:root {
  color-scheme: dark;
  --ink: #f3f5e7;
  --muted: #a8b4a8;
  --lime: #a9bc8f;
  --line: #364438;
  --panel: #202b24;
  --gold: #d4ba7c;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #151d18;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, canvas:focus-visible {
  outline: 3px solid #ffe58f;
  outline-offset: 3px;
}
.top { border-bottom: 1px solid #354137; background: #1b251e; }
.top-inner, main { max-width: 1500px; margin: auto; padding-inline: 24px; }
.top-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: 1.8px; white-space: nowrap; }
.brand b { color: var(--lime); }
.brand-cube { width: 23px; height: 24px; margin-right: 4px; background: conic-gradient(from 60deg at 50% 46%, #53963f 0 120deg, #76b844 0 240deg, #c5ed67 0); clip-path: polygon(50% 0, 100% 24%, 100% 76%, 50% 100%, 0 76%, 0 24%); }
.top-actions { display: flex; gap: 8px; }
.utility { min-height: 38px; padding: 0 11px; border: 1px solid var(--line); background: #26342a; border-radius: 5px; font-size: 13px; white-space: nowrap; }
.utility:disabled { opacity: .55; }
.utility:hover:enabled { background: #354739; }
main { padding-top: 26px; padding-bottom: 32px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.area-label, .record, .hud > div > span { font: 700 11px/1.2 Consolas, monospace; letter-spacing: 1.4px; color: var(--muted); }
.area-label { color: var(--lime); display: flex; align-items: center; gap: 8px; }
.area-label span { width: 7px; height: 7px; background: var(--lime); box-shadow: 0 0 12px #c6fa615c; }
h1 { font-size: clamp(30px, 4.5vw, 49px); line-height: 1; letter-spacing: -.055em; margin: 9px 0; }
p { color: var(--muted); margin: 0; line-height: 1.45; }
.record { text-align: right; padding: 8px 0; flex-shrink: 0; }
.record strong { display: block; color: var(--gold); font-size: 23px; margin-top: 6px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 305px; gap: 18px; align-items: start; }
.arena, .shop, .mission { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.arena { min-width: 0; }
.hud { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 13px 0; }
.hud > div { display: grid; justify-items: center; gap: 4px; border-right: 1px solid var(--line); }
.hud > div:last-child { border: 0; }
#plane-brake[hidden] { display: none; }
#plane-brake[aria-pressed="true"] { background: #694d31; border-color: #edc47e; color: #ffe3a2; }
@media (max-width: 650px) {
  .hud { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 0; }
  .hud > div:nth-child(3) { border-right: 0; }
}
.hud strong { font: 700 clamp(16px, 3vw, 23px)/1.1 Consolas, monospace; }
.gold { color: var(--gold); display: flex; align-items: center; gap: 7px; }
.coin { display: inline-block; flex: 0 0 11px; width: 11px; height: 13px; border-radius: 40%; background: #ffd56d; border: 2px solid #dd8e33; box-shadow: 1px 1px #936026; vertical-align: middle; }
.stage { position: relative; background: #344f3d; }
.quick-inventory { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; padding: 5px; background: #19261e; }
.quick-slot { min-width: 0; height: 48px; padding: 3px; border: 1px solid #526750; border-radius: 3px; background: #283c2e; color: var(--ink); font: 10px/1.3 Consolas, monospace; white-space: pre-line; overflow: hidden; overflow-wrap: anywhere; }
.quick-slot[aria-pressed="true"] { border-color: #fae08d; background: #3d4c31; color: #ffedaa; }
.quick-slot:disabled { opacity: .6; }
.quick-bar-slot { position: relative; padding-top: 13px; }
.quick-bar-slot::before { content: attr(data-key); position: absolute; top: 1px; left: 4px; font-weight: bold; color: #f7d789; }
.achievement-list { margin: 0; padding: 6px 10px 6px 30px; max-height: 400px; overflow-y: auto; }
.achievement-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.achievement-list strong { display: block; font-size: 13px; }
.achievement-list p, .achievement-list span { font-size: 11px; }
.achievement-list progress { display: block; width: 100%; height: 6px; margin-top: 5px; }
.achievement-list li[data-unlocked="true"] strong { color: var(--gold); }
.achievement-note { padding: 6px 12px; font-size: 11px; }
.achievement-toast { margin: 0; padding: 7px 12px; background: #334b30; color: #ffe2a0; font-size: 12px; }
#backpack { width: min(680px, calc(100% - 24px)); max-height: 90vh; overflow-y: auto; }
#backpack .store-heading { align-items: start; }
#backpack-help { max-width: 460px; }
.backpack-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 10px; }
.backpack-grid .quick-slot { height: 64px; font-size: 11px; }
.backpack-pages { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 0 10px 7px; font-size: 12px; }
.quick-slot[data-selected="true"] { border-color: #8edbe6; background: #314f57; color: #d9fbff; }
@media (max-width: 480px) { .quick-inventory { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.location, .minigun { position: absolute; font: 700 12px/1.2 Consolas, monospace; }
.location { top: 11px; left: 11px; background: #172b30e8; border: 1px solid #a2d1b6; border-radius: 4px; padding: 7px 9px; color: #def5af; pointer-events: none; }
.minigun { right: 11px; top: 11px; border: 1px solid #f5ce73; border-radius: 4px; background: #312a20; color: #ffe39c; padding: 10px 11px; }
.minigun:hover { background: #554126; }
canvas { display: block; width: 100%; aspect-ratio: 8 / 5; cursor: crosshair; touch-action: none; }
canvas:focus-visible { outline-offset: -4px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #15262163; padding: 6px; }
.overlay[hidden] { display: none; }
.dialog { text-align: center; background: #1a261fee; border: 1px solid #829962; border-radius: 9px; width: min(100%, 315px); padding: 21px; box-shadow: 0 5px 0 #132219ad, 0 15px 35px #101b1490; }
.target-icon { display: grid; place-items: center; margin: 0 auto 12px; width: 42px; height: 40px; background: #b9ef57; color: #263722; border: 4px solid #79aa3c; box-shadow: inset 0 3px #d9ff92, 4px 4px #172218; }
.target-icon span { width: 18px; height: 10px; border: 4px solid; border-block: 0; position: relative; }
.target-icon span::after { content: ""; position: absolute; width: 6px; height: 3px; background: currentColor; left: 2px; bottom: -2px; }
.dialog h2 { margin: 0 0 7px; font-size: 26px; }
.dialog p { font-size: 14px; }
.primary { min-height: 43px; border: 0; border-radius: 5px; background: var(--lime); color: #202c17; box-shadow: 0 3px #709729; margin-top: 15px; padding: 0 22px; font-weight: 900; }
.primary:hover { background: #deff9d; }
.controls { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--muted); padding: 8px 12px; }
.controls b { color: var(--ink); }
.arena-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 8px 8px 0; }
.arena-actions .utility { min-height: 32px; font-size: 12px; padding-inline: 7px; }
.world-notice, .world-action { position: absolute; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); }
.world-notice { bottom: 11px; width: max-content; padding: 6px 10px; border-radius: 5px; background: #1a2b25ed; color: #fff0bb; pointer-events: none; font-size: 13px; }
.world-action { bottom: 49px; max-width: calc(100% - 16px); white-space: normal; background: #4c5d33; border-color: #b8d279; }
.arena-expanded { overflow: hidden; }
.arena.expanded { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; border: 0; border-radius: 0; }
.arena.expanded .stage { flex: 1; min-height: 0; background: #18291e; }
.arena.expanded canvas { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.arena.expanded .touch-controls { flex-shrink: 0; }
.upgrade[hidden] { display: none; }
.sidebar { display: grid; gap: 16px; }
.shop-head, .mission { padding: 16px; }
.shop h2, .mission h2 { font-size: 18px; margin: 0 0 4px; }
.shop p, .mission p { font-size: 13px; }
.upgrade { min-height: 70px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; margin: 0 10px 8px; border: 1px solid #3b4b3d; background: #263329; border-radius: 6px; }
.upgrade-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid currentColor; border-radius: 5px; font: 900 25px/1 Consolas, monospace; }
.orange { color: #ffc66d; background: #50402b; }
.upgrade h3 { font-size: 14px; margin: 0 0 3px; }
.upgrade p { font-size: 12px; }
.buy { display: flex; justify-content: center; align-items: center; gap: 5px; min-width: 45px; min-height: 36px; padding: 0 6px; border: 1px solid #667850; border-radius: 4px; background: #394c2a; color: var(--gold); font: 700 14px Consolas, monospace; }
.buy:disabled { opacity: .66; background: #212c23; border-color: var(--line); }
.buy:hover:enabled { background: #557137; }
.buy[data-owned="true"] { color: var(--lime); }
.mission-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mission strong { color: var(--lime); font: 700 14px Consolas, monospace; }
progress { appearance: none; display: block; width: 100%; height: 8px; margin: 10px 0; border: 0; border-radius: 4px; overflow: hidden; background: #101913; accent-color: var(--lime); }
progress::-webkit-progress-bar { background: #101913; }
progress::-webkit-progress-value { background: var(--lime); }
progress::-moz-progress-bar { background: var(--lime); }
@media (max-width: 840px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { grid-template-columns: minmax(0, 1fr) minmax(190px, .7fr); align-items: start; }
}
@media (max-width: 550px) {
  .top-inner, main { padding-inline: 12px; }
  .top-inner { min-height: 52px; }
  .top-inner { flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  main { padding-top: 17px; }
  .intro { align-items: start; flex-wrap: wrap; }
  .intro > div:first-child { min-width: 0; }
  .player-summary { justify-content: flex-start; }
  .record { font-size: 9px; }
  .record strong { font-size: 18px; }
  .sidebar { grid-template-columns: 1fr; }
  .mission { grid-row: 1; }
  .dialog { padding: 10px 14px; }
  .dialog h2 { font-size: 21px; }
  .target-icon { display: none; }
  .primary { margin-top: 8px; }
  .hud > div > span { font-size: 9px; }
  .controls { gap: 7px 13px; }
}

#health { color: #d8eda2; white-space: nowrap; }
#health-bar { width: calc(100% - 20px); height: 6px; margin: 0; }
#health-bar[data-low="true"]::-webkit-progress-value { background: #f08b94; }
#health-bar[data-low="true"]::-moz-progress-bar { background: #f08b94; }
.shop-head { display: flex; gap: 11px; align-items: center; }
.shop-head .upgrade-icon { flex: 0 0 38px; }
.loadout { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; margin: 0 16px 12px; border: 1px solid var(--line); background: #19251e; border-radius: 6px; }
.loadout div { display: grid; gap: 4px; }
.loadout div:last-child { text-align: right; flex-shrink: 0; }
.loadout span { font: 700 11px Consolas, monospace; color: var(--muted); letter-spacing: 1px; }
.loadout strong { color: var(--lime); }
.shop .loadout { margin-bottom: 16px; }
kbd { background: #17241a; border: 1px solid var(--line); padding: 2px 5px; border-radius: 3px; }
dialog { color: var(--ink); border: 1px solid #819960; border-radius: 10px; background: var(--panel); width: min(440px, calc(100% - 24px)); padding: 12px 0; }
dialog::backdrop { background: #111b15b8; }
.store-heading { display: flex; justify-content: space-between; align-items: start; padding: 6px 14px; gap: 12px; }
.store-heading h2 { margin: 0 0 4px; }
.store-heading p, .store-balance { font-size: 14px; }
.store-balance { color: var(--gold); margin: 4px 14px 12px; }
.coin-gifts { padding: 9px; margin: 0 14px 12px; border: 1px solid var(--line); border-radius: 5px; font-size: 13px; }
.coin-gifts summary { cursor: pointer; }
.coin-gifts label { display: block; margin: 8px 0 4px; }
.gift-controls { display: flex; flex-wrap: wrap; gap: 6px; }
.coin-gifts input, .coin-gifts select {
  min-width: 0;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #18261d;
  color: var(--ink);
  font: inherit;
}
.coin-gifts input { flex: 1 1 145px; }
#gift-result { margin: 7px 0 0; color: var(--gold); }
.inventory-strip { display: flex; align-items: center; gap: 8px; padding: 6px 9px; border-block: 1px solid #455749; background: #19261e; }
.inventory-strip h2 { margin: 0 4px; color: #b3c4a9; font: 700 11px Consolas, monospace; text-transform: uppercase; }
.inventory-loadout { display: flex; align-items: center; min-width: 0; gap: 5px; padding-left: 6px; border-left: 1px solid #526750; }
.inventory-loadout > span { color: #aabfa3; font: 700 11px Consolas, monospace; text-transform: uppercase; }
.flight-slots, .inventory-blasters { display: flex; gap: 5px; }
.inventory-blasters { min-width: 0; overflow-x: auto; scrollbar-width: thin; padding: 2px; }
.inventory-slot { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; min-height: 40px; padding: 3px 7px; border: 1px solid #526750; border-radius: 4px; background: #283c2e; font: 700 12px Consolas, monospace; white-space: nowrap; }
.inventory-slot[hidden] { display: none; }
.inventory-slot:disabled { opacity: .62; }
.inventory-slot[aria-pressed="true"] { border-color: #fae08d; background: #3d4c31; color: #ffedaa; }
.inventory-slot:focus-visible { outline-offset: -3px; }
.inventory-blasters .inventory-slot::before { content: ""; width: 9px; height: 7px; background: var(--slot-accent, #9beffc); clip-path: polygon(0 0, 100% 0, 100% 60%, 62% 60%, 62% 100%, 25% 100%, 25% 60%, 0 60%); }
.slot-icon { width: 14px; height: 15px; flex: 0 0 14px; }
.arrow-icon { background: #a6eeff; clip-path: polygon(50% 0, 100% 53%, 67% 53%, 67% 100%, 33% 100%, 33% 53%, 0 53%); }
.glider-icon { background: #ffd98b; clip-path: polygon(50% 10%, 100% 24%, 93% 75%, 56% 58%, 56% 95%, 44% 95%, 44% 58%, 7% 75%, 0 24%); }
.tank-icon { background: #b0dd8f; clip-path: polygon(24% 0, 65% 0, 65% 28%, 100% 28%, 100% 47%, 61% 47%, 61% 65%, 90% 65%, 90% 100%, 0 100%, 0 65%, 24% 65%); }
.car-icon { background: #ffa580; clip-path: polygon(17% 43%, 33% 16%, 73% 16%, 85% 43%, 100% 48%, 100% 79%, 83% 79%, 83% 96%, 67% 96%, 67% 79%, 33% 79%, 33% 96%, 17% 96%, 17% 79%, 0 79%, 0 48%); }
.helicopter-icon { background: #a5dbe3; clip-path: polygon(0 7%,100% 7%,100% 20%,55% 20%,55% 38%,76% 38%,96% 67%,73% 79%,56% 79%,56% 90%,78% 90%,78% 100%,36% 100%,36% 90%,45% 90%,45% 79%,18% 67%,0 67%,0 54%,23% 54%,37% 38%,44% 38%,44% 20%,0 20%); }
.player-summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.pilot { min-width: max-content; display: grid; gap: 3px; padding-left: 10px; border-left: 2px solid #a6b660; }
.pilot strong { color: #f4e7b7; font-size: 16px; }
.pilot span, #rank-progress { color: #b8c7aa; font-size: 12px; }
.rank-card { padding: 11px 13px; background: #1e2b23; border: 1px solid #425443; border-radius: 5px; }
.rank-card summary { cursor: pointer; font-weight: 700; }
.rank-card summary span { display: block; margin: 4px 0 0 13px; font-weight: 400; }
.rank-card ol { padding-left: 28px; font-size: 13px; line-height: 1.6; margin-bottom: 0; }
.rank-card [aria-current] { color: #ffdf83; font-weight: 700; }
.flight-touch { display: flex; gap: 4px; }
.flight-touch[hidden] { display: none; }
.secret-action { position: absolute; right: 9px; bottom: 10px; background: #4e3f27; border-color: #d1ad65; }
@media (max-width: 550px) {
  .inventory-strip { flex-wrap: wrap; gap: 5px; padding-inline: 5px; }
  .inventory-loadout { width: 100%; border-left: 0; padding-left: 3px; }
  .inventory-strip h2, .inventory-strip kbd { display: none; }
  .inventory-slot { font-size: 11px; }
  .player-summary { gap: 4px; }
  .pilot { min-width: 0; }
}
.buy { min-width: 64px; }
.class-card { padding: 11px 13px; background: #1e2b23; border: 1px solid #425443; border-radius: 5px; }
.class-card summary { cursor: pointer; font-weight: 700; }
.class-card summary span { float: right; color: var(--gold); font: 700 14px Consolas, monospace; }
.class-card > p { font-size: 12px; color: var(--muted); margin: 9px 0; }
.class-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.class-row:has(button[aria-pressed="true"]) { background: #293a2b; }
.class-row > div { min-width: 0; }
.class-row strong { display: block; font-size: 14px; color: var(--ink); }
.class-requirement { color: var(--gold); font: 700 11px Consolas, monospace; }
.class-row p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 5px 0 0; }
.class-row button { flex-shrink: 0; min-height: 40px; font-size: 12px; }
.class-row button[aria-pressed="true"] { color: var(--gold); }
.class-inventory { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 6px 12px; border-bottom: 1px solid var(--line); background: #1e2b23; font: 12px Consolas, monospace; }
.class-inventory > strong { color: var(--gold); }
.class-inventory > span { color: var(--muted); }
.class-tools { display: flex; gap: 5px; flex-wrap: wrap; }
.rebirth-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--gold); font-size: 12px; }
.strike-panel { padding: 12px; background: #243b35; border-bottom: 1px solid #9fb88c; }
.strike-panel[hidden] { display: none; }
.strike-panel p { margin: 6px 0; font-size: 12px; }
#spawn-count { margin-top: 8px; font: 11px/1.5 Consolas, monospace; color: var(--gold); }
.touch-controls, .touch-help { display: none; }
@media (any-pointer: coarse), (max-width: 650px) {
  .touch-controls { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 12px 12px; }
  .touch-help { display: block; font-size: 12px; margin-top: 10px; }
  .touch-controls button { min-width: 42px; height: 40px; touch-action: none; border: 1px solid var(--line); border-radius: 5px; background: #2e4433; }
  .touch-controls button:disabled { opacity: .5; }
  .d-pad { display: grid; gap: 3px; grid-template-columns: repeat(3, 1fr); }
  .d-pad button:first-child { grid-column: 2; }
  .d-pad button:nth-child(2) { grid-column: 1; }
  .touch-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 5px; }
  .touch-actions button { padding: 0 10px; }
  .touch-actions .primary { background: var(--lime); margin: 0; }
}
@media (max-width: 360px) {
  .brand { font-size: 13px; letter-spacing: 1px; gap: 4px; }
  .brand-cube { width: 17px; height: 18px; margin-right: 1px; }
  .top-actions { gap: 4px; }
  .top-actions .utility { font-size: 12px; padding-inline: 6px; }
}
@media (min-width: 841px) and (max-height: 850px) {
  .top-inner { min-height: 52px; }
  main { padding-top: 16px; }
  .intro { margin-bottom: 14px; }
  h1 { font-size: 40px; }
  .stage { background: #1c2d25; }
  canvas { max-height: max(260px, calc(100svh - 325px)); object-fit: contain; }
}
/* World controls stay beside the inventory and wrap on small screens. */
.adventure-panel { padding: 16px; border: 1px solid #83988b; border-radius: 12px; margin-top: 16px; background: #eff3e8; color: #243b33; }
.adventure-panel h2 { font-size: 18px; margin: 0 0 8px; }
.adventure-panel p, .gold-trading p { font-size: 13px; line-height: 1.5; }
.adventure-panel button, .gold-trading button { margin: 4px 0; max-width: 100%; white-space: normal; }
.gold-trading { padding: 14px; margin-top: 16px; border: 1px solid #a19a6b; border-radius: 10px; }
.survival-inventory { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-top: 1px solid #64765d; background: #24352a; color: #e0e6c9; }
.survival-inventory span { font-size: 12px; line-height: 1.4; }
.uniform-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.uniform-row > div, .uniform-row > span:not(.uniform-swatch) { flex: 1; min-width: 0; }
.uniform-row p { font-size: 12px; margin-top: 4px; }
.uniform-row .utility { flex-shrink: 0; }
.uniform-swatch { width: 25px; height: 36px; border: 2px solid #a1ae91; border-radius: 7px 7px 2px 2px; flex: 0 0 25px; }
.uniform-swatch[data-uniform="woodland"] { background-image: repeating-linear-gradient(37deg, #3c5035 0 5px, transparent 5px 10px, #92936a 10px 14px); }
.uniform-swatch[data-uniform="desert"] { background-image: repeating-linear-gradient(-32deg, #c7ae7e 0 5px, transparent 5px 10px, #8b7958 10px 13px); }
.uniform-swatch[data-uniform="urban"] { background-image: linear-gradient(#26333a, #26333a); background-size: 16px 20px; background-position: center; background-repeat: no-repeat; }
.uniform-swatch[data-uniform="officer"], .uniform-swatch[data-uniform="general"] { background-image: linear-gradient(90deg, transparent 35%, #c7ad6f 35% 42%, transparent 42% 60%, #c7ad6f 60% 67%, transparent 67%); }
.outfitter-close { float: right; margin-left: 8px; }
.vehicle-crew[hidden] { display: none; }
.vehicle-crew .utility { white-space: normal; }
