@font-face {
  font-family: Pretendard;
  src: url("./assets/pretendard-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("./assets/barlow-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: Pretendard, system-ui, sans-serif;
  --bg: #211a2b;
  --surface: #302638;
  --surface-2: #3a2d43;
  --border: #76536b;
  --border-dim: #4a374f;
  --text: #fff0e3;
  --muted: #d4bfce;
  --subtle: #bfa8bd;
  --accent: #f4b9a5;
  --mint: #c3d7b8;
  --cool: #c0c2ef;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --display: "Barlow Condensed", Impact, sans-serif;
  --radius: 18px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 13% 3%, #67445a66 0, transparent 43%),
    radial-gradient(ellipse at 84% 21%, #59407270 0, transparent 42%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
a { color: inherit; }
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
button, a { touch-action: manipulation; }
button, a, [tabindex] { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { display: inline-block; flex: 0 0 auto; vertical-align: middle; }
h1, h2, p, dl, dd { margin: 0; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip { position: fixed; z-index: 10; top: 12px; left: 12px; padding: 10px 15px; background: var(--accent); color: #2c2034; }
.shell { width: min(1290px, calc(100% - 80px)); margin: 0 auto; }
.topbar { border-bottom: 1px solid #704e6c55; background: #241c2d9e; }
.topbar-inner { min-height: 68px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; justify-self: start; text-decoration: none; }
.brand-icon { display: grid; width: 43px; height: 43px; place-items: center; color: #f7c4ae; border: 1px solid #926985; background: linear-gradient(145deg, #77516a, #50354d); border-radius: 14px; }
.brand-icon svg { width: 24px; height: 24px; }
.brand strong { display: block; font-size: 16px; font-weight: 840; line-height: 1.06; letter-spacing: -.035em; }
.brand small { display: block; margin-top: 4px; color: var(--subtle); font-size: 10px; line-height: 1; }
.nav { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid #6c4f6c; border-radius: 999px; background: #2c2236; }
.nav button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 84px;
  min-height: 37px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 730;
}
.nav button:hover { background: #ffffff08; color: var(--text); }
.nav button[aria-current] { color: #fff0ea; background: #654760; box-shadow: 0 1px 4px #1c1528; }
.nav button[aria-current] svg { color: var(--accent); }
.nav-dot { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--mint); }
.account, .wallet, .currency { display: flex; align-items: center; }
.account { justify-self: end; gap: 12px; }
.wallet { gap: 16px; padding: 0 13px; min-height: 37px; border: 1px solid var(--border); background: #362a40; border-radius: 10px; }
.currency { display: inline-flex; gap: 6px; font: 700 13px var(--mono); }
.currency b { color: var(--text); }
.scrap { color: var(--accent); }
.parts { color: var(--cool); }
.icon-button { display: inline-grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 10px; background: #362a40; color: var(--muted); }
.icon-button:hover { color: var(--accent); border-color: #ad788b; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 32px 0 22px; }
.eyebrow { display: flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 760; letter-spacing: .035em; color: var(--accent); }
.overlay-hint i { width: 3px; height: 3px; background: currentColor; opacity: .58; }
.page-heading h1 { margin: 7px 0 5px; font-size: clamp(34px, 4.1vw, 58px); font-weight: 870; line-height: 1.12; letter-spacing: -.052em; }
.intro { color: var(--muted); font-size: 15px; word-break: keep-all; }
.transmission { display: flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid #886783; border-radius: 999px; color: #e8cbdf; background: #543c5770; font-size: 12px; font-weight: 700; white-space: nowrap; }
.transmission svg { color: #efd1b9; }
.status-light { display: inline-block; flex-shrink: 0; width: 7px; height: 7px; background: #c3d7b8; border-radius: 50%; box-shadow: 0 0 10px #bbdfae56; }
.field-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 17px; }
.terminal, .aside-panel, .record, .item-card, .shelter-panel, .contract { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.terminal, .item-card, .shelter-panel { overflow: hidden; box-shadow: 0 14px 36px #180f2542; }
.terminal-head, .terminal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--subtle);
  font-size: 11px;
}
.terminal-head > span:first-child { display: flex; align-items: center; gap: 11px; }
.terminal-head b { font: 760 13px Pretendard, system-ui, sans-serif; }
.terminal-head svg { color: var(--accent); }
.terminal-head b { color: #e8d4e0; }
#monitor-status { flex: 0 0 auto; padding: 3px 9px; border: 1px solid #725671; border-radius: 999px; background: #443149; color: #e6c8d5; font-size: 10px; font-weight: 750; }
.terminal[data-mode="running"] #monitor-status { color: var(--mint); }
.arena { display: grid; position: relative; width: 100%; aspect-ratio: 928 / 520; isolation: isolate; border-block: 1px solid #5a445d; background: #3d354c; }
.arena canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay { position: relative; z-index: 3; display: grid; align-items: center; justify-items: center; overflow: auto; max-height: 100%; padding: 20px; text-align: center; background: #22182bc9; }
.overlay-ready { background: radial-gradient(ellipse at 50% 48%, #251d33f3 1%, #281d35df 16%, #281e36a1 33%, #281e3600 66%); }
.overlay-content { width: min(100%, 560px); text-shadow: 0 2px 12px #21172a; }
.overlay-tag { justify-content: center; color: #ffcfba; font-size: 12px; }
.overlay h2 { margin: 9px 0 5px; font-size: clamp(27px, 3.7vw, 52px); line-height: 1.12; font-weight: 880; letter-spacing: -.055em; }
.overlay-desc { color: #f3dbe0; font-size: 14px; word-break: keep-all; }
.overlay .start { margin-top: 23px; min-width: 172px; border-radius: 999px; padding-inline: 17px; }
.overlay-hint, .overlay-rewards { display: flex; align-items: center; justify-content: center; gap: 9px; }
.overlay-hint { margin-top: 17px; font-size: 11px; color: #eed9e7; }
.overlay-hint svg { color: #f6c5bd; }
.overlay-hint i { margin: 0 4px; }
.overlay-rewards { margin-top: 17px; color: var(--muted); }
.overlay-rewards > span { display: inline-flex; gap: 5px; align-items: center; font-size: 14px; }
.action-row { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid #765772;
  background: #4b374f;
  border-radius: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button:hover { border-color: #c2869a; background: #624361; }
.button:disabled { background: #3a2d41; color: #b8a4b7; border-color: #57425b; }
.button:disabled .currency, .button:disabled .currency b { color: #bba9bf; }
.button.primary { color: #372238; background: var(--accent); border-color: #ffd2bc; }
.button.primary:hover { background: #ffd2bf; border-color: #ffe0d2; }
.button.primary .currency, .button.primary .currency b { color: #3a2c44; }
.button.primary:disabled { color: #b8a5bb; background: #392c40; border-color: #57425b; }
.button.primary:disabled .currency, .button.primary:disabled .currency b { color: #baabc0; }
.button.danger { background: #884b65; border-color: #cc8ca1; }
.button.compact { min-height: 36px; padding: 6px 10px; font-size: 12px; }
.button-cost { display: flex; align-items: center; gap: 7px; }
.keyboard, .auto { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.keyboard > span { margin-left: 3px; }
kbd { font: 700 10px/1 var(--mono); color: #e6d1e7; background: #493850; border: 1px solid #735774; border-bottom-width: 2px; border-radius: 3px; padding: 4px 5px 3px; }
.auto { margin-left: auto; gap: 6px; color: var(--mint); font-weight: 700; }
.field-aside { display: grid; gap: 14px; }
.aside-panel { padding: 16px; min-width: 0; }
.aside-title { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.aside-title > span { color: var(--accent); }
.aside-title h2 { font-size: 16px; letter-spacing: -.02em; }
.sector-list { display: grid; gap: 8px; }
.sector { display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; padding: 9px; text-align: left; border: 1px solid var(--border-dim); border-radius: 10px; background: #362b3e; color: var(--muted); }
.sector.selected { background: linear-gradient(110deg, #634454, #453247); border-color: #b38393; color: var(--text); }
.sector:not(:disabled):hover { border-color: var(--sector); }
.sector-num { display: grid; flex: 0 0 40px; height: 40px; place-items: center; background: #44354e; border: 1px solid #5e4965; border-radius: 11px; color: var(--sector); }
.sector.selected .sector-num { color: var(--sector); background: #795365; border-color: #ab7888; }
.sector-copy, .field-gun > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sector-copy strong, .field-gun strong { font-size: 13px; word-break: keep-all; }
.sector-copy small, .field-gun small { color: var(--subtle); font-size: 10px; letter-spacing: .015em; }
.sector.selected .sector-copy small { color: #eccddb; }
.sector-badge { margin-left: auto; flex-shrink: 0; color: var(--subtle); }
.sector.selected .sector-badge { color: var(--sector); }
.field-gun { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.gun-icon, .record-icon { display: grid; flex-shrink: 0; place-items: center; width: 42px; height: 40px; border-radius: 10px; color: var(--item, var(--accent)); border: 1px solid #78546f; background: #51394d; }
.field-gun small { font-family: var(--mono); }
.level-tag { margin-left: auto; padding: 4px 6px; background: #493950; border: 1px solid #6b5370; color: #e1ccea; border-radius: 4px; font: 750 10px var(--mono); white-space: nowrap; }
.inline-button { display: flex; justify-content: space-between; align-items: center; gap: 6px; width: 100%; min-height: 36px; padding: 4px 0 0; border: 0; border-top: 1px solid var(--border-dim); background: transparent; color: var(--accent); font-size: 12px; font-weight: 750; }
.inline-button:hover { color: #ffded3; }
.tip { display: flex; align-items: flex-start; gap: 8px; padding: 12px; border: 1px solid #6b4e6b; border-radius: 10px; color: #e3cad9; background: #392c40; }
.tip > span { color: var(--accent); }
.tip p { font-size: 12px; word-break: keep-all; }
.tip strong { color: #ffd0b9; }
.field-records { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.record { display: flex; align-items: center; gap: 10px; padding: 11px; min-width: 0; }
.record-icon { width: 38px; height: 38px; color: #dfc2e8; background: #47364f; border-color: #604a68; }
.record strong { color: #dec9da; font-size: 12px; word-break: keep-all; }
.record b { margin-left: auto; font: 800 29px/1 var(--display); color: #f6d9d4; white-space: nowrap; }
.footer { display: flex; justify-content: space-between; gap: 14px; padding: 18px 0 22px; color: var(--subtle); font-size: 11px; }
.footer > span { display: flex; align-items: center; gap: 7px; }
.footer .status-light { width: 5px; height: 5px; }
.hud { z-index: 2; position: absolute; inset: 0; pointer-events: none; font-size: 12px; }
.health, .wave, .field-loot, .hud-bottom, .boss-hud { position: absolute; }
.health, .wave, .field-loot { top: 13px; }
.health, .field-loot, .hud-bottom, .boss-hud { background: #291e36e8; border: 1px solid #775d7d; border-radius: 10px; }
.health { left: 15px; width: min(26%, 210px); padding: 7px 9px; }
.health > span { display: flex; align-items: center; gap: 4px; color: #ffc3c7; white-space: nowrap; }
.health b { margin-left: auto; color: #ffe8ed; font: 700 11px var(--mono); }
.meter { height: 5px; overflow: hidden; background: #534059; border-radius: 2px; }
.meter div { height: 100%; background: #b8acd9; }
.health-meter { margin-top: 4px; background: #664257; }
.health-meter div { background: #ef9bae; }
.wave { left: 50%; text-align: center; transform: translateX(-50%); text-shadow: 0 2px 4px #21172a; }
.wave small { display: block; color: #ffd1bc; font-size: 10px; font-weight: 750; letter-spacing: .09em; }
.wave b { display: block; font: 800 29px/.9 var(--display); color: #fff1e3; }
.wave i { color: #d6bed5; font-size: 17px; font-style: normal; }
.field-loot { right: 15px; display: flex; gap: 9px; align-items: center; padding: 4px 4px 4px 8px; }
.field-loot > span { display: flex; align-items: center; gap: 3px; }
.field-loot b { color: var(--text); font-family: var(--mono); }
.field-loot button { width: 30px; height: 29px; pointer-events: auto; }
.boss-hud { top: 63px; left: 50%; width: min(45%, 230px); padding: 4px 7px 6px; transform: translateX(-50%); color: #f5bdc7; text-align: center; font-size: 11px; }
.hud-bottom { right: 15px; bottom: 12px; left: 15px; display: grid; grid-template-columns: 1fr 1.7fr 1fr; gap: 12px; align-items: center; padding: 5px 9px; color: #ecd8ed; }
.hud-bottom > div:last-child { justify-self: end; white-space: nowrap; }
.hud-bottom svg { color: var(--accent); }
.xp { display: flex; align-items: center; gap: 8px; font: 700 11px var(--mono); white-space: nowrap; }
.xp .meter { flex: 1; }
.perk-grid { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.perk { flex: 1; text-align: left; min-width: 0; padding: 10px; color: #f8c9bc; background: #47344d; border: 1px solid #856389; border-radius: 10px; }
.perk:hover { border-color: var(--accent); background: #614561; }
.perk-top { display: flex; align-items: center; gap: 5px; min-height: 22px; color: var(--skill, #f8c9bc); }
.perk-top > span { font-size: 10px; font-weight: 720; word-break: keep-all; }
.perk-top kbd { margin-left: auto; }
.perk-area { border-color: color-mix(in srgb, var(--skill) 44%, #5a4161); background: linear-gradient(150deg, color-mix(in srgb, var(--skill) 12%, #352840), #3b2b45); }
.perk-exclusive { border-color: var(--skill); }
.perk-stats { display: block; margin-top: 6px; color: var(--skill); font-size: 11px; font-weight: 720; }
.perk strong, .perk small { display: block; word-break: keep-all; }
.perk strong { color: var(--text); font-size: 13px; margin-top: 4px; }
.perk small { color: var(--muted); font-size: 11px; }
.touch-controls { display: none; }
.sub-heading { padding-bottom: 24px; }
.return-button { margin-bottom: 1px; }
.weapon-group + .weapon-group { margin-top: 25px; }
.weapon-group > h2 { margin-bottom: 11px; font-size: 16px; letter-spacing: -.02em; }
.item-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.gear-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item-art { height: 174px; position: relative; display: grid; place-items: center; color: var(--item); background: radial-gradient(ellipse at 50% 42%, color-mix(in srgb, var(--item) 22%, #352841), #2b2236 77%); border-bottom: 1px solid var(--border); overflow: hidden; }
.item-art::before { position: absolute; inset: 0; content: ""; opacity: .65; background: radial-gradient(#f5cfeb54 .7px, transparent .85px); background-size: 15px 15px; }
.item-art > img { width: 91%; height: 84%; object-fit: contain; z-index: 1; filter: drop-shadow(0 10px 8px #20162c); }
.gun-icon > img { width: 38px; height: 30px; object-fit: contain; }
.item-art span, .item-art small { position: absolute; z-index: 2; font: 700 9px var(--mono); letter-spacing: .11em; }
.item-art span { top: 12px; left: 12px; }
.item-art small { bottom: 9px; right: 10px; color: var(--muted); }
.item-content { padding: 14px; }
.item-heading { display: flex; align-items: center; gap: 6px; }
.item-heading h3 { margin: 0; font-size: 19px; letter-spacing: -.035em; }
.item-content p { min-height: 42px; margin-top: 5px; color: var(--muted); font-size: 13px; word-break: keep-all; }
.weapon-skill { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0 9px; color: var(--skill); font-size: 12px; }
.weapon-skill svg { flex-shrink: 0; margin-top: 2px; }
.weapon-skill small { display: block; color: var(--muted); font-size: 11px; word-break: keep-all; }
.item-content .weapon-skill { min-height: 45px; }
.gun-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; padding: 11px 0; margin: 9px 0 10px; border-block: 1px solid var(--border-dim); }
.gun-stats dt { color: var(--muted); font-size: 11px; }
.gun-stats dd { font: 800 24px/1.05 var(--display); color: #f6e1e2; }
.item-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.item-actions .button { flex: 1; padding-inline: 7px; }
.shelter-grid { display: grid; grid-template-columns: minmax(0, 1fr) 365px; gap: 16px; align-items: start; }
.room { padding: 16px 18px 18px; background: radial-gradient(ellipse at 50% 80%, #624358, #35263d 70%); border-block: 1px solid var(--border); }
.room-wall { display: flex; align-items: center; justify-content: space-between; height: 88px; padding: 0 22px; background: repeating-linear-gradient(90deg, #66465d 0 2px, #76536b 2px 20px); border: 5px solid #4d374b; border-bottom-color: #9f6979; }
.room-wall span { display: grid; place-items: center; }
.room-window { width: 55px; height: 42px; border: 3px solid #bd8f96; border-radius: 12px 12px 4px 4px; color: #ebd3ee; background: radial-gradient(ellipse at 60% 30%, #74619b, #3b345c 75%); }
.room-picture { width: 38px; height: 32px; color: #bfc7ab; border: 3px solid #a5757d; border-radius: 4px; background: #5d485e; }
.room-light { width: 26px; height: 7px; border-radius: 8px 8px 2px 2px; background: #ffd3a7; box-shadow: 0 3px 22px #ffd3a7c4; }
.room-floor { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; background: #503549; border: 5px solid #976777; border-top: 0; }
.slot { position: relative; display: grid; min-width: 0; min-height: 42px; aspect-ratio: 1.6; padding: 0; place-items: center; border: 1px solid transparent; background: repeating-linear-gradient(0deg, #ffffff00 0 12px, #412b436b 12px 14px), linear-gradient(110deg, #85606e, #795164); color: #d9b2bd; font: 700 13px var(--mono); }
.room-floor.lit .slot { background: repeating-linear-gradient(0deg, #ffffff00 0 12px, #64394a64 12px 14px), #a27371; }
.slot:hover, .placing .slot:hover { z-index: 1; border-color: var(--accent); box-shadow: inset 0 0 16px #efb29465; }
.placing .slot { border-color: #bb8d9e; }
.slot .furniture-art { max-height: 93%; width: 83%; }
.shelter-controls { display: flex; align-items: center; gap: 6px; padding: 10px; }
.shelter-controls p { margin-right: auto; color: var(--muted); font-size: 12px; word-break: keep-all; }
.shelter-controls strong { color: var(--accent); }
.furniture-list { display: grid; gap: 4px; }
.furniture-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 5px; border: 1px solid var(--border-dim); border-radius: 10px; background: #362b3e; }
.furniture-row.picked { border-color: #aa798d; }
.furniture-row strong, .furniture-row small { display: block; word-break: keep-all; }
.furniture-row strong { font-size: 13px; }
.furniture-row small { color: var(--muted); font-size: 11px; }
.furniture-thumbnail { display: grid; place-items: center; min-height: 35px; border-radius: 3px; background: color-mix(in srgb, var(--item) 16%, #412f45); }
.furniture-thumbnail svg { width: 39px; }
.contracts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.contract { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 13px; }
.contract.complete { border-color: #bd8b9f; }
.contract h2 { font-size: 17px; letter-spacing: -.035em; }
.contract p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.contract-progress, .contract-rewards > span { display: flex; align-items: center; gap: 7px; }
.contract-progress { margin-top: 12px; }
.contract-progress > .meter { flex: 1; }
.contract-progress > span { color: var(--muted); font: 700 10px var(--mono); white-space: nowrap; }
.contract-rewards { display: grid; gap: 7px; justify-items: stretch; }
.contract-rewards > span { justify-content: center; }
.toast { z-index: 9; position: fixed; right: 18px; bottom: 18px; width: max-content; max-width: calc(100% - 36px); padding: 12px 16px; border: 1px solid #b7869c; border-radius: 10px; color: #ffe7dc; background: #543a53; box-shadow: 0 8px 25px #1b1227ab; font-size: 13px; font-weight: 710; }
dialog { max-width: min(420px, calc(100% - 28px)); padding: 0; border: 1px solid #8f6b8e; border-radius: 8px; background: #3e2e4a; color: var(--text); }
dialog::backdrop { background: #1f162bbf; }
.modal-inner { padding: 22px; }
.modal-inner h2 { margin: 6px 0; font-size: 25px; }
.modal-inner p:not(.eyebrow) { color: var(--muted); font-size: 14px; }
.modal-inner .action-row { justify-content: end; }
@media (min-width: 1600px) {
  .page-heading { padding-top: 44px; }
}
@media (max-width: 1100px) {
  .shell { width: calc(100% - 44px); }
  .field-grid { grid-template-columns: minmax(0, 1fr) 253px; gap: 13px; }
  .field-aside { gap: 9px; }
  .aside-panel { padding: 11px; }
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .shell { width: calc(100% - 32px); }
  .topbar-inner { gap: 0; grid-template-columns: 1fr auto; min-height: 0; }
  .brand, .account { margin-block: 9px; }
  .nav { grid-row: 2; grid-column: 1 / -1; justify-content: stretch; gap: 1px; margin: 0 0 9px; }
  .nav button { flex: 1; min-width: 0; min-height: 44px; padding: 0 6px; font-size: 13px; }
  .nav-dot { top: 7px; right: 10px; }
  .page-heading { padding: 24px 0 16px; }
  .transmission { display: none; }
  .field-grid, .shelter-grid { grid-template-columns: minmax(0, 1fr); }
  .field-aside { grid-template-columns: 1fr 1fr; }
  .tip { grid-column: 1 / -1; }
  .record { padding: 8px; gap: 6px; }
  .record-icon { width: 32px; height: 32px; }
  .record b { font-size: 24px; }
  .contracts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .field-aside { grid-template-columns: 1fr; }
  .field-records { grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 9px; }
}
@media (max-width: 510px) {
  .shell { width: calc(100% - 22px); }
  .wallet { gap: 10px; padding-inline: 8px; }
  .account { gap: 6px; }
  .page-heading h1 { font-size: 36px; }
  .intro { font-size: 13px; }
  .arena { aspect-ratio: 928 / 610; }
  .overlay { padding: 8px; }
  .overlay h2 { font-size: 30px; margin-top: 6px; }
  .overlay-desc { font-size: 12px; }
  .overlay .start { margin-top: 12px; }
  .overlay-hint, .overlay-rewards { margin-top: 8px; font-size: 10px; }
  .action-row { margin-top: 9px; }
  .terminal[data-mode="perk"] .overlay { padding: 6px 7px; }
  .terminal[data-mode="perk"] .overlay h2 { font-size: 25px; margin: 4px 0; }
  .terminal[data-mode="perk"] .overlay-desc { line-height: 1.35; }
  .perk-grid { margin-top: 6px; gap: 4px; }
  .perk { padding: 5px; }
  .perk kbd { display: none; }
  .perk small { font-size: 10px; line-height: 1.35; }
  .perk-top { gap: 4px; min-height: 17px; }
  .perk-top > svg { width: 14px; height: 14px; flex: 0 0 14px; }
  .perk-top > span, .perk-stats { font-size: 9px; }
  .perk-stats { margin-top: 4px; line-height: 1.28; }
  .terminal-foot { gap: 6px; min-height: 36px; padding: 0 8px; }
  .keyboard { gap: 2px; }
  .keyboard > span, .auto { font-size: 9px; }
  .keyboard kbd { padding: 3px 3px 2px; font-size: 8px; }
  .terminal-head { min-height: 37px; padding-inline: 9px; }
  .health, .wave, .field-loot { top: 8px; }
  .health { left: 7px; width: 29%; padding: 4px; }
  .health svg { width: 11px; }
  .health > span, .health b { font-size: 9px; }
  .wave b { font-size: 23px; }
  .field-loot { right: 7px; gap: 5px; padding: 2px 2px 2px 5px; }
  .field-loot svg { width: 12px; }
  .hud-bottom { bottom: 7px; right: 7px; left: 7px; padding: 3px 5px; font-size: 10px; }
  .hud-bottom svg { width: 12px; }
  .boss-hud { top: 45px; }
  .return-button { display: none; }
  .item-grid { grid-template-columns: 1fr; gap: 9px; }
  .item-art { height: 154px; }
  .item-content p { min-height: 0; }
  .room { padding: 8px; }
  .room-wall { height: 62px; padding-inline: 14px; }
  .overlay-ready { background: radial-gradient(ellipse at 50% 40%, #251d33ef 0, #281e36c7 31%, #281e3600 70%); }
  .shelter-controls { flex-wrap: wrap; }
  .shelter-controls p { flex: 0 0 100%; }
}
@media (pointer: coarse), (max-width: 620px) {
  .terminal[data-mode="running"] .terminal-foot { display: none; }
  .touch-controls { display: flex; align-items: center; justify-content: space-between; padding: 7px 13px; gap: 15px; }
  .touch-dpad { display: grid; grid-template-columns: repeat(3, 42px); gap: 3px; }
  .touch-controls button { display: grid; place-items: center; border: 1px solid #8d6b8f; border-radius: 10px; background: #493650; color: #f6e4ec; min-height: 40px; touch-action: none; user-select: none; }
  .touch-controls button:active { background: #70506f; color: var(--accent); }
  .touch-dpad button:first-child { grid-column: 2; }
  .touch-dpad button:nth-child(2) { grid-column: 1; }
  .touch-controls .dash-touch { width: 63px; height: 53px; gap: 0; padding: 4px; color: var(--accent); font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media (min-width: 781px) and (max-height: 820px) {
  .page-heading { padding: 24px 0 18px; }
  .page-heading h1 { font-size: clamp(34px, 3.85vw, 51px); }
  .arena { max-height: max(302px, calc(100svh - 294px)); }
}
