* { box-sizing: border-box; margin: 0; padding: 0; touch-action: none; }
html, body {
    width: 100%; height: 100%;
    background: #0a3d0a;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#game-container {
    position: relative;
    width: 100vw; height: 100vh;
    background: #1a5c1a;
}
#pitch {
    display: block;
    width: 100%; height: 100%;
}
#ui {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    pointer-events: none;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
    z-index: 5;
}
#teams {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 520px;
    font-size: 0.95rem;
    text-transform: uppercase;
}
#team-name-red { color: #ff4444; }
#team-name-blue { color: #4488ff; }
#scoreboard {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 2rem;
    margin-top: 2px;
}
#score-red { color: #ff4444; }
#score-blue { color: #4488ff; }
#timer {
    font-size: 1.1rem;
    background: rgba(0,0,0,0.5);
    padding: 2px 12px;
    border-radius: 12px;
    margin-top: 2px;
}
#possession {
    font-size: 0.75rem;
    margin-top: 4px;
    opacity: 0.9;
}
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.82);
    color: #fff;
    text-align: center;
    z-index: 10;
    padding: 20px;
}
.overlay h1 { font-size: 2.4rem; margin-bottom: 8px; text-shadow: 4px 4px 0 #cc0000; }
.overlay h2 { font-size: 1.8rem; margin-bottom: 18px; text-shadow: 3px 3px 0 #cc0000; }
.slogan { font-size: 1.2rem; color: #ffea00; margin-bottom: 25px; font-weight: 700; }
.menu-buttons, .diff-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 320px;
}
.menu-buttons.compact {
    gap: 8px;
}
.menu-buttons.compact .menu-btn {
    padding: 10px 18px;
    font-size: 0.95rem;
}
.menu-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    width: 100%;
    max-width: 800px;
    margin-bottom: 10px;
}
.menu-section {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,234,0,0.3);
    border-radius: 12px;
    padding: 14px;
}
.menu-section h3 {
    font-size: 1rem;
    color: #ffea00;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0 #000;
}
.menu-btn, .diff-btn, .back-btn {
    padding: 14px 28px;
    font-size: 1.15rem;
    font-weight: 900;
    border: 4px solid #000;
    cursor: pointer;
    transition: transform 0.05s, box-shadow 0.05s;
    text-transform: uppercase;
}
.menu-btn {
    background: #ffea00;
    color: #000;
    box-shadow: 5px 5px 0 #cc0000;
}
.diff-btn:nth-child(1) { background: #6bc952; color: #000; box-shadow: 5px 5px 0 #1a5c1a; }
.diff-btn:nth-child(2) { background: #ff9800; color: #000; box-shadow: 5px 5px 0 #cc0000; }
.diff-btn:nth-child(3) { background: #cc0000; color: #fff; box-shadow: 5px 5px 0 #ffea00; }
.back-btn {
    margin-top: 20px;
    background: #333;
    color: #fff;
    border: 3px solid #fff;
    box-shadow: 3px 3px 0 #000;
    font-size: 0.95rem;
}
.menu-btn:active, .diff-btn:active, .back-btn:active {
    transform: translateY(3px);
    box-shadow: 1px 1px 0 #000;
}
.controls-hint {
    margin-top: 22px;
    font-size: 0.8rem;
    opacity: 0.8;
    max-width: 400px;
}
.hidden { display: none !important; }
.team-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 360px;
    margin-bottom: 10px;
}
.team-btn {
    padding: 14px 10px;
    font-size: 1rem;
    font-weight: 900;
    border: 4px solid #000;
    cursor: pointer;
    background: #ffea00;
    color: #000;
    box-shadow: 4px 4px 0 #cc0000;
    text-transform: uppercase;
}
.team-btn:active {
    transform: translateY(3px);
    box-shadow: 1px 1px 0 #000;
}
.team-btn.selected {
    background: #cc0000;
    color: #fff;
    box-shadow: 4px 4px 0 #ffea00;
}
#formation-grid, #tactic-grid {
    max-width: 420px;
}
#formation-grid .team-btn, #tactic-grid .team-btn {
    font-size: 0.85rem;
    padding: 10px 6px;
}

#help ul {
    text-align: left;
    max-width: 420px;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}
#help li { margin-bottom: 8px; }

#bracket {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}
.bracket-match {
    background: rgba(255,255,255,0.1);
    border: 2px solid #ffea00;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 140px;
}
.bracket-team { display: flex; justify-content: space-between; }
.bracket-winner { color: #ffea00; font-weight: 900; }
#cup-status { font-size: 1rem; margin-bottom: 12px; color: #ffea00; }

.standings-list, #liga-calendar, .survival-info {
    background: rgba(255,255,255,0.08);
    border: 2px solid #ffea00;
    border-radius: 8px;
    padding: 14px;
    min-width: 260px;
    max-width: 520px;
    width: 100%;
    font-size: 0.9rem;
    max-height: 50vh;
    overflow-y: auto;
    margin-bottom: 14px;
}
.standing-row {
    display: grid;
    grid-template-columns: 30px 1fr 40px 40px 40px 50px;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    align-items: center;
}
.standing-row:last-child { border-bottom: none; }
.standing-row.user { background: rgba(255,234,0,0.15); }
.standing-row .pts { font-weight: 900; color: #ffea00; }
.calendar-match {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.calendar-match:last-child { border-bottom: none; }
.calendar-match.played { opacity: 0.7; }
.calendar-match.current { color: #ffea00; font-weight: 900; }

#records-list {
    background: rgba(255,255,255,0.08);
    border: 2px solid #ffea00;
    border-radius: 8px;
    padding: 14px;
    min-width: 260px;
    max-width: 360px;
    font-size: 0.95rem;
}

.audio-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: rgba(255,255,255,0.08);
    border: 2px solid #ffea00;
    border-radius: 8px;
    padding: 20px;
    min-width: 220px;
    margin-bottom: 20px;
}
.audio-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}
.audio-row input { width: 22px; height: 22px; }

