:root {
  --void: #05030a;
  --void-2: #0c0616;
  --ink: #160b24;
  --panel: rgba(16, 8, 32, 0.62);
  --panel-strong: rgba(10, 5, 22, 0.88);
  --line: rgba(168, 85, 247, 0.28);
  --line-strong: rgba(216, 180, 254, 0.55);
  --purple-0: #3b0764;
  --purple-1: #6b21a8;
  --purple-2: #7e22ce;
  --purple-3: #a855f7;
  --purple-4: #c084fc;
  --purple-5: #e9d5ff;
  --lilac: #f3e8ff;
  --gold: #f5c56b;
  --gold-dim: #c9a24a;
  --cyan: #67e8f9;
  --rose: #fb7185;
  --ok: #86efac;
  --text: #f4ecff;
  --muted: #b39ecf;
  --shadow: 0 24px 80px rgba(76, 29, 149, 0.38);
  --glow: 0 0 28px rgba(168, 85, 247, 0.35);
  --radius: 20px;
  --font-d: "Syne", sans-serif;
  --font-b: "Outfit", sans-serif;
  --font-s: "Instrument Serif", serif;
  --font-hud: "Oxanium", "Syne", sans-serif;
}

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

html, body { height: 100%; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-b);
  background: var(--void);
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
  line-height: 1.5;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img, svg { max-width: 100%; height: auto; }
button, a, input { touch-action: manipulation; }
input { font-size: 16px; }

a { color: var(--purple-4); text-decoration: none; }
a:hover { color: var(--lilac); }

button, input { font-family: inherit; }

.bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(980px 560px at 10% -12%, rgba(192, 132, 252, 0.42), transparent 58%),
    radial-gradient(760px 500px at 94% 6%, rgba(34, 211, 238, 0.16), transparent 50%),
    radial-gradient(680px 680px at 50% 118%, rgba(126, 34, 206, 0.5), transparent 52%),
    var(--void);
}
.grid-overlay {
  position: absolute; inset: -1px;
  background-image:
    linear-gradient(rgba(192,132,252,.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(192,132,252,.12) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 18%, #000 28%, transparent 80%);
  opacity: .7;
  animation: gridshift 28s linear infinite;
}
.scan {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, transparent 0 3px, rgba(255,255,255,.02) 3px 4px),
    linear-gradient(to bottom, transparent 40%, rgba(168,85,247,.12) 50%, transparent 60%);
  background-size: auto, 100% 220%;
  animation: scanmove 7s linear infinite;
  mix-blend-mode: screen;
  opacity: .35;
}

.orb {
  position: absolute; border-radius: 50%; filter: blur(40px); opacity: 0.55;
  animation: drift 22s ease-in-out infinite alternate;
}
.orb.a { width: 340px; height: 340px; background: #7e22ce; top: -80px; left: -60px; }
.orb.b { width: 280px; height: 280px; background: #581c87; right: -40px; top: 30%; animation-duration: 28s; }
.orb.c { width: 420px; height: 220px; background: #3b0764; bottom: -80px; left: 30%; animation-duration: 26s; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 24px) scale(1.08); }
}

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

.app { position: relative; z-index: 2; min-height: 100%; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; padding-top: max(14px, env(safe-area-inset-top));
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(20px) saturate(1.2);
  background: linear-gradient(180deg, rgba(5,3,10,.82), rgba(5,3,10,.28));
  border-bottom: 1px solid rgba(168,85,247,.18);
  box-shadow: 0 1px 0 rgba(103,232,249,.08);
}

.brand {
  display: flex; align-items: center; gap: 12px; color: var(--text);
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background:
    conic-gradient(from 210deg, #e9d5ff, #a855f7, #22d3ee, #6b21a8, #e9d5ff);
  box-shadow: 0 0 24px rgba(168, 85, 247, 0.55);
  position: relative;
}
.brand-mark::before {
  content: ""; position: absolute; inset: 2px; border-radius: 9px; background: #12081c;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  border: 2px solid rgba(233,213,255,.8); border-left-color: transparent;
  animation: spin 8s linear infinite;
}
.brand-name { font-family: var(--font-d); font-weight: 800; letter-spacing: 0.04em; font-size: 15px; }
.brand-name span { display: block; font-weight: 500; font-size: 10px; letter-spacing: 0.22em; color: var(--purple-4); text-transform: uppercase; }

.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linkish {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 13px; padding: 10px 12px; border-radius: 999px;
  min-height: 44px; letter-spacing: .04em;
}
.nav a:hover, .nav button.linkish:hover {
  color: var(--text); background: rgba(168,85,247,.14);
  box-shadow: inset 0 0 0 1px rgba(168,85,247,.28);
}

.nav-lang { position: relative; }
.nav-lang-menu {
  display: none; position: absolute; top: calc(100% - 2px); right: 0;
  width: 220px; padding: 8px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel-strong); box-shadow: var(--shadow);
  z-index: 30;
  flex-direction: column; align-items: stretch; gap: 4px;
}
.nav-lang:hover .nav-lang-menu,
.nav-lang:focus-within .nav-lang-menu,
.nav-lang.is-open .nav-lang-menu { display: flex; }
.nav-lang-menu button[data-lang] {
  display: flex; flex-direction: row; flex-wrap: nowrap;
  align-items: center; justify-content: flex-start; gap: 10px; width: 100%;
  background: none; border: 0; color: var(--text); cursor: pointer;
  text-align: left; padding: 8px 10px; border-radius: 10px; font-size: 14px;
  white-space: nowrap; line-height: 1.2;
}
.nav-lang-menu button[data-lang]:hover,
.nav-lang-menu button[data-lang].is-active { background: rgba(168,85,247,.16); }
.nav-lang-menu .flag {
  width: 22px; height: 15px; min-width: 22px; max-width: 22px; max-height: 15px;
  border-radius: 2px; flex: 0 0 22px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25); display: block;
}
.lang-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.lang-switch button {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 8px 11px; font-size: 12px; font-weight: 700; letter-spacing: .08em; min-height: 36px;
}
.lang-switch button.is-active { background: rgba(168,85,247,.28); color: var(--text); }

.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
  cursor: pointer; align-items: center; justify-content: center; flex: 0 0 auto;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--purple-5); position: relative;
}
.nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; left: 0;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }

