/* ============================================================
   星落之誓 · STARFALL OATH
   style.css — 视觉系统与全部界面
   ============================================================ */

/* ---------- 0. Reset & tokens ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: "Inter", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;

  --bg: #070a11;
  --bg-2: #0a101a;
  --bg-3: #0d1622;
  --panel: rgba(13, 21, 33, .82);
  --panel-solid: #0d1622;
  --panel-light: rgba(26, 38, 55, .64);
  --ink: #f4eddd;
  --ink-dim: #d6cdbb;
  --muted: #96a1b4;
  --faint: #677386;
  --line: rgba(232, 194, 124, .17);
  --line-strong: rgba(232, 194, 124, .38);
  --gold: #e8c27c;
  --gold-soft: #f6e5bb;
  --gold-deep: #9c773b;
  --coral: #ff766b;
  --coral-deep: #be4f4d;
  --teal: #54d8bd;
  --violet: #b78bff;
  --danger: #ff6f61;
  --shadow: 0 34px 80px rgba(0, 0, 0, .48);
  --ease: cubic-bezier(.22, .8, .2, 1);
  --ease-spring: cubic-bezier(.2, 1.3, .35, 1);
  --header-h: 70px;
  --radius: 18px;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 72% -10%, rgba(64, 110, 125, .14), transparent 34%),
    radial-gradient(circle at 4% 84%, rgba(123, 68, 109, .10), transparent 32%),
    var(--bg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.mode-story,
body.mode-battle { overflow: hidden; }
body.mode-result { overflow-y: auto; }
body.mode-title { overflow: hidden; }

button,
input,
select,
textarea { font: inherit; }
button { color: inherit; }
button:not(:disabled) { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; }
::selection { background: rgba(232, 194, 124, .28); color: #fff; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ambient-grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: .045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(232, 194, 124, .055), transparent 63%);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity .35s ease;
  will-change: transform;
}
@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cursor-glow { opacity: 1; }
}

.screen-reader-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.noscript {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.4rem;
}

/* ---------- 1. Typography / shared ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.eyebrow span {
  display: block;
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.eyebrow::after { content: ""; display: block; width: 4px; height: 4px; border: 1px solid var(--gold); transform: rotate(45deg); opacity: .7; }

.panel-kicker {
  display: block;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .82;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(150deg, rgba(255, 255, 255, .045), transparent 36%),
    linear-gradient(180deg, rgba(16, 25, 38, .9), rgba(8, 13, 21, .88));
  box-shadow: 0 20px 60px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(16px);
}
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  opacity: .7;
}
.panel::before {
  left: -1px;
  top: -1px;
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  border-top-left-radius: var(--radius);
}
.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  border-bottom-right-radius: var(--radius);
}

.ico {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- 2. Buttons ---------- */
.btn {
  --btn-bg: rgba(255, 255, 255, .04);
  --btn-border: rgba(255, 255, 255, .14);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--btn-border);
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  overflow: hidden;
  transition: border-color .25s ease, background .25s ease, color .25s ease, transform .25s var(--ease);
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .22), transparent 68%);
  transform: translateX(-130%);
  transition: transform .55s var(--ease);
}
.btn:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .07); transform: translateY(-1px); }
.btn:hover::after { transform: translateX(130%); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .38; cursor: not-allowed; filter: grayscale(.5); }
.btn:disabled::after { display: none; }

.btn--primary {
  --btn-bg: linear-gradient(100deg, #e5ba6f, #f4dda0 55%, #d6a45b);
  --btn-border: rgba(255, 236, 190, .5);
  color: #1d160c;
  background: linear-gradient(100deg, #e5ba6f, #f4dda0 55%, #d6a45b);
  box-shadow: 0 8px 28px rgba(220, 171, 93, .2), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn--primary:hover { color: #130e07; background: linear-gradient(100deg, #f0c980, #fff0bb 55%, #e3b56b); box-shadow: 0 12px 36px rgba(220, 171, 93, .28); }

.btn--ghost {
  background: rgba(7, 11, 18, .34);
  border-color: rgba(255, 255, 255, .2);
}
.btn--ghost:hover { border-color: var(--gold); color: var(--gold-soft); }

.btn--line {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--gold-soft);
  letter-spacing: .08em;
}
.btn--line:hover { background: rgba(232, 194, 124, .08); }
.btn--soft {
  background: rgba(84, 216, 189, .08);
  border-color: rgba(84, 216, 189, .32);
  color: #b7f7e9;
}
.btn--soft:hover { background: rgba(84, 216, 189, .14); border-color: rgba(84, 216, 189, .6); }
.btn--full { width: 100%; }
.btn--large { min-height: 58px; padding: 13px 28px; font-size: 14px; }
.btn--large span { letter-spacing: .14em; }
.btn--large small {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
  opacity: .55;
}
.btn--primary small { opacity: .48; }
.btn-arrow { margin-left: auto; font-size: 17px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: .22s ease;
}
.icon-btn:hover { color: var(--gold); border-color: var(--line-strong); background: rgba(232, 194, 124, .07); }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  transition: .2s ease;
}
.text-btn:hover { color: var(--gold); border-bottom-color: rgba(232, 194, 124, .4); }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .06em;
  transition: color .2s ease;
}
.back-btn:hover { color: var(--gold); }

/* ---------- 3. Header ---------- */
.game-header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 34px;
  height: var(--header-h);
  padding: 0 clamp(18px, 3vw, 46px);
  border-bottom: 1px solid rgba(232, 194, 124, .12);
  background: rgba(7, 11, 18, .76);
  backdrop-filter: blur(20px) saturate(1.2);
  transition: transform .4s var(--ease), opacity .3s ease;
}
.game-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 194, 124, .34), transparent);
}
.game-header.is-hidden { transform: translateY(-102%); opacity: 0; pointer-events: none; }
body.mode-title .game-header,
body.mode-story .game-header,
body.mode-battle .game-header,
body.mode-result .game-header { transform: translateY(-102%); opacity: 0; pointer-events: none; }

.game-brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand-sigil {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(232, 194, 124, .5);
  color: var(--gold);
  font-size: 14px;
  transform: rotate(45deg);
  transition: .4s var(--ease);
}
.brand-sigil::before { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(232, 194, 124, .2); }
.brand-sigil { text-shadow: 0 0 8px rgba(232, 194, 124, .5); }
.game-brand:hover .brand-sigil { transform: rotate(225deg); border-color: var(--gold); }
.brand-word { display: flex; flex-direction: column; line-height: 1.15; }
.brand-word b { font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: .13em; }
.brand-word small { margin-top: 3px; color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: .2em; }

.header-chapter {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 28px;
  border-left: 1px solid rgba(255, 255, 255, .09);
  white-space: nowrap;
}
.header-chapter span { color: var(--faint); font-family: var(--font-mono); font-size: 8px; letter-spacing: .16em; }
.header-chapter b { color: var(--ink-dim); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .12em; }

.header-resources { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.resource-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid rgba(232, 194, 124, .2);
  border-radius: 2px;
  background: rgba(232, 194, 124, .055);
  white-space: nowrap;
}
.resource-chip--ghost { border-color: rgba(255, 255, 255, .09); background: rgba(255, 255, 255, .02); }
.resource-icon { color: var(--gold); font-size: 10px; }
.resource-label { color: var(--faint); font-size: 9px; letter-spacing: .1em; }
.resource-chip b { color: var(--gold-soft); font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; }
.resource-chip--ghost b { color: var(--ink-dim); }

.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  position: relative;
  padding: 8px 13px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .1em;
  transition: color .2s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 1px;
  background: var(--gold);
  transform: translateX(-50%);
  transition: width .25s var(--ease);
}
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after, .nav-link:hover::after { width: 22px; }
.header-nav .icon-btn { margin-left: 8px; }

/* ---------- 4. Title screen ---------- */
.game-main { position: relative; z-index: 2; }

.screen { display: none; }
.screen.is-active { display: block; animation: screenIn .55s var(--ease) both; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.title-screen {
  position: relative;
  display: none;
  min-height: 100svh;
  overflow: hidden;
  background: #05080e;
}
.title-screen.is-active { display: block; }

.title-atmosphere { position: absolute; inset: 0; pointer-events: none; }
.title-nebula {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 40% 45% at 70% 25%, rgba(57, 133, 132, .24), transparent 65%),
    radial-gradient(ellipse 30% 50% at 20% 65%, rgba(110, 65, 107, .18), transparent 70%),
    radial-gradient(ellipse 60% 30% at 55% 105%, rgba(183, 139, 255, .09), transparent 65%);
  filter: blur(30px);
  animation: nebulaBreathe 16s ease-in-out infinite alternate;
}
@keyframes nebulaBreathe {
  from { transform: scale(1) translate3d(0, 0, 0); opacity: .8; }
  to { transform: scale(1.06) translate3d(-1.5%, 1%, 0); opacity: 1; }
}
.title-stars { position: absolute; inset: 0; }
.title-stars .star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff6db;
  box-shadow: 0 0 6px rgba(255, 240, 199, .7);
  animation: twinkle var(--dur, 5s) ease-in-out infinite var(--delay, 0s);
}
.title-stars .star.is-big { width: 3px; height: 3px; box-shadow: 0 0 12px rgba(255, 240, 199, .95); }
@keyframes twinkle {
  0%, 100% { opacity: .15; transform: scale(.7); }
  50% { opacity: 1; transform: scale(1.25); }
}
.title-moon {
  position: absolute;
  top: 13vh;
  right: 16vw;
  width: clamp(180px, 22vw, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 35%, #fffdf1 0 28%, #e5f2dd 55%, #b7d9cb 78%, #8fbdb4 100%);
  box-shadow:
    0 0 60px rgba(189, 244, 221, .25),
    0 0 150px rgba(124, 220, 195, .18),
    0 0 300px rgba(84, 216, 189, .08);
  opacity: .9;
}
.title-moon::before,
.title-moon::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(89, 130, 121, .14);
  filter: blur(2px);
}
.title-moon::before { width: 18%; height: 12%; left: 23%; top: 31%; }
.title-moon::after { width: 11%; height: 9%; right: 24%; bottom: 27%; }
.title-moon {
  animation: moonFloat 12s ease-in-out infinite alternate;
}
@keyframes moonFloat {
  from { transform: translateY(0); }
  to { transform: translateY(-12px); }
}
.title-ridge {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 0;
  background: #06100f;
}
.title-ridge--far {
  height: 48vh;
  clip-path: polygon(0 58%, 7% 42%, 15% 51%, 22% 31%, 30% 48%, 38% 29%, 47% 52%, 57% 37%, 66% 55%, 73% 33%, 82% 51%, 91% 38%, 100% 56%, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #112b2b, #0b1d1d 70%);
  opacity: .82;
}
.title-ridge--near {
  height: 31vh;
  clip-path: polygon(0 44%, 8% 36%, 17% 50%, 27% 37%, 39% 55%, 48% 40%, 57% 54%, 68% 38%, 78% 52%, 88% 40%, 100% 54%, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #071412, #030807);
}
.title-spire {
  position: absolute;
  bottom: 8vh;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(84, 216, 189, .45));
  box-shadow: 0 0 14px rgba(84, 216, 189, .22);
}
.title-spire::before,
.title-spire::after {
  content: "";
  position: absolute;
  left: 50%;
  border: 1px solid rgba(84, 216, 189, .3);
  transform: translateX(-50%) rotate(45deg);
}
.title-spire::before { top: 22%; width: 10px; height: 10px; }
.title-spire::after { top: 12%; width: 22px; height: 22px; opacity: .4; }
.title-spire--one { left: 7%; height: 33vh; }
.title-spire--two { right: 6%; height: 25vh; opacity: .65; }
.title-fireflies { position: absolute; inset: 0; }

.title-layout {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(420px, .98fr);
  align-items: center;
  gap: 2vw;
  max-width: 1560px;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(var(--header-h) + 4vh) clamp(26px, 5vw, 88px) 10vh;
}
.title-copy { position: relative; z-index: 3; max-width: 640px; }
.game-logo {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 22px 0 18px;
  line-height: .92;
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, .55));
}
.logo-cn {
  font-family: var(--font-display);
  font-size: clamp(68px, 9.5vw, 146px);
  font-weight: 700;
  letter-spacing: -.06em;
  background: linear-gradient(168deg, #fff9e9 8%, #f5dfb0 34%, #e5b96d 66%, #a77d3d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 70px rgba(232, 194, 124, .12);
}
.logo-cn em {
  position: relative;
  font-style: normal;
  color: transparent;
  background: linear-gradient(168deg, #ffd6ca 4%, #ff8a79 38%, #d95551 80%);
  -webkit-background-clip: text;
  background-clip: text;
}
.logo-cn em::after {
  content: "";
  position: absolute;
  left: 58%;
  top: 2%;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 118, 107, .7);
  transform: rotate(45deg);
}
.logo-en {
  margin-top: 18px;
  color: rgba(232, 194, 124, .58);
  font-family: var(--font-mono);
  font-size: clamp(9px, .9vw, 12px);
  font-weight: 500;
  letter-spacing: .58em;
  padding-left: 5px;
}
.title-lead {
  margin-top: 24px;
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: clamp(16px, 1.45vw, 22px);
  line-height: 1.9;
  letter-spacing: .12em;
}
.title-sub {
  margin-top: 10px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .18em;
}
.title-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 38px; }
.title-actions .btn { min-width: 174px; }
#btnContinue:disabled { opacity: .25; cursor: not-allowed; }
.title-signature { display: flex; align-items: center; gap: 13px; margin-top: 44px; color: var(--faint); font-size: 10px; letter-spacing: .18em; }
.sig-line { width: 34px; height: 1px; background: rgba(232, 194, 124, .25); }

