:root {
  /* Palette: Warm-Black-Gold + Grimoire & Relic (Inteligencia / taste-skill, zero purple) */
  --bg: #0c0a08;
  --surface: #15120f;
  --surface-2: #1f1a15;
  --surface-3: #2a231c;
  --border: rgba(242, 236, 224, 0.095);
  --border-strong: rgba(242, 236, 224, 0.16);
  --border-hi: rgba(201, 164, 90, 0.42);
  --inner-hi: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --text: #f2efe9;
  --muted: #a59d90;
  --accent: #c9a45a;
  --accent-bright: #e6c67c;
  --accent-soft: rgba(201, 164, 90, 0.14);
  --accent-glow: rgba(201, 164, 90, 0.22);
  --crimson: #e45858;
  --crimson-soft: rgba(186, 28, 42, 0.18);
  --crimson-border: rgba(228, 88, 88, 0.45);
  --blue: #5ab9fc;
  --hd: #38bdf8;
  --green: #4cc38a;

  /* Typography (taste-skill: Newsreader + Figtree + JetBrains Mono + Noto Sans JP) */
  --font-display: "Newsreader", "Yu Mincho", Georgia, serif;
  --font-sans: "Figtree", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Spacing & Nested Radius Scale (system.md & GUIA-DESIGN-ANTI-SLOP.md) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --radius: 12px;

  /* Motion & Micro-interactions (transitions.dev/_root.css & motion.md) */
  --ease-smooth-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.36, 0.64, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --m-in: 150ms;
  --m-out: 120ms;
  --m-press: 90ms;
  --modal-open-dur: 250ms;
  --modal-close-dur: 150ms;
  --modal-scale: 0.96;
  --tabs-dur: 220ms;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
  overflow-x: clip;
}
body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--bg);
  background-image:
    radial-gradient(920px 440px at 14% -6%, rgba(201, 164, 90, 0.105), transparent 62%),
    radial-gradient(760px 380px at 88% -8%, rgba(186, 28, 42, 0.065), transparent 58%),
    radial-gradient(640px 360px at 52% 108%, rgba(56, 189, 248, 0.045), transparent 64%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.58;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle static SVG grain overlay (backgrounds.md: static feTurbulence <= 0.032 opacity) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.site-header, .site-main, .site-footer {
  position: relative;
  z-index: 2;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  background: var(--accent);
  color: #0c0a08;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--r-sm);
}
.skip-link:focus {
  left: 16px;
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
  transition: color var(--m-in) var(--ease-smooth-out);
}
a:hover {
  color: #f5dfb0;
}

code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  background: rgba(242, 236, 224, 0.055);
  border: 1px solid rgba(242, 236, 224, 0.09);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  color: #efd498;
  word-break: break-all;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 10, 8, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
}
.site-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.site-brand:hover {
  text-decoration: none;
  color: var(--accent-bright);
}
.brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(201, 164, 90, 0.45);
  display: inline-block;
  transition: transform var(--m-in) var(--ease-bounce), border-color var(--m-in) ease;
}
.site-brand:hover .brand-mark {
  transform: scale(1.18);
  border-color: var(--accent-bright);
}
.brand-ver {
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}
.brand-sub {
  font-family: var(--font-mono);
  color: var(--accent-bright);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-hi);
}

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
}
.nav-link {
  color: var(--muted);
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  transition:
    background var(--tabs-dur) var(--ease-smooth-out),
    color var(--m-in) var(--ease-smooth-out),
    transform var(--m-press) var(--ease-smooth-out);
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-link:active {
  transform: scale(0.98);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(201, 164, 90, 0.34);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  box-shadow: var(--inner-hi);
}
.lang-pill {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  transition: background var(--tabs-dur) var(--ease-smooth-out), color var(--m-in) var(--ease-smooth-out);
}
.lang-pill:hover {
  color: var(--text);
  text-decoration: none;
}
.lang-pill.active {
  background: var(--accent);
  color: #0c0a08;
  box-shadow: 0 2px 8px rgba(201, 164, 90, 0.35);
}

.site-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 22px 72px;
  overflow-x: clip;
}
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(12, 10, 8, 0.78);
  color: var(--muted);
  font-size: 12.5px;
}
.site-footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.footer-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(201, 164, 90, 0.08);
  border: 1px solid rgba(201, 164, 90, 0.24);
  padding: 3px 9px;
  border-radius: 999px;
}

/* Spotlight surface & entrance choreography (React Bits SpotlightCard + motion.md) */
[data-spotlight] {
  position: relative;
  overflow: hidden;
  --spot-x: 50%;
  --spot-y: 0%;
}
[data-spotlight]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    460px circle at var(--spot-x) var(--spot-y),
    rgba(201, 164, 90, 0.11),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 240ms var(--ease-smooth-out);
}
[data-spotlight]:hover::after {
  opacity: 1;
}

