/* ==========================================================================
   ẤN NGUYỆT · CELESTIAL IMPERIAL GRIMOIRE UI (10-Round AAA Redesign)
   ========================================================================== */

/* ---------- ROUND 1: DESIGN SYSTEM, TYPOGRAPHY & COSMOS BACKDROP ---------- */
@font-face {
  font-family: Spectral;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/type/spectral-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: Spectral;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/type/spectral-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --void: #060911;
  --bg: #080d16;
  --surface-1: rgba(15, 22, 34, 0.82);
  --surface-2: rgba(20, 30, 46, 0.88);
  --surface-3: rgba(28, 41, 60, 0.92);
  --glass: rgba(12, 18, 29, 0.72);
  --ink: #faf3e3;
  --ink-soft: #d7d4c8;
  --sub: #9eaab8;
  --gold-bright: #ffe5a5;
  --gold: #eab967;
  --gold-deep: #a97c38;
  --jade: #5ce0b8;
  --crimson: #ff7a7a;
  --border-subtle: rgba(234, 185, 103, 0.16);
  --border-mid: rgba(234, 185, 103, 0.34);
  --border-bright: rgba(255, 229, 165, 0.65);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.62);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --serif: Spectral, "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Difficulty Escalation Spectrum */
  --tier-easy: #59e3a8;
  --tier-normal: #62c6ff;
  --tier-hard: #ffb74d;
  --tier-very-hard: #ff6e6e;
  --tier-nightmare: #d47bff;
  --tier-mythic: #ffd76a;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Layered Celestial Backdrop */
.cosmos-backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 55% at 18% -8%, rgba(44, 118, 106, 0.28), transparent 62%),
    radial-gradient(ellipse 65% 50% at 88% 12%, rgba(164, 112, 42, 0.20), transparent 60%),
    radial-gradient(ellipse 70% 60% at 50% 108%, rgba(74, 52, 130, 0.22), transparent 65%),
    linear-gradient(180deg, #070b14 0%, #0a111c 48%, #070a12 100%);
}
.cosmos-nebula {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 30% 35%, rgba(92, 224, 184, 0.08), transparent 32%),
    radial-gradient(circle at 72% 60%, rgba(234, 185, 103, 0.07), transparent 36%);
  filter: blur(42px);
  animation: nebula-drift 26s ease-in-out infinite alternate;
}
.cosmos-grid {
  position: absolute;
  inset: 0;
  opacity: 0.055;
  background-image:
    linear-gradient(rgba(234, 185, 103, 0.45) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234, 185, 103, 0.45) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 25%, #000, transparent 85%);
}
.cosmos-motes i {
  position: absolute;
  width: var(--size, 3px);
  height: var(--size, 3px);
  border-radius: 50%;
  background: radial-gradient(circle, #fff3c9, rgba(234, 185, 103, 0));
  box-shadow: 0 0 10px rgba(255, 223, 145, 0.7);
  opacity: 0;
  animation: mote-float var(--dur, 14s) ease-in-out var(--delay, 0s) infinite;
}
@keyframes nebula-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(2%, 2%, 0) scale(1.06); }
}
@keyframes mote-float {
  0%, 100% { opacity: 0; transform: translate3d(0, 18px, 0) scale(0.7); }
  30%, 70% { opacity: 0.7; }
  50% { transform: translate3d(12px, -24px, 0) scale(1.25); }
}

button, a, input, select { font: inherit; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; border: 0; background: transparent; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; }
.ico { width: 18px; height: 18px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Shared Premium Buttons & Badges */
.primary, .outline, .outline-pill, .ghost-btn, .gate, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 10px;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 180ms ease, border-color 180ms ease, background 180ms ease, filter 180ms ease;
}
.primary {
  position: relative;
  overflow: hidden;
  padding: 10px 24px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.015em;
  color: #1c1408;
  border: 1px solid #ffebba;
  background: linear-gradient(135deg, #ffe7a8 0%, #eab661 52%, #cf953d 100%);
  box-shadow:
    0 8px 24px rgba(234, 185, 103, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -2px 0 rgba(112, 68, 12, 0.35);
}
.primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.45) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}
.primary:enabled:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(234, 185, 103, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  filter: brightness(1.06);
}
.primary:enabled:hover::after { transform: translateX(120%); }
.primary:enabled:active { transform: translateY(0); }
.primary:disabled { opacity: 0.45; filter: grayscale(0.4); box-shadow: none; }

.ghost-btn, .outline, .outline-pill {
  padding: 9px 18px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--gold-bright);
  border: 1px solid var(--border-mid);
  background: linear-gradient(180deg, rgba(26, 38, 56, 0.72), rgba(14, 21, 33, 0.85));
  backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 232, 182, 0.12);
}
.ghost-btn:enabled:hover, .outline:enabled:hover, .outline-pill:enabled:hover {
  transform: translateY(-1px);
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(46, 56, 70, 0.85), rgba(20, 30, 44, 0.92));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 229, 165, 0.2);
}
.outline:disabled, .outline-pill:disabled, .ghost-btn:disabled { opacity: 0.42; color: var(--sub); }

.gate {
  padding: 10px 18px;
  color: #e4d5b6;
  background: rgba(15, 21, 31, 0.86);
  border: 1px solid rgba(180, 152, 106, 0.4);
  font-size: 13.5px;
  font-weight: 600;
}
.text-btn {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}
.text-btn:hover { color: var(--gold-bright); }

.eyeline {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
}
.eyeline .ico { width: 15px; height: 15px; }

/* Difficulty Pills */
.diff-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font: 700 11px/1.1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  background: rgba(8, 12, 20, 0.68);
  backdrop-filter: blur(8px);
}
.diff-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.diff-easy { color: var(--tier-easy); }
.diff-normal { color: var(--tier-normal); }
.diff-hard { color: var(--tier-hard); }
.diff-very-hard { color: var(--tier-very-hard); }
.diff-nightmare { color: var(--tier-nightmare); }
.diff-mythic { color: var(--tier-mythic); background: linear-gradient(135deg, rgba(84, 52, 12, 0.8), rgba(45, 20, 62, 0.8)); }

.boss-pill, .cleared-pill, .reward-pill, .trial-round-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font: 700 11px/1.1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.boss-pill { color: #ffcf87; border: 1px solid rgba(255, 122, 122, 0.55); background: rgba(98, 22, 30, 0.72); }
.boss-pill .ico { width: 13px; height: 13px; color: #ff9c6e; }
.cleared-pill { color: #8ff5c6; border: 1px solid rgba(92, 224, 184, 0.45); background: rgba(16, 62, 48, 0.72); }
.cleared-pill .ico { width: 13px; height: 13px; }
.reward-pill { color: var(--gold-bright); border: 1px solid rgba(234, 185, 103, 0.45); background: rgba(54, 40, 16, 0.7); }
.reward-pill .ico { width: 13px; height: 13px; }
.trial-round-pill { color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(15, 22, 36, 0.78); }


/* ---------- ROUND 2: FLOATING IMPERIAL GLASS HUD HEADER ---------- */
.imperial-hud {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(180deg, rgba(8, 12, 21, 0.92), rgba(10, 16, 27, 0.78));
  backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.42);
}
.imperial-hud::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(234, 185, 103, 0.55) 35%, rgba(92, 224, 184, 0.45) 65%, transparent);
  pointer-events: none;
}
.bar, main {
  width: min(100%, 1380px);
  margin-inline: auto;
  padding-inline: clamp(14px, 3.6vw, 48px);
}
.bar {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.2vw, 28px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
}
.brand #sigil {
  width: 36px;
  height: 40px;
  color: var(--gold-bright);
  display: flex;
  filter: drop-shadow(0 0 12px rgba(234, 185, 103, 0.45));
  transition: transform 240ms ease;
}
.brand:hover #sigil { transform: scale(1.06) rotate(-3deg); }
.brand svg { width: 100%; height: 100%; }
.brand-copy { display: flex; flex-direction: column; }
.brand-name {
  font: 600 25px/1.05 var(--serif);
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff8e6, #e8bc72);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub {
  font: 600 9.5px/1.2 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sub);
}

.hud-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 5px;
  border-radius: 999px;
  background: rgba(14, 21, 34, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.hud-nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--sub);
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.hud-nav .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  transition: opacity 180ms ease, transform 180ms ease;
}
.hud-nav button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.hud-nav button.active {
  color: #1c1306;
  background: linear-gradient(135deg, #ffe5a5, #e6b460);
  box-shadow: 0 4px 16px rgba(234, 185, 103, 0.35);
}
.hud-nav button.active .nav-dot { opacity: 1; background: #1c1306; transform: scale(1.15); }

.hud-tools { display: flex; align-items: center; gap: 10px; }
.hud-status { display: flex; align-items: center; gap: 8px; }
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 25, 40, 0.85);
}
.hud-pill small { font-weight: 500; opacity: 0.72; }
.hud-pill .ico { width: 14px; height: 14px; }
.energy.hud-pill { color: #8cf2c8; border-color: rgba(92, 224, 184, 0.34); background: rgba(15, 46, 40, 0.65); }
.energy.hud-pill:hover { border-color: var(--jade); box-shadow: 0 0 16px rgba(92, 224, 184, 0.22); }
.treasury.hud-pill { color: var(--gold-bright); border-color: rgba(234, 185, 103, 0.34); background: rgba(50, 38, 16, 0.55); }
.help {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-mid);
  background: rgba(18, 27, 42, 0.82);
  color: var(--gold-bright);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.help:hover { transform: scale(1.06); border-color: var(--gold-bright); box-shadow: 0 0 18px rgba(234, 185, 103, 0.25); }

main {
  padding-top: 24px;
  padding-bottom: 64px;
  outline: 0;
}

/* Topline & Campaign Progress */
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.map-link {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(20, 30, 46, 0.75);
  border: 1px solid var(--border-mid);
  color: var(--gold-bright);
  transition: all 180ms ease;
}
.map-link:hover { border-color: var(--gold-bright); background: rgba(34, 46, 66, 0.9); transform: translateX(2px); }

.campaign-ladder-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 24, 38, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.campaign-ladder-pill strong { color: var(--gold-bright); font-weight: 700; }
.ladder-bar {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.ladder-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold-bright));
  box-shadow: 0 0 10px rgba(92, 224, 184, 0.5);
}


/* ---------- ROUND 3: 10-ROUND PROGRESSIVE CLASSIC ARENA (#classic) ---------- */
.classic-arena-view { display: grid; gap: 22px; }

/* 10-Node Escalating Ladder */
.trial-ladder-wrap {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(16, 24, 38, 0.9), rgba(10, 15, 26, 0.94));
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 232, 182, 0.1);
  overflow-x: auto;
}
.trial-ladder {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, minmax(84px, 1fr));
  gap: 6px;
}
.trial-ladder::before {
  content: "";
  position: absolute;
  left: 42px;
  right: 42px;
  top: 23px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tier-easy), var(--tier-normal) 30%, var(--tier-hard) 55%, var(--tier-very-hard) 78%, var(--tier-mythic));
  opacity: 0.32;
}
.trial-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 4px 8px;
  border-radius: 12px;
  text-align: center;
  transition: transform 180ms ease, background 180ms ease;
}
.trial-node:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.04); }
.trial-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 15px/1 var(--serif);
  border: 2px solid var(--node-color, var(--gold));
  background: radial-gradient(circle at 35% 30%, rgba(36, 48, 70, 0.95), #0b101b);
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  transition: all 200ms ease;
}
.trial-orb .ico { width: 16px; height: 16px; }
.trial-node.tier-easy { --node-color: var(--tier-easy); }
.trial-node.tier-normal { --node-color: var(--tier-normal); }
.trial-node.tier-hard { --node-color: var(--tier-hard); }
.trial-node.tier-very-hard { --node-color: var(--tier-very-hard); }
.trial-node.tier-nightmare { --node-color: var(--tier-nightmare); }
.trial-node.tier-mythic { --node-color: var(--tier-mythic); }

.trial-node.done .trial-orb {
  background: linear-gradient(135deg, rgba(24, 88, 68, 0.95), rgba(14, 48, 40, 0.98));
  color: #9bf7cd;
}
.trial-node.locked .trial-orb {
  opacity: 0.52;
  border-style: dashed;
  color: var(--sub);
}
.trial-node.active {
  background: rgba(234, 185, 103, 0.11);
}
.trial-node.active .trial-orb {
  transform: scale(1.14);
  background: linear-gradient(135deg, var(--node-color), #1a1f2c);
  color: #0b0e16;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12), 0 0 24px var(--node-color);
}
.trial-node.mythic-boss .trial-orb {
  border-width: 2.5px;
  box-shadow: 0 0 20px rgba(255, 215, 106, 0.4);
}
.trial-tag { font-size: 12px; font-weight: 700; color: var(--ink); }
.trial-tier { font-size: 10px; font-weight: 700; color: var(--node-color); text-transform: uppercase; letter-spacing: 0.05em; }

/* Trial Hero Showcase */
.trial-hero {
  --aura: var(--tier-easy);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.9fr);
  gap: 24px;
  padding: clamp(22px, 3vw, 34px);
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--aura) 52%, transparent);
  background:
    linear-gradient(100deg, rgba(7, 11, 20, 0.94) 15%, rgba(10, 16, 28, 0.80) 56%, rgba(8, 12, 22, 0.88)),
    var(--scene) center 42% / cover no-repeat;
  box-shadow: var(--shadow-lg), 0 0 50px color-mix(in srgb, var(--aura) 14%, transparent);
}
.trial-hero.tier-easy { --aura: var(--tier-easy); }
.trial-hero.tier-normal { --aura: var(--tier-normal); }
.trial-hero.tier-hard { --aura: var(--tier-hard); }
.trial-hero.tier-very-hard { --aura: var(--tier-very-hard); }
.trial-hero.tier-nightmare { --aura: var(--tier-nightmare); }
.trial-hero.tier-mythic { --aura: var(--tier-mythic); }

