* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { --game-title-height: calc(clamp(10px,1.2dvmax,16px) * 1.5 + 2 * clamp(6px,1.2dvmin,14px)); font-family: Meiryo, "メイリオ", "Noto Sans JP", sans-serif; color: #f3f4f5; background: #090a0b; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; border: 1px solid #596168; border-radius: 0; color: #fff; background: #262a2d; }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #c5d843; outline-offset: 2px; }
.game-viewport { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(140px,20%) minmax(0,1fr) minmax(185px,25%); grid-template-rows: minmax(0,1fr) clamp(70px,18%,126px); width: 100dvw; height: 100dvh; container-type: size; overflow: hidden; background: linear-gradient(145deg,#1c2024 0%,#080a0d 44%,#13191e 100%); }
@media (orientation: portrait) { .game-viewport { inset: auto; top: 50%; left: 50%; width: 100dvh; height: 100dvw; transform: translate(-50%, -50%) rotate(90deg); } }
.rail, .score-area, .input-area, .player-strip { min-width: 0; min-height: 0; }
.rail { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; border-right: 1px solid #565d64; background: linear-gradient(90deg,#121619,#080a0c); }
.rail h1 { margin: 0; padding: 0 clamp(8px,1cqw,14px); height: var(--game-title-height); min-height: var(--game-title-height); flex-shrink: 0; display: flex; align-items: center; background: #246d9f; color: #fff; font-size: clamp(12px,1.5cqw,20px); font-weight: 700; line-height: 1.2; letter-spacing: .04em; }
.round-display { padding: 6px 9px; font-size: clamp(10px,1.2cqw,16px); letter-spacing: .05em; border-bottom: 1px solid #59616a; background: #252b30; }
.history { flex: 1; min-height: 0; overflow: auto; padding: 4px 7px; scrollbar-width: thin; }
.history-row { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px; border-bottom: 1px solid #ffffff25; padding: 4px 0; font-size: clamp(9px,1cqw,13px); }
.history-row span:last-child { overflow: hidden; color: #cbd1d5; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.team-totals { display: grid; gap: 2px; padding: 0 6px; }
.team-total { display: flex; justify-content: space-between; align-items: center; min-height: clamp(28px,5cqh,44px); padding: 2px 7px; font-size: clamp(9px,1.1cqw,15px); }
.team-total strong { font-size: clamp(17px,2.3cqw,30px); font-variant-numeric: tabular-nums; }
.team-total.team-a { background: #762d37; }
.team-total.team-b { background: #234d73; }
.rail-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 3px; padding: 5px; }
.rail-actions button { min-width: 0; min-height: clamp(27px,4cqh,38px); padding: 2px; font-size: clamp(8px,.8cqw,12px); }
.score-area { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 5px; text-align: center; background: radial-gradient(ellipse at 50% 48%,#2c3740 0%,#12191e 49%,#080b0e 83%); }
.turn-name { max-width: 100%; overflow: hidden; color: #c2cbd1; font-size: clamp(12px,1.8cqw,25px); letter-spacing: .08em; text-overflow: ellipsis; white-space: nowrap; }
.current-score { max-width: 100%; color: #e2e8ec; font-size: clamp(75px,14cqw,210px); font-weight: 700; line-height: 1; letter-spacing: -.06em; text-shadow: 0 3px 0 #64727c,0 9px 18px #000c; font-variant-numeric: tabular-nums; }
.turn-darts { color: #aeb9c1; font-size: clamp(12px,1.5cqw,21px); font-variant-numeric: tabular-nums; }
.status { min-height: 1.5em; margin: 5px 0 0; color: #d9dedf; font-size: clamp(10px,1.1cqw,16px); }
.input-area { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: clamp(3px,.7cqh,7px); padding: clamp(5px,1cqh,10px); border-left: 1px solid #59616a; background: linear-gradient(90deg,#0b0d0f,#161a1e); }
.multipliers, .specials { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
.multipliers button, .specials button { min-height: clamp(24px,5cqh,42px); font-size: clamp(11px,1.5cqw,20px); font-weight: 700; }
.multipliers button.selected { color: #fff; background: #246d9f; border-color: #9fc7e0; }
.number-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); grid-template-rows: repeat(4,minmax(0,1fr)); gap: 4px; }
.number-grid button { min-height: 0; font-size: clamp(12px,1.8cqw,26px); font-weight: 700; }
.specials button:last-child { font-size: clamp(9px,1.2cqw,16px); }
.player-strip { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-top: 3px solid #88939b; background: #10151a; }
.player { position: relative; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: center; padding: 3px 7px; border-right: 1px solid #67717a; background: linear-gradient(180deg,#28323a,#11171c); }
.player.team-a { border-top: 3px solid #ab3b47; }
.player.team-b { border-top: 3px solid #3479aa; }
.player.active { background: linear-gradient(180deg,#3a4853,#1a242b); box-shadow: inset 0 0 0 2px #e2e8ec; }
.player-name { width: 100%; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(9px,1.1cqw,15px); }
.player-score { font-size: clamp(28px,9cqh,65px); line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.player-meta { min-height: 1em; color: #b6bec4; font-size: clamp(8px,.9cqw,12px); }
.player.frozen .player-meta { color: #f0b681; font-weight: 700; }
@media (max-width:700px) { .rail h1 { font-size:10px; } }
@media (max-height:430px) and (orientation:landscape) { .rail h1 { font-size:10px; padding-inline:6px; } .round-display { padding:4px 6px; } .history-row { padding:3px 0; } .input-area { gap:4px; } .score-area { padding:5px; } .status { min-height:1.2em; } }
@media (max-height:550px), (pointer:coarse) { :root { --game-title-height:calc(clamp(9px,1.15dvmax,12px) * 1.5 + 6px); } }
.player.frozen { isolation: isolate; overflow: hidden; }
.player.frozen::before, .player.frozen::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.player.frozen::before { z-index: 0; background: rgba(100, 200, 240, .28); }
.player.frozen::after { z-index: 1; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20160%22%20preserveAspectRatio%3D%22none%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23e2faff%22%20stroke-width%3D%221.4%22%20stroke-linejoin%3D%22round%22%20opacity%3D%22.8%22%3E%3Cpath%20d%3D%22M178%2068%20L143%2037%20L118%200%20M143%2037%20L95%2039%20L59%2020%20L0%2025%20M178%2068%20L227%2031%20L250%200%20M227%2031%20L282%2042%20L328%2014%20L400%205%20M178%2068%20L207%20100%20L202%20133%20L220%20160%20M207%20100%20L259%20107%20L297%20139%20L349%20160%20M178%2068%20L128%2092%20L84%2088%20L37%20118%20L0%20125%20M128%2092%20L122%20131%20L96%20160%20M178%2068%20L231%2065%20L278%2082%20L327%2065%20L400%2087%20M95%2039%20L72%2061%20M282%2042%20L310%2045%20L332%2034%20M259%20107%20L275%20118%20L277%20141%20M84%2088%20L58%2076%20L32%2082%20M122%20131%20L143%20146%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center / 100% 100% no-repeat; }
.player.frozen > * { position: relative; z-index: 2; }

.round-start-overlay { position: absolute; inset: 0; z-index: 40; overflow: hidden; pointer-events: none; }
.round-start-overlay[hidden] { display: none; }
.round-start-position { position: absolute; text-align: center; transform: translate(-50%, -50%); }
.round-start-position[data-placement="below"] { transform: translateX(-50%); }
.round-start-overlay .round-start-text { display: block; color: #fff; font-family: Arial, Helvetica, sans-serif; font-weight: 900; line-height: 1.1; letter-spacing: .06em; white-space: nowrap; text-shadow: 0 2px 18px #000, 0 0 40px #000; animation: iwashi-round-pass 1.3s ease-in-out both; }
@keyframes iwashi-round-pass {
  0% { transform: translateX(-150%); opacity: 0; }
  24%, 70% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(150%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .round-start-overlay .round-start-text { animation: none; } }
