.scene-hud {
  --edge:max(16px,3vw,env(safe-area-inset-right));
  --foot:max(14px,2.7vh,env(safe-area-inset-bottom));
  position:absolute!important; inset:0!important; width:auto!important; height:auto!important;
  padding:0!important; margin:0!important; display:block!important; pointer-events:none;
  color:#fffaf1; z-index:3; text-shadow:0 1px 4px #101817,0 1px 10px #111c;
  container:scenehud / size; font-family:"Avenir Next","PingFang SC",system-ui,sans-serif;
}
.scene-hud::before {content:"";position:absolute;inset:auto 0 0;height:122px;background:linear-gradient(transparent,rgba(10,17,19,.60))}
.scene-hud .hud-caption {position:absolute;left:max(var(--edge),env(safe-area-inset-left));bottom:var(--foot);text-align:left}
.scene-hud .hud-caption h1 {font:500 clamp(17px,1.65vw,25px)/1.15 Baskerville,Georgia,serif;color:inherit;margin:0}
.scene-hud .hud-caption p {font:500 clamp(9px,.8vw,12px)/1.4 "Avenir Next",system-ui,sans-serif;color:#efece3;letter-spacing:.055em;margin:4px 0 0}
.scene-controls {position:absolute;right:var(--edge);bottom:var(--foot);display:flex;align-items:end;gap:clamp(10px,1.4vw,22px);max-width:calc(100% - 2 * var(--edge))}
.scene-hud .action-bar {position:relative;z-index:1;display:flex;align-items:end;justify-content:flex-end;gap:clamp(3px,.65vw,11px);pointer-events:auto}
.scene-hud .action-bar button {position:relative;appearance:none;display:grid;place-content:center;justify-items:center;gap:4px;min-width:46px;min-height:49px;margin:0;padding:3px 4px 7px;border:0;border-radius:0;box-shadow:none;background:transparent;color:#fffaf1;text-shadow:inherit;cursor:pointer;font:550 11px/1.1 "Avenir Next","PingFang SC",system-ui,sans-serif;white-space:nowrap;letter-spacing:.035em;touch-action:manipulation}
.scene-hud .action-bar svg {display:block;width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 1px 2px #171b19)}
.scene-hud .action-bar button::after {content:"";position:absolute;bottom:0;left:50%;height:2px;width:13px;background:currentColor;transform:translateX(-50%) scaleX(0);transition:transform .15s}
.scene-hud .action-bar button:is(:hover,:focus-visible,:active,[aria-pressed=true]) {color:#ffe1a2}
.scene-hud .action-bar button:is(:hover,:focus-visible,:active,[aria-pressed=true])::after {transform:translateX(-50%) scaleX(1)}
.scene-hud .action-bar button:focus-visible {outline:1px dashed #ffe1a2;outline-offset:1px}
.scene-hud .action-bar button:disabled {opacity:.48}
.scene-hud [hidden]{display:none!important}
.quiet .scene-hud{visibility:hidden;opacity:0}
.terrain-credit{position:absolute;right:var(--edge-x,20px);top:0;font:10px/1.5 system-ui;color:inherit;pointer-events:auto;text-decoration:none}
@container scenehud (max-width:760px){
  .scene-controls{right:max(8px,env(safe-area-inset-right));max-width:calc(100% - 16px);flex-direction:column;align-items:flex-end;gap:5px}
  .scene-hud .action-bar{gap:1px}
  .scene-hud .action-bar button{min-width:44px;padding-inline:1px;min-height:44px;font-size:10px}
  .scene-hud .hud-caption{bottom:calc(var(--foot) + 54px);max-width:calc(100% - 166px)}
}
@media (prefers-reduced-motion:reduce){.scene-hud .action-bar button::after{transition:none}}
.scene-hud .direction-pad {position:relative;display:grid;align-self:flex-end;grid-template-columns:repeat(3,24px);gap:2px;pointer-events:auto}
.direction-pad button {appearance:none;box-sizing:border-box;min-width:0;width:24px;height:22px;padding:0;margin:0;border:0;border-bottom:1px solid #ffffff60;border-radius:2px;background:#131a1c38;color:#f2eee7;text-shadow:0 1px 3px #171a1b;font:500 11px/1 system-ui;cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none}
.direction-pad [data-direction=up]{grid-column:2}.direction-pad [data-direction=left]{grid-column:1}
.direction-pad .arrow{display:none}.direction-pad button.pressed,.direction-pad button:active{color:#ffda91;background:#453d2ed9;border-color:#ffda91}
.direction-pad button:focus-visible{outline:1px solid #ffda91;outline-offset:1px}
@media(pointer:coarse){.scene-hud .direction-pad{grid-template-columns:repeat(3,44px);gap:2px}.direction-pad button{width:44px;height:44px;font-size:19px}.direction-pad .arrow{display:inline}.direction-pad .letter{display:none}}
.choice-slot {position:relative}
.choice-slot > button::before {content:"";position:absolute;right:3px;top:6px;width:4px;height:4px;border-top:1px solid currentColor;border-left:1px solid currentColor;transform:rotate(45deg);opacity:.8}
.choice-list {position:absolute;bottom:100%;left:50%;transform:translateX(-50%);display:grid;min-width:64px;padding:4px;background:rgba(17,24,25,.9);backdrop-filter:blur(8px);border-radius:3px}
.choice-slot:first-child .choice-list {left:0;transform:none}
.choice-slot:last-child .choice-list {left:auto;right:0;transform:none}
.scene-hud .choice-list button {min-width:56px;min-height:34px;padding:5px 7px;font-size:12px}
.scene-hud .choice-list button[aria-pressed=true]{background:#ffe1a216}
.scene-hud .choice-list button::after {bottom:2px}
.scene-hud .action-bar .seat-prompt {color:#f7e6be}
.seat-prompt kbd {position:absolute;top:1px;right:0;font:600 8px/1 system-ui;opacity:.8}
@media(pointer:coarse){
  .seat-prompt kbd{display:none}
  .scene-hud .choice-list button{min-height:44px}
  .direction-pad button{background:transparent;border:0;font-size:16px}
  .direction-pad button::after{content:"";position:absolute;inset:8px;border-bottom:1px solid #fff5;background:#17202747;border-radius:2px;z-index:-1}
  .direction-pad button{position:relative;isolation:isolate}
}
@container scenehud (max-width:760px){
  .choice-list{max-height:54cqh;overflow-y:auto;overscroll-behavior:contain}
}
@container scenehud (max-width:335px){
  .scene-controls{right:max(2px,env(safe-area-inset-right));max-width:calc(100% - 4px)}
  .scene-hud .action-bar{gap:0}
}