.trial-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 90% at 15% 0%, color-mix(in srgb, var(--aura) 20%, transparent), transparent 65%);
  pointer-events: none;
}
.trial-hero-main { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.hero-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.trial-hero h1 {
  font: 600 clamp(32px, 4.4vw, 56px)/1.06 var(--serif);
  letter-spacing: -0.035em;
  color: #fff6e0;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.65);
}
.trial-desc { max-width: 56ch; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.trial-stats-row, .hero-intel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(8, 13, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: var(--sub);
}
.trial-stats-row span, .hero-intel span { display: inline-flex; align-items: center; gap: 6px; }
.trial-stats-row b, .hero-intel b { color: var(--ink); font-weight: 700; }
.trial-stats-row .ico, .hero-intel .ico { width: 15px; height: 15px; color: var(--aura, var(--gold)); }

.power-compare {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(12, 19, 32, 0.8);
  border: 1px solid rgba(234, 185, 103, 0.18);
}
.power-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--sub);
  margin-bottom: 7px;
}
.power-labels b { color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.power-labels em { font-style: normal; font-weight: 700; color: var(--aura); }
.power-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 110, 110, 0.25);
  overflow: hidden;
}
.power-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--gold-bright));
  box-shadow: 0 0 12px rgba(92, 224, 184, 0.6);
  transition: width 320ms ease;
}

.trial-actions, .hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.trial-foe-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 13, 22, 0.78);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.trial-foe-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.trial-foe-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 9px;
  background: rgba(18, 28, 44, 0.85);
  border: 1px solid var(--foil, rgba(255, 255, 255, 0.12));
  min-width: 0;
}
.trial-foe-chip img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  flex: none;
  border: 1px solid var(--suit, var(--gold));
}
.trial-foe-chip em {
  position: absolute;
  top: 2px;
  left: 2px;
  padding: 1px 5px;
  border-radius: 5px;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  background: rgba(8, 12, 20, 0.92);
  color: var(--gold-bright);
}
.trial-foe-chip span { min-width: 0; display: flex; flex-direction: column; }
.trial-foe-chip b { font: 600 12.5px/1.15 var(--serif); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trial-foe-chip small { font-size: 10.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.trial-foe-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.trial-foe-footer span { display: flex; flex-direction: column; gap: 2px; }
.trial-foe-footer small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sub); font-weight: 700; }
.trial-diff-stars { color: var(--aura, var(--gold-bright)); font-size: 14px; letter-spacing: 2px; }
.trial-gold-val { color: var(--gold-bright); font: 700 14px/1.2 var(--sans); }

/* Classic Deck Forge */
.classic-forge {
  padding: clamp(18px, 2.5vw, 28px);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(15, 23, 37, 0.9), rgba(10, 15, 25, 0.95));
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-md);
}
.forge-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.forge-header h2 { font-size: clamp(24px, 3vw, 34px); color: var(--gold-bright); margin-top: 4px; }
.forge-sub { color: var(--sub); font-size: 13px; margin-top: 4px; }

.preset-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 11px 14px;
  border-radius: 12px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(140deg, rgba(25, 37, 56, 0.72), rgba(14, 21, 34, 0.88));
  transition: all 180ms ease;
}
.preset-btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(234, 185, 103, 0.2);
}
.preset-btn b { font: 600 14.5px/1.2 var(--serif); color: var(--gold-bright); }
.preset-btn small { font-size: 11.5px; color: var(--sub); line-height: 1.35; }

.deck-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(7, 11, 19, 0.72);
  border: 1px dashed rgba(234, 185, 103, 0.28);
  margin-bottom: 20px;
}
.deck-empty-msg { grid-column: 1 / -1; text-align: center; color: var(--sub); padding: 14px; font-size: 13.5px; }
.deck-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  text-align: left;
  background: linear-gradient(145deg, var(--enamel, #1c2838), rgba(12, 18, 28, 0.95));
  border: 1px solid var(--foil, var(--border-mid));
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease;
}
.deck-chip:hover { transform: translateY(-2px); border-color: #ff8c8c; }
.deck-chip img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; flex: none; }
.deck-chip span { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.deck-chip b { font: 600 12.5px/1.15 var(--serif); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-chip small { font-size: 10px; color: var(--gold-bright); }
.chip-x { font-style: normal; font-size: 16px; color: var(--sub); padding-inline: 2px; }
.deck-chip:hover .chip-x { color: var(--crimson); }

.archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.archive-toolbar select, .toggle-chip {
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(12, 19, 31, 0.9);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.toggle-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--sub); }
.toggle-chip .ico { width: 15px; height: 15px; }
.toggle-chip[aria-pressed="true"] {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(68, 49, 18, 0.65);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.archive-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 12px;
  text-align: left;
  background: linear-gradient(140deg, rgba(22, 32, 49, 0.85), rgba(11, 17, 27, 0.95));
  border: 1px solid var(--foil, rgba(255, 255, 255, 0.12));
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.archive-card:enabled:hover {
  transform: translateY(-2px);
  border-color: var(--suit, var(--gold-bright));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}
.archive-card:disabled { opacity: 0.55; }
.archive-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 9px;
  overflow: hidden;
  flex: none;
  border: 1px solid var(--suit, var(--gold));
}
.archive-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.archive-stars {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  text-align: center;
  font-size: 9px;
  line-height: 1.3;
  color: #ffe39a;
  background: linear-gradient(0deg, rgba(6, 9, 16, 0.92), transparent);
}
.archive-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.archive-info b { font: 600 14.5px/1.15 var(--serif); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-meta { font-size: 11px; color: var(--sub); }
.archive-skill { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-skill.is-sim { color: var(--jade); }
.archive-skill.is-raw { color: #8c96a8; }
.archive-stats { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.archive-add {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid var(--border-mid);
  color: var(--gold-bright);
  background: rgba(234, 185, 103, 0.1);
}
.archive-card:enabled:hover .archive-add { background: var(--gold); color: #191205; }
.book-page {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--sub);
}
.book-page b { color: var(--gold-bright); }


/* ---------- ROUND 4: CINEMATIC JOURNEY HERO & EXPEDITION ROUTE ---------- */
.hero.chapter-landscape {
  --aura: var(--gold);
  position: relative;
  isolation: isolate;
  min-height: clamp(360px, 34vw, 460px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border-mid);
  border-bottom: 0;
  background:
    linear-gradient(96deg, rgba(6, 10, 18, 0.94) 6%, rgba(8, 14, 24, 0.72) 44%, rgba(8, 12, 22, 0.16) 76%),
    linear-gradient(0deg, rgba(7, 11, 19, 0.92), transparent 52%),
    var(--scene) 58% 45% / cover no-repeat;
  box-shadow: var(--shadow-lg);
}
.hero.tier-easy { --aura: var(--tier-easy); }
.hero.tier-normal { --aura: var(--tier-normal); }
.hero.tier-hard { --aura: var(--tier-hard); }
.hero.tier-very-hard { --aura: var(--tier-very-hard); }
.hero.tier-nightmare { --aura: var(--tier-nightmare); }

.hero-ornament {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px solid rgba(255, 226, 160, 0.16);
  border-radius: 13px;
  background:
    linear-gradient(var(--gold-bright), var(--gold-bright)) left top / 28px 2px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left top / 2px 28px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right top / 28px 2px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right top / 2px 28px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right bottom / 28px 2px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right bottom / 2px 28px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left bottom / 28px 2px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left bottom / 2px 28px;
  background-repeat: no-repeat;
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: min(64%, 680px);
  margin: clamp(26px, 3.6vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.chapter {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-bright);
}
.chapter i {
  display: inline-block;
  width: 26px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold-bright));
}
.hero-copy h1 {
  font: 600 clamp(40px, 5.4vw, 76px)/1.05 var(--serif);
  letter-spacing: -0.04em;
  color: #fff6e1;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.72);
}
.hero-copy p {
  max-width: 48ch;
  color: #e6e3d8;
  font-size: 15px;
  line-height: 1.58;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

/* Expedition Itinerary */
.itinerary {
  padding: 18px clamp(16px, 2.8vw, 34px) 20px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: 1px solid var(--border-mid);
  border-top: 1px solid rgba(234, 185, 103, 0.22);
  background: linear-gradient(135deg, rgba(16, 25, 39, 0.94), rgba(10, 16, 27, 0.96));
  box-shadow: var(--shadow-md);
}
.itinerary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.itinerary-heading > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 17px/1.2 var(--serif);
  color: var(--gold-bright);
}
.itinerary-heading strong { font-size: 12.5px; color: var(--jade); font-weight: 700; }
.expedition-route {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.expedition-route button.waypoint {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(12, 19, 31, 0.75);
  transition: all 180ms ease;
}
.expedition-route button.waypoint:hover {
  transform: translateY(-2px);
  border-color: var(--border-mid);
  background: rgba(24, 35, 54, 0.85);
}
.expedition-route button.waypoint.chosen {
  border-color: var(--gold-bright);
  background: linear-gradient(145deg, rgba(56, 44, 22, 0.55), rgba(18, 28, 44, 0.92));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 229, 165, 0.22);
}
.waypoint-rail { position: relative; display: flex; align-items: center; width: 100%; margin-bottom: 4px; }
.waypoint-rail::after {
  content: "";
  flex: 1;
  height: 1.5px;
  margin-left: 10px;
  background: linear-gradient(90deg, rgba(234, 185, 103, 0.45), transparent);
}
.waypoint:last-child .waypoint-rail::after { display: none; }
.waypoint .seal {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  background: rgba(14, 22, 36, 0.95);
  color: var(--sub);
}
.waypoint.cleared .seal { border-color: var(--jade); color: var(--jade); background: rgba(15, 52, 44, 0.85); }
.waypoint.chosen .seal {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, #ffe6a6, #d49c42);
  color: #191206;
  box-shadow: 0 0 16px rgba(234, 185, 103, 0.5);
}
.waypoint .seal .ico { width: 14px; height: 14px; }
.waypoint-meta { display: flex; align-items: center; gap: 7px; }
.waypoint small { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sub); }
.waypoint.chosen small { color: var(--gold-bright); }
.boss-mini {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(152, 34, 44, 0.55);
  color: #ffc5a8;
}
.waypoint b { font: 600 18px/1.2 var(--serif); color: var(--ink); }
.waypoint-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 4px; font-size: 11.5px; }
.waypoint-stars { color: var(--gold-bright); letter-spacing: 2px; }
.waypoint-hp { display: inline-flex; align-items: center; gap: 4px; color: var(--sub); }
.waypoint-hp .ico { width: 12px; height: 12px; color: var(--crimson); }
.mini-diff { font-style: normal; font-weight: 700; font-size: 10px; text-transform: uppercase; }

.resume-banner { margin-top: 12px; text-align: center; }

/* Sculpted Relic Camp Bar */
.journey-camp {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.journey-camp:has([data-act="thief"]) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.journey-camp button, .collection-actions button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(145deg, rgba(20, 30, 46, 0.85), rgba(11, 17, 29, 0.94));
  box-shadow: var(--shadow-md);
  transition: all 190ms ease;
}
.journey-camp button.camp-featured {
  border-color: rgba(234, 185, 103, 0.52);
  background: linear-gradient(135deg, rgba(58, 42, 18, 0.72), rgba(20, 28, 46, 0.94));
}
.journey-camp button.camp-alert {
  border-color: rgba(255, 118, 118, 0.55);
  background: linear-gradient(135deg, rgba(72, 22, 32, 0.7), rgba(18, 24, 38, 0.92));
}
.journey-camp button:enabled:hover, .collection-actions button:enabled:hover {
  transform: translateY(-3px);
  border-color: var(--gold-bright);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.48), 0 0 22px rgba(234, 185, 103, 0.14);
}
.journey-camp button:disabled { opacity: 0.48; }
.journey-camp button span b, .collection-actions button span b {
  display: block;
  font: 600 16px/1.2 var(--serif);
  color: var(--ink);
}
.journey-camp button span small, .collection-actions button span small {
  display: block;
  font-size: 11.5px;
  color: var(--sub);
  margin-top: 2px;
}
.camp-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--gold-bright);
  background: rgba(234, 185, 103, 0.1);
  border: 1px solid rgba(234, 185, 103, 0.3);
}
.camp-icon svg { width: 30px; height: 30px; }

.journey-deck { margin-top: 36px; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.section-head h2 {
  font-size: clamp(28px, 3.4vw, 42px);
  letter-spacing: -0.03em;
  color: #fff4da;
  margin-top: 4px;
}
.deck-capacity {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--sub);
}
.deck-capacity b { color: var(--gold-bright); }
.deck-capacity .ico { width: 15px; height: 15px; color: var(--gold); }


