/* ═══════════════════════════════════════════════════════════
   $NEARUTO — The Way of the NEAR
   Palette: ink night / NEAR aqua / Uzumaki orange
   Type: Archivo variable (expanded black italic display)
   ═══════════════════════════════════════════════════════════ */

:root {
  --ink: #050b14;
  --panel: #0b1826;
  --panel-2: #081220;
  --aqua: #3fd0ff;
  --aqua-dim: #1e698b;
  --orange: #ff7a2f;
  --steel: #93adc0;
  --paper: #f2f8fc;
  --line: #16344a;
  --display: "Archivo", "Avenir Next Condensed", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--display);
  font-variation-settings: "wdth" 100;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

::selection { background: var(--orange); color: var(--ink); }

/* ── Display type ─────────────────────────────── */
h1, h2, h3 {
  font-family: var(--display);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.01em;
  line-height: 0.92;
  margin: 0;
  text-wrap: balance;
}
h2 { font-size: clamp(2.4rem, 5.5vw, 4.2rem); margin: 0.4rem 0 1rem; }
h3 { font-size: 1.15rem; font-variation-settings: "wdth" 112; }

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  font-variation-settings: "wdth" 108;
  color: var(--aqua);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.eyebrow-orange { color: var(--orange); }
.lede { color: var(--steel); max-width: 58ch; font-size: 1.02rem; }
.fineprint { font-size: 0.75rem; color: #5f7a8c; max-width: 60ch; }

/* ── Scroll progress ──────────────────────────── */
.scrollbar {
  position: fixed; z-index: 220; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; pointer-events: none;
}
.scrollbar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--aqua), #9be9ff 60%, var(--orange));
  box-shadow: 0 0 16px rgba(63, 208, 255, 0.7);
}

