:root {
  --bg: #0b1017; --panel: #121a24; --panel2: #16202b; --line: #243240; --text: #eff3f8; --muted: #8fa0b1;
  --orange: #ff8546; --mint: #9ee6cd; --miss: #2a3a4a; --red: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 16px/1.4 Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.warn { color: var(--orange); }

/* Сцена 1920×1080 масштабируется под экран целиком (app.js → fit). */
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; padding: 26px 42px 30px;
  display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(1200px 700px at 75% 40%, #1a2018 0%, transparent 60%), radial-gradient(900px 600px at 100% 100%, #2a1c14 0%, transparent 60%), var(--bg); }
#screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#screen > div { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.top { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; gap: 12px; align-items: center; }
.logo b { display: block; font-size: 14px; line-height: 1.05; letter-spacing: .08em; font-weight: 900; }
.logo small { display: block; font-size: 9px; letter-spacing: .45em; color: var(--muted); margin-top: 4px; }
.logo-ball { width: 38px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffb07a, var(--orange) 45%, #c4501c); }
.top-right { display: flex; gap: 28px; align-items: center; }
.tagline { font-size: 12px; letter-spacing: .18em; color: var(--muted); }
.pill { font-size: 12px; font-weight: 800; letter-spacing: .12em; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); }
.pill.idle { color: var(--orange); border-color: #6a3a20; background: #ff854612; }
.pill.live { color: var(--mint); border-color: #2f5a4b; background: #9ee6cd10; }
.pill.done { color: var(--text); }
.pill.off { color: var(--red); border-color: #6a2a2a; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .5; } }

.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .2em; color: var(--muted); }
.label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted); }
.acc { color: var(--mint); }
.chip-mint { font-size: 12px; color: var(--mint); border: 1px solid #2f5a4b; background: #9ee6cd10; padding: 6px 10px; border-radius: 6px; }

.screen-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 18px 0 18px; }
.screen-head h1 { font-size: 30px; letter-spacing: -.02em; margin-top: 6px; }
.screen-head .sub { color: var(--muted); font-size: 14px; margin-top: 8px; }
.head-right { text-align: right; font-size: 14px; }
.head-right b { font-size: 22px; }
.head-right p + p { margin-top: 6px; }
.record-badge { font-size: 12px; color: var(--orange); border: 1px solid #6a3a20; background: #ff854618; padding: 8px 12px; border-radius: 6px; }

.panel { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 20px 24px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-head h2 { font-size: 17px; }
.panel-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.panel-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.lg-made::before { content: "●"; color: var(--orange); margin-right: 5px; }
.lg-miss::before { content: "○"; margin-right: 5px; }

.stat { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.stat b { display: block; font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 6px; }
.stat > small { font-size: 12px; color: var(--muted); }

/* ---------- площадка ---------- */
.map-panel { display: flex; flex-direction: column; }
.court { position: relative; flex: 1; min-height: 0; margin: 8px 0 12px; container-type: size; }
.court-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(100cqw, calc(100cqh * 1584 / 870)); aspect-ratio: 1584 / 870; border-radius: 10px; overflow: hidden; }
.boards text { fill: #f4f6f8; font-weight: 800; letter-spacing: .12em; font-family: Inter, system-ui, sans-serif; }
.court-box svg { display: block; width: 100%; height: 100%; }
.pin { position: absolute; transform: translate(-50%, -22px); display: flex; flex-direction: column; align-items: center; gap: 5px; }
.num { font-style: normal; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; font-weight: 800; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff9c5e, #e4572e 60%, #b23a18); border: 2px solid #ffd2b8; box-shadow: 0 6px 14px #0009; }
.pin.empty .num { background: radial-gradient(circle at 35% 30%, #5b6978, #34414e); border-color: #8796a5; }
.pin.last .num { animation: ring 1.8s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 #ff8546cc, 0 6px 14px #0009; } 100% { box-shadow: 0 0 0 18px #ff854600, 0 6px 14px #0009; } }
.pin.best .num { border-color: var(--mint); }
.tag { background: #0a0f15e8; border: 1px solid #3a4b5c; border-radius: 6px; padding: 4px 9px; text-align: center; line-height: 1.2; }
.tag b { display: block; font-size: 16px; }
.tag .nm, .tag small { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; }
.pin.last .tag { border-color: var(--orange); }
.pin.best .tag { border-color: var(--mint); }
.best-tag { font-size: 10px; color: var(--mint); letter-spacing: .04em; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.badge { position: absolute; left: calc(50% + 14px); top: -14px; font-style: normal; font-weight: 800; font-size: 13px; padding: 2px 8px; border-radius: 6px; animation: pop 4s ease forwards; }
.badge.hit { background: #3ddc84; color: #06210f; }
.badge.miss { background: #34485c; color: var(--text); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 8% { transform: scale(1.25); opacity: 1; } 15%, 80% { transform: scale(1); opacity: 1; } 100% { opacity: 0; } }
.last-card, .points-table { display: none; }

/* ---------- графики ---------- */
#timeline { flex: 1; min-height: 0; margin: 6px 0; }
.chart { width: 100%; height: 100%; display: block; }
.ch-title { fill: #c8d2dc; font-size: 11px; letter-spacing: .04em; }
.ch-axis { fill: var(--muted); font-size: 10px; }
.ch-val { fill: var(--text); font-size: 11px; }
.ch-grid { stroke: #ffffff10; stroke-dasharray: 2 4; }
.bar-made { fill: var(--orange); }
.bar-miss { fill: var(--miss); stroke: #4a5d70; }
.bar-current { fill: none; stroke: var(--mint); stroke-dasharray: 3 3; }
.acc-line { fill: none; stroke: var(--mint); stroke-width: 2.5; }
.acc-dot { fill: var(--mint); }
.now-line { stroke: #c8d2dc; stroke-dasharray: 3 3; }
.now-label { fill: var(--text); font-size: 10px; }

/* ---------- IDLE ---------- */
.idle { position: relative; }
.idle-copy { position: absolute; left: 28px; top: 110px; }
.idle .eyebrow { color: var(--orange); }
.idle h1 { font-size: 118px; line-height: .96; font-weight: 900; letter-spacing: -.02em; margin: 28px 0 44px; }
.idle h1 span { color: var(--orange); }
.idle-lead { font-size: 19px; color: #c2cdd8; line-height: 1.5; }
.features { display: flex; gap: 0; list-style: none; padding: 0; margin: 46px 0 0; font-size: 12px; color: #c2cdd8; line-height: 1.5; }
.features li { border-left: 1px solid var(--line); padding: 0 24px 0 14px; }
.features b { display: block; color: var(--orange); font: 600 12px ui-monospace, Menlo, monospace; margin-bottom: 10px; }
/* Промофото заказчика (public/promo.jpg): если файл есть — заменяет нарисованный мяч. */
.idle-photo { position: absolute; right: -42px; top: -100px; width: 58%; height: calc(100% + 130px); object-fit: cover;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 30%), linear-gradient(to bottom, transparent, #000 18%);
  -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 30%), linear-gradient(to bottom, transparent, #000 18%); mask-composite: intersect; }
.idle-bottom p, .top-right { text-shadow: 0 1px 6px #000; }
.idle:has(.idle-photo) .idle-art { display: none; }
.idle-art { position: absolute; right: 120px; top: 70px; width: 640px; height: 640px; }
.ring { position: absolute; border-radius: 50%; border: 1px solid #ffffff1c; inset: 0; }
.ring.r2 { inset: 30px; border-color: #ffffff12; }
.ring.r3 { inset: 62px; border-style: dashed; border-color: #ffffff16; animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ball { position: absolute; inset: 105px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #ffc08a, #f0803f 40%, #c4501c 75%, #8e3510); box-shadow: 0 40px 80px #0009, inset -30px -40px 80px #0005; }
.ball svg { width: 100%; height: 100%; animation: spin 40s linear infinite; }
.orbit-dot { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; border: 1px solid #3a4856; background: var(--bg);
  display: grid; place-items: center; font: 11px ui-monospace, Menlo, monospace; color: var(--muted); }
.orbit-label { position: absolute; left: 50%; bottom: -20px; transform: translateX(-30%); font: 11px ui-monospace, Menlo, monospace; color: var(--muted); letter-spacing: .1em; }
.orbit-label i { font-style: normal; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #3a4856; margin-right: 8px; }
.ready-chip { position: absolute; left: -150px; top: 140px; transform: rotate(-6deg); font: 11px ui-monospace, Menlo, monospace; color: #c8d2dc;
  background: #172230; border: 1px solid #33475a; border-radius: 8px; padding: 12px 18px; }
.plus-card { position: absolute; right: -60px; bottom: 30px; transform: rotate(4deg); background: #172230; border: 1px solid #33475a; border-radius: 10px; padding: 14px 20px; animation: float 4s ease-in-out infinite; }
.plus-card b { display: block; font-size: 48px; color: var(--mint); font-weight: 500; line-height: 1; }
.plus-card small { font-size: 10px; letter-spacing: .2em; color: #c8d2dc; }
@keyframes float { 50% { transform: rotate(4deg) translateY(-10px); } }
.idle-bottom { position: absolute; left: 28px; right: 28px; bottom: 60px; border-top: 1px solid var(--line); padding-top: 30px; display: flex; justify-content: space-between; align-items: center; }
.cta { display: flex; align-items: center; gap: 14px; font-size: 30px; font-weight: 700; }
.cta-dot { width: 22px; height: 22px; border-radius: 50%; background: #ff854633; display: grid; place-items: center; animation: pulse 1.6s infinite; }
.cta-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px #ff854600, 0 0 0 0 #ff854660; } 0% { box-shadow: 0 0 0 0 #ff854660; } }
.idle-bottom p { text-align: right; font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ---------- LIVE ---------- */
.live-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1044px 1fr; gap: 20px; }
.live-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.score-timer { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.score-timer > div { padding: 18px 22px; }
.score { background: linear-gradient(135deg, #2a221d, var(--panel)); border-right: 1px solid var(--line); }
.timer { background: linear-gradient(180deg, var(--panel2), var(--panel)); }
.score b { display: block; font-size: 72px; line-height: 1.05; font-weight: 900; color: var(--orange); margin: 6px 0; }
.timer b { display: block; font: 700 58px/1.2 ui-monospace, Menlo, monospace; margin: 6px 0 4px; }
.score-timer small { font-size: 12px; color: var(--muted); }
.bar { height: 3px; background: #2a3846; margin-bottom: 10px; }
.bar i { display: block; height: 100%; background: var(--orange); transition: width .25s linear; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.types { font-size: 13px; color: #c8d2dc; display: flex; gap: 8px; align-items: center; }
.types i { font-style: normal; font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; margin-left: 10px; }
.types i:first-child { margin-left: 0; }
.game-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-between; }
.screen-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #c8d2dc; margin-top: 16px; }

/* ---------- RESULTS ---------- */
.screen-head + .cards4 { margin-top: -4px; }
.cards4 { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; gap: 16px; }
.cards4 .stat { padding: 16px 20px; }
.stat.hot { background: linear-gradient(135deg, #2e231c, var(--panel)); border-color: #5a3a26; }
.stat.hot b { color: var(--orange); }
.stat.hot b small { font-size: 16px; color: var(--text); }
.type-row { display: flex; justify-content: space-between; font-size: 13px; color: #c8d2dc; margin-top: 12px; font-family: ui-monospace, Menlo, monospace; }
.type-row span:first-child { font-family: Inter, system-ui, sans-serif; }
.type-row em { font-style: normal; color: var(--mint); margin-left: 6px; }
.results-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1010px 1fr; gap: 16px; margin-top: 16px; }
.results-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.toggle { display: flex; background: #0e151d; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.toggle button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-size: 12px; color: var(--muted); }
.toggle button[aria-pressed="true"] { background: #23332a; color: var(--text); }
.series-body { display: grid; grid-template-columns: 1fr 360px; gap: 20px; margin-top: 10px; }
.sbars { display: flex; gap: 22px; align-items: flex-end; overflow-x: auto; padding: 0 6px; scrollbar-width: none; }
.sbar { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 46px; font-size: 13px; }
.sbar i { display: block; width: 46px; background: #3a4b5d; border-radius: 3px; }
.sbar.cur i { background: var(--orange); }
.sbar.other i { background: repeating-linear-gradient(45deg, #2a3846, #2a3846 4px, #3a4b5d 4px, #3a4b5d 8px); }
.sbar small { font: 10px ui-monospace, Menlo, monospace; color: var(--muted); }
.series-body dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 13px; border-left: 1px solid var(--line); padding-left: 20px; }
.series-body dt { color: #c8d2dc; }
.series-body dd { margin: 0; font-family: ui-monospace, Menlo, monospace; text-align: right; }
.history { display: grid; grid-template-columns: 560px 1fr; gap: 30px; align-items: center; margin-top: 14px; padding: 14px 24px; }
.history h2 { font-size: 16px; }
.history p { font-size: 12px; margin-top: 6px; }
.history-scroll { max-height: 118px; overflow-y: auto; scrollbar-width: thin; }
.history table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history th { position: sticky; top: 0; background: var(--panel); font-size: 10px; font-weight: 600; color: var(--muted); text-align: right; padding: 3px 8px; }
.history td { text-align: right; padding: 4px 8px; border-top: 1px solid var(--line); }
.history th:first-child, .history td:first-child { text-align: left; }
.history tr.cur td:first-child { color: var(--orange); }
.reset-wrap { display: flex; align-items: center; gap: 16px; }
.reset { background: #121a24; border: 1px solid #50657a; border-radius: 10px; padding: 12px 26px; font-size: 15px; }
.reset:disabled { opacity: .5; }
.reset:focus-visible, .toggle button:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }

/* ---------- телефон: вёрстка в колонку вместо сцены 1920×1080 ---------- */
html:has(body.mobile), body.mobile { height: auto; overflow: auto; }
.mobile .stage { position: static; width: auto; height: auto; padding: 14px 14px 28px; overflow: visible; }
.mobile #screen > div { display: flex; flex-direction: column; gap: 12px; }
.mobile .top .tagline { display: none; }
.mobile .logo-ball { width: 30px; height: 30px; }
.mobile .logo b { font-size: 12px; }
.mobile .pill { font-size: 10px; padding: 6px 10px; }
.mobile .screen-head { margin: 12px 0 0; align-items: flex-start; gap: 12px; }
.mobile .screen-head h1 { font-size: 22px; }
.mobile .screen-head .sub { display: none; }
.mobile .head-right { font-size: 12px; }
.mobile .head-right b { font-size: 16px; }
.mobile .panel { padding: 14px; border-radius: 14px; }
.mobile .panel-head h2 { font-size: 15px; }
.mobile .stat { padding: 12px; }
.mobile .stat b { font-size: 22px; margin: 4px 0; }
.mobile .screen-foot { flex-direction: column; align-items: stretch; gap: 12px; margin-top: 0; font-size: 12px; }

/* площадка */
.mobile .map-panel .panel-foot, .mobile .map-panel .legend { display: none; }
.mobile .court { flex: none; height: calc((100vw - 30px) * 870 / 1584); margin: 8px -14px 0; }
.mobile .court-box { border-radius: 0; }
.mobile .pin { transform: translate(-50%, -15px); gap: 3px; }
.mobile .num { width: 30px; height: 30px; font-size: 15px; border-width: 1.5px; }
.mobile .tag { padding: 2px 5px; border-radius: 4px; }
.mobile .tag b { font-size: 11px; }
.mobile .tag .nm, .mobile .tag small, .mobile .best-tag { display: none; }
.mobile .badge { font-size: 11px; left: calc(50% + 10px); top: -10px; padding: 1px 6px; }

/* LIVE */
.mobile .live-grid, .mobile .results-grid { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.mobile .live-side, .mobile .results-side { display: contents; }
.mobile .score-timer { order: 1; }
.mobile .live .map-panel { order: 2; }
.mobile .last-card { order: 3; display: block; }
.mobile .live .game-panel { order: 4; }
.mobile .stats3 { order: 5; gap: 8px; }
.mobile .types { order: 6; flex-wrap: wrap; }
.mobile .score-timer > div { padding: 12px 14px; }
.mobile .score b { font-size: 44px; }
.mobile .timer b { font-size: 34px; }
.mobile .stats3 .stat > small { font-size: 11px; }
.mobile .last-card .panel-head { align-items: center; }
.mobile .lc-body { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin-top: 10px; }
.mobile .lc-body .num { width: 36px; height: 36px; font-size: 17px; }
.mobile .lc-body b, .mobile .lc-body span { display: block; font-size: 13px; }
.lc-badge { font-style: normal; font-weight: 800; padding: 3px 10px; border-radius: 99px; font-size: 14px; }
.lc-badge.hit { background: #3ddc84; color: #06210f; }
.lc-badge.miss { background: #34485c; }
.mobile .game-panel { min-height: 0; }
.mobile #timeline { flex: none; }
.mobile .chart { height: auto; }

/* RESULTS */
.mobile .cards4 { grid-template-columns: 1fr 1fr; gap: 8px; }
.mobile .cards4 .stat:first-child, .mobile .cards4 .stat:last-child { grid-column: 1 / -1; }
.mobile .results .map-panel .panel-head { flex-direction: column; }
.mobile .points-table { display: table; width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }
.mobile .points-table th { font-size: 10px; font-weight: 600; color: var(--muted); text-align: right; padding: 6px 4px; }
.mobile .points-table td { text-align: right; padding: 6px 4px; border-top: 1px solid var(--line); }
.mobile .points-table th:first-child, .mobile .points-table td:first-child { text-align: left; }
.mobile .points-table tr.best td:first-child { color: var(--mint); }
.mobile .points-table tfoot td { font-weight: 700; font-size: 13px; }
.mobile .points-table tfoot td:last-child { color: var(--orange); }
.mobile .series-body { grid-template-columns: 1fr; }
.mobile .series-body dl { border-left: 0; padding-left: 0; }
.mobile .history { display: block; margin-top: 0; padding: 14px; }
.mobile .history-scroll { max-height: 200px; margin-top: 10px; }
.mobile .history th:nth-child(6), .mobile .history td:nth-child(6) { display: none; }
.mobile .reset-wrap { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
.mobile .reset { width: 100%; padding: 14px; font-size: 16px; }

/* IDLE */
.mobile .idle { gap: 20px; }
.mobile .idle-copy, .mobile .idle-art, .mobile .idle-bottom { position: relative; left: auto; right: auto; top: auto; bottom: auto; }
.mobile .idle h1 { font-size: clamp(38px, 12vw, 64px); margin: 14px 0 18px; }
.mobile .idle-lead { font-size: 15px; }
.mobile .features { margin-top: 20px; }
.mobile .features li { padding: 0 10px 0 10px; }
.mobile .idle-art { zoom: .52; margin: 0 auto; }
.mobile .ready-chip { display: none; }
.mobile .plus-card { right: 0; }
.mobile .idle-bottom { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 18px; }
.mobile .idle-bottom p { text-align: left; }
.mobile .cta { font-size: 26px; }
.mobile .record-badge { white-space: nowrap; font-size: 11px; padding: 6px 8px; }
.mobile .screen-head .head-right { flex: none; }
.mobile .idle { margin-top: 18px; }
.mobile .idle-photo { position: static; width: calc(100% + 28px); height: auto; aspect-ratio: 4 / 5; margin: 0 -14px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 15%, #000 85%, transparent); -webkit-mask-composite: source-over; mask-composite: add; }
.top { position: relative; z-index: 2; }
.idle-copy, .idle-bottom { z-index: 1; }
