@font-face{font-family:Pixelify;src:url('./assets/pixelify.ttf') format('truetype');font-weight:400 700;font-display:swap}
@font-face{font-family:Plex Mono;src:url('./assets/plex-mono.ttf') format('truetype');font-weight:400;font-display:swap}

:root {
  color-scheme: dark;
  --ink: #151914;
  --panel: #1b2019;
  --border: #343d30;
  --text: #f3e8d3;
  --muted: #b1b19e;
  --accent: #f7a162;
  --pixel: Pixelify, monospace;
  --mono: 'Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; isolation: isolate; background: var(--ink); color: var(--text); font: 1rem/1.5 var(--mono); }
.forest-backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.forest-backdrop::before { content: ''; position: absolute; inset: -28px 0; background: url('./assets/north-woods.png') 66% center / cover no-repeat; }
.forest-backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #161b1480, #141a14a3 36%, #1118107a 70%, #141a14bf); }

@media (prefers-reduced-motion: no-preference) {
  [data-reveal] { transition: opacity .48s ease-out, translate .55s cubic-bezier(.22,.68,.34,1); }
  .reveal-pending:not(:focus-within) { opacity: .12; translate: 0 24px; }
  @supports (animation-timeline: scroll()) {
    .forest-backdrop::before { animation: forest-drift linear both; animation-timeline: scroll(root block); }
  }
}
@keyframes forest-drift { from { translate: 0 -22px; } to { translate: 0 22px; } }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; }
button:not(:disabled) { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.wrap { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--border); background: #151b16eb; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 24px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; font: 700 1.3rem/1 var(--pixel); white-space: nowrap; }
.logo-tile { width: 35px; height: 35px; display: block; border-radius: 50%; image-rendering: pixelated; }
nav { display: flex; gap: clamp(20px, 3.2vw, 46px); color: #c3c3ae; font-size: .875rem; white-space: nowrap; }
nav a:hover, .site-footer a:hover { color: var(--accent); }
.launch-status { display: inline-flex; align-items: center; gap: 9px; border: 1px solid #554838; background: #272218; padding: 7px 11px; color: var(--accent); text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; }
.launch-status span { width: 6px; height: 6px; background: var(--accent); }
.launch-status b { font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.header-x { width: 34px; height: 34px; display: grid; place-items: center; background: #242820; border: 1px solid #4d4f40; color: #ead8b9; -webkit-tap-highlight-color: #f4af7650; }
.header-x:hover { color: var(--accent); border-color: var(--accent); }
.x-mark { width: 14px; height: 14px; position: relative; display: block; }
.x-mark::before, .x-mark::after { content: ''; position: absolute; inset: 0; background: currentColor; }
.x-mark::before { clip-path: polygon(0 0, 28% 0, 100% 100%, 72% 100%); }
.x-mark::after { clip-path: polygon(82% 0, 100% 0, 18% 100%, 0 100%); }

.intro { display: flex; justify-content: space-between; align-items: end; gap: 26px; padding: 58px 0 34px; text-shadow: 0 2px 3px #10160d, 0 0 18px #11160f; }
.eyebrow { color: var(--accent); font-size: .8125rem; letter-spacing: .145em; margin: 0 0 14px; }
.eyebrow span { display: inline-block; vertical-align: middle; width: 25px; height: 2px; margin-right: 6px; background: var(--accent); }
h1 { font: 700 clamp(2.9rem, 7.45vw, 7rem)/.88 var(--pixel); letter-spacing: -.055em; margin: 0; white-space: nowrap; }
h1 em { color: var(--accent); font-style: normal; }
.intro-copy { color: #cfccba; max-width: 33ch; margin: 0 0 1px; }

.arcade { border: 1px solid #444b3b; background: var(--panel); box-shadow: 0 4px 0 #0d100d; scroll-margin-top: 8px; }
.hud { display: flex; align-items: center; gap: clamp(16px, 3.9vw, 56px); padding: 9px 19px; min-height: 56px; }
.stat { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.stat > span { color: var(--muted); font-size: .75rem; letter-spacing: .075em; text-transform: uppercase; }
.stat output { font: 700 1.45rem/1 var(--pixel); min-width: 2ch; }
.hud-tools { display: flex; margin-left: auto; gap: 8px; }
.hud-button { min-height: 34px; min-width: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 3px 9px; border: 1px solid #47503f; background: #252d23; color: var(--text); font-size: .8125rem; }
.hud-button:disabled { opacity: .46; }
.hud-button:hover:not(:disabled), .hud-button[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); }
.pause-icon { width: 10px; height: 12px; border-inline: 3px solid currentColor; }
.sound-icon { font: 700 1.2rem/1 var(--pixel); }
.sound:not([aria-pressed='true']) .sound-icon { color: #afad97; text-decoration: line-through; }

.stage { height: clamp(365px, 35vw, 510px); position: relative; isolation: isolate; overflow: hidden; border-block: 1px solid #4a4937; background: #25291d; }
.stage::before { content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; background: linear-gradient(180deg, #1519112b, transparent 27%, transparent 78%, #11150d45); }
#screen { position: absolute; inset: 0; display: block; width: 100%; height: 100%; image-rendering: pixelated; touch-action: none; }
#screen:focus-visible { outline-offset: -3px; }
.stage[data-mode='running'] #screen { cursor: crosshair; }
.scanlines { position: absolute; pointer-events: none; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, #10150b18 0 1px, transparent 1px 4px); }
.stage-caption { position: absolute; left: 19px; top: 17px; z-index: 2; display: flex; align-items: center; gap: 9px; padding: 5px 9px; background: #181b14e8; color: #e8dbc0; font-size: .75rem; letter-spacing: .08em; border: 1px solid #9a805b63; pointer-events: none; }
.stage-caption span { width: 6px; height: 6px; background: var(--accent); }
.overlay { position: absolute; z-index: 3; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 12px 0; text-align: center; background: radial-gradient(ellipse at 50% 43%, #151710c4 0%, #15171047 47%, transparent 74%); }
.stage[data-mode='paused'] .overlay, .stage[data-mode='over'] .overlay { background: #141711c9; }
.overlay h2 { margin: 0; font: 700 clamp(2.55rem, 5.2vw, 5.45rem)/.81 var(--pixel); letter-spacing: -.035em; text-shadow: 3px 4px #16180e; white-space: pre-line; }
.overlay > p { margin: 0; font-size: .875rem; }
.play-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 51px; min-width: 186px; padding: 9px 17px; border: 2px solid #ffd0a8; background: var(--accent); color: #211a12; box-shadow: 0 4px #954823; font: 700 1.55rem/1 var(--pixel); }
.play-button:hover { background: #ffbc86; }
.play-button:active { transform: translateY(2px); box-shadow: 0 2px #954823; }
.play-icon { width: 12px; height: 15px; background: currentColor; clip-path: polygon(0 0, 29% 0, 29% 18%, 56% 18%, 56% 34%, 77% 34%, 77% 43%, 100% 43%, 100% 57%, 77% 57%, 77% 66%, 56% 66%, 56% 82%, 29% 82%, 29% 100%, 0 100%); }
.text-button { background: #1b2019; border: 1px solid #74705c; padding: 5px 12px; font-size: .875rem; }
.text-button:hover { border-color: var(--accent); }
.wave-notice { z-index: 2; pointer-events: none; position: absolute; top: 15%; inset-inline: 0; text-align: center; margin: 0; color: #ffdcaa; font: 700 clamp(1.65rem, 4vw, 2.65rem)/1 var(--pixel); text-shadow: 2px 3px #191a12; }

.controls { display: flex; align-items: center; gap: 22px; padding: 13px 19px; color: var(--muted); scroll-margin-top: 16px; }
.controls h2 { margin: 0; color: #ebdec4; font: 700 1.2rem/1 var(--pixel); }
.desktop-help { display: flex; flex-wrap: wrap; gap: 9px clamp(13px, 2.3vw, 34px); align-items: center; font-size: .8125rem; }
.desktop-help > span { white-space: nowrap; }
kbd { display: inline-block; min-width: 22px; padding: 2px 5px; text-align: center; margin-right: 4px; border: 1px solid #4a5342; border-bottom-width: 2px; background: #252c22; color: #f3e8d3; font: inherit; line-height: 1.3; }
.touch-controls { align-items: center; justify-content: space-between; gap: 24px; padding: 10px 13px; border-bottom: 1px solid var(--border); touch-action: none; user-select: none; }
.dpad { display: grid; grid-template-columns: repeat(3, 43px); grid-template-rows: repeat(2, 43px); gap: 3px; }
.dpad button, .fire-button { border: 1px solid #5a6750; background: #293226; touch-action: none; }
.dpad button:nth-child(1) { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
.dpad button:nth-child(3) { grid-column: 2; grid-row: 2; }
.dpad button:nth-child(4) { grid-column: 3; grid-row: 2; }
.fire-button { padding: 12px 14px; min-height: 48px; border-color: #c1804a; color: #ffd3a5; }
.touch-controls button:active { background: #5b442b; }
.touch-help { display: none; margin: 0; font-size: .875rem; }

.launch-links { display: flex; flex-wrap: wrap; gap: 8px; }
.launch-links > * { border: 1px solid #68543c; color: var(--accent); background: #2a251b; padding: 6px 10px; font-size: .875rem; }
.launch-links a:hover, .launch-links button:hover { background: #393023; }
.site-footer { padding-block: 24px 32px; display: grid; grid-template-columns: 1fr minmax(0, max-content) 1fr; align-items: center; gap: 12px; color: #d5ceba; font-size: .8125rem; text-shadow: 0 1px 3px #10160d; }
.footer-brand { color: #d5c9ad; font: 700 1.05rem/1.4 var(--pixel); }
.footer-contract { grid-column: 2; display: flex; justify-content: center; align-items: baseline; gap: 8px; padding: 6px 9px; border: 1px solid #665139; background: #211f17ed; color: var(--accent); }
.footer-contract code { min-width: 0; overflow-wrap: anywhere; color: var(--text); font: inherit; }
.site-footer > a { grid-column: 3; justify-self: end; }

@media (max-width: 760px) {
  .site-footer { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .site-footer > :is(.footer-brand, .footer-contract, a) { grid-column: 1; justify-self: center; }
}

@media (max-width: 1000px) {
  .intro { flex-wrap: wrap; gap: 16px; }
  .intro-copy { max-width: 55ch; }
}
@media (max-width: 690px) {
  .forest-backdrop::before { background-position: 30% center; }
  .wrap { width: calc(100% - 30px); }
  .header-inner { flex-wrap: wrap; min-height: 0; padding: 13px 0 12px; gap: 12px; }
  nav { order: 1; flex-basis: 100%; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 10px; }
  .wordmark { font-size: 1.13rem; gap: 8px; }
  .logo-tile { width: 29px; height: 29px; }
  .launch-status { font-size: .625rem; padding: 5px 6px; gap: 5px; letter-spacing: 0; }
  .intro { padding: 31px 0 23px; gap: 12px; }
  .intro .eyebrow { font-size: .6875rem; margin-bottom: 11px; }
  h1 { font-size: clamp(2.24rem, 9.2vw, 4.2rem); }
  .intro-copy { font-size: .9375rem; }
  .hud { padding: 7px 8px; min-height: 48px; gap: 13px; }
  .stat { gap: 4px; flex-direction: column; align-items: flex-start; }
  .stat > span { font-size: .625rem; line-height: 1; }
  .stat output { font-size: 1.12rem; }
  .hud-tools { gap: 4px; }
  .hud-button { min-width: 34px; }
  .stage { height: clamp(280px, 48vw, 355px); }
  .stage-caption { top: 10px; left: 9px; font-size: .625rem; }
  .play-button { min-height: 44px; min-width: 155px; font-size: 1.3rem; }
  .overlay { gap: 12px; padding-top: 18px; }
  .controls { padding: 12px 10px; flex-wrap: wrap; gap: 8px; }
  .desktop-help { white-space: normal; }
}
@media (any-pointer: coarse) {
  .touch-controls { display: flex; }
  .desktop-help { display: none; }
  .touch-help { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.hud { gap: clamp(10px, 2.6vw, 40px); }
.hud-tools { margin-left: 0; }
.stat output { min-width: 0; }
.stat.remaining { margin-left: auto; }
.stat.remaining output { color: var(--accent); min-width: 2ch; }
.hud-button.compact { min-width: 27px; min-height: 28px; padding: 1px 5px; }

.stage { height: clamp(395px, 38vw, 535px); }
.stage-caption b { font-weight: 400; }
.stage[data-mode='running'] .stage-caption { opacity: .82; }
.stage[data-mode='menu'] .overlay { background: radial-gradient(ellipse at 50% 47%, #171b12eb 3%, #171b12b3 39%, #171b1220 84%); }
.overlay { justify-content: safe center; overflow-y: auto; padding: 32px 18px 18px; }
.overlay h2 { font-size: clamp(2.45rem, 5vw, 4.9rem); }
.overlay > .scene-kicker { color: var(--accent); font-size: .75rem; letter-spacing: .16em; }
.overlay > #overlay-copy { max-width: 53ch; color: #e3d9c0; line-height: 1.55; }
.overlay .play-button { flex-shrink: 0; }
.stage[data-mode='over'] .overlay { gap: 12px; }
.stage[data-mode='over'] .overlay h2 { font-size: clamp(2.3rem, 4.2vw, 4.2rem); }
.run-result { display: flex; gap: 1px; background: #60513b; border: 1px solid #60513b; }
.run-result > div { display: grid; align-content: center; gap: 4px; background: #211f16; padding: 7px 12px; }
.run-result span { color: #dbd0b8; font-size: .75rem; }
.run-result strong { font: 700 1.45rem/1 var(--pixel); }
.rank-form { display: grid; gap: 4px; justify-items: center; }
.rank-form label, #submit-status { color: #d9c8aa; font-size: .75rem; }
.rank-form > div { display: flex; gap: 4px; }
.rank-form input { width: min(44vw, 170px); min-width: 0; padding: 5px 9px; background: #1a1e17; color: var(--text); border: 1px solid #6e654e; font: inherit; }
#submit-status { margin: 0; }
.wave-notice { top: 17%; }

.finance { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: stretch; border-bottom: 1px solid var(--border); background: #20261d; }
.finance-card { padding: 12px 19px; }
.finance-card > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 11px; }
.finance-card.investment { text-align: right; }
.finance-card.investment > div { justify-content: flex-end; }
.finance-label { color: #c4c1ac; letter-spacing: .04em; font-size: .75rem; }
.finance-card strong { color: #f4e9cd; font: 700 1.8rem/1 var(--pixel); white-space: nowrap; }
.finance-card output { background: #2b3627; border: 1px solid #546347; color: #d1d8bb; padding: 1px 5px; font-size: .8125rem; white-space: nowrap; }
.finance-card small { display: block; color: #b9b9a3; font-size: .75rem; }
.positive, .finance-card output.positive { color: #bfe29a; }
.negative, .finance-card output.negative { color: #ffad9c; }
.finance-card output.negative { background: #382722; border-color: #68463a; }
.finance-card.pop { animation: cash-pop .35s steps(5) both; }
@keyframes cash-pop { from { background: #435738; } to { background: transparent; } }
.finance-card.loss { animation: cash-loss .35s steps(5) both; }
@keyframes cash-loss { from { background: #5c3129; } to { background: transparent; } }
.touch-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.touch-actions .hud-button { min-height: 48px; }

.shop { position: absolute; z-index: 4; inset: 0; overflow: auto; overscroll-behavior: contain; padding: 13px 20px; background: #151a13e8; }
.shop-panel { max-width: 970px; margin: auto; }
.shop-heading, .shop-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.shop-heading h2, .ranking-head h2 { margin: 0; font: 700 clamp(1.9rem,4vw,3rem)/1 var(--pixel); }
#shop-title:focus { outline: none; }
.shop-heading .eyebrow, .ranking-head .eyebrow { margin-bottom: 3px; }
.shop-balance { text-align: right; white-space: nowrap; }
.shop-balance span, .shop-summary { color: #c1bfaa; font-size: .8125rem; }
.shop-balance strong { display: block; color: #c4df94; font: 700 2rem/1 var(--pixel); }
.shop-summary { margin: 7px 0; }
.shop h3, .shop-weapons-panel summary { margin: 9px 0 5px; color: #e3d8bb; font: 700 1.28rem/1 var(--pixel); }
.shop-weapons-panel summary { display: flex; justify-content: space-between; align-items: center; list-style: none; cursor: pointer; }
.shop-weapons-panel summary::-webkit-details-marker { display: none; }
.shop-weapons-panel summary::after { content: '+'; color: var(--accent); padding: 0 5px; }
.shop-weapons-panel[open] summary::after { content: '−'; }
.shop-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.shop-item { display: grid; grid-template: auto 1fr auto / 1fr; justify-items: start; gap: 3px; min-width: 0; background: #242a1f; border: 1px solid #49533e; padding: 7px 9px; }
.shop-item h4 { margin: 0; color: #f1e3c5; font: 700 1.16rem/1 var(--pixel); }
.shop-item p { margin: 0; color: #ccceb7; font-size: .75rem; line-height: 1.25; }
.shop-item button { border: 1px solid #73583e; background: #33291d; color: var(--accent); padding: 2px 7px; font-size: .75rem; }
.shop-item button:hover:not(:disabled) { border-color: var(--accent); }
.shop-item button:disabled { background: #21261e; border-color: #414b38; color: #b0b49b; }
.shop-footer { position: sticky; bottom: -1px; margin-top: 10px; padding: 7px 0 5px; background: #161b14; border-top: 1px solid #3d4837; }
.shop-footer .play-button { min-height: 38px; min-width: 0; font-size: 1.23rem; white-space: nowrap; }
#shop-status { margin: 0; color: #e7d6ab; font-size: .8125rem; }

.ranking-panel { margin-top: 39px; padding: 20px 24px; border: 1px solid #46503c; background: #1b211af5; box-shadow: 0 4px #121911ab; scroll-margin-top: 16px; }
.ranking-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.ranking-head p:last-child { max-width: 53ch; margin: 0; color: var(--muted); font-size: .875rem; }
#ranking-status { color: #cbc8b4; font-size: .875rem; }
.ranking-panel table { width: 100%; border-collapse: collapse; margin-top: 12px; text-align: left; }
.ranking-panel td, .ranking-panel th { padding: 6px 5px; border-top: 1px solid #373f31; }
.ranking-panel th { color: #c5b899; font-size: .8125rem; font-weight: 400; }
.ranking-panel td:last-child, .ranking-panel th:last-child { text-align: right; }
.ranking-panel td:nth-child(2) { overflow-wrap: anywhere; }
.ranking-panel td:last-child { white-space: nowrap; }

.fullscreen-icon {
  width: 15px;
  height: 15px;
  background: linear-gradient(currentColor 0 0) top left, linear-gradient(currentColor 0 0) top right, linear-gradient(currentColor 0 0) bottom right, linear-gradient(currentColor 0 0) bottom left;
  background-repeat: no-repeat;
  background-size: 5px 2px;
  position: relative;
}
.fullscreen-icon::before { content: ''; position: absolute; inset: 0; background: inherit; background-size: 2px 5px; }
#fullscreen[aria-pressed='true'] .fullscreen-icon { transform: scale(.8); }
.arena-maximized { overflow: hidden; }
.arcade.is-maximized { position: fixed; inset: 0; z-index: 80; height: 100vh; height: 100dvh; }
.arcade.is-fullscreen { display: flex; flex-direction: column; width: 100%; max-height: 100%; background: #191e16; border: 0; overflow: hidden; }
.arcade.is-fullscreen .stage { flex: 1 1 auto; min-height: 0; height: auto; }
.arcade.is-fullscreen .hud, .arcade.is-fullscreen .finance, .arcade.is-fullscreen .touch-controls, .arcade.is-fullscreen .controls { flex: none; }
.arcade.is-fullscreen .hud { padding-inline: max(17px, env(safe-area-inset-left)) max(17px, env(safe-area-inset-right)); }
.arcade.is-fullscreen .controls { padding-block: 7px; }
.arcade.is-fullscreen .shop { padding-block: 20px; }
.arcade.is-fullscreen .shop-panel { max-width: 1050px; }
.arcade.is-fullscreen .finance-card { padding-block: 8px; }
#position-chart { display: block; align-self: center; width: 48px; height: 15px; image-rendering: pixelated; }

.token-panel { display: grid; grid-template-columns: auto minmax(0,1fr) minmax(0,.82fr); gap: 23px; align-items: center; margin-top: 37px; padding: 24px; border: 1px solid #625039; background: #272219f5; box-shadow: 0 4px #171910aa; scroll-margin-top: 16px; }
.token-emblem { display: block; width: 99px; height: 99px; border-radius: 50%; image-rendering: pixelated; }
.token-copy .eyebrow { margin-bottom: 4px; }
.token-copy h2 { margin: 0 0 7px; font: 700 clamp(1.87rem, 3.35vw, 3.3rem)/.96 var(--pixel); }
.token-copy h2 em { color: var(--accent); font-style: normal; white-space: nowrap; }
.token-copy p:last-child { max-width: 50ch; margin: 0; color: #ceccb5; font-size: .875rem; }
.token-details { min-width: 0; padding-left: 19px; border-left: 1px solid #544533; }
.token-details dl { display: flex; gap: 3px 20px; flex-wrap: wrap; margin: 0 0 9px; }
.token-details dt, .contract span { color: #bdb79c; font-size: .75rem; }
.token-details dd { margin: 0; font: 700 1.15rem/1.1 var(--pixel); color: #f2ddb5; }
.contract { display: flex; justify-content: space-between; gap: 7px; align-items: center; padding: 6px 8px; border: 1px solid #544835; background: #1c1d15; }
.contract output { display: block; overflow-wrap: anywhere; user-select: text; color: #e4ceaa; font-size: .8125rem; }
.contract .text-button { flex-shrink: 0; }
.token-details > p { margin: 6px 0 0; font-size: .75rem; color: #bdb79c; }
.token-details .launch-links { margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 690px) {
  nav { gap: 8px; font-size: .75rem; }
  .hud { gap: 8px; }
  .stat { gap: 3px; }
  .stat.remaining span { white-space: normal; }
  .stat.remaining { align-items: flex-end; text-align: right; }
  .hud-tools { gap: 4px; }
  .hud-tools .hud-button { min-width: 29px; padding-inline: 5px; }
  .stage { height: clamp(340px, 65vw, 435px); }
  .overlay { gap: 9px; padding: 34px 8px 10px; }
  .overlay h2 { font-size: clamp(2rem, 8.5vw, 3.5rem); }
  .overlay > #overlay-copy { max-width: 39ch; font-size: .8125rem; }
  .stage[data-mode='over'] .overlay h2 { font-size: clamp(1.85rem, 7.7vw, 3rem); }
  .run-result > div { padding: 4px 5px; }
  .run-result span { font-size: .625rem; }
  .finance { grid-template-columns: 1fr 1fr; }
  .finance-card { padding: 6px 8px; }
  .finance-card > div { gap: 3px 6px; }
  .finance-label { flex-basis: 100%; font-size: .6875rem; }
  .finance-card strong { font-size: 1.35rem; }
  .finance-card output, .finance-card small { font-size: .625rem; }
  #position-chart { display: none; }
  .shop { padding: 8px; }
  .shop-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .shop-balance span { font-size: .625rem; }
  .shop-balance strong { font-size: 1.5rem; }
  .shop-item p { font-size: .6875rem; }
  .ranking-panel { padding: 11px; margin-top: 24px; }
  .ranking-head { flex-direction: column; align-items: start; }
  .ranking-panel table { font-size: .8125rem; }
  .arcade.is-fullscreen .hud { padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .arcade.is-fullscreen .shop { padding-block: 8px; }
  .token-panel { grid-template-columns: auto minmax(0,1fr); gap: 12px; margin-top: 24px; padding: 12px; }
  .token-emblem { width: 56px; height: 56px; }
  .token-details { grid-column: 1/-1; padding: 10px 0 0; border: 0; border-top: 1px solid #544533; }
}
@media (min-width: 691px) and (max-width: 1000px) {
  .token-panel { grid-template-columns: auto minmax(0,1fr); }
  .token-details { grid-column: 2; padding: 9px 0 0; border: 0; border-top: 1px solid #544533; }
}
@media (any-pointer: coarse) {
  .arcade.is-fullscreen .controls { display: none; }
  .arcade.is-fullscreen .touch-controls { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (any-pointer: coarse) and (max-height: 520px) and (orientation: landscape) {
  .arcade.is-fullscreen .finance { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); }
  .arcade.is-fullscreen .touch-controls { padding-top: 3px; }
  .arcade.is-fullscreen .dpad { grid-template: repeat(2,32px) / repeat(3,39px); }
}
@media (prefers-reduced-motion: reduce) {
  .finance-card { animation: none !important; }
}

.stat.streak output { color: #edc789; }
.medal-strip { position: absolute; z-index: 2; top: 11%; left: 10px; right: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; pointer-events: none; }
.medal { display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; padding: 5px 8px; border: 1px solid #c98f53; background: #1e2017ee; color: #ffd79a; box-shadow: 0 2px #120f0b; animation: medal-in .23s ease-out both; }
.medal::before { content: ''; grid-row: 1/3; width: 17px; height: 19px; background: #e3ab69; clip-path: polygon(0 12%,24% 12%,24% 0,76% 0,76% 12%,100% 12%,100% 68%,74% 68%,74% 88%,50% 100%,26% 88%,26% 68%,0 68%); }
.medal strong { font: 700 1.08rem/1 var(--pixel); }
.medal span { font-size: .6875rem; color: #c8e9ac; }
@keyframes medal-in { from { opacity: .1; transform: translateY(-8px) scale(.88); } to { opacity: 1; transform: none; } }

.finance { grid-template-columns: minmax(120px,.78fr) minmax(135px,.82fr) minmax(350px,1.4fr); }
.finance-card, .finance-card.investment { text-align: left; align-content: center; }
.finance-card.investment > div { justify-content: start; }
.finance-card > .finance-label, .weapon-deck > .finance-label { display: block; margin-bottom: 3px; text-transform: uppercase; }
.weapon-deck { padding: 8px 12px; border-left: 1px solid var(--border); }
.weapon-slots { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; }
.weapon-slot { min-width: 0; min-height: 45px; position: relative; display: grid; place-items: center; gap: 2px; padding: 2px 4px; background: #272f23; border: 1px solid #525b45; color: #ddd9bf; }
.weapon-slot[aria-pressed='true'] { background: #453322; border-color: var(--accent); color: #ffdaab; }
.weapon-slot:not(:disabled):hover { border-color: #dab078; }
.weapon-slot.is-locked { background: #20241c; border-color: #3b4436; }
.weapon-slot.is-locked .weapon-sprite { opacity: .36; }
.weapon-slot-name { font-size: .625rem; line-height: 1; overflow-wrap: anywhere; }
.weapon-key { position: absolute; top: 2px; left: 4px; font-size: .625rem; color: #dad1ae; }
.weapon-sprite { width: 72px; max-width: 100%; height: auto; display: block; image-rendering: pixelated; }
.weapon-lock { display: none; width: 12px; height: 9px; position: absolute; top: 12px; right: 5px; background: #dbb476; border: 1px solid #634a31; }
.weapon-lock::before { content: ''; position: absolute; width: 8px; height: 7px; top: -7px; left: 1px; border: 2px solid #dbb476; border-bottom: 0; border-radius: 4px 4px 0 0; }
.weapon-lock::after { content: ''; position: absolute; width: 2px; height: 5px; left: 4px; top: 1px; background: #5d492f; }
.weapon-slot.is-locked .weapon-lock, .weapon-slot.unlocking .weapon-lock { display: block; }
.weapon-slot.unlocking .weapon-lock { animation: break-lock .65s ease-out both; }
.weapon-slot.unlocking .weapon-lock::before { transform-origin: left bottom; animation: break-shackle .65s ease-out both; }
.weapon-slot.unlocking::before, .weapon-slot.unlocking::after { content: ''; position: absolute; width: 4px; height: 4px; right: 8px; top: 12px; background: #ffce86; box-shadow: -5px -6px #f3a754, 2px 5px #dca05c; animation: lock-sparks .65s ease-out both; pointer-events: none; }
.weapon-slot.unlocking::after { --spark-y: 13px; --spark-x: -25px; }
@keyframes break-lock { 0%, 27% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translate(6px,-13px) rotate(42deg) scale(.5); } }
@keyframes break-shackle { 0%, 12% { transform: none; } 75%, 100% { transform: translate(-5px,-6px) rotate(-75deg); } }
@keyframes lock-sparks { from { opacity: .9; transform: none; } to { opacity: 0; transform: translate(var(--spark-x, 16px),var(--spark-y, -12px)) rotate(65deg); } }
#shop-weapons { grid-template-columns: repeat(4,minmax(0,1fr)); }
.shop-item .weapon-sprite { width: 85px; justify-self: start; }
.shop-item.has-sprite { grid-template-rows: auto auto 1fr auto; }

.rank-form { justify-items: center; width: min(100%,605px); }
.rank-form .rank-fields { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.2fr) auto; gap: 6px; align-items: end; width: 100%; }
.rank-fields label { display: grid; text-align: left; gap: 3px; }
.rank-fields label small { display: inline; font-size: .625rem; }
.rank-fields input { width: 100%; min-height: 31px; }
.rank-fields button { white-space: nowrap; }
#wallet-note { color: #cfc6ad; margin: 0; font-size: .6875rem; }
#claim-receipt { color: #c8e9ac; }

.reward-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 20px; padding: 13px 16px; border: 1px solid #795a3b; background: #2b2519; }
.reward-card .eyebrow { display: block; margin: 0 0 6px; }
.reward-card strong { display: block; color: #f5d496; font: 400 clamp(1.2rem,2.4vw,1.8rem)/1.15 var(--mono); font-variant-numeric: tabular-nums; }
.reward-card p { margin: 0; max-width: 59ch; color: #e2d6b9; font-size: .875rem; }
.reward-card a { color: #f7bd83; text-decoration: underline; text-underline-offset: 3px; }
.reward-clock { text-align: right; flex-shrink: 0; }
.reward-clock output { color: #ffe1a8; font: 400 clamp(1.15rem, 2.2vw, 1.75rem)/1.15 var(--mono); font-variant-numeric: tabular-nums; }
.launch-demo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 16px 0 0; color: #f6dfb7; padding: 8px 12px; background: #382d1d; border: 1px solid #8d6f43; font-size: .8125rem; }
.launch-demo strong { color: var(--accent); }
.launch-demo a { margin-inline-start: auto; text-decoration: underline; text-underline-offset: 3px; }
.market-panel { margin-top: 30px; padding: 19px; border: 1px solid #6a4d35; background: #252219f5; box-shadow: 0 4px #171910aa; scroll-margin-top: 16px; }
.market-heading { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.market-heading .eyebrow { margin: 0 0 4px; }
.market-heading h2 { margin: 0 0 9px; font: 700 clamp(1.8rem,4vw,2.8rem)/1 var(--pixel); }
.market-heading output { margin-bottom: 9px; color: #ffc58d; overflow-wrap: anywhere; font-size: .875rem; text-align: right; }
.market-field { position: relative; min-height: clamp(204px, 27vw, 365px); display: grid; place-items: center; overflow: hidden; border: 1px solid #77553b; background: linear-gradient(#352719b8, #201b15de), url('./assets/north-woods.png') center 57% / cover; }
.market-field::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg,#f1ac6d17 0 1px,transparent 1px 37px),repeating-linear-gradient(90deg,#f1ac6d14 0 1px,transparent 1px 66px); }
#market-status { z-index: 1; margin: 0 11px; padding: 7px 10px; background: #1b2017dc; border: 1px solid #776144; color: #e8d6b1; text-align: center; }
#market-chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.market-meta { display: flex; justify-content: space-between; gap: 8px; padding-top: 7px; color: #d9ceb1; font-size: .75rem; }
.market-meta a { color: var(--accent); }

[data-group='combat'] { --skill-tone: #fab476; --skill-surface: #413025; }
[data-group='field'] { --skill-tone: #dcc988; --skill-surface: #383525; }
[data-group='survival'] { --skill-tone: #bdce93; --skill-surface: #303a29; }
[data-group='supplies'] { --skill-tone: #f1a088; --skill-surface: #423129; }
.skill-icon { display: block; width: 24px; height: 24px; flex: none; image-rendering: pixelated; }
.skill-tabs { display: flex; gap: 5px; flex-wrap: wrap; margin: 0 0 8px; }
.skill-tabs button { display: flex; align-items: center; gap: 4px; padding: 3px 9px; min-height: 34px; border: 1px solid #4c5744; background: #252d22; color: #d9d3b8; font-size: .75rem; -webkit-tap-highlight-color: #f4af7650; }
.skill-tabs .skill-icon { width: 18px; height: 18px; }
.skill-tabs button[aria-pressed='true'] { background: var(--skill-surface); border-color: var(--skill-tone); color: #fff0d5; }
.skill-tabs button:hover { border-color: var(--skill-tone); }
.skill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.skill-card { min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(1.7em,1fr) auto; align-items: start; gap: 3px 8px; padding: 8px; border: 1px solid #4d5442; border-left: 2px solid var(--skill-tone); background: #232c20; }
.skill-emblem { grid-row: 1 / span 2; display: grid; place-items: center; width: 37px; height: 37px; background: var(--skill-surface); border: 1px solid #5d5944; }
.skill-emblem .skill-icon { width: 32px; height: 32px; }
.skill-card h4 { margin: 0; color: #f0e1be; font: 700 1.16rem/1.05 var(--pixel); }
.skill-card p { margin: 0; color: #dedac4; font-size: .75rem; line-height: 1.3; }
.skill-progress { grid-column: 1; align-self: center; display: grid; gap: 3px; color: #d7cfb2; font-size: .65rem; white-space: nowrap; }
.skill-pips { display: flex; gap: 2px; }
.skill-pips i { width: 6px; height: 5px; background: #394137; border: 1px solid #606751; }
.skill-pips i.filled { border-color: var(--skill-tone); background: var(--skill-tone); }
.skill-card button { grid-column: 2; justify-self: end; min-height: 25px; border: 1px solid #745d43; background: var(--skill-surface); color: var(--skill-tone); padding: 2px 7px; font-size: .75rem; white-space: nowrap; }
.skill-card button:hover:not(:disabled) { border-color: var(--skill-tone); }
.skill-card button:disabled { color: #b9baaa; background: #293128; border-color: #434d3f; }
.active-boosts { position: absolute; z-index: 2; left: 13px; bottom: 12px; display: grid; justify-items: start; gap: 4px; pointer-events: none; }
.boost-badge { display: flex; gap: 5px; align-items: center; padding: 2px 6px 2px 3px; border: 1px solid var(--skill-tone); background: #1d2219e8; color: #f4e4c4; font-size: .75rem; }
.boost-badge .skill-icon { width: 21px; height: 21px; }
.boost-badge strong { color: var(--skill-tone); font-variant-numeric: tabular-nums; }
.combat-hud { position: absolute; z-index: 2; right: 13px; bottom: 12px; width: min(245px, calc(100% - 27px)); display: grid; gap: 7px; color: #f4e4c4; text-shadow: 1px 1px #141811, 0 0 3px #141811; pointer-events: none; }
.health-hud { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; }
.health-hud > span, .ammo-display > span { font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; }
#health-meter { --health-fill: linear-gradient(#ef6e64 0 43%, #c43435 43%); width: 100%; height: 10px; appearance: none; border: 1px solid #321b19; background: #4a2421; accent-color: #e34d49; }
#health-meter::-webkit-progress-bar { background: #4a2421; }
#health-meter::-webkit-progress-value { background: var(--health-fill); }
#health-meter::-moz-progress-bar { background: var(--health-fill); }
.ammo-hud { display: flex; align-items: end; justify-content: space-between; gap: 7px; }
.ammo-display { min-width: 0; display: grid; gap: 2px; }
.ammo-icons { min-height: 14px; display: flex; flex-wrap: wrap; gap: 1px; align-items: end; }
.cartridge-icon { display: block; width: 9px; height: 14px; image-rendering: pixelated; }
.combat-hud .hud-button { min-width: 26px; min-height: 25px; padding: 1px 4px; border: 0; background: transparent; text-shadow: inherit; pointer-events: auto; }

@media (max-width: 690px) {
  .finance { grid-template-columns: 1fr 1fr; }
  .weapon-deck { grid-column: 1/-1; padding: 4px 7px 6px; border: 0; border-top: 1px solid var(--border); }
  .weapon-deck > .finance-label { margin: 0 0 2px; }
  .weapon-slot { min-height: 40px; }
  .weapon-slot-name { font-size: .5625rem; }
  .weapon-sprite { width: 59px; }
  #shop-weapons { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .rank-form .rank-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .rank-fields button { grid-column: 1/-1; justify-self: center; }
  .reward-card { align-items: start; flex-direction: column; padding: 9px; gap: 6px; }
  .reward-card p { font-size: .8125rem; }
  .reward-clock { text-align: left; }
  .market-panel { padding: 9px; }
  .header-x { width: 27px; height: 27px; }
  .x-mark { width: 12px; height: 12px; }
  .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-card { padding: 6px; gap: 4px; grid-template-columns: 24px minmax(0, 1fr); }
  .skill-emblem { width: 24px; height: 26px; grid-row: 1; }
  .skill-emblem .skill-icon { width: 24px; height: 24px; }
  .skill-card h4 { font-size: .95rem; align-self: center; }
  .skill-card p { grid-column: 1/-1; font-size: .6875rem; }
  .skill-progress { grid-column: 1/-1; display: flex; align-items: center; gap: 5px; }
  .skill-card button { grid-column: 1/-1; font-size: .6875rem; padding-inline: 4px; }
  .skill-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .skill-tabs button { min-width: 0; justify-content: center; text-align: center; padding-inline: 2px; gap: 2px; font-size: .625rem; }
  .active-boosts { left: 7px; bottom: 7px; }
  .combat-hud { right: 7px; bottom: 7px; width: min(183px, 55%); gap: 3px; }
  .health-hud { gap: 5px; }
  .cartridge-icon { width: 6px; height: 10px; }
  .ammo-icons { min-height: 10px; }
  .boost-badge { font-size: .625rem; padding-right: 4px; }
  .boost-badge .skill-icon { width: 17px; height: 17px; }
}
@media (max-width: 430px) {
  .hud { gap: 5px; }
  .stat > span { font-size: .57rem; }
  .stat output { font-size: .99rem; }
  .hud-tools .hud-button { min-width: 24px; min-height: 30px; padding-inline: 3px; }
  .hud-tools { gap: 3px; }
  .medal { padding: 4px 5px; }
  .medal strong { font-size: .95rem; }
}
@media (any-pointer: coarse) and (max-height: 520px) and (orientation: landscape) {
  .arcade.is-fullscreen .finance { grid-template-columns: minmax(0,.65fr) minmax(0,.75fr) minmax(230px,1.7fr); }
  .arcade.is-fullscreen .weapon-deck { grid-column: auto; border-top: 0; }
  .arcade.is-fullscreen .weapon-deck > .finance-label, .arcade.is-fullscreen .weapon-slot-name { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .medal, .weapon-slot.unlocking::before, .weapon-slot.unlocking::after, .weapon-slot.unlocking .weapon-lock, .weapon-slot.unlocking .weapon-lock::before { animation-duration: .001s; }
}
