/* ============================================================
   ĐẠI THIÊN DIỄN THUẬT - IMMORTAL MATRIX
   Ink + Jade design system, matching in-game brand tokens
   ============================================================ */

@font-face {
  font-family: 'Noto Serif';
  src: url('/assets/fonts/ns-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Serif';
  src: url('/assets/fonts/ns-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Serif';
  src: url('/assets/fonts/ns-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/bvp-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/bvp-semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Be Vietnam Pro';
  src: url('/assets/fonts/bvp-bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink-950: #0a100e;
  --ink-900: #0c1210;
  --ink-850: #101815;
  --ink-800: #152019;
  --ink-700: #1e2c24;
  --ink-600: #2f4238;
  --ink-500: #4a6356;
  --paper: #f0ebe0;
  --paper-dim: #9faea3;
  --paper-faint: #6d7f74;
  --gold: #d4b06a;
  --gold-dim: #9a7d45;
  --gold-faint: rgba(212, 176, 106, 0.14);
  --danger: #cd8272;
  --serif: 'Noto Serif', 'Times New Roman', serif;
  --sans: 'Be Vietnam Pro', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --nav-h: 68px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
  background: var(--ink-900);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: rgba(212, 176, 106, 0.28);
  color: var(--paper);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* paper grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ NAV ============ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 48px);
  transition: background 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(10, 16, 14, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: rgba(212, 176, 106, 0.1);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}
.nav-seal {
  width: 26px; height: 26px;
  color: var(--gold);
}
.nav-wordmark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.nav-links {
  display: flex;
  gap: clamp(18px, 3vw, 36px);
}
.nav-links a {
  color: var(--paper-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--paper); }
.nav-cta {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid rgba(212, 176, 106, 0.4);
  padding: 9px 18px;
  border-radius: 999px;
  transition: background 0.25s, border-color 0.25s;
}
.nav-cta:hover {
  background: var(--gold-faint);
  border-color: var(--gold);
}
.nav-menu-btn {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}
.nav-menu-btn span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--paper);
  transition: transform 0.25s, opacity 0.25s;
}
.nav-menu-btn[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav-menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 49;
  background: rgba(10, 16, 14, 0.97);
  border-bottom: 1px solid var(--ink-600);
  padding: 12px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  color: var(--paper-dim);
  text-decoration: none;
  font-size: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink-800);
}
.mobile-menu a:last-child { border-bottom: 0; }
.mobile-menu .mobile-menu-cta {
  color: var(--gold);
  font-weight: 600;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-radius: 999px;
  padding: 15px 32px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s, background 0.22s, border-color 0.22s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: #142019;
  box-shadow: 0 0 0 0 rgba(212, 176, 106, 0);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(212, 176, 106, 0.22);
}
.btn-ghost {
  color: var(--paper);
  border-color: var(--ink-500);
  background: rgba(21, 32, 25, 0.35);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
}
.btn:active { transform: translateY(0); }

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

.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--ink-950);
}
.hero-scene {
  position: absolute;
  inset: 0;
}
.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.layer-moon, .layer-far, .layer-mid, .layer-near, .scene-birds {
  will-change: transform;
}
.mist-1 { animation: mistDrift 26s ease-in-out infinite alternate; }
.mist-2 { animation: mistDrift 34s ease-in-out infinite alternate-reverse; }
@keyframes mistDrift {
  from { transform: translateX(-40px); }
  to { transform: translateX(50px); }
}

.hero-cliff {
  position: absolute;
  left: -2%;
  bottom: 0;
  width: clamp(300px, 38vw, 580px);
  will-change: transform;
}
.hero-cliff svg { display: block; width: 100%; height: auto; }

