/* ==========================================================
   CYBERTRON ARCHIVE — core stylesheet
   ========================================================== */

:root {
  --bg: #06080e;
  --bg-2: #090d16;
  --bg-3: #0d1220;
  --panel: rgba(14, 20, 34, .74);
  --panel-solid: #0d1320;
  --line: rgba(168, 184, 210, .13);
  --line-strong: rgba(168, 184, 210, .28);
  --text: #eef1f7;
  --muted: #98a4b8;
  --dim: #667287;
  --accent: #ff4141;
  --accent-soft: rgba(255, 65, 65, .14);
  --amber: #ffb020;
  --cyan: #5eead4;
  --violet: #a78bfa;
  --green: #34d399;
  --radius: 3px;
  --header-h: 76px;
  --container: 1240px;
  --font-display: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Microsoft YaHei UI", sans-serif;
  --font-sans: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.modal-open { overflow: hidden; }

::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #06080e; }
::-webkit-scrollbar-thumb {
  background: #283247;
  border: 2px solid #06080e;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: #3b4964; }

img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3, h4, dl, dd, blockquote { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

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

.container {
  width: min(var(--container), calc(100% - 64px));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 999;
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

.page-noise {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

.cursor-glow {
  position: fixed;
  z-index: 0;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 65, 65, .075), transparent 62%);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity .4s;
  will-change: transform;
}
@media (pointer: fine) { .cursor-glow { opacity: 1; } }

/* ============================== HEADER ============================== */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background .35s, border-color .35s, backdrop-filter .35s;
}
.site-header.is-scrolled {
  background: rgba(6, 8, 14, .82);
  border-bottom-color: var(--line);
  backdrop-filter: blur(18px) saturate(130%);
}
.header-inner {
  width: min(var(--container), calc(100% - 64px));
  height: 100%;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  flex-shrink: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  color: var(--accent);
  filter: drop-shadow(0 0 12px rgba(255, 65, 65, .35));
  transition: transform .5s var(--ease);
}
.brand:hover .brand-mark { transform: rotate(60deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .08em;
}
.brand-text small {
  margin-top: 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .24em;
}
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a {
  position: relative;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: .04em;
  transition: color .2s;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s var(--ease);
}
.site-nav a:hover { color: var(--text); }
.site-nav a:hover::after { transform: scaleX(1); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  box-shadow: 0 0 10px var(--accent);
}
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: var(--text);
  transition: transform .25s, opacity .25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================== BUTTONS ============================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
  transition: background .25s, color .25s, border-color .25s, transform .25s, box-shadow .25s;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 32px rgba(255, 65, 65, .22);
}
.btn-primary:hover {
  background: #ff5c5c;
  border-color: #ff5c5c;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(255, 65, 65, .34);
}
.btn-outline {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, .02);
}
.btn-outline:hover {
  border-color: var(--text);
  background: rgba(255, 255, 255, .06);
  transform: translateY(-2px);
}
.btn-ghost {
  min-height: 40px;
  padding: 0 15px;
  border-color: var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); }
.btn-ghost svg { width: 15px; height: 15px; }

/* ============================== HERO ============================== */