/* ── Nav ──────────────────────────────────────── */
.nav {
  position: fixed; z-index: 200; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem max(4vw, 1rem);
  background: linear-gradient(rgba(3, 8, 14, 0.92), rgba(3, 8, 14, 0.75));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { border-radius: 8px; }
.brand strong {
  display: block; font-size: 1.15rem; font-style: italic; font-weight: 900;
  font-variation-settings: "wdth" 120; line-height: 1;
  text-shadow: 0 0 18px rgba(30, 189, 255, 0.55);
}
.brand small { display: block; font-size: 0.6rem; color: var(--aqua); letter-spacing: 0.14em; text-transform: uppercase; }
.navlinks { display: flex; gap: 1.4rem; font-size: 0.8rem; font-weight: 700; }
.navlinks a { opacity: 0.85; transition: opacity 0.2s, color 0.2s; }
.navlinks a:hover { opacity: 1; color: var(--aqua); }

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 1.3rem;
  border-radius: 10px; border: 1px solid;
  background: rgba(6, 18, 29, 0.85);
  font-size: 0.85rem; font-weight: 800; font-style: italic;
  font-variation-settings: "wdth" 110;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-aqua { border-color: var(--aqua); box-shadow: 0 0 18px rgba(37, 199, 255, 0.35), inset 0 0 16px rgba(30, 155, 192, 0.2); }
.btn-aqua:hover { box-shadow: 0 0 28px rgba(37, 199, 255, 0.55), inset 0 0 16px rgba(30, 155, 192, 0.3); }
.btn-orange { border-color: var(--orange); box-shadow: 0 0 18px rgba(255, 122, 47, 0.35), inset 0 0 16px rgba(169, 74, 30, 0.25); }
.btn-orange:hover { box-shadow: 0 0 28px rgba(255, 122, 47, 0.55), inset 0 0 16px rgba(169, 74, 30, 0.35); }
.btn-copy { border-color: var(--aqua); font-size: 0.75rem; min-height: 40px; }
.btn-mini {
  border: 1px solid var(--aqua-dim); background: transparent; border-radius: 8px;
  padding: 0.25rem 0.8rem; font-size: 0.75rem; font-weight: 700; cursor: pointer;
  color: var(--aqua); transition: border-color 0.2s;
}
.btn-mini:hover { border-color: var(--aqua); }

/* ── Rank HUD ─────────────────────────────────── */
.rankhud {
  position: fixed; z-index: 190; right: 1rem; top: 4.6rem;
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: 0.2rem 0.6rem; width: 158px; padding: 0.6rem 0.8rem;
  background: rgba(4, 16, 27, 0.88); border: 1px solid var(--aqua-dim);
  border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.4s, border-color 0.4s;
}
.rankhud.levelup { border-color: var(--orange); box-shadow: 0 0 26px rgba(255, 122, 47, 0.5); }
.rankhud-glyph { font-size: 1.4rem; color: var(--aqua); font-style: normal; line-height: 1; }
.rankhud-text small { display: block; font-size: 0.55rem; letter-spacing: 0.16em; text-transform: uppercase; color: #7f9aaa; }
.rankhud-text b { display: block; font-size: 0.8rem; font-style: italic; }
.rankhud-bar { grid-column: 1 / 3; height: 3px; background: #14303f; border-radius: 3px; overflow: hidden; }
.rankhud-bar em { display: block; height: 100%; width: 0; background: var(--aqua); box-shadow: 0 0 8px var(--aqua); transition: width 0.3s; }

/* ── Scenes (full-bleed image sections) ───────── */
.scene { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
.scene-bg, .hero-bg { position: absolute; inset: 0; z-index: 0; }
/* full poster shown via contain; a blurred cover copy fills the widescreen space */
.scene-bg img, .hero-bg img { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-fill { object-fit: cover; filter: blur(26px) brightness(0.45) saturate(1.15); scale: 1.12; }
.bg-fit { object-fit: contain; z-index: 1; }
.scene-shade { position: absolute; inset: 0; z-index: 1; }
.scene-shade.left { background: linear-gradient(0deg, var(--ink) 0%, transparent 40%), linear-gradient(90deg, rgba(2, 8, 18, 0.88), transparent 65%); }
.scene-shade.right { background: linear-gradient(0deg, var(--ink) 0%, transparent 40%), linear-gradient(270deg, rgba(2, 8, 18, 0.88), transparent 65%); }

/* ── Hero ─────────────────────────────────────── */
.hero { justify-content: center; text-align: center; }
.hero-shade {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(0deg, var(--ink) 0%, transparent 38%),
    radial-gradient(ellipse at 50% 62%, transparent 30%, rgba(2, 6, 10, 0.55) 100%);
}
.hero-content { position: relative; z-index: 2; width: min(920px, 92vw); padding-top: 3rem; }
.hero-kicker {
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase;
  color: #8ee2ff; margin: 0 0 0.5rem; text-shadow: 0 2px 12px #000;
}
.hero-title {
  font-size: clamp(2.8rem, 12.5vw, 8.8rem);
  line-height: 0.82;
  font-variation-settings: "wdth" 125;
  text-shadow: 0 10px 44px #000, 0 0 34px rgba(29, 175, 255, 0.5);
  white-space: nowrap;
}
.hero-title .line { display: inline-block; }
.hero-title .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em) rotate(4deg);
  filter: blur(6px);
  animation: ch-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(180ms + var(--i) * 55ms);
}
@keyframes ch-in {
  to { opacity: 1; transform: none; filter: none; }
}
.hero-sub {
  font-size: clamp(1.4rem, 3.4vw, 2.6rem); font-weight: 900; font-style: italic;
  font-variation-settings: "wdth" 116; margin: 0.8rem 0 0;
  text-shadow: 0 3px 16px #000;
}
.hero-sub b { color: var(--aqua); }
.hero-tag { font-size: 0.95rem; color: #d6e6ef; letter-spacing: 0.04em; text-shadow: 0 2px 10px #000; margin: 1.2rem 0 1.6rem; }
.hero-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.hero-down {
  position: absolute; z-index: 2; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase; color: #c6d9e4;
  text-align: center;
}
.hero-down span { display: block; font-size: 1.2rem; margin-top: 0.2rem; animation: bob 2.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.hero-kanji {
  position: absolute; z-index: 1; right: 4vw; bottom: 6vh;
  font-size: clamp(6rem, 16vw, 13rem); line-height: 1; font-style: normal;
  color: rgba(63, 208, 255, 0.08); user-select: none; pointer-events: none;
}

/* ── Story panels over scenes ─────────────────── */
.story {
  position: relative; z-index: 2;
  width: min(640px, 90vw);
  margin: 14vh max(5vw, 1.4rem);
  padding: 2.2rem 2rem;
  background: linear-gradient(135deg, rgba(3, 16, 30, 0.92), rgba(6, 22, 36, 0.72));
  border-left: 3px solid var(--aqua);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
}
.story-right { margin-left: auto; border-left: 0; border-right: 3px solid var(--orange); }
.story blockquote {
  margin: 1.4rem 0 0; padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--orange); background: rgba(10, 26, 37, 0.8);
  font-size: 0.95rem; font-weight: 700; font-style: italic;
}

/* paths inside village story */
.paths { display: grid; gap: 0.6rem; margin: 1.4rem 0 0; }
.path {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(7, 26, 40, 0.65);
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.path:hover { border-color: var(--aqua); transform: translateX(6px); background: rgba(10, 34, 52, 0.8); }
.path-icon { font-size: 1.5rem; color: var(--aqua); font-style: normal; line-height: 1; }
.path b { display: block; font-style: italic; }
.path small { color: var(--steel); font-size: 0.8rem; }

/* ── Panel sections ───────────────────────────── */
.panel-section { padding: 6.5rem max(5vw, 1.2rem); position: relative; }
#intel { background: radial-gradient(ellipse at 50% -10%, #0b2940, var(--ink) 60%); }
.section-head { max-width: 820px; margin: 0 auto 2.6rem; text-align: center; }
.section-head .lede { margin-inline: auto; }

/* ── Live intel ───────────────────────────────── */
.intel-status {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  max-width: 1080px; margin: 0 auto 1.2rem;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; color: var(--steel);
}
.pulse-dot {
  width: 9px; height: 9px; border-radius: 50%; background: #57606a;
  transition: background 0.3s;
}
.pulse-dot.live { background: #3dffa0; box-shadow: 0 0 10px #3dffa0; animation: pulse 2s infinite; }
.pulse-dot.err { background: var(--orange); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.intel-updated { color: #5f7a8c; font-size: 0.72rem; margin-left: auto; }

.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.7rem;
  max-width: 1080px; margin: 0 auto;
}
.stat {
  padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
  transition: border-color 0.25s, transform 0.25s;
}
.stat:hover { border-color: var(--aqua-dim); transform: translateY(-3px); }
.stat small { display: block; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #7f9aaa; font-weight: 700; }
.stat b {
  display: block; font-size: clamp(1.3rem, 2.4vw, 1.9rem); font-style: italic;
  font-variation-settings: "wdth" 114; margin: 0.35rem 0 0.15rem; color: #c9f1ff;
}
.stat span { font-size: 0.7rem; color: #5f7a8c; }
.stat-orange b { color: #ffcf9e; }
.stat-orange { border-color: rgba(255, 122, 47, 0.25); }
.stat-orange:hover { border-color: rgba(255, 122, 47, 0.55); }
.stat b.up { color: #7dffb8; }
.stat b.down { color: #ff8d7a; }

.bonding {
  max-width: 1080px; margin: 0.7rem auto 0; padding: 1.3rem 1.4rem;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
}
.bonding-head { display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap; }
.bonding-head b { font-style: italic; font-size: 1.05rem; }
.bonding-head span { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--aqua); font-weight: 700; }
.bonding-pct { margin-left: auto; font-size: 1.5rem !important; color: #c9f1ff; }
.bonding-track { height: 10px; margin: 0.8rem 0 0.6rem; background: #0d2233; border-radius: 6px; overflow: hidden; }
.bonding-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--aqua), #9be9ff);
  box-shadow: 0 0 14px rgba(63, 208, 255, 0.8);
  border-radius: 6px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.bonding p { margin: 0; font-size: 0.8rem; color: var(--steel); }

.intel-foot {
  display: flex; align-items: center; justify-content: center; gap: 0.9rem; flex-wrap: wrap;
  max-width: 1080px; margin: 1.6rem auto 0;
}
.ca-chip {
  display: inline-flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--aqua-dim); border-radius: 10px;
  background: rgba(2, 9, 18, 0.9); padding: 0.6rem 0.9rem; cursor: pointer;
  transition: border-color 0.2s;
}
.ca-chip:hover { border-color: var(--aqua); }
.ca-chip span { font-size: 0.62rem; letter-spacing: 0.18em; color: #7b9eaf; font-weight: 700; }
.ca-chip code { font-family: var(--mono); font-size: 0.85rem; color: #d8f6ff; }
.ca-chip b { font-size: 0.7rem; color: var(--aqua); font-style: italic; }

/* ── Bag simulator ────────────────────────────── */
.sim { margin-top: 1.4rem; }
.sim label { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; }
.sim input {
  width: 100%; margin-top: 0.45rem; padding: 0.85rem 1rem;
  border: 1px solid #245d77; border-radius: 10px;
  background: rgba(2, 10, 18, 0.9); color: var(--paper);
  font-family: var(--mono); font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.sim input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 14px rgba(255, 122, 47, 0.3); }
.sim-now { font-size: 0.88rem; color: var(--steel); min-height: 1.4em; margin: 0.8rem 0; }
.sim-now b { color: #ffcf9e; font-style: italic; }
.sim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.sim-cell {
  padding: 0.75rem 0.7rem; border: 1px solid #173e52; border-radius: 10px;
  background: rgba(2, 11, 19, 0.85);
  opacity: 0; transform: translateY(10px);
  animation: cellIn 0.4s forwards; animation-delay: calc(var(--i) * 60ms);
}
@keyframes cellIn { to { opacity: 1; transform: none; } }
.sim-cell small { display: block; font-size: 0.62rem; letter-spacing: 0.08em; color: #7594a5; text-transform: uppercase; font-weight: 700; }
.sim-cell b { display: block; font-size: 0.98rem; font-style: italic; color: #61d9ff; margin-top: 0.3rem; }
.sim-cell.hit { border-color: var(--orange); }
.sim-cell.hit b { color: #ffcf9e; }
.sim-cell em { display: block; font-size: 0.62rem; font-style: normal; color: #5f7a8c; margin-top: 0.15rem; }

/* ── Academy scrolls ──────────────────────────── */
#academy { background: linear-gradient(var(--ink), #071523 50%, var(--ink)); }
.scrolls {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem;
  max-width: 1120px; margin: 0 auto;
}
.scroll-card {
  padding: 1.7rem 1.4rem; min-height: 200px;
  background: linear-gradient(160deg, #0b1e2c, #050e17);
  border: 1px solid #1b526c; border-radius: 14px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s, border-color 0.25s;
}
.scroll-card:hover { transform: translateY(-5px); border-color: var(--aqua); }
.scroll-icon { font-size: 1.8rem; color: var(--orange); font-style: normal; line-height: 1; }
.scroll-card h3 { color: #77ddff; margin: 0.9rem 0 0.5rem; }
.scroll-card p { font-size: 0.88rem; color: var(--steel); margin: 0; }
.academy-note { text-align: center; max-width: 62ch; margin: 2.2rem auto 0; color: var(--steel); font-size: 0.95rem; }

/* ── Roadmap ──────────────────────────────────── */
.roadmap-section { background: radial-gradient(ellipse at 50% 120%, #0b2940, var(--ink) 65%); }
.roadmap {
  list-style: none; margin: 0 auto; padding: 0;
  max-width: 760px; position: relative;
}
.roadmap::before {
  content: ""; position: absolute; left: 27px; top: 10px; bottom: 10px; width: 2px;
  background: linear-gradient(var(--aqua), var(--orange));
  opacity: 0.4;
}
.milestone {
  display: flex; gap: 1.4rem; align-items: flex-start;
  padding: 1.2rem 0; position: relative;
}
.milestone-marker {
  flex: 0 0 56px; height: 56px; display: grid; place-items: center;
  border: 1px solid var(--aqua-dim); border-radius: 50%;
  background: var(--panel-2);
  font-style: italic; font-weight: 900; font-size: 1.05rem; color: var(--aqua);
  position: relative; z-index: 1;
}
.milestone:last-child .milestone-marker { color: var(--orange); border-color: rgba(255, 122, 47, 0.5); }
.milestone h3 { margin-bottom: 0.35rem; }
.milestone p { margin: 0; color: var(--steel); font-size: 0.95rem; max-width: 52ch; }

/* ── Gallery ──────────────────────────────────── */
.gallery-section { padding: 6.5rem 0; }
.gallery-section .section-head { padding-inline: max(5vw, 1.2rem); }
.gallery {
  display: flex; gap: 0.8rem;
  overflow-x: auto; padding: 0.5rem max(5vw, 1.2rem) 1.4rem;
  scroll-snap-type: x mandatory;
  cursor: grab;
  scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery.dragging { cursor: grabbing; scroll-snap-type: none; }
.gallery figure {
  flex: 0 0 min(430px, 78vw); margin: 0;
  position: relative; overflow: hidden;
  border: 1px solid #1a536e; border-radius: 16px;
  aspect-ratio: 1 / 1; scroll-snap-align: center;
}
.gallery img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  user-select: none; -webkit-user-drag: none;
}
.gallery figure:hover img { transform: scale(1.045); }
.gallery figcaption {
  position: absolute; inset: auto 0 0 0; padding: 2.4rem 1.2rem 1.1rem;
  background: linear-gradient(transparent, rgba(2, 7, 13, 0.94));
}
.gallery figcaption b { display: block; font-style: italic; font-size: 1rem; }
.gallery figcaption span { font-size: 0.78rem; color: var(--steel); }

/* ── Studio ───────────────────────────────────── */
.studio-section { background: linear-gradient(var(--ink), #0a1a2a 55%, var(--ink)); }
.studio { max-width: 860px; margin: 0 auto; }
.studio-controls {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem;
  margin-bottom: 1rem;
}
.studio-controls label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; }
.studio-controls select, .studio-controls input {
  width: 100%; margin-top: 0.4rem; padding: 0.75rem 0.9rem;
  border: 1px solid #245d77; border-radius: 10px;
  background: rgba(2, 10, 18, 0.9); color: var(--paper);
  transition: border-color 0.2s;
}
.studio-controls select:focus, .studio-controls input:focus { outline: none; border-color: var(--orange); }
.studio-msg { grid-column: 1 / -1; }
.studio-actions { grid-column: 1 / -1; display: flex; gap: 0.7rem; flex-wrap: wrap; }
.studio-output {
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
  padding: 1.3rem 1.4rem;
}
.studio-output-label { margin: 0 0 0.5rem; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #7f9aaa; font-weight: 700; }
.studio-text { margin: 0; font-size: 0.95rem; color: #d6e6ef; line-height: 1.7; }

/* ── Sacred scroll ────────────────────────────── */
.sacred {
  position: relative; min-height: 92svh;
  display: flex; align-items: center; justify-content: center;
  padding: 5rem 1.2rem; text-align: center; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #0e5279 0%, #071a29 30%, var(--ink) 65%);
}
.sacred-kanji {
  position: absolute; right: -0.16em; top: 50%; translate: 0 -50%;
  font-size: clamp(18rem, 46vw, 36rem); line-height: 1;
  color: rgba(255, 122, 47, 0.05); user-select: none; pointer-events: none;
}
.sacred-card {
  position: relative; width: min(880px, 96vw);
  padding: 3rem 2.2rem;
  border: 1px solid #2abff3; border-radius: 20px;
  background: rgba(4, 16, 27, 0.88);
  box-shadow: 0 0 70px rgba(29, 189, 255, 0.22), inset 0 0 40px rgba(11, 90, 126, 0.15);
}
.rank-final { font-size: 0.9rem; color: var(--steel); margin: 0 0 1rem; }
.rank-final .rankhud-glyph { color: var(--orange); }
.rank-final b { color: var(--orange); font-style: italic; }
.sacred-card .lede { margin-inline: auto; }
.ca-full {
  display: block; width: 100%; margin: 1.6rem 0; padding: 1rem 1.2rem;
  border: 1px solid var(--aqua); border-radius: 12px;
  background: #020912; cursor: pointer; text-align: left;
  transition: box-shadow 0.2s;
}
.ca-full:hover { box-shadow: 0 0 24px rgba(63, 208, 255, 0.35); }
.ca-full span { display: block; font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: #7b9eaf; font-weight: 700; margin-bottom: 0.35rem; }
.ca-full code {
  display: block; font-family: var(--mono); font-size: clamp(0.7rem, 1.9vw, 1rem);
  color: #d8f6ff; word-break: break-all;
}
.sacred-links { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }

/* ── Footer ───────────────────────────────────── */
footer {
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  padding: 2rem max(5vw, 1.2rem);
  border-top: 1px solid var(--line); background: #02070d;
}
footer strong { display: block; font-style: italic; font-size: 1.05rem; font-variation-settings: "wdth" 120; }
footer small { display: block; font-size: 0.62rem; color: var(--aqua); letter-spacing: 0.14em; text-transform: uppercase; }
footer p { max-width: 72ch; font-size: 0.72rem; line-height: 1.7; color: #6e8998; margin: 0; }

/* ── Toast ────────────────────────────────────── */
#toast {
  position: fixed; z-index: 400; left: 50%; bottom: 1.4rem;
  transform: translate(-50%, 90px); opacity: 0;
  background: #0b3349; border: 1px solid var(--aqua); border-radius: 10px;
  padding: 0.8rem 1.3rem; font-size: 0.82rem; font-weight: 700; font-style: italic;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ── Scroll animations ────────────────────────── */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); transition-delay: calc(var(--d, 0) * 90ms); }
.reveal.in { opacity: 1; transform: none; }
.reveal-wipe { clip-path: inset(0 0 100% 0); transition: clip-path 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.reveal-wipe.in { clip-path: inset(0 0 0% 0); }

/* ── Scroll-driven animations (progressive enhancement) ── */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    /* .hero/.scene are overflow:hidden (thus scroll containers), so anonymous
       view() inside them would track the wrong scroller — name the timeline
       on the section and let descendants subscribe to it instead */
    .scene { view-timeline: --scene-view; }

    /* hero softly recedes as you scroll past it */
    .hero-content {
      animation: hero-exit linear both;
      animation-timeline: --scene-view;
      animation-range: exit 0% exit 90%;
    }

    /* slow zoom on scene artwork, tied to scroll position */
    .hero-bg, .scene-bg {
      animation: scene-zoom linear both;
      animation-timeline: --scene-view;
      animation-range: cover 0% cover 100%;
    }

    /* the training-arc line draws itself */
    .roadmap { view-timeline: --roadmap-view; }
    .roadmap::before {
      transform-origin: top;
      animation: line-draw linear both;
      animation-timeline: --roadmap-view;
      animation-range: cover 5% cover 65%;
    }
    .milestone-marker {
      animation: marker-on linear both;
      animation-timeline: view();
      animation-range: entry 30% entry 100%;
    }

    /* gallery cards enter along the scroller's own axis */
    .gallery figure {
      animation: card-in linear both;
      animation-timeline: view(inline);
      animation-range: entry 0% entry 70%;
    }

    /* the sacred kanji breathes in as the section crosses the viewport */
    .sacred { view-timeline: --sacred-view; }
    .sacred-kanji {
      animation: kanji-glow linear both;
      animation-timeline: --sacred-view;
      animation-range: cover 0% cover 100%;
    }
  }
}
@keyframes kanji-glow {
  0% { color: rgba(255, 122, 47, 0.03); text-shadow: 0 0 0 transparent; }
  55% { color: rgba(255, 122, 47, 0.14); text-shadow: 0 0 140px rgba(255, 122, 47, 0.4); }
  100% { color: rgba(255, 122, 47, 0.04); text-shadow: 0 0 0 transparent; }
}
@keyframes hero-exit {
  to { opacity: 0; transform: translateY(-70px) scale(0.94); }
}
@keyframes scene-zoom {
  from { scale: 1.06; }
  to { scale: 1; }
}
@keyframes line-draw {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes marker-on {
  from { opacity: 0.3; box-shadow: 0 0 0 transparent; }
  to { opacity: 1; box-shadow: 0 0 18px currentColor; }
}
@keyframes card-in {
  from { opacity: 0.35; transform: translateX(46px); }
  to { opacity: 1; transform: none; }
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 1060px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .scrolls { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .navlinks { display: none; }
  .rankhud { top: auto; bottom: 1rem; right: 0.8rem; width: 138px; padding: 0.5rem 0.7rem; }
  .hero-kanji { right: 2vw; bottom: 12vh; }
  .story { margin: 12vh auto; width: min(640px, 92vw); }
  .story-right { margin-inline: auto; }
  .studio-controls { grid-template-columns: 1fr; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
  .intel-updated { margin-left: 0; }
  footer { gap: 1rem; }
}
@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat { padding: 0.85rem 0.9rem; }
  .sim-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Accessibility ────────────────────────────── */
:focus-visible { outline: 2px solid var(--aqua); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal, .reveal-wipe { opacity: 1; transform: none; clip-path: none; }
  [data-parallax] img { transform: none !important; }
}