@keyframes enterUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
[data-enter] {
  animation: enterUp 320ms var(--ease-smooth-out) both;
}

/* Page Head & Split Hero Showcase */
.page-head {
  margin-bottom: 20px;
  padding: 22px 24px;
  background: linear-gradient(155deg, rgba(31, 26, 21, 0.92), rgba(21, 18, 15, 0.96));
  border: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--inner-hi), 0 14px 36px rgba(0, 0, 0, 0.38);
}
.page-head-hero {
  padding: 28px 28px;
}
.hero-eyebrow, .card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 8px;
}
.hero-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.page-head h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-lead {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  max-width: 64ch;
}

.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.85fr);
  gap: 28px;
  align-items: center;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  transition:
    transform var(--m-in) var(--ease-smooth-out),
    background var(--m-in) var(--ease-smooth-out),
    border-color var(--m-in) var(--ease-smooth-out),
    box-shadow var(--m-in) var(--ease-smooth-out);
}
.btn-primary {
  background: linear-gradient(180deg, #d7b368, #b99145);
  color: #0c0a08;
  border: 1px solid rgba(255, 232, 178, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 18px rgba(201, 164, 90, 0.24);
}
.btn-primary:hover {
  color: #0c0a08;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 24px rgba(201, 164, 90, 0.34);
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--inner-hi);
}
.btn-secondary:hover {
  color: var(--accent-bright);
  border-color: var(--border-hi);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary:active, .btn-secondary:active {
  transform: translateY(0) scale(0.98);
  transition-duration: var(--m-press);
}

.m-arrow {
  display: inline-block;
  transition: transform var(--m-in) var(--ease-smooth-out);
}
.btn-primary:hover .m-arrow,
.home-card:hover .m-arrow {
  transform: translateX(3px);
}

/* 3-Card D-Force HD Fanned Stage */
.hero-card-stage {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 210px;
  padding: 14px 0;
}
.hero-card-slot {
  position: relative;
  flex: 0 0 auto;
  transition: transform 260ms var(--ease-smooth-out);
}
.hero-showcase-img {
  display: block;
  width: clamp(82px, 11vw, 122px);
  height: auto;
  border-radius: 8px;
  padding: 2px;
  background: linear-gradient(145deg, rgba(230, 198, 124, 0.42), #15120f);
  border: 1px solid var(--border-hi);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.65);
  cursor: zoom-in;
  transition: transform 260ms var(--ease-smooth-out), box-shadow 260ms var(--ease-smooth-out), border-color 200ms ease;
}
.hero-card-slot.slot-1 {
  transform: translateX(18px) translateY(8px) rotate(-9deg);
  z-index: 1;
}
.hero-card-slot.slot-2 {
  transform: translateY(-6px) scale(1.06);
  z-index: 3;
}
.hero-card-slot.slot-2 .hero-showcase-img {
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.75), 0 0 24px rgba(201, 164, 90, 0.22);
}
.hero-card-slot.slot-3 {
  transform: translateX(-18px) translateY(8px) rotate(9deg);
  z-index: 2;
}
@media (hover: hover) and (pointer: fine) {
  .hero-card-stage:hover .hero-card-slot.slot-1 {
    transform: translateX(8px) translateY(4px) rotate(-12deg);
  }
  .hero-card-stage:hover .hero-card-slot.slot-2 {
    transform: translateY(-12px) scale(1.1);
  }
  .hero-card-stage:hover .hero-card-slot.slot-3 {
    transform: translateX(-8px) translateY(4px) rotate(12deg);
  }
  .hero-card-slot:hover {
    z-index: 5;
  }
  .hero-showcase-img:hover {
    border-color: var(--accent-bright);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.82), 0 0 24px rgba(230, 198, 124, 0.4);
  }
}
.hero-stage-caption {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  box-shadow: var(--inner-hi);
}
.hero-stat strong {
  font-family: var(--font-mono);
  color: var(--accent-bright);
  font-weight: 600;
}
.hero-stat-hd {
  border-color: rgba(56, 189, 248, 0.36);
  background: rgba(56, 189, 248, 0.085);
}
.hero-stat-hd strong {
  color: #7cd8ff;
}