.hero {
  position: relative;
  min-height: 100svh;
  padding: calc(var(--header-h) + 68px) 0 96px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(168, 184, 210, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 184, 210, .055) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 78% 72% at 54% 44%, #000 22%, transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at 54% 44%, #000 22%, transparent 76%);
}
.hero-grid-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, transparent 26%, transparent 74%, var(--bg) 100%);
}
.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}
.hero-orb-a {
  width: 540px;
  height: 540px;
  right: -100px;
  top: 4%;
  background: rgba(255, 65, 65, .15);
  animation: orbFloat 14s ease-in-out infinite alternate;
}
.hero-orb-b {
  width: 460px;
  height: 460px;
  left: -160px;
  bottom: 2%;
  background: rgba(94, 234, 212, .07);
  animation: orbFloat 18s ease-in-out infinite alternate-reverse;
}
.hero-scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .12) 3px 4px);
  opacity: .35;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(340px, .86fr);
  align-items: center;
  gap: clamp(40px, 6vw, 90px);
}
.hero-copy { position: relative; }
.eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.eyebrow-index {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 21px;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 10px;
}
.eyebrow-sep { color: var(--accent); }
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, .12), 0 0 12px var(--green);
  animation: pulseDot 2.2s ease-in-out infinite;
}
.hero-title {
  margin: 26px 0 0;
  font-family: var(--font-display);
  font-size: clamp(58px, 9.2vw, 128px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.045em;
}
.title-line { display: block; }
.title-accent {
  position: relative;
  width: fit-content;
  color: var(--accent);
  text-shadow: 0 0 52px rgba(255, 65, 65, .3);
}
.title-cursor {
  display: inline-block;
  width: .09em;
  height: .68em;
  margin-left: .08em;
  background: var(--accent);
  vertical-align: .02em;
  animation: blink 1.1s steps(2, start) infinite;
}
.hero-lede {
  margin-top: 28px;
  color: var(--muted);
  font-size: clamp(15px, 1.25vw, 17px);
  line-height: 1.95;
  max-width: 34em;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: clamp(44px, 6vw, 72px);
  border-top: 1px solid var(--line);
  max-width: 560px;
}
.hero-stats > div {
  padding: 18px 18px 0 0;
  border-right: 1px solid var(--line);
}
.hero-stats > div:last-child { border-right: 0; }
.hero-stats dt {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .12em;
}
.hero-stats dd {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
}
.hero-stats dd small {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .14em;
}
.hero-stats .infinity { color: var(--accent); }

.hero-visual { position: relative; }
.target-frame {
  position: relative;
  aspect-ratio: 4 / 4.72;
  max-height: 610px;
  margin-inline: auto;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 65, 65, .12), transparent 62%),
    linear-gradient(160deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, 0) 58%),
    var(--bg-2);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
}
.target-frame::before {
  content: "";
  position: absolute;
  inset: 11px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 3;
}
.target-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 8, 14, .55) 0, transparent 22%, transparent 62%, rgba(6, 8, 14, .92) 100%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .08) 3px 4px);
}
.corner {
  position: absolute;
  z-index: 5;
  width: 18px;
  height: 18px;
  border-color: var(--accent);
  border-style: solid;
  pointer-events: none;
}
.corner-tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner-tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner-bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner-br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.target-top {
  position: absolute;
  z-index: 5;
  top: 24px;
  left: 25px;
  right: 25px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .16em;
}
.target-id { color: var(--accent); }
.featured-portrait {
  position: absolute;
  inset: 6% 4% 9%;
  z-index: 1;
  display: grid;
  place-items: center;
}
.featured-portrait .portrait-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, .45));
}
.scanline {
  position: absolute;
  z-index: 4;
  left: 11px;
  right: 11px;
  height: 90px;
  top: -100px;
  background: linear-gradient(180deg, transparent, rgba(94, 234, 212, .075) 70%, rgba(94, 234, 212, .2) 98%, transparent);
  border-bottom: 1px solid rgba(94, 234, 212, .35);
  animation: scanMove 5.6s ease-in-out infinite;
  pointer-events: none;
  opacity: .7;
}
.target-bottom {
  position: absolute;
  z-index: 6;
  left: 26px;
  right: 26px;
  bottom: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.target-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: .02em;
}
.target-en {
  margin-top: 5px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .2em;
}
.target-open {
  flex-shrink: 0;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(6, 8, 14, .5);
  color: var(--text);
  transition: background .25s, border-color .25s, transform .25s;
}
.target-open svg { width: 20px; height: 20px; }
.target-open:hover { background: var(--accent); border-color: var(--accent); transform: translate(2px, -2px); }
.visual-caption {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
}
.visual-line { width: 26px; height: 1px; background: var(--accent); flex-shrink: 0; }
.visual-caption p { flex: 1; }
.visual-coord { color: #4b566a; white-space: nowrap; }

.hero-ticker {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38px;
  border-top: 1px solid var(--line);
  background: rgba(6, 8, 14, .55);
  overflow: hidden;
  display: flex;
  align-items: center;
}
.ticker-track {
  display: flex;
  align-items: center;
  gap: 38px;
  width: max-content;
  padding-left: 38px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .22em;
  white-space: nowrap;
  animation: ticker 38s linear infinite;
}
.ticker-track i { color: var(--accent); font-style: normal; font-size: 8px; }

/* ============================== SECTIONS ============================== */

.section {
  position: relative;
  padding: clamp(88px, 11vw, 140px) 0;
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: clamp(38px, 5vw, 58px);
}
.section-head h2 {
  margin-top: 18px;
  font-family: var(--font-display);
  font-size: clamp(34px, 4.6vw, 62px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.025em;
}
.section-head h2 em { font-style: normal; color: var(--accent); }
.section-note {
  flex-shrink: 0;
  padding-bottom: 8px;
  color: var(--dim);
  font-size: 13px;
  line-height: 1.9;
  text-align: right;
}

/* ============================== FACTIONS ============================== */

.faction-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.faction-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 356px;
  padding: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(165deg, var(--fc-soft, rgba(255, 255, 255, .04)), transparent 56%),
    var(--bg-2);
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  transition: transform .4s var(--ease), border-color .35s, background .35s;
}
.faction-card::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--fc);
  transition: width .45s var(--ease);
}
.faction-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  right: -20px;
  bottom: -34px;
  width: 170px;
  height: 170px;
  border: 1px solid var(--fc);
  border-radius: 50%;
  opacity: .12;
  transition: transform .6s var(--ease), opacity .4s;
}
.faction-card:hover {
  transform: translateY(-7px);
  border-color: color-mix(in srgb, var(--fc) 55%, transparent);
  background:
    linear-gradient(165deg, var(--fc-soft, rgba(255, 255, 255, .06)), transparent 70%),
    var(--bg-3);
}
.faction-card:hover::before { width: 100%; }
.faction-card:hover::after { transform: scale(1.18); opacity: .22; }
.faction-emblem {
  position: relative;
  z-index: 1;
  width: 84px;
  height: 84px;
  margin-bottom: auto;
  color: var(--fc);
  filter: drop-shadow(0 0 18px var(--fc-soft));
  transition: transform .6s var(--ease);
}
.faction-card:hover .faction-emblem { transform: rotate(-8deg) scale(1.06); }
.faction-index {
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
}
.faction-body { position: relative; z-index: 1; margin-top: 34px; }
.faction-name {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  line-height: 1.1;
}
.faction-en {
  display: block;
  margin-top: 4px;
  color: var(--fc);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .2em;
}
.faction-desc {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.faction-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
}
.faction-meta .go { color: var(--fc); }
.faction-card:hover .faction-meta .go { text-decoration: underline; text-underline-offset: 4px; }

