/* Cart Climb · House of Carts — shell, HUD, entry, touch pad and dialog.
   Colours come from assets/colors/tokens.css. System fonts only. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--ink-900); color: var(--text); overflow: hidden; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:focus { outline: none; }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { -webkit-user-drag: none; }

#arcade { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; background: var(--ink-900); }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: var(--ink-900); image-rendering: auto; outline: none; }

/* ---------- HUD ---------- */
/* safe areas: every inset is max(design inset, env(safe-area-inset-*)) so notches, the Dynamic Island and the home bar never cover a control */
#hud { position: absolute; left: max(clamp(12px, 2.2vw, 32px), env(safe-area-inset-left)); right: max(clamp(12px, 2.2vw, 32px), env(safe-area-inset-right)); top: max(clamp(12px, 2.2vw, 32px), env(safe-area-inset-top)); height: 34px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; color: var(--text); }
#hud button { pointer-events: auto; }
.hud-left { display: flex; align-items: center; height: 100%; }
#floor-id { font-size: 11px; line-height: 19px; color: var(--hoc-green); border-left: 3px solid var(--hoc-green); padding-left: 7px; letter-spacing: 0.04em; width: 56px; white-space: nowrap; }
.room-stack { display: flex; flex-direction: column; align-self: flex-start; margin-left: 9px; }
#room { font-size: clamp(14px, 1.45vw, 18.56px); line-height: 1.05; font-weight: 700; letter-spacing: -0.01em; text-shadow: 0 1px 0 var(--ink-950); white-space: nowrap; }
#mode-badge { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 9px; line-height: 10px; margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--hoc-blue); }
#arcade[data-difficulty="nightmare"] #mode-badge { color: var(--hazard); }
#arcade[data-difficulty="nightmare"] #floor-id { color: var(--hazard); border-left-color: var(--hazard); }
.hud-right { display: flex; align-items: center; height: 100%; }
.hud-icon { display: inline-block; width: 14px; height: 14px; margin-right: 4px; opacity: 0.9; }
.hud-icon.skull { background: var(--text-muted); -webkit-mask: url("assets/images/icon-skull.svg") center / contain no-repeat; mask: url("assets/images/icon-skull.svg") center / contain no-repeat; }
.hud-icon.clock { background: var(--text-muted); -webkit-mask: url("assets/images/icon-clock.svg") center / contain no-repeat; mask: url("assets/images/icon-clock.svg") center / contain no-repeat; }
#deaths { font-size: 13px; line-height: 15px; margin-right: 27px; }
#timer { font-size: 13px; line-height: 15px; margin-right: 25px; min-width: 31px; }
/* the pause button is a 44x44 hit box (touch minimum); the visible 36x34 panel is drawn inside it, so the layout and look are unchanged */
#pause { position: relative; width: 44px; height: 44px; margin: -5px -4px; padding: 0; background: none; border: 0; border-radius: 7px; display: grid; place-items: center; font-size: 13px; }
#pause::before { content: ""; position: absolute; inset: 5px 4px; border-radius: 5px; background: var(--panel); border: 1px solid var(--panel-edge); }
#pause .bars { position: relative; display: block; width: 10px; height: 12px; border-left: 3px solid var(--text); border-right: 3px solid var(--text); }
#pause:hover::before { border-color: var(--hoc-blue); }