/* Bento Home Grid */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.home-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, rgba(31, 26, 21, 0.72), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 22px;
  color: var(--text);
  box-shadow: var(--inner-hi), 0 10px 28px rgba(0, 0, 0, 0.28);
  transition:
    border-color var(--m-in) var(--ease-smooth-out),
    transform var(--m-in) var(--ease-smooth-out),
    box-shadow var(--m-in) var(--ease-smooth-out);
}
.home-card:hover {
  border-color: var(--border-hi);
  transform: translateY(-2px);
  box-shadow: var(--inner-hi), 0 16px 34px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(201, 164, 90, 0.22);
  text-decoration: none;
}
.home-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.home-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.home-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-bright);
  background: var(--accent-soft);
  border: 1px solid var(--border-hi);
  padding: 2px 10px;
  border-radius: var(--r-sm);
}
.home-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}
.card-action {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-bright);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Interactive Filter Bar & Controls */
.wiki-controls {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--inner-hi), 0 10px 26px rgba(0, 0, 0, 0.28);
}
.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.wiki-search {
  flex: 1 1 280px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 9px 13px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--m-in) var(--ease-smooth-out), box-shadow var(--m-in) var(--ease-smooth-out);
}
.wiki-search::placeholder {
  color: rgba(165, 157, 144, 0.72);
}
.wiki-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 164, 90, 0.16);
}
.result-count {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.clear-btn {
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 500;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color var(--m-in) var(--ease-smooth-out),
    background var(--m-in) var(--ease-smooth-out),
    transform var(--m-press) var(--ease-smooth-out);
}
.clear-btn:hover {
  border-color: var(--border-hi);
  background: var(--surface-3);
}
.clear-btn:active {
  transform: scale(0.97);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.filter-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 4px;
}
.pill {
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--tabs-dur) var(--ease-smooth-out),
    color var(--m-in) var(--ease-smooth-out),
    border-color var(--m-in) var(--ease-smooth-out),
    transform var(--m-press) var(--ease-smooth-out);
}
.pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-3);
}
.pill:active {
  transform: scale(0.97);
}
.pill.active {
  background: var(--accent-soft);
  color: var(--accent-bright);
  border-color: var(--border-hi);
  font-weight: 600;
}

/* Catalog Sections & Data Tables */
.cat-section {
  margin-bottom: 30px;
}
.cat-section.is-hidden {
  display: none;
}
.cat-title {
  margin: 0 0 11px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 7px;
}
.cat-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--inner-hi), 0 10px 28px rgba(0, 0, 0, 0.26);
}
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.wiki-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.wiki-table td {
  padding: 10px 13px;
  border-bottom: 1px solid rgba(242, 236, 224, 0.06);
  vertical-align: middle;
}
.wiki-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.012);
}
.wiki-table tbody tr {
  transition: background-color 120ms ease;
}
.wiki-table tbody tr:hover {
  background: rgba(201, 164, 90, 0.065);
}
.wiki-table tbody tr.is-hidden {
  display: none;
}

.col-img {
  width: 56px;
  text-align: center;
}
.wiki-table-cards .col-img {
  width: 116px;
}
.wiki-table td.col-img img {
  display: block;
  margin: 0 auto;
  cursor: zoom-in;
  image-rendering: pixelated;
  border-radius: var(--r-sm);
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  transition:
    transform var(--m-in) var(--ease-smooth-out),
    box-shadow var(--m-in) var(--ease-smooth-out),
    border-color var(--m-in) var(--ease-smooth-out);
}
.wiki-table td.col-img img:hover {
  transform: scale(1.08);
  border-color: var(--border-hi);
}
.wiki-table td.col-img img.card-hd {
  width: 96px;
  height: auto;
  image-rendering: auto;
  padding: 2px;
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(201, 164, 90, 0.28), #14110e);
  border: 1px solid var(--border-hi);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.5);
}
.wiki-table td.col-img img.card-hd:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: var(--accent-bright);
  box-shadow: 0 10px 24px rgba(201, 164, 90, 0.26);
}
.no-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.col-name {
  min-width: 195px;
}
.name-pt {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}
.name-jp {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.col-id {
  white-space: nowrap;
}
.copy-id {
  margin-left: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
  cursor: pointer;
  transition: color var(--m-in) ease, background var(--m-in) ease, border-color var(--m-in) ease;
}
.copy-id:hover {
  color: var(--accent-bright);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.copy-id.copied {
  color: var(--green);
}

.col-meta {
  min-width: 145px;
  font-size: 12px;
  color: var(--muted);
}
.col-no {
  white-space: nowrap;
  min-width: 96px;
}
.card-no {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  font-size: 12.5px;
}
.card-bc {
  margin-top: 3px;
}

/* Rarity & Status Badges (Zero purple: EX uses Grimoire Crimson) */
.col-rarity {
  white-space: nowrap;
}
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  margin: 2px 2px 2px 0;
}
.badge-c {
  color: #c7c0b4;
}
.badge-uc {
  color: var(--blue);
  border-color: rgba(90, 185, 252, 0.38);
  background: rgba(90, 185, 252, 0.09);
}
.badge-r {
  color: var(--accent-bright);
  border-color: var(--border-hi);
  background: var(--accent-soft);
}
.badge-ex {
  color: #ff8a8a;
  border-color: var(--crimson-border);
  background: var(--crimson-soft);
}
.badge-card {
  color: var(--green);
  border-color: rgba(76, 195, 138, 0.38);
  background: rgba(76, 195, 138, 0.09);
}
.badge-star {
  color: var(--accent-bright);
  border-color: var(--border-hi);
}
.badge-hd {
  color: #7cd8ff;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}
.pill-hd {
  border-color: rgba(56, 189, 248, 0.35);
  color: #8fdfff;
}
.pill-hd.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--hd);
  color: #eefaff;
}

