/* Match presentation uses the original hall_match_hud / hall_gameplay cadence.
   This layer changes neither gameplay authority nor the native card proportions. */
.mission-shields{display:flex;justify-content:center;gap:42px;margin:8px auto;max-width:100%}
.mission-shield{position:relative;width:30px;height:42px;flex:none}
.mission-shield:not(:last-child)::after{content:'';position:absolute;left:100%;top:50%;height:2px;width:42px;background:#52565a;z-index:-1}
.mission-shield[data-outcome=good]::after{background:#a6d1df}.mission-shield[data-outcome=evil]::after{background:#b3676b}
.mission-shield svg{width:100%;height:100%;overflow:visible;image-rendering:pixelated}.mission-shield polygon{fill:#101820;stroke:#737777;stroke-width:2}.mission-shield text{fill:#737777;font-size:24px;font-family:AvalonPixel,monospace}.mission-shield[data-current=true] polygon{stroke:#c1b797}.mission-shield[data-current=true] text{fill:#c1b797}
.identity-progress{color:#dddccc;font-size:16px;margin:4px 0}.target-seat{font-size:12px;color:#c7b99a}.court-nameplate[data-match-marker~=leader]::before{content:'队长 · ';color:#dfd5b9}.court-nameplate[data-match-marker~=team]::after{content:' · 出征';color:#a6d1df}.court-nameplate[data-match-marker~=target]{color:#f4e3d2;text-shadow:0 0 5px #ffe6ad,0 0 15px #dab976,1px 1px #10141a}
#game[data-stage=reveal] .game-hud{z-index:2;pointer-events:none}#game[data-stage=reveal] .game-toolbar{z-index:3}
#game[data-stage=team_selection] .game-hud,#game:is([data-stage=team_voting],[data-stage=inspection]) .game-hud,#game[data-stage=mission_execution] .game-hud,#game[data-stage=vote_reveal] .game-hud,#game[data-stage=mission_reveal] .game-hud,#game[data-stage=assassination] .game-hud,#game[data-stage=game_result] .game-hud{width:min(720px,calc(100vw - 480px))}
.native-reveal{width:100%;overflow:visible;gap:16px;flex-wrap:wrap;align-content:center;flex:none}
.native-reveal .reveal-card{width:min(180px,calc((100vw - 100px)/var(--reveal-count) - 16px));aspect-ratio:180/276;flex:none;perspective:900px;animation:match-card-exit 450ms ease-in-out var(--exit-delay) both}
.reveal-card-turn{position:relative;width:100%;height:100%;transform-style:preserve-3d;animation:match-card-flip var(--flip-duration) ease-in-out var(--flip-delay) both}
.native-reveal .court-card{position:absolute;inset:0;width:100%;height:100%!important;backface-visibility:hidden;animation:none}
.reveal-front{transform:rotateY(180deg)}
@keyframes match-card-flip{from{transform:rotateY(0)}to{transform:rotateY(180deg)}}
@keyframes match-card-exit{from{opacity:1;transform:none}to{opacity:0;transform:translateY(24px) scale(.96)}}
.stage-announcement{color:#d5ecf2;font-size:clamp(32px,5vw,72px);line-height:1.4;text-align:center;white-space:pre-line;text-shadow:2px 2px #10141a;animation:match-title-in 450ms ease-out both;pointer-events:none}
.stage-announcement[data-side=evil]{color:#e4a1a5}@keyframes match-title-in{from{opacity:0}to{opacity:1}}
#game[data-stage=game_result] .game-actions:has(.result-verdict){background:none;flex-direction:column;gap:24px}
#game[data-stage=game_result] .game-actions:has(.result-pane){padding-top:170px;padding-bottom:20px;align-items:flex-start}
.result-pane{width:min(1300px,calc(100vw - 48px));max-width:calc(100vw - 48px);max-height:calc(100dvh - 190px)}
.result-roles{gap:20px;max-height:none;overflow:visible}.result-role{width:clamp(110px,12vw,180px)}.result-role .court-card{width:100%}.result-role p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0 0 8px}
.result-pane .result-summary{font-size:20px;margin:6px 0 12px}
/* Keep touch-sized controls and allow portrait / short-landscape presentations. */
@media(max-width:600px){
 #game:not([data-stage=waiting]) .game-hud{width:auto;max-width:none;left:12px;right:12px;top:68px}
 .mission-shields{gap:24px;margin:4px auto}.mission-shield{width:22px;height:30px}.mission-shield:not(:last-child)::after{width:24px}.game-hud .mission-track{font-size:12px;line-height:16px}.game-hud .phase-title{font-size:20px;line-height:24px;margin:0}.game-hud .room-code{font-size:12px;line-height:16px}
 .native-reveal{gap:12px}.native-reveal .reveal-card{width:min(100px,calc((100vw - 64px)/3))}.stage-announcement{font-size:32px}
 #game[data-stage=game_result] .game-actions:has(.result-pane){padding-top:182px}.result-pane{width:calc(100vw - 24px);max-width:calc(100vw - 24px);max-height:calc(100dvh - 194px);padding:16px 10px}.result-roles{gap:12px}.result-role{width:calc((100vw - 80px)/3)}.result-pane .result-summary{font-size:14px}.identity-progress{font-size:14px}
 #game[data-stage=reveal] .game-actions{padding-top:124px}
}
@media(min-width:480px) and (max-height:620px){
 #game:not([data-stage=waiting]) .game-hud{width:auto;left:max(64px,calc(env(safe-area-inset-left) + 52px));right:max(64px,calc(env(safe-area-inset-right) + 52px));top:max(8px,env(safe-area-inset-top));max-width:none;transform:none}.game-hud .room-code{font-size:12px;line-height:16px}.game-hud .phase-title{font-size:18px;line-height:22px;margin:0}.game-hud .mission-track{font-size:12px;line-height:16px}.mission-shields{gap:22px;margin:3px auto}.mission-shield{width:20px;height:28px}.mission-shield:not(:last-child)::after{width:22px}
 .native-reveal{gap:10px}.native-reveal .reveal-card{width:min(96px,calc((100dvh - 160px)*180/276),calc((100vw - 80px)/var(--reveal-count) - 10px))}.stage-announcement{font-size:32px}
 #game[data-stage=game_result] .game-actions:has(.result-pane){padding-top:110px;padding-bottom:10px}.result-pane{max-height:calc(100dvh - 120px);padding:12px 16px}.result-pane h2{font-size:22px}.result-pane .result-summary{font-size:14px}.result-roles{gap:12px}.result-role{width:80px}
 #game[data-stage=reveal] .game-hud{display:none}
}
.game-toolbar .fullscreen-symbol{display:none}
/* Match HUD follows the native screen axis, never the space left by tools.
   Two symmetric 44px rails leave the middle for the unchanged HUD stack.
   Waiting keeps its room badge at the left and its tools at the right. */
@media(min-width:480px) and (max-height:620px){
 #game:not([data-stage=menu]) .game-toolbar .toolbar-fullscreen{width:44px;min-width:44px;height:44px;min-height:44px;padding:10px;display:grid;place-items:center}
 #game:not([data-stage=menu]) .toolbar-fullscreen .fullscreen-label{display:none}
 #game:not([data-stage=menu]) .toolbar-fullscreen .fullscreen-symbol{display:block;width:22px;height:22px;pointer-events:none}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .game-toolbar{top:max(8px,env(safe-area-inset-top));left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .toolbar-right{width:100%;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;grid-template-rows:44px 44px;gap:8px;margin:0;pointer-events:none}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .toolbar-right>.avalon-button{width:44px;min-width:44px;height:44px;min-height:44px;pointer-events:auto}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .match-identity-shortcut{grid-column:1;grid-row:1}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .toolbar-roster{grid-column:1;grid-row:2}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .toolbar-fullscreen{grid-column:3;grid-row:1}
 #game:not([data-stage=menu]):not([data-stage=waiting]) .toolbar-menu{grid-column:3;grid-row:2}
}
@media(prefers-reduced-motion:reduce){.reveal-card-turn,.native-reveal .reveal-card{animation-duration:1ms!important}.stage-announcement{animation:none}}

@media(min-width:601px) and (min-height:621px){
 #game[data-stage=vote_reveal] .game-actions,#game[data-stage=mission_reveal] .game-actions{width:calc(100vw - 96px)}
 .native-reveal{flex-wrap:nowrap}
 .result-pane.avalon-document{width:calc(100vw - 48px);padding:24px 32px;background:none;border:0;box-shadow:none;color:#e2decb}
 .result-pane h2{color:#e2decb}.result-role{width:min(calc((100vw - 220px)/var(--result-columns)),calc((100dvh - 365px)/var(--result-rows)*180/276))}
}

@media(max-width:600px) and (orientation:portrait){#game[data-stage=waiting] .game-hud{width:auto}}
.result-verdict{animation-name:match-verdict;animation-duration:1900ms;animation-timing-function:ease-in-out}
.result-verdict[data-target=true]{animation-name:match-assassination-verdict}
@keyframes match-verdict{0%{opacity:0}24%,63%{opacity:1}100%{opacity:0}}
@keyframes match-assassination-verdict{0%{opacity:0}16%,76%{opacity:1}100%{opacity:0}}

/* Six-to-ten-player reveal decks must fit the presentation, not be vertically
   clipped by a centered overflowing flex row. Keep every vote visible. */
@media(max-width:600px) and (min-height:621px){
 #game[data-stage=vote_reveal] .native-reveal{display:grid;grid-template-columns:repeat(3,max-content);justify-content:center;gap:10px}
 #game[data-stage=vote_reveal] .native-reveal .reveal-card{width:min(96px,calc((100vw - 80px)/3),calc((100dvh - 340px)*180/1104))}
 #game[data-stage=vote_reveal] .game-actions{gap:12px;overflow:auto}
}
@media(min-width:480px) and (max-height:620px){
 #game[data-stage=vote_reveal] .native-reveal{display:grid;grid-template-columns:repeat(5,max-content);justify-content:center;gap:8px}
 #game[data-stage=vote_reveal] .native-reveal .reveal-card{width:min(96px,calc((100vw - 104px)/5),calc((100dvh - 200px)*180/552))}
 #game[data-stage=vote_reveal] .game-actions{gap:8px}
}

@media(min-width:601px) and (min-height:621px){
 .result-pane .result-roles{display:grid;grid-template-columns:repeat(var(--result-columns),max-content);justify-content:center;row-gap:32px}
 .result-pane .result-role{width:min(calc((100vw - 220px)/var(--result-columns)),calc((100dvh - 470px)/var(--result-rows)*180/276))}
}
