:root {
  --ink: #f1e6c8;
  --dim: #b9ab86;
  --gold: #ffcf5a;
  --red: #ff5a3c;
  --panel: rgba(10, 12, 8, 0.42);
  --hud-font: 'Share Tech Mono', ui-monospace, Menlo, Consolas, monospace;
  --title-font: 'Black Ops One', Impact, 'Arial Black', sans-serif;
}
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden; background: #0b0d09;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
  color: var(--ink); font-family: var(--hud-font);
}
#stage { position: fixed; inset: 0; }
#gl { width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 1px 2px rgba(0,0,0,.8), 0 0 8px rgba(0,0,0,.5); }
.hud-tl, .hud-tr, .hud-bl, .hud-br { position: absolute; }
.hud-tl { left: max(16px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); }
.hud-tr { right: max(16px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); text-align: right; }
.hud-bl { left: max(16px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); }
.hud-br { right: max(16px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); text-align: right; }
.hud-label { font-size: 11px; letter-spacing: .22em; color: var(--dim); }
.hud-big { font-family: var(--title-font); font-size: 26px; letter-spacing: .06em; line-height: 1.05; }
.hud-chain { font-family: var(--title-font); font-size: 17px; color: var(--gold); height: 20px; opacity: 0; transition: opacity .2s; }
.hud-chain.on { opacity: 1; }
.hud-lives { display: flex; gap: 6px; margin-bottom: 6px; }
.hud-lives i { width: 18px; height: 18px; display: block; background: url(assets/ui/portrait.png) center/cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.hud-hp { display: flex; gap: 4px; }
.hud-hp i { width: 26px; height: 7px; display: block; background: #74c05a; box-shadow: 0 0 0 1px rgba(0,0,0,.6); transform: skewX(-18deg); }
.hud-hp i.off { background: rgba(255,255,255,.14); }
.hud-gren { font-family: var(--title-font); font-size: 22px; }
.hud-gren small { font-family: var(--hud-font); font-size: 11px; letter-spacing: .2em; color: var(--dim); display: block; }
.hud-obj { position: absolute; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); font-size: 12px; letter-spacing: .2em; color: var(--dim); white-space: nowrap; }
.hud-prog { position: absolute; right: max(10px, env(safe-area-inset-right)); top: 50%; width: 4px; height: 38vh; transform: translateY(-50%); background: rgba(255,255,255,.12); border-radius: 2px; }
#hud-prog-fill { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(255,207,90,.55); border-radius: 2px; }
#hud-prog-joe { position: absolute; left: -4px; width: 12px; height: 3px; background: var(--gold); }

.banner { position: fixed; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; text-shadow: 0 2px 10px rgba(0,0,0,.85); }
#banner-big { font-family: var(--title-font); font-size: clamp(34px, 7vw, 76px); letter-spacing: .06em; }
#banner-small { margin-top: 8px; font-size: clamp(12px, 1.6vw, 17px); letter-spacing: .3em; color: var(--dim); white-space: pre-line; }
.toast { position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%); font-family: var(--title-font); font-size: 18px; color: var(--gold); opacity: 0; transition: opacity .25s; pointer-events: none; text-shadow: 0 2px 6px rgba(0,0,0,.9); white-space: nowrap; }
.toast.on { opacity: 1; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
#title { background: radial-gradient(ellipse at center, rgba(8,10,6,.15) 0%, rgba(8,10,6,.55) 70%, rgba(8,10,6,.8) 100%); }
#pause { background: rgba(8,10,6,.6); }
#loading { background: #0b0d09; z-index: 20; }
.load-big { font-family: var(--title-font); font-size: clamp(34px, 7vw, 72px); color: var(--ink); letter-spacing: .06em; }
.title-inner { padding: 20px 16px; max-width: 640px; }
h1 { font-family: var(--title-font); font-weight: 400; font-size: clamp(48px, 11vw, 112px); margin: 0; line-height: .95; letter-spacing: .03em; color: #efe2bd; text-shadow: 0 4px 0 #3b2a14, 0 10px 30px rgba(0,0,0,.8); }
h1 span { display: block; font-size: .42em; color: var(--gold); letter-spacing: .3em; margin-top: 6px; }
h2 { font-family: var(--title-font); font-weight: 400; font-size: 54px; margin: 0 0 18px; }
.subtitle { letter-spacing: .38em; color: var(--dim); font-size: 13px; margin: 12px 0 26px; }
.menu { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.menu button {
  font: inherit; font-size: 15px; letter-spacing: .22em; color: var(--ink); cursor: pointer;
  background: rgba(15, 17, 11, .72); border: 1px solid rgba(241, 230, 200, .18); border-radius: 3px;
  padding: 11px 18px; min-width: 260px; transition: border-color .12s, background .12s;
}
.menu button.sel, .menu button:hover { border-color: var(--gold); color: var(--gold); background: rgba(35, 30, 12, .82); }
.help { margin-top: 18px; font-size: 13px; line-height: 1.7; color: var(--dim); background: rgba(10,12,8,.7); padding: 10px 16px; border-radius: 4px; }
.help b { color: var(--ink); letter-spacing: .12em; }
.help p { margin: 4px 0; }
.hiscores { margin-top: 20px; font-size: 13px; letter-spacing: .18em; color: var(--dim); line-height: 1.6; }
.hiscores b { color: var(--ink); }
.foot { margin-top: 22px; font-size: 11px; letter-spacing: .12em; color: #8a8068; }
.foot a { color: #c9b27a; }

/* ---------- touch ---------- */
#touch { position: fixed; inset: 0; pointer-events: none; }
.stick { position: absolute; bottom: 9vh; width: 132px; height: 132px; margin: -66px; border-radius: 50%; border: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.14); opacity: .75; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%; background: rgba(255,255,255,.28); }
#stick-l { left: calc(max(16px, env(safe-area-inset-left)) + 76px); }
#stick-r { right: calc(max(16px, env(safe-area-inset-right)) + 76px); left: auto; margin: -66px -66px -66px 0; }
#stick-r .knob { background: rgba(255,120,80,.35); }
.tbtn { position: absolute; pointer-events: auto; right: calc(max(16px, env(safe-area-inset-right)) + 170px); bottom: calc(9vh + 70px); width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,207,90,.5); background: rgba(0,0,0,.3); color: var(--gold); font-family: var(--title-font); font-size: 20px; }
.tbtn.small { width: 40px; height: 40px; font-size: 13px; right: max(16px, env(safe-area-inset-right)); left: auto; bottom: auto; top: calc(max(12px, env(safe-area-inset-top)) + 62px); border-color: rgba(255,255,255,.25); color: var(--ink); }
@media (max-width: 700px) {
  .hud-big { font-size: 20px; }
  .hud-obj { display: none; }
  .menu button { min-width: 220px; }
}

/* build v9: WATCH DEMO tag */
#demo-tag { position: fixed; top: 44px; left: 50%; transform: translateX(-50%); z-index: 30;
  font: 600 12px/1 ui-monospace, Menlo, monospace; letter-spacing: .18em; color: #f3dc9a;
  background: rgba(10, 12, 8, .62); border: 1px solid rgba(243, 220, 154, .45); border-radius: 3px;
  padding: 7px 12px; pointer-events: none; animation: demoPulse 1.6s ease-in-out infinite; }
#demo-tag .t { display: none; }
@media (pointer: coarse) { #demo-tag .k { display: none; } #demo-tag .t { display: inline; } }
@keyframes demoPulse { 50% { opacity: .55; } }