#commentator {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    border: 3px solid #ffea00;
    border-radius: 10px;
    padding: 10px 22px;
    color: #ffea00;
    font-size: 1.4rem;
    font-weight: 900;
    text-shadow: 2px 2px 0 #cc0000;
    text-align: center;
    z-index: 8;
    pointer-events: none;
    transition: opacity 0.2s;
    max-width: 80vw;
}
#commentator.red { color: #ff4444; border-color: #ff4444; }
#commentator.blue { color: #4488ff; border-color: #4488ff; }

#goal-scorer {
    position: absolute;
    top: 34%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 2px 2px 0 #000;
    z-index: 7;
    pointer-events: none;
}

#survival-hud {
    position: absolute;
    top: 86px;
    background: rgba(0,0,0,0.55);
    padding: 4px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #ffea00;
}

#pause { background: rgba(0,0,0,0.88); }
.record-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}
.record-row:last-child { border-bottom: none; }

#goal { background: rgba(0,0,0,0.65); }
#goal-title { animation: pulse 0.6s infinite alternate; }
#goal-quote {
    font-size: 1.2rem;
    color: #ffea00;
    max-width: 480px;
    margin-top: 12px;
    font-weight: 700;
}
@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

#match-end h2 { font-size: 2.2rem; }
#end-score { font-size: 1.8rem; margin-bottom: 20px; }

#controls-mobile {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
}
#stick-zone {
    position: absolute;
    left: 20px; bottom: 20px;
    width: 140px; height: 140px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 3px solid rgba(255,255,255,0.35);
    pointer-events: auto;
}
#stick {
    position: absolute;
    left: 50%; top: 50%;
    width: 58px; height: 58px;
    margin: -29px 0 0 -29px;
    border-radius: 50%;
    background: rgba(255,234,0,0.85);
    border: 3px solid #000;
}
.mobile-btn {
    position: absolute;
    width: 64px; height: 64px;
    border-radius: 50%;
    border: 3px solid #fff;
    font-size: 1.4rem;
    pointer-events: auto;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
}
.mobile-btn.active { transform: scale(0.95); filter: brightness(1.2); }
#btn-action {
    right: 25px; bottom: 35px;
    width: 90px; height: 90px;
    background: #cc0000;
    color: #fff;
    font-size: 2rem;
}
#btn-action.active { background: #ff3333; transform: scale(0.96); }
#btn-pass {
    right: 120px; bottom: 115px;
    background: #4488ff;
    color: #fff;
}
#btn-tackle {
    right: 120px; bottom: 35px;
    background: #ff9800;
    color: #000;
}
#btn-sprint {
    right: 25px; bottom: 140px;
    background: #ffea00;
    color: #000;
}
#charge-bar {
    position: absolute;
    right: 25px; bottom: 240px;
    width: 90px; height: 10px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #fff;
    border-radius: 5px;
    overflow: hidden;
    display: none;
}
#charge-fill {
    width: 0%; height: 100%;
    background: linear-gradient(90deg, #ffea00, #cc0000);
}
#stamina-bar {
    position: absolute;
    right: 25px; bottom: 225px;
    width: 90px; height: 8px;
    background: rgba(0,0,0,0.4);
    border: 2px solid #fff;
    border-radius: 4px;
    overflow: hidden;
    display: none;
}
#stamina-fill {
    width: 100%; height: 100%;
    background: linear-gradient(90deg, #00c853, #ffea00, #cc0000);
}

#controls-list {
    background: rgba(255,255,255,0.08);
    border: 2px solid #ffea00;
    border-radius: 8px;
    padding: 14px;
    min-width: 260px;
    max-width: 360px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 0.95rem;
    margin-bottom: 10px;
}
.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    cursor: pointer;
}
.control-row:last-child { border-bottom: none; }
.control-row.listening { background: rgba(255,234,0,0.2); }
.control-key {
    background: #333;
    border: 2px solid #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 900;
    min-width: 70px;
    text-align: center;
}
#tutorial-progress { margin: 20px 0; }

@media (hover: none) and (pointer: coarse) {
    #controls-mobile { display: block; }
    #stamina-bar { display: block; }
}
@media (max-height: 420px) {
    .overlay h1 { font-size: 1.8rem; }
    .overlay h2 { font-size: 1.4rem; }
    .menu-btn, .diff-btn { padding: 10px 20px; font-size: 1rem; }
}