/* ---------- ROUND 5: COLLECTOR-GRADE 3D FOIL CARDS ---------- */
.suit-Forest { --suit: #72e8a8; --foil: #397a5e; --enamel: #102a24; }
.suit-Kingdom { --suit: #ffd980; --foil: #a8823c; --enamel: #2d2415; }
.suit-Hell { --suit: #c69cff; --foil: #7350a8; --enamel: #211635; }
.suit-Wildness { --suit: #ff9c6e; --foil: #a35c3c; --enamel: #2f1a14; }
.faction-crest { display: block; width: 17px; height: 17px; flex: none; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(12px, 1.4vw, 18px);
  align-items: stretch;
}
.spirit {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 5px;
  border-radius: 14px;
  border: 1.5px solid var(--foil);
  background: linear-gradient(155deg, var(--enamel), #0b101b 70%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-align: left;
  overflow: hidden;
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), border-color 220ms ease, box-shadow 220ms ease;
}
.spirit::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, var(--suit), transparent 45%, var(--foil));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.45;
  pointer-events: none;
}
.card-glare {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle 160px at var(--mx, 50%) var(--my, 30%), rgba(255, 245, 215, 0.24), transparent 72%);
  transition: opacity 220ms ease;
}
.spirit:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: var(--suit);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.65), 0 0 26px color-mix(in srgb, var(--suit) 28%, transparent);
}
.spirit:hover .card-glare { opacity: 1; }

/* Foil Shimmer for 4★ & 5★ Cards */
.foil-epic::after, .foil-mythic::after {
  content: "";
  position: absolute;
  inset: -40%;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 36%, rgba(255, 240, 190, 0.16) 47%, rgba(128, 240, 255, 0.14) 52%, transparent 64%);
  transform: translateX(-60%);
  animation: foil-sweep 6.5s ease-in-out infinite;
}
.foil-mythic {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.58), 0 0 18px rgba(255, 212, 110, 0.2);
}
@keyframes foil-sweep {
  0%, 72%, 100% { transform: translateX(-75%); }
  40% { transform: translateX(75%); }
}

.spirit .picture {
  position: relative;
  display: block;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.6);
  background: #0a1019;
}
.spirit .picture img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 22%;
  transition: transform 340ms ease;
}
.spirit:hover .picture img { transform: scale(1.06); }
.spirit.locked .picture img { filter: saturate(0.25) brightness(0.58); }

.crest-mount {
  position: absolute;
  top: 0;
  left: 9px;
  z-index: 2;
  width: 28px;
  height: 36px;
  display: grid;
  place-items: center;
  padding-bottom: 5px;
  background: linear-gradient(180deg, var(--foil), var(--enamel));
  color: var(--suit);
  clip-path: polygon(0 0, 100% 0, 100% 74%, 50% 100%, 0 74%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.rarity {
  color: #ffe396;
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.08em;
}
.spirit .rarity {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(8, 12, 20, 0.84);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 224, 145, 0.42);
}
.card-lv {
  position: absolute;
  left: 7px;
  bottom: 7px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 6px;
  font: 800 10.5px/1.2 var(--sans);
  background: linear-gradient(135deg, #ffe5a0, #cf943a);
  color: #1c1306;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}
.card-lock {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(9, 13, 21, 0.88);
  border: 1px solid rgba(234, 185, 103, 0.5);
  color: var(--gold-bright);
}
.card-lock .ico { width: 13px; height: 13px; }

.spirit .card-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 9px 8px 6px;
}
.spirit .affinity {
  color: var(--suit);
  font: 700 9.5px/1.2 var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.spirit .card-copy strong {
  margin: 3px 0 8px;
  color: #fff6e3;
  font: 600 clamp(16px, 1.35vw, 20px)/1.15 var(--serif);
}
.spirit .card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.spirit .skill { color: var(--sub); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { display: inline-flex; align-items: center; gap: 7px; flex: none; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font: 700 12px/1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.stat .ico { width: 13px; height: 13px; }
.atk { color: #ffcf7d; }
.hp { color: #ff99a4; }

/* Collection Masthead & Vault */
.collection-mast {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 158px;
  padding: 26px clamp(18px, 3vw, 38px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-mid);
  background: radial-gradient(ellipse at 85% 30%, rgba(92, 224, 184, 0.18), transparent 55%),
    linear-gradient(135deg, rgba(18, 29, 44, 0.94), rgba(10, 15, 26, 0.96));
  box-shadow: var(--shadow-lg);
}
.collection-mast > div:first-child { position: relative; z-index: 1; max-width: 70%; }
.collection-mast .page-title {
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.08;
  color: #fff5dc;
  margin: 6px 0 10px;
}
.roster-wallet { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.wallet-cap { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.roster-spread { position: absolute; right: 3.5%; top: 10%; height: 122%; width: 26%; pointer-events: none; }
.roster-spread img {
  position: absolute;
  height: 92%;
  width: 48%;
  object-fit: cover;
  border: 2px solid var(--gold);
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7);
}
.roster-spread img:first-child { left: 0; top: 10%; transform: rotate(-14deg); }
.roster-spread img:nth-child(2) { left: 22%; top: 0; transform: rotate(-2deg); z-index: 1; }
.roster-spread img:nth-child(3) { left: 46%; top: 10%; transform: rotate(12deg); }

.collection-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.collection-actions .ico { width: 24px; height: 24px; color: var(--gold-bright); }
.roster-vault { margin-top: 22px; }
.roster-scopes {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.roster-scopes button {
  padding: 10px 2px;
  font: 600 18px/1.2 var(--serif);
  color: var(--sub);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.roster-scopes button[aria-pressed="true"] { color: var(--gold-bright); border-bottom-color: var(--gold-bright); }
.roster-scopes b {
  font: 700 11px/1 var(--sans);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(234, 185, 103, 0.14);
  color: var(--gold-bright);
  margin-left: 5px;
}
.roster-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 8px;
}
.roster-search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 10px;
  background: rgba(11, 17, 29, 0.92);
  border: 1px solid var(--border-subtle);
}
.roster-search:focus-within { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(234, 185, 103, 0.16); }
.roster-search svg { width: 17px; height: 17px; color: var(--gold); flex: none; }
.roster-search input {
  width: 100%;
  min-height: 42px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}
.roster-search input::placeholder { color: #7e8b9e; }
.faction-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.faction-choices button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(16, 24, 38, 0.85);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.faction-choices button .faction-crest { color: var(--suit); }
.faction-choices button[aria-pressed="true"] {
  border-color: var(--suit, var(--gold-bright));
  color: var(--suit, var(--gold-bright));
  background: var(--enamel, rgba(56, 44, 20, 0.72));
}
@media (min-width: 641px) { .card-vault .filter { display: none; } }
@media (max-width: 640px) { .faction-choices { display: none; } }
.roster-results-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 2px 12px;
  font-size: 12.5px;
  color: var(--sub);
}
.roster-empty {
  text-align: center;
  padding: 36px 20px;
  border-radius: var(--radius-md);
  background: rgba(14, 21, 34, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--sub);
}
.roster-empty .ico { width: 28px; height: 28px; color: var(--gold); margin-bottom: 8px; }


/* ---------- ROUND 6: TACTICAL 3D-LIT BATTLEGROUND ARENA ---------- */
#app:has(.battle-shell) { padding-top: 14px; }
.battle-shell {
  max-width: 1020px;
  margin-inline: auto;
  display: grid;
  gap: 10px;
}

.encounter-head {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mid);
  background:
    linear-gradient(95deg, rgba(8, 13, 23, 0.94) 18%, rgba(12, 20, 32, 0.75) 58%, rgba(8, 13, 23, 0.92)),
    var(--encounter-land) center 48% / cover no-repeat;
  box-shadow: var(--shadow-md);
}
.encounter-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.encounter-head h1 {
  font: 600 clamp(22px, 3vw, 32px)/1.12 var(--serif);
  color: #fff6df;
  margin-top: 2px;
}
.encounter-right { display: flex; align-items: center; gap: 10px; flex: none; }
.retreat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sub);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(12, 18, 30, 0.76);
}
.retreat-btn:hover { color: #ffb3b3; border-color: rgba(255, 122, 122, 0.5); }
.retreat-btn .ico { width: 14px; height: 14px; }
.encounter-head .round {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9px;
  border: 1px solid var(--border-bright);
  background: linear-gradient(135deg, rgba(46, 36, 18, 0.88), rgba(16, 22, 34, 0.92));
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.encounter-head .round b { font-size: 16px; color: #fff; }

/* The War Table Arena */
.arena {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-mid);
  background: #0d1522;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 232, 182, 0.16);
}
.arena.arena-shake { animation: board-shake 280ms ease-out; }
@keyframes board-shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(-4px, 2px, 0); }
  50% { transform: translate3d(4px, -2px, 0); }
  75% { transform: translate3d(-2px, 1px, 0); }
}

.duel-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 16px;
}
.duel-banner.foe {
  background: linear-gradient(95deg, rgba(64, 24, 30, 0.92), rgba(18, 22, 34, 0.95) 56%, rgba(14, 19, 30, 0.96));
  border-bottom: 1px solid rgba(255, 130, 118, 0.34);
}
.duel-banner.ally {
  background: linear-gradient(95deg, rgba(16, 52, 46, 0.92), rgba(16, 24, 36, 0.95) 56%, rgba(12, 19, 30, 0.96));
  border-top: 1px solid rgba(92, 224, 184, 0.34);
}
.foe-banner-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

/* Non-overlapping Docked Enemy Reserve Hand */
.enemy-hand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(255, 152, 132, 0.25);
}
.enemy-hand > small { font-size: 10.5px; font-weight: 700; color: #f0beac; text-transform: uppercase; letter-spacing: 0.06em; }
.enemy-hand-tray { display: flex; align-items: center; gap: 4px; }
.enemy-hand-tray .empty-tray { color: var(--sub); font-size: 11px; }
.enemy-hand-tray > span {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  overflow: visible;
  border: 1px solid rgba(255, 174, 146, 0.6);
  background: #141a26;
}
.enemy-hand-tray img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }
.enemy-hand-tray b {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 800;
  background: #15101a;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
}

/* Commander Meters */
.arena .meter {
  --metal: var(--jade);
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 11px;
}
.arena .meter.enemy { --metal: #ff8f7d; }
.hero-sigil {
  position: relative;
  isolation: isolate;
  width: 40px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 96% 18%, 88% 78%, 50% 100%, 12% 78%, 4% 18%);
  background: linear-gradient(155deg, var(--gold), #182332);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}
.hero-sigil::after {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: inherit;
  background: url("assets/crest-ally.webp") center / cover no-repeat;
}
.meter.enemy .hero-sigil::after { background-image: url("assets/crest-foe.webp"); }
.hero-sigil svg { width: 22px; height: 22px; opacity: 0; }

.duel-vitals { flex: 1; min-width: 0; }
.duel-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.commander-side {
  display: inline-block;
  margin-right: 7px;
  font: 700 9.5px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--metal);
}
.duel-name b { font: 600 clamp(14px, 1.6vw, 18px)/1.15 var(--serif); color: #fff6e0; }
.duel-name strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 800 clamp(14px, 1.7vw, 18px)/1 var(--sans);
  font-variant-numeric: tabular-nums;
  color: #fff;
  white-space: nowrap;
}
.duel-name strong .ico { width: 13px; height: 13px; color: var(--metal); }
.duel-name strong small { font-size: 11px; color: var(--sub); font-weight: 600; }

.arena .track {
  position: relative;
  display: block;
  width: 100%;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: rgba(5, 8, 14, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.arena .track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #279476, #6ef0c2);
  box-shadow: 0 0 14px rgba(92, 224, 184, 0.55);
  transition: width 320ms cubic-bezier(.2,.8,.2,1);
}
.arena .meter.enemy .track i {
  background: linear-gradient(90deg, #b83333, #ff8775);
  box-shadow: 0 0 14px rgba(255, 120, 108, 0.55);
}
.arena .track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(20% - 1px), rgba(0, 0, 0, 0.35) calc(20% - 1px) 20%);
  pointer-events: none;
}

.piles { display: flex; align-items: center; gap: 6px; flex: none; }
.pile-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--sub);
  background: rgba(9, 14, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-variant-numeric: tabular-nums;
}
.pile-pill b { color: var(--ink); font-weight: 800; }
.pile-pill .ico { width: 13px; height: 13px; color: var(--gold); }
.pile-grave { color: var(--gold-bright); border-color: rgba(234, 185, 103, 0.28); }
.pile-grave:hover { border-color: var(--gold-bright); background: rgba(44, 34, 18, 0.72); }

/* Battlefield Board */
.duel-field {
  position: relative;
  padding: 14px clamp(12px, 3vw, 34px);
  background:
    radial-gradient(ellipse 80% 50% at 50% 50%, rgba(234, 185, 103, 0.09), transparent 70%),
    linear-gradient(180deg, rgba(9, 14, 24, 0.65), rgba(10, 16, 26, 0.38) 50%, rgba(9, 14, 24, 0.72)),
    url("assets/duel-painted.webp") center 50% / cover no-repeat;
}
.arena .lanes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1.2vw, 14px);
  max-width: 780px;
  margin-inline: auto;
}
.arena :is(.unit, .empty) {
  width: 100%;
  min-width: 0;
  height: clamp(92px, 14vw, 128px);
  border-radius: 12px;
}

.arena .empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px dashed rgba(205, 195, 165, 0.26);
  background: rgba(8, 13, 22, 0.48);
  backdrop-filter: blur(4px);
  color: rgba(215, 212, 200, 0.42);
  font-size: 11px;
  font-weight: 700;
  transition: all 180ms ease;
}
.arena .foe-empty { border-color: rgba(255, 140, 124, 0.24); background: rgba(36, 16, 20, 0.34); }
.slot-num { font: 600 16px/1 var(--serif); opacity: 0.35; }

