:root {
  --bg: #0a0f21;
  --panel: #151d38;
  --panel-2: #1d2847;
  --ink: #f5f1d9;
  --muted: #bbc4da;
  --cyan: #69f0e2;
  --yellow: #ffe66d;
  --pink: #ff7aa8;
  --green: #8df07b;
  --red: #ff6f6f;
  --line: #3e4d72;
  --shadow: #050812;
  --pixel: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, #21305c 0, transparent 34rem),
    var(--bg);
  background-size: 24px 24px, 24px 24px, auto, auto;
  font-family: var(--ui);
  min-height: 100vh;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,.08) 4px);
  mix-blend-mode: multiply;
  z-index: 99;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 12px;
  z-index: 200;
  background: var(--yellow);
  color: #111;
  padding: 10px 14px;
  font-weight: 800;
}
.skip-link:focus { top: 12px; }

.page-shell { max-width: 1460px; margin: 0 auto; padding: 14px; }

.topbar {
  position: sticky;
  top: 8px;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 10px;
  border: 3px solid var(--cyan);
  background: rgba(10,15,33,.94);
  box-shadow: 6px 6px 0 var(--shadow);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.brand-mark { font-size: 2.2rem; filter: drop-shadow(3px 3px 0 #000); }
.brand b { display: block; font: 900 1.1rem/1 var(--pixel); color: var(--cyan); letter-spacing: .08em; }
.brand small { color: var(--muted); }

.nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.nav button, .sound-toggle {
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 9px 12px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow);
}
.nav button:hover, .nav button.active, .sound-toggle:hover { border-color: var(--yellow); color: var(--yellow); transform: translate(-1px,-1px); }
.sound-toggle span { font-size: .85rem; }

main { padding: 36px 0 18px; }
.view { display: none; animation: appear .18s steps(3, end); }
.view.active { display: block; }
@keyframes appear { from { opacity: .2; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.panel, .info-card, .mode-card {
  border: 3px solid var(--line);
  background: linear-gradient(135deg, var(--panel), #10172e);
  box-shadow: 8px 8px 0 var(--shadow);
}

.hero {
  min-height: 470px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 28px;
  align-items: center;
  padding: clamp(24px, 6vw, 72px);
  border-color: var(--cyan);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "VAC//FOBOPEDIA//2026";
  position: absolute;
  right: -50px;
  top: 34px;
  transform: rotate(90deg);
  font: 700 .75rem var(--pixel);
  letter-spacing: .18em;
  color: rgba(105,240,226,.25);
}
.eyebrow, .pixel-label {
  font: 800 .78rem var(--pixel);
  letter-spacing: .12em;
  color: var(--yellow);
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.2rem, 6vw, 5.6rem); line-height: .95; margin-bottom: 22px; letter-spacing: -.055em; }
.lead { font-size: clamp(1.05rem, 2vw, 1.4rem); line-height: 1.55; color: var(--muted); max-width: 800px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.primary, .secondary, .danger-button {
  border: 3px solid;
  padding: 13px 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 5px 5px 0 var(--shadow);
}
.primary { background: var(--yellow); color: #171717; border-color: #fff1a8; }
.secondary { background: var(--panel-2); border-color: var(--cyan); }
.primary:hover, .secondary:hover, .danger-button:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 var(--shadow); }

.mascot-card { display: grid; place-items: center; gap: 18px; }
.mascot { font-size: clamp(7rem, 15vw, 12rem); filter: drop-shadow(10px 10px 0 #000); animation: bob 1.8s steps(4,end) infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-2deg); } }
.speech { max-width: 430px; border: 3px solid var(--pink); padding: 18px; background: #241c37; position: relative; }
.speech::before { content: ""; position: absolute; left: 24px; top: -15px; width: 22px; height: 22px; background: #241c37; border-left: 3px solid var(--pink); border-top: 3px solid var(--pink); transform: rotate(45deg); }
.speech strong { color: var(--pink); font: 900 1.1rem var(--pixel); }
.speech p { margin: 8px 0 0; line-height: 1.55; }

.three-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 24px 0; }
.info-card { padding: 24px; min-height: 240px; }
.info-card:nth-child(1) { border-color: var(--green); }
.info-card:nth-child(2) { border-color: var(--red); }
.info-card:nth-child(3) { border-color: var(--pink); }
.big-emoji { font-size: 3.4rem; }
.info-card h2 { margin: 14px 0 10px; }
.info-card p { color: var(--muted); line-height: 1.55; }


.name-origin {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 22px;
  padding: 24px;
  margin: 24px 0;
  border-color: var(--pink);
}
.name-origin-mark { font-size: clamp(3.5rem, 8vw, 6rem); filter: drop-shadow(6px 6px 0 #000); }
.name-origin h2 { margin-bottom: 8px; font-size: clamp(1.6rem, 3vw, 2.7rem); }
.name-origin p:last-child { margin: 0; color: var(--muted); line-height: 1.6; }
.term-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 7px;
  border: 2px solid var(--line);
  background: #0d142b;
  color: var(--muted);
  font: 800 .62rem/1.2 var(--pixel);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.term-badge.rare { border-color: var(--pink); color: var(--pink); }
.term-badge.modern { border-color: var(--cyan); color: var(--cyan); }
.term-badge.debated { border-color: var(--yellow); color: var(--yellow); }
.phobia-card .term-badge { margin-bottom: 12px; }

.motto { padding: 24px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 30px; align-items: center; border-color: var(--yellow); }
.motto h2 { font-size: clamp(1.8rem, 4vw, 3.3rem); margin: 0; }
.motto p { margin: 0; color: var(--muted); line-height: 1.6; }

.section-head { max-width: 1020px; margin: 0 auto 28px; text-align: center; }
.section-head h1 { font-size: clamp(2.2rem, 5vw, 4.5rem); margin-bottom: 14px; }
.section-head > p:last-child { color: var(--muted); font-size: 1.15rem; line-height: 1.55; }
.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
  gap: 8px;
  overflow: hidden;
}
.timeline article {
  min-width: 0;
  padding: 24px;
  border: 2px solid transparent;
  overflow: hidden;
}
.timeline article:hover { border-color: var(--cyan); background: rgba(105,240,226,.04); }
.scene {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 92px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-style: normal;
  font-size: clamp(2.6rem, 3.6vw, 4.1rem);
  line-height: 1;
  letter-spacing: -.08em;
}
.timeline p, .lesson p, .balance p { color: var(--muted); line-height: 1.55; }
.timeline > *, .three-cards > *, .lesson-grid > *, .balance > *,
.atlas-grid > *, .game-menu > *, .progress-grid > *, .badges > * { min-width: 0; }


.lesson-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.lesson { padding: 28px; }
.animal-signs { display: flex; flex-wrap: wrap; gap: 8px; }
.animal-signs span { border: 2px solid var(--line); background: var(--panel-2); padding: 8px 10px; }
.alarm-demo { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.alarm-demo button { cursor: pointer; border: 2px solid var(--line); padding: 11px; background: var(--panel-2); }
.alarm-demo button:hover { border-color: var(--yellow); }
.result-box { min-height: 62px; padding: 12px; border-left: 5px solid var(--cyan); background: #0d142b; }
.balance { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 20px; padding: 28px; text-align: center; align-items: center; }
.balance-side { border: 2px solid var(--line); padding: 18px; min-height: 210px; }
.balance-face { font-size: 3.4rem; }
.scale { font: 900 clamp(1rem, 3vw, 2rem) var(--pixel); color: var(--cyan); margin-bottom: 16px; }
.next-step { display: flex; justify-content: center; margin: 30px 0; }

.atlas-head { max-width: none; display: grid; grid-template-columns: 1fr auto; text-align: left; align-items: end; gap: 20px; }
.search-box { display: grid; gap: 6px; color: var(--muted); font-size: .9rem; }
.search-box input { width: min(360px, 80vw); border: 3px solid var(--line); background: var(--panel); color: var(--ink); padding: 12px; }

.term-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: .9rem;
  box-shadow: 4px 4px 0 var(--shadow);
}
.term-legend span { min-width: 220px; flex: 1 1 220px; }
.term-legend b { color: var(--ink); }
.term-legend .rare-text { color: var(--pink); }
.term-legend .modern-text { color: var(--cyan); }
.term-legend .debated-text { color: var(--yellow); }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-row button { border: 2px solid var(--line); background: var(--panel); padding: 8px 12px; cursor: pointer; }
.filter-row button small { display: inline-grid; place-items: center; min-width: 1.55rem; height: 1.35rem; margin-left: 5px; padding: 0 4px; border: 1px solid currentColor; font: 800 .68rem var(--pixel); }
.filter-row button.active, .filter-row button:hover { border-color: var(--cyan); color: var(--cyan); }
.atlas-groups { display: grid; gap: 34px; }
.atlas-category { min-width: 0; scroll-margin-top: 110px; }
.category-head { margin: 0 0 14px; padding: 18px 20px; border-left: 5px solid var(--cyan); background: linear-gradient(90deg, rgba(105,240,226,.09), transparent); }
.category-head h2 { margin: 3px 0 7px; font-size: clamp(1.65rem, 3vw, 2.65rem); }
.category-head p:last-child { margin: 0; color: var(--muted); line-height: 1.5; }
.atlas-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.phobia-card { border: 3px solid var(--line); background: var(--panel); padding: 18px; min-height: 245px; cursor: pointer; text-align: left; box-shadow: 6px 6px 0 var(--shadow); position: relative; overflow: hidden; }
.phobia-card::after { content: "+"; position: absolute; right: 10px; bottom: 2px; color: var(--line); font: 900 3.3rem var(--pixel); }
.phobia-card:hover { border-color: var(--yellow); transform: translate(-2px,-2px); }
.phobia-card.visited { border-color: var(--green); }
.phobia-card .card-emoji { font-size: 3rem; display: block; margin-bottom: 14px; }
.phobia-card h2 { font: 900 1.05rem var(--pixel); color: var(--cyan); text-transform: uppercase; overflow-wrap: anywhere; }
.phobia-card p { color: var(--muted); line-height: 1.45; }
.phobia-card small { color: var(--yellow); }
.empty-state { grid-column: 1 / -1; padding: 40px; text-align: center; border: 3px dashed var(--line); color: var(--muted); }

.phobia-dialog { width: min(780px, calc(100vw - 24px)); max-height: 88vh; overflow: auto; border: 4px solid var(--cyan); background: var(--bg); color: var(--ink); box-shadow: 12px 12px 0 #000; padding: 0; }
.phobia-dialog::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(3px); }
.dialog-close { position: sticky; top: 8px; float: right; margin: 8px; z-index: 3; width: 42px; height: 42px; border: 3px solid var(--red); background: #2b1520; font-size: 1.6rem; cursor: pointer; }
.dialog-body { padding: 34px; }
.dialog-emoji { font-size: 5.5rem; }
.dialog-body h2 { font-size: clamp(2rem, 5vw, 3.3rem); margin-bottom: 8px; color: var(--cyan); overflow-wrap: anywhere; }
.etymology { border: 3px solid var(--yellow); background: #251f18; padding: 16px; margin: 20px 0; }
.etymology code { color: var(--yellow); font: 800 1rem var(--pixel); }
.fact-box { border-left: 7px solid var(--pink); background: #24192f; padding: 16px; margin-top: 20px; }
.dialog-note { color: var(--muted); line-height: 1.6; }

.game-menu { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mode-card { min-height: 250px; padding: 24px; text-align: left; cursor: pointer; }
.mode-card:hover { border-color: var(--yellow); transform: translate(-2px,-2px); }
.mode-card span { display: block; font-size: 3.5rem; margin-bottom: 20px; }
.mode-card b { display: block; color: var(--cyan); font: 900 1rem var(--pixel); margin-bottom: 12px; }
.mode-card small { color: var(--muted); line-height: 1.5; }
.game-stage { padding: 28px; max-width: 900px; margin: 0 auto; }
.hidden { display: none !important; }
.game-topline { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 18px; color: var(--muted); }
.game-question { text-align: center; padding: 18px 0; }
.game-question .huge { font-size: clamp(4rem, 14vw, 9rem); display: block; margin-bottom: 14px; }
.game-question h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer { border: 3px solid var(--line); background: var(--panel-2); padding: 15px; cursor: pointer; text-align: left; min-height: 64px; }
.answer:hover { border-color: var(--cyan); }
.answer.correct { border-color: var(--green); background: #17331f; }
.answer.wrong { border-color: var(--red); background: #3a1b26; }
.feedback { margin: 18px 0; padding: 15px; border: 3px solid var(--line); min-height: 72px; line-height: 1.55; }
.feedback.good { border-color: var(--green); }
.feedback.learn { border-color: var(--yellow); }
.game-controls { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.game-controls button { border: 2px solid var(--line); background: var(--panel); padding: 10px 14px; cursor: pointer; }
.game-controls button:hover { border-color: var(--yellow); }

.progress-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stat-card { padding: 28px; text-align: center; }
.stat { display: block; font: 900 clamp(3rem, 8vw, 6rem) var(--pixel); color: var(--yellow); }
.stat-card p { color: var(--muted); }
.badges-panel, .safety-note { padding: 28px; margin-top: 22px; }
.badges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.badge { border: 3px solid var(--line); padding: 16px; text-align: center; opacity: .4; filter: grayscale(1); }
.badge.earned { opacity: 1; filter: none; border-color: var(--yellow); background: #282319; }
.badge span { display: block; font-size: 2.7rem; margin-bottom: 8px; }
.badge b { font: 800 .86rem var(--pixel); }
.safety-note p { max-width: 980px; color: var(--muted); line-height: 1.6; }
.danger-button { background: #351621; border-color: var(--red); color: var(--ink); }

.footer { margin-top: 36px; border-top: 3px solid var(--line); padding: 28px 8px 42px; display: flex; justify-content: space-between; gap: 24px; color: var(--muted); }
.footer div { display: grid; gap: 6px; }
.footer strong { color: var(--cyan); font-family: var(--pixel); }
.footer a { color: var(--yellow); }
.footer p { max-width: 530px; text-align: right; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .nav { grid-column: 1 / -1; order: 3; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .hero { grid-template-columns: 1fr; }
  .three-cards { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scene { font-size: clamp(2.7rem, 6vw, 4rem); }
  .atlas-grid { grid-template-columns: repeat(3, 1fr); }
  .game-menu { grid-template-columns: 1fr 1fr; }
  .badges { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .page-shell { padding: 8px; }
  .topbar { top: 4px; }
  .sound-toggle span { display: none; }
  .nav button { white-space: nowrap; }
  main { padding-top: 22px; }
  .hero { min-height: auto; padding: 26px 18px; }
  h1 { letter-spacing: -.035em; }
  .motto, .lesson-grid, .balance, .atlas-head, .progress-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: minmax(0, 1fr); }
  .scene { min-height: 72px; font-size: 3.2rem; }
  .atlas-head { align-items: stretch; }
  .search-box input { width: 100%; }
  .atlas-grid { grid-template-columns: 1fr 1fr; }
  .phobia-card { min-height: 220px; }
  .game-menu { grid-template-columns: 1fr; }
  .answers { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
  .footer p { text-align: left; }
}

@media (max-width: 480px) {
  .brand small { display: none; }
  .atlas-grid { grid-template-columns: 1fr; }
  .badges { grid-template-columns: 1fr; }
  .dialog-body { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 700px) {
  .name-origin { grid-template-columns: 1fr; }
  .name-origin-mark { font-size: 4rem; }
}
