/* Match frame and power rail share the same steel, ivory and amber finish. */
.hud-top {
  top:16px; width:min(460px,calc(100vw - 24px)); padding:0; gap:0;
  display:grid; grid-template-columns:1fr 168px 1fr; align-items:stretch;
  border:1px solid #a0bbd038; border-top-color:#e7cd945c; border-radius:16px;
  background:linear-gradient(130deg,#102031ed,#07111df5 55%,#15202bed);
  box-shadow:0 14px 35px #0006,inset 0 1px #ffffff0d;
  overflow:hidden; backdrop-filter:blur(12px);
}
.hud-top::before { content:''; position:absolute; top:0; left:30%; right:30%; height:2px; background:linear-gradient(90deg,transparent,#e9ca8a,transparent); }
.hud-top .team { display:flex; flex-direction:column; justify-content:center; align-items:flex-start; gap:4px; min-width:0; padding:12px 20px; color:#83c9ed; }
.hud-top .team.red { align-items:flex-end; color:#ff536f; }
.hud-top .team>.team-name { display:block; font:750 8px/1 system-ui; letter-spacing:1.5px; color:inherit; }
#spectator-controls { position:fixed; z-index:30; top:105px; left:50%; transform:translateX(-50%); display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:8px; width:max-content; max-width:calc(100vw - 32px); padding:12px 16px; border:1px solid #a18b60; border-radius:6px; background:#091521ee; color:#f4e6c6; box-shadow:0 4px 24px #0008; font:600 12px system-ui; }
#spectator-controls[hidden] { display:none; }
#spectator-controls.tournament-observer { top:auto; bottom:24px; }
#spectator-controls strong,#spectator-controls small { flex-basis:100%; text-align:center; }
#spectator-controls small { color:#a9bdcd; font-size:11px; }
#spectator-controls button,#spectator-controls select { padding:7px 10px; color:#d8e4ec; background:#14283b; border:1px solid #496279; border-radius:4px; font:inherit; }
#spectator-controls button[aria-pressed="true"] { color:#fff1c5; border-color:#e4bd66; background:#3c3526; }
.hud-top .team-score { display:flex; align-items:center; gap:12px; }
.hud-top .red .team-score { flex-direction:row-reverse; }
.hud-top .team b { font:650 34px/1 system-ui; letter-spacing:-1px; text-shadow:0 0 24px currentColor; }
.hud-top .round-wins { display:flex; gap:7px; }
.hud-top .round-wins i { display:block; width:8px; height:8px; border:1px solid currentColor; transform:rotate(45deg); opacity:.35; background:#040b14; }
.hud-top .round-wins i.won { opacity:1; background:currentColor; box-shadow:0 0 9px currentColor; }
.hud-top .team-survivors { display:flex; align-items:center; gap:5px; color:#8fa3b6; font:600 9px/1 system-ui; }
.hud-top .team-survivors .alive { display:inline; width:auto; height:auto; margin:0; padding:0; border:0; border-radius:0; color:#e0ebf4; font:700 10px/1 system-ui; background:none; }
.hud-top .team-survivors small { font:inherit; }
.hud-top .mid { display:flex; flex-direction:column; justify-content:center; gap:5px; min-width:0; padding:12px 8px 11px; background:linear-gradient(180deg,#e5d2ae08,#ffffff02); border-inline:1px solid #b9d4e013; text-align:center; }
.hud-top .mid .phase { color:#d0dce5; font:750 9px/1.1 system-ui; letter-spacing:1.8px; }
.hud-top .round-timer { margin:0; color:#fff1d5; font:650 30px/1.05 system-ui; letter-spacing:1px; font-variant-numeric:tabular-nums; text-shadow:0 2px 12px #000a; }
.hud-top .mid .round-format { display:block; font:700 7px/1.2 system-ui; letter-spacing:1.2px; color:#8e9cac; }
.hud-top.match-point .round-format { color:#eed29a; }
.hud-top.time-critical .round-timer { color:#ffad9d; }
.hud[data-phase=roundEnd] .hud-top { border-color:#dfbf795e; }
.hud .sudden { top:126px!important; }

.combat-dock {
  width:min(620px,calc(100vw - 32px)); bottom:20px; border-radius:17px;
  border-color:#a4b9c936; border-top-color:#e2c59555;
  background:linear-gradient(145deg,#162738f5,#09121ff5 70%);
  box-shadow:0 18px 55px #0009,inset 0 1px #ffffff09;
}
.combat-dock .hud-left { padding:15px 20px 11px; align-items:center; gap:16px; }
.combat-dock .portrait { width:54px; height:54px; flex:0 0 54px; border-radius:12px; border-color:#d5be875c; box-shadow:0 0 0 4px #050c155c; }
.combat-dock .bars { gap:0; padding:0; }
.combat-dock .hp { height:17px; border:1px solid #87c7b936; transform:none; border-radius:4px; }
.combat-dock .hp .hp-text { font:750 10px/15px system-ui; text-shadow:0 1px 3px #000b; }
.hp,.pbar,.frame-health { position:relative; overflow:hidden; }
.hp>.recovery-fill,.pbar>.recovery-fill,.frame-health>.recovery-fill { display:block; position:absolute; left:0; top:0; height:100%; width:var(--recovery-pct,100%); background:#bed4da80; pointer-events:none; }
.hp>i,.pbar>i,.frame-health>i { display:block; height:100%; position:relative; z-index:1; }
.hp>.recovery-limit,.pbar>.recovery-limit,.frame-health>.recovery-limit { position:absolute; z-index:2; left:calc(var(--recovery-pct,100%) - 2px); top:0; height:100%; width:2px; background:#f4f8ed; pointer-events:none; }
.hp>.hp-text,.frame-health>b { z-index:3; }
.combat-dock .power-meta { display:flex; justify-content:space-between; gap:8px; margin:9px 0 5px; font:750 8px/1 system-ui; letter-spacing:1.25px; }
.combat-dock .power-label { color:#c0c8ff; }
.combat-dock .power-state { color:#93a7bd; letter-spacing:.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.combat-dock .energy { position:relative; width:100%; height:19px; margin:0; border:1px solid #929fe75e; border-radius:4px; transform:none; overflow:hidden; background:#060b17; box-shadow:inset 0 2px 5px #0009; }
.combat-dock .energy>i { background:linear-gradient(90deg,#596cc4,#9d9be6 65%,#d0c8ff); box-shadow:0 0 15px #8491e87a; border-radius:2px; }
.combat-dock .energy::after { content:''; position:absolute; inset:0; background:repeating-linear-gradient(90deg,transparent 0,transparent calc(10% - 1px),#06102066 calc(10% - 1px),#06102066 10%); pointer-events:none; }
.combat-dock .energy-text { display:block; position:absolute; inset:0; width:auto; z-index:1; text-align:center; color:#f4f0ff; font:800 11px/17px system-ui; letter-spacing:.7px; text-shadow:0 1px 4px #000,0 0 5px #000; }
.combat-dock .hud-abilities { margin:0 15px; padding:12px 6px 15px; gap:11px; border-top:1px solid #adc1d014; }
.combat-dock .slot { width:66px; height:66px; border-radius:10px; background:linear-gradient(160deg,#243240,#080f18); }
.combat-dock .slot.ult { margin-left:8px; border-color:#aa92df65; }
.combat-dock.ultimate-ready .energy { border-color:#f6d58c; box-shadow:0 0 20px #e9ad4530; }
.combat-dock.ultimate-ready .energy>i { background:linear-gradient(90deg,#b47732,#efbd62 60%,#ffe6a4); box-shadow:0 0 16px #e8b15888; }
.combat-dock.ultimate-ready .energy-text,.combat-dock.ultimate-ready .power-label,.combat-dock.ultimate-ready .power-state { color:#fff0c8; }
.combat-dock.ultimate-ready .slot.ult { border-color:#ffdf9a; box-shadow:0 0 0 2px #dfb56424,0 0 23px #e8bd5940; }
.combat-dock .statuses { bottom:calc(100% + 10px); }

@media(max-width:760px) {
  .hud-top { top:10px; width:min(360px,calc(100vw - 20px)); grid-template-columns:1fr 132px 1fr; border-radius:12px; }
  .hud-top .team { padding:9px 12px; gap:4px; }.hud-top .team b { font-size:28px; }
  .hud-top .team-score { gap:8px; }.hud-top .round-wins { gap:5px; }.hud-top .round-wins i { width:6px; height:6px; }
  .hud-top .mid { padding:10px 5px; }.hud-top .round-timer { font-size:26px; }.hud-top .team>.team-name { font-size:7px; letter-spacing:1px; }
  .hud-top .mid .phase { font-size:8px; }.hud-top .mid .round-format { font-size:6px; letter-spacing:.6px; }
  .hud .sudden { top:108px!important; }.arena-frames { top:120px; }
  .hud:has(.sudden.on) .arena-frames { top:155px; }
  .combat-dock { bottom:12px; width:calc(100vw - 20px); border-radius:13px; }
  .combat-dock .hud-left { padding:12px 13px 10px; gap:11px; }.combat-dock .portrait { width:42px; height:42px; flex-basis:42px; }
  .combat-dock .power-meta { margin-top:7px; font-size:7px; }.combat-dock .energy { height:18px; }.combat-dock .energy-text { font-size:10px; line-height:16px; }
  .combat-dock .hud-abilities { margin-inline:9px; padding:10px 0 12px; gap:7px; }.combat-dock .slot { width:clamp(40px,12vw,53px); height:clamp(40px,12vw,53px); border-radius:8px; }
  .combat-dock .slot.ult { margin-left:3px; }.combat-dock .slot .cd { font-size:19px; line-height:46px; }
}
@media(max-height:600px) and (min-width:761px) {
  .combat-dock { bottom:10px; }.combat-dock .hud-left { padding-block:10px; }.combat-dock .hud-abilities { padding-block:9px; }.combat-dock .slot { width:52px; height:52px; }
}

/* Reserve a separate command strip: the arena canvas ends above the HUD. */
:root { --combat-inset:108px; }
body:has(#select.hidden) canvas#game { height:calc(100dvh - var(--combat-inset)); }
body:has(#select.hidden) .hud::before { content:''; position:fixed; inset:auto 0 0; height:var(--combat-inset); background:linear-gradient(180deg,#101c29,#070e17); border-top:1px solid #95b6cb26; box-shadow:0 -4px 20px #0004; }
.combat-dock { display:grid; grid-template-columns:minmax(230px,1fr) auto; align-items:center; width:min(860px,calc(100vw - 32px)); bottom:10px; border-radius:12px; }
.combat-dock .hud-left { padding:12px 15px; gap:12px; }
.combat-dock .portrait { width:42px; height:42px; flex-basis:42px; border-radius:9px; }
.medallion-button { position:relative; width:44px; height:44px; flex:0 0 44px; padding:0; overflow:hidden; border:1px solid #c1a364; border-radius:7px; color:#fff2d4; background:#112238; cursor:pointer; pointer-events:auto; }
.medallion-button .medallion-icon { position:absolute; inset:0; background-size:cover; }
.medallion-button>i { position:absolute; inset:0; }
.medallion-button .medallion-key { position:absolute; left:2px; top:1px; padding:0 3px; font:800 10px system-ui; background:#05111acc; }
.medallion-button>b { position:absolute; inset:0; display:grid; place-items:center; font:800 19px system-ui; text-shadow:0 2px 4px #000; }
.medallion-button:disabled { cursor:default; border-color:#526073; }.medallion-button:disabled .medallion-icon { filter:saturate(.35) brightness(.65); }
.medallion-button.ready { box-shadow:0 0 9px #65c9ff30; }
#character-loading { position:fixed; inset:0; z-index:120; display:grid; place-items:center; background:#06101bec; backdrop-filter:blur(12px); color:#e9eff5; font-family:system-ui; text-align:center; }
#character-loading[hidden] { display:none; }
#character-loading>div { padding:32px; max-width:420px; }
#character-loading h2 { font-size:22px; font-weight:650; margin:24px 0 12px; }
#character-loading p { color:#9aafc1; font-size:13px; }
#character-loading button { padding:10px 18px; color:#ebdcc0; background:#1b2b3c; border:1px solid #b99b62; border-radius:5px; }
.loading-orbit { display:inline-block; width:38px; height:38px; border:2px solid #a3c2e525; border-top-color:#dab777; border-radius:50%; animation:loading-orbit 1s linear infinite; }
#character-loading[data-state="error"] .loading-orbit { animation:none; border-color:#d26d60; }
@keyframes loading-orbit { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) { .loading-orbit { animation:none; } }
.combat-dock .power-meta { margin:6px 0 4px; font-size:7px; }
.combat-dock .energy { height:18px; }.combat-dock .energy-text { line-height:16px; }
.combat-dock .hud-abilities { padding:11px 14px 11px 15px; margin:0; gap:8px; border-top:0; border-left:1px solid #adc1d014; }
.combat-dock .slot { width:54px; height:54px; }.combat-dock .slot .cd { font-size:21px; line-height:50px; }
.combat-dock .slot.ult { margin-left:4px; }
.combat-dock .statuses { grid-column:1 / -1; }
#fullscreen-toggle { position:fixed; z-index:45; top:16px; right:18px; display:flex; align-items:center; gap:8px; padding:9px 11px; border:1px solid #a3bed135; border-radius:8px; background:#0c1725e8; color:#c7d8e4; font:650 10px system-ui; cursor:pointer; }
#fullscreen-toggle:hover,#fullscreen-toggle[aria-pressed=true] { border-color:#e4c48a99; color:#ffdf9c; }
#fullscreen-toggle svg { width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.fullscreen-status { position:fixed; z-index:80; right:18px; top:62px; width:min(310px,calc(100vw - 36px)); border:1px solid #d7bb7b66; background:#142334f5; padding:13px; border-radius:8px; color:#f2e2bc; font:12px/1.6 system-ui; }
.fullscreen-status[hidden] { display:none; }
@media(max-width:760px) {
  :root { --combat-inset:154px; }
  .combat-dock { display:block; bottom:8px; width:calc(100vw - 20px); }
  .combat-dock .hud-left { padding:10px 13px 8px; }
  .combat-dock .hud-abilities { border-left:0; border-top:1px solid #adc1d014; padding:9px 0 10px; margin:0 9px; gap:7px; }
  .combat-dock .slot { width:clamp(32px,calc((100vw - 88px) / var(--ability-count,6)),50px); height:clamp(32px,calc((100vw - 88px) / var(--ability-count,6)),50px); }
  #fullscreen-toggle { top:auto; bottom:calc(var(--combat-inset) + 10px); right:10px; padding:8px; }
  #fullscreen-toggle span { display:none; }
  .fullscreen-status { top:auto; bottom:calc(var(--combat-inset) + 52px); right:10px; }
}
@media(max-height:600px) and (min-width:761px) {
  :root { --combat-inset:92px; }
  .combat-dock { bottom:6px; }.combat-dock .hud-left { padding:8px 12px; }.combat-dock .hud-abilities { padding:8px 12px; }.combat-dock .slot { width:48px; height:48px; }
}
