/* ============================================================
   KHAWRIZM ONE — Unified Sovereign Experience
   v3.0 BUILD 2026.05
   ============================================================ */

:root {
  --void: #000208;
  --deep: #050508;
  --panel: #08101a;
  --panel-2: #0c1626;
  --line: rgba(125, 232, 255, 0.12);
  --line-strong: rgba(125, 232, 255, 0.28);
  --cyan: #7de8ff;
  --cyan-dim: #4fb8d4;
  --violet: #7c3aed;
  --violet-dim: #5b21b6;
  --gold: #e8c97a;
  --red: #ff6b6b;
  --green: #6dffb0;
  --text: #d8eaf2;
  --text-dim: #7d96a8;
  --text-mute: #4d6376;

  --f-display: 'Orbitron', 'Cinzel', sans-serif;
  --f-ui: 'Rajdhani', system-ui, sans-serif;
  --f-myth: 'Cinzel', 'Times New Roman', serif;
  --f-mono: 'Share Tech Mono', 'Courier New', monospace;
  --f-ar: 'Rajdhani', 'Tajawal', 'Cairo', sans-serif;
}

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

html, body {
  background: var(--void);
  color: var(--text);
  font-family: var(--f-ui);
  font-weight: 300;
  line-height: 1.55;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
}

body[dir="rtl"] { font-family: var(--f-ar); }

/* ============================================================
   ATMOSPHERE — particles + scan-line + hex-grid
   ============================================================ */
#bg-particles, #bg-hex, #bg-scan {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#bg-hex {
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(124, 58, 237, 0.10), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(125, 232, 255, 0.08), transparent 50%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='52' viewBox='0 0 60 52'><polygon points='30,1 58,17 58,35 30,51 2,35 2,17' fill='none' stroke='%237de8ff' stroke-opacity='0.18' stroke-width='0.6'/></svg>");
  background-size: cover, cover, 60px 52px;
  opacity: 0.6;
}

#bg-scan::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 24px var(--cyan), 0 0 8px rgba(125,232,255,0.5);
  opacity: 0.35;
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0%   { transform: translateY(-4px); }
  100% { transform: translateY(100vh); }
}

#bg-particles { z-index: 1; }

main { position: relative; z-index: 2; }

/* ============================================================
   GLOBAL NAV + LANGUAGE SWITCHER
   ============================================================ */
.nav-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(0,2,8,0.92), rgba(0,2,8,0.55) 70%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(125,232,255,0.5);
}

.nav-logo .hex {
  display: inline-block;
  width: 18px; height: 18px;
  background: var(--cyan);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: 0 0 10px var(--cyan);
}

.nav-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 10px;
  letter-spacing: 0.18em;
  transition: color 180ms, text-shadow 180ms;
}
.nav-links a:hover { color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }

.lang-switcher {
  display: flex;
  gap: 4px;
  font-family: var(--f-display);
}
.lang-switcher button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 4px 8px;
  font-size: 10px;
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 160ms;
}
.lang-switcher button:hover { color: var(--cyan); border-color: var(--cyan); }
.lang-switcher button.active {
  color: var(--void);
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

@media (max-width: 720px) {
  .nav-links { display: none; }
  .nav-bar { padding: 8px 10px; }
}

/* ============================================================
   SECTION SHELL
   ============================================================ */
section {
  min-height: 100vh;
  padding: 100px 24px 80px;
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
}

/* WORLD markers removed in v6 — see .book-section / .chapter-number below */

.section-head {
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.section-head h2 {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: 0.06em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(125,232,255,0.35);
  line-height: 1;
}
.section-head .sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--f-mono);
}

/* ============================================================
   HERO / NEXUS GATEWAY
   ============================================================ */
#hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: 80px;
  text-align: center;
  position: relative;
}

.hero-logo {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 48px);
  letter-spacing: 0.18em;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(125,232,255,0.6);
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.hero-logo .hex {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  box-shadow: 0 0 24px var(--cyan);
  animation: pulse 3s ease-in-out infinite;
}

.hero-subline {
  color: var(--text-mute);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  margin-bottom: 40px;
}

/* Orbiting system */
.nexus-system {
  position: relative;
  width: min(560px, 88vw);
  height: min(560px, 88vw);
  margin: 30px auto 50px;
  --orbit: 180px;
}
@media (max-width: 520px) {
  .nexus-system { --orbit: 120px; }
  .nexus-system .planet { width: 44px; height: 44px; margin-top: -22px; margin-left: -22px; font-size: 9px; }
  .nexus-system .nexus-core { width: 80px; height: 80px; }
}

.nexus-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--cyan) 30%, var(--violet) 70%, transparent 100%);
  box-shadow:
    0 0 60px var(--cyan),
    0 0 120px rgba(124,58,237,0.55),
    inset 0 0 30px rgba(255,255,255,0.5);
  animation: pulse 4s ease-in-out infinite;
  z-index: 5;
}