/* ---------- entry (start screen) ---------- */
#entry { position: absolute; left: 50%; top: 112px; transform: translateX(-50%); width: 530px; max-width: calc(100% - 36px); text-align: center; z-index: 3; }
/* soft scrim so the title copy reads over the level art (the art stays visible around it) */
#entry::before { content: ""; position: absolute; left: -70px; right: -70px; top: -56px; bottom: -34px; z-index: -1; pointer-events: none; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(12, 13, 31, 0.86) 0%, rgba(12, 13, 31, 0.7) 45%, rgba(12, 13, 31, 0.3) 75%, rgba(12, 13, 31, 0) 100%); }
#entry[hidden] { display: none; }
/* the brand lockup sits above the logotype in its own box, so the measured title block is unchanged */
.brand-lockup { position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin: 0 0 8px; display: flex; align-items: center; gap: 7px; font-size: 12px; line-height: 16px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap; color: var(--text); text-shadow: 0 1px 0 var(--ink-950); }
.brand-lockup em { font-style: italic; font-weight: 600; letter-spacing: 0.08em; text-transform: none; color: var(--text-muted); }
.brand-lockup img { display: block; width: 20px; height: 16px; }
#entry h1 { margin: 0 auto; width: 300px; height: 116px; display: block; }
#entry h1 img { display: block; width: 300px; height: 116px; filter: drop-shadow(0 4px 0 var(--ink-950)); }
#entry .premise { margin: 13px auto 0; max-width: 440px; font-size: 16px; line-height: 1.4; color: var(--text); text-shadow: 0 1px 0 var(--ink-950), 0 0 12px rgba(12, 13, 31, 0.8); }
#start-choices, .choices { margin: 19px 0 0; display: flex; justify-content: center; gap: 9px; }
.choice { display: flex; align-items: center; gap: 10px; height: 54.5px; padding: 0 16px; background: rgba(28, 29, 62, 0.92); border: 1px solid var(--panel-edge); border-radius: 6px; text-align: left; color: var(--text); }
.choice:hover { border-color: var(--hoc-blue); }
.choice-text { display: flex; flex-direction: column; }
.choice-text strong { font-size: 16px; line-height: 18px; font-weight: 700; }
.choice-text small { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; line-height: 13px; color: var(--text-muted); margin-top: 2px; }
.choice-icon { display: inline-block; width: 18px; height: 18px; flex: none; }
.choice-icon.flag { background: linear-gradient(var(--hoc-green), var(--hoc-green)) 2px 1px / 3px 16px no-repeat, linear-gradient(var(--hoc-green), var(--hoc-green)) 5px 1px / 11px 8px no-repeat; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
.choice-icon.skull { background: var(--hazard); -webkit-mask: url("assets/images/icon-skull.svg") center / contain no-repeat; mask: url("assets/images/icon-skull.svg") center / contain no-repeat; }
#quick-hint { margin: 12.5px 0 0; font-size: 10px; line-height: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; text-shadow: 0 1px 0 var(--ink-950); }

/* ---------- in-run bits ---------- */
#dash-state { position: absolute; left: max(clamp(12px, 2.2vw, 32px), env(safe-area-inset-left)); bottom: max(clamp(12px, 2.2vw, 32px), env(safe-area-inset-bottom)); font-size: 10px; line-height: 11px; letter-spacing: 0.14em; color: var(--text-muted); display: flex; align-items: center; gap: 6px; pointer-events: none; }
#dash-state .dot { width: 7px; height: 7px; background: var(--hoc-green); border-radius: 1px; box-shadow: 0 0 6px var(--hoc-green); }
#dash-state.spent { opacity: 0.45; }
#dash-state.spent .dot { background: var(--text-dim); box-shadow: none; }
#dash-state[hidden] { display: none; }
#notice { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); font-size: 12px; line-height: 16px; letter-spacing: 0.04em; padding: 7px 12px; background: rgba(28, 29, 62, 0.92); border: 1px solid var(--panel-edge); border-left: 3px solid var(--hoc-green); border-radius: 4px; color: var(--text); white-space: nowrap; pointer-events: none; z-index: 2; }
#notice[hidden] { display: none; }
/* with the touch pad on screen the notice sits 18px above the pad (pad bottom inset + pad height + 18px) at every size */
#arcade[data-touch="true"] #notice { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 109px + 18px); }
#roof-action { position: absolute; left: 0; top: 0; padding: 8px 12px; min-width: 98px; font-size: 16px; line-height: 20px; text-align: center; background: rgba(28, 29, 62, 0.94); border: 1px solid var(--hoc-green); border-radius: 6px; color: var(--text); pointer-events: none; white-space: nowrap; }
#roof-action small { display: block; font-size: 10px; line-height: 14px; color: var(--hoc-green); letter-spacing: 0.08em; }
#roof-action[hidden] { display: none; }

/* ---------- touch pad (phones) ---------- */
#touch-pad { position: absolute; left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); height: 109px; z-index: 2; }
#touch-pad[hidden], #arcade.dialog-open #touch-pad { display: none; }
#stick { position: absolute; left: 0; bottom: 0; width: 109px; height: 109px; border-radius: 50%; background: rgba(28, 29, 62, 0.78); border: 2px solid var(--panel-edge); touch-action: none; }
#stick.live { border-color: var(--hoc-green); }
#stick .knob { position: absolute; left: 50%; top: 50%; width: 49px; height: 49px; margin: -24.5px 0 0 -24.5px; border-radius: 50%; background: var(--steel); border: 3px solid var(--text); box-shadow: 0 3px 0 var(--ink-950); will-change: transform; }
#stick .knob::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ink-600); }
.stick-arrow { position: absolute; width: 0; height: 0; border: 6px solid transparent; opacity: 0.55; }
.stick-arrow.l { left: 8px; top: 50%; margin-top: -6px; border-right-color: var(--text-muted); border-left-width: 0; }
.stick-arrow.r { right: 8px; top: 50%; margin-top: -6px; border-left-color: var(--text-muted); border-right-width: 0; }
.stick-arrow.d { left: 50%; bottom: 8px; margin-left: -6px; border-top-color: var(--text-muted); border-bottom-width: 0; }
.pad-buttons { position: absolute; right: 0; bottom: 0; top: 0; width: 170px; }
.pad-btn { position: absolute; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: 0.08em; touch-action: none; padding: 0; }
.pad-btn.jump { right: 0; bottom: 2px; width: 90px; height: 90px; font-size: 13px; background: var(--hoc-green); color: var(--ink-900); border: 3px solid #9bffbf; box-shadow: 0 4px 0 #19934a; }
.pad-btn.jump .up { width: 0; height: 0; border: 9px solid transparent; border-bottom: 12px solid var(--ink-900); border-top-width: 0; margin-bottom: 2px; }
.pad-btn.jump::before { content: ""; position: absolute; width: 4px; height: 12px; background: var(--ink-900); top: 36px; border-radius: 1px; }
.pad-btn.dash { right: 98px; bottom: 21px; width: 66px; height: 66px; font-size: 11px; background: rgba(28, 29, 62, 0.92); color: var(--text); border: 3px solid var(--hoc-blue); box-shadow: 0 4px 0 var(--belt-dark); }
.pad-btn.dash .chev { width: 10px; height: 10px; border-top: 3px solid var(--hoc-blue); border-right: 3px solid var(--hoc-blue); transform: rotate(45deg); margin: 0 0 4px -4px; }
.pad-btn.dash.spent { opacity: 0.5; }
.pad-btn.pressed { transform: translateY(3px); box-shadow: none; }

/* ---------- overlay + dialog ---------- */
#overlay { position: absolute; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 5; padding: 16px; }
#overlay[hidden] { display: none; }
#dialog { position: relative; width: min(408px, calc(100vw - 32px)); max-width: 100%; --dp: clamp(21px, 0.9px + 3.11vw, 30px); padding: calc(var(--dp) - 3px) calc(var(--dp) - 1px) calc(var(--dp) - 1px); /* fluid inset incl. the 3px top / 1px side borders */ background: var(--panel); border: 1px solid var(--panel-edge); border-top: 3px solid var(--hoc-green); border-radius: 8px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); outline: none; }
#arcade[data-difficulty="nightmare"] #dialog { border-top-color: var(--hazard); }
.dialog-mark { position: absolute; right: 14px; top: 10px; opacity: 0.85; }
.dialog-mark img { display: block; width: 28px; height: 22px; }
#dialog-kicker { margin: 0 0 16px; font-size: 10px; line-height: 14px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--hoc-green); }
#arcade[data-difficulty="nightmare"] #dialog-kicker { color: var(--hazard); }
#dialog-title { margin: 0 0 10px; font-size: clamp(31px, 5vw, 45px); line-height: 1; font-weight: 900; letter-spacing: -0.02em; text-transform: uppercase; color: var(--text); }
#dialog-text { margin: 0 0 17px; font-size: 11px; line-height: 15.25px; min-height: 30.5px; color: var(--text-muted); white-space: pre-line; }
#dialog[data-view="won"] #dialog-text { font-size: 14px; line-height: 21px; min-height: 42px; color: var(--text); }
#dialog .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn { height: 45px; display: flex; align-items: center; gap: 10px; padding: 0 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(11px, 1.8vw, 13px); font-weight: 700; text-align: left; background: var(--panel-soft); border: 1px solid var(--panel-edge); border-radius: 6px; color: var(--text); }
.btn:hover { border-color: var(--hoc-blue); }
.btn.primary { background: var(--hoc-green); color: var(--ink-900); border-color: var(--hoc-green); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.wide { grid-column: 1 / -1; }
.btn[hidden] { display: none; }
.ico { display: inline-block; width: 12px; height: 12px; flex: none; position: relative; }
.ico.play { width: 0; height: 0; border: 6px solid transparent; border-left: 10px solid currentColor; border-right-width: 0; }
.ico.stairs { background: linear-gradient(currentColor, currentColor) 0 8px / 4px 4px no-repeat, linear-gradient(currentColor, currentColor) 4px 4px / 4px 8px no-repeat, linear-gradient(currentColor, currentColor) 8px 0 / 4px 12px no-repeat; }
/* glyph icons are small SVGs from assets/images used as masks, so they take the button's text colour */
.ico.again, .ico.keys, .ico.sound, .ico.full { background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.ico.again { --ico: url("assets/images/icon-again.svg"); }
.ico.keys { --ico: url("assets/images/icon-keys.svg"); }
.ico.sound { --ico: url("assets/images/icon-sound.svg"); }
.ico.full { --ico: url("assets/images/icon-full.svg"); }
.ico.back { width: 0; height: 0; border: 6px solid transparent; border-right: 10px solid currentColor; border-left-width: 0; }
.help { margin: 0 0 17px; font-size: 13px; line-height: 1.5; color: var(--text); }
.help p { margin: 0 0 8px; }
.help kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; padding: 1px 5px; background: var(--ink-900); border: 1px solid var(--panel-edge); border-radius: 3px; }
.help[hidden], .choices[hidden] { display: none; }
#dialog .choices { margin: 0 0 17px; }

/* ---------- phone portrait ---------- */
@media (max-width: 700px) {
  #hud { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); height: 32px; }
  #floor-id { font-size: 9px; line-height: 16px; width: 48px; padding-left: 5px; }
  .room-stack { margin-left: 6px; }
  #room { font-size: 14px; }
  #mode-badge { font-size: 8px; line-height: 9px; margin-top: 3px; }
  .hud-icon { width: 12px; height: 12px; margin-right: 3px; }
  #deaths { font-size: 11px; line-height: 13px; margin-right: 13px; }
  #timer { font-size: 11px; line-height: 13px; margin-right: 10px; min-width: 26px; }
  #pause { margin: -6px; font-size: 11px; }
  #pause::before { inset: 6px; }
  #entry { top: 110px; width: calc(100% - 36px); }
  .brand-lockup { font-size: 10px; line-height: 14px; margin-bottom: 6px; }
  .brand-lockup img { width: 17px; height: 14px; }
  #entry h1, #entry h1 img { width: 175px; height: 68px; }
  #entry .premise { margin-top: 10px; max-width: 280px; font-size: 13px; }
  #start-choices { margin-top: 12px; }
  .choice { height: 47.4px; padding: 0 12px; gap: 8px; }
  .choice-text strong { font-size: 15px; line-height: 17px; }
  .choice-text small { font-size: 10px; line-height: 12px; }
  #quick-hint { margin-top: 13px; font-size: 9px; line-height: 13.5px; }
  .btn { padding: 0 12px; }
  #notice { bottom: 18%; font-size: 11px; }
}
/* phone landscape */
@media (max-height: 520px) {
  #hud { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); }
  #entry { top: 24px; }
  .brand-lockup { display: none; } /* no room above the logotype in landscape; the brand is on the win screen and the roof */
  #entry h1, #entry h1 img { width: 132px; height: 51px; }
  #entry .premise { margin-top: 6px; font-size: 12px; max-width: 320px; }
  #start-choices { margin-top: 8px; }
  #quick-hint { margin-top: 8px; }
  #touch-pad { height: 22vh; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  #arcade[data-touch="true"] #notice { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 22vh + 18px); }
  #stick { width: 22vh; height: 22vh; }
  .pad-btn.jump { width: 18vh; height: 18vh; }
  .pad-btn.dash { width: 13vh; height: 13vh; right: 20vh; bottom: 4vh; }
  #dialog { --dp: 17px; }
  #dialog-title { font-size: 28px; }
  .btn { height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
