/* FoilClash — Prism Foil Vault & Velvet Collector Mat
 * Default Dark Mode (#0E131F Midnight Velvet) + Optional Cool Archival Binder Light (#F4F6FA)
 * Display: Chakra Petch · UI: DM Sans · WCAG AAA/AA Contrast · Zero CLS
 */

:root {
  --bg-canvas: #0E131F;
  --bg-mat: #151D2E;
  --bg-surface: #1B253A;
  --bg-elevated: #23304A;
  --bg-header: rgba(14, 19, 31, 0.90);

  --text-primary: #F8FAFC;
  --text-secondary: #B6C2D9;
  --text-muted: #8B9BB5;
  --text-on-accent: #0E131F;

  --accent-gold: #F5C451;
  --accent-gold-hover: #FAD373;
  --accent-gold-soft: rgba(245, 196, 81, 0.16);
  --accent-sapphire: #38BDF8;
  --accent-sapphire-soft: rgba(56, 189, 248, 0.16);
  --accent-amethyst: #C084FC;
  --accent-amethyst-soft: rgba(192, 132, 252, 0.16);
  --accent-emerald: #34D399;
  --accent-emerald-soft: rgba(52, 211, 153, 0.16);
  --accent-crimson: #F43F5E;
  --accent-crimson-soft: rgba(244, 63, 94, 0.16);
  --accent-silver: #CBD5E1;

  --border-stitch: rgba(245, 196, 81, 0.28);
  --border-hairline: rgba(248, 250, 252, 0.12);
  --border-strong: rgba(248, 250, 252, 0.22);

  --shadow-mat: 0 24px 60px -18px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow-card: 0 12px 28px -10px rgba(0, 0, 0, 0.55);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  --container-max: 1080px;
  --font-display: "Chakra Petch", "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: "DM Sans", "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="light"] {
  --bg-canvas: #F4F6FA;
  --bg-mat: #E8EDF5;
  --bg-surface: #FFFFFF;
  --bg-elevated: #F8FAFC;
  --bg-header: rgba(244, 246, 250, 0.92);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #5B6B82;
  --text-on-accent: #FFFFFF;

  --accent-gold: #B45309;
  --accent-gold-hover: #92400E;
  --accent-gold-soft: rgba(180, 83, 9, 0.12);
  --accent-sapphire: #0369A1;
  --accent-sapphire-soft: rgba(3, 105, 161, 0.12);
  --accent-amethyst: #7E22CE;
  --accent-amethyst-soft: rgba(126, 34, 206, 0.12);
  --accent-emerald: #047857;
  --accent-emerald-soft: rgba(4, 120, 87, 0.12);
  --accent-crimson: #BE123C;
  --accent-crimson-soft: rgba(190, 18, 60, 0.12);
  --accent-silver: #64748B;

  --border-stitch: rgba(180, 83, 9, 0.32);
  --border-hairline: rgba(15, 23, 42, 0.11);
  --border-strong: rgba(15, 23, 42, 0.22);

  --shadow-mat: 0 20px 44px -18px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-card: 0 10px 24px -10px rgba(15, 23, 42, 0.14);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(56, 189, 248, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 35% at 85% 15%, rgba(245, 196, 81, 0.08), transparent 55%),
    var(--bg-canvas);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  overflow-x: clip;
}

html[data-theme="light"] body {
  background:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(3, 105, 161, 0.07), transparent 60%),
    var(--bg-canvas);
}

main {
  flex: 1 0 auto;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color 0.18s var(--ease-out), background-color 0.18s var(--ease-out), border-color 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

a:hover {
  color: var(--accent-gold-hover);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-sapphire);
  outline-offset: 3px;
  border-radius: 6px;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent-gold);
  color: var(--text-on-accent);
  font-weight: 700;
  padding: 10px 18px;
  z-index: 100;
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  left: 16px;
  top: 12px;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 22px;
}

.container--prose {
  max-width: 780px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-hairline);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-height: 64px;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.brand:hover {
  color: var(--accent-gold);
}

.brand__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-links > a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
}