.wrap { width: min(1120px, calc(100% - 28px)); margin: 0 auto; }

/* LANDING */
.hero { padding: 48px 0 28px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.kicker {
  color: var(--cyan); letter-spacing: 0.28em; text-transform: uppercase;
  font-size: 11px; font-weight: 600; margin-bottom: 14px;
  font-family: var(--font-hud);
}
h1 {
  font-family: var(--font-d); font-size: clamp(38px, 6vw, 72px); line-height: 0.95;
  letter-spacing: -0.03em; margin-bottom: 18px;
}
h1 em { font-family: var(--font-s); font-style: italic; color: var(--purple-4); font-weight: 400; }
.lede { color: var(--muted); font-size: 18px; max-width: 52ch; margin-bottom: 28px; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.btn {
  border: 0; cursor: pointer; border-radius: 999px; padding: 13px 22px;
  font-weight: 600; font-size: 14px; letter-spacing: 0.04em;
  min-height: 44px; position: relative;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  color: #16061f;
  background: linear-gradient(180deg, #f3e8ff, #c084fc 42%, #a855f7);
  box-shadow: 0 10px 32px rgba(168,85,247,.42), 0 0 0 1px rgba(255,255,255,.08), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-primary:hover { box-shadow: 0 14px 40px rgba(168,85,247,.58), 0 0 24px rgba(168,85,247,.35); transform: translateY(-1px); }
.btn-ghost {
  color: var(--text); background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 18px rgba(168,85,247,.06);
}
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(168,85,247,.12); }
.btn-gold {
  color: #2a1a04; background: linear-gradient(180deg, #ffe7a8, var(--gold));
}

.hero-card {
  background: linear-gradient(180deg, rgba(28,12,52,.55), rgba(10,5,22,.55));
  border: 1px solid var(--line); border-radius: 28px;
  padding: 22px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(18px);
  position: relative; overflow: hidden; min-height: 280px;
}
.hero-card::after {
  content: ""; position: absolute; inset: 10px; border-radius: 20px; pointer-events: none;
  border: 1px solid rgba(255,255,255,.04);
}
.hero-card::before {
  content: ""; position: absolute; inset: auto -20% 40% 30%; height: 180px;
  background: radial-gradient(circle, rgba(168,85,247,.35), transparent 70%);
  filter: blur(10px);
}

.preview-stage { position: relative; height: 320px; display: grid; place-items: center; }
.ring {
  width: 220px; height: 220px; border-radius: 50%;
  border: 1px dashed rgba(192,132,252,.45);
  display: grid; place-items: center; position: relative;
  animation: spin 28s linear infinite;
}
.ring-inner {
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f3e8ff, #a855f7 40%, #3b0764);
  box-shadow: 0 0 60px rgba(168,85,247,.55);
  animation: pulse 3.4s ease-in-out infinite;
}
.node {
  position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--purple-4); box-shadow: 0 0 12px var(--purple-3);
}
.node.n1 { top: 8px; left: 50%; transform: translateX(-50%); }
.node.n2 { right: 14px; top: 50%; transform: translateY(-50%); }
.node.n3 { bottom: 8px; left: 50%; transform: translateX(-50%); background: var(--gold); }
.node.n4 { left: 14px; top: 50%; transform: translateY(-50%); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.06); filter: saturate(1.2); } }