.title-cast {
  position: relative;
  align-self: stretch;
  min-height: 58vh;
}
.cast-halo {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(40vw, 590px);
  aspect-ratio: 1;
  border: 1px solid rgba(232, 194, 124, .16);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 80px rgba(84, 216, 189, .05);
}
.cast-halo::before,
.cast-halo::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(232, 194, 124, .1);
}
.cast-halo::before { inset: 8%; animation: haloSpin 60s linear infinite; }
.cast-halo::after { inset: 20%; border-style: solid; border-color: rgba(84, 216, 189, .07); }
@keyframes haloSpin { to { transform: rotate(360deg); } }
.cast-figure {
  position: absolute;
  bottom: 4vh;
  filter: drop-shadow(0 28px 40px rgba(0, 0, 0, .55));
  transition: transform .6s var(--ease), filter .6s ease;
}
.cast-figure .unit-art { width: 100%; height: 100%; overflow: visible; }
.cast-figure--ren {
  left: 30%;
  z-index: 4;
  width: clamp(210px, 22vw, 350px);
  height: 58vh;
  transform: translateX(-50%);
  filter: drop-shadow(0 0 38px rgba(84, 216, 189, .18)) drop-shadow(0 30px 44px rgba(0, 0, 0, .6));
}
.cast-figure--mia {
  left: 11%;
  z-index: 3;
  width: clamp(170px, 18vw, 286px);
  height: 47vh;
  opacity: .92;
  transform: translateX(-50%) rotate(-2deg);
}
.cast-figure--serena {
  right: 5%;
  z-index: 5;
  width: clamp(190px, 20vw, 320px);
  height: 55vh;
  transform: translateX(0);
  filter: drop-shadow(0 0 34px rgba(232, 194, 124, .14)) drop-shadow(0 30px 44px rgba(0, 0, 0, .6));
}
.cast-figure--ren .unit-art { animation: castFloat 7s ease-in-out infinite; }
.cast-figure--mia .unit-art { animation: castFloat 8s ease-in-out infinite .8s; }
.cast-figure--serena .unit-art { animation: castFloat 7.5s ease-in-out infinite .35s; }
@keyframes castFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.title-cast:hover .cast-figure--ren { transform: translateX(-50%) translateY(-5px) scale(1.01); }
.title-cast:hover .cast-figure--mia { transform: translateX(-50%) rotate(-4deg) translateY(-3px); }
.title-cast:hover .cast-figure--serena { transform: translateY(-4px) scale(1.01); }
.cast-plinth {
  position: absolute;
  left: 50%;
  bottom: 2.5vh;
  width: 78%;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(232, 194, 124, .42), transparent);
  box-shadow: 0 0 26px rgba(232, 194, 124, .18);
}
.cast-plinth::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 60%;
  height: 38px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(232, 194, 124, .12), transparent 70%);
}
.cast-caption {
  position: absolute;
  left: 50%;
  bottom: -2.4vh;
  display: flex;
  gap: 20px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.cast-caption span { color: var(--faint); font-size: 8px; letter-spacing: .1em; }
.cast-caption i { color: var(--gold); font-family: var(--font-mono); font-style: normal; margin-right: 4px; }

.title-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(26px, 5vw, 88px) 24px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .14em;
}
.title-footer__left,
.title-footer__right { display: flex; align-items: center; gap: 14px; }
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.build-tag { color: rgba(232, 194, 124, .4); }
.title-footer .text-btn { font-family: var(--font-mono); font-size: 8px; letter-spacing: .14em; }

/* ---------- 5. Story ---------- */
.story-screen { display: none; min-height: 100svh; background: #03070a; }
.story-screen.is-active { display: block; }
.story-stage {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: #03070a;
  --bd-sky-a: #06141b;
  --bd-sky-b: #10383a;
  --bd-sky-c: #2e695e;
  --bd-moon: #d6fff1;
  --bd-far: #102f31;
  --bd-mid: #09211f;
  --bd-near: #030e0d;
  --bd-ground: #04100d;
  --bd-water: #123c43;
  --bd-glow: #62e8c7;
  --bd-vignette: #020708;
  cursor: pointer;
}
.story-stage[data-scene="forest-edge"] {
  --bd-sky-a: #06141b; --bd-sky-b: #10383a; --bd-sky-c: #2e695e;
  --bd-moon: #d6fff1; --bd-far: #102f31; --bd-mid: #09211f; --bd-near: #030e0d;
  --bd-ground: #04100d; --bd-glow: #62e8c7; --bd-vignette: #020708;
}
.story-stage[data-scene="fireflies"] {
  --bd-sky-a: #07120f; --bd-sky-b: #14392b; --bd-sky-c: #336b4d;
  --bd-moon: #f1ffc9; --bd-far: #12352a; --bd-mid: #0a251a; --bd-near: #03110c;
  --bd-ground: #04100a; --bd-glow: #d7f36e; --bd-vignette: #030906;
}
.story-stage[data-scene="ford"] {
  --bd-sky-a: #061321; --bd-sky-b: #173e52; --bd-sky-c: #3f7880;
  --bd-moon: #d9f5ff; --bd-far: #153847; --bd-mid: #0b2633; --bd-near: #041119;
  --bd-ground: #06131a; --bd-water: #1d5369; --bd-glow: #7bd9ff; --bd-vignette: #02070c;
}
.story-stage[data-scene="grove"] {
  --bd-sky-a: #0d0a1a; --bd-sky-b: #2b2445; --bd-sky-c: #55476b;
  --bd-moon: #decfff; --bd-far: #29243b; --bd-mid: #171528; --bd-near: #080712;
  --bd-ground: #0a0912; --bd-glow: #a98cff; --bd-vignette: #05040a;
}
.story-stage[data-scene="camp"] {
  --bd-sky-a: #100c12; --bd-sky-b: #3b2730; --bd-sky-c: #6d4938;
  --bd-moon: #ffd49c; --bd-far: #2c2325; --bd-mid: #1e1718; --bd-near: #0b0909;
  --bd-ground: #100b08; --bd-glow: #ff9a57; --bd-vignette: #0a0605;
}
.story-stage[data-scene="mist"] {
  --bd-sky-a: #0a1118; --bd-sky-b: #27353f; --bd-sky-c: #526269;
  --bd-moon: #e7f4f4; --bd-far: #26343c; --bd-mid: #151f27; --bd-near: #080d12;
  --bd-ground: #081015; --bd-glow: #b9d5d9; --bd-vignette: #04090c;
}
.story-stage[data-scene="bridge"] {
  --bd-sky-a: #07101c; --bd-sky-b: #182b45; --bd-sky-c: #3c5368;
  --bd-moon: #e2f2ff; --bd-far: #17293b; --bd-mid: #0d1a29; --bd-near: #050c14;
  --bd-ground: #071019; --bd-glow: #7fc8ff; --bd-vignette: #02060b;
}
.story-stage[data-scene="spring"] {
  --bd-sky-a: #091020; --bd-sky-b: #26365e; --bd-sky-c: #5e6e93;
  --bd-moon: #ecf2ff; --bd-far: #28344e; --bd-mid: #151f33; --bd-near: #080d17;
  --bd-ground: #09101c; --bd-water: #2d3f69; --bd-glow: #b4cbff; --bd-vignette: #030711;
}
.story-stage[data-scene="ruins"] {
  --bd-sky-a: #0c0c1b; --bd-sky-b: #28264a; --bd-sky-c: #4d476d;
  --bd-moon: #e0d8ff; --bd-far: #2b2947; --bd-mid: #19162d; --bd-near: #090712;
  --bd-ground: #0b0915; --bd-glow: #c6a8ff; --bd-vignette: #05040a;
}
.story-stage[data-scene="altar"] {
  --bd-sky-a: #0e0710; --bd-sky-b: #321329; --bd-sky-c: #5c2632;
  --bd-moon: #ffc7bb; --bd-far: #341b2b; --bd-mid: #20101c; --bd-near: #0d070b;
  --bd-ground: #0e0609; --bd-glow: #ff7c88; --bd-vignette: #080306;
}
.story-stage[data-scene="altar-dawn"] {
  --bd-sky-a: #1c1a31; --bd-sky-b: #6b5166; --bd-sky-c: #d39782;
  --bd-moon: #fff0c9; --bd-far: #574366; --bd-mid: #362b42; --bd-near: #18111f;
  --bd-ground: #19111a; --bd-glow: #ffdda1; --bd-vignette: #0b0810;
}

.story-backdrop { position: absolute; inset: -2%; }
.story-backdrop svg { width: 100%; height: 100%; }
.story-backdrop { animation: storyPan 28s ease-in-out infinite alternate; }
@keyframes storyPan {
  from { transform: scale(1.015) translateX(-.6%); }
  to { transform: scale(1.06) translateX(.8%); }
}
.story-backdrop .bd-firefly { animation: fireflyFloat 4.5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes fireflyFloat {
  from { opacity: .18; transform: translateY(0) scale(.8); }
  to { opacity: .95; transform: translateY(-14px) scale(1.2); }
}
.story-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 4, 8, .45) 0%, transparent 22%, transparent 62%, rgba(2, 4, 8, .82) 100%),
    radial-gradient(ellipse at 50% 62%, transparent 24%, rgba(2, 4, 8, .42) 100%);
  pointer-events: none;
}
.story-particles { position: absolute; inset: 0; pointer-events: none; }
.story-particles .particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--bd-glow);
  box-shadow: 0 0 10px var(--bd-glow);
  opacity: .4;
  animation: particleRise var(--dur, 9s) linear infinite var(--delay, 0s);
}
@keyframes particleRise {
  from { transform: translateY(10vh) scale(.4); opacity: 0; }
  20% { opacity: .7; }
  80% { opacity: .5; }
  to { transform: translateY(-80vh) scale(1.2); opacity: 0; }
}
.story-stage[data-scene="mist"] .story-veil {
  background:
    linear-gradient(180deg, rgba(200, 220, 225, .05), transparent 22%, transparent 58%, rgba(2, 6, 9, .88)),
    radial-gradient(ellipse at 50% 70%, transparent 18%, rgba(2, 6, 9, .5) 100%);
}
.story-stage[data-scene="mist"]::after,
.story-stage[data-scene="mist"]::before {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  height: 24vh;
  background: linear-gradient(90deg, transparent, rgba(190, 215, 220, .09), transparent);
  filter: blur(22px);
  animation: mistDrift 24s linear infinite alternate;
  pointer-events: none;
}
.story-stage[data-scene="mist"]::after { bottom: 18vh; }
.story-stage[data-scene="mist"]::before { bottom: 42vh; animation-duration: 31s; animation-direction: alternate-reverse; opacity: .6; }
@keyframes mistDrift {
  from { transform: translateX(-8%); }
  to { transform: translateX(8%); }
}
.story-stage[data-scene="camp"] .story-veil {
  background:
    linear-gradient(180deg, rgba(10, 5, 5, .35), transparent 28%, transparent 64%, rgba(8, 4, 3, .86)),
    radial-gradient(ellipse at 78% 58%, rgba(255, 148, 76, .12), transparent 28%),
    radial-gradient(ellipse at 50% 60%, transparent 26%, rgba(8, 4, 3, .4));
}