/* ============================== TIMELINE ============================== */

.section-timeline {
  background:
    radial-gradient(ellipse 60% 100% at 50% 0, rgba(255, 65, 65, .04), transparent 70%),
    var(--bg-2);
}
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 37px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-strong);
}
.era-card {
  position: relative;
  padding: 0 10px 0 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
  transition: transform .35s var(--ease);
}
.era-card:hover { transform: translateY(-5px); }
.era-dot {
  position: relative;
  z-index: 1;
  display: block;
  width: 13px;
  height: 13px;
  margin: 31px 0 0 2px;
  border: 2px solid var(--bg-2);
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 1px var(--dim);
  transition: background .3s, box-shadow .3s;
}
.era-card:hover .era-dot,
.era-card.is-active .era-dot {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgba(255, 65, 65, .65);
}
.era-year {
  display: block;
  margin-top: 24px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
}
.era-title {
  display: block;
  margin-top: 9px;
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 800;
  line-height: 1.25;
}
.era-short {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .14em;
}
.era-desc {
  margin-top: 14px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.85;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================== ARCHIVE ============================== */

.section-archive { background: var(--bg); }
.archive-shell {
  position: relative;
  padding: clamp(18px, 2.2vw, 28px);
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 300px),
    rgba(10, 14, 24, .6);
}
.archive-shell::before,
.archive-shell::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--accent);
  border-style: solid;
  pointer-events: none;
}
.archive-shell::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.archive-shell::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }
.archive-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  max-width: 460px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, .55);
  transition: border-color .25s, background .25s;
}
.search-box:focus-within { border-color: var(--accent); background: rgba(6, 8, 14, .85); }
.search-box svg { width: 17px; height: 17px; color: var(--dim); flex-shrink: 0; }
.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}
.search-box input::placeholder { color: var(--dim); }
.search-box kbd {
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.6;
}
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.sort-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .16em;
}
.sort-select {
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2398a4b8' stroke-width='1.7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  color: var(--muted);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
}
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
}
.filter-label {
  width: 34px;
  flex-shrink: 0;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .16em;
}
.chip-group { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .03em;
  transition: color .2s, border-color .2s, background .2s;
}
.chip .chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--chip-color, var(--dim));
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active {
  border-color: var(--chip-color, var(--accent));
  background: var(--chip-soft, var(--accent-soft));
  color: var(--text);
}
.chip.is-active .chip-dot { box-shadow: 0 0 8px var(--chip-color, var(--accent)); }
.fav-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-left: auto;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  transition: color .2s, border-color .2s;
}
.fav-filter svg { width: 14px; height: 14px; }
.fav-filter span { font-family: var(--font-mono); font-size: 9px; }
.fav-filter:hover { color: var(--text); border-color: var(--line-strong); }
.fav-filter[aria-pressed="true"] {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(255, 176, 32, .07);
}
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 2px 14px;
}
#resultCount {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
}
#resultCount b { color: var(--text); font-weight: 600; }
.clear-filters {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.character-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.char-card {
  position: relative;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 28%, var(--fc-soft, rgba(255, 255, 255, .05)), transparent 62%),
    var(--bg-2);
  overflow: hidden;
  transition: transform .4s var(--ease), border-color .3s, box-shadow .4s;
  isolation: isolate;
  animation: cardIn .55s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 28ms);
}
.char-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  width: 34px;
  height: 2px;
  background: var(--fc, var(--accent));
  transition: width .35s var(--ease);
}
.char-card:hover {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--fc) 48%, transparent);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.char-card:hover::before { width: 100%; }
.char-portrait {
  position: relative;
  aspect-ratio: 1 / 1.06;
  padding: 2px 2px 0;
  overflow: hidden;
}
.char-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(9, 13, 22, .9) 100%);
  pointer-events: none;
}
.char-portrait .portrait-svg {
  width: 100%;
  height: 100%;
  transition: transform .6s var(--ease), filter .4s;
}
.char-card:hover .char-portrait .portrait-svg {
  transform: scale(1.04);
  filter: drop-shadow(0 0 22px var(--fc-soft));
}
.card-badges {
  position: absolute;
  z-index: 6;
  top: 11px;
  left: 11px;
  right: 11px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  background: rgba(6, 8, 14, .55);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
  backdrop-filter: blur(4px);
}
.badge-faction { border-color: color-mix(in srgb, var(--fc) 45%, transparent); color: var(--fc); }
.badge-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.card-fav {
  position: relative;
  z-index: 5;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, .5);
  color: var(--dim);
  backdrop-filter: blur(4px);
  transition: color .2s, border-color .2s, background .2s;
  pointer-events: auto;
}
.card-fav svg { width: 14px; height: 14px; }
.card-fav:hover { color: var(--amber); border-color: var(--amber); }
.card-fav.is-fav { color: var(--amber); border-color: rgba(255, 176, 32, .5); background: rgba(255, 176, 32, .1); }
.card-fav.is-fav svg { fill: currentColor; }
.card-file {
  position: absolute;
  z-index: 3;
  right: 13px;
  bottom: 12px;
  color: rgba(238, 241, 247, .45);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
}
.char-body {
  position: relative;
  z-index: 3;
  padding: 0 16px 16px;
  margin-top: -6px;
}
.char-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
}
.char-en {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: .12em;
}
.char-role {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.power-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
  white-space: nowrap;
}
.power-meter {
  width: 58px;
  height: 2px;
  margin-top: 7px;
  background: rgba(168, 184, 210, .16);
  overflow: hidden;
}
.power-meter i {
  display: block;
  height: 100%;
  width: calc(var(--power) * 10%);
  background: var(--fc, var(--accent));
  box-shadow: 0 0 8px var(--fc, var(--accent));
}
.power-num {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--fc, var(--text));
}
.power-num small { color: var(--dim); font-family: var(--font-mono); font-size: 8px; font-weight: 400; }
.card-hit {
  position: absolute;
  inset: 0;
  z-index: 4;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.card-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.card-cta {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 47%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 1px solid color-mix(in srgb, var(--fc) 55%, transparent);
  background: rgba(6, 8, 14, .72);
  color: var(--fc);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -42%);
  backdrop-filter: blur(6px);
  transition: opacity .3s, transform .3s;
}
.card-cta svg { width: 12px; height: 12px; }
.char-card:hover .card-cta { opacity: 1; transform: translate(-50%, -50%); }