.section { padding: 28px 0 64px; }
.section h2 {
  font-family: var(--font-d); font-size: 28px; margin-bottom: 8px;
}
.section p.sub { color: var(--muted); margin-bottom: 22px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: linear-gradient(180deg, rgba(24,12,42,.55), rgba(10,5,22,.5));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; min-height: 160px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  position: relative;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 10px; height: 10px; border: 1px solid var(--purple-4); opacity: .55;
}
.card::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.card::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.card h3 { font-family: var(--font-d); font-size: 18px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 14px; }
.tag {
  display: inline-block; font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 10px; font-family: var(--font-hud);
}

.story-block {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start;
}
.story-text p { color: var(--muted); margin-bottom: 14px; }
.quote {
  font-family: var(--font-s); font-size: 26px; line-height: 1.25; color: var(--lilac);
  border-left: 3px solid var(--purple-3); padding-left: 16px;
}

.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0 110px; color: var(--muted); font-size: 13px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  box-shadow: 0 -1px 0 rgba(103,232,249,.06);
}

/* SCREENS / GAME SHELL */
.screen { display: none; animation: fade .35s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.game-shell { padding: 8px 0 96px; }
.hud {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.hud-side { display: flex; gap: 10px; flex-wrap: wrap; }
.hud-side.right { justify-content: flex-end; }
.stat {
  background: rgba(12,6,24,.7); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 12px; min-width: 86px;
  box-shadow: inset 0 0 16px rgba(168,85,247,.08);
}
.stat b { display: block; font-size: 16px; font-family: var(--font-hud); }
.stat span { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.level-title { text-align: center; }
.level-title h2 { font-size: 22px; }
.level-title p { color: var(--muted); font-size: 13px; }

.board-wrap {
  display: grid; place-items: center;
  min-height: min(420px, calc(100svh - 280px));
  background:
    linear-gradient(180deg, rgba(168,85,247,.08), rgba(255,255,255,.015)),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(168,85,247,.05) 31px 32px);
  border: 1px solid var(--line); border-radius: 24px;
  padding: 56px 12px 18px;
  position: relative; overflow: hidden;
  width: 100%;
  box-shadow: inset 0 0 80px rgba(88,28,135,.18);
}
.hint-bar {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  color: var(--muted); font-size: 12px; z-index: 3; line-height: 1.35;
}
.pulse-meter {
  width: min(160px, 36%); height: 8px; background: rgba(255,255,255,.06);
  border-radius: 99px; overflow: hidden; border: 1px solid var(--line); flex: 0 0 auto;
}
.pulse-meter > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--purple-2), var(--cyan));
}

.grid-board {
  display: grid; gap: var(--gap, 8px); z-index: 2;
}
.cell {
  width: var(--cell, 64px); height: var(--cell, 64px);
  border-radius: clamp(10px, calc(var(--cell, 64px) * 0.22), 16px);
  border: 1px solid var(--line);
  background: rgba(16, 8, 28, .85); cursor: pointer; position: relative;
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.cell:hover { transform: translateY(-2px); }
.cell:active { transform: scale(0.96); }
.cell.on {
  background: radial-gradient(circle at 35% 30%, #f3e8ff, #a855f7 48%, #5b21b6);
  box-shadow: 0 0 22px rgba(168,85,247,.55);
  border-color: transparent;
}
.cell.s1 {
  background: radial-gradient(circle at 35% 30%, #ddd6fe, #7c3aed 55%, #4c1d95);
}
.cell.s2 {
  background: radial-gradient(circle at 35% 30%, #f5d0fe, #c026d3 55%, #701a75);
}
.cell.locked { cursor: not-allowed; opacity: .45; }
.cell.goal-ok { outline: 2px solid var(--gold); }
.cell .idx {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-d); font-weight: 700; font-size: 18px; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.45);
}

.seq-board { display: flex; gap: var(--gap, 10px); flex-wrap: wrap; justify-content: center; max-width: min(520px, 100%); }
.orb-btn {
  width: var(--orb, 84px); height: var(--orb, 84px); border-radius: 50%; border: 2px solid var(--line);
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.08), rgba(16,8,28,.9));
  cursor: pointer; position: relative;
  box-shadow: inset 0 0 20px rgba(168,85,247,.15);
  transition: transform .12s ease, box-shadow .12s ease;
}
.orb-btn:hover { transform: scale(1.05); }
.orb-btn.lit {
  box-shadow: 0 0 28px currentColor, inset 0 0 18px rgba(255,255,255,.25);
  transform: scale(1.08);
  border-color: currentColor;
}
.orb-btn.good { animation: pop .28s ease; }
@keyframes pop { 50% { transform: scale(1.16); } }