.story-cast { position: absolute; inset: 0 0 11vh; z-index: 4; pointer-events: none; }
.story-actor {
  position: absolute;
  bottom: -2vh;
  width: clamp(170px, 21vw, 330px);
  height: 62vh;
  transform: translateX(-50%);
  opacity: .48;
  filter: saturate(.55) brightness(.62) drop-shadow(0 22px 34px rgba(0, 0, 0, .55));
  transition: opacity .55s ease, filter .55s ease, transform .65s var(--ease);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.story-actor .story-sprite { width: 100%; height: 100%; overflow: visible; }
.story-actor.is-speaking {
  opacity: 1;
  filter: saturate(1.05) brightness(1) drop-shadow(0 0 30px rgba(232, 194, 124, .08)) drop-shadow(0 24px 36px rgba(0, 0, 0, .6));
  transform: translateX(-50%) translateY(-1.8vh) scale(1.025);
  z-index: 6;
}
.story-actor.is-narrator { opacity: .34; filter: saturate(.45) brightness(.55) drop-shadow(0 22px 34px rgba(0, 0, 0, .5)); }
.story-actor.is-npc { width: clamp(180px, 24vw, 370px); height: 67vh; }
.story-actor .actor-shadow {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 70%;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, .5);
  filter: blur(8px);
}
.story-actor .npc-aura {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 90%;
  height: 65%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, var(--npc-glow, rgba(183, 139, 255, .18)), transparent 65%);
  filter: blur(12px);
  z-index: -1;
}

.story-letterbox { position: absolute; left: 0; right: 0; z-index: 8; height: 16px; background: #020305; pointer-events: none; }
.story-letterbox--top { top: 0; }
.story-letterbox--bottom { bottom: 0; }

.story-topbar {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 4vw, 58px);
}
.story-chapter { display: flex; flex-direction: column; gap: 3px; }
.story-chapter span { color: var(--gold); font-family: var(--font-mono); font-size: 8px; letter-spacing: .22em; }
.story-chapter b { color: var(--ink-dim); font-family: var(--font-display); font-size: clamp(13px, 1.2vw, 17px); font-weight: 600; letter-spacing: .14em; }
.story-controls { display: flex; align-items: center; gap: 8px; }
.story-btn {
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(4, 8, 12, .32);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  backdrop-filter: blur(8px);
  transition: .2s ease;
}
.story-btn:hover, .story-btn.is-on { border-color: var(--line-strong); color: var(--gold); }
.story-btn span { opacity: .6; margin-left: 3px; }

.story-dialogue {
  position: absolute;
  left: 50%;
  bottom: max(3.2vh, 28px);
  z-index: 14;
  display: flex;
  align-items: stretch;
  gap: 18px;
  width: min(1000px, 92vw);
  min-height: 142px;
  padding: 24px 66px 22px 24px;
  transform: translateX(-50%);
  border: 1px solid rgba(232, 194, 124, .3);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(16, 25, 37, .94), rgba(6, 11, 17, .96)),
    radial-gradient(ellipse at 0 0, rgba(232, 194, 124, .08), transparent 45%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px);
  cursor: default;
}
.story-dialogue::before,
.story-dialogue::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--gold);
  opacity: .65;
}
.story-dialogue::before { left: 6px; top: 6px; border-left: 1px solid; border-top: 1px solid; }
.story-dialogue::after { right: 6px; bottom: 6px; border-right: 1px solid; border-bottom: 1px solid; }
.dialogue-portrait {
  position: relative;
  width: 72px;
  min-width: 72px;
  height: 72px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, rgba(232, 194, 124, .18), rgba(8, 14, 22, .9));
}
.dialogue-portrait .unit-art { width: 135%; height: 135%; margin: -13% 0 0 -18%; }
.dialogue-portrait.is-narrator { display: grid; place-items: center; color: var(--gold); font-family: var(--font-display); font-size: 26px; }
.dialogue-portrait.is-narrator .unit-art { display: none; }
.dialogue-body { flex: 1; min-width: 0; }
.dialogue-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .15em;
}
.dialogue-name::after { content: ""; width: 24px; height: 1px; background: linear-gradient(90deg, var(--gold), transparent); opacity: .6; }
.dialogue-name .name-sub { color: var(--faint); font-family: var(--font-mono); font-size: 8px; letter-spacing: .12em; }
.dialogue-text {
  min-height: 52px;
  color: #e8e0d2;
  font-family: var(--font-display);
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 2;
  letter-spacing: .06em;
}
.dialogue-text .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  vertical-align: -.12em;
  background: var(--gold);
  animation: cursorBlink .8s steps(1) infinite;
}
@keyframes cursorBlink { 50% { opacity: 0; } }
.dialogue-next {
  position: absolute;
  right: 24px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(232, 194, 124, .36);
  border-radius: 50%;
  background: rgba(232, 194, 124, .08);
  transition: .2s ease;
}
.dialogue-next span {
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  transform: rotate(45deg) translate(-1px, -1px);
  animation: nextPulse 1.5s ease-in-out infinite;
}
.dialogue-next:hover { background: rgba(232, 194, 124, .18); transform: scale(1.06); }
@keyframes nextPulse { 0%, 100% { opacity: .45; transform: rotate(45deg) translate(-1px, -1px); } 50% { opacity: 1; transform: rotate(45deg) translate(2px, 2px); } }
.dialogue-progress {
  position: absolute;
  left: 24px;
  right: 66px;
  bottom: 8px;
  height: 1px;
  background: rgba(255, 255, 255, .06);
}
.dialogue-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  transition: width .3s ease;
  box-shadow: 0 0 8px rgba(232, 194, 124, .3);
}
.story-hint {
  position: absolute;
  right: clamp(20px, 4vw, 58px);
  bottom: max(1.4vh, 20px);
  z-index: 13;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
  opacity: .6;
  transition: opacity .3s ease;
}
.story-hint.is-hidden { opacity: 0; }
.story-dialogue.is-narrator { border-color: rgba(255, 255, 255, .14); }
.story-dialogue.is-narrator .dialogue-name { color: var(--ink-dim); }
.story-dialogue.is-narrator .dialogue-name::after { background: linear-gradient(90deg, var(--muted), transparent); }

/* ---------- 6. Hub / chapter map ---------- */
.hub-screen {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--header-h) + 32px) clamp(18px, 3.4vw, 54px) 36px;
  overflow: hidden;
}
.hub-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 73% 8%, rgba(54, 132, 125, .16), transparent 70%),
    radial-gradient(ellipse 38% 40% at 10% 80%, rgba(123, 79, 139, .10), transparent 70%),
    linear-gradient(180deg, rgba(7, 11, 18, .2), rgba(7, 11, 18, .82));
}
.hub-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(232, 194, 124, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 194, 124, .035) 1px, transparent 1px);
  background-size: 76px 76px;
  mask-image: radial-gradient(ellipse at 70% 40%, #000 20%, transparent 74%);
}
.hub-wrap {
  position: relative;
  z-index: 2;
  max-width: 1660px;
  margin: 0 auto;
}
.hub-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 24px;
  padding: 0 4px;
}
.hub-heading h2 {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.1vw, 46px);
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.15;
}
.hub-heading h2 small {
  display: inline-block;
  margin-left: 16px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .2em;
  vertical-align: middle;
}
.hub-heading p {
  max-width: 380px;
  padding-bottom: 6px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 13px;
  line-height: 1.9;
  letter-spacing: .06em;
  text-align: right;
}
.hub-grid {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 346px;
  gap: 15px;
  align-items: stretch;
}

/* Party rail */
.party-rail { display: flex; flex-direction: column; padding: 21px 19px 17px; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.panel-head h3 { margin-top: 3px; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: .08em; }
.unit-count { padding: 3px 7px; border: 1px solid var(--line); color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.party-list { display: flex; flex-direction: column; gap: 4px; }
.party-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: background .2s ease, border-color .2s ease;
}
.party-row:hover { background: rgba(255, 255, 255, .03); border-color: rgba(255, 255, 255, .06); }
.party-thumb {
  position: relative;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--el) 40%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--el) 18%, transparent), rgba(7, 12, 18, .9));
}
.party-thumb .unit-art { width: 150%; height: 150%; margin: -24% 0 0 -25%; }
.party-info { min-width: 0; }
.party-info b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.party-info small { display: block; margin-top: 1px; color: var(--faint); font-size: 9px; letter-spacing: .05em; }
.party-lv { color: var(--muted); font-family: var(--font-mono); font-size: 9px; text-align: right; }
.party-lv b { display: block; color: var(--gold); font-size: 12px; font-weight: 500; }
.party-spirits {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 16px 3px 12px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  color: var(--faint);
  font-size: 8px;
  letter-spacing: .1em;
}
.party-spirits span { color: var(--gold); }
.party-spirit-list { display: flex; gap: 5px; margin-left: auto; }
.party-spirit {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid color-mix(in srgb, var(--el) 42%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--el) 18%, transparent), transparent);
  font-size: 10px;
  color: var(--el);
}
.party-rail > .btn { margin-top: auto; }
.party-power {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 15px;
  padding: 0 2px;
}
.party-power span { color: var(--faint); font-size: 9px; letter-spacing: .12em; }
.party-power b { color: var(--gold-soft); font-family: var(--font-mono); font-size: 25px; font-weight: 500; letter-spacing: .04em; text-shadow: 0 0 18px rgba(232, 194, 124, .18); }
.rail-note {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  padding: 12px 11px;
  border: 1px solid rgba(255, 255, 255, .055);
  background: rgba(255, 255, 255, .018);
}
.note-star { color: var(--gold); font-size: 9px; line-height: 1.7; }
.rail-note p { color: var(--faint); font-size: 9px; line-height: 1.7; }