.nav-links > a:hover,
.nav-links > a[aria-current="page"] {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--accent-gold);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  margin-left: 4px;
}

.lang-switch a,
.lang-switch span {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 1.2;
}

.lang-switch a:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.lang-switch .is-active,
.lang-switch [aria-current="page"] {
  background: var(--accent-gold);
  color: var(--text-on-accent);
}

/* Hero */
.hero {
  padding: 36px 0 20px;
}

.hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
}

.badge--gold {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  border-color: rgba(245, 196, 81, 0.35);
}

.badge--sapphire {
  background: var(--accent-sapphire-soft);
  color: var(--accent-sapphire);
  border-color: rgba(56, 189, 248, 0.35);
}

.badge--emerald {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border-color: rgba(52, 211, 153, 0.35);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-top: 0;
  line-height: 1.16;
  letter-spacing: -0.015em;
}

.hero h1 {
  font-size: clamp(1.85rem, 4.2vw, 2.95rem);
  font-weight: 700;
  margin-bottom: 12px;
}

.lead {
  color: var(--text-secondary);
  font-size: clamp(0.98rem, 1.4vw, 1.08rem);
  max-width: 70ch;
  margin: 0;
}

/* Velvet Collector Mat Demo Shell */
.demo-section {
  padding: 12px 0 44px;
}

.vault-shell {
  position: relative;
  background: var(--bg-mat);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-mat);
}

.vault-shell::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed var(--border-stitch);
  border-radius: 15px;
  pointer-events: none;
}

.vault-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hairline);
}

.vault-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.vault-meta__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text-primary);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
}

.pill--gold {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  border-color: rgba(245, 196, 81, 0.35);
}

.pill--sapphire {
  background: var(--accent-sapphire-soft);
  color: var(--accent-sapphire);
  border-color: rgba(56, 189, 248, 0.35);
}

.pill--amethyst {
  background: var(--accent-amethyst-soft);
  color: var(--accent-amethyst);
  border-color: rgba(192, 132, 252, 0.35);
}

.pill--emerald {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
  border-color: rgba(52, 211, 153, 0.35);
}

/* Stepper Tabs */
.step-tabs {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 18px;
}

.step-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s var(--ease-out), background-color 0.18s var(--ease-out), color 0.18s var(--ease-out);
}

.step-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-tab.is-active {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.step-tab.is-done {
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--accent-emerald);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-elevated);
  font-size: 0.74rem;
  flex-shrink: 0;
}

.step-tab.is-active .step-num {
  background: var(--accent-gold);
  color: var(--text-on-accent);
}

.step-tab.is-done .step-num {
  background: var(--accent-emerald);
  color: var(--text-on-accent);
}

/* Panels */
.stage-panel {
  position: relative;
  z-index: 2;
}

.stage-panel[hidden] {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s var(--ease-out), background-color 0.16s var(--ease-out), border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

.btn:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--accent-gold);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--gold {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--text-on-accent);
  box-shadow: 0 8px 22px -6px rgba(245, 196, 81, 0.45);
}

.btn--gold:hover:not(:disabled) {
  background: var(--accent-gold-hover);
  border-color: var(--accent-gold-hover);
  color: var(--text-on-accent);
}

.btn--sapphire {
  background: var(--accent-sapphire);
  border-color: var(--accent-sapphire);
  color: var(--text-on-accent);
}

.btn--sapphire:hover:not(:disabled) {
  filter: brightness(1.08);
  color: var(--text-on-accent);
}

.btn--emerald {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: var(--text-on-accent);
}

.btn--emerald:hover:not(:disabled) {
  filter: brightness(1.06);
  color: var(--text-on-accent);
}

.btn--sm {
  min-height: 36px;
  padding: 6px 13px;
  font-size: 0.8rem;
}

/* STEP 1: Foil Booster Pack Stage */
.pack-stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
}

@media (min-width: 820px) {
  .pack-stage {
    grid-template-columns: 270px 1fr;
    gap: 28px;
  }
}