.col-info {
  min-width: 260px;
}
.cell-stat {
  color: #efe2c6;
  font-size: 13px;
  font-weight: 500;
}
.cell-desc {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.cell-xbe {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.xbe-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}
.xbe-price {
  color: #f3d27a;
  border-color: rgba(243, 210, 122, 0.32);
  background: rgba(243, 210, 122, 0.08);
}
.xbe-atk {
  color: #ffb074;
  border-color: rgba(255, 145, 77, 0.36);
  background: rgba(255, 145, 77, 0.1);
}
.xbe-res {
  color: #7ee2b8;
  border-color: rgba(76, 195, 138, 0.36);
  background: rgba(76, 195, 138, 0.09);
}
.xbe-def {
  color: #8fd3ff;
  border-color: rgba(90, 185, 252, 0.35);
  background: rgba(90, 185, 252, 0.09);
}
.xbe-stat {
  color: #c5b6ff;
  border-color: rgba(167, 139, 250, 0.36);
  background: rgba(167, 139, 250, 0.1);
}
.xbe-status {
  color: #7ee8fa;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.09);
}
.xbe-neg {
  color: #ff9c9c;
  border-color: var(--crimson-border);
  background: var(--crimson-soft);
}
.muted {
  color: var(--muted);
}

.empty-state {
  display: none;
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
}

/* Modal Lightbox with Holo/Scale Choreography (06-modal.md + HoloCard.tsx) */
@keyframes lbModalIn {
  from {
    opacity: 0;
    transform: scale(var(--modal-scale));
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
#lb-ov {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 5, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  z-index: 9999;
  cursor: zoom-out;
  --holo-x: 50%;
  --holo-y: 50%;
}
#lb-ov.open {
  display: flex;
}
#lb-ov.open img {
  animation: lbModalIn var(--modal-open-dur) var(--ease-smooth-out) both;
}
#lb-ov img {
  min-width: 160px;
  max-width: 88vw;
  max-height: 78vh;
  image-rendering: pixelated;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  padding: 8px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.72);
}
#lb-ov img.lb-hd {
  min-width: min(310px, 80vw);
  width: auto;
  height: auto;
  image-rendering: auto;
  padding: 10px;
  background:
    radial-gradient(circle at var(--holo-x) var(--holo-y), rgba(230, 198, 124, 0.24), transparent 55%),
    var(--surface);
  border: 1px solid var(--border-hi);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.82), 0 0 28px rgba(201, 164, 90, 0.22);
}
#lb-cap {
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  max-width: 680px;
  text-align: center;
  background: rgba(21, 18, 15, 0.92);
  border: 1px solid var(--border-strong);
  padding: 7px 16px;
  border-radius: 999px;
  box-shadow: var(--inner-hi);
}

/* Deck Builder Header Button, Table Controls & Modal */
.nav-deck-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-bright);
  background: rgba(201, 164, 90, 0.1);
  border: 1px solid rgba(201, 164, 90, 0.34);
  cursor: pointer;
  transition:
    background var(--m-in) var(--ease-smooth-out),
    border-color var(--m-in) var(--ease-smooth-out),
    transform var(--m-press) var(--ease-smooth-out),
    box-shadow var(--m-in) var(--ease-smooth-out);
}
.nav-deck-btn:hover {
  background: rgba(201, 164, 90, 0.2);
  border-color: var(--accent-bright);
  box-shadow: 0 0 14px rgba(201, 164, 90, 0.25);
}
.nav-deck-btn:active {
  transform: scale(0.97);
}
.nav-deck-btn.has-cards {
  background: linear-gradient(180deg, rgba(215, 179, 104, 0.24), rgba(185, 145, 69, 0.16));
  border-color: var(--accent-bright);
}
@keyframes deckPulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.09); box-shadow: 0 0 18px rgba(230, 198, 124, 0.55); }
  100% { transform: scale(1); }
}
.nav-deck-btn.pulse {
  animation: deckPulse 280ms var(--ease-bounce);
}
.deck-icon-svg {
  flex-shrink: 0;
  color: var(--accent-bright);
}
.deck-nav-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(12, 10, 8, 0.65);
  color: var(--text);
  border: 1px solid rgba(201, 164, 90, 0.32);
}
.nav-deck-btn.has-cards .deck-nav-badge {
  background: var(--accent);
  color: #0c0a08;
  border-color: transparent;
}

