html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: transparent; }
[hidden] { display: none !important; }
body { color: var(--ui-text); font-size: 16px; }
#app { width: 100%; height: 100%; padding: clamp(14px, 1.7vw, 30px); }
#app.is-empty { visibility: hidden; }
.screen { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.screen-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 0 4px; }
.brand-kicker { color: var(--ui-accent); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.brand-title { margin: 2px 0 0; color: var(--ui-text); font-size: clamp(23px, 2vw, 34px); font-weight: 800; line-height: 1.05; }
.head-metrics { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: end; }
.metric-pill { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--ui-stroke); border-radius: 14px; background: linear-gradient(180deg, #262626, #191919); color: var(--ui-text); font-size: 15px; font-weight: 750; box-shadow: 0 8px 24px #0003; }
.metric-label { color: var(--ui-muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.lives { color: var(--ui-red); font-size: 20px; letter-spacing: 2px; white-space: nowrap; }
.status-pill { color: var(--ui-accent); }
.field-layout { display: flex; align-items: stretch; justify-content: space-between; gap: clamp(16px, 1.7vw, 32px); min-height: 0; }
.side-left .field-layout { flex-direction: row-reverse; }
.board-card { position: relative; flex: 0 0 auto; padding: 13px; border: 1px solid #3e3e3e; border-radius: 22px; background: linear-gradient(160deg, #262626 0%, #191919 72%); box-shadow: 0 20px 48px #0005, inset 0 1px #ffffff0a; }
.grid-scroll { overflow: visible; }
table.grid { border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.grid th { width: var(--cell); height: calc(var(--cell) * .46); padding: 0; color: var(--ui-muted); font-size: max(12px, calc(var(--cell) * .29)); font-weight: 800; line-height: 1; text-align: center; }
.grid th.row-axis { width: max(24px, calc(var(--cell) * .48)); }
.grid td { position: relative; width: var(--cell); height: var(--cell); padding: 0; overflow: hidden; border: 1px solid #3a3a3a; border-radius: 9px; background: linear-gradient(160deg, #686868, #585858); color: var(--ui-text); font-size: calc(var(--cell) * .48); font-weight: 850; line-height: 1; text-align: center; box-shadow: inset 0 1px #ffffff1f; }
.grid td.closed::before { position: absolute; top: 5px; right: 7px; left: 7px; height: 2px; border-radius: 2px; background: #c6c6c670; content: ''; }
.grid td.open { border-color: #c9c9c9; border-radius: 7px; background: var(--ui-cell-open); box-shadow: inset 0 1px #fff8; }
.grid td.flagged { background: linear-gradient(160deg, #727272, #5e5e5e); }
.grid td.flag-wrong { border-color: #a64a53; background: #332b32; }
.grid td.exploded { border-color: #ff9b98; background: linear-gradient(145deg, #f15c64, #d73548); box-shadow: 0 0 20px #f14e5d80, inset 0 1px #fff7; }
.grid td.exploded { display: grid; place-items: center; }
.exploded-avatar { --avatar-size: calc(var(--cell) * .68); z-index: 1; box-shadow: 0 1px 5px #0008, inset 0 0 0 1px #ffffff80; }
.exploded-bomb { position: absolute; z-index: 2; top: 2px; right: 2px; width: 25%; height: 25%; filter: drop-shadow(0 1px 2px #0009); }
.explosion-callout { position: absolute; z-index: 10; display: flex; align-items: center; gap: 9px; max-width: min(240px, 38vw); padding: 7px 13px 7px 8px; border: 1px solid #ff9b98; border-radius: 999px; background: linear-gradient(135deg, #32191f, #1b1b1b); color: #fff5f2; box-shadow: 0 8px 28px #000a, 0 0 18px #e5485480; font-size: 15px; font-weight: 850; line-height: 1.1; white-space: nowrap; pointer-events: none; transform: translate(-50%, -50%); animation: explosion-callout-in 180ms ease-out both; }
.explosion-callout .avatar { --avatar-size: 30px; border: 1px solid #ffffff80; }
.explosion-callout-name { overflow: hidden; text-overflow: ellipsis; }
@keyframes explosion-callout-in { from { opacity: 0; scale: .9; } to { opacity: 1; scale: 1; } }
.grid td.mine-revealed { border-color: #8d2734; background: #7d303b; color: #fff0e8; }
.bomb-icon { width: 56%; height: 56%; vertical-align: middle; }
.flag-icon { width: 54%; height: 54%; vertical-align: middle; color: var(--ui-gold); }
.cross-icon { width: 52%; height: 52%; color: #ff8d98; vertical-align: middle; }
.n1 { color: #2877d2 !important; } .n2 { color: #23915b !important; } .n3 { color: #d45146 !important; } .n4 { color: #624ec6 !important; }
.n5 { color: #aa442f !important; } .n6 { color: #218c95 !important; } .n7 { color: #303030 !important; } .n8 { color: #626262 !important; }
.board-hint { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px 16px; margin: 12px 6px 1px; color: var(--ui-text); font-size: max(18px, calc(var(--cell) * .38)); font-weight: 800; line-height: 1.25; text-align: center; }
.hint-item { display: inline-flex; align-items: center; gap: 7px; }
.hint-key { padding: 2px 8px; border: 1px solid #b9a3ff70; border-radius: 7px; background: #b9a3ff12; color: var(--ui-accent); font-variant-numeric: tabular-nums; }
.side-column { display: flex; flex: 0 1 clamp(300px, 25vw, 430px); flex-direction: column; gap: 12px; min-width: 285px; max-width: 430px; }
.side-card { min-width: 0; padding: 15px 17px; border: 1px solid var(--ui-stroke); border-radius: 18px; background: linear-gradient(180deg, #262626, #191919); box-shadow: 0 12px 28px #0003; }
.side-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; color: var(--ui-text); font-size: 13px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--ui-accent); font-size: 10px; letter-spacing: .12em; }
.live-dot::before { width: 7px; height: 7px; border-radius: 50%; background: var(--ui-accent); box-shadow: 0 0 9px #b9a3ff90; content: ''; }
.player-list, .hospital-list, .event-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.player-row { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; min-height: 34px; padding: 3px 7px; border-radius: 10px; }
.player-row.is-viewer { background: #b9a3ff12; }
.rank { color: var(--ui-muted); font-size: 11px; font-weight: 800; }
.player-name { display: flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; font-size: 13px; font-weight: 750; }
.player-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { color: var(--ui-accent); font-size: 14px; font-weight: 850; }
.explosions { color: var(--ui-muted); font-size: 11px; white-space: nowrap; }
.hospital-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 28px; color: #dbdbdb; font-size: 13px; }
.hospital-name { display: flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; }
.hospital-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hospital-timer { flex: 0 0 auto; color: var(--ui-gold); font-weight: 850; font-variant-numeric: tabular-nums; }
.empty-note { color: var(--ui-muted); font-size: 12px; }
.event-row { display: grid; grid-template-columns: 7px 1fr; gap: 8px; align-items: start; padding: 5px 0; border-bottom: 1px solid #3e3e3e80; font-size: 12px; line-height: 1.35; }
.event-row:last-child { border-bottom: 0; }
.event-mark { width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--ui-accent); }
.event-row[data-kind="explode"] .event-mark { background: var(--ui-red); }
.event-row[data-kind="flag"] .event-mark { background: var(--ui-gold); }
.event-row[data-kind="blocked"] .event-mark { background: #a0a0a0; }
.event-copy { min-width: 0; overflow-wrap: anywhere; }
.countdown-cover { position: absolute; inset: 13px; display: grid; place-items: center; border-radius: 15px; background: #0f0f0fb8; backdrop-filter: blur(5px); }
.countdown-number { color: var(--ui-accent); font-size: clamp(90px, 13vw, 210px); font-weight: 850; line-height: 1; text-shadow: 0 0 45px #b9a3ff55; }
.screen.results-screen { align-items: center; }
.results-heading { width: min(1320px, 94vw); display: flex; justify-content: space-between; align-items: end; margin-bottom: 4px; }
.results-title { margin: 5px 0 0; font-size: clamp(28px, 3vw, 48px); font-weight: 850; }
.result-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.result-stat { min-width: 120px; padding: 11px 14px; border: 1px solid var(--ui-stroke); border-radius: 14px; background: var(--ui-bg); }
.result-stat strong { display: block; color: var(--ui-accent); font-size: 21px; }
.result-stat span { color: var(--ui-muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.results-grid { width: min(1320px, 94vw); display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.results-card { min-width: 0; padding: 20px; border: 1px solid var(--ui-stroke); border-radius: 22px; background: linear-gradient(180deg, #262626f5, #191919f8); box-shadow: 0 20px 44px #0004; }
.results-card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 850; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table th { padding: 8px 7px; color: var(--ui-muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-align: left; text-transform: uppercase; }
.results-table td { padding: 8px 7px; border-top: 1px solid #3e3e3e80; font-size: 13px; }
.results-table td.num, .results-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.result-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.delta { display: inline-block; margin-left: 6px; color: var(--ui-accent); font-size: 11px; font-weight: 850; }
.delta.negative { color: #ff8992; }
.result-row-enter { animation: row-enter 360ms cubic-bezier(.2,.75,.25,1) both; }
@keyframes row-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tile-open { 0% { opacity: .55; transform: scale(.78); filter: brightness(1.5); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); filter: brightness(1); } }
@keyframes board-hit { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.board-hit { animation: board-hit 240ms ease-out; }
@media (max-width: 1050px) {
  #app { padding: 10px; }
  .screen { gap: 8px; }
  .field-layout { gap: 8px; }
  .side-column { min-width: 220px; flex-basis: 30vw; }
  .side-card { padding: 10px; }
  .side-title { font-size: 11px; }
  .event-row { font-size: 10px; }
  .player-row { grid-template-columns: 20px minmax(0,1fr) auto; gap: 5px; }
  .explosions { display: none; }
}
@media (max-height: 760px) {
  #app { padding: 8px; }
  .screen { gap: 6px; }
  .screen-head { gap: 10px; }
  .brand-title { font-size: 22px; }
  .metric-pill { min-height: 34px; padding: 5px 9px; font-size: 12px; }
  .side-column { gap: 6px; }
  .side-card { padding: 8px 10px; }
  .side-title { margin-bottom: 5px; }
  .player-list, .hospital-list, .event-list { gap: 1px; }
  .player-row { min-height: 26px; }
  .event-row { padding: 3px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .result-row-enter, .board-hit, .explosion-callout { animation: none; }
}

/* Заголовки лежат прямо на видео стрима: без подложки текст сливается с картинкой игры. */
.screen-head > div:first-child,
.results-heading > div:first-child {
  padding: 10px 18px 12px;
  border: 1px solid var(--ui-stroke);
  border-radius: 16px;
  background: linear-gradient(180deg, #262626, #191919);
  box-shadow: 0 10px 24px #0004;
}
.brand-title, .results-title { text-shadow: 0 2px 8px #0008; }

/* ——— Командный режим ——— */
[data-team="red"] { --team: #ff5d5d; --team-soft: #ff5d5d24; }
[data-team="blue"] { --team: #4f9dff; --team-soft: #4f9dff24; }
[data-team="draw"] { --team: #c9c9c9; --team-soft: #c9c9c91f; }

.pick-columns { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2vw, 36px); min-height: 0; flex: 1 1 auto; max-height: 72vh; }
.pick-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 0; padding: 26px 22px; border: 2px solid var(--team); border-radius: 26px; background: linear-gradient(180deg, #262626, #191919); box-shadow: 0 0 0 6px var(--team-soft), 0 20px 48px #0005; }
.pick-key { padding: 4px 22px; border-radius: 16px; background: var(--team); color: #111; font-size: clamp(42px, 5vw, 86px); font-weight: 850; line-height: 1.15; }
.pick-name { margin: 6px 0 0; color: var(--team); font-size: clamp(28px, 2.6vw, 46px); font-weight: 850; }
.pick-count { color: var(--ui-text); font-size: 22px; font-weight: 800; }
.pick-list { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 8px; width: 100%; margin: 6px 0 0; padding: 0; overflow: hidden; list-style: none; }
.pick-list li { display: flex; align-items: center; gap: 7px; max-width: 220px; padding: 5px 12px 5px 5px; border: 1px solid #3e3e3e; border-radius: 999px; background: #1b1b1b; font-size: 15px; font-weight: 750; animation: row-enter 260ms ease-out both; }
.pick-list li.empty-note { border: 0; background: none; }
.pick-list li.seen { animation: none; }
.pick-hint { font-size: 22px; }

.teams-layout { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(14px, 1.6vw, 30px); min-height: 0; }
.team-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.team-bar { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 16px; border: 2px solid var(--team); border-radius: 16px; background: linear-gradient(180deg, #262626, #191919); box-shadow: 0 8px 24px #0004; }
.team-name { margin-right: auto; color: var(--team); font-size: clamp(20px, 1.6vw, 28px); font-weight: 850; }
.team-stat { display: flex; align-items: baseline; gap: 6px; }
.team-stat strong { color: var(--ui-text); font-size: 20px; font-variant-numeric: tabular-nums; }
.team-stat:first-of-type strong { color: var(--team); font-size: 26px; }
.team-board { border-color: var(--team); box-shadow: 0 0 0 3px var(--team-soft), 0 20px 48px #0005; }
.team-col.is-out .team-board table { filter: grayscale(.8) brightness(.7); }
.team-col.is-winner .team-board { box-shadow: 0 0 0 5px var(--team), 0 0 40px var(--team-soft); }
.team-cover { position: absolute; inset: 13px; display: grid; place-items: center; border-radius: 15px; background: #0f0f0fa8; pointer-events: none; }
.team-cover-text { padding: 10px 22px; border: 2px solid var(--team); border-radius: 14px; background: #191919; color: var(--team); font-size: clamp(22px, 2vw, 34px); font-weight: 850; }
.team-cover .countdown-number { color: var(--team); text-shadow: 0 0 45px var(--team-soft); }
.team-top { display: flex; justify-content: center; gap: 8px; width: 100%; margin: 0; padding: 0; list-style: none; }
.team-top li { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 33%; padding: 5px 12px 5px 5px; border: 1px solid #3e3e3e; border-radius: 999px; background: linear-gradient(180deg, #262626, #191919); font-size: 14px; font-weight: 750; }
.team-top .score { color: var(--team); }
.teams-hint { margin-top: 2px; }

.result-stat[data-team] strong { color: var(--team); }
.results-table tr[data-team] td:first-child { box-shadow: inset 4px 0 var(--team); }
.team-banner { display: flex; align-items: baseline; justify-content: center; gap: 22px; width: min(1320px, 94vw); padding: 14px 24px; border: 2px solid var(--team); border-radius: 20px; background: linear-gradient(180deg, #262626, #191919); box-shadow: 0 0 0 5px var(--team-soft), 0 20px 44px #0004; animation: row-enter 420ms ease-out both; }
.team-banner-title { color: var(--team); font-size: clamp(28px, 2.6vw, 44px); font-weight: 850; }
.team-banner-score { font-size: clamp(28px, 2.6vw, 44px); font-weight: 850; font-variant-numeric: tabular-nums; }
.team-banner-score [data-team] { color: var(--team); }
.team-banner-note { color: var(--ui-muted); font-size: 15px; font-weight: 750; }
@media (prefers-reduced-motion: reduce) { .pick-list li, .team-banner { animation: none; } }

/* ——— Игра в слова ——— */
.words-layout { flex: 1 1 auto; min-height: 0; }
.words-card { display: flex; flex: 1 1 auto; flex-direction: column; gap: 10px; min-width: 0; max-width: 1200px; padding: 16px 18px; }
.words-last { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 14px; border: 1px solid #3e3e3e; border-radius: 14px; background: #1b1b1b; }
.words-last-label { color: var(--ui-muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.words-last-word { padding: 3px 14px; border-radius: 10px; background: var(--c, #4a4a4a); color: #111; font-size: 26px; font-weight: 850; }
.words-last-word.is-unknown { background: none; color: var(--ui-muted); text-decoration: line-through; }
.words-last .word-who { margin-left: auto; }
.words-record { color: var(--ui-accent); font-weight: 850; }
.words-points { color: var(--ui-accent); font-size: 18px; font-weight: 850; }
.words-top { display: grid; flex: 1 1 auto; grid-template-rows: repeat(20, minmax(0, 1fr)); gap: 5px; min-height: 0; margin: 0; padding: 0; list-style: none; }
.word-row { position: relative; display: flex; align-items: center; gap: 14px; min-height: 0; padding: 0 14px; overflow: hidden; border: 1px solid #3e3e3e; border-radius: 10px; background: #222; font-size: clamp(16px, 1.4vw, 24px); font-weight: 800; }
.word-bar { position: absolute; inset: 0 auto 0 0; width: var(--fill); background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 75%, #000)); opacity: .9; }
.word-row > :not(.word-bar) { position: relative; }
.word-rank { min-width: 64px; color: #fff; font-size: .85em; text-shadow: 0 1px 3px #000a; }
.word-text { flex: 1 1 auto; min-width: 0; overflow: hidden; color: #fff; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 3px #000a; }
.word-who { display: flex; align-items: center; gap: 8px; max-width: 34%; color: #e2e2e2; font-size: .7em; font-weight: 750; text-shadow: 0 1px 3px #000a; }
.word-row.is-win { border-color: #3ddc84; box-shadow: 0 0 22px #3ddc8466; }
.words-empty { grid-row: 1 / span 20; align-self: center; justify-self: center; font-size: 18px; }
.words-unknown { font-size: 18px; }
.words-hint { margin-top: 0; }
.words-win { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 22px; background: #0f0f0fd0; }
.words-win-card { display: grid; justify-items: center; gap: 12px; padding: 34px 54px; border: 2px solid #3ddc84; border-radius: 24px; background: linear-gradient(180deg, #262626, #191919); box-shadow: 0 0 0 6px #3ddc8422, 0 24px 60px #0008; }
.words-win-word { color: #3ddc84; font-size: clamp(56px, 6vw, 110px); font-weight: 850; line-height: 1.05; }
.words-win-who { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 850; }
.win-avatar { --avatar-size: 46px; }
.legend-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: #dbdbdb; }
.legend-list li { display: flex; align-items: center; gap: 9px; }
.legend-list span { width: 26px; height: 12px; border-radius: 4px; background: var(--c); }
.legend-list .legend-none { border: 1px solid #555; background: none; }
