/* Scoring-only structure; projected boards never use this shell. */
.game-active-screen .scoring-layout {
    --scoring-gap: clamp(12px, 1.3vmin, 20px);
    --scoring-controls-height: calc(2 * clamp(64px, 7dvh, 88px) + clamp(10px, 1.2vmin, 16px));
    --scoring-input-size: min(100%, max(200px, calc(var(--scoring-pane-height) - 100px)));
    --scoring-pane-height: max(280px, min(calc(100vw + 28px), calc(100dvh - 544px)));
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "error" "input" "controls" "scoreboard";
    gap: var(--scoring-gap);
    width: 100%;
    max-width: none;
    min-width: 0;
    height: auto;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    position: relative;
    align-items: start;
}
.game-active-screen .scoring-layout-header { min-width: 0; display: flex; align-items: center; padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid #ffffff24; overflow-wrap: anywhere; }
.game-active-screen .scoring-layout.ab-scoring .scoring-layout-header { display: none; }
.game-active-screen .scoring-layout.ab-watl-scoring .scoring-layout-header { display: flex; padding: 0; margin-bottom: 10px; border-bottom: 0; }
.game-active-screen .scoring-layout-header > * { width: 100%; margin: 0; }
.game-active-screen .scoring-layout-header :is(.std-header-line,.wvs-header,.darts-sv-header-line,.cts-header) { flex-wrap: wrap; }
.game-active-screen .scoring-layout-player { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; }
.game-active-screen .scoring-layout-player > span { color: #b8cbe0; font-weight: 700; }
.game-active-screen .scoring-layout-player > strong { font-size: clamp(1.25rem, 2.4vmin, 1.8rem); color: #fff; }
.game-active-screen .scoring-layout-error { grid-area: error; color: #fecaca; padding: 10px 14px; background: #7f1d1d66; border: 1px solid #f8717180; border-radius: 10px; }
.game-active-screen .scoring-layout-input { grid-area: input; display: flex; flex-direction: column; position: relative; min-width: 0; width: 100%; height: var(--scoring-pane-height); max-height: calc(100dvh - 252px); overflow: auto; padding: 12px; border: 1px solid #ffffff24; border-radius: 12px; background: #ffffff0a; }
.game-active-screen .scoring-layout-input-content { flex: 0 0 auto; min-width: 0; width: 100%; margin-block: auto; position: relative; }
.game-active-screen .scoring-layout-input-toolbar { position: absolute; top: 12px; left: 12px; z-index: 4; }
.game-active-screen .scoring-layout .scoring-mode-switch { display: flex; gap: 8px; width: fit-content; margin: 0; padding: 0; border: 0; background: none; }
.game-active-screen .scoring-layout .scoring-mode-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: 1px solid #64748b; border-radius: 8px; background: #0f172af2; color: #cbd5e1; font-size: 22px; line-height: 1; touch-action: manipulation; }
.game-active-screen .scoring-layout .scoring-mode-button[aria-pressed="true"] { border-color: #93c5fd; background: #1d4ed8; color: #fff; box-shadow: inset 0 0 0 1px #93c5fd55; }
.game-active-screen .scoring-layout .scoring-mode-button:hover { filter: brightness(1.2); }
.game-active-screen .scoring-layout .scoring-mode-button:focus-visible { outline: 3px solid #fef08a; outline-offset: 3px; }
.game-active-screen .scoring-layout.has-input-toolbar { --scoring-input-size: min(100%, max(200px, calc(var(--scoring-pane-height) - 36px))); }
.game-active-screen .scoring-layout.has-input-toolbar .has-special-miss { --scoring-input-size: min(100%, max(180px, calc(var(--scoring-pane-height) - 116px))); }
.game-active-screen .scoring-layout-controls { grid-area: controls; width: 100%; min-width: 0; }
.game-active-screen .scoring-layout-scoreboard { grid-area: scoreboard; min-width: 0; width: 100%; max-height: min(45dvh, max(140px, calc(100dvh - var(--scoring-pane-height) - var(--scoring-controls-height) - 2 * var(--scoring-gap) - 136px))); padding: 12px; border: 1px solid #ffffff24; border-radius: 12px; background: #0f172aa6; overflow: auto; }
.game-active-screen .scoring-layout :is(.std-player-panel,.wvs-header,.darts-sv-player-panel,.dh-header-card,.cts-header,.sks-turn-card) { padding: 0; margin: 0; border: 0; background: none; }
.game-active-screen .scoring-layout :is(.std-buttons-panel,.wvs-target-panel,.darts-sv-buttons-panel,.std-scoreboard-panel,.darts-sv-scoreboard-panel,.wvs-scoreboard,.dh-scoreboard-card,.cts-scoreboard) { padding: 0; margin: 0; border: 0; background: none; overflow: visible; max-height: none; }
.game-active-screen .scoring-layout .scoring-manual-input { padding-top: 56px; }
.game-active-screen .scoring-layout :is(.tablet-game-input,.axeman-phase-section,.std-controls,.wvs-controls,.darts-sv-controls,.game-controls,.axeman-controls,.ttt-controls,.bs-controls) { margin: 0; padding: 0; width: 100%; }
.game-active-screen .scoring-layout :is(.its-board-shell,.dts-board-shell) { width: var(--scoring-input-size); max-width: 100%; aspect-ratio: 1; }
.game-active-screen .scoring-layout .has-special-miss { --scoring-input-size: min(100%, max(180px, calc(var(--scoring-pane-height) - 180px))); }
.game-active-screen .scoring-layout :is(.ttt-claim-grid,.pairs-card-grid,.attack-grid,.am-grid,.ac-scoring-target) { width: var(--scoring-input-size); max-width: 100%; margin: 0 auto; }
.game-active-screen .scoring-layout :is(.ttt-claim-grid,.pairs-card-grid,.attack-grid,.am-grid) { aspect-ratio: 1; }
.game-active-screen .scoring-layout :is(.am-cell,.attack-cell) { min-width: 0; min-height: 0; height: auto; aspect-ratio: 1; }
.game-active-screen .scoring-layout :is(.ais-main,.azs-main,.am-main-area,.bs-main-area,.bs-grid-column,.ac-scoring-layout,.ac-scoring-mine) { display: contents; }
.game-active-screen .scoring-layout :is(.ais-stage,.azs-stage) { width: 100%; height: auto; min-height: 0; max-height: none; position: relative; }
.game-active-screen .scoring-layout .ais-grid-shell { width: min(var(--scoring-input-size), calc((var(--scoring-pane-height) - 36px) * .875)); max-width: 100%; min-height: 0; height: auto; aspect-ratio: 7 / 8; margin: auto; }
.game-active-screen .scoring-layout .azs-stage { width: var(--scoring-input-size); aspect-ratio: 1; margin: auto; }
.game-active-screen .scoring-layout :is(.ais-topline,.azs-topline) { margin-bottom: 16px; }
.game-active-screen .scoring-layout :is(.dh-action-grid,.pyr-scoring-grid) { grid-template-columns: 1fr; }
.game-active-screen .scoring-layout :is(.dh-action-btn.hit,.pyr-btn-hit) { min-height: 100px; height: clamp(100px, 18dvh, 220px); width: 100%; }
.game-active-screen .scoring-layout :is(.dh-target-card,.dh-action-grid) { margin-bottom: 12px; }
.game-active-screen .scoring-layout .dh-subtitle { margin: 0; }
.game-active-screen .scoring-layout-header .dh-header-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 4px 16px; }
.game-active-screen .scoring-layout-header .dh-header-top { margin: 0; }
.game-active-screen .scoring-layout-header .dh-player-name { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 1.5rem; }
.game-active-screen .scoring-layout-header .dh-subtitle { grid-column: 1; font-size: .85rem; line-height: 1.2; }
.game-active-screen .scoring-layout .dh-target-card { grid-template-columns: minmax(120px,160px) minmax(0,1fr); padding: 12px; gap: 12px; }
.game-active-screen .scoring-layout-header .sks-current-photo { width: 48px; height: 60px; }
.game-active-screen .scoring-layout-header .sks-turn-copy h2 { font-size: 1.5rem; margin: 2px 0; }
.game-active-screen .scoring-layout-header .sks-lives i { font-size: 1rem; }
.game-active-screen .scoring-layout-header .cts-header h2 { margin: 0; font-size: 1.5rem; }
.game-active-screen .scoring-layout-header .ac-mine-heading { margin-bottom: 4px; }
.game-active-screen .scoring-layout-header .ac-mine-heading h2 { margin: 0; font-size: 20px; }
.game-active-screen .scoring-layout-header .ac-tool { padding: 5px 8px; }
.game-active-screen .scoring-layout-header .ac-turn { margin-bottom: 0; }
.game-active-screen .scoring-layout .cts-score-grid { width: 100%; }
.game-active-screen .scoring-layout .pop-scoring-grid { width: 100%; max-width: none; }
.game-active-screen .scoring-layout .quiz-answer-section { margin: 0; }
.game-active-screen .scoring-layout :is(.cw-turn-info,.ttt-current-player,.quiz-current-player,.current-turn-info,.ais-turn-panel,.azs-turn-panel) { display: none; }
.game-active-screen .scoring-layout :is(.ttt-scoreboard,.connectwar-scoring-scoreboard,.pairs-scoreboard,.axeman-scoreboard,.am-scoreboard-row,.sks-roster) { margin: 0; width: 100%; }
.game-active-screen .scoring-layout .sks-target-image { width: min(100%, 118px); }
.game-active-screen .scoring-layout .sks-result-buttons { grid-template-columns: 1fr; }
.game-active-screen .scoring-layout .sks-roster-player { min-height: 64px; }
.game-active-screen .scoring-layout .ac-haul { max-height: none; overflow: visible; margin-top: 16px; }
.game-active-screen .scoring-layout .ac-scoring-mine { position: static; }
.game-active-screen .scoring-layout .ac-scoring-target { container-type: normal; display: block; flex: none; height: auto; min-height: 0; }
.game-active-screen .scoring-layout .ac-scoring-target > .ac-mine { width: 100%; max-width: 100%; }
.game-active-screen .scoring-layout .ass-panel { margin: 0; }
.game-active-screen .scoring-layout .asbs-scoreboard.vertical { width: 100%; min-width: 0; }
.game-active-screen .scoring-layout .ass-action-panel { display: flex; flex-direction: column; }
.game-active-screen .scoring-layout .ass-goal-card { width: 100%; min-width: 0; }
.game-active-screen .scoring-layout .ass-goal-image { width: 100%; min-height: 220px; }
.game-active-screen .scoring-layout :is(.ass-action-side,.ass-fixture-strip) { display: none; }
.game-active-screen .scoring-roster { width: 100%; color: #fff; }
.game-active-screen :is(.scoring-roster-heading,.scoring-roster-player) { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; padding: 14px 12px; }
.game-active-screen .scoring-roster-heading { color: #a6b8cd; font-weight: 800; text-transform: uppercase; }
.game-active-screen .scoring-roster-player { border: 1px solid #ffffff20; border-radius: 10px; margin: 8px 0; }
.game-active-screen .scoring-roster-player strong { display: flex; align-items: center; gap: 12px; }
.game-active-screen .scoring-roster-pip { width: 9px; height: 9px; border-radius: 50%; background: #475569; flex: 0 0 auto; }
.game-active-screen .scoring-roster-player.current { background: #60a5fa40; border-color: #60a5fa; box-shadow: inset 0 0 0 2px #60a5fa, 0 0 18px #60a5fa44; }
.game-active-screen .scoring-roster-player.current .scoring-roster-pip { background: #93c5fd; box-shadow: 0 0 10px #60a5fa; }
@media (orientation: portrait) {
    .game-active-screen .scoring-layout.ab-scoring .scoring-layout-scoreboard { max-height: 45dvh; }
}
@media (orientation: landscape) and (min-width: 900px) {
    /* Reserve the screen padding, top navigation space, actual controls and grid gaps; allow 1px for rounding. */
    .game-active-screen .scoring-layout { --scoring-pane-height: min(calc(100dvh - 272px), calc(100dvh - 5.25rem - 1px - var(--scoring-controls-height) - 2 * var(--scoring-gap))); grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: auto auto auto; grid-template-areas: "error error" "input scoreboard" "controls scoreboard"; }
    .game-active-screen .scoring-layout-scoreboard { max-height: calc(var(--scoring-pane-height) + var(--scoring-controls-height) + var(--scoring-gap)); align-self: stretch; }
}