.pack-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.foil-pack {
  position: relative;
  width: 210px;
  height: 292px;
  border-radius: 14px;
  background: linear-gradient(145deg, #253453 0%, #151F35 45%, #1E2E4D 75%, #2D3D61 100%);
  border: 2px solid rgba(203, 213, 225, 0.48);
  box-shadow:
    0 20px 40px -12px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: grab;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}

.foil-pack:hover {
  transform: translateY(-3px);
}

.foil-pack.is-golden {
  background: linear-gradient(145deg, #5B4315 0%, #261D10 42%, #4A3512 72%, #6E5119 100%);
  border-color: var(--accent-gold);
  box-shadow:
    0 20px 44px -10px rgba(245, 196, 81, 0.35),
    inset 0 0 0 1px rgba(245, 196, 81, 0.35);
}

.foil-pack.is-opened {
  opacity: 0.72;
  cursor: default;
  transform: scale(0.96);
}

.foil-pack__crimp-top,
.foil-pack__crimp-bot {
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.26) 0 4px,
    rgba(0, 0, 0, 0.28) 4px 8px
  );
  z-index: 3;
}

.foil-pack__crimp-top { top: 0; }
.foil-pack__crimp-bot { bottom: 0; }

.foil-pack__sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    120deg,
    transparent 35%,
    rgba(255, 255, 255, 0.18) 47%,
    rgba(56, 189, 248, 0.22) 51%,
    rgba(245, 196, 81, 0.22) 55%,
    transparent 67%
  );
  animation: foil-sweep 3.4s linear infinite;
  pointer-events: none;
}

@keyframes foil-sweep {
  0% { transform: translateX(-45%) rotate(8deg); }
  100% { transform: translateX(45%) rotate(8deg); }
}

.foil-pack__tear-strip {
  position: absolute;
  top: 52px;
  left: 0;
  right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1.5px dashed rgba(245, 196, 81, 0.75);
  border-bottom: 1.5px dashed rgba(245, 196, 81, 0.75);
  background: rgba(14, 19, 31, 0.52);
  color: #F5C451;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  z-index: 4;
  transition: transform 0.12s linear, opacity 0.15s ease;
}

.foil-pack__tear-glow {
  position: absolute;
  top: 50px;
  left: 0;
  height: 40px;
  width: 0%;
  background: linear-gradient(90deg, rgba(245, 196, 81, 0.7), rgba(56, 189, 248, 0.85), rgba(192, 132, 252, 0.75));
  filter: blur(6px);
  z-index: 3;
  pointer-events: none;
}

.foil-pack__body {
  position: absolute;
  inset: 96px 14px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  z-index: 2;
}

.foil-pack__emblem {
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 196, 81, 0.25), rgba(56, 189, 248, 0.08) 70%);
  border: 1px solid rgba(245, 196, 81, 0.45);
}

.foil-pack__label {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  color: #F8FAFC;
  letter-spacing: 0.04em;
}

.foil-pack__sub {
  font-size: 0.76rem;
  color: #B6C2D9;
}

.foil-pack.is-ripping .foil-pack__tear-strip {
  transform: translateX(48px) rotate(-8deg);
  opacity: 0;
}

/* Pack Progress Dots */
.pack-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pack-dot {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
}

.pack-dot.is-current {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.pack-dot.is-done {
  border-color: rgba(52, 211, 153, 0.5);
  color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
}

/* Revealed Cards Fan & 3D Foil Tilt */
.reveal-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reveal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.reveal-header h3 {
  margin: 0;
  font-size: 1.06rem;
}

.reveal-fan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-height: 196px;
  align-items: stretch;
  perspective: 900px;
}

@media (max-width: 560px) {
  .reveal-fan {
    gap: 8px;
  }
}

.reveal-placeholder {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: rgba(14, 19, 31, 0.35);
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.92rem;
}

html[data-theme="light"] .reveal-placeholder {
  background: rgba(255, 255, 255, 0.55);
}

/* Foil Token Card */
.foil-card {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 12px 8px 10px;
  border-radius: 14px;
  background: var(--bg-surface);
  border: 2px solid var(--accent-silver);
  box-shadow: var(--shadow-card);
  text-align: center;
  overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: transform 0.16s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
  animation: card-pop 0.38s var(--ease-out) both;
}

