:root {
    --bg: #07080c;
    --text: #f4f7fb;
    --muted: #9aa8bf;
    --accent: #f5a623;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    height: 100%;
    background: #07080c url('../img/play-bg.png') center center / cover no-repeat;
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.play-app {
    height: 100%;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    padding: clamp(12px, 1.6vh, 28px) clamp(20px, 2vw, 48px) clamp(10px, 1.4vh, 24px);
    background: linear-gradient(180deg, rgba(7, 8, 12, 0.42) 0%, rgba(7, 8, 12, 0.72) 100%);
}

.play-header {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: center;
    column-gap: clamp(12px, 1.6vw, 28px);
    margin-bottom: clamp(6px, 1vh, 14px);
    text-shadow: 0 2px 12px rgba(0,0,0,0.65);
    position: relative;
    z-index: 2;
}
.battle-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: clamp(8px, 1.5vw, 24px);
    align-items: center;
    min-width: 0;
    margin-bottom: clamp(8px, 1vh, 16px);
    padding: clamp(8px, 1vh, 14px) clamp(12px, 1.4vw, 22px);
    border: 1px solid rgba(245, 166, 35, 0.45);
    border-radius: 16px;
    background: rgba(7, 8, 12, 0.72);
    overflow: hidden;
}
.battle-board[hidden] {
    display: block;
    height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: hidden;
    visibility: hidden;
}
.battle-kicker {
    grid-column: 1 / -1;
    color: #f5a623;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: clamp(12px, 1.4vw, 16px);
    font-weight: 800;
}
.battle-side { min-width: 0; overflow: hidden; }
.battle-side.away { text-align: right; }
.battle-name {
    font-size: clamp(16px, 2vw, 28px);
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.battle-score {
    font-size: clamp(28px, 4vw, 56px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.battle-score.ready { color: #3ddc97; font-size: clamp(22px, 3vw, 40px); }
.battle-score.waiting { color: #ff8b84; font-size: clamp(22px, 3vw, 40px); }
.battle-score span { font-size: 0.45em; margin-left: 4px; color: #9aa8bf; }
.battle-vs { color: #9aa8bf; font-weight: 800; letter-spacing: 0.08em; }
.header-left { min-width: 0; }
.header-center { text-align: center; padding-top: 0; }
.header-right {
    min-width: 0;
    text-align: right;
    justify-self: end;
}
.clock {
    font-size: clamp(36px, 4.8vh, 64px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: #fff;
    line-height: 1;
}
.clock-urgent {
    color: #ff6b57;
    text-shadow: 0 0 24px rgba(255, 80, 60, 0.65);
}
.clock[hidden] { display: none !important; }
.brand { font-size: clamp(22px, 2vw, 36px); font-weight: 900; letter-spacing: 0.14em; }
.brand span { color: var(--accent); }
.status {
    font-size: clamp(13px, 1.1vw, 20px);
    color: var(--muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.25;
    max-width: 18vw;
}

.teams {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(14px, 1.6vw, 22px);
    align-content: start;
    align-items: start;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.team-card {
    background: rgba(14, 18, 28, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: clamp(16px, 1.8vh, 22px) clamp(18px, 1.6vw, 24px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    min-width: 0;
}
.team-name { font-size: clamp(22px, 2.2vw, 36px); font-weight: 800; margin-bottom: 2px; line-height: 1.1; }
.team-roster {
    font-size: clamp(14px, 1.3vw, 22px);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0 0 8px;
    line-height: 1.2;
}
.team-score { font-size: clamp(36px, 4.6vw, 64px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.team-score small { font-size: 0.35em; color: var(--muted); margin-left: 8px; }
.team-meta { margin: 8px 0; color: var(--muted); font-size: clamp(14px, 1.1vw, 18px); }
.bar { height: 14px; background: #0b0e14; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.latest { margin-top: 8px; font-size: 15px; color: var(--text); }
.team-dumps {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    max-height: 140px;
    overflow: auto;
}
.team-dumps li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 15px;
    color: #d5deee;
    padding: 3px 0;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.team-dumps strong { color: #fff; }

.play-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    min-height: 0;
}
.play-app.has-mock .play-bottom {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 22vw);
}
.play-app.has-mock .delivery-board { grid-column: 1; }
.play-app.has-mock .mock-dock { grid-column: 2; }
.delivery-board {
    margin-top: 0;
    background: rgba(14, 18, 28, 0.72);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 14px 18px;
    backdrop-filter: blur(10px);
    min-width: 0;
}
.delivery-board[hidden] { display: none !important; }
.delivery-board h2 {
    margin: 0 0 8px;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.delivery-list {
    display: grid;
    gap: 6px;
    max-height: min(18vh, 220px);
    overflow: auto;
}
.delivery-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto 1fr;
    gap: 12px;
    align-items: center;
    border-left: 4px solid var(--accent);
    padding: 4px 8px;
    font-size: 18px;
}
.delivery-g { font-weight: 800; font-variant-numeric: tabular-nums; }
.delivery-toward { color: var(--muted); }
.live-scale {
    margin-top: 8px;
    font-size: 14px;
    color: #c8d6ea;
    letter-spacing: 0.04em;
}

.ticker {
    font-size: clamp(16px, 1.4vw, 20px);
    color: #e8eef8;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.highs {
    margin-top: 6px;
    max-width: min(280px, 24vw);
    color: #d5deee;
    font-size: clamp(12px, 0.85vw, 15px);
    line-height: 1.35;
    text-align: left;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}
.highs strong {
    color: var(--text);
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.85em;
}

.video-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 30;
    display: grid;
    place-items: center;
}
.video-overlay[hidden] { display: none !important; }
.video-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    z-index: 1;
}
.video-hud {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 36px 48px 48px;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.82) 55%);
    text-align: center;
    pointer-events: none;
    text-shadow: 0 3px 18px rgba(0, 0, 0, 0.9);
}
.video-hud[hidden] { display: none !important; }
.hud-team {
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    font-size: clamp(18px, 2.4vw, 32px);
    font-weight: 800;
    margin-bottom: 8px;
}
.hud-type {
    font-size: clamp(42px, 7vw, 96px);
    font-weight: 900;
    line-height: 1;
    text-transform: uppercase;
}
.hud-grams {
    margin-top: 10px;
    font-size: clamp(28px, 4.5vw, 64px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #ffe7b0;
}
.hud-score {
    margin-top: 8px;
    font-size: clamp(18px, 2.6vw, 36px);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #d7e6ff;
}
.video-fallback {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(circle at center, #2a1b07, #050505);
    pointer-events: none;
}
.video-fallback[hidden] { display: none !important; }
.fallback-kicker { letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); font-size: 24px; }
.fallback-title { font-size: clamp(42px, 8vw, 110px); font-weight: 900; }
.fallback-detail { font-size: 32px; color: var(--muted); }

.key-gate {
    min-height: 100vh;
    display: grid;
    place-content: center;
    gap: 12px;
    text-align: center;
}
.key-gate input, .key-gate button {
    font: inherit;
    padding: 12px 16px;
    border-radius: 12px;
    border: 0;
}
.key-gate button { background: var(--accent); font-weight: 800; }

.mock-dock {
    position: static;
    z-index: 2;
    background: rgba(12, 14, 20, 0.92);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: start;
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    align-self: end;
}
.mock-dock button, .mock-dock select {
    background: #222;
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 8px 10px;
    cursor: pointer;
}
.mock-title { width: 100%; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mock-status { width: 100%; font-size: 12px; color: var(--muted); }
.mock-status.error { color: #ff8a7a; }

.service-overlay, .winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    background: rgba(5, 6, 10, 0.88);
}
.service-overlay[hidden], .winner-overlay[hidden] { display: none !important; }
.end-countdown {
    position: fixed;
    inset: 0;
    z-index: 36;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(5, 6, 10, 0.62);
    pointer-events: none;
    text-shadow: 0 8px 40px rgba(0, 0, 0, 0.85);
}
.end-countdown[hidden] { display: none !important; }
.end-countdown-kicker {
    font-size: clamp(18px, 2.2vw, 32px);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #ffb4a8;
    font-weight: 800;
    margin-bottom: clamp(8px, 1.2vh, 18px);
}
.end-countdown-number {
    font-size: clamp(120px, 28vh, 340px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    line-height: 0.85;
    color: #fff;
    animation: end-count-pulse 1s ease-in-out infinite;
}
@keyframes end-count-pulse {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.06); }
    100% { transform: scale(1); opacity: 0.92; }
}
.service-card, .winner-card {
    text-align: center;
    padding: 36px 48px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 28px;
    background: rgba(14, 18, 28, 0.92);
    max-width: 720px;
}
.winner-card {
    width: min(760px, calc(100vw - 32px));
}
.winner-title { font-size: clamp(32px, 6vw, 72px); font-weight: 900; margin: 8px 0 0; line-height: 1.05; }
.winner-total {
    margin: 8px 0 4px;
    font-size: clamp(36px, 6vw, 72px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: #ffe7b0;
}
.winner-detail { color: var(--muted); font-size: 22px; }
.winner-standings {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
    text-align: left;
}
.winner-standings li {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 4px solid var(--accent, #f5a623);
    background: rgba(8, 10, 16, 0.55);
    font-weight: 800;
}
.winner-standings .place { color: var(--accent, #f5a623); letter-spacing: 0.08em; text-transform: uppercase; }
.winner-standings .who { display: flex; flex-direction: column; gap: 2px; }
.winner-standings .who-roster {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 800;
}
.winner-standings .how-much { font-variant-numeric: tabular-nums; font-size: 22px; }