.embers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.ember {
  position: absolute;
  bottom: -8px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: emberRise linear infinite;
}
@keyframes emberRise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: var(--eo, 0.5); }
  85% { opacity: var(--eo, 0.5); }
  100% { transform: translateY(-105vh) translateX(var(--ex, 30px)); opacity: 0; }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
  margin-top: calc(var(--nav-h) * -0.5);
}
.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 26px;
  animation: heroRise 1s var(--ease-out) 0.1s backwards;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 6.8rem);
  line-height: 1.06;
  letter-spacing: 0.02em;
  text-shadow: 0 4px 60px rgba(10, 16, 14, 0.9);
  animation: heroRise 1s var(--ease-out) 0.25s backwards;
}
.hero-sub {
  max-width: 34rem;
  margin: 26px auto 0;
  color: var(--paper-dim);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.7;
  animation: heroRise 1s var(--ease-out) 0.4s backwards;
}
.hero-ctas {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 38px;
  animation: heroRise 1s var(--ease-out) 0.55s backwards;
}
@keyframes heroRise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.section-head {
  max-width: 720px;
  margin: 0 auto 64px;
  text-align: center;
  padding: 0 24px;
}
.section-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  line-height: 1.15;
}
.section-sub {
  margin-top: 18px;
  color: var(--paper-dim);
  font-size: 16.5px;
  line-height: 1.7;
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ============ MANIFESTO ============ */

.manifesto {
  padding: clamp(120px, 18vh, 200px) 24px;
  background:
    radial-gradient(ellipse 80% 55% at 70% 20%, rgba(30, 44, 36, 0.55), transparent 70%),
    var(--ink-900);
}
.manifesto-inner {
  max-width: 880px;
  margin: 0 auto;
}
.manifesto-line {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 3.4vw, 2.5rem);
  line-height: 1.4;
  color: var(--paper);
  padding-bottom: 1.2em;
}
.manifesto-line:nth-child(2) { margin-left: clamp(0px, 8vw, 110px); }
.manifesto-line:nth-child(3) { margin-left: clamp(0px, 4vw, 48px); }
.manifesto-line:nth-child(4) { margin-left: clamp(0px, 12vw, 170px); }
.manifesto-close {
  margin-top: clamp(48px, 8vh, 90px);
  max-width: 560px;
  color: var(--paper-dim);
  font-size: 17px;
  line-height: 1.75;
  border-left: 2px solid var(--gold-dim);
  padding-left: 26px;
}

/* ============ DEMO ============ */

.demo {
  padding: clamp(90px, 14vh, 160px) 24px clamp(100px, 15vh, 170px);
  background: var(--ink-850);
}
.demo-shell {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: start;
}
.demo-stage {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: 18px;
  padding: clamp(26px, 4vw, 46px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(240, 235, 224, 0.04);
}
.demo-narrative {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
  line-height: 1.85;
  flex: 1;
}
.demo-narrative .demo-kicker {
  display: block;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 20px;
}
.demo-narrative p { margin-bottom: 1.1em; }
.demo-narrative p:last-child { margin-bottom: 0; }
.demo-narrative .demo-result {
  color: var(--paper-dim);
  font-style: italic;
}
.demo-narrative .demo-ending-title {
  display: block;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--gold);
  margin: 22px 0 8px;
}
.demo-choices {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 34px;
}
.demo-choice {
  text-align: left;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--paper);
  background: var(--ink-700);
  border: 1px solid var(--ink-600);
  border-radius: 12px;
  padding: 15px 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease-out);
}
.demo-choice:hover:not(:disabled) {
  border-color: var(--gold-dim);
  background: #233529;
  transform: translateX(4px);
}
.demo-choice:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.demo-choice .choice-hint {
  display: block;
  font-size: 12.5px;
  color: var(--gold-dim);
  margin-top: 3px;
}
.demo-choice.continue {
  text-align: center;
  font-weight: 600;
  color: #142019;
  background: var(--gold);
  border-color: var(--gold);
}
.demo-choice.continue:hover { transform: translateY(-2px); background: var(--gold); }
.demo-fade {
  animation: demoFade 0.5s var(--ease-out);
}
@keyframes demoFade {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.demo-side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: calc(var(--nav-h) + 20px);
}
.demo-stats, .demo-timeline {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: 18px;
  padding: 24px 26px;
}
.demo-side-title {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-faint);
  margin-bottom: 18px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  font-size: 15px;
}
.stat-name { color: var(--paper-dim); }
.stat-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  transition: color 0.3s;
}
.stat-value.bump-up { color: #9fd6a8; }
.stat-value.bump-down { color: var(--danger); }
.stat-value.stat-danger { color: var(--danger); }
.stat-trait {
  margin-top: 16px;
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--gold);
  border: 1px solid rgba(212, 176, 106, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
}
.timeline-list {
  list-style: none;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--paper-dim);
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.timeline-list li {
  padding: 8px 0 8px 16px;
  border-left: 1px solid var(--ink-600);
  position: relative;
}
.timeline-list li::before {
  content: '';
  position: absolute;
  left: -3.5px;
  top: 16px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-dim);
}
.timeline-list li b {
  color: var(--gold);
  font-weight: 600;
  margin-right: 6px;
}
.timeline-list li:empty { display: none; }
.timeline-empty {
  color: var(--paper-faint);
  font-style: italic;
  padding-left: 0 !important;
  border-left: 0 !important;
}
.timeline-empty::before { display: none; }

/* ============ LOOP (CÁCH CHƠI) ============ */