/* Map */
.map-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.map-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 21px 23px 15px; }
.map-top h3 { margin-top: 4px; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: .08em; }
.map-legend { display: flex; align-items: center; gap: 13px; padding-top: 8px; color: var(--faint); font-size: 8px; white-space: nowrap; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot--clear { background: var(--teal); box-shadow: 0 0 7px rgba(84, 216, 189, .6); }
.dot--current { background: var(--coral); box-shadow: 0 0 7px rgba(255, 118, 107, .65); }
.dot--lock { background: #47515f; }
.map-frame {
  position: relative;
  flex: 1;
  min-height: 520px;
  margin: 0 11px 11px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
  background: #07110f;
}
.map-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 17, 15, .15), transparent 25%, transparent 72%, rgba(5, 10, 9, .7)),
    radial-gradient(ellipse at 50% 48%, transparent 30%, rgba(3, 7, 6, .48) 100%);
  z-index: 2;
}
.map-art { position: absolute; inset: 0; opacity: .64; filter: saturate(.9) brightness(.75); transform: scale(1.08); }
.map-art .backdrop-svg { width: 100%; height: 100%; }
.map-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(232, 194, 124, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 194, 124, .035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 15%, transparent 80%);
  opacity: .7;
}
.map-path { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; }
.map-path__glow { fill: none; stroke: rgba(232, 194, 124, .16); stroke-width: 7; filter: blur(3px); }
.map-path__line { fill: none; stroke: rgba(232, 194, 124, .46); stroke-width: 1.2; stroke-dasharray: 5 9; }
.map-nodes { position: absolute; inset: 0; z-index: 5; }
.map-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 86px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  transition: color .2s ease, transform .2s var(--ease);
}
.map-node:hover { color: var(--ink); transform: translate(-50%, -50%) scale(1.04); }
.node-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: rgba(7, 13, 19, .86);
  box-shadow: 0 0 0 4px rgba(7, 13, 19, .55), 0 8px 22px rgba(0, 0, 0, .35);
  font-family: var(--font-mono);
  font-size: 11px;
  transition: .25s var(--ease);
}
.node-orb::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
}
.node-orb::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
  opacity: .45;
}
.map-node .node-name { color: inherit; font-family: var(--font-display); font-size: 10px; letter-spacing: .05em; white-space: nowrap; text-shadow: 0 2px 8px #000; }
.map-node .node-badge {
  position: absolute;
  top: -7px;
  right: -12px;
  min-width: 30px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: rgba(6, 10, 15, .9);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: .06em;
  opacity: .85;
}
.map-node.is-cleared { color: var(--teal); }
.map-node.is-cleared .node-orb { border-color: rgba(84, 216, 189, .7); background: rgba(9, 36, 32, .92); box-shadow: 0 0 0 4px rgba(7, 13, 19, .55), 0 0 24px rgba(84, 216, 189, .2); }
.map-node.is-cleared .node-orb::after { width: 8px; height: 4px; border: 1px solid var(--teal); border-top: 0; border-right: 0; background: none; border-radius: 0; transform: translate(-50%, -60%) rotate(-45deg); opacity: 1; }
.map-node.is-current { color: var(--coral); }
.map-node.is-current .node-orb { border-color: var(--coral); background: rgba(50, 17, 19, .92); box-shadow: 0 0 0 4px rgba(7, 13, 19, .55), 0 0 26px rgba(255, 118, 107, .28); animation: nodePulse 2.6s ease-in-out infinite; }
.map-node.is-current .node-orb::after { background: var(--coral); opacity: 1; }
.map-node.is-current .node-badge { color: var(--coral); }
.map-node.is-locked { color: #57616f; opacity: .72; cursor: not-allowed; }
.map-node.is-locked .node-orb { background: rgba(8, 12, 17, .78); border-color: rgba(255, 255, 255, .12); }
.map-node.is-locked .node-orb::after { background: #57616f; }
.map-node.is-selected .node-orb { outline: 1px solid var(--gold); outline-offset: 4px; }
.map-node.is-selected .node-name { color: var(--gold-soft); }
.map-node.is-boss .node-orb { border-radius: 4px 50% 50% 50%; transform: rotate(45deg); width: 38px; height: 38px; }
.map-node.is-boss .node-orb span { transform: rotate(-45deg); }
.map-node.is-boss .node-orb::before { inset: 5px; border-radius: 4px 50% 50% 50%; }
.map-node.is-boss .node-orb::after { display: none; }
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(7, 13, 19, .55), 0 0 18px rgba(255, 118, 107, .16); }
  50% { box-shadow: 0 0 0 4px rgba(7, 13, 19, .55), 0 0 38px rgba(255, 118, 107, .4); }
}
.map-compass {
  position: absolute;
  top: 20px;
  right: 22px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
}
.map-compass i { position: relative; width: 1px; height: 30px; background: linear-gradient(180deg, var(--gold), transparent); opacity: .5; }
.map-compass i::before { content: ""; position: absolute; left: -3px; top: 0; width: 7px; height: 7px; border-left: 1px solid var(--gold); border-top: 1px solid var(--gold); transform: rotate(45deg); }
.map-caption {
  position: absolute;
  left: 22px;
  bottom: 20px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.map-caption span { color: var(--gold); font-family: var(--font-mono); font-size: 8px; letter-spacing: .16em; }
.map-caption b { color: var(--ink-dim); font-family: var(--font-display); font-size: 12px; font-weight: 500; letter-spacing: .14em; }

/* Mission panel */
.mission-panel { display: flex; flex-direction: column; padding: 21px 19px 17px; overflow: hidden; }
.mission-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mission-no { color: var(--gold); font-family: var(--font-mono); font-size: 34px; font-weight: 300; line-height: .9; letter-spacing: -.06em; opacity: .8; }
.mission-status { padding: 3px 7px; border: 1px solid rgba(255, 255, 255, .12); color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: .1em; white-space: nowrap; }
.mission-status.is-clear { color: var(--teal); border-color: rgba(84, 216, 189, .32); }
.mission-status.is-boss { color: var(--coral); border-color: rgba(255, 118, 107, .35); }
.mission-name { margin-top: 16px; font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: .05em; line-height: 1.2; }
.mission-en { margin-top: 5px; color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: .18em; }
.mission-desc { margin-top: 13px; color: var(--muted); font-family: var(--font-display); font-size: 11px; line-height: 1.85; letter-spacing: .03em; }
.mission-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 17px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .06);
}
.mission-data div { padding: 8px 10px; background: rgba(7, 12, 18, .8); }
.mission-data span { display: block; color: var(--faint); font-size: 7px; letter-spacing: .1em; }
.mission-data b { display: block; margin-top: 2px; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.mission-data b.is-gold { color: var(--gold-soft); }
.mission-enemies { margin-top: 17px; }
.mission-section-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--faint); font-size: 8px; letter-spacing: .1em; }
.mission-section-label b { color: var(--muted); font-weight: 500; letter-spacing: .04em; }
.enemy-preview { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.enemy-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 2px 4px;
  border: 1px solid color-mix(in srgb, var(--el) 26%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--el) 7%, rgba(7, 12, 18, .7));
  overflow: hidden;
}
.enemy-chip .unit-art { width: 34px; height: 34px; }
.enemy-chip small { max-width: 100%; color: var(--faint); font-size: 6px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.enemy-chip.is-boss { border-color: color-mix(in srgb, var(--coral) 52%, transparent); background: color-mix(in srgb, var(--coral) 10%, rgba(7, 12, 18, .8)); }
.enemy-chip.is-boss::after { content: "BOSS"; position: absolute; top: 1px; right: 1px; color: var(--coral); font-family: var(--font-mono); font-size: 5px; }
.mission-reward {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 17px;
  padding: 10px 11px;
  border: 1px solid rgba(232, 194, 124, .16);
  background: linear-gradient(90deg, rgba(232, 194, 124, .07), transparent);
}
.mission-reward span { color: var(--faint); font-size: 8px; letter-spacing: .08em; }
.mission-reward b { color: var(--gold-soft); font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.mission-reward b i { color: var(--gold); font-style: normal; margin-right: 3px; font-size: 10px; }
.mission-actions { display: flex; flex-direction: column; gap: 7px; margin-top: auto; padding-top: 16px; }
.mission-actions .btn { width: 100%; }
.mission-actions .btn--primary { min-height: 48px; }
.mission-actions-row { display: flex; gap: 7px; }
.mission-actions-row .btn { flex: 1; font-size: 10px; padding: 8px 8px; min-height: 36px; }
.mission-locked { margin-top: auto; padding: 13px 12px; border: 1px dashed rgba(255, 255, 255, .11); color: var(--faint); font-size: 9px; line-height: 1.7; text-align: center; }
.mission-locked b { color: var(--muted); }

.hub-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 15px;
  padding: 13px 17px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(9, 14, 22, .52);
}
.hub-tip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tip-label { flex: none; padding-right: 12px; border-right: 1px solid rgba(232, 194, 124, .2); color: var(--gold); font-family: var(--font-mono); font-size: 7px; letter-spacing: .16em; }
.hub-tip p { color: var(--muted); font-size: 10px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-tip .text-btn { flex: none; }
.hub-footer-actions { display: flex; align-items: center; gap: 18px; flex: none; }

/* ---------- 7. Team / level up ---------- */
.team-screen {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--header-h) + 32px) clamp(18px, 3.4vw, 54px) 48px;
  overflow: hidden;
}
.team-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 82% 16%, rgba(123, 83, 143, .11), transparent 45%),
    radial-gradient(ellipse at 12% 72%, rgba(55, 126, 122, .1), transparent 45%);
}
.team-wrap { position: relative; z-index: 2; max-width: 1500px; margin: 0 auto; }
.team-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 24px; }
.team-heading h2 { margin-top: 9px; font-family: var(--font-display); font-size: clamp(30px, 3vw, 44px); font-weight: 700; letter-spacing: .06em; }
.team-heading p { max-width: 610px; margin-top: 7px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.team-heading__side { display: flex; align-items: center; gap: 10px; padding-bottom: 5px; }
.sand-panel { min-width: 120px; padding: 8px 14px; border: 1px solid rgba(232, 194, 124, .18); background: rgba(232, 194, 124, .045); }
.sand-panel span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .1em; }
.sand-panel b { display: block; color: var(--gold-soft); font-family: var(--font-mono); font-size: 19px; font-weight: 500; letter-spacing: .03em; }
.team-grid { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 16px; align-items: start; }
.roster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.contract-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 540px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 3px;
  background: linear-gradient(180deg, #121b26, #080c13);
  color: var(--ink);
  text-align: left;
  transition: transform .32s var(--ease), border-color .3s ease, box-shadow .3s ease;
}
.contract-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 38%, rgba(8, 12, 19, .2) 52%, rgba(8, 12, 19, .96) 88%),
    radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--el) 16%, transparent), transparent 58%);
}
.contract-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 1px solid transparent;
  background: linear-gradient(125deg, rgba(255, 255, 255, .18), transparent 20%, transparent 65%, color-mix(in srgb, var(--el) 30%, transparent)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .4;
  transition: opacity .3s ease;
}
.contract-card:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--el) 48%, transparent); box-shadow: 0 26px 60px rgba(0, 0, 0, .45), 0 0 30px color-mix(in srgb, var(--el) 10%, transparent); }
.contract-card:hover::after, .contract-card.is-selected::after { opacity: 1; }
.contract-card.is-selected { border-color: color-mix(in srgb, var(--el) 62%, transparent); box-shadow: 0 18px 46px rgba(0, 0, 0, .42), 0 0 0 1px color-mix(in srgb, var(--el) 24%, transparent); }
.card-art {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 330px;
  padding: 14px 6px 0;
  overflow: hidden;
}
.card-art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 72%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--el) 22%, transparent);
  border-radius: 50%;
}
.card-art::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 47%;
  width: 52%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px dashed color-mix(in srgb, var(--el) 18%, transparent);
  border-radius: 50%;
  animation: haloSpin 50s linear infinite;
}
.card-art .unit-art { position: relative; z-index: 1; width: 100%; height: 100%; transition: transform .5s var(--ease); filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .4)); }
.contract-card:hover .card-art .unit-art { transform: translateY(-4px) scale(1.02); }
.card-top {
  position: absolute;
  top: 13px;
  left: 13px;
  right: 13px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.card-rarity { display: flex; gap: 2px; color: var(--gold); font-size: 8px; text-shadow: 0 0 8px rgba(232, 194, 124, .5); }
.card-element {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid color-mix(in srgb, var(--el) 50%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--el) 10%, rgba(6, 10, 15, .8));
  color: var(--el);
  font-family: var(--font-display);
  font-size: 11px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--el) 20%, transparent);
}
.card-level {
  position: absolute;
  top: 48px;
  left: 13px;
  z-index: 4;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(5, 9, 14, .5);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
}
.card-body { position: relative; z-index: 5; padding: 15px 16px 17px; }
.card-role { color: var(--el); font-family: var(--font-mono); font-size: 7px; letter-spacing: .14em; }
.card-name { margin-top: 2px; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: .08em; line-height: 1.15; }
.card-name small { margin-left: 6px; color: var(--faint); font-size: 9px; font-weight: 400; letter-spacing: .05em; }
.card-title { margin-top: 2px; color: var(--muted); font-family: var(--font-display); font-size: 10px; letter-spacing: .08em; }
.card-spirit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, .07);
  color: var(--faint);
  font-size: 8px;
  letter-spacing: .04em;
}
.card-spirit b { color: var(--ink-dim); font-weight: 500; }
.card-spirit .mini-orb { margin-left: auto; display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid color-mix(in srgb, var(--sp-el) 40%, transparent); border-radius: 50%; color: var(--sp-el); font-size: 9px; }