.nexus-core::after {
  content: '⬡';
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-size: 36px;
  color: var(--void);
  text-shadow: 0 0 4px #fff;
}

.ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  animation: spin var(--dur, 30s) linear infinite;
}
.ring.r1 { width: 60%; height: 60%; --dur: 26s; }
.ring.r2 { width: 78%; height: 78%; --dur: 42s; animation-direction: reverse; }
.ring.r3 { width: 96%; height: 96%; --dur: 60s; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.planet {
  position: absolute;
  top: 50%; left: 50%;
  width: 56px; height: 56px;
  margin-top: -28px;
  margin-left: -28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 10px;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 220ms, box-shadow 220ms;
  text-align: center;
}
.planet:hover {
  transform: scale(1.18);
  z-index: 10;
}
.planet-label {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  white-space: nowrap;
  font-family: var(--f-mono);
  background: rgba(0,2,8,0.7);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms;
}
.planet:hover .planet-label { opacity: 1; }

/* 8 planet color variants */
.planet[data-color="cyan"]    { background: radial-gradient(circle at 30% 30%, #b9f3ff, #4fb8d4 60%, #0a3a4a); box-shadow: 0 0 20px var(--cyan); }
.planet[data-color="violet"]  { background: radial-gradient(circle at 30% 30%, #d2b8ff, #7c3aed 60%, #2a134e); box-shadow: 0 0 20px var(--violet); }
.planet[data-color="gold"]    { background: radial-gradient(circle at 30% 30%, #fff1c0, #e8c97a 60%, #5a4520); box-shadow: 0 0 20px var(--gold); }
.planet[data-color="red"]     { background: radial-gradient(circle at 30% 30%, #ffc4c4, #ff6b6b 60%, #5a1a1a); box-shadow: 0 0 20px var(--red); }
.planet[data-color="green"]   { background: radial-gradient(circle at 30% 30%, #c0ffd9, #6dffb0 60%, #1a5a30); box-shadow: 0 0 20px var(--green); }
.planet[data-color="blue"]    { background: radial-gradient(circle at 30% 30%, #b4c8ff, #4a6bff 60%, #1a225a); box-shadow: 0 0 20px #4a6bff; }
.planet[data-color="orange"]  { background: radial-gradient(circle at 30% 30%, #ffd4a3, #ff9b3d 60%, #5a3010); box-shadow: 0 0 20px #ff9b3d; }
.planet[data-color="white"]   { background: radial-gradient(circle at 30% 30%, #ffffff, #cfd8dc 60%, #455a64); box-shadow: 0 0 20px #fff; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.9; }
}

.hero-tagline {
  font-family: var(--f-myth);
  font-weight: 700;
  font-size: clamp(24px, 4vw, 44px);
  color: var(--gold);
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(232,201,122,0.4);
  margin: 20px 0 16px;
  min-height: 1.2em;
  transition: opacity 600ms;
}

.status-bar {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-top: 18px;
}
.status-bar span { display: flex; align-items: center; gap: 6px; }
.status-bar span::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.status-bar span.warn::before { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.status-bar span.cyan::before { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }

.scroll-cue {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.4em;
  animation: float 2.4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.4; }
  50%      { transform: translate(-50%, 10px); opacity: 1; }
}

/* ============================================================
   PANELS / CARDS — shared
   ============================================================ */
.panel {
  background: linear-gradient(180deg, rgba(8,16,26,0.85), rgba(5,5,8,0.85));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}
.panel h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 880px) {
  .grid-2, .grid-3, .grid-6 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-6 { grid-template-columns: 1fr; }
}

/* ============================================================
   HAVEN GHOST
   ============================================================ */
#haven-ghost { background: linear-gradient(180deg, transparent, rgba(124,58,237,0.04), transparent); }

.ghost-stage {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  align-items: center;
  margin-bottom: 30px;
}
@media (max-width: 880px) {
  .ghost-stage { grid-template-columns: 1fr; }
}

.ghost-svg-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.ghost-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 30px rgba(125,232,255,0.4));
  animation: ghost-float 6s ease-in-out infinite;
}
@keyframes ghost-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}

.ghost-eye, .ghost-core {
  animation: glow-pulse 2.2s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

.ghost-speech {
  background: rgba(0,2,8,0.7);
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 18px 20px;
  font-family: var(--f-myth);
  font-size: 18px;
  color: var(--cyan);
  min-height: 80px;
  position: relative;
  text-shadow: 0 0 8px rgba(125,232,255,0.4);
}
.ghost-speech::after {
  content: '▌';
  color: var(--cyan);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.waveform {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  height: 60px;
  margin: 14px 0;
}
.waveform .bar {
  width: 4px;
  background: linear-gradient(to top, var(--violet), var(--cyan));
  border-radius: 2px;
  height: 8px;
  transition: height 80ms;
}

.tts-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
textarea.tts-input {
  width: 100%;
  background: var(--deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: var(--f-ar);
  font-size: 15px;
  min-height: 70px;
  resize: vertical;
  margin-bottom: 10px;
}
textarea.tts-input:focus { outline: none; border-color: var(--cyan); }

.btn {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 3px;
  text-transform: uppercase;
  transition: all 180ms;
}
.btn:hover {
  background: var(--cyan);
  color: var(--void);
  box-shadow: 0 0 18px var(--cyan);
}
.btn.violet { border-color: var(--violet); color: var(--violet); }
.btn.violet:hover { background: var(--violet); color: #fff; box-shadow: 0 0 18px var(--violet); }
.btn.gold { border-color: var(--gold); color: var(--gold); }
.btn.gold:hover { background: var(--gold); color: var(--void); box-shadow: 0 0 18px var(--gold); }
.btn.red { border-color: var(--red); color: var(--red); }
.btn.red:hover { background: var(--red); color: var(--void); box-shadow: 0 0 18px var(--red); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-family: var(--f-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 160ms;
}
.chip:hover, .chip.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(125,232,255,0.08);
}

.slider-row {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.slider-row label { min-width: 60px; letter-spacing: 0.15em; }
.slider-row input[type="range"] { flex: 1; accent-color: var(--cyan); }
.slider-row .val { color: var(--cyan); min-width: 38px; text-align: right; }

/* Status card grid */
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
@media (max-width: 720px) { .status-grid { grid-template-columns: 1fr 1fr; } }
.status-card {
  background: var(--deep);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 4px;
  position: relative;
}
.status-card .k {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.status-card .v {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--cyan);
  letter-spacing: 0.08em;
}
.status-card.warn .v { color: var(--gold); }
.status-card.danger .v { color: var(--red); }
.status-card.ok .v { color: var(--green); }

/* ============================================================
   HAVEN OS
   ============================================================ */
.metric-bar { margin-bottom: 12px; }
.metric-bar .lbl {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.metric-bar .lbl span:last-child { color: var(--cyan); }
.metric-bar .track {
  height: 6px;
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.metric-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  width: 0%;
  transition: width 1.2s ease-out;
  box-shadow: 0 0 12px rgba(125,232,255,0.6);
}

.proc-table {
  width: 100%;
  font-family: var(--f-mono);
  font-size: 12px;
  border-collapse: collapse;
  direction: ltr;
}
.proc-table th, .proc-table td {
  padding: 6px 8px;
  text-align: start;
  border-bottom: 1px solid var(--line);
}
.proc-table th {
  color: var(--text-mute);
  font-weight: 400;
  letter-spacing: 0.18em;
  font-size: 10px;
  text-transform: uppercase;
}
.proc-table td { color: var(--text); }
.proc-table .ok { color: var(--green); }
.proc-table .pid { color: var(--cyan); }

.activity-log {
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--green);
  min-height: 160px;
  max-height: 240px;
  overflow: hidden;
  position: relative;
  line-height: 1.6;
  direction: ltr;
  text-align: left;
}
.activity-log .line { white-space: nowrap; overflow: hidden; }
.activity-log .ts { color: var(--text-mute); margin-right: 6px; }
.activity-log .ok { color: var(--green); }
.activity-log .warn { color: var(--gold); }
.activity-log .info { color: var(--cyan); }

.phalanx-out {
  margin-top: 12px;
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 10px 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
  min-height: 50px;
  background: var(--void);
}
.phalanx-out.allowed { border-color: var(--green); color: var(--green); }
.phalanx-out.blocked { border-color: var(--red); color: var(--red); }
.phalanx-out.override { border-color: var(--gold); color: var(--gold); }

/* ============================================================
   SOVEREIGN COSMOS
   ============================================================ */
#cosmos { padding: 100px 0 80px; max-width: none; min-height: 100vh; }
.cosmos-wrap { position: relative; max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.cosmos-stage {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #06091a 0%, var(--void) 70%);
}
#cosmos-canvas { width: 100%; height: 100%; display: block; }

.cosmos-hud {
  position: absolute;
  top: 12px; left: 14px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(125,232,255,0.5);
  letter-spacing: 0.18em;
  pointer-events: none;
  z-index: 3;
  direction: ltr;
  text-align: left;
}
.cosmos-hud .row { margin-bottom: 4px; }
.cosmos-clock { color: var(--gold); }

.cosmos-help {
  position: absolute;
  bottom: 12px; right: 14px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.18em;
  pointer-events: none;
  z-index: 3;
}

/* Cosmos modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,2,8,0.85);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-card {
  background: linear-gradient(180deg, var(--panel-2), var(--deep));
  border: 1px solid var(--cyan);
  border-radius: 6px;
  padding: 26px 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 0 60px rgba(125,232,255,0.25);
  position: relative;
}
.modal-card h3 {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--cyan);
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(125,232,255,0.4);
}
.modal-card .role {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.2em;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.modal-card .desc { color: var(--text); font-size: 14px; line-height: 1.65; }
.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  font-size: 22px;
  cursor: pointer;
  font-family: var(--f-display);
}
.modal-close:hover { color: var(--red); }

/* ============================================================
   CASPER ENTITY
   ============================================================ */
.casper-stage {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 26px;
  align-items: start;
  margin-bottom: 24px;
}
@media (max-width: 880px) { .casper-stage { grid-template-columns: 1fr; } }

.casper-entity {
  width: 100%;
  aspect-ratio: 1;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: radial-gradient(circle at center, rgba(124,58,237,0.15), transparent 70%);
  cursor: pointer;
  position: relative;
  transition: all 240ms;
}
.casper-entity.active {
  border-color: var(--violet);
  box-shadow: 0 0 30px var(--violet);
  background: radial-gradient(circle at center, rgba(124,58,237,0.3), transparent 70%);
}
.casper-entity svg { width: 75%; height: 75%; }
.casper-state {
  position: absolute;
  bottom: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--text-mute);
}
.casper-entity.active .casper-state { color: var(--violet); text-shadow: 0 0 8px var(--violet); }

.evidence {
  list-style: none;
  font-family: var(--f-mono);
  font-size: 12px;
}
.evidence li {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  margin-bottom: 6px;
  background: rgba(0,2,8,0.5);
  word-break: break-all;
  direction: ltr;
  text-align: left;
}
.evidence .label {
  display: inline-block;
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: 0.15em;
  font-size: 10px;
  color: var(--gold);
  margin-right: 6px;
}
.evidence .wallet { color: var(--cyan); }
.evidence .domain { color: var(--red); }

.fact-banner {
  background: linear-gradient(90deg, rgba(232,201,122,0.15), rgba(232,201,122,0.05));
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  margin: 14px 0;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 0.06em;
}
body[dir="rtl"] .fact-banner {
  border-left: none;
  border-right: 3px solid var(--gold);
}

/* ============================================================
   DARKMAN ETERNAL
   ============================================================ */
.player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(124,58,237,0.08), rgba(0,2,8,0.6));
  border-radius: 6px;
}
.play-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 1px solid var(--cyan);
  background: var(--void);
  color: var(--cyan);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 200ms;
}
.play-btn:hover {
  background: var(--cyan); color: var(--void);
  box-shadow: 0 0 18px var(--cyan);
}
.player-meta {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  direction: ltr;
  text-align: left;
}
.player-meta .title {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 16px;
  color: var(--gold);
  margin-bottom: 4px;
  letter-spacing: 0.15em;
}
.player canvas {
  width: 100%; height: 60px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.lyrics {
  margin-top: 22px;
  font-family: var(--f-myth);
  font-size: 18px;
  line-height: 2;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
  direction: ltr;
}
.lyrics .line {
  display: block;
  opacity: 0.35;
  cursor: pointer;
  transition: all 240ms;
  padding: 4px;
}
.lyrics .line:hover { color: var(--cyan); opacity: 1; }
.lyrics .line.active {
  color: var(--gold);
  opacity: 1;
  text-shadow: 0 0 18px rgba(232,201,122,0.5);
  transform: scale(1.04);
}

.dedication {
  text-align: center;
  margin-top: 30px;
  font-family: var(--f-myth);
  font-size: 14px;
  color: var(--violet);
  letter-spacing: 0.3em;
}

/* ============================================================
   NIYAH ENGINE — chat
   ============================================================ */
.chat-wrap {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
}
@media (max-width: 880px) { .chat-wrap { grid-template-columns: 1fr; } }

.chat-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--deep);
  display: flex;
  flex-direction: column;
  height: 480px;
}
.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}
.msg.user {
  align-self: flex-end;
  background: rgba(124,58,237,0.2);
  border: 1px solid var(--violet);
  color: var(--text);
}
.msg.ai {
  align-self: flex-start;
  background: rgba(125,232,255,0.08);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--f-myth);
}
body[dir="rtl"] .msg.user { align-self: flex-start; }
body[dir="rtl"] .msg.ai { align-self: flex-end; }

.chat-input-row {
  display: flex;
  border-top: 1px solid var(--line);
  padding: 10px;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: var(--void);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 4px;
  font-family: var(--f-ar);
  font-size: 14px;
}
.chat-input:focus { outline: none; border-color: var(--cyan); }

.icon-btn {
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: var(--void);
  color: var(--cyan);
  border-radius: 4px;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
  transition: all 180ms;
}
.icon-btn:hover { border-color: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.icon-btn.recording { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1.2s ease-in-out infinite; }

.chat-status {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  margin-bottom: 10px;
}
.chat-status .live { color: var(--green); }

/* ============================================================
   NIYAH VOICE LAB
   ============================================================ */
.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 880px) { .lab-grid { grid-template-columns: 1fr; } }

.lab-canvas {
  width: 100%;
  height: 180px;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 4px;
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
@media (max-width: 720px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }
.metric-card {
  background: var(--deep);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 4px;
  text-align: center;
}
.metric-card .k {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-mute);
  text-transform: uppercase;
}
.metric-card .v {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 12px rgba(125,232,255,0.4);
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.transcript {
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  font-family: var(--f-mono);
  font-size: 13px;
  color: var(--text);
  min-height: 90px;
  margin-top: 12px;
  line-height: 1.7;
}

.pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.pad {
  aspect-ratio: 1.4;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--deep));
  color: var(--text-dim);
  font-family: var(--f-display);
  font-size: 11px;
  letter-spacing: 0.12em;
  border-radius: 3px;
  cursor: pointer;
  transition: all 120ms;
}
.pad:hover { color: var(--cyan); border-color: var(--cyan); }
.pad.hit {
  background: var(--cyan);
  color: var(--void);
  box-shadow: 0 0 18px var(--cyan);
}

/* ============================================================
   MANIFESTO / FOOTER
   ============================================================ */
#manifesto {
  text-align: center;
  padding-bottom: 40px;
  min-height: auto;
}
.manifesto-text {
  max-width: 760px;
  margin: 0 auto;
  font-family: var(--f-myth);
  font-size: 19px;
  line-height: 2;
  color: var(--text);
  letter-spacing: 0.02em;
}
.manifesto-text.en {
  font-family: var(--f-display);
  font-weight: 300;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-top: 28px;
}

footer {
  margin-top: 60px;
  padding: 30px 24px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.18em;
  line-height: 2;
}
footer a {
  color: var(--cyan);
  text-decoration: none;
}
footer a:hover { text-shadow: 0 0 8px var(--cyan); }
footer .copyright { color: var(--gold); margin-top: 16px; }

/* ============================================================
   UTIL
   ============================================================ */
.text-cyan { color: var(--cyan); }
.text-gold { color: var(--gold); }
.text-violet { color: var(--violet); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.mono { font-family: var(--f-mono); }
.display { font-family: var(--f-display); font-weight: 700; letter-spacing: 0.15em; }
.mt-8  { margin-top: 8px;  }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ============================================================
   V5 ADDITIONS — Foundations, Critical Review, Roadmap,
   Friction, Question-to-the-World
   ============================================================ */

.mt-32 { margin-top: 32px; }

/* ---- Citation link style (used inside V5 sections) ---- */
.cite {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px dashed rgba(125, 232, 255, 0.45);
  padding-bottom: 1px;
  transition: color 160ms, border-color 160ms, text-shadow 160ms;
  word-break: break-word;
}
.cite:hover {
  color: #b9f3ff;
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 8px rgba(125, 232, 255, 0.45);
}

/* ============================================================
   SECTION 10 · ENGINEERING FOUNDATIONS
   ============================================================ */
#engineering-foundations {
  background: linear-gradient(180deg, transparent, rgba(125, 232, 255, 0.03), transparent);
}

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 960px) {
  .pillar-grid { grid-template-columns: 1fr; }
}

.pillar {
  background: linear-gradient(180deg, rgba(8, 16, 26, 0.85), rgba(5, 5, 8, 0.85));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
}
.pillar::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--violet), var(--cyan), transparent);
  opacity: 0.65;
}
.pillar.pillar-wide {
  grid-column: 1 / -1;
}

.pillar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pillar-num {
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  color: var(--void);
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0;
  box-shadow: 0 0 14px rgba(125, 232, 255, 0.45);
}
.pillar-head h3 {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--cyan);
  text-transform: uppercase;
  margin: 0;
}

.foundation-card {
  border-inline-start: 2px solid var(--violet);
  background: rgba(0, 2, 8, 0.55);
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 0 4px 4px 0;
}
body[dir="rtl"] .foundation-card { border-radius: 4px 0 0 4px; }

.foundation-card:last-child { margin-bottom: 0; }
.fc-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.fc-claim {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 6px;
}

.foundation-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 880px) {
  .foundation-row { grid-template-columns: 1fr; }
}

/* ============================================================
   SECTION 11 · CRITICAL SELF-REVIEW
   ============================================================ */
.challenge-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.challenge-card {
  display: grid;
  grid-template-columns: 56px 1fr 28px 1fr;
  gap: 14px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(8, 16, 26, 0.85), rgba(5, 5, 8, 0.85));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
}
.challenge-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(180deg, var(--red), var(--gold), var(--green));
  opacity: 0.65;
}
body[dir="rtl"] .challenge-card::before { left: auto; right: 0; }

.cc-num {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 36px;
  color: var(--violet);
  text-shadow: 0 0 16px rgba(124, 58, 237, 0.5);
  letter-spacing: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}
.cc-challenge, .cc-solution {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 0;
}
.cc-arrow {
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(125, 232, 255, 0.5);
}
body[dir="rtl"] .cc-arrow { transform: scaleX(-1); }

.cc-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-mute);
  text-transform: uppercase;
}
.cc-challenge .cc-tag { color: var(--red); }
.cc-solution .cc-tag  { color: var(--green); }

