:root {
  color-scheme: dark;
  --bg: #07060b;
  --gold: #f3c24a;
  --gold-hi: #ffe7a0;
  --gold-lo: #b9811c;
  --cream: #fff3d6;
  --ink: #e9e2d0;
  --muted: rgba(233, 226, 208, 0.62);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#runner-root { position: fixed; inset: 0; }
#runner-canvas { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }

#hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 5;
}
.hud-block { min-width: 6.5rem; }
.hud-block.right { text-align: right; }
.hud-label {
  font-family: Orbitron, system-ui, sans-serif;
  font-size: 0.6rem; letter-spacing: 0.2em; color: rgba(243, 194, 74, 0.78);
}
.hud-value {
  font-family: Orbitron, system-ui, sans-serif; font-weight: 700;
  font-size: 1.45rem; color: var(--cream);
  text-shadow: 0 0 14px rgba(243, 194, 74, 0.45), 0 2px 0 rgba(0,0,0,0.5);
}
.hud-value.coins { display: inline-flex; align-items: center; gap: 0.35rem; justify-content: flex-end; }
.hud-sub { font-size: 0.72rem; color: var(--muted); }
.coin-icon { width: 1.2em; height: 1.2em; vertical-align: -0.2em; filter: drop-shadow(0 0 6px rgba(243,194,74,0.55)); }
.hud-buttons { display: flex; gap: 0.5rem; pointer-events: auto; }
.icon-btn {
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid rgba(243, 194, 74, 0.45);
  background: rgba(10, 8, 16, 0.55); color: var(--gold-hi);
  font-size: 0.95rem; cursor: pointer; backdrop-filter: blur(4px);
}
.icon-btn:active { transform: scale(0.94); }

#turn-hint {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-family: Orbitron, system-ui, sans-serif; font-weight: 900; font-size: clamp(1.4rem, 6vw, 2.4rem);
  color: var(--gold-hi); letter-spacing: 0.12em; pointer-events: none; z-index: 4;
  text-shadow: 0 0 18px rgba(243,194,74,0.85), 0 3px 0 rgba(0,0,0,0.6);
  animation: pulse 0.45s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 0.55; transform: translateX(-50%) scale(0.96);} to { opacity: 1; transform: translateX(-50%) scale(1.06);} }

.overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(243,194,74,0.10), transparent 60%), rgba(5, 4, 9, 0.55);
}
.card {
  width: min(92vw, 440px);
  max-height: calc(100dvh - 2rem); overflow: auto;
  text-align: center;
  padding: 1.6rem 1.4rem 1.3rem;
  border-radius: 20px;
  border: 1px solid rgba(243, 194, 74, 0.35);
  background: linear-gradient(180deg, rgba(24, 18, 10, 0.92), rgba(10, 8, 14, 0.94));
  box-shadow: 0 0 50px rgba(243,194,74,0.14), inset 0 1px 0 rgba(255,231,160,0.12);
}
.card.small { width: min(88vw, 340px); }
.kicker { font-family: Orbitron, system-ui, sans-serif; font-size: 0.62rem; letter-spacing: 0.22em; color: rgba(243,194,74,0.8); margin-bottom: 0.6rem; }
h1 {
  font-family: Orbitron, system-ui, sans-serif; font-weight: 900;
  font-size: clamp(1.9rem, 9vw, 2.8rem); line-height: 1.02; color: var(--cream);
  text-shadow: 0 0 22px rgba(243,194,74,0.35);
}
h1 span {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
h2 { font-family: Orbitron, system-ui, sans-serif; font-size: 1.7rem; color: var(--cream); margin-bottom: 0.6rem; }
.tag { margin: 0.8rem auto 1rem; max-width: 32ch; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.controls { list-style: none; text-align: left; font-size: 0.82rem; margin: 0 auto 1.2rem; max-width: 340px; display: grid; gap: 0.4rem; }
.controls li { padding: 0.45rem 0.7rem; border-radius: 10px; background: rgba(243,194,74,0.06); border: 1px solid rgba(243,194,74,0.14); }
.controls b { color: var(--gold-hi); font-weight: 600; }
.controls span { display: block; color: var(--muted); font-size: 0.74rem; }
.cta {
  display: block; width: 100%; padding: 0.95rem 1rem; border: 0; border-radius: 14px; cursor: pointer;
  font-family: Orbitron, system-ui, sans-serif; font-weight: 900; font-size: 1.05rem; letter-spacing: 0.16em;
  color: #2a1803;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 50%, #d79b2b);
  box-shadow: 0 6px 24px rgba(243,194,74,0.35), inset 0 -3px 0 rgba(120,70,8,0.4);
}
.cta:active { transform: translateY(1px); }
.ghost { margin-top: 0.7rem; background: none; border: 0; color: var(--muted); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; }
.fine { margin-top: 0.85rem; font-size: 0.7rem; color: var(--muted); }
.back { display: inline-block; margin-top: 0.6rem; font-size: 0.78rem; color: rgba(243,194,74,0.85); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.6rem 0 0.8rem; }
.stats div { padding: 0.6rem 0.3rem; border-radius: 12px; background: rgba(243,194,74,0.07); border: 1px solid rgba(243,194,74,0.16); display: flex; flex-direction: column; gap: 0.2rem; }
.stats b { font-family: Orbitron, system-ui, sans-serif; font-size: 1.15rem; color: var(--cream); }
.best { color: var(--gold-hi); font-size: 0.9rem; margin-bottom: 0.3rem; }
.balance { color: var(--muted); font-size: 0.85rem; margin-bottom: 1rem; }
.balance b { color: var(--cream); }
@media (max-height: 560px) { .controls { display: none; } .tag { margin: 0.5rem auto; } }

.fine.legal { font-size: 0.7rem; opacity: 0.75; margin-top: 0.6rem; }
.fine.legal a { color: inherit; }
.share-row { display:flex; gap:.5rem; justify-content:center; margin-top:.6rem; flex-wrap:wrap; }
.share-row .ghost { text-decoration:none; display:inline-block; border:1px solid #f3c24a; color:#ffd36b; border-radius:999px; padding:.35rem .9rem; }
#runner-meta { margin: .4rem 0 .6rem; text-align: left; font-size: .78rem; }
#runner-meta .meta-h { margin: .5rem 0 .25rem; font-weight: 800; letter-spacing: .1em; color: #f3c24a; font-size: .72rem; }
#runner-meta .meta-h small { font-weight: 500; letter-spacing: 0; color: #cdbf9e; }
#runner-meta .missions { list-style: none; margin: 0; padding: 0; }
#runner-meta .missions li { display: flex; gap: .35rem; padding: .12rem 0; color: #f5ead0; }
#runner-meta .missions li span { margin-left: auto; color: #cdbf9e; }
#runner-meta .missions li.done { opacity: .7; }
#runner-meta .skins { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; }
#runner-meta .skin { background: rgba(255,255,255,.05); border: 1px solid rgba(243,194,74,.35); border-radius: 10px; color: #f5ead0; font: 600 .72rem system-ui, sans-serif; padding: .35rem .2rem; cursor: pointer; }
#runner-meta .skin small { display: block; font-weight: 500; color: #cdbf9e; font-size: .64rem; }
#runner-meta .skin.on { border-color: #f3c24a; background: rgba(243,194,74,.18); }
.rlb { margin: .5rem 0; text-align: left; font-size: .78rem; }
.rlb .meta-h { margin: .3rem 0; font-weight: 800; letter-spacing: .1em; color: #f3c24a; font-size: .72rem; }
.rlb ol { margin: 0; padding-left: 1.4rem; max-height: 9.5rem; overflow: auto; color: #f5ead0; }
.rlb li { display: list-item; }
.rlb li span { display: inline-block; min-width: 60%; }
.rlb li b { float: right; }
.rlb-msg { margin: .2rem 0; color: #cdbf9e; font-size: .72rem; }
.rlb-submit { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .4rem; }
.rlb-submit input { flex: 1; min-width: 8rem; background: rgba(255,255,255,.06); border: 1px solid rgba(243,194,74,.45); border-radius: 8px; color: #fff3c4; padding: .35rem .5rem; font: inherit; }
.rlb-submit .ghost { margin-top: 0; border: 1px solid #f3c24a; color: #ffd36b; border-radius: 999px; padding: .3rem .8rem; text-decoration: none; }
.rlb-submit .rlb-msg { flex-basis: 100%; }