.badge-limit {
  color: #e6d5b8;
  border-color: rgba(201, 164, 90, 0.32);
  background: rgba(201, 164, 90, 0.09);
}

.wiki-table tbody tr.has-deck-card {
  cursor: pointer;
}
.wiki-table tbody tr.in-deck {
  background: rgba(201, 164, 90, 0.11) !important;
  box-shadow: inset 3px 0 0 var(--accent-bright);
}
.wiki-table td.col-img {
  position: relative;
}
.zoom-img-btn {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  background: rgba(21, 18, 15, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  cursor: zoom-in;
  transition: color var(--m-in) ease, border-color var(--m-in) ease;
}
.zoom-img-btn:hover {
  color: var(--accent-bright);
  border-color: var(--border-hi);
}

.row-deck-ctrl {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.row-deck-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-bright);
  background: rgba(201, 164, 90, 0.11);
  border: 1px solid rgba(201, 164, 90, 0.32);
  cursor: pointer;
  transition: background var(--m-in) ease, border-color var(--m-in) ease, transform var(--m-press) ease;
}
.row-deck-add:hover {
  background: rgba(201, 164, 90, 0.22);
  border-color: var(--accent-bright);
}
.row-deck-add:active {
  transform: scale(0.96);
}
.row-deck-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(12, 10, 8, 0.78);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 2px 4px;
}
.rd-btn {
  width: 22px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rd-btn:hover {
  border-color: var(--accent-bright);
  color: var(--accent-bright);
}
.rd-qty {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent-bright);
  padding: 0 5px;
}

/* Deck Builder Modal */
#deck-modal-ov {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 5, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9500;
}
#deck-modal-ov.open {
  display: flex;
}
.deck-dialog {
  width: min(880px, 96vw);
  max-height: 88vh;
  max-height: 90dvh;
  background: linear-gradient(165deg, #1b1612, #120f0c);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--inner-hi), 0 24px 64px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: lbModalIn var(--modal-open-dur) var(--ease-smooth-out) both;
}
.deck-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-strong);
  background: rgba(31, 26, 21, 0.65);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deck-hdr-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.deck-hdr-title h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}
.deck-close-btn {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
}
.deck-close-btn:hover {
  color: var(--text);
  border-color: var(--border-hi);
}