.cc-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-transform: uppercase;
  margin-top: 2px;
}
.cc-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}
.cc-cites {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

@media (max-width: 880px) {
  .challenge-card { grid-template-columns: 1fr; }
  .cc-num { font-size: 28px; padding-bottom: 4px; }
  .cc-arrow { transform: rotate(90deg); padding: 6px 0; }
  body[dir="rtl"] .cc-arrow { transform: rotate(90deg) scaleX(-1); }
}

/* Hallucinations table */
.halluc-table {
  width: 100%;
  border-collapse: collapse;
  direction: ltr;
  font-size: 12px;
}
body[dir="rtl"] .halluc-table { direction: rtl; }
.halluc-table th,
.halluc-table td {
  padding: 10px 12px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.halluc-table th {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 400;
}
.halluc-table td { color: var(--text); line-height: 1.55; }
.halluc-table .hc-claim {
  color: var(--red);
  font-family: var(--f-mono);
  white-space: nowrap;
}
@media (max-width: 720px) {
  .halluc-table th, .halluc-table td { padding: 8px 6px; font-size: 11px; }
  .halluc-table .hc-claim { white-space: normal; }
}

/* ============================================================
   SECTION 12 · ROADMAP
   ============================================================ */
.roadmap-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-inline-start: 0;
}
.roadmap-timeline::before {
  content: '';
  position: absolute;
  top: 24px;
  bottom: 24px;
  inset-inline-start: 26px;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet), var(--gold));
  opacity: 0.45;
}
body[dir="rtl"] .roadmap-timeline::before { inset-inline-start: auto; right: 26px; }