.loop {
  padding: clamp(100px, 15vh, 170px) 0 clamp(110px, 16vh, 180px);
  background: var(--ink-900);
}
.loop-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}
.loop-card {
  background: var(--ink-800);
  border: 1px solid var(--ink-600);
  border-radius: 16px;
  padding: 28px 24px;
  transition: border-color 0.25s, transform 0.3s var(--ease-out);
}
.loop-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-5px);
}
.loop-card:nth-child(even) { margin-top: 34px; }
.loop-icon {
  width: 34px; height: 34px;
  color: var(--gold);
  fill: currentColor;
  margin-bottom: 20px;
}
.loop-card h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
}
.loop-card p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--paper-dim);
}

/* ============ KARMA BENTO ============ */

.karma {
  padding: clamp(100px, 15vh, 170px) 24px;
  background: var(--ink-850);
}
.bento {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}
.bento-cell {
  border: 1px solid var(--ink-600);
  border-radius: 18px;
  padding: clamp(26px, 3vw, 38px);
  background: var(--ink-800);
  overflow: hidden;
}
.bento-npc {
  grid-column: span 7;
  background:
    radial-gradient(ellipse 90% 70% at 85% 0%, rgba(212, 176, 106, 0.07), transparent 60%),
    var(--ink-800);
}
.bento-artifact { grid-column: span 5; }
.bento-combat {
  grid-column: span 5;
  background:
    radial-gradient(ellipse 80% 80% at 10% 100%, rgba(74, 99, 86, 0.35), transparent 65%),
    var(--ink-800);
}
.bento-breakthrough { grid-column: span 4; }
.bento-timeline {
  grid-column: span 3;
  background:
    linear-gradient(160deg, rgba(212, 176, 106, 0.08), transparent 55%),
    var(--ink-700);
}
.bento-title {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  font-weight: 700;
  margin-bottom: 12px;
}
.bento-body {
  color: var(--paper-dim);
  font-size: 15px;
  line-height: 1.7;
  max-width: 52ch;
}

.npc-card {
  margin-top: 26px;
  background: var(--ink-700);
  border: 1px solid var(--ink-600);
  border-radius: 14px;
  padding: 22px 24px;
  max-width: 430px;
}
.npc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.npc-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 19px;
}
.npc-realm {
  font-size: 12.5px;
  color: var(--gold-dim);
  letter-spacing: 0.05em;
}
.npc-axes { display: grid; gap: 9px; }
.axis {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--paper-dim);
}
.axis span { width: 72px; flex-shrink: 0; }
.axis i {
  display: block;
  height: 3px;
  width: var(--w);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}
.npc-memory {
  margin-top: 18px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  color: var(--paper-dim);
  line-height: 1.6;
}

.ledger {
  list-style: none;
  margin-top: 24px;
  display: grid;
  gap: 0;
}
.ledger li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 0 13px 22px;
  border-left: 1px solid var(--ink-500);
  position: relative;
}
.ledger li::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 20px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-500);
}
.ledger li:first-child { padding-top: 4px; }
.ledger li:first-child::before { top: 11px; }
.ledger li:last-child { padding-bottom: 2px; }
.ledger li.ledger-danger::before { background: var(--danger); }
.ledger-who {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15.5px;
  color: var(--paper);
}
.ledger-danger .ledger-who { color: var(--danger); }
.ledger-what {
  font-size: 13.5px;
  color: var(--paper-dim);
}

.counter-ladder {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-width: 300px;
}
.rung {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--paper-dim);
  border: 1px solid var(--ink-600);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 9px 14px;
  background: rgba(21, 32, 25, 0.5);
}
.rung-best {
  color: #9fd6a8;
  border-left-color: #9fd6a8;
}
.rung-worst {
  color: var(--danger);
  border-left-color: var(--danger);
}

.life-log {
  list-style: none;
  margin-top: 24px;
  display: grid;
  gap: 13px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--paper-dim);
}
.life-log b {
  display: block;
  font-family: var(--serif);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* ============ WORLD ============ */

.world {
  position: relative;
  padding: clamp(130px, 19vh, 210px) 24px clamp(110px, 16vh, 180px);
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(20, 37, 30, 0.9), transparent 75%),
    var(--ink-950);
  overflow: hidden;
}
.world::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 78% 30%, rgba(212, 176, 106, 0.05), transparent 70%);
  pointer-events: none;
}
.world-inner {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  text-align: center;
}
.world-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.8rem, 8vw, 6rem);
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--paper) 30%, rgba(240, 235, 224, 0.55));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.world-tone {
  max-width: 620px;
  margin: 30px auto 0;
  color: var(--paper-dim);
  font-size: 16.5px;
  line-height: 1.75;
}
.realm-track {
  margin-top: clamp(56px, 8vh, 90px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 20px);
  flex-wrap: wrap;
}
.realm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px clamp(18px, 2.6vw, 34px);
  border: 1px solid var(--ink-500);
  border-radius: 14px;
  background: rgba(21, 32, 25, 0.6);
  backdrop-filter: blur(4px);
}
.realm:last-of-type {
  border-color: var(--gold-dim);
  box-shadow: 0 0 34px rgba(212, 176, 106, 0.12);
}
.realm-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}
.realm-life {
  font-size: 12.5px;
  color: var(--gold-dim);
  letter-spacing: 0.1em;
}
.realm-link {
  width: clamp(16px, 3vw, 44px);
  height: 1px;
  background: linear-gradient(90deg, var(--ink-500), var(--gold-dim));
}
.factions {
  margin-top: clamp(64px, 9vh, 100px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
}
.faction {
  border-top: 1px solid var(--ink-500);
  padding-top: 22px;
}
.faction h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--paper);
}
.faction p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--paper-dim);
}