.deck-meters {
  padding: 12px 20px;
  background: rgba(12, 10, 8, 0.55);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deck-meter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.deck-slot-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.deck-slot-pill {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}
.deck-slot-pill strong {
  color: var(--accent-bright);
}
.deck-slot-pill.warn {
  border-color: var(--crimson-border);
  background: var(--crimson-soft);
  color: #ffb0b0;
}
.deck-bar-track {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.deck-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 999px;
  transition: width 180ms var(--ease-smooth-out);
}
.deck-bar-fill.full {
  background: linear-gradient(90deg, #e6a23c, var(--crimson));
}

.deck-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deck-empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.deck-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--inner-hi);
}
.deck-item-thumb {
  width: 52px;
  height: 68px;
  object-fit: contain;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  padding: 2px;
  cursor: zoom-in;
}
.deck-item-info {
  min-width: 0;
}
.deck-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.deck-item-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.deck-item-effect {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent-bright);
  margin-top: 4px;
}
.deck-item-ctrls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.deck-qty-input {
  width: 56px;
  padding: 5px 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm);
}
.deck-qty-max-lbl {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-right: 4px;
}
.deck-mini-btn {
  padding: 5px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.deck-mini-btn:hover {
  border-color: var(--border-hi);
  color: var(--accent-bright);
}
.deck-mini-btn.danger:hover {
  border-color: var(--crimson-border);
  color: #ff9494;
  background: var(--crimson-soft);
}

.deck-ftr {
  padding: 14px 20px;
  border-top: 1px solid var(--border-strong);
  background: rgba(21, 18, 15, 0.95);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.deck-ftr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.deck-ftr-left, .deck-ftr-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.deck-status-msg {
  font-size: 12.5px;
  color: var(--accent-bright);
  min-height: 18px;
}
.deck-status-msg.err {
  color: #ff8a8a;
}
.deck-status-msg.ok {
  color: var(--green);
}

/* Modal Tab Switcher + AI Recommended Decks Panel */
.deck-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(14, 11, 9, 0.78);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.deck-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.deck-tab:hover {
  color: var(--text);
  border-color: var(--border-hi);
}
.deck-tab.active {
  color: var(--accent-bright);
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(201, 164, 90, 0.18), rgba(201, 164, 90, 0.06));
}
.deck-tab-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.deck-empty-cta {
  margin-top: 14px;
}

.ai-rec-intro {
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: rgba(201, 164, 90, 0.08);
  border: 1px solid rgba(201, 164, 90, 0.28);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
.ai-rec-intro strong {
  color: var(--accent-bright);
}
.ai-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.ai-filter-pill {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ai-filter-pill:hover {
  color: var(--text);
  border-color: var(--border-hi);
}
.ai-filter-pill.active {
  color: var(--bg);
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

.ai-deck-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--inner-hi);
}
.ai-deck-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.ai-deck-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ai-deck-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ai-class-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(90, 185, 252, 0.45);
  background: rgba(90, 185, 252, 0.14);
  color: #8fd3ff;
}
.ai-class-badge.cls-WIZARD { border-color: rgba(164, 126, 255, 0.5); background: rgba(164, 126, 255, 0.16); color: #d1b8ff; }
.ai-class-badge.cls-FIGHTER { border-color: rgba(235, 110, 95, 0.5); background: rgba(235, 110, 95, 0.16); color: #ffb3a8; }
.ai-class-badge.cls-THIEF { border-color: rgba(88, 214, 141, 0.48); background: rgba(88, 214, 141, 0.14); color: #9cf2bf; }
.ai-class-badge.cls-PRIEST { border-color: rgba(230, 198, 124, 0.55); background: rgba(230, 198, 124, 0.16); color: #ffe39e; }

.ai-deck-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
}
.ai-deck-source {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.ai-deck-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ai-stat-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--accent-bright);
}
.ai-deck-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
}

.ai-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 7px;
}
.ai-card-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  background: rgba(12, 10, 8, 0.65);
  border: 1px solid var(--border);
  min-width: 0;
}
.ai-card-chip img {
  width: 30px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
  background: var(--surface-2);
  cursor: zoom-in;
}
.ai-card-chip-txt {
  min-width: 0;
  flex: 1 1 auto;
}
.ai-card-chip-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-card-chip-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.ai-card-chip-qty {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bright);
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(201, 164, 90, 0.14);
  border: 1px solid rgba(201, 164, 90, 0.35);
  flex-shrink: 0;
}