.phase {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  position: relative;
}
.phase-marker {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  background: var(--void);
  border: 2px solid var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(125, 232, 255, 0.45);
  position: relative;
  z-index: 2;
}
.phase[data-phase="0"] .phase-marker { border-color: var(--green); box-shadow: 0 0 16px rgba(109, 255, 176, 0.5); }
.phase[data-phase="1"] .phase-marker { border-color: var(--cyan); }
.phase[data-phase="2"] .phase-marker { border-color: var(--gold); box-shadow: 0 0 16px rgba(232, 201, 122, 0.5); }
.phase[data-phase="3"] .phase-marker { border-color: var(--violet); box-shadow: 0 0 16px rgba(124, 58, 237, 0.5); }
.phase[data-phase="4"] .phase-marker { border-color: var(--red); box-shadow: 0 0 16px rgba(255, 107, 107, 0.5); }

.phase-marker span {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 22px;
  color: #fff;
  text-shadow: 0 0 10px var(--cyan);
}
.phase-body {
  background: linear-gradient(180deg, rgba(8, 16, 26, 0.85), rgba(5, 5, 8, 0.85));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 14px 18px;
  position: relative;
}
.phase-body::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.5;
}
.phase-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.phase-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-transform: uppercase;
}
.phase-dur {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
}
.phase-deliver {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 8px;
}
.phase-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}
.phase-meta b {
  color: var(--text-mute);
  font-weight: 400;
  letter-spacing: 0.18em;
  margin-inline-end: 4px;
}
.phase-meta .capex { color: var(--green); }
.phase-meta .risk  { color: var(--gold); }
.phase-meta .risk b { color: var(--text-mute); }