@keyframes card-pop {
  0% { opacity: 0; transform: translateY(18px) scale(0.86) rotateY(40deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotateY(0deg); }
}

.foil-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle 120px at var(--mx) var(--my),
    rgba(255, 255, 255, 0.26),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.foil-card:hover::after {
  opacity: 1;
}

.foil-card--common {
  border-color: var(--accent-silver);
}

.foil-card--rare {
  border-color: var(--accent-sapphire);
  box-shadow: 0 12px 28px -10px rgba(56, 189, 248, 0.35);
}

.foil-card--epic {
  border-color: var(--accent-amethyst);
  box-shadow: 0 12px 30px -8px rgba(192, 132, 252, 0.42);
}

.foil-card--prismatic {
  border-color: var(--accent-gold);
  background:
    linear-gradient(135deg, rgba(245, 196, 81, 0.18), rgba(52, 211, 153, 0.14), rgba(56, 189, 248, 0.18)),
    var(--bg-surface);
  box-shadow: 0 14px 36px -8px rgba(245, 196, 81, 0.52);
}

.foil-card--prismatic::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    115deg,
    transparent 38%,
    rgba(250, 204, 21, 0.28) 47%,
    rgba(52, 211, 153, 0.28) 51%,
    rgba(56, 189, 248, 0.28) 55%,
    transparent 64%
  );
  animation: foil-sweep 2.8s linear infinite;
  pointer-events: none;
}

.foil-card__top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  z-index: 2;
}

.foil-card__tag {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.foil-card__tag--new {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.foil-card__tag--merge {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.foil-card__tag--pity {
  background: var(--accent-amethyst-soft);
  color: var(--accent-amethyst);
}

.foil-card__glyph {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.foil-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.2;
  z-index: 2;
}

.foil-card__rarity {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  z-index: 2;
}

.foil-card__stats {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  z-index: 2;
}

/* Vault Collection Strip */
.vault-tray {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-hairline);
}

.vault-tray__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.vault-tray__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.mini-token {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 12px;
  border: 1.5px solid var(--border-hairline);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  text-align: center;
  transition: transform 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
}

.mini-token:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
}

.mini-token.is-selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(245, 196, 81, 0.35);
}

.mini-token.is-deployed {
  background: var(--accent-sapphire-soft);
  border-color: var(--accent-sapphire);
}

.mini-token__name {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
}

.mini-token__sub {
  font-size: 0.66rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
}

/* STEP 2: 2x3 Velvet Mat Formation */
.synergy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.synergy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.synergy-chip.is-active {
  color: var(--text-primary);
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
}

.synergy-chip[data-faction="vanguard"].is-active {
  border-color: var(--accent-sapphire);
  background: var(--accent-sapphire-soft);
  color: var(--accent-sapphire);
}

.synergy-chip[data-faction="arcana"].is-active {
  border-color: var(--accent-amethyst);
  background: var(--accent-amethyst-soft);
  color: var(--accent-amethyst);
}

