:root {
  --mint: #9bf4e4;
  --mint-dim: rgba(155, 244, 228, 0.55);
  --muted: #8199a3;
  --line: rgba(151, 206, 213, 0.2);
  --amber: #f0bf7e;
  --red: #ff6a6a;
  --violet: #e58cff;
  --ink: #050a12;
  --panel: rgba(6, 16, 24, 0.55);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--ink); color: #eaf6f6; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
[hidden] { display: none !important; }
kbd { font-family: var(--mono); font-size: 10px; border: 1px solid rgba(190, 230, 235, 0.45); border-radius: 3px; padding: 2px 5px; color: #dff; background: rgba(10, 25, 32, 0.5); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.vignette { pointer-events: none; position: fixed; inset: 0; background: radial-gradient(ellipse at 55% 45%, transparent 45%, rgba(1, 5, 10, 0.6) 100%); }
#damage { pointer-events: none; position: fixed; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 40, 60, 0.55) 100%); transition: opacity 0.12s; }
#flash { pointer-events: none; position: fixed; inset: 0; background: #fff; opacity: 0; }

/* ---------- top bar ---------- */
.topbar { position: fixed; z-index: 6; top: 0; left: 0; right: 0; padding: 26px 4%; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; color: #eaf6f6; text-decoration: none; font-size: 14px; letter-spacing: 2.4px; font-weight: 700; }
.brand svg { width: 34px; height: 34px; fill: none; stroke: var(--mint); stroke-width: 1.3; }
.brand .thin { font-weight: 400; color: #b9cbd2; }
.brand small { display: block; font-size: 8px; letter-spacing: 2.6px; margin-top: 7px; color: var(--muted); font-weight: 400; }
.topRight { display: flex; gap: 10px; align-items: center; }
.status { display: flex; gap: 8px; align-items: center; font-size: 9px; letter-spacing: 1.6px; color: #a7babb; margin-right: 12px; font-family: var(--mono); }
.status i, .titleMeta i { background: var(--mint); display: inline-block; width: 5px; height: 5px; border-radius: 50%; box-shadow: 0 0 8px #9bf4e4aa; }
.status.alert { color: var(--red); }
.status.alert i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.iconBtn { border: 1px solid var(--line); background: rgba(10, 22, 28, 0.45); min-height: 31px; min-width: 31px; font-size: 10px; letter-spacing: 0.6px; color: #a9c5cb; padding: 6px 10px; border-radius: 3px; backdrop-filter: blur(6px); transition: border-color 0.2s, color 0.2s; }
.iconBtn:hover { border-color: var(--mint-dim); color: #fff; }
body.is-title #viewBtn, body.is-title #pauseBtn { display: none; }

/* ---------- title ---------- */
.title { position: fixed; inset: 0; z-index: 3; pointer-events: none; transition: opacity 0.9s ease; }
.title > * { pointer-events: auto; }
.title.leaving { opacity: 0; }
.title.leaving > * { pointer-events: none; }
.titleCopy { position: absolute; top: 50%; left: 9%; max-width: 640px; transform: translateY(-50%); }
.eyebrow { font-size: 9px; font-weight: 500; letter-spacing: 2.2px; color: var(--mint); display: flex; align-items: center; gap: 12px; font-family: var(--mono); }
.line { height: 1px; width: 30px; background: var(--mint); }
h1 { font-size: clamp(54px, 7vw, 112px); line-height: 1; font-weight: 400; letter-spacing: -0.055em; margin: 26px 0 24px; text-shadow: 0 0 40px rgba(0, 0, 0, 0.45); }
h1 em { font-style: normal; color: var(--mint); text-shadow: 0 0 34px rgba(110, 255, 230, 0.35); }
.titleCopy p { color: #a9bcc5; font-size: 15px; line-height: 1.75; margin: 0; }
.keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 18px; font-size: 13px; color: #c9d8dc; }
.keys span { margin: 0 12px 0 4px; }
.primary { border: 1px solid #b1ffed; background: var(--mint); color: #071919; padding: 18px 22px; font-size: 14px; font-weight: 600; min-width: 236px; display: flex; justify-content: space-between; gap: 35px; align-items: center; margin-top: 30px; border-radius: 3px; box-shadow: 0 0 40px rgba(107, 246, 205, 0.18); transition: background 0.2s, transform 0.2s, box-shadow 0.2s; }
.primary:hover:not(:disabled) { background: #c9fff4; transform: translateY(-2px); box-shadow: 0 0 50px rgba(107, 246, 205, 0.35); }
.primary:disabled { opacity: 0.6; cursor: progress; }
.primary b { font-size: 22px; font-weight: 400; line-height: 12px; }
.titleMeta { display: flex; gap: 26px; align-items: center; font-size: 9px; color: #92a6ae; letter-spacing: 1.6px; margin-top: 24px; font-family: var(--mono); }
.titleMeta i { margin-right: 6px; }
.planetLabel { position: absolute; left: 76%; top: 64%; display: flex; gap: 12px; font-size: 11px; letter-spacing: 2.2px; color: #d6e3df; font-family: var(--mono); }
.planetLabel small { font-size: 8px; display: block; margin-top: 8px; color: #9aafba; letter-spacing: 1.3px; }
.cross { color: var(--mint); font-size: 24px; font-weight: 200; line-height: 14px; }
.titleBottom { pointer-events: none !important; position: absolute; bottom: 34px; left: 4%; right: 4%; border-top: 1px solid var(--line); padding-top: 22px; display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: 2.2px; color: #91a7af; font-family: var(--mono); }
.titleBottom .cross { margin-left: 18px; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; font-family: var(--mono); }
.hud button { pointer-events: auto; }
.hudTL { position: absolute; top: 104px; left: 4%; max-width: 360px; }
.hudTL h2 { font-family: var(--sans); font-weight: 400; font-size: 30px; letter-spacing: -0.03em; margin: 10px 0 14px; }
.objective { border-left: 2px solid var(--mint); padding: 8px 12px 10px; background: linear-gradient(90deg, rgba(8, 26, 32, 0.6), transparent); display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; min-width: 290px; }
.objective.done { border-color: var(--amber); }
.objLabel { grid-column: 1 / -1; font-size: 8px; letter-spacing: 2px; color: var(--mint); }
.objective.done .objLabel { color: var(--amber); }
#objText { grid-column: 1 / -1; font-family: var(--sans); font-size: 13px; color: #e2eff0; line-height: 1.4; }
.objBar { height: 3px; background: rgba(155, 244, 228, 0.15); border-radius: 2px; overflow: hidden; }
.objBar i { display: block; height: 100%; width: 0; background: var(--mint); box-shadow: 0 0 10px var(--mint); transition: width 0.3s; }
.objective.done .objBar i { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.objCount { font-size: 12px; color: #fff; }
.objective.bump { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.04); } }

.hudTR { position: absolute; top: 104px; right: 4%; text-align: right; }
.scoreLabel { font-size: 9px; letter-spacing: 2.2px; color: var(--muted); }
.score { font-family: var(--sans); font-size: 44px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.chain { margin-top: 4px; color: var(--amber); font-size: 12px; letter-spacing: 1.5px; opacity: 0; transition: opacity 0.25s; }
.chain.on { opacity: 1; }
.chainBar { margin: 5px 0 0 auto; width: 110px; height: 2px; background: rgba(240, 191, 126, 0.2); }
.chainBar i { display: block; height: 100%; background: var(--amber); width: 0; margin-left: auto; }
.best { margin-top: 10px; font-size: 9px; letter-spacing: 2px; color: var(--muted); }
.best b { color: #cfe; font-weight: 500; margin-left: 6px; }

.hudBL { position: absolute; left: 4%; bottom: 34px; display: grid; gap: 10px; }
.meter { display: grid; grid-template-columns: 56px 190px 34px; align-items: center; gap: 10px; font-size: 9px; letter-spacing: 1.8px; color: var(--muted); }
.meter b { color: #eaf6f6; font-weight: 500; font-size: 12px; text-align: right; }
.bar { height: 6px; border: 1px solid var(--line); background: rgba(5, 15, 20, 0.5); padding: 1px; }
.bar i { display: block; height: 100%; width: 100%; background: var(--mint); box-shadow: 0 0 10px rgba(155, 244, 228, 0.6); transition: width 0.15s; }
.bar.boost i { background: #7ab8ff; box-shadow: 0 0 10px rgba(122, 184, 255, 0.6); }
.bar.shield.low i { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 0.6s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

.hudBR { position: absolute; right: 4%; bottom: 30px; }
.jump { width: 250px; border: 1px solid var(--line); background: rgba(6, 18, 24, 0.55); border-radius: 3px; padding: 12px 14px; display: grid; gap: 8px; text-align: left; backdrop-filter: blur(6px); }
.jump:disabled { cursor: default; }
.jumpTop { display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: 2px; color: var(--muted); }
.jumpBar { height: 6px; background: rgba(240, 191, 126, 0.12); border-radius: 1px; overflow: hidden; }
.jumpBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c78a3c, var(--amber)); transition: width 0.3s; }
.jumpText { font-size: 11px; letter-spacing: 1.6px; color: #cfe; }
.jump.ready { border-color: var(--amber); box-shadow: 0 0 30px rgba(240, 191, 126, 0.35); animation: ready 1.2s ease-in-out infinite; }
.jump.ready .jumpText { color: var(--amber); }
.jump.ready .jumpTop { color: var(--amber); }
@keyframes ready { 50% { box-shadow: 0 0 46px rgba(240, 191, 126, 0.6); } }
.jump.titan .jumpBar i { background: linear-gradient(90deg, #8a3c9e, var(--violet)); }

.reticle { position: absolute; left: 0; top: 0; width: 44px; height: 44px; margin: -22px 0 0 -22px; will-change: transform; }
.reticle i { position: absolute; inset: 0; border: 1px solid rgba(155, 244, 228, 0.55); border-radius: 50%; }
.reticle span { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 8px var(--mint); }
.reticle::before, .reticle::after { content: ''; position: absolute; background: rgba(155, 244, 228, 0.7); }
.reticle::before { left: -12px; right: -12px; top: 50%; height: 1px; clip-path: polygon(0 0, 22% 0, 22% 100%, 0 100%, 0 0, 78% 0, 100% 0, 100% 100%, 78% 100%); }
.reticle::after { display: none; }
.lock { position: absolute; left: 0; top: 0; width: 60px; height: 60px; will-change: transform; }
.lock i { position: absolute; width: 12px; height: 12px; border-color: var(--amber); border-style: solid; border-width: 0; }
.lock i:nth-child(1) { left: 0; top: 0; border-left-width: 2px; border-top-width: 2px; }
.lock i:nth-child(2) { right: 0; top: 0; border-right-width: 2px; border-top-width: 2px; }
.lock i:nth-child(3) { left: 0; bottom: 0; border-left-width: 2px; border-bottom-width: 2px; }
.lock i:nth-child(4) { right: 0; bottom: 0; border-right-width: 2px; border-bottom-width: 2px; }
.lock small { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font-size: 9px; letter-spacing: 1.5px; color: var(--amber); white-space: nowrap; }
.lock.core i { border-color: var(--violet); }
.lock.core small { color: var(--violet); }
.marker { position: absolute; left: 0; top: 0; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 1.5px solid #5ff5df; transform-origin: center; box-shadow: 0 0 8px rgba(95, 245, 223, 0.6); will-change: transform; }
.marker.core { border-color: var(--violet); box-shadow: 0 0 10px rgba(229, 140, 255, 0.7); width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.arrow { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.arrow i { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-top: 2px solid #5ff5df; border-right: 2px solid #5ff5df; filter: drop-shadow(0 0 6px #5ff5df); }
.arrow small { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); font-size: 9px; letter-spacing: 1.4px; color: #5ff5df; white-space: nowrap; }
.arrow.core i { border-color: var(--violet); filter: drop-shadow(0 0 6px var(--violet)); }
.arrow.core small { color: var(--violet); }
.warning { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); color: var(--red); font-size: 13px; letter-spacing: 3px; border: 1px solid rgba(255, 106, 106, 0.6); padding: 8px 16px; background: rgba(40, 6, 10, 0.45); animation: blink 0.7s infinite; white-space: nowrap; }
.toast { position: absolute; left: 50%; top: 118px; transform: translate(-50%, -8px); max-width: min(620px, 88vw); text-align: center; font-family: var(--sans); font-size: 15px; letter-spacing: 0.2px; color: #eaf6f6; padding: 12px 22px; border: 1px solid var(--line); background: rgba(6, 18, 24, 0.7); backdrop-filter: blur(6px); border-radius: 3px; opacity: 0; transition: opacity 0.3s, transform 0.3s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.gold { border-color: rgba(240, 191, 126, 0.7); color: #ffe2b8; }
.toast.violet { border-color: rgba(229, 140, 255, 0.7); color: #f4d6ff; }
.toast.red { border-color: rgba(255, 106, 106, 0.7); color: #ffd0d0; }
.popup { position: absolute; left: 0; top: 0; font-size: 15px; font-weight: 600; color: #fff; text-shadow: 0 0 10px rgba(255, 190, 120, 0.9); white-space: nowrap; animation: pop 1.1s ease-out forwards; pointer-events: none; }
.popup small { font-size: 10px; color: var(--amber); margin-left: 4px; }
.popup.teal { color: #c8fff6; text-shadow: 0 0 10px rgba(95, 245, 223, 0.9); font-size: 12px; }
.popup.violet { color: #f6dcff; text-shadow: 0 0 12px rgba(229, 140, 255, 0.9); font-size: 22px; }
@keyframes pop { 0% { opacity: 0; translate: -50% 0; scale: 0.7; } 15% { opacity: 1; scale: 1.1; } 100% { opacity: 0; translate: -50% -46px; scale: 1; } }
.hint { position: absolute; top: 84px; left: 50%; transform: translateX(-50%); font-size: 10px; letter-spacing: 1px; color: #9fb4bb; white-space: nowrap; transition: opacity 1.2s; }
.hint kbd { margin: 0 2px; }
.hint.gone { opacity: 0; }

.warpCard { position: fixed; z-index: 5; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; animation: warpIn 0.6s ease-out; }
.warpCard .eyebrow { justify-content: center; color: var(--amber); }
.warpCard h2 { font-size: clamp(36px, 5vw, 64px); font-weight: 300; letter-spacing: -0.04em; margin: 14px 0 6px; text-shadow: 0 0 30px rgba(0, 0, 0, 0.6); }
.warpCard p { color: #b7cad0; font-size: 15px; margin: 0; }
@keyframes warpIn { from { opacity: 0; letter-spacing: 0.2em; } }

/* ---------- modals ---------- */
.modalBack { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(2, 6, 12, 0.6); backdrop-filter: blur(5px); padding: 16px; }
.modal { width: min(520px, 100%); border: 1px solid var(--line); background: rgba(7, 17, 24, 0.92); padding: 34px 34px 26px; border-radius: 4px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.modal.wide { width: min(640px, 100%); }
.modal h2 { font-weight: 400; font-size: 32px; letter-spacing: -0.03em; margin: 14px 0 16px; }
.modal p { color: #a9bcc5; font-size: 14px; line-height: 1.7; }
.helpGrid { display: grid; grid-template-columns: 150px 1fr; gap: 10px 14px; font-size: 13px; color: #d2e2e5; align-items: center; margin: 8px 0 6px; }
.textBtn { display: block; background: none; border: 0; color: var(--muted); font-size: 12px; letter-spacing: 1px; margin-top: 14px; padding: 6px 0; }
.textBtn:hover { color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 8px 0 4px; }
.stats div { border-top: 1px solid var(--line); padding-top: 10px; }
.stats b { display: block; font-size: 26px; font-weight: 300; font-variant-numeric: tabular-nums; }
.stats span { font-size: 8px; letter-spacing: 1.8px; color: var(--muted); font-family: var(--mono); }
.newBest { display: inline-block; font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: #071919; background: var(--amber); padding: 5px 10px; border-radius: 2px; margin-bottom: 12px; }

/* ---------- touch ---------- */
.touch { position: absolute; inset: 0; pointer-events: none; }
.stick { pointer-events: auto; position: absolute; left: 5%; bottom: 120px; width: 140px; height: 140px; border-radius: 50%; border: 1px solid var(--line); background: rgba(10, 30, 36, 0.3); }
.stick i { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(155, 244, 228, 0.25); border: 1px solid var(--mint-dim); }
.touchBtns { position: absolute; right: 5%; bottom: 130px; display: flex; gap: 14px; align-items: flex-end; pointer-events: auto; }
.tBtn { width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); background: rgba(10, 30, 36, 0.45); font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: #cfe; }
.tBtn.fire { width: 96px; height: 96px; border-color: var(--mint-dim); color: var(--mint); }
.tBtn.on { background: rgba(155, 244, 228, 0.25); }

/* ---------- small screens ---------- */
@media (max-height: 660px) and (min-width: 821px) {
  .titleCopy { top: 52%; }
  h1 { font-size: clamp(46px, 6vw, 76px); margin: 14px 0 14px; }
  .titleCopy p { font-size: 13px; line-height: 1.6; }
  .keys { margin-top: 12px; }
  .primary { margin-top: 18px; }
  .titleMeta { margin-top: 14px; }
  .titleBottom { bottom: 14px; padding-top: 12px; }
}
@media (max-width: 820px) {
  .topbar { padding: 14px 16px; }
  .status, .brand small { display: none; }
  .titleCopy { left: 16px; right: 16px; top: auto; bottom: 90px; }
  h1 { font-size: 54px; margin: 16px 0; }
  .titleCopy p { font-size: 13px; }
  .keys { display: none; }
  .planetLabel { left: auto; right: 16px; top: 110px; }
  .titleBottom { left: 16px; right: 16px; bottom: 18px; font-size: 7px; }
  .hudTL { top: 66px; left: 16px; max-width: 60vw; }
  .hudTL h2 { font-size: 20px; margin: 6px 0 8px; }
  .objective { min-width: 0; }
  #objText { font-size: 11px; }
  .hudTR { top: 66px; right: 16px; }
  .score { font-size: 28px; }
  .hudBL { left: 16px; bottom: 16px; }
  .meter { grid-template-columns: 46px 90px 28px; }
  .hudBR { right: 16px; bottom: 12px; }
  .jump { width: 170px; padding: 8px 10px; }
  .hint { display: none; }
  .helpGrid { grid-template-columns: 110px 1fr; font-size: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 24px 20px 18px; }
}

.mixPanel { position: fixed; z-index: 8; top: 70px; right: 4%; width: 300px; max-width: calc(100vw - 32px); padding: 16px 18px 14px; border: 1px solid var(--line); background: rgba(6, 16, 22, 0.92); backdrop-filter: blur(10px); border-radius: 4px; display: grid; gap: 12px; font-size: 12px; color: #d6e6e8; }
.mixHead { display: flex; justify-content: space-between; align-items: center; }
.mixMute { border: 1px solid var(--line); background: transparent; color: #cfe; font-size: 11px; padding: 5px 10px; border-radius: 3px; }
.mixMute[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.mixRow { display: grid; grid-template-columns: 58px 1fr 34px; gap: 10px; align-items: center; }
.mixRow b { font-family: var(--mono); font-weight: 500; font-size: 11px; text-align: right; color: #eaf6f6; font-variant-numeric: tabular-nums; }
.mixRow input { width: 100%; accent-color: #9bf4e4; }
.mixNote { margin: 0; font-size: 10.5px; line-height: 1.5; color: var(--muted); }

/* short landscape screens (phones turned sideways) */
@media (max-height: 520px) {
  .topbar { padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .status, .brand small, .hint { display: none; }
  .hudTL { top: 52px; left: max(16px, env(safe-area-inset-left, 0px)); max-width: 40vw; }
  .hudTL h2 { font-size: 18px; margin: 4px 0 6px; }
  .objective { min-width: 0; padding: 5px 9px 6px; }
  #objText { font-size: 11px; }
  .hudTR { top: 52px; right: max(16px, env(safe-area-inset-right, 0px)); }
  .score { font-size: 26px; }
  .hudBL { left: 50%; transform: translateX(-50%); bottom: 8px; display: flex; gap: 18px; }
  .meter { grid-template-columns: 42px 70px 24px; }
  .hudBR { right: max(16px, env(safe-area-inset-right, 0px)); top: 132px; bottom: auto; }
  .jump { width: 150px; padding: 6px 9px; }
  .toast { top: auto; bottom: 40px; font-size: 12px; padding: 8px 14px; max-width: 44vw; }
  .stick { left: max(16px, env(safe-area-inset-left, 0px)); bottom: 14px; width: 116px; height: 116px; }
  .touchBtns { right: max(16px, env(safe-area-inset-right, 0px)); bottom: 14px; }
  .tBtn { width: 64px; height: 64px; }
  .tBtn.fire { width: 82px; height: 82px; }
  .warpCard h2 { font-size: 34px; }
  .mixPanel { top: 52px; right: max(16px, env(safe-area-inset-right, 0px)); gap: 8px; padding: 12px 14px; }
  .mixNote { display: none; }
  .titleBottom, .titleMeta, .keys { display: none; }
  .titleCopy { top: 54%; }
  h1 { font-size: 50px; margin: 10px 0; }
}