.callout-parallel {
  margin-top: 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.12), rgba(125, 232, 255, 0.06));
  border: 1px solid var(--violet);
  border-radius: 4px;
  padding: 14px 18px;
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.18);
}
.cp-icon {
  font-size: 26px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(232, 201, 122, 0.6);
}
.cp-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-transform: uppercase;
}
.cp-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
}

@media (max-width: 720px) {
  .phase { grid-template-columns: 44px 1fr; gap: 10px; }
  .phase-marker { width: 42px; height: 42px; }
  .phase-marker span { font-size: 17px; }
  .roadmap-timeline::before { inset-inline-start: 20px; }
  body[dir="rtl"] .roadmap-timeline::before { right: 20px; }
}

/* ============================================================
   SECTION 13 · FRICTION
   ============================================================ */
.friction-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 880px) {
  .friction-grid { grid-template-columns: 1fr; }
}

.friction-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  gap: 10px 14px;
  background: linear-gradient(180deg, rgba(26, 8, 8, 0.55), rgba(5, 5, 8, 0.85));
  border: 1px solid rgba(232, 201, 122, 0.28);
  border-radius: 4px;
  padding: 16px 18px;
  position: relative;
}
.fr-flag {
  grid-row: 1 / 3;
  display: grid; place-items: center;
  font-size: 22px;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(232, 201, 122, 0.55);
}
.fr-risk, .fr-mit { display: flex; flex-direction: column; gap: 4px; }
.fr-mit { border-top: 1px dashed var(--line); padding-top: 10px; }
.fr-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-mute);
  text-transform: uppercase;
}
.fr-risk .fr-tag { color: var(--red); }
.fr-mit  .fr-tag { color: var(--green); }
.fr-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
}
.fr-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