.unit-detail { padding: 22px 22px 20px; min-height: 640px; }
.detail-head { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.detail-portrait {
  position: relative;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--el) 44%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 28%, color-mix(in srgb, var(--el) 22%, transparent), rgba(7, 11, 17, .9));
  box-shadow: 0 0 22px color-mix(in srgb, var(--el) 12%, transparent);
}
.detail-portrait .unit-art { width: 145%; height: 145%; margin: -15% 0 0 -22%; }
.detail-name .panel-kicker { color: var(--el); }
.detail-name h3 { margin-top: 3px; font-family: var(--font-display); font-size: 27px; font-weight: 700; letter-spacing: .06em; line-height: 1.2; }
.detail-name h3 small { margin-left: 6px; color: var(--faint); font-size: 9px; font-weight: 400; }
.detail-name p { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.detail-level { text-align: right; }
.detail-level span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .1em; }
.detail-level b { display: block; color: var(--gold-soft); font-family: var(--font-mono); font-size: 27px; font-weight: 400; line-height: 1.15; }
.detail-level b small { color: var(--faint); font-size: 10px; }
.detail-quote { margin: 14px 0 15px; padding-left: 11px; border-left: 1px solid color-mix(in srgb, var(--el) 40%, transparent); color: var(--muted); font-family: var(--font-display); font-size: 10px; line-height: 1.8; letter-spacing: .04em; }
.detail-section { margin-top: 16px; }
.detail-section h4 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--ink-dim); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .1em; }
.detail-section h4 span { color: var(--faint); font-family: var(--font-mono); font-size: 7px; font-weight: 400; letter-spacing: .1em; }
.stat-list { display: flex; flex-direction: column; gap: 6px; }
.stat-row { display: grid; grid-template-columns: 33px 1fr 43px; align-items: center; gap: 8px; }
.stat-row > span { color: var(--faint); font-size: 8px; letter-spacing: .05em; }
.stat-bar { height: 3px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--el), color-mix(in srgb, var(--el) 40%, #fff)); box-shadow: 0 0 7px color-mix(in srgb, var(--el) 40%, transparent); transition: width .5s var(--ease); }
.stat-row > b { color: var(--ink-dim); font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-align: right; }
.passive-box, .spirit-box {
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, .065);
  background: rgba(255, 255, 255, .018);
}
.passive-box b, .spirit-box b { display: flex; align-items: center; gap: 7px; color: var(--gold-soft); font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: .05em; }
.passive-box b::before, .spirit-box b::before { content: "✦"; color: var(--gold); font-size: 8px; }
.passive-box p, .spirit-box p { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.spirit-box { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px; align-items: center; }
.spirit-orb { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid color-mix(in srgb, var(--sp-el) 45%, transparent); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--sp-el) 16%, transparent), transparent); }
.spirit-orb .unit-art { width: 44px; height: 44px; }
.spirit-box small { display: block; margin-top: 2px; color: var(--faint); font-family: var(--font-mono); font-size: 7px; letter-spacing: .06em; }
.skill-list { display: flex; flex-direction: column; gap: 6px; }
.skill-row { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 7px 8px; border: 1px solid rgba(255, 255, 255, .06); background: rgba(255, 255, 255, .018); }
.skill-glyph { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid color-mix(in srgb, var(--el) 44%, transparent); border-radius: 50%; color: var(--el); font-family: var(--font-display); font-size: 10px; }
.skill-copy b { display: block; color: var(--ink-dim); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.skill-copy p { margin-top: 1px; color: var(--faint); font-size: 8px; line-height: 1.45; }
.skill-cd { color: var(--faint); font-family: var(--font-mono); font-size: 7px; white-space: nowrap; }
.skill-cd.is-zero { color: var(--teal); }
.elite-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 10px;
  border: 1px solid rgba(232, 194, 124, .17);
  background: linear-gradient(90deg, rgba(232, 194, 124, .08), transparent);
}
.elite-mark { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid var(--gold); color: var(--gold); font-family: var(--font-mono); font-size: 9px; transform: rotate(45deg); }
.elite-mark span { transform: rotate(-45deg); }
.elite-stage b { display: block; color: var(--gold-soft); font-family: var(--font-display); font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.elite-stage small { display: block; margin-top: 1px; color: var(--faint); font-size: 8px; }
.elite-stage i { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 7px; font-style: normal; }
.upgrade-box {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.upgrade-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.upgrade-next span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .08em; }
.upgrade-next b { display: block; margin-top: 2px; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.upgrade-cost { text-align: right; }
.upgrade-cost span { display: block; color: var(--faint); font-size: 8px; }
.upgrade-cost b { display: block; color: var(--gold-soft); font-family: var(--font-mono); font-size: 18px; font-weight: 500; }
.upgrade-box .btn { width: 100%; margin-top: 10px; min-height: 43px; }
.level-progress { display: flex; gap: 3px; margin-top: 10px; }
.level-progress i { flex: 1; height: 4px; background: rgba(255, 255, 255, .07); }
.level-progress i.is-on { background: linear-gradient(90deg, var(--gold-deep), var(--gold)); box-shadow: 0 0 7px rgba(232, 194, 124, .25); }
.level-progress i.is-current { background: var(--coral); box-shadow: 0 0 7px rgba(255, 118, 107, .4); }
.cap-note { margin-top: 7px; color: var(--faint); font-size: 8px; text-align: center; letter-spacing: .05em; }

/* ---------- 8. Battle ---------- */
.battle-screen { display: none; min-height: 100svh; background: #030609; }
.battle-screen.is-active { display: block; }
.battle-frame {
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  background: #030609;
  --bd-sky-a: #06141b;
  --bd-sky-b: #10383a;
  --bd-sky-c: #2e695e;
  --bd-moon: #d6fff1;
  --bd-far: #102f31;
  --bd-mid: #09211f;
  --bd-near: #030e0d;
  --bd-ground: #04100d;
  --bd-water: #123c43;
  --bd-glow: #62e8c7;
  --bd-vignette: #020708;
}
.battle-frame[data-scene="fireflies"] { --bd-sky-a:#07120f; --bd-sky-b:#14392b; --bd-sky-c:#336b4d; --bd-moon:#f1ffc9; --bd-far:#12352a; --bd-mid:#0a251a; --bd-near:#03110c; --bd-ground:#04100a; --bd-glow:#d7f36e; --bd-vignette:#030906; }
.battle-frame[data-scene="ford"] { --bd-sky-a:#061321; --bd-sky-b:#173e52; --bd-sky-c:#3f7880; --bd-moon:#d9f5ff; --bd-far:#153847; --bd-mid:#0b2633; --bd-near:#041119; --bd-ground:#06131a; --bd-water:#1d5369; --bd-glow:#7bd9ff; --bd-vignette:#02070c; }
.battle-frame[data-scene="grove"] { --bd-sky-a:#0d0a1a; --bd-sky-b:#2b2445; --bd-sky-c:#55476b; --bd-moon:#decfff; --bd-far:#29243b; --bd-mid:#171528; --bd-near:#080712; --bd-ground:#0a0912; --bd-glow:#a98cff; --bd-vignette:#05040a; }
.battle-frame[data-scene="camp"] { --bd-sky-a:#100c12; --bd-sky-b:#3b2730; --bd-sky-c:#6d4938; --bd-moon:#ffd49c; --bd-far:#2c2325; --bd-mid:#1e1718; --bd-near:#0b0909; --bd-ground:#100b08; --bd-glow:#ff9a57; --bd-vignette:#0a0605; }
.battle-frame[data-scene="mist"] { --bd-sky-a:#0a1118; --bd-sky-b:#27353f; --bd-sky-c:#526269; --bd-moon:#e7f4f4; --bd-far:#26343c; --bd-mid:#151f27; --bd-near:#080d12; --bd-ground:#081015; --bd-glow:#b9d5d9; --bd-vignette:#04090c; }
.battle-frame[data-scene="bridge"] { --bd-sky-a:#07101c; --bd-sky-b:#182b45; --bd-sky-c:#3c5368; --bd-moon:#e2f2ff; --bd-far:#17293b; --bd-mid:#0d1a29; --bd-near:#050c14; --bd-ground:#071019; --bd-glow:#7fc8ff; --bd-vignette:#02060b; }
.battle-frame[data-scene="spring"] { --bd-sky-a:#091020; --bd-sky-b:#26365e; --bd-sky-c:#5e6e93; --bd-moon:#ecf2ff; --bd-far:#28344e; --bd-mid:#151f33; --bd-near:#080d17; --bd-ground:#09101c; --bd-water:#2d3f69; --bd-glow:#b4cbff; --bd-vignette:#030711; }
.battle-frame[data-scene="ruins"] { --bd-sky-a:#0c0c1b; --bd-sky-b:#28264a; --bd-sky-c:#4d476d; --bd-moon:#e0d8ff; --bd-far:#2b2947; --bd-mid:#19162d; --bd-near:#090712; --bd-ground:#0b0915; --bd-glow:#c6a8ff; --bd-vignette:#05040a; }
.battle-frame[data-scene="altar"] { --bd-sky-a:#0e0710; --bd-sky-b:#321329; --bd-sky-c:#5c2632; --bd-moon:#ffc7bb; --bd-far:#341b2b; --bd-mid:#20101c; --bd-near:#0d070b; --bd-ground:#0e0609; --bd-glow:#ff7c88; --bd-vignette:#080306; }
.battle-backdrop { position: absolute; inset: 0; }
.battle-backdrop svg { width: 100%; height: 100%; }
.battle-darken {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 5, 8, .62) 0%, transparent 22%, transparent 55%, rgba(2, 5, 8, .82) 100%),
    radial-gradient(ellipse at 50% 48%, transparent 25%, rgba(2, 5, 8, .55) 100%);
}
.battle-speedlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(from 0deg at 50% 48%, transparent 0deg 7deg, rgba(255, 255, 255, .045) 7.5deg 8deg, transparent 8.5deg 15deg);
  mask-image: radial-gradient(circle at 50% 48%, transparent 0 22%, #000 60%);
  transition: opacity .15s ease;
}
.battle-speedlines.is-on { opacity: 1; animation: speedSpin 1.2s linear infinite; }
@keyframes speedSpin { to { transform: rotate(8deg) scale(1.06); } }

.battle-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px clamp(18px, 3vw, 42px);
}
.battle-back {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(4, 8, 13, .42);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
  backdrop-filter: blur(8px);
  transition: .2s ease;
}
.battle-back:hover { color: var(--gold); border-color: var(--line-strong); }
.battle-title { text-align: center; }
.battle-title span { display: block; color: var(--gold); font-family: var(--font-mono); font-size: 8px; letter-spacing: .2em; }
.battle-title b { display: block; margin-top: 2px; color: var(--ink-dim); font-family: var(--font-display); font-size: clamp(13px, 1.3vw, 18px); font-weight: 600; letter-spacing: .12em; }
.battle-tools { display: flex; align-items: center; gap: 7px; }
.tool-btn {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(4, 8, 13, .42);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .1em;
  backdrop-filter: blur(8px);
  transition: .2s ease;
}
.tool-btn span { color: var(--faint); margin-left: 4px; }
.tool-btn:hover, .tool-btn.is-on { color: var(--gold); border-color: var(--line-strong); }
.tool-btn.is-on span { color: var(--teal); }
.tool-btn--icon { width: 34px; padding: 0; }
.tool-btn--speed { min-width: 38px; justify-content: center; color: var(--gold-soft); font-size: 9px; }

.team-strip {
  position: absolute;
  top: 80px;
  z-index: 18;
  display: flex;
  gap: 5px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 3px;
  background: rgba(4, 8, 13, .38);
  backdrop-filter: blur(10px);
}
.team-strip--enemy { right: clamp(18px, 3vw, 42px); }
.team-strip--player { left: clamp(18px, 3vw, 42px); }
.team-strip::before {
  content: attr(data-label);
  position: absolute;
  left: 2px;
  top: -14px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: .18em;
  opacity: .75;
}
.team-strip--enemy::before { left: auto; right: 2px; }
.team-pip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 45px;
  padding: 4px 3px 3px;
  border: 1px solid color-mix(in srgb, var(--el) 26%, transparent);
  border-radius: 2px;
  background: color-mix(in srgb, var(--el) 6%, rgba(6, 11, 17, .7));
  transition: opacity .3s ease, border-color .3s ease;
}
.team-pip .pip-name { max-width: 100%; color: var(--faint); font-size: 6px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-pip .pip-hp { width: 100%; height: 2px; background: rgba(255, 255, 255, .1); }
.team-pip .pip-hp i { display: block; height: 100%; background: var(--el); transition: width .4s ease; }
.team-pip.is-active { border-color: var(--el); box-shadow: 0 0 12px color-mix(in srgb, var(--el) 28%, transparent); }
.team-pip.is-active::after { content: ""; position: absolute; left: 50%; bottom: -4px; width: 4px; height: 4px; border-radius: 50%; background: var(--el); transform: translateX(-50%); }
.team-pip.is-fainted { opacity: .26; filter: grayscale(1); }
.team-pip.is-fainted .pip-hp i { width: 0 !important; }
.team-pip.is-switchable { cursor: pointer; }
.team-pip.is-switchable:hover { border-color: var(--gold); }

.battle-arena { position: absolute; inset: 0; z-index: 4; }
.arena-ring {
  position: absolute;
  border: 1px solid rgba(232, 194, 124, .18);
  border-radius: 50%;
  pointer-events: none;
  opacity: .6;
}
.arena-ring::before, .arena-ring::after { content: ""; position: absolute; border-radius: 50%; border: 1px dashed rgba(84, 216, 189, .12); }
.arena-ring::before { inset: 7%; }
.arena-ring::after { inset: 17%; border-style: solid; border-color: rgba(255, 255, 255, .05); }
.arena-ring--enemy { width: 34vw; height: 34vw; right: 2vw; top: 19vh; max-width: 520px; max-height: 520px; }
.arena-ring--player { width: 38vw; height: 38vw; left: 1vw; bottom: 9vh; max-width: 580px; max-height: 580px; opacity: .4; }
.battle-unit {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(27vw, 390px);
  transition: opacity .35s ease, filter .35s ease;
}
.battle-unit--enemy { right: 9%; top: 16%; height: 45vh; min-height: 280px; }
.battle-unit--player { left: 7%; bottom: 20.5%; height: 48vh; min-height: 300px; }
.unit-hud {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 9px 12px 8px;
  border: 1px solid rgba(232, 194, 124, .24);
  border-radius: 2px;
  background: linear-gradient(100deg, rgba(12, 22, 33, .94), rgba(7, 13, 21, .85));
  box-shadow: 0 10px 26px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(10px);
}
.battle-unit--enemy .unit-hud { border-color: color-mix(in srgb, var(--el) 38%, transparent); }
.battle-unit--player .unit-hud { border-color: color-mix(in srgb, var(--el) 44%, transparent); }
.unit-hud-top { display: flex; align-items: center; gap: 6px; }
.unit-hud-name { color: var(--ink); font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: .08em; line-height: 1.25; }
.unit-hud-title { color: var(--faint); font-size: 7px; letter-spacing: .04em; }
.unit-hud-el { margin-left: auto; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid color-mix(in srgb, var(--el) 55%, transparent); border-radius: 50%; color: var(--el); font-family: var(--font-display); font-size: 9px; }
.unit-hud-lv { color: var(--gold); font-family: var(--font-mono); font-size: 8px; }
.unit-hp-label { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-family: var(--font-mono); font-size: 7px; }
.unit-hp-label b { color: var(--ink-dim); font-weight: 500; }
.unit-hp { height: 5px; margin-top: 3px; background: rgba(255, 255, 255, .09); overflow: hidden; }
.unit-hp i { display: block; height: 100%; background: linear-gradient(90deg, var(--el), color-mix(in srgb, var(--el) 50%, #fff)); box-shadow: 0 0 6px color-mix(in srgb, var(--el) 50%, transparent); transition: width .45s var(--ease); }
.unit-hp.is-low i { background: linear-gradient(90deg, #d24e4b, #ff8a76); }
.unit-shield { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--gold); font-family: var(--font-mono); font-size: 7px; }
.unit-shield::before { content: "◇"; font-size: 8px; }
.unit-sprite-wrap { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; width: 100%; padding-top: 6px; }
.unit-sprite-wrap .unit-art { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 22px 28px rgba(0, 0, 0, .5)); }
.battle-unit--enemy .unit-sprite-wrap .unit-art { filter: drop-shadow(0 22px 30px rgba(0, 0, 0, .55)) drop-shadow(0 0 28px color-mix(in srgb, var(--el) 12%, transparent)); }
.battle-unit--player .unit-sprite-wrap .unit-art { filter: drop-shadow(0 22px 30px rgba(0, 0, 0, .55)) drop-shadow(0 0 24px color-mix(in srgb, var(--el) 12%, transparent)); }
.battle-unit.is-attacking.unit--player .unit-sprite-wrap { animation: lungePlayer .42s var(--ease); }
.battle-unit.is-attacking.unit--enemy .unit-sprite-wrap { animation: lungeEnemy .42s var(--ease); }
@keyframes lungePlayer {
  0% { transform: translate(0, 0); }
  35% { transform: translate(35px, -14px) scale(1.02); }
  100% { transform: translate(0, 0); }
}
@keyframes lungeEnemy {
  0% { transform: translate(0, 0); }
  35% { transform: translate(-35px, 14px) scale(1.02); }
  100% { transform: translate(0, 0); }
}
.battle-unit.is-hit .unit-sprite-wrap { animation: hitShake .35s ease; }
@keyframes hitShake {
  0%, 100% { transform: translateX(0); filter: none; }
  20% { transform: translateX(-10px) rotate(-1deg); filter: brightness(1.8) saturate(.2); }
  45% { transform: translateX(8px) rotate(1deg); }
  70% { transform: translateX(-4px); }
}
.battle-unit.is-fainted { opacity: .12; filter: grayscale(1) blur(1px); pointer-events: none; }
.unit-status { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; min-height: 0; }
.status-tag { padding: 1px 5px; border: 1px solid rgba(255, 255, 255, .1); color: var(--faint); font-size: 6px; letter-spacing: .04em; }
.status-tag.is-burn { color: #ff9a7a; border-color: rgba(255, 120, 98, .3); }
.status-tag.is-shield { color: var(--gold); border-color: rgba(232, 194, 124, .28); }
.status-tag.is-stun { color: var(--violet); border-color: rgba(183, 139, 255, .3); }
.status-tag.is-buff { color: var(--teal); border-color: rgba(84, 216, 189, .28); }
.status-tag.is-debuff { color: #8ea8c9; border-color: rgba(142, 168, 201, .24); }

.turn-banner {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 12;
  transform: translate(-50%, -50%);
  padding: 7px 18px;
  border-top: 1px solid rgba(232, 194, 124, .3);
  border-bottom: 1px solid rgba(232, 194, 124, .3);
  background: rgba(6, 10, 15, .58);
  color: var(--gold-soft);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .24em;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.turn-banner.is-on { animation: bannerIn 1.15s var(--ease); }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.92); letter-spacing: .4em; }
  18%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); letter-spacing: .24em; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.03); }
}
.damage-layer { position: absolute; inset: 0; z-index: 14; pointer-events: none; }
.damage-float {
  position: absolute;
  color: #fff5de;
  font-family: var(--font-mono);
  font-size: clamp(20px, 2.4vw, 34px);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .8), 0 0 18px currentColor;
  animation: damageRise 1.05s var(--ease) forwards;
  white-space: nowrap;
}
.damage-float.is-crit { color: #ffd166; font-size: clamp(25px, 3vw, 44px); }
.damage-float.is-heal { color: #87f5c8; }
.damage-float.is-shield { color: #ffe4a2; font-size: 16px; }
.damage-float.is-effective { color: #ff9a76; }
.damage-float small { display: block; margin-top: 2px; font-family: var(--font-display); font-size: 9px; font-weight: 500; letter-spacing: .08em; text-align: center; text-shadow: none; }
@keyframes damageRise {
  0% { opacity: 0; transform: translateY(12px) scale(.75); }
  16% { opacity: 1; transform: translateY(0) scale(1.08); }
  34% { transform: translateY(-8px) scale(1); }
  100% { opacity: 0; transform: translateY(-62px) scale(.95); }
}
.battle-callout {
  position: absolute;
  left: 50%;
  top: 31%;
  z-index: 13;
  transform: translateX(-50%);
  padding: 5px 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(5, 9, 14, .72);
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .14em;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
.battle-callout.is-on { animation: callout 1.4s var(--ease); }
@keyframes callout {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(.96); }
  15%, 78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(1); }
}

.battle-log {
  position: absolute;
  left: clamp(18px, 3vw, 42px);
  top: 148px;
  z-index: 15;
  width: min(286px, 25vw);
  max-height: 130px;
  padding: 9px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 3px;
  background: rgba(4, 8, 13, .36);
  backdrop-filter: blur(9px);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.7;
}
.battle-log__title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; color: var(--faint); font-size: 6px; letter-spacing: .16em; }
.battle-log__title::after { content: ""; flex: 1; height: 1px; margin-left: 8px; background: rgba(255, 255, 255, .06); }
.battle-log-line { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.battle-log-line:first-of-type { color: var(--ink-dim); }
.battle-log-line b { color: var(--gold); font-weight: 500; }
.battle-log-line.is-damage b { color: var(--coral); }
.battle-log-line.is-heal b { color: var(--teal); }
.battle-log-line.is-system b { color: var(--violet); }

.battle-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(18px, 3vw, 42px) max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, transparent, rgba(4, 8, 13, .72) 18%, rgba(4, 8, 13, .96));
  backdrop-filter: blur(9px);
}
.battle-active { display: flex; flex-direction: column; justify-content: flex-end; }
.battle-active .ba-kicker { color: var(--gold); font-family: var(--font-mono); font-size: 7px; letter-spacing: .16em; }
.battle-active h3 { margin-top: 3px; font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: .08em; }
.battle-active h3 small { margin-left: 6px; color: var(--faint); font-size: 8px; font-weight: 400; }
.battle-active p { margin-top: 2px; color: var(--muted); font-size: 9px; }
.battle-active .ba-hp { margin-top: 9px; }
.battle-active .ba-hp span { display: flex; justify-content: space-between; color: var(--faint); font-family: var(--font-mono); font-size: 7px; }
.battle-active .ba-hp b { color: var(--ink-dim); font-weight: 500; }
.battle-active .ba-hp .bar { height: 3px; margin-top: 3px; background: rgba(255, 255, 255, .08); }
.battle-active .ba-hp .bar i { display: block; height: 100%; background: var(--el, var(--teal)); transition: width .4s ease; }
.battle-active .ba-hint { margin-top: 10px; color: var(--faint); font-size: 8px; line-height: 1.5; }
.battle-actions { display: grid; grid-template-columns: minmax(0, 1fr) 144px; gap: 9px; }
.skill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.skill-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 92px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 3px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--el) 13%, transparent), transparent 60%),
    rgba(10, 17, 26, .76);
  color: var(--ink);
  text-align: left;
  transition: .22s var(--ease);
}
.skill-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--el); opacity: .7; }
.skill-card:hover { border-color: color-mix(in srgb, var(--el) 55%, transparent); background: color-mix(in srgb, var(--el) 7%, rgba(10, 17, 26, .8)); transform: translateY(-2px); }
.skill-card:disabled { opacity: .36; cursor: not-allowed; transform: none; }
.skill-card:disabled:hover { border-color: rgba(255, 255, 255, .1); }
.skill-card__top { display: flex; align-items: center; gap: 6px; width: 100%; }
.skill-card__el { display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid color-mix(in srgb, var(--el) 48%, transparent); border-radius: 50%; color: var(--el); font-family: var(--font-display); font-size: 9px; }
.skill-card__name { font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.skill-card__cd { margin-left: auto; color: var(--faint); font-family: var(--font-mono); font-size: 7px; }
.skill-card__cd.is-ready { color: var(--teal); }
.skill-card__desc { margin-top: 3px; color: var(--faint); font-size: 8px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.skill-card__power { margin-top: auto; color: color-mix(in srgb, var(--el) 76%, #fff); font-family: var(--font-mono); font-size: 7px; letter-spacing: .08em; }
.battle-side-actions { display: flex; flex-direction: column; gap: 8px; }
.battle-action {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 3px;
  background: rgba(10, 17, 26, .7);
  color: var(--ink-dim);
  text-align: left;
  transition: .2s ease;
}
.battle-action:hover { border-color: var(--line-strong); background: rgba(232, 194, 124, .06); }
.battle-action:disabled { opacity: .35; cursor: not-allowed; }
.ba-icon { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid rgba(232, 194, 124, .22); border-radius: 50%; color: var(--gold); font-size: 12px; }
.battle-action b { display: block; font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.battle-action small { display: block; margin-top: 1px; color: var(--faint); font-family: var(--font-mono); font-size: 6px; letter-spacing: .06em; }
.battle-action small i { font-style: normal; color: var(--gold); }

.battle-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(430px, 92vw);
  padding: 26px 24px;
  overflow-y: auto;
  border-left: 1px solid var(--line-strong);
  background: linear-gradient(160deg, rgba(15, 24, 37, .98), rgba(7, 11, 18, .99));
  box-shadow: -30px 0 80px rgba(0, 0, 0, .5);
  animation: drawerIn .35s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(100%); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.drawer-head h3 { margin-top: 4px; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: .06em; }
.drawer-list { display: flex; flex-direction: column; gap: 7px; margin-top: 16px; }
.drawer-unit {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .022);
  color: var(--ink);
  text-align: left;
  transition: .2s ease;
}
.drawer-unit:hover { border-color: color-mix(in srgb, var(--el) 50%, transparent); background: color-mix(in srgb, var(--el) 6%, transparent); }
.drawer-unit:disabled { opacity: .35; cursor: not-allowed; }
.drawer-orb { position: relative; width: 52px; height: 52px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--el) 36%, transparent); border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--el) 14%, transparent), transparent); }
.drawer-orb .unit-art { width: 150%; height: 150%; margin: -22% 0 0 -25%; }
.drawer-unit b { display: block; font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.drawer-unit small { display: block; margin-top: 1px; color: var(--faint); font-size: 8px; }
.drawer-hp { width: 80px; text-align: right; }
.drawer-hp span { color: var(--faint); font-family: var(--font-mono); font-size: 7px; }
.drawer-hp .bar { height: 3px; margin-top: 3px; background: rgba(255, 255, 255, .09); }
.drawer-hp .bar i { display: block; height: 100%; background: var(--el); }
.drawer-note { margin-top: 18px; color: var(--faint); font-size: 9px; line-height: 1.7; }

/* ---------- 9. Result ---------- */
.result-screen {
  position: relative;
  display: none;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(232, 194, 124, .16), transparent 34%),
    radial-gradient(ellipse at 50% 100%, rgba(84, 216, 189, .06), transparent 48%),
    #05080d;
}
.result-screen.is-active { display: grid; place-items: center; }
.result-rays {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 120vmax;
  height: 120vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, transparent 0deg 8deg, rgba(232, 194, 124, .055) 8.5deg 9deg, transparent 9.5deg 17deg);
  mask-image: radial-gradient(circle, #000 0 12%, transparent 68%);
  animation: resultRays 80s linear infinite;
  pointer-events: none;
}
@keyframes resultRays { to { transform: translate(-50%, -50%) rotate(360deg); } }
.result-card {
  position: relative;
  z-index: 2;
  width: min(660px, 92vw);
  margin: 6vh 0;
  padding: 42px 46px 32px;
  border: 1px solid rgba(232, 194, 124, .32);
  background:
    linear-gradient(145deg, rgba(23, 35, 51, .96), rgba(8, 13, 20, .98)),
    radial-gradient(ellipse at 50% 0, rgba(232, 194, 124, .1), transparent 55%);
  box-shadow: 0 60px 140px rgba(0, 0, 0, .62), inset 0 1px 0 rgba(255, 255, 255, .07);
  text-align: center;
}
.result-card::before, .result-card::after {
  content: "";
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: var(--gold);
  opacity: .7;
}
.result-card::before { left: 10px; top: 10px; border-left: 1px solid; border-top: 1px solid; }
.result-card::after { right: 10px; bottom: 10px; border-right: 1px solid; border-bottom: 1px solid; }
.result-emblem {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  border: 1px solid rgba(232, 194, 124, .4);
  border-radius: 50%;
  color: var(--gold);
  font-size: 26px;
  box-shadow: 0 0 36px rgba(232, 194, 124, .13), inset 0 0 22px rgba(232, 194, 124, .06);
  animation: emblemFloat 5s ease-in-out infinite;
}
.result-screen.is-defeat .result-emblem { color: var(--coral); border-color: rgba(255, 118, 107, .4); box-shadow: 0 0 36px rgba(255, 118, 107, .12), inset 0 0 22px rgba(255, 118, 107, .06); }
.result-screen.is-defeat .result-rays { opacity: .3; filter: grayscale(1); }
@keyframes emblemFloat { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(8deg); } }
.result-kicker { display: block; color: var(--gold); font-family: var(--font-mono); font-size: 8px; letter-spacing: .28em; }
.result-card h2 { margin-top: 7px; font-family: var(--font-display); font-size: clamp(32px, 4vw, 52px); font-weight: 700; letter-spacing: .1em; line-height: 1.2; }
.result-subtitle { margin-top: 7px; color: var(--muted); font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; }
.result-stars { display: flex; justify-content: center; gap: 7px; margin-top: 17px; color: var(--gold); font-size: 13px; letter-spacing: .2em; }
.result-stars .is-empty { opacity: .18; }
.result-rewards { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }
.reward-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid rgba(232, 194, 124, .16);
  background: rgba(232, 194, 124, .05);
}
.reward-item span { color: var(--faint); font-size: 8px; }
.reward-item b { color: var(--gold-soft); font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.result-stats { display: flex; justify-content: center; gap: 24px; margin-top: 19px; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .07); }
.result-stats div { text-align: center; }
.result-stats span { display: block; color: var(--faint); font-size: 8px; letter-spacing: .08em; }
.result-stats b { display: block; color: var(--ink-dim); font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 25px; }
.result-actions .btn { min-width: 132px; }
.result-hint { margin-top: 16px; color: var(--faint); font-size: 8px; letter-spacing: .06em; }
.result-screen.is-defeat .result-kicker { color: var(--coral); }