.empty-state[hidden] { display: none; }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--line-strong);
}
.empty-icon { width: 60px; height: 60px; color: var(--dim); margin-bottom: 18px; }
.empty-state h3 { font-size: 19px; }
.empty-state p { margin: 6px 0 20px; color: var(--dim); font-size: 13px; }

/* ============================== ABOUT ============================== */

.section-about {
  background:
    radial-gradient(ellipse 50% 80% at 20% 20%, rgba(255, 65, 65, .05), transparent 70%),
    var(--bg-2);
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: clamp(40px, 7vw, 100px);
  align-items: start;
}
.about-copy h2 {
  margin: 18px 0 26px;
  font-family: var(--font-display);
  font-size: clamp(36px, 4.8vw, 66px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -.03em;
}
.about-copy h2 em { font-style: normal; color: var(--accent); }
.about-copy > p {
  max-width: 36em;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 2;
}
.about-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.about-tags span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
}
.about-panels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.about-panel {
  position: relative;
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, .35);
  transition: border-color .3s, background .3s;
}
.about-panel:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, .025); }
.panel-no {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--line-strong);
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 900;
  line-height: 1;
}
.about-panel h3 { margin-top: 48px; font-size: 15px; letter-spacing: .04em; }
.about-panel p { margin-top: 8px; color: var(--dim); font-size: 12px; line-height: 1.85; }
.panel-accent { border-color: rgba(255, 65, 65, .25); background: rgba(255, 65, 65, .035); }
.panel-accent .panel-no { color: var(--accent); opacity: .7; }