.arena .ally-ranks button:is(.suggested, .available, .drop-target) {
  border: 2px solid var(--gold-bright);
  background: radial-gradient(circle at 50% 35%, rgba(234, 185, 103, 0.38), rgba(16, 46, 38, 0.85));
  color: #fff3cb;
  box-shadow: 0 0 24px rgba(234, 185, 103, 0.36), inset 0 0 18px rgba(255, 232, 165, 0.22);
  animation: portal-pulse 2s ease-in-out infinite;
}
.arena .ally-ranks button:is(.suggested, .available, .drop-target) .ico {
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-bright);
  background: rgba(16, 24, 34, 0.88);
  color: var(--gold-bright);
}
.arena .ally-ranks .drop-hover {
  transform: scale(1.04);
  background: radial-gradient(circle at 50% 40%, rgba(255, 224, 140, 0.56), rgba(32, 66, 52, 0.92));
}
@keyframes portal-pulse {
  0%, 100% { box-shadow: 0 0 16px rgba(234, 185, 103, 0.3), inset 0 0 12px rgba(255, 232, 165, 0.16); }
  50% { box-shadow: 0 0 28px rgba(234, 185, 103, 0.58), inset 0 0 20px rgba(255, 232, 165, 0.32); }
}

/* Field Units */
.arena .unit {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0;
  text-align: left;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  background: #0f1826;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.56);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.arena .foe-ranks .unit { border-color: rgba(255, 146, 128, 0.72); border-top: 3px solid #ff8c7a; }
.arena .ally-ranks .unit { border-color: rgba(114, 232, 184, 0.72); border-bottom: 3px solid var(--jade); }
.arena .unit:hover { transform: translateY(-3px) scale(1.02); z-index: 2; box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7); }
.arena .unit.is-frozen { filter: saturate(0.75) hue-rotate(15deg); box-shadow: 0 0 18px rgba(100, 210, 255, 0.5); }
.arena .unit.is-paralyzed { box-shadow: 0 0 18px rgba(255, 224, 100, 0.5); }
.arena .unit img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  z-index: -2;
}
.arena .unit::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.1) 18%, rgba(6, 10, 18, 0.55) 55%, rgba(6, 10, 18, 0.96) 92%);
}
.unit-status-chip {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 11px;
  background: rgba(8, 14, 24, 0.88);
  border: 1px solid rgba(145, 225, 255, 0.5);
}
.unit-hp-strip {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 5px;
  height: 3.5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  overflow: hidden;
  z-index: 1;
}
.unit-hp-strip i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #43d99d, #a5ffdb);
  transition: width 260ms ease;
}
.foe-ranks .unit-hp-strip i { background: linear-gradient(90deg, #e84b4b, #ffa596); }
.arena .unit-caption {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 6px 7px;
  gap: 3px;
}
.arena .unit-caption b {
  font: 600 clamp(11px, 1.3vw, 14px)/1.12 var(--serif);
  color: #fff6e0;
  text-shadow: 0 2px 4px #000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.arena .unit .stat { font-size: clamp(10.5px, 1.15vw, 12.5px); }
.arena .unit .stat .ico { width: 11px; height: 11px; }

/* Formation Line */
.arena .formation-line {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(6px, 1.2vw, 14px);
  max-width: 780px;
  margin: 7px auto;
  min-height: 24px;
  align-items: center;
}
.formation-line .line-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 22px;
  border-radius: 999px;
  font: 700 11px/1 var(--sans);
  color: var(--sub);
  background: rgba(8, 13, 23, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.formation-line .line-mark .ico { width: 13px; height: 13px; }
.formation-line .line-mark.contested {
  color: var(--gold-bright);
  border-color: rgba(234, 185, 103, 0.55);
  background: linear-gradient(90deg, rgba(96, 46, 22, 0.8), rgba(56, 42, 16, 0.88));
  box-shadow: 0 0 12px rgba(234, 185, 103, 0.25);
}
.formation-line .line-mark.next {
  color: var(--jade);
  border-color: rgba(92, 224, 184, 0.5);
}

/* Facing lane highlight when summoning */
.duel-field:has(.ally-ranks > :nth-child(1):is(.available,.drop-hover,:focus-visible)) .foe-ranks > :nth-child(1),
.duel-field:has(.ally-ranks > :nth-child(2):is(.available,.drop-hover,:focus-visible)) .foe-ranks > :nth-child(2),
.duel-field:has(.ally-ranks > :nth-child(3):is(.available,.drop-hover,:focus-visible)) .foe-ranks > :nth-child(3),
.duel-field:has(.ally-ranks > :nth-child(4):is(.available,.drop-hover,:focus-visible)) .foe-ranks > :nth-child(4),
.duel-field:has(.ally-ranks > :nth-child(5):is(.available,.drop-hover,:focus-visible)) .foe-ranks > :nth-child(5) {
  outline: 2px solid var(--gold-bright);
  outline-offset: -2px;
}


/* ---------- ROUND 7: TACTILE HAND DOCK & ARCANE COMMAND PANEL ---------- */
.battle-dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.battle-dock:has(.command-panel) {
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  align-items: stretch;
}
.hand-console, .command-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-mid);
  background: linear-gradient(145deg, rgba(16, 25, 40, 0.92), rgba(10, 16, 27, 0.96));
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 232, 182, 0.1);
}
.hand-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  grid-template-areas: "heading controls" "cards controls";
  gap: 10px 14px;
  padding: 12px 14px;
  align-items: center;
}
.hand-console .hand-title {
  grid-area: heading;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.hand-console .hand-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 18px/1.15 var(--serif);
  color: var(--gold-bright);
}
.hand-console .hand-title .ico { width: 17px; height: 17px; }
.hand-status {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sub);
  background: rgba(255, 255, 255, 0.06);
}
.hand-status.can-play { color: var(--jade); background: rgba(20, 68, 54, 0.72); }
.hand-console #hint {
  flex-basis: 100%;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.battle-countdown { color: var(--gold-bright); font-variant-numeric: tabular-nums; }

