:root {
  --night: #0a0f2c;
  --night-2: #121a45;
  --night-3: #1b2560;
  --ink: #eef2ff;
  --muted: #9aa6d6;
  --gold: #ffd166;
  --gold-2: #f4a261;
  --cyan: #7df9ff;
  --red: #e63946;
  --hazard: #ffcc00;
  --steel: #8d99ae;
  --win-top: #3149c4;
  --win-bot: #0f1a6b;
  --pixel: "Press Start 2P", monospace;
  --display: "Cinzel", Georgia, serif;
  --sans: "Chakra Petch", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 60px; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
a { color: var(--cyan); }
button { font: inherit; color: inherit; cursor: pointer; }
canvas { image-rendering: pixelated; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.scanlines {
  position: fixed; inset: 0; z-index: 300; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.12) 0 1px, transparent 1px 3px);
}

/* ---------- JRPG window ---------- */
.window {
  background: linear-gradient(180deg, var(--win-top), var(--win-bot));
  border: 3px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 0 3px #050822, inset 0 0 0 2px rgba(0,0,0,.35), 8px 8px 0 rgba(0,0,0,.35);
  color: #fff;
  padding: 18px 20px;
}
.window h3 {
  margin: 0 0 14px; font-family: var(--pixel); font-weight: 400; font-size: 12px;
  color: var(--gold); letter-spacing: 1px;
}

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 20px; padding: 10px 20px;
  background: rgba(10, 15, 44, .88); backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(255,255,255,.15);
  font-family: var(--pixel); font-size: 10px;
}
.hud-player { display: flex; align-items: center; gap: 12px; }
.hud-name { color: #fff; }
.hud-lv { color: var(--gold); }
.exp-bar { width: 90px; height: 8px; background: #050822; border: 2px solid #fff; display: block; }
.exp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), #3a86ff); transition: width .6s; }
.hud-nav { margin: 0 auto; display: flex; gap: 22px; }
.hud-nav a { color: var(--ink); text-decoration: none; }
.hud-nav a:hover { color: var(--gold); }
.hud-right { display: flex; align-items: center; gap: 14px; }
.gil { color: var(--gold); }
.hud-btn { font-family: var(--pixel); font-size: 9px; background: none; border: 2px solid var(--muted); color: var(--muted); padding: 6px 8px; }
.hud-btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.bump { animation: bump .4s; }
@keyframes bump { 40% { transform: scale(1.4); color: #fff; } }

/* ---------- Title screen ---------- */
.title-screen {
  position: relative; min-height: calc(100vh - 50px); overflow: hidden;
  display: grid; align-items: center;
  background:
    radial-gradient(ellipse at 70% 110%, rgba(125,249,255,.18), transparent 55%),
    radial-gradient(ellipse at 20% -10%, rgba(155,93,229,.45), transparent 60%),
    linear-gradient(180deg, #070a20, #111a52 70%, #1d2a78);
}
.stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-grid {
  position: relative; width: 100%; max-width: 1180px; margin: 0 auto; padding: 40px 24px 80px;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center;
}
.kicker { font-family: var(--pixel); font-size: 10px; letter-spacing: 2px; color: var(--cyan); margin: 0; }
.logo {
  position: relative; display: inline-block; margin: 12px 0 6px;
  font-family: var(--display); font-weight: 900; font-size: clamp(64px, 11vw, 150px); line-height: 1;
  letter-spacing: .04em;
  background: linear-gradient(100deg, #fff6d5 0%, var(--gold) 30%, #b8792b 50%, var(--gold) 62%, #fff6d5 70%, var(--gold) 85%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #6b3d10) drop-shadow(0 10px 18px rgba(0,0,0,.6));
  animation: shine 5s linear infinite;
}
@keyframes shine { to { background-position: -250% 0; } }
.logo-crystal {
  position: absolute; right: -.35em; top: .05em; width: .28em; height: .5em;
  background: linear-gradient(135deg, #fff, var(--cyan) 45%, #3a86ff);
  clip-path: polygon(50% 0, 100% 40%, 50% 100%, 0 40%);
  filter: drop-shadow(0 0 12px var(--cyan));
  animation: bob 3s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-10px); } }
.typer { font-family: var(--pixel); font-size: 11px; color: var(--ink); min-height: 1.6em; margin: 10px 0 26px; }
.caret { color: var(--gold); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.menu { position: relative; display: inline-flex; flex-direction: column; gap: 4px; padding: 18px 28px 18px 52px; min-width: 280px; }
.menu-item {
  background: none; border: 0; text-align: left; padding: 8px 4px;
  font-family: var(--pixel); font-size: 13px; color: #fff;
}
.menu-item small { font-size: 8px; color: var(--muted); margin-left: 8px; }
.menu-item.active, .menu-item:hover { color: var(--gold); }
.cursor {
  position: absolute; left: 12px; top: 0; width: 26px; height: 16px;
  transition: top .12s steps(3); animation: poke .6s ease-in-out infinite;
}
.cursor canvas { display: block; }
@keyframes poke { 50% { transform: translateX(4px); } }
.menu-hint { font-family: var(--pixel); font-size: 8px; color: var(--muted); margin-top: 14px; }

.title-right { position: relative; display: grid; place-items: center; min-height: 460px; }
.magic-circle {
  position: absolute; width: min(460px, 90%); aspect-ratio: 1; fill: none;
  stroke: rgba(125,249,255,.35); stroke-width: .8;
  animation: spin 40s linear infinite;
  filter: drop-shadow(0 0 6px rgba(125,249,255,.5));
}
.magic-circle text { fill: rgba(125,249,255,.55); stroke: none; font-family: var(--display); font-size: 8.4px; letter-spacing: 1.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hero-mech { position: relative; width: min(320px, 70vw); animation: hover 4s ease-in-out infinite; z-index: 1; }
@keyframes hover { 50% { transform: translateY(-14px); } }
.platform {
  position: absolute; bottom: 18px; width: 300px; height: 36px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(125,249,255,.55), rgba(125,249,255,0) 70%);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(.8); opacity: .6; } }
.scroll-cue {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  color: var(--gold); text-decoration: none; font-size: 18px; animation: bob 1.6s ease-in-out infinite;
}

/* ---------- Pixel mech ---------- */
.punit { position: relative; width: 100%; aspect-ratio: 72 / 64; }
.punit canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.punit .flame { opacity: 0; }
.pveh .flame, .hero-mech .flame, .bay.launching .flame, .summon .flame { opacity: 1; animation: pflick .12s steps(2) infinite; }
@keyframes pflick { 50% { filter: brightness(1.4) saturate(1.3); opacity: .75; } }
.hero-mech .punit { filter: drop-shadow(0 0 24px rgba(125,249,255,.25)); }
.intro { margin: 4px 0 0; max-width: 460px; color: #dfe4ff; font-size: 18px; }

/* ---------- Hazard strip ---------- */
.hazard {
  overflow: hidden; background: #0b0b0f; color: var(--hazard);
  border-block: 12px solid transparent;
  border-image: repeating-linear-gradient(45deg, var(--hazard) 0 14px, #0b0b0f 14px 28px) 12;
  font-family: var(--sans); font-weight: 700; letter-spacing: 3px; font-size: 14px; padding: 10px 0;
}
.hazard-track { display: flex; gap: 56px; width: max-content; animation: tick 40s linear infinite; }
.hazard-track span { white-space: nowrap; }
.hazard-track span::before { content: "◆"; margin-right: 56px; color: #fff; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- Chapters ---------- */
.chapter { padding: 110px 20px; }
.chapter > * { max-width: 1140px; margin-left: auto; margin-right: auto; }
.chapter-head { text-align: center; margin-bottom: 52px; }
.chapter-num {
  display: inline-block; font-family: var(--pixel); font-size: 10px; letter-spacing: 2px;
  color: var(--night); background: var(--cyan); padding: 7px 12px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.chapter-head h2 {
  margin: 16px 0 10px; font-family: var(--display); font-weight: 900; font-size: clamp(34px, 6vw, 64px);
  line-height: 1.1; color: var(--gold); text-shadow: 0 3px 0 #6b3d10, 0 8px 24px rgba(0,0,0,.5);
}
.chapter-head p { color: var(--muted); max-width: 540px; margin: 0 auto; }

/* ---------- Hangar ---------- */
.hangar {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 2px, transparent 2px 120px),
    linear-gradient(180deg, #0c1233, #151c3f);
}
.hangar-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: stretch; }
.bay {
  position: relative; overflow: hidden; min-height: 560px; border-radius: 6px;
  border: 3px solid #3a4468;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(255,255,255,.05) 49.6% 50.4%, transparent 50.4%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 2px, transparent 2px 60px),
    radial-gradient(ellipse at 50% 30%, #2d3766, #10152f 70%);
  display: grid; place-items: center;
}
.bay::before, .bay::after {
  content: ""; position: absolute; width: 26px; height: 26px; border: 3px solid var(--cyan); opacity: .7;
}
.bay::before { top: 14px; left: 14px; border-right: 0; border-bottom: 0; }
.bay::after { bottom: 14px; right: 14px; border-left: 0; border-top: 0; }
.bay-lights { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-around; }
.bay-lights i {
  width: 70px; height: 8px; background: #fff7d6; border-radius: 0 0 6px 6px;
  box-shadow: 0 0 30px 10px rgba(255,247,214,.25);
}
.bay-lights i::after {
  content: ""; position: absolute; width: 120px; height: 500px; margin-left: -25px; margin-top: 8px;
  background: linear-gradient(180deg, rgba(255,247,214,.07), transparent 80%);
  clip-path: polygon(35% 0, 65% 0, 100% 100%, 0 100%); pointer-events: none;
}
.bay-gantry {
  position: absolute; left: 8%; right: 8%; top: 38%; height: 14px;
  background: repeating-linear-gradient(90deg, #3a4468 0 8px, #262d4d 8px 16px);
  border-block: 3px solid #4d5883; opacity: .8;
}
.bay-unit { position: relative; width: min(380px, 84%); z-index: 1; margin-bottom: 30px; }
.bay-unit .pveh { display: none; }
.bay.veh-mode .pmech { display: none; }
.bay.veh-mode .pveh { display: block; }
.bay-unit::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: 0; height: 7%; z-index: -1; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%);
}
.bay-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  background: repeating-linear-gradient(45deg, var(--hazard) 0 16px, #111 16px 32px);
  border-top: 4px solid #000; opacity: .85;
}
.bay-readout {
  position: absolute; left: 20px; top: 26px; z-index: 2;
  display: grid; grid-template-columns: auto auto; gap: 2px 12px;
  font-family: var(--sans); font-size: 12px; letter-spacing: 1px; color: var(--cyan);
}
.bay-readout b { color: #fff; font-weight: 700; }
.bay.launching .pmech { animation: launch-up 1.5s cubic-bezier(.6, 0, .9, .4) forwards; }
.bay.launching .pveh { animation: launch-right 1.3s cubic-bezier(.6, 0, .9, .4) forwards; }
.bay.landing .bay-unit { animation: land .7s cubic-bezier(.2, 1.4, .5, 1); }
@keyframes launch-up { 0% { transform: none; } 18% { transform: translateY(12px) scaleY(.96); } 100% { transform: translateY(-900px); } }
@keyframes launch-right { 0% { transform: none; } 15% { transform: translateX(-20px); } 100% { transform: translateX(900px); } }
@keyframes land { from { transform: translateY(-500px); } }
.launch-fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; display: grid; place-items: center; }
.launch-fx.show { animation: fx 1.8s ease-out; }
@keyframes fx { 0% { opacity: 0; } 10%, 75% { opacity: 1; } 100% { opacity: 0; } }
.speedlines {
  position: absolute; inset: -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.14) 0 2deg, transparent 2deg 9deg);
  animation: spin 3s linear infinite;
}
.launch-fx p {
  position: relative; margin: 0; padding: 12px 28px; text-align: center;
  font-family: var(--sans); font-weight: 700; font-style: italic; font-size: clamp(22px, 4vw, 40px);
  letter-spacing: 2px; color: #fff; background: var(--red);
  transform: skewX(-12deg); box-shadow: 8px 8px 0 #000;
}

.config { display: flex; flex-direction: column; gap: 14px; }
.opt { display: grid; gap: 8px; }
.opt-label { font-family: var(--pixel); font-size: 9px; color: var(--cyan); }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-btn {
  font-family: var(--pixel); font-size: 9px; padding: 10px 12px;
  background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.5); border-radius: 4px;
}
.opt-btn:hover { border-color: #fff; }
.opt-class { display: grid; gap: 6px; min-width: 104px; text-align: center; }
.opt-class small { font-size: 7px; opacity: .75; }
.opt-btn[aria-pressed="true"] { background: var(--gold); color: var(--night); border-color: #fff; }
.swatch {
  width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.4);
  background: conic-gradient(var(--a) 0 50%, var(--b) 50% 75%, var(--c) 75%);
}
.swatch[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px var(--night), 0 0 0 5px var(--gold); }
.stats { display: grid; gap: 8px; margin-top: 4px; padding-top: 14px; border-top: 2px dashed rgba(255,255,255,.25); }
.stat { display: grid; grid-template-columns: 96px 1fr 24px; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 8px; }
.stat-bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.stat-bar i { height: 10px; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.2); transition: background .3s; }
.stat-bar i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.config-actions { display: flex; gap: 12px; margin-top: 6px; }
.btn {
  flex: 1; font-family: var(--pixel); font-size: 11px; padding: 16px 12px;
  background: var(--red); color: #fff; border: 3px solid #fff; border-radius: 4px;
  box-shadow: 0 5px 0 #7a1020; transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #7a1020; }
.btn-alt { background: #3a86ff; box-shadow: 0 5px 0 #1d4a9e; }
.btn-alt:active { box-shadow: 0 1px 0 #1d4a9e; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Quest board ---------- */
.quests { background: linear-gradient(180deg, #151c3f, #1f1530); }
.board { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.board-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 26px;
  padding: 34px 28px; border-radius: 10px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 3px, transparent 3px 64px),
    linear-gradient(90deg, #6b4423, #7d5230 30%, #6b4423 60%, #7a4f2c);
  border: 10px solid #3d2410; box-shadow: inset 0 0 40px rgba(0,0,0,.6), 0 20px 40px rgba(0,0,0,.4);
}
.quest {
  position: relative; padding: 26px 18px 18px; color: #3a2614; text-align: center;
  background: linear-gradient(180deg, #f6ead0, #e8d3a8);
  clip-path: polygon(0 2%, 4% 0, 30% 1.5%, 60% 0, 96% 1%, 100% 4%, 99% 40%, 100% 97%, 94% 100%, 50% 98.5%, 6% 100%, 0 96%, 1% 50%);
  transform: rotate(var(--tilt, 0deg)); transition: transform .25s;
  filter: drop-shadow(0 8px 6px rgba(0,0,0,.4));
}
.quest:hover { transform: rotate(0deg) translateY(-6px); }
.quest::before {
  content: ""; position: absolute; top: 8px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a8a, var(--red) 60%, #7a1020);
}
.quest-rank { font-family: var(--sans); font-size: 20px; line-height: 1; letter-spacing: 2px; color: rgba(58,38,20,.25); }
.quest-rank b { color: #d4891c; font-weight: 400; }
.quest canvas { display: block; margin: 12px auto; }
.quest h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 900; font-size: 20px; color: #3a2614; line-height: 1.2; }
.quest p { margin: 0 0 12px; font-size: 14px; line-height: 1.4; }
.quest .reward { font-family: var(--pixel); font-size: 8px; color: #7a4f2c; margin-bottom: 14px; }
.quest button {
  font-family: var(--pixel); font-size: 10px; padding: 11px 18px;
  background: #3a2614; color: #f6ead0; border: 0; border-radius: 3px;
}
.quest button:hover { background: var(--red); }
.stamp {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg);
  font-family: var(--pixel); font-size: 16px; color: var(--red); border: 4px solid var(--red);
  padding: 8px 10px; opacity: 0; pointer-events: none; mix-blend-mode: multiply;
}
.quest.cleared .stamp { opacity: .85; animation: stamp .35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-18deg) scale(2.4); opacity: 0; } }
.pouch-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; font-size: 15px; }
.pouch-list li { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(255,255,255,.2); padding-bottom: 6px; }
.pouch-list b { color: var(--gold); font-family: var(--pixel); font-size: 10px; }
.tips p { margin: 0 0 10px; font-size: 14px; color: #dfe4ff; }
.tips b { font-family: var(--pixel); font-size: 8px; color: var(--night); background: var(--gold); padding: 3px 5px; margin-right: 6px; }
.tips em { color: var(--gold); font-style: normal; font-weight: 700; }

/* ---------- Status menu ---------- */
.status { background: radial-gradient(ellipse at 70% 30%, rgba(125,249,255,.1), transparent 55%), #1f1530; }
.status-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.status-tabs.menu { position: sticky; top: 80px; display: flex; min-width: 0; padding: 16px 16px 16px 50px; }
.status-tabs .menu-item[aria-selected="true"] { color: var(--cyan); }
.status-tabs .menu-item[aria-selected="true"]::after { content: " <"; }
.status-panel { min-height: 460px; padding: 26px 28px; }
.st-top { display: flex; align-items: center; gap: 20px; }
.st-portrait { width: 110px; height: 110px; flex: none; display: grid; place-items: center; background: rgba(0,0,0,.3); border: 3px solid #fff; border-radius: 8px; }
.st-top h3 { margin: 0 0 8px; font-family: var(--display); font-weight: 900; font-size: 28px; color: var(--gold); letter-spacing: 0; line-height: 1.15; }
.st-job { margin: 0 0 6px; font-family: var(--pixel); font-size: 11px; color: #fff; line-height: 1.6; }
.st-loc { margin: 0; font-family: var(--pixel); font-size: 9px; color: var(--cyan); line-height: 1.6; }
.st-bio { font-size: 18px; margin: 22px 0; }
.st-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.st-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; background: rgba(0,0,0,.25); border-radius: 6px; }
.st-stats span { font-family: var(--pixel); font-size: 8px; color: var(--muted); }
.st-stats b { font-size: 16px; color: var(--gold); text-align: right; }
.st-contact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.tbtn {
  display: inline-block; font-family: var(--pixel); font-size: 10px; padding: 11px 14px; text-decoration: none;
  color: var(--night); background: var(--gold); border: 2px solid #fff; border-radius: 4px; text-align: center;
}
.tbtn.ghost { background: transparent; color: #fff; }
.tbtn.go { background: var(--red); color: #fff; }
.tbtn:hover { filter: brightness(1.12); }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sk-group h4 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-family: var(--pixel); font-size: 9px; line-height: 1.6; color: var(--gold); font-weight: 400; }
.sk-group h4 small { width: 100%; font-size: 7px; color: var(--cyan); }
.sk-icon canvas { display: block; }
.sk-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sk-group li { font-size: 16px; padding: 6px 10px; background: rgba(0,0,0,.22); border-left: 3px solid var(--cyan); border-radius: 0 4px 4px 0; }
.journey { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 4px; position: relative; }
.journey::before { content: ""; position: absolute; left: 96px; top: 8px; bottom: 8px; width: 2px; background: rgba(255,255,255,.25); }
.journey li { display: grid; grid-template-columns: 90px 1fr; gap: 22px; padding: 10px 0; position: relative; }
.journey li::before { content: ""; position: absolute; left: 88px; top: 16px; width: 10px; height: 10px; transform: rotate(45deg); background: var(--muted); }
.journey li.active::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.j-when { font-family: var(--pixel); font-size: 8px; line-height: 1.8; color: var(--cyan); padding-top: 4px; }
.j-body b { font-size: 18px; }
.j-body em { margin-left: 8px; font-style: normal; font-family: var(--pixel); font-size: 7px; color: var(--night); background: var(--gold); padding: 3px 5px; vertical-align: middle; }
.j-role { display: block; color: var(--gold); font-size: 15px; }
.j-body p { margin: 4px 0 0; font-size: 15px; color: #dfe4ff; }
.tr-list { display: grid; gap: 16px; }
.tr-card { display: flex; gap: 20px; align-items: center; padding: 18px; background: rgba(0,0,0,.22); border-radius: 8px; }
.tr-icon { width: 80px; height: 80px; flex: none; display: grid; place-items: center; background: rgba(0,0,0,.3); border: 2px solid rgba(255,255,255,.35); border-radius: 6px; }
.tr-card b { display: block; font-size: 20px; margin: 4px 0; }
.tr-card p { margin: 0; color: var(--gold); }
.tr-card small { color: var(--muted); font-size: 14px; }
.files-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
.file-list { display: grid; gap: 6px; }
.slot {
  display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 12px; width: 100%;
  text-align: left; padding: 10px 12px; color: #fff;
  background: rgba(0,0,0,.18); border: 2px solid transparent; border-radius: 6px;
}
.slot:hover { border-color: rgba(255,255,255,.4); }
.slot[aria-selected="true"] { border-color: var(--gold); background: rgba(255,209,102,.13); }
.slot-icon { width: 50px; height: 50px; display: grid; place-items: center; background: rgba(0,0,0,.3); border: 2px solid rgba(255,255,255,.35); border-radius: 6px; }
.slot-title { font-family: var(--pixel); font-size: 10px; line-height: 1.5; }
.slot-title small { display: block; font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.slot-meta { font-family: var(--pixel); font-size: 8px; text-align: right; line-height: 2; color: var(--gold); white-space: nowrap; }
.slot-meta span { display: block; color: #fff; }
.file-detail { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 16px; background: rgba(0,0,0,.2); border-radius: 8px; min-height: 360px; }
.file-detail .art { width: 130px; height: 130px; display: grid; place-items: center; background: radial-gradient(circle, rgba(125,249,255,.28), transparent 70%); animation: bob 3s ease-in-out infinite; }
.file-detail h3 { margin: 0; font-family: var(--display); font-weight: 900; font-size: 24px; color: var(--gold); letter-spacing: 0; }
.file-detail .loc { font-family: var(--pixel); font-size: 8px; color: var(--cyan); line-height: 1.9; }
.file-detail p { margin: 0; font-size: 16px; }
.file-detail .tags { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.file-detail .tags span { font-family: var(--pixel); font-size: 7px; padding: 6px 7px; border: 2px solid rgba(255,255,255,.5); border-radius: 4px; }
.file-detail .loading { margin: auto; font-family: var(--pixel); font-size: 10px; color: var(--muted); }

/* ---------- Quest types ---------- */
.quest-type {
  position: absolute; top: 14px; left: 14px; font-family: var(--pixel); font-size: 7px; padding: 4px 6px;
  color: #f6ead0; background: #6b4423; border-radius: 3px;
}
.quest-type.qt-tac { background: #2f5fd6; }
.quest canvas.quest-mech { width: 96px; height: auto; image-rendering: pixelated; transform: scaleX(-1); }

/* ---------- Tactics board ---------- */
.tbox { width: min(1060px, 100%); height: min(660px, 100%); }
.tac { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 290px; gap: 12px; padding: 12px; background: #0b0f2a; }
.tboard-wrap { display: grid; place-items: center; min-height: 0; min-width: 0; }
.tboard {
  position: relative; width: 100%; max-height: 100%; aspect-ratio: 10 / 7;
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr);
  border: 3px solid #fff; border-radius: 6px; overflow: hidden; background: #6a8f45;
}
.tcell {
  position: relative; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.14);
}
.tcell canvas { position: relative; z-index: 0; opacity: .95; }
.t-P { background: linear-gradient(135deg, #7aa04f 0 50%, #739a49 50%); }
.t-F { background: #4d7a32; }
.t-R { background: #9a9282; }
.t-W { background: #5b5f78; cursor: not-allowed; }
.tcell::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.tcell.mv::after { background: rgba(58,134,255,.5); box-shadow: inset 0 0 0 1px rgba(170,205,255,.9); }
.tcell.threat::after { background: rgba(230,57,70,.3); }
.tcell.atk::after { background: rgba(230,57,70,.6); box-shadow: inset 0 0 0 2px #ffb3b8; animation: blink 1s steps(1) infinite; }
.tcell.heal::after { background: rgba(74,222,128,.55); box-shadow: inset 0 0 0 2px #c6ffd9; }
.tcell.sel::after { box-shadow: inset 0 0 0 3px var(--gold); }
.tcell:hover::after { outline: 2px solid rgba(255,255,255,.7); outline-offset: -3px; }
.tunit {
  position: absolute; z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  transition: left .25s ease, top .25s ease, opacity .4s;
}
.tunit::before {
  content: ""; position: absolute; bottom: 10%; left: 18%; right: 18%; height: 16%; border-radius: 50%;
  background: rgba(58,134,255,.6); box-shadow: 0 0 8px rgba(58,134,255,.8);
}
.tunit.enemy::before { background: rgba(230,57,70,.6); box-shadow: 0 0 8px rgba(230,57,70,.8); }
.tunit canvas { position: relative; width: 96%; height: auto; image-rendering: auto; filter: drop-shadow(0 2px 0 rgba(0,0,0,.45)); }
.tunit.enemy canvas { transform: scaleX(-1); }
.tunit.acted canvas { filter: grayscale(.9) brightness(.65); }
.tunit .thp { position: relative; width: 70%; height: 5px; margin: 1px 0 3px; background: #111; border: 1px solid #fff; }
.tunit .thp i { display: block; height: 100%; background: #80ffb0; transition: width .3s; }
.tunit.enemy .thp i { background: #ff6b6b; }
.tunit.lunge canvas { animation: tlunge .35s; }
@keyframes tlunge { 40% { translate: var(--dx) var(--dy); } }
.tunit.hurt canvas { animation: hit .35s; }
.tunit.dead { opacity: 0; }
.tpop { margin-left: -1em; font-size: 16px; z-index: 5; }
.tpop.crit { color: var(--gold); }
.tpop.miss { font-size: 11px; color: #cfd8ff; }
.tpop.heal { color: #80ffb0; }
.tpanel { display: flex; flex-direction: column; gap: 12px; padding: 14px; overflow: auto; font-size: 14px; }
.tp-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--pixel); font-size: 9px; }
.tp-head b { font-weight: 400; padding: 4px 6px; border-radius: 3px; }
.tp-head b.player { background: #2f5fd6; }
.tp-head b.enemy { background: var(--red); }
.tp-hint { margin: 0; color: #dfe4ff; }
.tp-unit { display: flex; gap: 12px; align-items: center; }
.tp-portrait { width: 76px; height: 68px; flex: none; display: grid; place-items: center; background: rgba(0,0,0,.3); border: 2px solid rgba(255,255,255,.4); border-radius: 6px; }
.tp-unit.enemy .tp-portrait canvas { transform: scaleX(-1); }
.tp-portrait canvas { width: 72px; image-rendering: pixelated; }
.tp-id { flex: 1; display: grid; gap: 4px; }
.tp-id b { font-family: var(--pixel); font-size: 10px; }
.tp-id small { font-family: var(--pixel); font-size: 7px; color: var(--muted); }
.tp-stats { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--pixel); font-size: 8px; }
.tp-stats span { padding: 5px 6px; background: rgba(0,0,0,.25); border-radius: 3px; }
.tp-stats b { color: var(--gold); font-weight: 400; }
.tp-terr { margin: 0; font-family: var(--pixel); font-size: 7px; color: var(--cyan); }
.tp-actions { display: grid; gap: 8px; }
.tp-fc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-fc div { display: grid; gap: 4px; padding: 8px; background: rgba(0,0,0,.28); border-radius: 4px; font-family: var(--pixel); font-size: 8px; }
.tp-fc b { font-weight: 400; color: var(--gold); font-size: 8px; }
.tp-fc .up { color: #80ffb0; font-style: normal; }
.tp-fc .down { color: #ff8a8a; font-style: normal; }
.tp-foot { margin-top: auto; display: grid; gap: 8px; font-family: var(--pixel); font-size: 7px; color: var(--muted); }
.tp-foot .btn { font-size: 10px; padding: 12px; }
.tp-tri { margin: 0; font-family: var(--pixel); font-size: 7px; line-height: 1.9; color: var(--cyan); }
.tp-tri small { color: var(--muted); }
.phase-banner {
  position: absolute; left: 0; right: 0; top: 42%; z-index: 7; pointer-events: none; opacity: 0;
  font-family: var(--sans); font-weight: 700; font-style: italic; font-size: clamp(28px, 6vw, 56px); letter-spacing: 4px;
  text-align: center; color: #fff; padding: 10px 0;
}
.phase-banner.show { animation: phase 1.15s ease-out forwards; }
.phase-banner.player { background: linear-gradient(90deg, transparent, rgba(47,95,214,.92) 20%, rgba(47,95,214,.92) 80%, transparent); }
.phase-banner.enemy { background: linear-gradient(90deg, transparent, rgba(200,30,45,.92) 20%, rgba(200,30,45,.92) 80%, transparent); }
@keyframes phase { 0% { opacity: 0; transform: translateX(-30%); } 20%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateX(30%); } }

/* ---------- Toy chest ---------- */
.chest { background: linear-gradient(180deg, #1f1530, #120c1f); }
.chest-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 22px; }
.chip {
  font-family: var(--pixel); font-size: 10px; padding: 12px 14px;
  background: linear-gradient(180deg, var(--win-top), var(--win-bot)); border: 3px solid #fff; border-radius: 6px;
  box-shadow: 0 0 0 2px #050822, 0 4px 0 2px #050822;
}
.chip:hover { color: var(--gold); }
.chip:active { transform: translateY(3px); box-shadow: 0 0 0 2px #050822; }
.chip[aria-pressed="true"] { color: var(--cyan); }
.toybox {
  position: relative; height: 460px; overflow: hidden; touch-action: none;
  border: 14px solid #5a3413; border-top-width: 20px; border-radius: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 3px, transparent 3px 90px),
    linear-gradient(180deg, #7a4a22, #5d3718);
  box-shadow:
    0 0 0 4px #ffcc4d, 0 0 0 8px #2b1606,
    inset 0 18px 30px rgba(0,0,0,.55), inset 0 -26px 0 rgba(0,0,0,.25);
}
.toy { position: absolute; left: 0; top: 0; cursor: grab; touch-action: none; will-change: transform; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); z-index: 1; }
.toy.dragging { cursor: grabbing; filter: drop-shadow(0 14px 6px rgba(0,0,0,.5)); }

/* ---------- Save point ---------- */
.savepoint {
  padding: 120px 20px 70px; text-align: center;
  background: radial-gradient(ellipse at 50% 20%, rgba(125,249,255,.18), transparent 50%), #05071a;
}
.save-crystal { position: relative; width: 180px; height: 220px; margin: 0 auto 30px; display: grid; place-items: center; }
.save-crystal .glow { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(125,249,255,.5), transparent 65%); animation: pulse 3s ease-in-out infinite; }
#saveCrystal { position: relative; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 0 16px var(--cyan)); }
.motes { position: absolute; inset: 0; pointer-events: none; }
.motes i { position: absolute; bottom: 10%; width: 4px; height: 4px; background: #fff; box-shadow: 0 0 6px var(--cyan); animation: rise var(--d) linear infinite; animation-delay: var(--delay); opacity: 0; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-200px); opacity: 0; } }
.save-window { max-width: 460px; margin: 0 auto; text-align: left; }
.save-window p { margin: 0 0 12px; font-size: 17px; min-height: 2.8em; }
.save-actions { position: relative; display: flex; gap: 56px; padding-left: 40px; }
.credits { margin-top: 70px; font-family: var(--pixel); font-size: 10px; line-height: 2.4; }
.credits-site { color: var(--gold); font-size: 13px; }
.credits a { text-decoration: none; }
.credits .small { font-family: var(--sans); font-size: 13px; line-height: 1.5; max-width: 420px; margin: 18px auto 0; }

/* ---------- Battle pop-up ---------- */
.battle {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 8, 34, .72); backdrop-filter: blur(4px); font-family: var(--sans);
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.battle[hidden] { display: none; }
.battle-box {
  position: relative; display: flex; flex-direction: column; width: min(940px, 100%); height: min(620px, 100%);
  overflow: hidden; background: #000; border: 3px solid #fff; border-radius: 10px;
  box-shadow: 0 0 0 3px #050822, 0 30px 80px rgba(0,0,0,.7);
  animation: pop .35s cubic-bezier(.3, 1.5, .5, 1);
}
.battle-bar {
  position: relative; z-index: 9; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 8px 16px; font-family: var(--pixel); font-size: 10px; color: var(--gold);
  background: linear-gradient(180deg, var(--win-top), var(--win-bot)); border-bottom: 3px solid #fff;
}
.battle-close {
  width: 34px; height: 30px; font-family: var(--pixel); font-size: 12px; color: #fff;
  background: var(--red); border: 2px solid #fff; border-radius: 4px;
}
.battle-close:hover { filter: brightness(1.2); }
.battle-swirl {
  position: absolute; inset: -50%; z-index: 5; pointer-events: none;
  background: repeating-conic-gradient(#fff 0 10deg, #000 10deg 20deg);
  animation: swirl .9s ease-in forwards;
}
@keyframes swirl {
  0% { transform: rotate(0) scale(.1); opacity: 0; }
  30% { opacity: 1; }
  80% { transform: rotate(540deg) scale(1.4); opacity: 1; }
  100% { transform: rotate(720deg) scale(3); opacity: 0; }
}
.arena {
  position: relative; flex: 1; overflow: hidden; min-height: 0;
  background: var(--arena, linear-gradient(180deg, #5ba3ff 0%, #bde0fe 45%, #6a994e 45.2%, #386641));
}
.arena::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 55%;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 60px);
  transform: perspective(300px) rotateX(55deg); transform-origin: bottom; pointer-events: none;
}
.ability {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 4;
  font-family: var(--pixel); font-size: 12px; white-space: nowrap;
  background: linear-gradient(180deg, var(--win-top), var(--win-bot)); border: 3px solid #fff; border-radius: 6px;
  padding: 12px 22px; opacity: 0; transition: opacity .15s;
}
.ability.show { opacity: 1; }
.foe { position: absolute; left: 12%; bottom: 18%; z-index: 2; transition: filter .2s, opacity .6s, transform .6s; }
.foe canvas { display: block; filter: drop-shadow(0 12px 0 rgba(0,0,0,.25)); }
.foe.down { transform: rotate(-12deg) translateY(20px); }
.foe.down::after {
  content: "DOWN"; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-family: var(--pixel); font-size: 12px; color: #fff; background: var(--red); padding: 6px 8px;
  animation: blink .6s steps(1) infinite;
}
.foe.dead { opacity: 0; transform: scale(1.2); filter: brightness(3) saturate(0); }
.foe.hit, .member.hit { animation: hit .35s; }
@keyframes hit { 20% { transform: translateX(-10px); filter: brightness(3); } 40% { transform: translateX(10px); } 60% { transform: translateX(-6px); filter: brightness(2); } }
.foe.attacking { animation: lunge .5s; }
@keyframes lunge { 40% { transform: translateX(60px) scale(1.08); } }
.party { position: absolute; right: 10%; bottom: 14%; z-index: 2; display: grid; gap: 14px; }
.member { position: relative; transition: transform .2s, filter .3s; }
.member:nth-child(1) { transform: translateX(-30px); }
.member:nth-child(3) { transform: translateX(30px); }
.member.ready { transform: translateX(-60px); }
.member.ready::before {
  content: ""; position: absolute; left: 50%; top: -18px; margin-left: -6px;
  border: 6px solid transparent; border-top: 10px solid var(--gold); animation: bob .6s infinite;
}
.member.ko { filter: grayscale(1) brightness(.6); transform: rotate(90deg) translateY(-10px); }
.member.acting { animation: step .5s; }
@keyframes step { 40% { transform: translateX(-100px); } }
.dmg {
  position: absolute; z-index: 6; pointer-events: none; font-family: var(--pixel); font-size: 22px;
  color: #fff; text-shadow: 3px 3px 0 #000, -1px -1px 0 #000; animation: dmg 1s ease-out forwards;
}
.dmg.heal { color: #80ffb0; }
.dmg.tag { font-size: 14px; color: var(--gold); padding: 6px 8px; background: #000; text-shadow: none; }
.dmg.weak { color: #fff; background: var(--red); font-size: 14px; padding: 6px 8px; text-shadow: none; transform: skewX(-10deg); }
@keyframes dmg { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { transform: translateY(-24px) scale(1.2); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-50px); opacity: 0; } }
.summon { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; }
.summon.go { display: block; background: radial-gradient(circle at 30% 60%, rgba(255,255,255,.7), transparent 40%); animation: flash 1.6s; }
.summon .punit { transform: scaleX(-1); }
.summon .mech-wrap { position: absolute; width: 220px; right: -260px; bottom: 30%; animation: fly-in 1.6s cubic-bezier(.3, .8, .4, 1) forwards; }
@keyframes fly-in { 0% { right: -260px; transform: rotate(-15deg); } 40% { right: 45%; transform: rotate(-8deg); } 70% { right: 50%; } 100% { right: 130%; transform: rotate(-20deg); } }
@keyframes flash { 0%, 100% { background-color: transparent; } 45% { background-color: rgba(255,255,255,.6); } }

.battle-ui {
  position: relative; display: grid; grid-template-columns: 1fr 1.7fr; gap: 12px; padding: 12px;
  background: #050822; border-top: 3px solid #fff; font-size: 15px; min-height: 210px;
}
.battle-ui .window { padding: 14px 16px; }
.battle-ui .commands { padding: 12px 16px 12px 46px; }
.foe-list { font-family: var(--pixel); font-size: 11px; line-height: 2; }
.foe-list .hpbar { margin-top: 6px; }
.party-list { display: grid; gap: 8px; }
.prow { display: grid; grid-template-columns: 1.2fr 1.5fr .8fr 1.3fr; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 10px; padding: 4px 6px; border-radius: 4px; }
.prow.ready { background: rgba(255,209,102,.18); }
.prow.ko { color: var(--red); }
.prow small { font-size: 7px; color: var(--muted); display: block; margin-top: 4px; }
.hpbar { height: 8px; background: #050822; border: 2px solid #fff; }
.hpbar i { display: block; height: 100%; background: #80ffb0; transition: width .3s; }
.hpbar.low i { background: var(--gold); }
.atb { height: 10px; background: #050822; border: 2px solid #fff; }
.atb i { display: block; height: 100%; background: linear-gradient(90deg, #3a86ff, var(--cyan)); }
.atb.full i { background: var(--gold); animation: blink .5s steps(1) infinite; }
.commands {
  position: absolute; left: 12px; bottom: 12px; top: 12px; width: calc((100% - 36px) / 2.7);
  display: flex; flex-direction: column; gap: 2px; padding: 12px 16px 12px 44px; z-index: 2; overflow: auto;
}
.commands[hidden] { display: none; }
.commands .who { font-family: var(--pixel); font-size: 8px; color: var(--cyan); margin-bottom: 6px; }
.commands .menu-item { font-size: 11px; padding: 5px 2px; }
.commands .menu-item:disabled { color: rgba(255,255,255,.35); cursor: default; }
.commands .menu-item.special { color: #fff; background: var(--red); padding: 8px; margin-top: 4px; transform: skewX(-8deg); animation: blink 1s steps(1) infinite; }
.aoa {
  position: absolute; inset: 0; z-index: 7; display: none; flex-direction: column; justify-content: center; align-items: center;
  background: linear-gradient(160deg, #d0021b 0 45%, #000 45.2% 60%, #d0021b 60.2%);
  font-family: var(--sans); font-weight: 700; font-style: italic; color: #fff; pointer-events: none;
}
.aoa.go { display: flex; animation: aoa 1.3s ease-out forwards; }
.aoa span { font-size: clamp(40px, 10vw, 120px); line-height: .95; text-shadow: 8px 8px 0 #000; transform: skewX(-12deg); }
.aoa span:last-child { color: #000; background: #fff; padding: 0 .2em; text-shadow: none; }
@keyframes aoa { 0% { clip-path: polygon(0 45%, 100% 40%, 100% 40%, 0 45%); } 20%, 80% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); } 100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); opacity: 0; } }
.result {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(0,0,0,.55);
}
.result[hidden] { display: none; }
.result .window { min-width: min(420px, 92vw); text-align: center; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
.result h3 { font-size: 20px; margin-bottom: 18px; }
.result p { margin: 6px 0; font-family: var(--pixel); font-size: 10px; line-height: 1.8; }
.result .btn { margin-top: 18px; flex: none; padding: 14px 22px; }
.result .row { display: flex; gap: 10px; justify-content: center; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- Toast + rain ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 400; transform: translate(-50%, 160%);
  font-family: var(--pixel); font-size: 11px; padding: 14px 20px; text-align: center;
  background: linear-gradient(180deg, var(--win-top), var(--win-bot)); border: 3px solid #fff; border-radius: 6px;
  box-shadow: 0 0 0 3px #050822; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1);
  max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); }
.rain { position: fixed; inset: 0; pointer-events: none; z-index: 350; overflow: hidden; }
.rain canvas { position: absolute; top: -60px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(calc(100vh + 120px)) rotate(540deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .title-grid { grid-template-columns: 1fr; text-align: center; padding-top: 24px; gap: 10px; }
  .title-right { order: -1; min-height: 320px; }
  .hero-mech { width: 220px; }
  .menu { text-align: left; }
  .hangar-grid, .board, .status-grid, .files-grid { grid-template-columns: 1fr; }
  .status-tabs.menu { position: static; flex-direction: row; flex-wrap: wrap; padding: 10px 12px 10px 40px; gap: 0 6px; }
  .sk-grid { grid-template-columns: 1fr; }
  .tac { grid-template-columns: 1fr; overflow: auto; }
  .tboard-wrap { display: block; }
  .tpanel { overflow: visible; }
  .file-detail { position: static; min-height: 0; }
  .bay { min-height: 460px; }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .hud { gap: 10px; padding: 8px 16px; font-size: 8px; }
  .exp-bar, .hud-name { display: none; }
  .hud-nav { gap: 10px; }
  .chapter { padding: 80px 16px; }
  .status-panel { padding: 18px 16px; }
  .st-top { flex-direction: column; align-items: flex-start; }
  .st-stats { grid-template-columns: 1fr; }
  .journey::before, .journey li::before { display: none; }
  .journey li { grid-template-columns: 1fr; gap: 4px; }
  .battle { padding: 8px; }
  .toybox { height: 380px; border-width: 10px; }
  .battle-ui { grid-template-columns: 1fr; }
  .foe-list { display: none; }
  .commands { width: auto; right: 12px; }
  .prow { grid-template-columns: 1fr 1.2fr 1fr; font-size: 8px; }
  .prow .mpcol { display: none; }
  .foe { left: 4%; }
  .party { right: 4%; }
  .ability { font-size: 9px; }
}
@media (max-width: 460px) {
  .hud-nav a { font-size: 7px; }
  .hud-btn { display: none; }
  .menu { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Battle effects ---------- */
.spell {
  position: absolute; z-index: 4; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, #fff 0, var(--sc) 30%, transparent 70%);
  animation: burst .6s ease-out forwards;
}
@keyframes burst { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.slash {
  position: absolute; z-index: 4; width: 200px; height: 6px; margin: -3px 0 0 -100px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #fff 40%, #fff 60%, transparent);
  box-shadow: 0 0 12px #fff; transform: rotate(-35deg) scaleX(0);
  animation: slash .35s ease-out forwards;
}
@keyframes slash { 50% { transform: rotate(-35deg) scaleX(1); opacity: 1; } 100% { transform: rotate(-35deg) scaleX(1.2); opacity: 0; } }
.weak-line { font-size: 9px; color: var(--muted); margin-top: 8px; }