/* ---------- 10. Modal / toast ---------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-layer[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 9, .78);
  backdrop-filter: blur(7px);
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  max-height: min(84svh, 760px);
  display: flex;
  flex-direction: column;
  border-color: rgba(232, 194, 124, .28);
  animation: modalIn .35s var(--ease-spring);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.modal-head h3 { margin-top: 4px; font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: .08em; }
.modal-body { padding: 18px 24px; overflow-y: auto; color: var(--muted); font-size: 11px; line-height: 1.85; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 22px; }
.guide-section { margin-bottom: 18px; }
.guide-section h4 { margin-bottom: 7px; color: var(--gold-soft); font-family: var(--font-display); font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.guide-section p { color: var(--muted); font-size: 10px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.guide-box { padding: 9px 10px; border: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .02); }
.guide-box b { display: block; color: var(--ink-dim); font-size: 10px; }
.guide-box span { display: block; margin-top: 2px; color: var(--faint); font-size: 8px; }
.type-wheel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.type-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid color-mix(in srgb, var(--el) 36%, transparent); color: var(--el); font-size: 8px; }
.type-pill b { color: var(--muted); font-weight: 400; }
.story-archive-list { display: flex; flex-direction: column; gap: 5px; }
.archive-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .018);
  color: var(--ink-dim);
  text-align: left;
  transition: .2s ease;
}
.archive-row:hover { border-color: var(--line-strong); background: rgba(232, 194, 124, .04); }
.archive-row span { color: var(--gold); font-family: var(--font-mono); font-size: 8px; }
.archive-row b { font-family: var(--font-display); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
.archive-row small { margin-left: auto; color: var(--faint); font-size: 7px; }
.reset-copy { color: var(--muted); font-size: 11px; line-height: 1.8; }
.reset-copy b { color: var(--coral); font-weight: 500; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 900;
  padding: 9px 17px;
  border: 1px solid rgba(232, 194, 124, .32);
  background: rgba(8, 13, 20, .94);
  color: var(--gold-soft);
  font-size: 10px;
  letter-spacing: .06em;
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  backdrop-filter: blur(10px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 11. Element color helpers ---------- */
[data-element="ember"] { --el: #ff7862; --sp-el: #ffb09f; }
[data-element="gale"] { --el: #54d8bd; --sp-el: #a9f5e4; }
[data-element="volt"] { --el: #f2c84b; --sp-el: #ffe9a1; }
[data-element="tide"] { --el: #69a9ff; --sp-el: #b8d6ff; }
[data-element="light"] { --el: #ffe1a3; --sp-el: #fff5d8; }
[data-element="dark"] { --el: #b78bff; --sp-el: #ddc8ff; }

/* ---------- 12. Responsive ---------- */
@media (max-width: 1380px) {
  .hub-grid { grid-template-columns: 265px minmax(0, 1fr) 318px; }
  .party-rail { padding: 18px 15px 14px; }
  .mission-panel { padding: 18px 16px 14px; }
  .map-frame { min-height: 480px; }
  .team-grid { grid-template-columns: minmax(0, 1fr) 430px; }
  .contract-card { min-height: 500px; }
  .card-art { min-height: 300px; }
  .battle-unit { width: min(29vw, 360px); }
}

@media (max-width: 1180px) {
  .header-chapter { display: none; }
  .hub-grid { grid-template-columns: 245px minmax(0, 1fr); }
  .mission-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 0 24px; align-items: start; }
  .mission-head, .mission-name, .mission-en, .mission-desc, .mission-data, .mission-enemies, .mission-reward { grid-column: 1; }
  .mission-actions, .mission-locked { grid-column: 2; grid-row: 1 / span 7; align-self: end; margin-top: 0; }
  .mission-panel { padding: 18px 22px; }
  .mission-actions { padding-top: 0; }
  .map-frame { min-height: 560px; }
  .team-grid { grid-template-columns: minmax(0, 1fr) 400px; }
  .roster { gap: 9px; }
  .contract-card { min-height: 450px; }
  .card-art { min-height: 260px; }
  .card-name { font-size: 22px; }
  .battle-active { display: none; }
  .battle-bottom { grid-template-columns: minmax(0, 1fr); }
  .battle-actions { grid-template-columns: minmax(0, 1fr) 132px; }
  .battle-log { top: 142px; width: 240px; }
}

@media (max-width: 960px) {
  :root { --header-h: 62px; }
  .game-header { gap: 18px; padding: 0 18px; }
  .brand-word small { display: none; }
  .brand-word b { font-size: 13px; }
  .header-resources { gap: 5px; }
  .resource-chip { padding: 3px 8px; min-height: 30px; }
  .resource-label { display: none; }
  .nav-link { padding: 7px 8px; font-size: 11px; }

  .title-layout { grid-template-columns: 1fr; align-items: end; padding-top: 12vh; padding-bottom: 17vh; }
  .title-copy { max-width: 620px; }
  .game-logo { margin-bottom: 12px; }
  .title-cast { position: absolute; inset: 0; min-height: 0; opacity: .48; z-index: 1; }
  .cast-figure--ren { left: 61%; width: 36vw; height: 55vh; }
  .cast-figure--mia { left: 37%; width: 29vw; height: 43vh; }
  .cast-figure--serena { right: 2%; width: 33vw; height: 52vh; }
  .cast-caption, .cast-plinth { display: none; }
  .title-copy { z-index: 3; }
  .title-moon { right: 7vw; top: 9vh; opacity: .55; }
  .title-ridge--far { height: 38vh; }
  .title-ridge--near { height: 25vh; }
  .title-signature { margin-top: 26px; }

  .hub-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .hub-heading p { text-align: left; max-width: 540px; }
  .hub-grid { grid-template-columns: 1fr; }
  .party-rail { display: grid; grid-template-columns: 1fr auto; gap: 0 18px; }
  .party-rail .panel-head, .party-list { grid-column: 1 / -1; }
  .party-list { flex-direction: row; flex-wrap: wrap; gap: 5px; }
  .party-row { display: inline-grid; grid-template-columns: 40px auto; width: calc(33.33% - 4px); margin-right: 0; }
  .party-row .party-lv { display: none; }
  .party-info b span { display: none; }
  .party-thumb { width: 40px; height: 40px; }
  .party-spirits { grid-column: 1 / -1; margin: 10px 0 0; }
  .party-rail > .btn { grid-column: 2; grid-row: 3; align-self: end; min-width: 150px; }
  .party-power { grid-column: 1; grid-row: 3; margin: 10px 0 0; }
  .rail-note { display: none; }
  .mission-panel { grid-column: auto; display: block; }
  .mission-actions { padding-top: 16px; }
  .map-frame { min-height: 500px; }

  .team-heading { flex-direction: column; align-items: flex-start; gap: 14px; }
  .team-heading__side { width: 100%; justify-content: space-between; }
  .team-grid { grid-template-columns: 1fr; }
  .roster { order: 2; }
  .unit-detail { order: 1; min-height: 0; }
  .contract-card { min-height: 470px; }
  .card-art { min-height: 280px; }

  .battle-top { padding: 12px 14px; }
  .battle-title b { font-size: 12px; }
  .battle-back { font-size: 9px; padding: 6px 9px; }
  .team-strip { top: 66px; gap: 3px; padding: 4px; }
  .team-strip--enemy { right: 12px; }
  .team-strip--player { left: 12px; }
  .team-pip { width: 38px; }
  .team-pip .pip-name { font-size: 5.5px; }
  .battle-unit--enemy { right: 3%; top: 17%; width: 36vw; height: 40vh; }
  .battle-unit--player { left: 2%; bottom: 27%; width: 38vw; height: 42vh; }
  .unit-hud { max-width: 260px; padding: 7px 9px 6px; }
  .unit-hud-name { font-size: 12px; }
  .battle-log { display: none; }
  .battle-bottom { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); }
  .battle-actions { grid-template-columns: minmax(0, 1fr) 112px; }
  .skill-card { min-height: 80px; padding: 8px 9px; }
  .skill-card__name { font-size: 11px; }
  .skill-card__desc { font-size: 7px; -webkit-line-clamp: 2; }
  .battle-action { padding: 6px 7px; }
  .ba-icon { width: 22px; height: 22px; }
}

@media (max-width: 700px) {
  :root { --header-h: 58px; }
  .game-header { padding: 0 12px; gap: 10px; }
  .brand-sigil { width: 28px; height: 28px; font-size: 11px; }
  .brand-word b { font-size: 12px; letter-spacing: .08em; }
  .header-resources { margin-left: auto; }
  .header-nav .nav-link[data-nav="team"] { display: none; }
  .header-nav { gap: 0; }
  .header-nav .icon-btn { width: 32px; height: 32px; margin-left: 3px; }
  .resource-chip { padding: 3px 6px; }
  .resource-chip b { font-size: 10px; }

  .title-layout { padding: 12vh 22px 16vh; align-items: center; }
  .eyebrow { font-size: 8px; }
  .logo-cn { font-size: clamp(66px, 20vw, 110px); }
  .logo-en { font-size: 8px; letter-spacing: .4em; margin-top: 12px; }
  .title-lead { margin-top: 18px; font-size: 15px; line-height: 1.85; }
  .title-sub { font-size: 7px; }
  .title-actions { margin-top: 28px; flex-direction: column; gap: 8px; }
  .title-actions .btn { width: 100%; min-height: 52px; }
  .title-actions .btn small { display: none; }
  .title-signature { margin-top: 22px; font-size: 8px; }
  .title-cast { opacity: .22; }
  .cast-figure--ren { left: 64%; width: 46vw; height: 45vh; }
  .cast-figure--mia { left: 33%; width: 36vw; height: 35vh; }
  .cast-figure--serena { right: 1%; width: 40vw; height: 42vh; }
  .title-moon { width: 150px; right: 2vw; top: 8vh; opacity: .42; }
  .title-footer { padding: 0 22px 16px; }
  .title-footer__right .text-btn { display: none; }
  .title-footer { font-size: 7px; }

  .story-stage { min-height: 520px; }
  .story-cast { inset: 0 0 18vh; }
  .story-actor { width: 42vw; height: 48vh; }
  .story-actor.is-npc { width: 52vw; height: 55vh; }
  .story-cast.is-crowded .story-actor { width: 34vw; height: 43vh; }
  .story-cast.is-crowded .story-actor.is-npc { width: 36vw; height: 47vh; }
  .story-dialogue { width: calc(100vw - 24px); min-height: 124px; padding: 15px 42px 17px 15px; gap: 10px; bottom: 24px; }
  .dialogue-portrait { width: 48px; min-width: 48px; height: 48px; }
  .dialogue-name { font-size: 12px; margin-bottom: 4px; }
  .dialogue-text { font-size: 13px; line-height: 1.8; min-height: 47px; }
  .dialogue-next { right: 10px; bottom: 13px; width: 28px; height: 28px; }
  .dialogue-progress { left: 15px; right: 42px; bottom: 6px; }
  .story-topbar { padding: 12px 14px; }
  .story-chapter b { font-size: 11px; }
  .story-btn { padding: 6px 8px; font-size: 8px; }
  .story-hint { display: none; }

  .hub-screen { padding: calc(var(--header-h) + 18px) 12px 24px; }
  .hub-heading h2 { font-size: 30px; }
  .hub-heading h2 small { display: block; margin: 6px 0 0; }
  .hub-heading p { font-size: 11px; }
  .hub-grid { gap: 10px; }
  .party-rail { padding: 15px 12px 12px; }
  .party-row { width: calc(50% - 3px); }
  .party-rail > .btn { min-width: 135px; font-size: 11px; }
  .map-top { padding: 15px 14px 10px; flex-direction: column; gap: 6px; }
  .map-legend { padding-top: 0; gap: 8px; font-size: 7px; }
  .map-frame { min-height: 440px; margin: 0 7px 7px; }
  .map-node { width: 64px; gap: 4px; }
  .node-orb { width: 34px; height: 34px; font-size: 9px; }
  .map-node .node-name { font-size: 8px; }
  .map-node.is-boss .node-orb { width: 31px; height: 31px; }
  .map-node .node-badge { right: -9px; top: -5px; font-size: 5px; min-width: 24px; }
  .map-caption { left: 12px; bottom: 12px; }
  .mission-panel { padding: 15px 13px 13px; }
  .mission-name { font-size: 23px; }
  .mission-no { font-size: 28px; }
  .mission-data { margin-top: 13px; }
  .enemy-preview { gap: 3px; }
  .enemy-chip .unit-art { width: 27px; height: 27px; }
  .enemy-chip small { font-size: 5px; }
  .hub-footer { flex-direction: column; align-items: flex-start; gap: 9px; padding: 11px 12px; }
  .hub-tip { flex-wrap: wrap; gap: 7px; }
  .hub-tip p { white-space: normal; font-size: 9px; }
  .hub-footer-actions { gap: 14px; }

  .team-screen { padding: calc(var(--header-h) + 18px) 12px 30px; }
  .team-heading h2 { font-size: 31px; }
  .team-heading p { font-size: 10px; }
  .team-heading__side { align-items: stretch; }
  .sand-panel { min-width: 92px; padding: 6px 10px; }
  .sand-panel b { font-size: 16px; }
  .team-heading__side .btn { font-size: 10px; padding: 7px 12px; }
  .roster { grid-template-columns: 1fr; gap: 9px; }
  .contract-card { min-height: 160px; display: grid; grid-template-columns: 130px minmax(0, 1fr); }
  .contract-card::before { background: linear-gradient(90deg, transparent 20%, rgba(8, 12, 19, .4) 55%, rgba(8, 12, 19, .94)); }
  .card-art { min-height: 150px; height: 100%; padding: 6px 0 0; }
  .card-art::before { width: 92%; }
  .card-art::after { display: none; }
  .card-body { padding: 13px 12px; align-self: end; }
  .card-name { font-size: 22px; }
  .card-spirit { margin-top: 6px; padding-top: 6px; }
  .card-level { top: 44px; }
  .unit-detail { padding: 15px 13px 16px; }
  .detail-head { grid-template-columns: 70px minmax(0, 1fr) auto; }
  .detail-portrait { width: 70px; height: 70px; }
  .detail-name h3 { font-size: 21px; }
  .detail-level b { font-size: 21px; }
  .detail-quote { font-size: 9px; }
  .stat-row > b { font-size: 9px; }
  .upgrade-box .btn { min-height: 40px; }
  .unit-detail .unit-hud { display: none; }

  .battle-frame { min-height: 580px; }
  .battle-top { padding: 9px 10px; }
  .battle-title span { font-size: 6px; }
  .battle-title b { font-size: 10px; }
  .battle-back { padding: 5px 7px; font-size: 8px; }
  .tool-btn { min-height: 29px; padding: 4px 7px; font-size: 7px; }
  .tool-btn--icon { width: 29px; }
  .tool-btn--speed { min-width: 30px; padding: 4px 5px; }
  .team-strip { top: 54px; gap: 2px; padding: 3px; }
  .team-strip--enemy { right: 7px; }
  .team-strip--player { left: 7px; }
  .team-pip { width: 28px; padding: 3px 2px 2px; }
  .team-pip .pip-name { display: none; }
  .team-pip .pip-hp { height: 2px; }
  .battle-arena { top: 45px; bottom: 170px; }
  .battle-unit--enemy { right: 0; top: 10%; width: 47vw; height: 35vh; min-height: 200px; }
  .battle-unit--player { left: -1%; bottom: 1%; width: 50vw; height: 37vh; min-height: 210px; }
  .unit-hud { max-width: 210px; padding: 5px 7px; }
  .unit-hud-name { font-size: 10px; }
  .unit-hud-title { display: none; }
  .unit-hud-el { width: 18px; height: 18px; font-size: 8px; }
  .unit-hp { height: 4px; }
  .unit-status { display: none; }
  .arena-ring--enemy { width: 65vw; height: 65vw; right: -10vw; top: 15%; }
  .arena-ring--player { width: 70vw; height: 70vw; left: -14vw; bottom: -4%; }
  .turn-banner { font-size: 10px; padding: 5px 12px; }
  .battle-bottom { padding: 8px 8px max(8px, env(safe-area-inset-bottom)); }
  .battle-actions { grid-template-columns: 1fr; gap: 6px; }
  .skill-grid { gap: 5px; }
  .skill-card { min-height: 67px; padding: 6px 7px; }
  .skill-card__top { gap: 4px; }
  .skill-card__el { width: 17px; height: 17px; font-size: 8px; }
  .skill-card__name { font-size: 10px; }
  .skill-card__cd { font-size: 6px; }
  .skill-card__desc { font-size: 6.5px; line-height: 1.35; -webkit-line-clamp: 2; }
  .skill-card__power { font-size: 6px; }
  .battle-side-actions { flex-direction: row; height: 38px; }
  .battle-action { flex: 1; padding: 4px 7px; gap: 5px; }
  .ba-icon { width: 19px; height: 19px; font-size: 10px; }
  .battle-action b { font-size: 9px; }
  .battle-action small { font-size: 5.5px; }
  .battle-drawer { width: 100vw; padding: 18px 14px; }
  .battle-log { display: none; }
  .damage-float { font-size: 22px; }
  .damage-float.is-crit { font-size: 30px; }

  .result-card { padding: 30px 18px 24px; margin: 4vh 0; }
  .result-emblem { width: 56px; height: 56px; font-size: 20px; margin-bottom: 12px; }
  .result-card h2 { font-size: 32px; }
  .result-subtitle { font-size: 10px; }
  .result-rewards { flex-wrap: wrap; margin-top: 17px; }
  .reward-item { padding: 6px 9px; }
  .result-stats { gap: 15px; }
  .result-actions .btn { min-width: 105px; font-size: 11px; padding: 8px 12px; }

  .modal-card { max-height: 86svh; }
  .modal-head { padding: 17px 17px 11px; }
  .modal-head h3 { font-size: 19px; }
  .modal-body { padding: 14px 17px; }
  .modal-actions { padding: 0 17px 17px; }
  .guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .logo-cn { font-size: 62px; }
  .title-lead { font-size: 14px; }
  .party-row { width: calc(50% - 3px); }
  .party-rail > .btn { grid-column: 1 / -1; margin-top: 10px; }
  .party-power { grid-column: 1; grid-row: auto; }
  .battle-unit--enemy { width: 50vw; }
  .battle-unit--player { width: 54vw; }
  .skill-card__desc { display: none; }
}

@media (max-height: 700px) and (min-width: 701px) {
  .title-layout { padding-top: 11vh; padding-bottom: 8vh; }
  .logo-cn { font-size: clamp(60px, 8vw, 110px); }
  .title-lead { margin-top: 12px; font-size: 16px; }
  .title-actions { margin-top: 20px; }
  .title-signature { margin-top: 18px; }
  .cast-figure--ren { height: 52vh; }
  .cast-figure--mia { height: 42vh; }
  .cast-figure--serena { height: 50vh; }
  .story-dialogue { min-height: 120px; padding-top: 16px; padding-bottom: 16px; }
  .story-actor { height: 54vh; }
  .battle-bottom { padding-top: 10px; }
  .battle-unit--enemy { height: 39vh; }
  .battle-unit--player { height: 41vh; }
}

@media (max-height: 620px) {
  body.mode-title { overflow-y: auto; }
  .title-screen { min-height: 620px; overflow-y: auto; }
  .title-layout { min-height: 620px; padding-top: 92px; padding-bottom: 100px; }
  .title-footer { position: absolute; bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
  .story-backdrop, .title-nebula, .title-moon, .cast-figure .unit-art { animation: none !important; }
}