.hand-console .hand {
  grid-area: cards;
  display: grid;
  grid-template-columns: repeat(var(--hand-count), minmax(0, 1fr));
  gap: 8px;
  max-width: calc(122px * var(--hand-count));
}
.hand-card {
  --suit: var(--gold);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 3px 3px 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(155deg, rgba(24, 34, 52, 0.96), #0d1420);
  text-align: left;
  min-width: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), border-color 180ms ease, box-shadow 180ms ease;
}
.hand-card.f-Forest { --suit: #72e8a8; }
.hand-card.f-Kingdom { --suit: #ffd980; }
.hand-card.f-Hell { --suit: #c69cff; }
.hand-card.f-Wildness { --suit: #ff9c6e; }
.hand-card[data-hand]:enabled { touch-action: none; user-select: none; cursor: grab; }
.hand-card img { -webkit-user-drag: none; pointer-events: none; }
.hand-card.drag-source { opacity: 0.45; }

.hand-card .hand-art {
  display: block;
  width: 100%;
  border-radius: 7px;
  overflow: hidden;
  border-bottom: 1px solid var(--suit);
}
.hand-card .hand-art img {
  display: block;
  width: 100%;
  aspect-ratio: 1.2;
  object-fit: cover;
  object-position: center 22%;
}
.hand-card > b {
  margin: 4px 4px 0;
  font: 600 12px/1.15 var(--serif);
  color: #fff6e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hand-card .stats { margin: 3px 4px 5px; gap: 6px; }
.hand-card .stat { font-size: 10.5px; }
.hand-card .stat .ico { width: 10px; height: 10px; }
.hand-card .countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
  margin: auto -3px 0;
  font: 700 10.5px/1 var(--sans);
  background: rgba(16, 26, 40, 0.92);
  color: var(--sub);
}
.hand-card .countdown svg { width: 11px; height: 11px; }
.hand-card.ready {
  border-color: var(--jade);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 14px rgba(92, 224, 184, 0.2);
}
.hand-card.ready .countdown { background: linear-gradient(90deg, #1b5e4c, #247b63); color: #d9fff0; }
.hand-card.ready:hover { transform: translateY(-5px); border-color: var(--gold-bright); }
.hand-card.picked {
  transform: translateY(-7px);
  border-color: var(--gold-bright);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6), 0 0 22px rgba(234, 185, 103, 0.5);
}
.hand-card.picked .countdown { background: linear-gradient(90deg, #ffe39c, #dfb059); color: #1d1406; }
.hand-card.waiting img { filter: saturate(0.55) brightness(0.76); }

.hand-console .actions {
  grid-area: controls;
  display: grid;
  gap: 8px;
}
.hand-console .actions button { width: 100%; min-height: 44px; padding-inline: 12px; font-size: 13.5px; }
.hand-console .actions .primary { grid-row: 1; }
.actions [data-act="auto"][aria-pressed="true"] {
  border-color: var(--jade);
  color: var(--jade);
  background: rgba(15, 52, 44, 0.72);
}
.drag-portrait {
  position: fixed;
  z-index: 60;
  width: 88px;
  aspect-ratio: 4/5;
  object-fit: cover;
  border: 2px solid var(--gold-bright);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.8), 0 0 24px rgba(234, 185, 103, 0.5);
  pointer-events: none;
  transform: translate(-50%, -65%) rotate(-4deg);
}

/* Arcane Command Spells Panel */
.command-panel { padding: 12px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.command-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.command-line h3 { display: inline-flex; align-items: center; gap: 6px; font: 600 17px/1.1 var(--serif); color: var(--gold-bright); }
.command-line .ico { width: 16px; height: 16px; }
.command-line span { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.command-line .is-ready { background: rgba(20, 68, 54, 0.75); color: var(--jade); }
.command-line .is-wait { background: rgba(255, 255, 255, 0.08); color: var(--sub); }

.command-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.command-panel .command {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  text-align: left;
  border: 1px solid rgba(234, 185, 103, 0.45);
  background: linear-gradient(145deg, rgba(64, 46, 18, 0.72), rgba(22, 24, 34, 0.92));
  color: var(--gold-bright);
  transition: all 170ms ease;
}
.command-panel .command.mend {
  border-color: rgba(92, 224, 184, 0.45);
  background: linear-gradient(145deg, rgba(16, 62, 50, 0.72), rgba(16, 26, 36, 0.92));
  color: #a9fbd8;
}
.command-panel .command:enabled:hover { transform: translateY(-2px); filter: brightness(1.12); }
.command-panel .command:disabled { opacity: 0.45; filter: grayscale(0.5); }
.command-panel .command[aria-pressed="true"] { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.command .ico { width: 22px; height: 22px; flex: none; }
.command-panel .command b { display: block; font-size: 13px; }
.command-panel .command small { display: block; font-size: 10.5px; color: var(--ink-soft); line-height: 1.25; }

.command-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}
.command-choices > strong { width: 100%; font-size: 12px; color: var(--gold-bright); }
.command-choices button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 6px;
  border-radius: 9px;
  border: 1px solid var(--border-mid);
  background: rgba(20, 32, 48, 0.9);
  color: var(--ink);
  font-size: 12px;
  text-align: left;
}
.command-choices button:hover { border-color: var(--gold-bright); }
.command-choices img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.command-choices small { display: block; font-size: 10px; color: var(--sub); }
.cancel-command { color: #ffb3b3 !important; border-color: rgba(255, 122, 122, 0.4) !important; }

.battle-footer-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.rune-state, .last-event {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  background: rgba(13, 20, 33, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
}
.rune-state .ico { color: var(--gold-bright); width: 16px; height: 16px; }
.rune-state b { color: var(--gold-bright); }
.rune-state.awakened { border-color: var(--gold-bright); box-shadow: 0 0 20px rgba(234, 185, 103, 0.35); }
.last-event { border-left: 3px solid var(--gold); color: var(--gold-bright); }


/* ---------- ROUND 8: CINEMATIC COMBAT CHOREOGRAPHY & BATTLE HISTORY ---------- */
.arena.clash-playing { --strike-light: #ffe28c; --strike-edge: #d49d45; }
.arena.clash-playing.enemy-strike { --strike-light: #ff9c82; --strike-edge: #d1564a; }
.arena .divider.strike-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: 780px;
  min-height: 46px;
  margin: 6px auto;
  padding: 5px 12px;
  border-radius: 12px;
  border: 1px solid var(--strike-edge);
  background: linear-gradient(90deg, rgba(16, 30, 44, 0.94), rgba(10, 15, 24, 0.96) 50%, rgba(44, 24, 24, 0.94));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
}
.strike-party { display: flex; align-items: center; gap: 8px; min-width: 0; }
.strike-party img, .strike-party .strike-hero {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  flex: none;
  border: 1.5px solid var(--strike-edge);
  background: #141f2e;
}
.strike-party .strike-hero { display: grid; place-items: center; color: var(--strike-light); }
.strike-party small, .strike-counter small { display: block; font-size: 10px; color: var(--sub); font-weight: 700; text-transform: uppercase; }
.strike-party b { font: 600 15px/1.1 var(--serif); color: #fff6e1; }
.strike-counter { display: grid; place-items: center; gap: 1px; color: var(--strike-light); }
.strike-counter .ico { width: 18px; height: 18px; }

.clash-playing .clash-source { opacity: 0.35; outline: 2px solid var(--strike-light); }
.arena .clash-actor {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8), 0 0 28px var(--strike-light);
}
.clash-playing .strike-trace {
  position: absolute;
  z-index: 4;
  height: 4px;
  border-radius: 999px;
  pointer-events: none;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, transparent, var(--strike-light) 40%, #fff 82%, transparent);
  box-shadow: 0 0 14px var(--strike-light);
}
.clash-playing .clash-hit {
  outline: 2.5px solid var(--strike-light);
  animation: clash-impact 340ms ease-out;
}
@keyframes clash-impact {
  25% { transform: rotate(-3deg) scale(0.94); filter: brightness(1.9); }
  65% { transform: rotate(2deg); }
}
.impact-ring {
  position: absolute;
  z-index: 8;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--strike-light);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.4);
  animation: shockwave 420ms ease-out forwards;
}
@keyframes shockwave {
  to { transform: translate(-50%, -50%) scale(4.2); opacity: 0; }
}
.clash-damage {
  position: absolute;
  z-index: 9;
  pointer-events: none;
  transform: translate(-50%, -50%);
  padding: 4px 11px;
  border-radius: 8px;
  font: 800 clamp(18px, 2.3vw, 28px)/1.1 var(--sans);
  color: #fff6e5;
  background: linear-gradient(145deg, #b82d2d, #68141c);
  border: 1.5px solid #ffd89b;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.72), 0 0 16px rgba(255, 110, 90, 0.55);
  animation: damage-pop 460ms cubic-bezier(.2,.9,.3,1) both;
}
.clash-damage.is-blocked {
  background: linear-gradient(145deg, #32465f, #1a2434);
  border-color: #9dc8ff;
  font-size: 16px;
}
@keyframes damage-pop {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.6); }
  45% { opacity: 1; transform: translate(-50%, -62%) scale(1.16); }
  100% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
}

.duel-delta {
  --effect-ink: #ffd1be;
  --effect-bg: #7a2323;
  position: absolute;
  z-index: 5;
  top: 5px;
  right: 5px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--effect-ink);
  background: var(--effect-bg);
  color: var(--effect-ink);
  font: 800 12px/1.2 var(--sans);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: duel-amount 320ms ease-out both;
}
.duel-delta.healing { --effect-ink: #c6ffe2; --effect-bg: #185e43; }
.duel-delta.summoned { --effect-ink: #ffeaad; --effect-bg: #6b4b16; }
.arena .meter .duel-delta { top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); }
@keyframes duel-amount {
  from { opacity: 0; transform: translateY(6px) scale(0.88); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Combat History Drawer */
.combat-history {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(12, 18, 30, 0.85);
  overflow: hidden;
}
.combat-history > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--gold-bright);
}
.combat-history > summary::-webkit-details-marker { display: none; }
.combat-history > summary > b { font: 600 17px/1.2 var(--serif); }
.combat-history > summary > span { margin-left: auto; font-size: 12px; color: var(--sub); }
.combat-history[open] > summary { background: rgba(24, 34, 52, 0.72); border-bottom: 1px solid var(--border-subtle); }
.combat-history[open] > summary > .ico:last-child { transform: rotate(90deg); }
.record-pages { padding: 4px 16px 14px; }
.record-round {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.record-round:last-of-type { border: 0; }
.record-round h3 { grid-column: 1; grid-row: 1 / 3; font: 600 15px/1.3 var(--serif); color: var(--gold); }
.record-round ol { grid-column: 2; list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.record-round li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-soft);
}
.record-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(20, 30, 46, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--jade);
}
.record-mark .ico { width: 12px; height: 12px; }
.record-hit .record-mark { color: var(--gold-bright); border-color: rgba(234, 185, 103, 0.45); }
.record-lost .record-mark { color: var(--crimson); border-color: rgba(255, 122, 122, 0.45); }
.record-spell .record-mark { color: #8ad8ff; border-color: rgba(120, 210, 255, 0.45); }
.record-hit b { color: #fff; }
.record-hit strong { color: #ffb3a1; font-weight: 700; }
.record-round > p { grid-column: 2; margin-top: 6px; padding-left: 33px; font-size: 12px; color: var(--sub); }
.history-more { margin-top: 10px; }


/* ---------- ROUND 9: ROYAL GRIMOIRE MODALS ---------- */
dialog {
  padding: 0;
  color: var(--ink);
  background: linear-gradient(160deg, #111a2b, #090e18);
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-lg);
  width: min(500px, calc(100vw - 24px));
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.85), 0 0 40px rgba(234, 185, 103, 0.12);
}
dialog::backdrop {
  background: rgba(3, 6, 12, 0.78);
  backdrop-filter: blur(8px);
}
dialog[open] { animation: modal-rise 220ms cubic-bezier(.2,.85,.25,1); }
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
#dialog-body { position: relative; }
.dialog-x {
  position: absolute;
  z-index: 6;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(8, 12, 21, 0.86);
  border: 1px solid var(--border-mid);
  color: var(--gold-bright);
  backdrop-filter: blur(8px);
}
.dialog-x:hover { border-color: var(--gold-bright); background: rgba(32, 42, 60, 0.95); transform: rotate(90deg); }
.modal-pad { padding: 28px; }
.modal-pad h2 { font-size: 32px; line-height: 1.12; color: #fff5dd; margin: 6px 0 12px; padding-right: 34px; }
.modal-pad p { color: var(--ink-soft); margin: 8px 0; }
.modal-wallet { margin: 16px 0; }
.modal-pad .primary { margin-top: 12px; width: 100%; }

/* Rules, Runes, Swap, Graveyard, Chronicle */
.rules { padding-left: 20px; color: var(--ink-soft); display: grid; gap: 10px; margin: 14px 0 20px; }
.rules b { color: var(--gold-bright); }
.rune-list { display: grid; gap: 10px; margin-top: 16px; }
.rune-list button {
  padding: 14px 16px;
  border-radius: 12px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  background: rgba(16, 25, 40, 0.82);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rune-list button b { font: 600 17px/1.2 var(--serif); color: var(--ink); }
.rune-list button span { font-size: 13px; color: var(--sub); }
.rune-list button[aria-pressed="true"] {
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, rgba(64, 46, 18, 0.65), rgba(18, 28, 44, 0.92));
}
.rune-list button[aria-pressed="true"] b { color: var(--gold-bright); }

.replace { display: grid; gap: 8px; margin-top: 16px; }
.replace button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(16, 25, 40, 0.82);
  text-align: left;
}
.replace button:enabled:hover { border-color: var(--gold); }
.replace img { width: 42px; height: 42px; border-radius: 7px; object-fit: cover; }
.replace .ico { margin-left: auto; color: var(--gold); }
.grave-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grave-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; background: rgba(18, 26, 40, 0.82); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 13px; }
.grave-list img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.chronicle details { border-bottom: 1px solid var(--border-subtle); padding: 10px 0; }
.chronicle summary { font: 600 16px/1.3 var(--serif); color: var(--gold-bright); cursor: pointer; }
.source { color: var(--gold-bright); text-decoration: underline; }
.archival { margin: 14px 0; }
.archival img { width: 100%; border-radius: 10px; border: 1px solid var(--border-subtle); }
.archival figcaption { font-size: 12.5px; color: var(--gold); margin-top: 4px; }

/* Card Folio Dossier */
dialog:has(.folio) { width: min(840px, calc(100vw - 24px)); overflow: hidden; }
.folio {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  max-height: calc(90dvh - 4px);
  overflow-y: auto;
  background: radial-gradient(ellipse at top left, var(--enamel), transparent 62%), linear-gradient(160deg, #101a2a, #090e18);
}
.folio-visual { padding: 24px 0 24px 24px; }
.folio-mount {
  position: relative;
  padding: 6px;
  border-radius: 14px;
  border: 1.5px solid var(--suit);
  background: var(--enamel);
  box-shadow: var(--shadow-lg);
}
.folio-mount .detail-art { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; }
.folio-body { padding: 26px 26px 24px; min-width: 0; }
.folio-line { display: flex; align-items: center; gap: 10px; margin-right: 36px; }
.folio-line > span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--suit); font: 700 11px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.14em; }
.folio-body h2 { margin: 8px 0 2px; font: 600 clamp(28px, 3.6vw, 42px)/1.08 var(--serif); color: #fff6e0; }
.folio-alias { color: var(--sub); font: italic 15px/1.4 var(--serif); }
.folio-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(8, 13, 23, 0.72);
  border: 1px solid var(--border-subtle);
}
.folio-stats dt { font: 700 10px/1.3 var(--sans); text-transform: uppercase; letter-spacing: 0.1em; color: var(--sub); }
.folio-stats dd { display: flex; align-items: center; gap: 5px; margin: 4px 0 0; font: 700 16px/1.1 var(--sans); }
.folio-stats .ico { width: 14px; height: 14px; color: var(--gold); }
.folio-body section { padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.folio-body section:last-child { border: 0; padding-bottom: 0; }
.folio-body h3 { color: var(--suit); font-size: 20px; margin-bottom: 4px; }
.folio-body p { font-size: 13.5px; color: var(--ink-soft); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.detail-actions .upgrade-cta:enabled {
  background: linear-gradient(135deg, #ffe5a5, #e2ae55);
  color: #1c1306;
  border-color: #fff0c4;
  font-weight: 700;
}
.folio .folio-jump { display: none; }

/* Battle Briefing Modal */
dialog:has(.battle-briefing) { width: min(640px, calc(100vw - 24px)); overflow: hidden; }
.battle-briefing { display: flex; flex-direction: column; max-height: calc(90dvh - 4px); }
.briefing-cover {
  display: flex;
  align-items: flex-end;
  min-height: 175px;
  padding: 22px 26px 18px;
  background:
    linear-gradient(0deg, #0d1523 4%, rgba(13, 21, 35, 0.35) 70%),
    linear-gradient(95deg, rgba(8, 12, 21, 0.85), transparent 72%),
    var(--scene) center 45% / cover no-repeat;
}
.briefing-top-badges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.briefing-cover h2 { font: 600 clamp(30px, 4.5vw, 44px)/1.08 var(--serif); color: #fff6e0; margin-top: 6px; }
.briefing-scroll { flex: auto; overflow-y: auto; padding: 16px 26px; }
.briefing-story { font: 500 15.5px/1.5 var(--serif); color: var(--ink-soft); margin-bottom: 16px; }
.briefing-foe, .briefing-party, .briefing-challenge { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.briefing-foe small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.briefing-foe h3 { font-size: 22px; color: var(--ink); }
.briefing-foe > span { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: #ffa6a6; }
.briefing-lineup { display: flex; gap: 9px; margin: 12px 0 16px; overflow-x: auto; padding-bottom: 4px; }
.briefing-enemy { flex: 0 0 68px; margin: 0; }
.briefing-enemy > div { position: relative; }
.briefing-enemy img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; border: 1px solid var(--border-mid); display: block; }
.briefing-enemy span { position: absolute; right: 3px; bottom: 3px; padding: 1px 5px; border-radius: 5px; background: rgba(8, 12, 20, 0.9); color: var(--gold-bright); font-size: 10px; font-weight: 700; }
.briefing-enemy figcaption { font: 600 11.5px/1.2 var(--serif); color: var(--ink-soft); margin-top: 4px; text-align: center; }
.briefing-challenge { flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.difficulty { display: inline-flex; gap: 6px; }
.difficulty button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(16, 24, 38, 0.85);
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 700;
}
.difficulty button[aria-pressed="true"] { border-color: var(--gold-bright); color: var(--gold-bright); background: rgba(58, 43, 18, 0.72); }
.difficulty .ico { width: 12px; height: 12px; }
.briefing-challenge p { font-size: 13px; color: var(--sub); }
.briefing-party { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: 13px; color: var(--ink-soft); }
.briefing-party > span { display: inline-flex; align-items: center; gap: 6px; }
.battle-briefing footer { padding: 14px 26px 18px; border-top: 1px solid var(--border-subtle); background: rgba(9, 14, 24, 0.92); }
.battle-briefing footer .primary { width: 100%; }

/* Victory / Defeat Painted Epilogue */
dialog:has(.outcome) { width: min(600px, calc(100vw - 24px)); overflow: hidden; }
.outcome-art {
  position: relative;
  height: clamp(190px, 30dvh, 275px);
  overflow: hidden;
  background: #0d1522;
}
.outcome-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.outcome-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #0d1524 2%, rgba(13, 21, 36, 0.72) 28%, transparent 72%);
}
.outcome-title { position: absolute; z-index: 2; inset: auto 26px 8px; }
.outcome-title h2 {
  font: 600 clamp(34px, 5.5vw, 52px)/1.08 var(--serif);
  color: #fff3c6;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
}
.result-defeat .outcome-title h2 { color: #ffcabd; }
.outcome-body { padding: 10px 26px 24px; display: grid; gap: 12px; }
.outcome-reason { font-size: 14px; color: var(--ink-soft); }
.end-story { font: 500 16px/1.5 var(--serif); color: #fff3d4; padding: 12px 14px; border-radius: 10px; background: rgba(234, 185, 103, 0.08); border-left: 3px solid var(--gold); }
.battle-recap {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(16, 25, 40, 0.85);
  border: 1px solid var(--border-subtle);
}
.recap-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.recap-heading h3 { font-size: 16px; color: var(--gold-bright); }
.recap-heading span { font-size: 12px; color: var(--sub); }
.recap-duel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.recap-side { display: flex; align-items: center; gap: 9px; }
.recap-side img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.recap-side span { font-size: 11.5px; color: var(--sub); }
.recap-side b { display: block; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.battle-recap p { margin-top: 10px; font-size: 12px; color: var(--sub); }
.spoils {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(64, 46, 18, 0.55), rgba(18, 28, 44, 0.85));
  border: 1px solid rgba(234, 185, 103, 0.42);
}
.spoils > span, .spoils > b, .prize-card { display: inline-flex; align-items: center; gap: 7px; }
.spoils > b { color: var(--gold-bright); font-size: 15px; }
.award-stars .earned { color: var(--gold-bright); }
.award-stars .empty { color: #546175; }
.prize-card { color: var(--jade); font-weight: 600; font-size: 13.5px; }
.outcome-cta-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; margin-top: 4px; }
.outcome-body > .primary { width: 100%; }

/* Combatant Inspector */
dialog:has(.combatant) { width: min(720px, calc(100vw - 24px)); overflow: hidden; }
.combatant { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
.inspect-picture { position: relative; min-height: 280px; background: #0a1019; }
.inspect-picture img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 24%; }
.inspect-sheet { padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 10px; }
.inspect-sheet h2 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.1; color: #fff6e0; }
.inspect-affinity { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--suit, var(--gold)); text-transform: uppercase; letter-spacing: 0.1em; }
.inspect-vitals {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(9, 14, 24, 0.78);
  border: 1px solid var(--border-subtle);
}
.inspect-vitals small { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--sub); }
.inspect-vitals strong { display: block; font: 600 26px/1.2 var(--serif); color: #fff; }
.inspect-vitals em { font-style: normal; font-size: 13px; color: var(--sub); }
.inspect-life { display: block; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); margin-top: 5px; overflow: hidden; }
.inspect-life i { display: block; height: 100%; background: var(--jade); }
.inspect-status { color: #ffba82; font-size: 13px; font-weight: 700; }
.inspect-ability h3 { font-size: 19px; color: var(--gold-bright); }
.inspect-ability p { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }
.inspect-opposite {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: rgba(16, 25, 40, 0.85);
  text-align: left;
}
.inspect-opposite img, .inspect-opposite i { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; flex: none; }
.inspect-opposite i { display: grid; place-items: center; background: rgba(234, 185, 103, 0.12); color: var(--gold-bright); }
.inspect-opposite small { display: block; font-size: 10.5px; color: var(--sub); }
.inspect-opposite b { font: 600 15px/1.2 var(--serif); color: var(--ink); }
.inspect-opposite > .ico { margin-left: auto; color: var(--gold); }
.inspect-sheet > .primary { width: 100%; margin-top: auto; }

/* World Atlas Modal */
dialog:has(.atlas-sheet) { width: min(1060px, calc(100vw - 24px)); overflow: hidden; }
.atlas-sheet { max-height: calc(90dvh - 4px); overflow-y: auto; }
.atlas-heading { padding: 20px 54px 16px 24px; }
.atlas-heading h2 { font-size: clamp(26px, 3.2vw, 38px); color: #fff6e0; margin-top: 4px; }
.atlas-pages { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(245px, 1fr); border-top: 1px solid var(--border-mid); }
.atlas-chart {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #bdab79 url("assets/atlas-painted.webp") center / 100% 100% no-repeat;
}
.atlas-trail { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.atlas-trail path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.trail-edge { stroke: #ffe4a1; stroke-width: 4px; opacity: 0.9; }
.trail-ink { stroke: #5a381d; stroke-width: 2px; stroke-dasharray: 4 5; }
.atlas-site {
  position: absolute;
  z-index: 2;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.atlas-site span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--serif);
  border: 1.5px solid #ffebb8;
  background: #232c38;
  color: #fff6e0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  transition: transform 180ms ease;
}
.atlas-site:hover span { transform: scale(1.18); }
.atlas-site.is-complete span { background: #185e49; color: #baffdf; }
.atlas-site.is-open span { background: #e8b861; color: #1b1306; }
.atlas-site.is-current span {
  transform: scale(1.16);
  box-shadow: 0 0 0 4px rgba(255, 229, 155, 0.72), 0 0 22px rgba(255, 215, 110, 0.9);
}
.atlas-key {
  list-style: none;
  margin: 0;
  padding: 10px 16px;
  background: linear-gradient(155deg, rgba(16, 25, 39, 0.95), #0b111c);
  border-left: 1px solid var(--border-mid);
  display: grid;
  align-content: center;
}
.atlas-key label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
.atlas-key label:hover { color: var(--gold-bright); }
.atlas-key-no { font: 700 11px/1 var(--sans); color: var(--gold); }
.atlas-key-name { font: 600 14.5px/1.2 var(--serif); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.atlas-diff { font: 700 9.5px/1 var(--sans); font-style: normal; text-transform: uppercase; opacity: 0.9; }
.atlas-key .is-current { color: var(--gold-bright); }
.atlas-key .ico { width: 13px; height: 13px; }


/* ---------- RESPONSIVE PERFECTION (DESKTOP · TABLET · MOBILE) ---------- */
@media (max-width: 1060px) {
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .trial-hero { grid-template-columns: 1fr; }
  .preset-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .battle-dock:has(.command-panel) { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .bar { flex-wrap: wrap; padding-block: 10px; gap: 8px 12px; }
  .hud-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
  .hud-nav button { flex: 1; justify-content: center; padding: 7px 10px; font-size: 12.5px; }
  .hud-tools { margin-left: auto; }
}

@media (max-width: 860px) {
  .atlas-pages { grid-template-columns: 1fr; }
  .atlas-key { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; border-left: 0; border-top: 1px solid var(--border-mid); }
  .journey-camp { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deck-chip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .battle-footer-strip { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

@media (max-width: 720px) {
  .hud-nav button { padding: 7px 8px; font-size: 12px; }
  .hero-copy { max-width: 100%; margin: 22px; }
  .expedition-route { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-grid { grid-template-columns: 1fr; }
  .collection-actions { grid-template-columns: 1fr; }
  .hand-console { grid-template-columns: 1fr; grid-template-areas: "heading" "cards" "controls"; }
  .hand-console .actions { grid-template-columns: 1fr 1.5fr; }
  .hand-console .actions .primary { grid-row: auto; }
  .duel-banner { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .foe-banner-right { width: 100%; justify-content: space-between; }
  .folio, .combatant { display: block; }
  .folio-visual { position: static; padding: 18px 18px 0; }
  .folio-mount { max-width: 240px; margin-inline: auto; }
  .folio .folio-jump { display: inline-flex; }
  .outcome-cta-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cosmos-motes { display: none; }
}


/* ---------- CROSS-GAME MECHANICS UI (MUTATORS, SYNERGIES, ORACLE EYE, MULLIGAN, 3-SPELL) ---------- */
.sound-btn[aria-pressed="false"] { opacity: 0.52; color: var(--sub); }

.trial-node-stars {
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--gold-bright);
  line-height: 1.1;
}
.trial-star-rule { font-size: 11.5px; color: var(--ink-soft); font-weight: 600; }

.mutator-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(125deg, rgba(60, 42, 16, 0.56), rgba(14, 22, 36, 0.88));
  border: 1px solid rgba(234, 185, 103, 0.4);
  font-size: 13px;
  color: var(--ink-soft);
}
.mutator-card .ico { width: 18px; height: 18px; color: var(--gold-bright); margin-top: 2px; }
.mutator-card small { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--gold); font-weight: 700; }
.mutator-card b { color: var(--gold-bright); }

.arena-aura-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(8, 13, 23, 0.86);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.arena-aura-strip.ally-auras {
  border-bottom: 0;
  border-top: 1px solid rgba(92, 224, 184, 0.16);
}
.mutator-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(54, 40, 16, 0.65);
  border: 1px solid rgba(234, 185, 103, 0.42);
  font-size: 11.5px;
  color: var(--gold-bright);
}
.mutator-pill .ico { width: 13px; height: 13px; }
.mutator-pill small { color: var(--ink-soft); font-weight: 500; }

.synergy-bar { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.synergy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--suit, var(--gold));
  background: var(--enamel, rgba(20, 30, 44, 0.85));
  color: var(--suit, var(--gold-bright));
  box-shadow: 0 0 12px color-mix(in srgb, var(--suit, var(--gold)) 22%, transparent);
}
.synergy-chip .faction-crest { width: 13px; height: 13px; }
.synergy-chip small { color: var(--ink-soft); font-weight: 500; }

.speed-btn.is-fast, .oracle-btn.is-active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(66, 48, 18, 0.72);
}

.oracle-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid rgba(114, 198, 255, 0.45);
  background: linear-gradient(95deg, rgba(16, 44, 68, 0.85), rgba(12, 20, 34, 0.92));
  font-size: 12.5px;
  color: var(--ink);
}
.oracle-banner.is-lethal {
  border-color: rgba(255, 224, 128, 0.75);
  background: linear-gradient(95deg, rgba(84, 58, 14, 0.88), rgba(24, 48, 36, 0.9));
  box-shadow: 0 0 22px rgba(255, 215, 106, 0.25);
}
.oracle-banner.is-danger {
  border-color: rgba(255, 118, 118, 0.7);
  background: linear-gradient(95deg, rgba(84, 20, 28, 0.88), rgba(20, 18, 30, 0.92));
}
.oracle-title { display: inline-flex; align-items: center; gap: 7px; color: var(--gold-bright); }
.oracle-title .ico { width: 16px; height: 16px; }
.oracle-metrics { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.oracle-metrics b.pos { color: var(--jade); }
.oracle-metrics b.neg { color: var(--crimson); }

.formation-line .line-mark.ally-direct {
  color: #9bf7cd;
  border-color: rgba(92, 224, 184, 0.42);
  background: rgba(16, 56, 46, 0.78);
}
.formation-line .line-mark.foe-direct {
  color: #ffada3;
  border-color: rgba(255, 122, 122, 0.45);
  background: rgba(68, 20, 28, 0.78);
}

.mulligan-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: #a8e4ff;
  border: 1px solid rgba(114, 198, 255, 0.45);
  background: rgba(16, 44, 68, 0.72);
  transition: all 160ms ease;
}
.mulligan-btn:enabled:hover { border-color: #d6f3ff; background: rgba(26, 66, 98, 0.9); transform: translateY(-1px); }
.mulligan-btn .ico { width: 13px; height: 13px; }

.hand-key {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font: 800 10px/1 var(--sans);
  background: rgba(8, 12, 20, 0.82);
  color: var(--gold-bright);
  border: 1px solid rgba(255, 229, 165, 0.35);
}

.arena .unit.has-shield {
  box-shadow: 0 0 18px rgba(255, 224, 130, 0.5), inset 0 0 0 2px rgba(255, 232, 155, 0.75);
}

.command-pair { grid-template-columns: 1fr; gap: 7px; }
.command-panel .command { padding: 8px 12px; }
.command-panel .command.rally {
  border-color: rgba(198, 156, 255, 0.45);
  background: linear-gradient(145deg, rgba(46, 24, 74, 0.72), rgba(18, 22, 36, 0.92));
  color: #dfc4ff;
}
.arena .unit.spell-targetable {
  outline: 2.5px solid var(--gold-bright);
  outline-offset: 2px;
  box-shadow: 0 0 24px rgba(255, 224, 130, 0.65);
  cursor: crosshair;
  animation: portal-pulse 1.5s ease-in-out infinite;
}

.collection-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.defeat-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 13px;
  color: #e9dec2;
  background: rgba(234, 185, 103, 0.1);
  border: 1px solid rgba(234, 185, 103, 0.3);
}
.defeat-tip .ico { width: 16px; height: 16px; color: var(--gold-bright); margin-top: 2px; }
.rules code {
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(234, 185, 103, 0.14);
  color: var(--gold-bright);
  font-size: 12.5px;
}

@media (max-width: 960px) {
  .collection-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .command-pair { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hand-key { display: none; }
  .mutator-pill small { display: none; }
  .encounter-right { flex-wrap: wrap; justify-content: flex-end; }
}


/* ---------- LIVE GAMEPLAY COACH, WAIT PROGRESS BAR & FAST-WAIT CONTROLS ---------- */
.coach-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(92, 224, 184, 0.45);
  background: linear-gradient(95deg, rgba(16, 52, 46, 0.88), rgba(14, 22, 36, 0.94));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.coach-banner.step-1 {
  border-color: rgba(234, 185, 103, 0.55);
  background: linear-gradient(95deg, rgba(64, 46, 16, 0.85), rgba(14, 22, 36, 0.94));
}
.coach-banner.step-2 {
  border-color: rgba(92, 224, 184, 0.72);
  background: linear-gradient(95deg, rgba(16, 66, 54, 0.9), rgba(14, 24, 38, 0.94));
  box-shadow: 0 0 22px rgba(92, 224, 184, 0.18);
}
.coach-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(8, 13, 23, 0.72);
  color: var(--gold-bright);
  border: 1px solid rgba(255, 229, 165, 0.35);
}
.coach-pill .ico { width: 13px; height: 13px; }
.coach-banner p {
  flex: 1;
  font-size: 13px;
  line-height: 1.42;
  color: var(--ink);
}
.coach-banner p b { color: var(--gold-bright); }
.coach-close {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--sub);
}
.coach-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.coach-close .ico { width: 14px; height: 14px; }

.hand-skill-mini {
  margin: 1px 4px 0;
  font-size: 10px;
  color: var(--jade);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wait-bar {
  display: block;
  height: 3px;
  margin: 0 4px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.wait-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--jade));
}
.hand-card.ready {
  border-color: #6ef0c2;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 18px rgba(92, 224, 184, 0.38);
  animation: ready-card-glow 2s ease-in-out infinite;
}
@keyframes ready-card-glow {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.52), 0 0 12px rgba(92, 224, 184, 0.28); }
  50% { box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6), 0 0 24px rgba(110, 240, 194, 0.58); }
}

.fast-wait-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: #a9e6ff;
  border: 1px solid rgba(114, 198, 255, 0.52);
  background: linear-gradient(135deg, rgba(16, 52, 82, 0.85), rgba(14, 24, 40, 0.94));
  transition: all 170ms ease;
}
.fast-wait-btn:hover {
  transform: translateY(-1px);
  border-color: #d6f3ff;
  box-shadow: 0 6px 18px rgba(98, 198, 255, 0.28);
}
.fast-wait-btn .ico { width: 15px; height: 15px; }

.hand-console {
  grid-template-columns: minmax(0, 1fr) 186px;
}

@media (max-width: 720px) {
  .coach-banner { flex-wrap: wrap; gap: 6px; }
  .hand-console { grid-template-columns: 1fr; }
}


/* ---------- HEROES HALL, QUEST GUILD, ENDLESS BOUNTIES & WORLD CODEX ---------- */
.nav-badge[hidden] { display: none; }
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font: 800 10.5px/1 var(--sans);
  background: linear-gradient(135deg, #ff7a7a, #d8364a);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 110, 110, 0.65);
}
.hero-sigil::after { background-image: var(--hero-art, url("assets/crest-ally.webp")); }

/* Keep coach banner ultra-compact so battle + hand fit above the fold */
.coach-banner { padding: 7px 12px; gap: 10px; }
.coach-banner p { font-size: 12.5px; line-height: 1.32; }

.quests-hub { display: grid; gap: 26px; }
.commander-masthead {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: clamp(18px, 2.8vw, 28px);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--foil, var(--border-mid));
  background:
    radial-gradient(ellipse at 12% 20%, var(--enamel, rgba(24, 48, 42, 0.7)), transparent 58%),
    linear-gradient(145deg, rgba(16, 25, 40, 0.94), rgba(9, 14, 24, 0.97));
  box-shadow: var(--shadow-lg);
}
.commander-portrait-wrap {
  position: relative;
  width: 128px;
  height: 128px;
  border-radius: 18px;
  padding: 4px;
  background: linear-gradient(145deg, var(--suit, var(--gold)), var(--enamel, #182332));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
}
.commander-portrait-wrap img { width: 100%; height: 100%; border-radius: 14px; object-fit: cover; object-position: center 20%; display: block; }
.commander-lv-badge {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translateX(-50%);
  padding: 3px 12px;
  border-radius: 999px;
  font: 800 11.5px/1.2 var(--sans);
  white-space: nowrap;
  background: linear-gradient(135deg, #ffe7a5, #d49a3c);
  color: #1c1306;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}
.commander-summary { display: flex; flex-direction: column; gap: 8px; }
.commander-summary h1 { font: 600 clamp(26px, 3.6vw, 42px)/1.08 var(--serif); color: #fff6e0; }
.commander-active-passive { font-size: 13.5px; color: var(--ink-soft); }
.commander-active-passive b { color: var(--suit, var(--gold-bright)); }
.xp-strip { display: grid; gap: 5px; font-size: 12px; color: var(--sub); }
.xp-strip b { color: var(--gold-bright); }
.xp-bar { height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; max-width: 440px; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--jade), var(--gold-bright)); }
.career-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.career-stats span { display: inline-flex; align-items: center; gap: 5px; }
.career-stats b { color: var(--ink); }
.career-stats .ico { width: 14px; height: 14px; color: var(--gold); }

.hub-section .section-head { margin-bottom: 14px; padding-bottom: 10px; }
.hero-roster-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hero-roster-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: left;
  border: 1.5px solid var(--foil, var(--border-subtle));
  background: linear-gradient(150deg, var(--enamel, #152132), rgba(10, 15, 25, 0.96) 72%);
  box-shadow: var(--shadow-md);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.hero-roster-card:hover { transform: translateY(-3px); border-color: var(--suit, var(--gold-bright)); }
.hero-roster-card.is-selected {
  border-color: var(--gold-bright);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), 0 0 24px color-mix(in srgb, var(--suit, var(--gold)) 28%, transparent);
}
.hero-card-top { display: flex; align-items: center; gap: 13px; }
.hero-card-top img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; object-position: center 20%; border: 1.5px solid var(--suit, var(--gold)); flex: none; }
.hero-faction-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--suit); }
.hero-faction-tag .faction-crest { width: 13px; height: 13px; }
.hero-card-top h3 { font-size: 22px; color: #fff6e0; margin-top: 1px; }
.hero-card-top small { font-size: 12px; color: var(--sub); }
.hero-equipped {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #1c1306;
  background: linear-gradient(135deg, #ffe7a5, #e2ae55);
}
.hero-equipped .ico { width: 13px; height: 13px; }
.hero-quote { font: italic 13.5px/1.4 var(--serif); color: var(--gold-bright); }
.hero-lore-short { font-size: 12.5px; color: var(--ink-soft); line-height: 1.48; }
.hero-passive {
  margin-top: auto;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(7, 11, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.hero-passive b { color: var(--jade); display: inline-flex; align-items: center; gap: 5px; }
.hero-passive .ico { width: 14px; height: 14px; }

.quest-filter-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.quest-filter-tabs button {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--sub);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 22, 36, 0.85);
}
.quest-filter-tabs button[aria-pressed="true"] {
  color: #1c1306;
  border-color: var(--gold-bright);
  background: linear-gradient(135deg, #ffe5a5, #e5b25b);
}

.quest-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bounty-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quest-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(155deg, rgba(18, 28, 44, 0.9), rgba(10, 15, 25, 0.95));
  box-shadow: var(--shadow-md);
}
.quest-card.is-ready {
  border-color: var(--gold-bright);
  background: linear-gradient(145deg, rgba(64, 46, 16, 0.62), rgba(16, 26, 40, 0.95));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 22px rgba(234, 185, 103, 0.22);
}
.quest-card.is-claimed { opacity: 0.62; }
.quest-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.quest-badges { display: inline-flex; align-items: center; gap: 6px; }
.bounty-tag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #a6e2ff;
  background: rgba(18, 52, 80, 0.72);
  border: 1px solid rgba(114, 198, 255, 0.35);
}
.quest-rewards { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.quest-rewards b { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-bright); }
.quest-rewards b .ico { width: 13px; height: 13px; }
.quest-rewards em { font-style: normal; font-weight: 700; color: var(--jade); }
.quest-card h3 { font-size: 19px; color: #fff6e0; }
.quest-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.42; }
.quest-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quest-prog { flex: 1; display: grid; gap: 4px; }
.quest-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.quest-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--jade), var(--gold-bright)); }
.quest-prog small { font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }
.quest-claim-btn { min-height: 36px; padding: 6px 14px; font-size: 12.5px; }
.quest-done { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--jade); }
.quest-done .ico { width: 14px; height: 14px; }
.quest-pending { font-size: 11.5px; color: var(--sub); }

.lore-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lore-card {
  position: relative;
  overflow: hidden;
  min-height: 175px;
  display: flex;
  align-items: flex-end;
  border-radius: var(--radius-md);
  border: 1px solid var(--foil, var(--border-mid));
  background:
    linear-gradient(0deg, rgba(7, 11, 20, 0.96) 16%, rgba(10, 16, 28, 0.72) 65%, rgba(10, 16, 28, 0.4)),
    var(--scene) center / cover no-repeat;
  box-shadow: var(--shadow-md);
}
.lore-card.is-locked { filter: saturate(0.35); }
.lore-card-body { padding: 18px; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.lore-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--suit, var(--gold)); }
.lore-meta span { display: inline-flex; align-items: center; gap: 5px; }
.lore-meta .faction-crest { width: 14px; height: 14px; }
.lore-open { font-style: normal; color: var(--jade); }
.lore-lock { font-style: normal; display: inline-flex; align-items: center; gap: 4px; color: var(--sub); }
.lore-lock .ico { width: 12px; height: 12px; }
.lore-card h3 { font-size: 21px; color: #fff6e0; }
.lore-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.48; }

@media (max-width: 960px) {
  .bounty-grid, .hero-roster-grid, .quest-grid, .lore-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .commander-masthead { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .career-stats { justify-content: center; }
}


/* ---------- HERO ULTIMATE ORB, RELIC FORGE, ENDLESS ABYSS & PRE-BATTLE DIALOGUE ---------- */
.ally-banner-right { display: flex; align-items: center; gap: 10px; flex: none; }
.hero-ult-btn {
  position: relative;
  overflow: hidden;
  min-height: 34px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(234, 185, 103, 0.34);
  background: rgba(12, 18, 30, 0.88);
  color: var(--sub);
  font-size: 11.5px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.hero-ult-btn .ult-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(234, 185, 103, 0.25), rgba(255, 224, 130, 0.45));
  transition: width 320ms ease;
}
.hero-ult-btn .ult-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.hero-ult-btn .ico { width: 13px; height: 13px; color: var(--gold); }
.hero-ult-btn.is-ready {
  border-color: #fff0b8;
  color: #1c1306;
  background: linear-gradient(135deg, #fff0b8, #eab65d 55%, #cf8f30);
  box-shadow: 0 0 22px rgba(255, 215, 106, 0.65);
  animation: portal-pulse 1.6s ease-in-out infinite;
}
.hero-ult-btn.is-ready .ult-fill { display: none; }
.hero-ult-btn.is-ready .ico { color: #1c1306; }
.hero-ult-btn.is-ready:hover { transform: translateY(-2px) scale(1.03); }

.hero-ult-box {
  padding: 8px 11px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(60, 42, 16, 0.45), rgba(14, 20, 34, 0.82));
  border: 1px solid rgba(234, 185, 103, 0.32);
  font-size: 12px;
  color: var(--ink-soft);
}
.hero-ult-box b { color: var(--gold-bright); display: inline-flex; align-items: center; gap: 5px; }
.hero-ult-box .ico { width: 13px; height: 13px; }

.equipped-relics-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.equipped-relic-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(58, 42, 16, 0.68);
  border: 1px solid rgba(234, 185, 103, 0.45);
}
.equipped-relic-pill .ico { width: 12px; height: 12px; }

/* Relic Forge Grid */
.relic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.relic-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 15px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: linear-gradient(155deg, rgba(18, 28, 44, 0.9), rgba(10, 15, 25, 0.95));
  box-shadow: var(--shadow-md);
}
.relic-card.is-equipped {
  border-color: var(--gold-bright);
  background: linear-gradient(145deg, rgba(64, 46, 16, 0.62), rgba(16, 26, 40, 0.96));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.52), 0 0 22px rgba(234, 185, 103, 0.2);
}
.relic-top { display: flex; align-items: center; gap: 11px; }
.relic-ico {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  background: rgba(234, 185, 103, 0.14);
  border: 1px solid rgba(234, 185, 103, 0.4);
  color: var(--gold-bright);
}
.relic-top h3 { font-size: 18px; color: #fff6e0; }
.relic-top small { font-size: 11px; color: var(--sub); }
.relic-card.is-equipped .relic-top small { color: var(--jade); font-weight: 700; }
.relic-card p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.relic-foot { margin-top: auto; padding-top: 4px; }
.relic-btn { width: 100%; min-height: 38px; padding: 6px 12px; font-size: 12.5px; }

/* Endless Abyss Banner */
.abyss-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1.5px solid rgba(212, 123, 255, 0.5);
  background:
    linear-gradient(96deg, rgba(24, 10, 40, 0.94) 15%, rgba(16, 18, 38, 0.82) 60%, rgba(12, 14, 28, 0.92)),
    var(--scene) center / cover no-repeat;
  box-shadow: var(--shadow-md), 0 0 38px rgba(176, 92, 240, 0.18);
}
.abyss-copy { display: flex; flex-direction: column; gap: 6px; max-width: 720px; }
.abyss-copy h2 { font-size: clamp(24px, 3vw, 34px); color: #f6ddff; }
.abyss-copy p { font-size: 13.5px; color: var(--ink-soft); }
.abyss-copy b { color: var(--gold-bright); }
.abyss-cta {
  background: linear-gradient(135deg, #f3c4ff, #b85df0 55%, #7c35c4);
  border-color: #f8ddff;
  color: #160824;
  box-shadow: 0 8px 26px rgba(184, 93, 240, 0.4);
}

/* Pre-battle Dialogue Strip */
.dialogue-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(234, 185, 103, 0.36);
  background: linear-gradient(95deg, rgba(16, 36, 44, 0.92), rgba(14, 18, 30, 0.95) 50%, rgba(44, 18, 26, 0.92));
}
.dlg-side { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlg-foe { justify-content: flex-end; text-align: right; }
.dlg-side img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; flex: none; border: 1.5px solid var(--gold); }
.dlg-side b { display: block; font: 600 13px/1.15 var(--serif); color: var(--gold-bright); }
.dlg-side p { font: italic 12px/1.35 var(--serif); color: var(--ink-soft); margin-top: 2px; }
.dlg-vs { font: 800 11px/1 var(--sans); color: var(--gold); padding: 4px 7px; border-radius: 999px; border: 1px solid var(--border-mid); background: rgba(8, 12, 20, 0.72); }

@media (max-width: 960px) {
  .relic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .relic-grid { grid-template-columns: 1fr; }
  .dialogue-strip { grid-template-columns: 1fr; text-align: left; }
  .dlg-foe { justify-content: flex-start; text-align: left; flex-direction: row-reverse; }
  .dlg-vs { display: none; }
  .ally-banner-right { width: 100%; justify-content: space-between; }
}


/* ---------- MESMERIZING HOLOGRAPHIC 3D LUXURY CARDS (GWENT x LOR x TAROT FILIGREE) ---------- */
.card-grid { perspective: 1200px; }
.spirit {
  position: relative;
  padding: 6px;
  border-radius: 16px;
  border: 1.5px solid color-mix(in srgb, var(--suit) 62%, #d8b268);
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--suit) 26%, transparent), transparent 58%),
    linear-gradient(165deg, color-mix(in srgb, var(--enamel) 95%, #1c2838) 0%, #090e18 66%, #121a28 100%);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.62),
    inset 0 1px 0 rgba(255, 242, 204, 0.34),
    inset 0 -1px 0 rgba(0, 0, 0, 0.72);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transform-style: preserve-3d;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1), border-color 220ms ease, box-shadow 220ms ease;
}
.spirit:hover {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-8px) scale(1.03);
  border-color: #ffedb8;
  box-shadow:
    0 26px 52px rgba(0, 0, 0, 0.78),
    0 0 34px color-mix(in srgb, var(--suit) 42%, transparent),
    inset 0 1px 0 rgba(255, 250, 224, 0.55);
  z-index: 5;
}

/* Prismatic Holographic Foil Plane */
.card-foil-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: color-dodge;
  background:
    radial-gradient(circle 190px at var(--mx, 50%) var(--my, 28%), rgba(255, 240, 195, 0.36), transparent 68%),
    linear-gradient(125deg,
      rgba(255, 190, 120, 0.16) 10%,
      rgba(120, 245, 210, 0.22) 35%,
      rgba(165, 145, 255, 0.22) 60%,
      rgba(255, 224, 130, 0.24) 85%);
  transition: opacity 240ms ease;
}
.spirit:hover .card-foil-layer { opacity: 0.92; }
.spirit.foil-rare .card-foil-layer { opacity: 0.2; }
.spirit.foil-epic .card-foil-layer { opacity: 0.34; }
.spirit.foil-mythic {
  border-color: #ffe396;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.72),
    0 0 28px rgba(255, 212, 110, 0.34),
    inset 0 0 14px rgba(255, 224, 135, 0.18);
}
.spirit.foil-mythic .card-foil-layer { opacity: 0.45; }

/* Sculpted Filigree Portrait Window */
.spirit .picture {
  border-radius: 11px 11px 8px 8px;
  border: 1.5px solid rgba(255, 226, 160, 0.35);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.65);
}
.spirit .picture img {
  aspect-ratio: 4 / 4.35;
  object-position: center 20%;
}
.picture-filigree {
  position: absolute;
  inset: 5px;
  z-index: 1;
  pointer-events: none;
  border-radius: 7px;
  border: 1px solid rgba(255, 232, 175, 0.24);
  background:
    linear-gradient(var(--gold-bright), var(--gold-bright)) left top / 14px 1.5px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left top / 1.5px 14px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right top / 14px 1.5px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right top / 1.5px 14px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left bottom / 14px 1.5px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) left bottom / 1.5px 14px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right bottom / 14px 1.5px,
    linear-gradient(var(--gold-bright), var(--gold-bright)) right bottom / 1.5px 14px;
  background-repeat: no-repeat;
}
.spirit .picture::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.24) 0%, transparent 28%, transparent 66%, rgba(8, 12, 22, 0.88) 100%);
}

/* Floating Mana/Cost Crystal Gem */
.card-cost-gem {
  position: absolute;
  left: 7px;
  bottom: 7px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  transform: rotate(45deg);
  display: grid;
  place-items: center;
  font: 800 11px/1 var(--sans);
  color: #e8f8ff;
  background: linear-gradient(145deg, #3ea8ff, #174c8e);
  border: 1.5px solid #bfe6ff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.65), 0 0 10px rgba(82, 188, 255, 0.45);
}
.card-cost-gem::after { content: none; }
.card-cost-gem { transform: none; border-radius: 50%; }
.spirit .card-lv {
  left: 36px;
  bottom: 8px;
}

.spirit .rarity {
  top: 7px;
  right: 7px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.86);
  border: 1px solid rgba(255, 226, 152, 0.52);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
}
.rarity.r-5 {
  color: #fff2b2;
  border-color: #ffe388;
  background: linear-gradient(135deg, rgba(84, 52, 12, 0.92), rgba(40, 18, 56, 0.92));
  box-shadow: 0 0 14px rgba(255, 214, 102, 0.55);
}

/* Engraved Nameplate & Sculpted Stat Gems */
.spirit .card-copy {
  position: relative;
  z-index: 2;
  padding: 8px 6px 4px;
  gap: 6px;
}
.card-ribbon {
  display: block;
  padding-bottom: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--suit) 28%, rgba(255, 255, 255, 0.08));
}
.spirit .card-copy strong {
  display: block;
  margin: 2px 0 0;
  font: 600 clamp(15.5px, 1.3vw, 19px)/1.14 var(--serif);
  background: linear-gradient(180deg, #fffaf0, #f0d39a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.spirit .card-bottom {
  border-top: 0;
  padding-top: 2px;
  align-items: center;
}
.gem-stats { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.gem-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  font: 800 11.5px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.gem-pill .ico { width: 11px; height: 11px; }
.gem-atk {
  color: #fff2cc;
  background: linear-gradient(145deg, #a86c1e, #59330c);
  border: 1px solid #ffd482;
}
.gem-hp {
  color: #ffe2e6;
  background: linear-gradient(145deg, #a8283e, #591020);
  border: 1px solid #ff99a8;
}

/* Luxury Polish for Battlefield Units & Hand Cards too! */
.arena .unit {
  border-radius: 14px;
  border-width: 2px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.65), inset 0 0 0 1px rgba(255, 236, 185, 0.26);
}
.arena .unit::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 9px;
  border: 1px solid rgba(255, 232, 175, 0.22);
  pointer-events: none;
}
.arena .unit .stats { gap: 4px; }
.arena .unit .stat {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.arena .unit .stat.atk { border-color: rgba(255, 207, 125, 0.55); }
.arena .unit .stat.hp { border-color: rgba(255, 153, 164, 0.55); }

.hand-card {
  border-radius: 13px;
  padding: 4px 4px 0;
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--suit) 24%, transparent), transparent 60%),
    linear-gradient(160deg, #1b273c, #0a101b 70%);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 240, 200, 0.26);
}
.hand-card .hand-art {
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, var(--suit) 65%, #ffe39a);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.55);
}
.hand-card .stat {
  padding: 1.5px 5px;
  border-radius: 999px;
  background: rgba(7, 11, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.archive-card {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--suit, var(--gold)) 42%, rgba(255, 255, 255, 0.12));
  background:
    radial-gradient(ellipse at 0% 50%, color-mix(in srgb, var(--suit, var(--gold)) 14%, transparent), transparent 55%),
    linear-gradient(145deg, rgba(22, 33, 52, 0.92), rgba(10, 15, 26, 0.96));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 238, 195, 0.14);
}
.archive-card:enabled:hover {
  transform: translateY(-3px) scale(1.012);
  border-color: #ffe7a8;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.62), 0 0 22px color-mix(in srgb, var(--suit, var(--gold)) 28%, transparent);
}


