/* Littlest Wars: late-night arcade cabinet. Black glass, chunky green buttons,
   pulp-serif storytelling, pixel numbers. One fixed dark look by design. */
:root {
  --ink: #050506;
  --panel: #0e1017;
  --line: #262a35;
  --text: #f4f1e8;
  --dim: #9ea4b1;
  --green: #18c45c;
  --blue: #0b43b0;
  --red: #e2272e;
  --gold: #f6b91d;
  --dialog: #7a7c89;
  --display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --pixel: 'Chakra Petch', 'Segoe UI', Arial, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--ink); color: var(--text); font: 17px/1.4 var(--serif); -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
button[disabled], .poor { opacity: .38; }
img { max-width: 100%; display: block; }
.num { font-family: var(--pixel); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; letter-spacing: .01em; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .02em; text-wrap: balance; }
.dim { color: var(--dim); }
.center { text-align: center; }
.gold { color: var(--gold); }

.app { height: 100%; max-width: 480px; margin: 0 auto; position: relative; overflow: hidden; background: var(--ink); }

/* ---------- full-screen art screens (title, difficulty, game over) */
.frame { height: 100%; display: flex; align-items: center; justify-content: center; container-type: size; background: var(--ink); }
.art { position: relative; width: min(100cqw, calc(100cqh * 9 / 16)); aspect-ratio: 9 / 16; background: center / cover no-repeat; }
.hot { position: absolute; background: transparent; border: 0; border-radius: 6px; }
.hot:focus-visible { outline: 3px solid var(--gold); }
.title-extras { position: absolute; left: 0; right: 0; top: 89.5%; display: flex; flex-wrap: nowrap; justify-content: center; align-items: center; gap: 2.5%; padding-inline: 4%; }
/* Scale with the title art so the buttons stay on one line under START GAME on any screen. */
.title-extras .pill { font-size: min(13px, calc(min(100cqw, 100cqh * 9 / 16) * .032)); padding: .45em 1.1em; white-space: nowrap; }
.pill { border: 2px solid var(--text); background: rgba(5, 5, 6, .78); color: var(--text); padding: 6px 14px; border-radius: 999px; font-family: var(--display); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.pill.gold { border-color: var(--gold); color: var(--ink); background: var(--gold); }
.share { position: absolute; left: 4%; top: 2.5%; width: 11%; aspect-ratio: 1; border: 0; padding: 0; background: none; }
.over-score { position: absolute; left: 8%; right: 8%; top: 53%; text-align: center; }
.over-score p { margin: 6px 0; }
.score { font-size: 20px; }
.score strong { font-family: var(--pixel); color: var(--gold); font-size: 26px; display: block; }

.namebox { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); text-align: center; background: #000; }
.welcome { font-family: var(--display); font-size: clamp(26px, 8vw, 38px); line-height: 1.15; margin: 0; text-wrap: balance; }
.welcome.big { font-size: clamp(30px, 10vw, 46px); }
.namebox input { width: 100%; max-width: 320px; padding: 12px; font: 600 24px var(--serif); text-align: center; background: #000; color: var(--text); border: 4px solid var(--text); border-radius: 0; }
.reject { font-family: var(--display); color: var(--red); font-size: 24px; line-height: 1.15; margin: 0; }
.loading { width: 100%; height: 100%; border: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); text-align: center; }
.tap { font-family: var(--pixel); color: var(--dim); animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
.retired { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding-left: var(--gutter-l); padding-right: var(--gutter-r); background: radial-gradient(circle at 50% 30%, #2a2207, #000 70%); }
.retired h1 { font-size: 44px; margin: 0; }
.story { font-size: 20px; max-width: 34ch; }

/* ---------- in-game layout */
.game { height: 100%; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); position: relative; }
.hud { display: flex; align-items: center; gap: 6px; min-width: 0; padding-block: 8px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); background: #000; border-bottom: 1px solid var(--line); }
.vitals { display: flex; flex-direction: column; gap: 3px; flex: none; }
.hp { display: flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; }
.hp img { width: 22px; }
.hp .num, .cargo .num { font-size: 15px; line-height: 1; }
.cargo { display: flex; align-items: center; gap: 4px; }
.cargo .crate { width: 20px; height: 20px; margin-inline: 1px; }
.hud .more { font-family: var(--pixel); font-weight: 700; font-size: 11px; line-height: 1; color: #000; background: var(--green); border: 0; border-radius: 3px; padding: 3px 6px; white-space: nowrap; }
.hud .more:disabled { opacity: .45; }
.hud.long .cargo .num { font-size: 13px; }
@media (max-width: 400px) { .hud.long .more .word { display: none; } }
.hp .kits { font-family: var(--pixel); font-size: 12px; color: var(--green); }
.cash { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; }
.cashrow { display: flex; align-items: center; gap: 6px; }
.cash .num { font-size: 19px; line-height: 1; white-space: nowrap; }
.retire { border: 0; padding: 0; background: none; }
.retire img { height: 26px; }
.tools { display: flex; gap: 3px; flex: none; }
@media (max-width: 400px) { .hud .icon { width: 29px; height: 29px; } }
.icon { width: 32px; height: 32px; border: 0; padding: 0; background: none; }
.icon img { width: 100%; height: 100%; }

.view { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dock { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 8px calc(8px + env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); background: #000; border-top: 1px solid var(--line); }
.dockbtn { width: 56px; height: 56px; }
.dockbtn.ghost { display: block; }
.where { text-align: center; display: flex; flex-direction: column; line-height: 1.1; }
.where .display { font-size: 20px; }
.where .dim { font-family: var(--pixel); font-size: 13px; }

/* ---------- city / market */
/* City screen: the art fills the whole view and stays put; the market scrolls over it on a see-through panel. */
.view.city, .view.store, .view.airport { background-color: var(--ink); background-size: cover; background-position: center 85%; background-repeat: no-repeat; }
.view.store, .view.airport { background-position: center; }
.view.store .store, .view.airport .airport { min-height: 100%; background: linear-gradient(rgba(5,5,6,.6), rgba(5,5,6,.45) 22%, rgba(5,5,6,.6) 45%, rgba(5,5,6,.72)); }
.store .title, .airport .title, .store .sub, .store > p, .airport > p { text-shadow: 0 2px 3px #000, 0 0 10px rgba(0,0,0,.9); }
.view.store .item { background: rgba(14,16,23,.8); border-color: rgba(255,255,255,.12); }
.view.store .item.hidden { background: rgba(40,8,10,.82); }
.view.airport .flights li { background: rgba(0,0,0,.66); }
.banner { height: clamp(140px, 30vh, 260px); }
.city .chips { padding-bottom: 8px; }
.city .market-head { background: linear-gradient(rgba(5,5,6,0), rgba(5,5,6,.8)); }
.city .market { background: rgba(5,5,6,.7); -webkit-backdrop-filter: blur(1.5px); backdrop-filter: blur(1.5px); min-height: 60vh; }
.city .goodrow { border-bottom-color: rgba(255,255,255,.08); }
.city .gname, .city .gown, .city .gprice, .city .market-head { text-shadow: 0 1px 2px #000, 0 0 6px rgba(0,0,0,.8); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 8px 0; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.chip { font-family: var(--pixel); font-size: 12px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.chip.up { border-color: var(--green); color: var(--green); }
.chip.down { border-color: var(--red); color: #ff8a8e; }
.market-head, .goodrow { display: grid; grid-template-columns: 26px minmax(0, 1fr) 3.4em 6.6em 34px 34px; align-items: center; column-gap: 6px; }
.market-head { padding-block: 10px 4px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); font-family: var(--pixel); font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.market-head span:first-child { grid-column: 1 / 3; }
.market-head span:nth-child(2), .market-head span:nth-child(3) { text-align: right; }
.market { list-style: none; margin: 0; padding: 0 0 12px; }
.goodrow { padding-block: 5px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); border-bottom: 1px solid #14161d; }
.gicon { width: 26px; height: 26px; object-fit: contain; }
.gname { font-size: 16px; line-height: 1.15; min-width: 0; }
.gown { text-align: right; font-size: 14px; color: var(--dim); }
.gprice { text-align: right; font-size: 14px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.gprice small { font-size: 10px; color: var(--dim); }
.gprice.cheap { color: #4ef08a; }
.gprice.pricey { color: #ff7b80; }
.pm { width: 34px; height: 34px; border: 0; padding: 0; background: none; }

/* ---------- store / airport */
.store, .airport { padding-block: 12px 20px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.title { font-size: 40px; text-align: center; margin: 4px 0; }
.sub { font-family: var(--display); font-size: 15px; letter-spacing: .06em; margin: 18px 0 6px; color: var(--gold); text-transform: uppercase; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; background: var(--panel); border: 1px solid var(--line); }
.item.regional { border-color: #3d3410; }
.item.hidden { border-color: #4a1214; background: #160809; }
.iicon { width: 52px; height: 52px; object-fit: contain; }
.iinfo { display: flex; flex-direction: column; min-width: 0; }
.iname { font-weight: 600; line-height: 1.15; }
.iinfo small { font-size: 13px; color: var(--dim); line-height: 1.25; }
.ibuy { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ibuy .num { font-size: 14px; }
.tag { font-family: var(--pixel); font-size: 12px; color: var(--dim); border: 1px solid var(--line); padding: 2px 6px; }
.favor { margin-top: 18px; padding: 12px; border: 2px dashed var(--gold); text-align: center; }
.favor .imgbtn { margin: 8px auto 0; }

.flights { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.flights li { display: grid; grid-template-columns: minmax(0, 1fr) auto 40px; align-items: center; gap: 10px; padding: 6px 10px; background: rgba(0, 0, 0, .6); }
.dest { font-size: 20px; }
.flights .num { font-size: 16px; }
.play { width: 36px; height: 36px; border: 0; padding: 0; background: none; }
.warn { color: #ffb3b6; text-align: center; font-weight: 600; }

/* ---------- buttons made from the game's art */
.imgbtn { border: 0; padding: 0; background: none; }
.imgbtn img { height: 46px; width: auto; }
.imgbtn.small img { height: 30px; }
.row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 12px 0 4px; }

/* ---------- overlays */
.overlay { position: absolute; inset: 0; z-index: 10; background: rgba(0, 0, 0, .72); display: flex; align-items: flex-end; justify-content: center; }
.overlay.card-layer { align-items: stretch; background: #000; }
.card { width: 100%; display: flex; flex-direction: column; overflow-y: auto; background: #000; padding-bottom: env(safe-area-inset-bottom, 0px); }
.pic { flex: none; background: center / cover no-repeat; position: relative; }
.pic.portrait { aspect-ratio: 1; width: min(calc(100% - 32px), 44vh); max-width: 100%; margin: 10px auto 0; border: 3px solid #fff; }
.pic.scene { height: 34vh; border-bottom: 3px solid #fff; filter: saturate(.9); }
.card-text { padding: 12px var(--gutter-r) 0 var(--gutter-l); text-align: center; }
.kicker { font-family: var(--display); color: var(--gold); letter-spacing: .06em; text-transform: uppercase; margin: 4px 0; font-size: 15px; }
.card.bad .kicker, .combat .kicker { color: #ff6b70; }
.card.combat.won .kicker { color: #4ef08a; }
.quote { font-size: 19px; margin: 6px auto; max-width: 36ch; }
.result { margin: 6px auto; max-width: 36ch; font-weight: 600; }
.roll { font-family: var(--pixel); font-size: 14px; margin: 8px 0; }
.roll.good { color: #4ef08a; }
.roll.bad { color: #ff8a8e; }
.revive { margin: 12px auto; padding: 10px; max-width: 36ch; border: 3px solid; }
.revive.good { border-color: var(--green); }
.revive.bad { border-color: var(--red); }
.revive .display { font-size: 26px; margin: 0; }
.revive.good .display { color: var(--green); }
.revive.bad .display { color: var(--red); }
.offer { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
.qty { display: flex; justify-content: center; align-items: stretch; gap: 6px; margin: 8px 0; }
.qty button { min-width: 44px; border: 2px solid var(--text); background: #000; font-size: 22px; line-height: 1; }
.qty .max { font-family: var(--pixel); font-size: 13px; padding: 0 10px; border-color: var(--gold); color: var(--gold); }
.qty input { width: 7.5em; text-align: center; font-size: 20px; background: #000; color: var(--text); border: 2px solid var(--text); padding: 6px; min-width: 0; }
.statline { font-family: var(--pixel); font-size: 12px; line-height: 1.5; margin-top: 10px; }
.foe { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px; background: rgba(0, 0, 0, .78); font-family: var(--pixel); font-size: 13px; }
.bar { height: 10px; background: #3a0d0f; border: 1px solid #000; }
.bar i { display: block; height: 100%; background: var(--red); transition: width .3s; }
.pips { position: absolute; top: 6px; left: 6px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 70%; }
.pip { width: 12px; height: 12px; background: var(--red); border: 2px solid #000; }
.pip.down { background: #333; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; justify-items: center; padding: 12px var(--gutter-r) 8px var(--gutter-l); }
.actions .wide { grid-column: 1 / -1; }
.actions .imgbtn img { height: 50px; }
.kitrow { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.kitbtn { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #0b1a10; border: 2px solid var(--green); text-align: left; min-width: 0; }
.kitbtn img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.kitbtn span { display: flex; flex-direction: column; font-weight: 600; line-height: 1.1; min-width: 0; font-size: 15px; }
.kitbtn small { font-family: var(--pixel); font-weight: 500; font-size: 12px; color: var(--dim); }
.me { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 8px auto 0; width: min(calc(100% - 32px), 44vh); max-width: 100%; font-family: var(--pixel); font-size: 13px; }
.bar.mine { background: #0d2a16; }
.bar.mine i { background: var(--green); }

.panel { width: 100%; max-height: 90%; overflow-y: auto; background: var(--panel); border-top: 4px solid var(--green); padding-block: 14px calc(18px + env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-head h2 { flex: 1; margin: 0; font-size: 24px; }
.close { width: 40px; height: 40px; border: 2px solid var(--text); background: #000; font-size: 18px; }
.panel.confirm { align-self: center; margin-inline: 16px; width: auto; max-width: 360px; border: 0; border-radius: 22px; background: var(--dialog); text-align: center; padding: 22px 18px; }
.ask { font-size: 24px; line-height: 1.3; margin: 0 0 6px; color: #fff; }
.panel.confirm .dim { color: #e3e4ea; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 12px 0; text-align: center; }
.stats div { background: #000; border: 1px solid var(--line); padding: 6px 0; display: flex; flex-direction: column; }
.stats .num { font-size: 20px; }
.stats small { font-size: 11px; color: var(--dim); }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot { aspect-ratio: 3 / 4; border: 2px solid #fff; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; text-align: center; min-width: 0; }
.slot img { width: 70%; aspect-ratio: 1; object-fit: contain; }
.slot small { font-size: 11px; line-height: 1.1; overflow-wrap: anywhere; }
.slabel { font-family: var(--pixel); font-size: 11px; color: var(--dim); text-transform: uppercase; }
.cargo { list-style: none; margin: 0; padding: 0; }
.cargo li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.cargo img { width: 26px; height: 26px; object-fit: contain; }
.scores { margin: 10px 0; padding: 0; list-style: none; counter-reset: s; }
.scores li { display: grid; grid-template-columns: 1.6em minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); counter-increment: s; }
.scores li::before { content: counter(s); grid-row: 1 / 3; font-family: var(--pixel); color: var(--gold); align-self: center; }
.scores small { grid-column: 2; color: var(--dim); font-size: 13px; }
.scores .num { grid-row: 1 / 3; grid-column: 3; align-self: center; }
.sheet p { margin: 8px 0; }
.sheet input[type=range] { width: 100%; accent-color: var(--green); }
.total { font-size: 18px; text-align: center; }
.total .num { font-size: 22px; color: var(--gold); }
.toast { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 20; background: #000; border: 2px solid var(--gold); padding: 8px 14px; font-size: 15px; width: max-content; max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) { .tap { animation: none; } .bar i { transition: none; } }
@media (min-width: 520px) { .app { border-inline: 1px solid var(--line); } }

/* ---------- 1.0: title version, notebook, score tabs, updates, notices */
.version { position: absolute; left: 0; right: 0; top: 1.6%; margin: 0; text-align: center; font-family: var(--display); color: #fff; letter-spacing: .06em; text-transform: uppercase;
  font-size: min(14px, calc(min(100cqw, 100cqh * 9 / 16) * .036)); text-shadow: 0 2px 0 #000, 0 0 6px #000; pointer-events: none; }
.dock .where { flex: 1; }
.where .dim.last { color: var(--gold); font-weight: 700; }
.nbpicks { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 10px 0 4px; }
.nbpick { aspect-ratio: 1; border: 2px solid var(--line); border-radius: 6px; background: #000; padding: 4px; }
.nbpick img { width: 100%; height: 100%; object-fit: contain; }
.nbpick.on { border-color: var(--green); background: #062a12; }
.nbrows { list-style: none; margin: 6px 0 10px; padding: 0; }
.nbrows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.nbrows li.here { background: rgba(24, 196, 92, .10); }
.nbrows .dest { font-weight: 600; }
.nbrows small { grid-column: 1; }
.nbrows .num { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: 17px; }
.tag.cheap, .tag.pricey { font-family: var(--pixel); font-size: 11px; padding: 1px 6px; border-radius: 999px; margin-left: 6px; vertical-align: 1px; }
.tag.cheap { background: var(--green); color: #000; }
.tag.pricey { background: var(--red); color: #fff; }
.stabs { display: flex; gap: 8px; justify-content: center; margin: 10px 0 4px; }
.stab { border: 3px solid transparent; border-radius: 6px; background: none; padding: 0; width: min(30%, 110px); opacity: .55; }
.stab img { width: 100%; display: block; }
.stab.on { opacity: 1; border-color: var(--gold); }
.updates { margin: 6px 0 14px; padding-left: 1.2em; }
.updates li { margin-bottom: 6px; }
.card.notice { padding-top: 6px; }
.giftimg { width: 120px; height: 120px; object-fit: contain; margin: 10px auto; image-rendering: pixelated; }
.title-links { position: absolute; left: 0; right: 0; top: 91.6%; display: flex; flex-wrap: wrap; justify-content: center; gap: .3em 1.1em; padding-inline: 4%;
  font-family: var(--pixel); font-weight: 600; font-size: min(13px, calc(min(100cqw, 100cqh * 9 / 16) * .034)); }
.title-links a, .title-links button { color: #fff; background: none; border: 0; padding: 2px 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 0 #000, 0 0 6px #000; }
.utabs { display: flex; gap: 8px; margin: 10px 0 4px; }
.roadmap li { margin-bottom: 10px; }
.notice-text { color: #fff; font-size: 18px; margin: 4px 0 8px; }