/* ============================== FOOTER ============================== */

.site-footer {
  border-top: 1px solid var(--line);
  background: #05070c;
}
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  padding: 46px 0 34px;
}
.footer-brand { display: flex; align-items: center; gap: 15px; }
.footer-brand .brand-mark { width: 44px; height: 44px; color: var(--accent); }
.footer-brand strong { font-size: 18px; letter-spacing: .06em; }
.footer-brand p { margin-top: 3px; color: var(--dim); font-size: 11px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 22px; }
.footer-nav a { color: var(--muted); font-size: 12px; transition: color .2s; }
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  color: #4f5b6e;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .08em;
}
.footer-status { display: inline-flex; align-items: center; gap: 6px; color: #5f6d82; }
.footer-status span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 7px var(--green);
}

.back-to-top {
  position: fixed;
  z-index: 60;
  right: 26px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(6, 8, 14, .8);
  color: var(--muted);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .3s, visibility .3s, transform .3s, color .2s, border-color .2s;
}
.back-to-top svg { width: 18px; height: 18px; }
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ============================== MODAL ============================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 9, .84);
  backdrop-filter: blur(10px);
  animation: fadeIn .25s ease both;
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  max-height: min(90vh, 860px);
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .035), transparent 46%),
    #0a0f1b;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: modalIn .45s var(--ease) both;
}
.modal-panel::before {
  content: "";
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 90px;
  height: 2px;
  background: var(--accent);
}
.modal-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 30px;
  padding: 0 58px 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .14em;
  background: rgba(6, 8, 14, .4);
}
.modal-hud span:last-child { color: var(--accent); }
.modal-close {
  position: absolute;
  z-index: 10;
  top: 38px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, .65);
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover { color: #fff; border-color: var(--accent); background: var(--accent); }
.modal-scroll {
  display: grid;
  grid-template-columns: minmax(300px, .78fr) minmax(0, 1.22fr);
  max-height: calc(min(90vh, 860px) - 30px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.file-visual {
  position: relative;
  min-height: 560px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 38%, var(--fc-soft, rgba(255, 65, 65, .1)), transparent 62%),
    rgba(6, 8, 14, .45);
  overflow: hidden;
}
.file-visual::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid var(--line);
  pointer-events: none;
}
.file-visual .portrait-wrap {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 520px;
}
.file-portrait { width: 100%; max-width: 340px; margin-inline: auto; }
.file-portrait .portrait-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, .45));
}
.file-id-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .1em;
}
.file-id-tag b { color: var(--fc); font-weight: 500; }
.file-actions {
  position: absolute;
  z-index: 4;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 6px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(6, 8, 14, .55);
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); border-color: var(--text); }
.icon-btn.is-fav { color: var(--amber); border-color: rgba(255, 176, 32, .55); background: rgba(255, 176, 32, .1); }
.icon-btn.is-fav svg { fill: currentColor; }
.file-body { padding: 38px clamp(24px, 4vw, 46px) 42px; }
.file-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
}
.file-kicker .k-faction { color: var(--fc); }
.file-kicker .k-sep { color: var(--dim); }
.file-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 54px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.02em;
}
.file-en {
  margin-top: 7px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
}
.file-subtitle {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}
.file-quote {
  position: relative;
  margin: 26px 0 0;
  padding: 16px 18px 16px 22px;
  border-left: 2px solid var(--fc, var(--accent));
  background: linear-gradient(90deg, var(--fc-soft, var(--accent-soft)), transparent);
  color: #d6dceb;
  font-size: 15px;
  line-height: 1.8;
}
.file-quote::before {
  content: "“";
  position: absolute;
  top: 2px;
  left: 7px;
  color: var(--fc);
  font-family: Georgia, serif;
  font-size: 30px;
  line-height: 1;
  opacity: .55;
}
.file-quote p { padding-left: 5px; }
.file-quote cite {
  display: block;
  margin-top: 6px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: normal;
  letter-spacing: .1em;
}
.file-bio { margin-top: 24px; }
.file-bio p { color: var(--muted); font-size: 13.5px; line-height: 2; }
.file-bio p + p { margin-top: 14px; }
.file-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px 0 14px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .18em;
}
.file-section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
}
.stat-row { min-width: 0; }
.stat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--dim);
  font-size: 11px;
}
.stat-head b {
  color: var(--fc, var(--text));
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}
.stat-track {
  height: 3px;
  margin-top: 6px;
  background: rgba(168, 184, 210, .14);
  overflow: hidden;
}
.stat-track i {
  display: block;
  height: 100%;
  width: calc(var(--v) * 10%);
  background: var(--fc, var(--accent));
  box-shadow: 0 0 10px var(--fc, var(--accent));
  transform-origin: left;
  animation: statGrow .9s var(--ease) both;
  animation-delay: calc(var(--i) * 60ms + 150ms);
}
.ability-list { display: flex; flex-wrap: wrap; gap: 7px; }
.ability-list li {
  padding: 5px 10px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  background: rgba(255, 255, 255, .02);
}
.file-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin-top: 26px;
  border: 1px solid var(--line);
  background: var(--line);
}
.file-meta-grid div { padding: 12px 14px; background: #0a0f1b; }
.file-meta-grid dt {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .12em;
}
.file-meta-grid dd { margin-top: 3px; color: var(--text); font-size: 12px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.related-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
  text-align: left;
  overflow: hidden;
  transition: border-color .2s, transform .25s;
}
.related-card:hover { border-color: var(--rc, var(--accent)); transform: translateY(-3px); }
.related-art { display: block; height: 86px; overflow: hidden; }
.related-art .portrait-svg { width: 100%; height: 100%; }
.related-info { display: block; padding: 7px 9px 9px; border-top: 1px solid var(--line); }
.related-info strong { display: block; font-size: 11px; }
.related-info span {
  display: block;
  margin-top: 1px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-pager {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .08em;
  transition: color .2s;
}
.pager-btn svg { width: 14px; height: 14px; }
.pager-btn:hover { color: var(--text); }
.pager-btn.next { margin-left: auto; text-align: right; }

.toast {
  position: fixed;
  z-index: 300;
  left: 50%;
  bottom: 30px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  background: rgba(10, 15, 27, .95);
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  z-index: 500;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  text-align: center;
  font-size: 13px;
}

/* ============================== PORTRAIT SVG ============================== */

.portrait-svg { overflow: visible; }
.portrait-svg .p-ring { fill: none; stroke: var(--c1); }
.portrait-svg .p-grid { stroke: var(--c1); }
.portrait-svg .p-hud-text {
  fill: var(--c1);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
  opacity: .7;
}
.portrait-svg .p-scanbar {
  animation: holoScan 4.6s ease-in-out infinite;
}
.portrait-svg .p-flicker { animation: holoFlicker 7s linear infinite; }

/* ============================== REVEAL / MOTION ============================== */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s var(--ease) var(--delay, 0s), transform .8s var(--ease) var(--delay, 0s);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@keyframes blink { 0%, 45% { opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, .1), 0 0 10px var(--green); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, .03), 0 0 18px var(--green); }
}
@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-36px, 44px, 0) scale(1.12); }
}
@keyframes scanMove {
  0% { top: -20%; opacity: 0; }
  12% { opacity: .7; }
  88% { opacity: .7; }
  100% { top: 110%; opacity: 0; }
}
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes holoScan {
  0%, 100% { transform: translateY(0); opacity: .25; }
  50% { transform: translateY(280px); opacity: .7; }
}
@keyframes holoFlicker {
  0%, 91%, 94%, 100% { opacity: 1; }
  92% { opacity: .72; }
  93% { opacity: .9; }
}
@keyframes statGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(22px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================== RESPONSIVE ============================== */

@media (max-width: 1140px) {
  .hero-inner { grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr); gap: 42px; }
  .site-nav a { padding-inline: 10px; font-size: 13px; }
  .character-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .faction-grid { grid-template-columns: repeat(2, 1fr); }
  .faction-card { min-height: 300px; }
  .timeline { grid-template-columns: repeat(2, 1fr); row-gap: 34px; }
  .timeline::before { display: none; }
  .era-card { display: grid; grid-template-columns: 16px 1fr; column-gap: 14px; }
  .era-dot { grid-row: 1 / span 6; margin-top: 5px; }
  .era-year { margin-top: 0; }
  .era-title, .era-short, .era-desc { grid-column: 2; }
}