/* ---------- ELVES REALM SKILL VFX, SUMMON FLASH & PROGRESSIVE UNLOCKING ---------- */
.hud-nav button[hidden] { display: none; }

.unlock-roadmap {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px dashed rgba(234, 185, 103, 0.42);
  background: linear-gradient(95deg, rgba(48, 36, 16, 0.48), rgba(14, 21, 34, 0.86));
  font-size: 13px;
}
.unlock-roadmap .ico { width: 17px; height: 17px; color: var(--gold-bright); flex: none; }
.unlock-roadmap b { display: block; color: var(--gold-bright); font-size: 13px; }
.unlock-roadmap small { color: var(--sub); font-size: 12px; }

.unlock-celebration {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #ffe69c;
  background: linear-gradient(135deg, rgba(78, 56, 16, 0.78), rgba(20, 52, 42, 0.85));
  box-shadow: 0 0 24px rgba(255, 224, 130, 0.25);
}
.unlock-celebration .ico { width: 20px; height: 20px; color: #fff0b8; margin-top: 2px; flex: none; }
.unlock-celebration small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--jade); font-weight: 800; }
.unlock-celebration b { display: block; font: 600 17px/1.2 var(--serif); color: #fff6dc; margin: 2px 0; }
.unlock-celebration span { font-size: 12.5px; color: var(--ink-soft); }

.help-footer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.help-footer-actions .primary { flex: 1; margin-top: 0; }

.auto-toggle-btn[aria-pressed="true"] {
  border-color: #6ef0c2;
  background: linear-gradient(135deg, rgba(20, 82, 64, 0.88), rgba(14, 42, 36, 0.94));
  color: #d8fff0;
  box-shadow: 0 0 18px rgba(92, 224, 184, 0.35);
}

/* Elves Realm Individual Unit Skill VFX */
.arena .unit.unit-entering {
  animation: summon-drop 420ms cubic-bezier(.18,.88,.32,1.15);
  box-shadow: 0 0 28px rgba(255, 226, 145, 0.72);
}
@keyframes summon-drop {
  0% { opacity: 0; transform: translateY(-22px) scale(1.16); filter: brightness(1.8); }
  100% { opacity: 1; transform: none; filter: none; }
}

.arena .divider.skill-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 780px;
  min-height: 36px;
  margin: 6px auto;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--fx-color, var(--gold-bright));
  background: linear-gradient(90deg, rgba(12, 18, 30, 0.9), color-mix(in srgb, var(--fx-color, var(--gold)) 22%, rgba(12, 18, 30, 0.95)), rgba(12, 18, 30, 0.9));
  box-shadow: 0 0 20px color-mix(in srgb, var(--fx-color, var(--gold)) 35%, transparent);
}
.skill-banner-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #fff6e0;
}
.skill-banner-tag .ico { width: 16px; height: 16px; color: var(--fx-color, var(--gold-bright)); }
.skill-banner-tag em { font-style: normal; font-weight: 800; color: var(--fx-color, var(--gold-bright)); }