.synergy-chip[data-faction="wild"].is-active {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.synergy-chip[data-faction="forge"].is-active {
  border-color: var(--accent-gold);
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.mat-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mat-row-label {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.mat-grid-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mat-cell {
  min-height: 112px;
  padding: 10px 8px;
  border-radius: 14px;
  border: 1.5px dashed var(--border-strong);
  background: rgba(14, 19, 31, 0.35);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.14s ease;
}

html[data-theme="light"] .mat-cell {
  background: rgba(255, 255, 255, 0.55);
}

.mat-cell:hover {
  border-color: var(--accent-gold);
}

.mat-cell.is-filled {
  border-style: solid;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.mat-cell__hint {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
}

.squad-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

/* STEP 3: 4v4 Auto-Battle Arena */
.arena-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.arena-board {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(14, 19, 31, 0.45);
  border: 1px solid var(--border-hairline);
}

html[data-theme="light"] .arena-board {
  background: rgba(255, 255, 255, 0.65);
}

.arena-side-label {
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.arena-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 520px) {
  .arena-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px 8px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  text-align: center;
  transition: transform 0.14s var(--ease-out), opacity 0.25s ease;
}

.unit-card.is-ko {
  opacity: 0.32;
  filter: grayscale(0.8);
}

.unit-card.is-lunge-up {
  transform: translateY(-14px) scale(1.04);
}

.unit-card.is-lunge-down {
  transform: translateY(14px) scale(1.04);
}

.unit-card.is-hit {
  animation: unit-shake 0.22s ease;
}

@keyframes unit-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.unit-card__name {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
}

.unit-card__hpbar {
  width: 100%;
  height: 7px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  position: relative;
}

.unit-card__hpfill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent-emerald);
  transition: width 0.14s linear;
}

.unit-card--enemy .unit-card__hpfill {
  background: var(--accent-crimson);
}

.unit-card__shield {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  background: var(--accent-sapphire);
  opacity: 0.8;
}

.unit-card__nums {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.float-dmg {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  color: #F8FAFC;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 6;
  animation: float-up 0.55s ease-out forwards;
}

.float-dmg--crit {
  color: #F5C451;
  font-size: 0.96rem;
}

.float-dmg--heal {
  color: #34D399;
}

.float-dmg--arc {
  color: #C084FC;
}

@keyframes float-up {
  0% { opacity: 1; transform: translate(-50%, 4px) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(1.1); }
}

.battle-log {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--text-secondary);
  min-height: 24px;
  text-align: center;
}

/* Result Panel */
.result-panel {
  margin-top: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(245, 196, 81, 0.14), rgba(56, 189, 248, 0.10)), var(--bg-surface);
  border: 1.5px solid var(--accent-gold);
  text-align: center;
}

.result-panel[hidden] {
  display: none !important;
}

.result-panel h3 {
  font-size: 1.35rem;
  margin-bottom: 6px;
  color: var(--accent-gold);
}

.result-panel__sub {
  margin: 0 0 14px;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.result-panel__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}

.result-panel__bridge {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* Toast */
.demo-toast {
  margin-top: 12px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-sapphire);
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: center;
}

.demo-toast[hidden] {
  display: none !important;
}

/* Content Sections */
.section {
  padding: 44px 0;
}

.section--border {
  border-top: 1px solid var(--border-hairline);
}

.geo-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 24px 26px;
}

.geo-box h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.geo-box p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.96rem;
}

.app-bridge {
  margin-top: 18px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-stitch);
  background: var(--bg-mat);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.app-bridge p {
  margin: 0;
  color: var(--text-primary);
  font-weight: 600;
  max-width: 58ch;
  font-size: 0.94rem;
}

.app-bridge__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.feat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 20px;
}

@media (min-width: 760px) {
  .feat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 22px;
}

.feat-card__kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-gold);
  margin-bottom: 6px;
}

.feat-card h3 {
  font-size: 1.12rem;
  margin-bottom: 8px;
}

.feat-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
}

/* Privacy / Support Prose */
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 24px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 8px;
  opacity: 0.5;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 20px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.callout {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  margin: 16px 0;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.callout--gold {
  border-color: var(--border-stitch);
  background: var(--accent-gold-soft);
  color: var(--text-primary);
}

.prose h2 {
  margin-top: 28px;
  font-size: 1.24rem;
}

.prose p, .prose li {
  color: var(--text-secondary);
  font-size: 0.96rem;
}

.prose code, .callout code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-elevated);
  color: var(--accent-sapphire);
}

.guide-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.guide-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.guide-item h3 {
  font-size: 1.04rem;
  margin-bottom: 6px;
}

.guide-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-hairline);
  background: var(--bg-mat);
  padding: 36px 0 28px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.site-footer__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 18px 28px;
}

.site-footer__brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1rem;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.site-footer__links a {
  color: var(--text-secondary);
}

.site-footer__links a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.site-footer__copy {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .foil-pack__sheen,
  .foil-card--prismatic::before {
    animation: none !important;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
  }
}