.path-board { display: grid; gap: var(--gap, 6px); }
.path-cell {
  width: var(--cell, 54px); height: var(--cell, 54px);
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(16,8,28,.8); cursor: pointer; display: grid; place-items: center;
  font-family: var(--font-d); font-weight: 700; color: var(--purple-5);
}
.path-cell.start { box-shadow: 0 0 0 2px var(--cyan); }
.path-cell.end { box-shadow: 0 0 0 2px var(--gold); }
.path-cell.used {
  background: radial-gradient(circle at 30% 30%, #c084fc, #6b21a8);
}
.path-cell.dead { opacity: .3; pointer-events: none; }
.path-cell.warn { animation: blink .6s linear infinite; }
@keyframes blink { 50% { filter: brightness(1.4); } }

.controls { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

.modal-layer {
  position: fixed; inset: 0; z-index: 40; background: rgba(5,2,10,.62);
  display: none; place-items: center; padding: 20px; backdrop-filter: blur(8px);
}
.modal-layer.open { display: grid; }
.modal {
  width: min(520px, 100%); background: var(--panel-strong); border: 1px solid var(--line);
  border-radius: 24px; padding: 24px; box-shadow: var(--shadow);
}
.modal h3 { font-family: var(--font-d); font-size: 24px; margin-bottom: 8px; }
.modal p { color: var(--muted); margin-bottom: 16px; }
.modal .row { display: flex; gap: 10px; flex-wrap: wrap; }

.levels {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.lvl {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px; color: var(--text); cursor: pointer;
}
.lvl:hover { border-color: var(--line-strong); }
.lvl .n { font-family: var(--font-d); font-size: 13px; color: var(--purple-4); }
.lvl.locked { opacity: .4; cursor: not-allowed; }
.lvl.done { border-color: rgba(245,197,107,.45); }

/* COOKIES */
.cookie-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80;
  bottom: max(12px, env(safe-area-inset-bottom));
  background: var(--panel-strong); border: 1px solid var(--line-strong);
  border-radius: 22px; padding: 16px 16px 14px; box-shadow: var(--shadow);
  display: none; backdrop-filter: blur(18px);
  max-height: min(70vh, 480px); overflow: auto;
}
.cookie-banner.show { display: block; }
.cookie-banner h3 { font-family: var(--font-d); margin-bottom: 6px; }
.cookie-banner p { color: var(--muted); font-size: 14px; margin-bottom: 14px; max-width: 90ch; }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.cookie-modal .toggles { display: grid; gap: 10px; margin: 12px 0 18px; }
.toggle-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.toggle-row b { display: block; font-size: 14px; }
.toggle-row span { color: var(--muted); font-size: 12px; }

.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: #3b2a52; border-radius: 99px; cursor: pointer;
  transition: .2s;
}
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #d8b4fe; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--purple-2); }
.switch input:checked + .slider::before { transform: translateX(20px); background: white; }
.switch input:disabled + .slider { opacity: .7; cursor: not-allowed; }

.legal { padding: 28px 0 80px; }
.legal h1 { font-size: clamp(28px, 8vw, 40px); }
.legal h2 { margin: 24px 0 8px; font-size: 20px; }
.legal p, .legal li { color: var(--muted); margin-bottom: 10px; }
.legal ul { padding-left: 18px; }

.toast {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px;
  margin: 0 auto; width: max-content; max-width: calc(100% - 24px); z-index: 90;
  background: var(--ink); border: 1px solid var(--line); color: var(--text);
  padding: 10px 14px; border-radius: 12px; display: none;
}
.toast.show { display: block; animation: fade .25s ease; }

.score-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.score-table th, .score-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.score-table th { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

@media (max-width: 960px) {
  .hero, .story-block, .grid-3 { grid-template-columns: 1fr; }
  .hero { padding: 28px 0 12px; gap: 22px; }
  .hero-card { min-height: 220px; }
  .preview-stage { height: 220px; }
  .ring { width: 168px; height: 168px; }
  .ring-inner { width: 108px; height: 108px; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; top: calc(100% - 2px); left: 12px; right: 12px;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 10px; border: 1px solid var(--line); border-radius: 16px;
    background: var(--panel-strong); box-shadow: var(--shadow);
  }
  .site-header { position: sticky; }
  .site-header.is-open .nav { display: flex; }
  .nav a, .nav button.linkish { width: 100%; text-align: left; border-radius: 12px; }
  .nav-lang { width: 100%; }
  .nav-lang-btn { width: 100%; }
  .nav-lang-menu {
    position: static; min-width: 0; box-shadow: none;
    background: rgba(255,255,255,.03); margin-top: 4px;
  }
  .hud { grid-template-columns: 1fr; }
  .hud-side, .hud-side.right { justify-content: center; }
  .level-title h2 { font-size: 18px; }
  .level-title p { font-size: 12px; }
  .quote { font-size: 22px; }
  .section { padding: 18px 0 40px; }
  .section h2 { font-size: 24px; }
  h1 { font-size: clamp(32px, 11vw, 52px); }
  .lede { font-size: 16px; }
  .site-footer { padding: 22px 0 140px; }
  .cookie-actions .btn { flex: 1 1 140px; }
  .modal { padding: 18px; border-radius: 18px; }
  .modal-layer { padding: 12px; align-items: end; }
  .levels { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
  .wrap { width: min(1120px, calc(100% - 18px)); }
  .brand-name span { display: none; }
  .stat { min-width: 72px; padding: 7px 10px; }
  .board-wrap { padding: 52px 8px 14px; border-radius: 18px; min-height: min(360px, calc(100svh - 260px)); }
  .hint-bar { flex-direction: column; }
  .pulse-meter { width: 100%; }
  .orb { filter: blur(48px); opacity: .35; }
  .btn { width: auto; }
  .cta-row .btn { flex: 1 1 auto; text-align: center; }
}

@media (hover: none) {
  .cell:hover, .orb-btn:hover, .btn-primary:hover { transform: none; }
}

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


@keyframes gridshift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 48px 48px, 48px 48px; }
}
@keyframes scanmove {
  from { background-position: 0 0, 0 -40%; }
  to { background-position: 0 0, 0 140%; }
}

h1 {
  text-shadow: 0 0 28px rgba(168,85,247,.28);
}
h1 em {
  text-shadow: 0 0 24px rgba(192,132,252,.45);
}

.hud-chip {
  position: absolute; top: 14px; left: 16px; z-index: 3;
  font-family: var(--font-hud); font-size: 10px; letter-spacing: .22em;
  color: var(--cyan);
  border: 1px solid rgba(103,232,249,.35);
  background: rgba(6, 18, 28, .55);
  padding: 5px 9px; border-radius: 999px;
  box-shadow: 0 0 16px rgba(103,232,249,.18);
}
.hud-chip::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: #4ade80; margin-right: 8px; box-shadow: 0 0 8px #4ade80;
  vertical-align: middle;
}