/* ============================================================
   SECTION 14 · THE QUESTION TO THE WORLD
   ============================================================ */
#call-to-world {
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(125, 232, 255, 0.08), transparent 60%),
    radial-gradient(ellipse at 50% 80%, rgba(124, 58, 237, 0.08), transparent 60%);
}
.ctw-head { text-align: center; }
.ctw-head h2 { color: var(--gold); text-shadow: 0 0 22px rgba(232, 201, 122, 0.4); }

.ctw-question {
  font-family: var(--f-myth);
  font-weight: 700;
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.55;
  color: var(--cyan);
  max-width: 900px;
  margin: 18px auto 36px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 12px rgba(125, 232, 255, 0.25);
}
body[dir="rtl"] .ctw-question { font-family: var(--f-ar); font-weight: 700; }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}
@media (max-width: 980px) { .choice-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .choice-grid { grid-template-columns: 1fr; } }

.choice-card {
  background: linear-gradient(180deg, rgba(8, 16, 26, 0.85), rgba(5, 5, 8, 0.85));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 18px 18px;
  cursor: pointer;
  text-align: start;
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform 220ms, border-color 220ms, box-shadow 220ms;
  font-family: inherit;
}
.choice-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: var(--cyan);
  opacity: 0.7;
  transition: height 220ms;
}
.choice-card[data-color="cyan"]::before   { background: var(--cyan); }
.choice-card[data-color="violet"]::before { background: var(--violet); }
.choice-card[data-color="gold"]::before   { background: var(--gold); }
.choice-card[data-color="red"]::before    { background: var(--red); }