/* ============ ENDINGS ============ */

.endings {
  padding: clamp(110px, 16vh, 180px) 24px;
  background: var(--ink-900);
}
.ending-list {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(28px, 4.5vh, 48px);
}
.ending-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.6rem, 4.6vw, 3.4rem);
  line-height: 1.25;
  text-align: center;
  color: var(--paper);
  max-width: 20ch;
}
.ending-title:nth-child(even) { color: var(--paper-dim); }

/* ============ BETA ============ */

.beta {
  padding: clamp(120px, 18vh, 200px) 24px;
  background:
    radial-gradient(ellipse 70% 55% at 50% 100%, rgba(30, 44, 36, 0.8), transparent 75%),
    var(--ink-950);
}
.beta-inner {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.beta-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  line-height: 1.15;
}
.beta-sub {
  margin: 22px auto 0;
  max-width: 440px;
  color: var(--paper-dim);
  font-size: 16px;
  line-height: 1.7;
}
.beta-form {
  margin-top: 40px;
  display: flex;
  gap: 12px;
  justify-content: center;
}
.beta-input {
  flex: 1;
  max-width: 330px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--paper);
  background: var(--ink-800);
  border: 1px solid var(--ink-500);
  border-radius: 999px;
  padding: 15px 24px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.beta-input::placeholder { color: var(--paper-faint); }
.beta-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(212, 176, 106, 0.14);
}
.beta-btn { border: 0; }
.beta-msg {
  margin-top: 18px;
  font-size: 14.5px;
  min-height: 24px;
  color: var(--paper-dim);
}
.beta-msg.ok { color: #9fd6a8; }
.beta-msg.err { color: var(--danger); }

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

.footer {
  border-top: 1px solid var(--ink-700);
  background: var(--ink-950);
  padding: 48px 24px;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
}
.footer-en {
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--paper-faint);
}
.footer-note {
  font-size: 13px;
  color: var(--paper-faint);
  max-width: 420px;
  line-height: 1.6;
}
.footer-copy {
  font-size: 13px;
  color: var(--paper-faint);
}

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

@media (max-width: 1024px) {
  .loop-track {
    grid-template-columns: repeat(3, 1fr);
  }
  .loop-card:nth-child(even) { margin-top: 0; }
  .bento-npc, .bento-artifact, .bento-combat { grid-column: span 6; }
  .bento-breakthrough { grid-column: span 5; }
  .bento-timeline { grid-column: span 7; }
}

@media (max-width: 860px) {
  .nav-links, .nav-cta { display: none; }
  .nav-menu-btn { display: flex; }
  .demo-shell { grid-template-columns: 1fr; }
  .demo-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .demo-stats, .demo-timeline { flex: 1 1 260px; }
  .factions { grid-template-columns: 1fr; gap: 28px; }
  .beta-form { flex-direction: column; align-items: stretch; }
  .beta-input { max-width: none; }
  .beta-btn { width: 100%; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .loop-track {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .bento-npc, .bento-artifact, .bento-combat, .bento-breakthrough, .bento-timeline {
    grid-column: span 12;
  }
  .hero-ctas .btn { padding: 14px 26px; font-size: 14px; }
  .manifesto-line:nth-child(2),
  .manifesto-line:nth-child(3),
  .manifesto-line:nth-child(4) { margin-left: 0; }
  .realm-track { flex-direction: column; }
  .realm { width: 100%; max-width: 300px; }
  .realm-link {
    width: 1px;
    height: 26px;
    background: linear-gradient(180deg, var(--ink-500), var(--gold-dim));
  }
  .demo-stage { min-height: 0; }
  .hero-cliff { width: clamp(180px, 44vw, 300px); }
}

/* ============ REDUCED MOTION ============ */

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