@media (max-width: 960px) {
  :root { --header-h: 68px; }
  .container { width: calc(100% - 40px); }
  .header-inner { width: calc(100% - 40px); }
  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 99;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 10px 20px 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(6, 8, 14, .97);
    backdrop-filter: blur(20px);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, transform .25s, visibility .25s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .site-nav a { padding: 14px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
  .site-nav a::after { display: none; }
  .nav-toggle { display: flex; }
  .btn-random span { display: none; }
  .btn-random { width: 42px; min-height: 42px; padding: 0; }
  .hero { min-height: auto; padding-top: calc(var(--header-h) + 54px); padding-bottom: 92px; }
  .hero-inner { grid-template-columns: 1fr; gap: 50px; }
  .hero-visual { max-width: 430px; width: 100%; margin-inline: auto; }
  .hero-stats { max-width: none; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .section-note { text-align: left; padding-bottom: 0; }
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .modal-scroll { grid-template-columns: minmax(260px, .72fr) minmax(0, 1.28fr); }
  .file-visual { min-height: 480px; }
  .file-visual .portrait-wrap { min-height: 440px; }
}

@media (max-width: 720px) {
  .container { width: calc(100% - 32px); }
  .header-inner { width: calc(100% - 32px); }
  .brand-text strong { font-size: 15px; }
  .brand-text small { font-size: 8px; letter-spacing: .18em; }
  .brand-mark { width: 34px; height: 34px; }
  .hero-title { font-size: clamp(48px, 15vw, 82px); }
  .hero-lede br { display: none; }
  .hero-actions .btn { flex: 1; min-width: 150px; padding-inline: 14px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats > div { padding: 14px 14px 12px 0; border-bottom: 1px solid var(--line); }
  .hero-stats > div:nth-child(2n) { border-right: 0; }
  .hero-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
  .hero-stats dd { font-size: 28px; }
  .target-frame { max-height: none; }
  .visual-coord { display: none; }
  .faction-grid { grid-template-columns: 1fr; }
  .faction-card { min-height: 272px; }
  .faction-emblem { width: 66px; height: 66px; }
  .timeline { grid-template-columns: 1fr; row-gap: 26px; }
  .archive-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .search-box { max-width: none; }
  .toolbar-right { justify-content: space-between; }
  .search-box kbd { display: none; }
  .fav-filter { margin-left: 0; }
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .char-body { padding: 0 12px 13px; }
  .char-name { font-size: 18px; }
  .char-en { display: none; }
  .char-role { font-size: 10px; }
  .char-portrait { aspect-ratio: 1 / 1.12; }
  .badge { font-size: 7px; padding: 2px 5px; }
  .card-file { display: none; }
  .card-cta { display: none; }
  .about-panels { grid-template-columns: 1fr; }
  .about-panel { min-height: auto; }
  .about-panel h3 { margin-top: 34px; }
  .footer-top { flex-direction: column; align-items: flex-start; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .modal { padding: 0; align-items: end; }
  .modal-panel {
    width: 100%;
    max-height: 94vh;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .modal-scroll {
    display: block;
    max-height: calc(94vh - 30px);
  }
  .file-visual {
    min-height: 0;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .file-visual::before { inset: 10px; }
  .file-visual .portrait-wrap { min-height: 0; position: relative; }
  .file-portrait { max-width: 230px; }
  .file-id-tag { max-width: 300px; margin: 0 auto; }
  .file-body { padding: 26px 20px 34px; }
  .file-title { font-size: 38px; }
  .stat-grid { gap: 12px 16px; }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
  .related-art { height: 64px; }
  .back-to-top { right: 16px; bottom: 16px; }
}

@media (max-width: 430px) {
  .eyebrow { font-size: 9px; letter-spacing: .12em; }
  .hero-stats dd { font-size: 24px; }
  .char-portrait { aspect-ratio: 1 / 1.08; }
  .char-name { font-size: 18px; }
  .char-en { display: none; }
  .filter-label { width: 100%; }
  .chip { height: 30px; padding: 0 10px; font-size: 11px; }
  .file-meta-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related-info { padding: 5px 6px 7px; }
  .related-info strong { font-size: 10px; }
  .related-info span { display: none; }
}

@media (max-width: 360px) {
  .character-grid { grid-template-columns: 1fr; }
  .char-portrait { aspect-ratio: 1 / .95; }
  .char-name { font-size: 21px; }
  .char-en { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .hero-ticker .ticker-track { animation: none; }
}