.ring-mid {
  width: 176px; height: 176px; border-style: solid; border-width: 1px;
  border-color: rgba(103,232,249,.28) transparent rgba(168,85,247,.45) transparent;
  animation: spin 10s linear infinite reverse;
  position: absolute;
}
.ring-slow { animation-duration: 36s; }

.btn-primary {
  overflow: hidden;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 3.6s ease-in-out infinite;
}
@keyframes sheen {
  0%, 55% { transform: translateX(-120%); }
  80%, 100% { transform: translateX(120%); }
}

.lvl {
  background:
    linear-gradient(180deg, rgba(28,12,52,.62), rgba(10,5,22,.7));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.lvl:hover {
  box-shadow: 0 0 24px rgba(168,85,247,.22), inset 0 1px 0 rgba(255,255,255,.08);
}

.modal {
  box-shadow: var(--shadow), 0 0 0 1px rgba(103,232,249,.08), 0 0 60px rgba(168,85,247,.2);
}

.cookie-banner {
  box-shadow: var(--shadow), 0 0 40px rgba(168,85,247,.18);
}

@media (prefers-reduced-motion: reduce) {
  .orb, .ring, .ring-mid, .ring-inner, .scan, .grid-overlay, .brand-mark::after, .btn-primary::after {
    animation: none !important;
  }
}