.choice-card:hover {
  transform: translateY(-4px);
  border-color: var(--cyan);
  box-shadow: 0 12px 36px rgba(125, 232, 255, 0.22), 0 0 22px rgba(125, 232, 255, 0.18);
}
.choice-card[data-color="violet"]:hover { border-color: var(--violet); box-shadow: 0 12px 36px rgba(124, 58, 237, 0.25); }
.choice-card[data-color="gold"]:hover   { border-color: var(--gold);   box-shadow: 0 12px 36px rgba(232, 201, 122, 0.22); }
.choice-card[data-color="red"]:hover    { border-color: var(--red);    box-shadow: 0 12px 36px rgba(255, 107, 107, 0.22); }

.choice-card.voted {
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(232, 201, 122, 0.45);
}
.choice-card.voted::before { height: 6px; background: var(--gold); }

.ch-num {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 28px;
  color: var(--text-mute);
  letter-spacing: 0;
  margin-bottom: 8px;
}
.ch-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  text-transform: uppercase;
  margin-bottom: 8px;
  line-height: 1.3;
}
.ch-text {
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 14px;
  min-height: 38px;
}
.ch-tag {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold);
  padding: 3px 8px;
  border: 1px solid var(--gold);
  border-radius: 2px;
  text-transform: uppercase;
}

.ctw-tally {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 26px auto 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  min-height: 18px;
}
.ctw-tally .tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ctw-tally .tally b { color: var(--cyan); font-weight: 700; }

.ctw-foot {
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.22em;
  text-align: center;
  text-transform: uppercase;
}

/* world-marker rule removed in v6 */

/* ============================================================
   V6 · BOOK TYPOGRAPHY — academic long-form reading layout
   ============================================================ */

.book-section,
.book-front {
  position: relative;
  padding: 96px 24px 80px;
  min-height: auto;
}

.book-chapter {
  max-width: 780px;
  margin: 0 auto;
  font-family: var(--f-body, "Rajdhani", "Tajawal", system-ui, sans-serif);
  line-height: 1.85;
  font-size: 17.5px;
  font-weight: 400;
  color: #d8e1ea;
  letter-spacing: 0.005em;
}

body[dir="rtl"] .book-chapter {
  font-family: "Tajawal", "Amiri", "Rajdhani", system-ui, serif;
  line-height: 1.95;
  font-size: 18px;
}

.book-chapter p {
  margin: 0 0 1.5rem;
  text-align: justify;
  text-justify: inter-word;
}

.book-chapter p + p { text-indent: 0; }

.book-chapter b,
.book-chapter strong {
  color: #f3e9c0;
  font-weight: 700;
}

.book-chapter i,
.book-chapter em {
  color: #a8c8e0;
  font-style: italic;
}

.book-chapter code {
  font-family: var(--f-mono, "Share Tech Mono", monospace);
  font-size: 0.88em;
  background: rgba(125, 232, 255, 0.07);
  border: 1px solid rgba(125, 232, 255, 0.18);
  padding: 1px 6px;
  border-radius: 3px;
  color: #b8e8ff;
  letter-spacing: 0;
}