.ai-gear-box {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(26, 20, 14, 0.85);
  border: 1px dashed rgba(201, 164, 90, 0.42);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ai-gear-hdr {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--accent-bright);
  text-transform: uppercase;
}
.ai-gear-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ai-gear-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
}
.ai-gear-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  flex-shrink: 0;
}
.ai-gear-tag.t-weapon { color: #ffd089; border-color: rgba(255, 208, 137, 0.4); }
.ai-gear-tag.t-acces, .ai-gear-tag.t-armor { color: #8fd3ff; border-color: rgba(90, 185, 252, 0.38); }
.ai-gear-tag.t-ex { color: #d1b8ff; border-color: rgba(164, 126, 255, 0.42); }
.ai-gear-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(201, 164, 90, 0.5);
  text-underline-offset: 2px;
}
.ai-gear-link:hover {
  color: var(--accent-bright);
}
.ai-gear-note {
  color: var(--muted);
  font-size: 11.5px;
}

.ai-deck-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}
.ai-deck-status {
  font-size: 12px;
  color: var(--accent-bright);
  margin-right: auto;
}
.ai-deck-status.ok { color: var(--green); }
.ai-deck-status.err { color: #ff8a8a; }

#deck-toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  max-width: calc(100vw - 32px);
  z-index: 9800;
  background: rgba(21, 18, 15, 0.96);
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms var(--ease-smooth-out);
}
#deck-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1140px) {
  .site-main {
    padding: 22px 16px 60px;
  }
  .wiki-table th,
  .wiki-table td {
    padding: 9px 10px;
  }
  .wiki-table-cards .col-img {
    width: 92px;
  }
  .wiki-table td.col-img img.card-hd {
    width: 78px;
  }
  .col-no {
    min-width: 76px;
    white-space: normal;
  }
  .col-rarity {
    white-space: normal;
  }
  .col-name {
    min-width: 145px;
  }
  .col-meta {
    min-width: 120px;
  }
  .col-info {
    min-width: 185px;
  }
  .col-id {
    white-space: normal;
    max-width: 190px;
  }
  .col-id code {
    font-size: 11px;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 940px) {
  .site-header-inner {
    padding: 10px 14px;
    gap: 8px 10px;
  }
  .header-right {
    display: contents;
  }
  .site-brand {
    order: 1;
    font-size: 18px;
    gap: 7px;
  }
  .brand-ver {
    font-size: 13px;
  }
  .lang-switch {
    order: 2;
  }
  .site-nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .nav-link,
  .nav-deck-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .hero-split {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .hero-card-stage {
    min-height: 170px;
    margin-top: 4px;
  }
}

@media (max-width: 860px) {
  .site-main {
    padding: 16px 12px 52px;
  }
  .table-scroll {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .wiki-table,
  .wiki-table tbody {
    display: block;
    width: 100%;
  }
  .wiki-table thead {
    display: none;
  }
  .wiki-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .wiki-table tbody tr,
  .wiki-table tbody tr:nth-child(even) {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    grid-template-areas:
      "img name"
      "img meta"
      "info info"
      "id id";
    column-gap: 12px;
    row-gap: 6px;
    align-items: start;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 12px;
    box-shadow: var(--inner-hi), 0 6px 18px rgba(0, 0, 0, 0.24);
  }
  .wiki-table.wiki-table-cards tbody tr,
  .wiki-table.wiki-table-cards tbody tr:nth-child(even) {
    grid-template-columns: 82px minmax(0, 1fr);
    grid-template-areas:
      "img name"
      "img no"
      "img rarity"
      "info info"
      "id id";
  }
  .wiki-table tbody tr.is-hidden {
    display: none;
  }
  .wiki-table tbody tr.in-deck {
    background: rgba(201, 164, 90, 0.11) !important;
    border-color: var(--border-hi);
    box-shadow: inset 3px 0 0 var(--accent-bright), 0 6px 18px rgba(0, 0, 0, 0.26);
  }
  .wiki-table td {
    display: block;
    padding: 0;
    border: none;
    min-width: 0;
    max-width: none;
    width: auto;
  }
  .wiki-table td.col-img,
  .wiki-table-cards td.col-img {
    grid-area: img;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }
  .wiki-table td.col-img img.card-hd {
    width: 76px;
  }
  .zoom-img-btn {
    width: 100%;
    padding: 4px 6px;
    font-size: 10.5px;
  }
  .wiki-table td.col-name {
    grid-area: name;
  }
  .wiki-table td.col-no {
    grid-area: no;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    white-space: normal;
  }
  .wiki-table td.col-no .card-bc {
    margin-top: 0;
  }
  .wiki-table td.col-rarity {
    grid-area: rarity;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    white-space: normal;
  }
  .wiki-table td.col-meta {
    grid-area: meta;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    white-space: normal;
  }
  .wiki-table td.col-rarity br,
  .wiki-table td.col-meta br {
    display: none;
  }
  .wiki-table td.col-rarity .badge,
  .wiki-table td.col-meta .badge {
    margin: 0;
  }
  .wiki-table td.col-info {
    grid-area: info;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px solid rgba(242, 236, 224, 0.06);
  }
  .wiki-table td.col-id {
    grid-area: id;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    white-space: normal;
  }
  .wiki-table td.col-id code {
    font-size: 11px;
    overflow-wrap: anywhere;
  }
  .wiki-table td.col-id .copy-id {
    margin-left: 0;
    padding: 3px 8px;
  }
  .row-deck-add {
    padding: 5px 10px;
    font-size: 12px;
    min-height: 32px;
  }
  .rd-btn {
    width: 28px;
    height: 26px;
    font-size: 14px;
  }
  .rd-qty {
    font-size: 12px;
    padding: 0 7px;
  }
  .deck-dialog {
    width: 98vw;
    max-height: 90vh;
    max-height: 90dvh;
  }
  .deck-item {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }
  .deck-item-ctrls {
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 6px;
    border-top: 1px solid rgba(242, 236, 224, 0.06);
  }
}

@media (max-width: 640px) {
  body {
    background-attachment: scroll;
  }
  .page-head {
    padding: 16px;
    margin-bottom: 14px;
    border-radius: var(--r-md);
  }
  .page-head-hero {
    padding: 18px 16px;
  }
  .page-head h1 {
    font-size: clamp(22px, 6.2vw, 28px);
  }
  .page-lead {
    font-size: 13.5px;
  }
  .hero-eyebrow,
  .card-kicker {
    font-size: 10px;
    letter-spacing: 0.07em;
    flex-wrap: wrap;
  }
  .hero-stats {
    gap: 6px;
  }
  .hero-stat {
    font-size: 11.5px;
    padding: 4px 9px;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    justify-content: center;
  }
  .home-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 16px 0;
  }
  .home-card {
    padding: 16px;
    border-radius: var(--r-md);
  }
  .wiki-controls {
    padding: 12px;
    gap: 9px;
    margin-bottom: 14px;
    border-radius: var(--r-md);
  }
  .search-row {
    gap: 8px;
  }
  .wiki-search {
    flex: 1 1 100%;
    font-size: 16px;
    padding: 10px 12px;
  }
  .result-count {
    margin-right: auto;
    font-size: 12px;
  }
  .clear-btn {
    min-height: 36px;
    padding: 6px 14px;
  }
  .filter-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .filter-group::-webkit-scrollbar {
    display: none;
  }
  .filter-label {
    flex: 0 0 auto;
    white-space: nowrap;
    margin-right: 2px;
  }
  .pill {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
  .cat-title {
    font-size: 18px;
  }
  .site-footer-inner {
    justify-content: center;
    text-align: center;
    padding: 16px 14px;
  }
  #lb-ov {
    padding: 14px;
  }
  #lb-ov img {
    max-width: 92vw;
    max-height: 74vh;
    max-height: 74dvh;
  }
  #lb-cap {
    max-width: 92vw;
    border-radius: 14px;
    padding: 8px 14px;
    font-size: 12.5px;
  }
  #deck-modal-ov {
    padding: 8px;
    align-items: flex-end;
  }
  .deck-dialog {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 14px;
  }
  .deck-hdr {
    padding: 12px 14px;
    flex-wrap: nowrap;
  }
  .deck-hdr-title {
    min-width: 0;
    flex-wrap: wrap;
    gap: 8px;
  }
  .deck-hdr-title h2 {
    font-size: 18px;
    line-height: 1.2;
  }
  .deck-close-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
  }
  .deck-meters {
    padding: 10px 14px;
    gap: 6px;
  }
  .deck-meter-row {
    font-size: 12px;
    gap: 6px;
  }
  .deck-slot-pill {
    font-size: 11px;
    padding: 3px 7px;
  }
  .deck-body {
    padding: 10px 14px;
    gap: 8px;
  }
  .deck-item {
    padding: 10px;
  }
  .deck-item-thumb {
    width: 46px;
    height: 62px;
  }
  .deck-item-title code {
    font-size: 11px;
  }
  .deck-item-ctrls {
    justify-content: flex-start;
  }
  .deck-qty-input {
    font-size: 16px;
    width: 58px;
    min-height: 36px;
  }
  .deck-mini-btn {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 12px;
  }
  .deck-ftr {
    padding: 10px 14px;
    gap: 8px;
  }
  .deck-ftr-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .deck-ftr-left,
  .deck-ftr-right {
    width: 100%;
  }
  .deck-ftr-right .btn-primary {
    flex: 1 1 100%;
    justify-content: center;
    min-height: 40px;
  }
  .deck-ftr-right .btn-secondary,
  .deck-ftr-left > * {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
    min-height: 36px;
  }
  .deck-tabs {
    padding: 8px 14px;
    gap: 6px;
  }
  .deck-tab {
    flex: 1 1 0;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12.5px;
    min-height: 36px;
  }
  .ai-deck-card {
    padding: 12px;
  }
  .ai-cards-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .ai-deck-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .ai-deck-actions > .btn-primary,
  .ai-deck-actions > .btn-secondary {
    width: 100%;
    justify-content: center;
    min-height: 38px;
  }
  #deck-toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
    text-align: center;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .site-brand {
    font-size: 16px;
    gap: 6px;
  }
  .brand-ver {
    font-size: 12px;
  }
  .brand-sub {
    font-size: 9.5px;
    padding: 1px 6px;
    letter-spacing: 0.06em;
  }
  .lang-pill {
    padding: 4px 8px;
    font-size: 11px;
  }
  .nav-link,
  .nav-deck-btn {
    padding: 5px 10px;
    font-size: 12.5px;
  }
  .wiki-table.wiki-table-cards tbody tr,
  .wiki-table.wiki-table-cards tbody tr:nth-child(even) {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .wiki-table td.col-img img.card-hd {
    width: 68px;
  }
}

@media (max-height: 540px) {
  .site-header {
    position: relative;
  }
  .deck-dialog {
    max-height: 96vh;
    max-height: 96dvh;
    overflow-y: auto;
  }
  .deck-body {
    overflow: visible;
    flex: none;
  }
}

@media (hover: none) {
  [data-spotlight]:hover::after {
    opacity: 0;
  }
  .btn-primary:hover,
  .btn-secondary:hover,
  .home-card:hover,
  .wiki-table td.col-img img:hover,
  .wiki-table td.col-img img.card-hd:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