.fx-fire { --fx-color: #ff824d; }
.fx-ice { --fx-color: #7ae2ff; }
.fx-lightning { --fx-color: #ffe875; }
.fx-poison { --fx-color: #6ef09a; }
.fx-heal { --fx-color: #7cffc4; }
.fx-buff { --fx-color: #ffd975; }
.fx-drain { --fx-color: #df8aff; }
.fx-arcane { --fx-color: #9ec8ff; }
.fx-summon { --fx-color: #ffe396; }

.arena .unit.skill-casting {
  outline: 2.5px solid var(--fx-color, var(--gold-bright));
  box-shadow: 0 0 28px var(--fx-color, var(--gold-bright));
  transform: scale(1.06);
}
.skill-beam {
  position: absolute;
  z-index: 6;
  height: 5px;
  border-radius: 999px;
  pointer-events: none;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, transparent, var(--fx-color, var(--gold-bright)) 35%, #fff 82%, transparent);
  box-shadow: 0 0 18px var(--fx-color, var(--gold-bright));
  animation: beam-flash 480ms ease-out forwards;
}
@keyframes beam-flash {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}
.skill-burst {
  position: absolute;
  z-index: 7;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.35);
  background: radial-gradient(circle, #fff 10%, var(--fx-color, var(--gold-bright)) 52%, transparent 74%);
  box-shadow: 0 0 24px var(--fx-color, var(--gold-bright));
  animation: skill-pop-ring 520ms ease-out forwards;
}
@keyframes skill-pop-ring {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(3.4); }
}
.clash-damage.skill-pop {
  font-size: 18px;
  border-color: var(--fx-color, var(--gold-bright));
  background: linear-gradient(145deg, color-mix(in srgb, var(--fx-color, #b82d2d) 55%, #121622), #0e1320);
  color: #fff;
}