.book-chapter a {
  color: var(--cyan, #7de8ff);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}

.book-chapter a:hover { color: var(--gold, #e8c97a); }

/* Chapter number — gold serif */
.chapter-number {
  font-family: "Cinzel", "Cairo", "Tajawal", serif;
  font-size: 14px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold, #e8c97a);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(232, 201, 122, 0.25);
  font-weight: 500;
}

body[dir="rtl"] .chapter-number {
  font-family: "Amiri", "Cairo", "Tajawal", serif;
  letter-spacing: 0.08em;
  font-size: 15px;
}

/* Chapter title — large with hairline underline */
.chapter-title {
  font-family: "Orbitron", "Tajawal", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
  color: #f3f7fb;
  margin: 0 0 36px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0;
}

body[dir="rtl"] .chapter-title {
  font-family: "Tajawal", "Amiri", system-ui, serif;
  font-weight: 700;
  line-height: 1.45;
}

/* Citation references — superscript */
sup.cite-ref {
  font-size: 0.68em;
  line-height: 0;
  vertical-align: super;
  margin-inline-start: 1px;
}

sup.cite-ref a.cite,
.book-chapter a.cite {
  color: var(--gold, #e8c97a);
  text-decoration: none;
  border-bottom: 1px dotted rgba(232, 201, 122, 0.55);
  padding: 0 1px;
  font-family: var(--f-mono, "Share Tech Mono", monospace);
  font-weight: 500;
}

sup.cite-ref a.cite:hover { color: #fff; border-bottom-color: #fff; }

/* Figure blocks — diagrams */
.diagram-fig {
  margin: 2.5rem 0;
  padding: 0;
  background: rgba(8, 12, 22, 0.55);
  border: 1px solid rgba(125, 232, 255, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

.diagram-fig-wide { margin-inline-start: -40px; margin-inline-end: -40px; }

.diagram-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #060914;
}

.diagram-fig figcaption {
  padding: 14px 22px 18px;
  font-family: var(--f-body, "Tajawal", system-ui);
  font-size: 14.5px;
  line-height: 1.7;
  color: #9ab;
  border-top: 1px solid rgba(125, 232, 255, 0.1);
  text-align: justify;
}

.diagram-fig figcaption b { color: var(--gold, #e8c97a); }

/* Data tables in chapters */
.data-table-wrap { overflow-x: auto; margin: 2rem 0; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--f-body, "Tajawal", "Rajdhani");
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  border: 1px solid rgba(125, 232, 255, 0.15);
  text-align: start;
  vertical-align: top;
}

.data-table thead th {
  background: rgba(125, 232, 255, 0.08);
  color: var(--gold, #e8c97a);
  font-weight: 700;
  font-family: "Share Tech Mono", monospace;
  font-size: 13px;
  letter-spacing: 0.05em;
}

.data-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }

/* References section */
.book-references .ref-note {
  color: #9ab;
  font-style: italic;
  font-size: 15.5px;
  margin-bottom: 2rem;
  padding-inline-start: 18px;
  border-inline-start: 2px solid rgba(232, 201, 122, 0.3);
}

.ref-list {
  list-style: decimal;
  padding-inline-start: 28px;
  font-size: 15px;
  line-height: 1.8;
  color: #c5cfd9;
}

.ref-list li {
  margin-bottom: 12px;
  padding-inline-start: 6px;
}

.ref-list li::marker { color: var(--gold, #e8c97a); font-family: "Share Tech Mono", monospace; }

.ref-list a {
  color: var(--cyan, #7de8ff);
  word-break: break-word;
}

/* Front matter */
.book-front .chapter-number { color: var(--violet, #b39bff); border-bottom-color: rgba(179, 155, 255, 0.25); }
.book-front .chapter-title { font-size: clamp(24px, 3.5vw, 34px); }

/* Footer */
.book-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 40px 24px;
  text-align: center;
  font-family: var(--f-mono, "Share Tech Mono");
  font-size: 13px;
  color: var(--text-mute, #6a7b8c);
  letter-spacing: 0.06em;
}

.book-footer .footer-row { margin: 6px 0; }
.book-footer .footer-row a { color: var(--cyan, #7de8ff); text-decoration: none; border-bottom: 1px solid rgba(125,232,255,0.3); }
.book-footer .copyright { color: var(--text-dim, #99a8b8); margin-top: 16px; }

/* Mobile — chapter expands full width, diagrams scroll horizontally */
@media (max-width: 760px) {
  .book-section, .book-front { padding: 72px 18px 60px; }
  .book-chapter { font-size: 16.5px; line-height: 1.85; }
  body[dir="rtl"] .book-chapter { font-size: 17px; }
  .chapter-title { font-size: clamp(22px, 6vw, 30px); }
  .diagram-fig-wide { margin-inline-start: -18px; margin-inline-end: -18px; }
  .diagram-fig { overflow-x: auto; }
  .diagram-svg { min-width: 720px; }
  .data-table { font-size: 13.5px; }
}
