@font-face {
  font-family: "PSP";
  src: url("/fonts/psp-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F, U+2191, U+2193, U+2212;
  font-display: swap;
}
@font-face {
  font-family: "PSP";
  src: url("/fonts/psp-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
  font-display: swap;
}

:root {
  --bg: #0a0a0b;
  --bg-el: #131316;
  --bg-surface: #1a1a1f;
  --bg-hover: #232329;
  --border: #26262d;
  --border-strong: #3a3a44;
  --fg: #ededee;
  --fg-muted: #9b9ba3;
  --fg-subtle: #787880;
  --accent: #ff6b1a;
  --accent-soft: rgba(255, 107, 26, 0.12);
  --accent-border: rgba(255, 107, 26, 0.4);
  --good: #4ade80;
  --warn: #facc15;
  --bad: #f87171;
  --info: #60a5fa;
  --sans: ui-sans-serif, -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Menlo", monospace;
  --px: "PSP", var(--mono);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1100px 500px at 75% -10%, rgba(255, 107, 26, 0.07), transparent 60%),
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

.scanlines {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(127,127,127,0.02) 0px, rgba(127,127,127,0.02) 1px,
    transparent 1px, transparent 3px);
}

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 45; background: rgba(255,255,255,.05); }
#progress-bar { height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 12px rgba(255,107,26,.7); transition: width .3s ease; }

#deck { position: relative; height: 100dvh; }

.slide {
  position: absolute; inset: 0;
  display: flex;
  opacity: 0;
  transform: translateX(46px);
  transition: opacity .38s ease, transform .38s ease;
  pointer-events: none;
  visibility: hidden;
}
.slide.active { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.slide.past { transform: translateX(-46px); }

.wrap {
  width: min(94vw, 1320px);
  margin: auto;
  padding: 5vh 24px 9vh;
}
.wrap.center { display: flex; flex-direction: column; align-items: center; text-align: center; }

.rise {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .55s cubic-bezier(.2,.7,.2,1), transform .55s cubic-bezier(.2,.7,.2,1);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.rise.in { opacity: 1; transform: none; }
.rise.settled { transition: none; opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .rise { transition: none; }
}

.caret { animation: caretBlink 1.4s steps(1, end) infinite; }
.caret-txt { color: var(--accent); animation: caretBlink 1.4s steps(1, end) infinite; }
@keyframes caretBlink { 0%, 45% { opacity: 1; } 55%, 100% { opacity: .12; } }

h1 {
  font-size: clamp(46px, 7.2vw, 108px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.04;
  margin-top: 4vh;
}
h2 {
  font-size: clamp(30px, 4.2vw, 58px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 5vh;
}
h2::before { content: "▸ "; color: var(--accent); font-weight: 700; }

.mono { font-family: var(--mono); }
.pr { color: var(--accent); font-weight: 600; }
.dim { color: var(--fg-subtle); }
.dim-t { color: var(--fg-subtle); font-size: 13px; }

.sub { margin-top: 3vh; font-size: clamp(15px, 1.6vw, 22px); color: var(--fg-muted); }
.sub b { color: var(--accent); font-weight: 600; }
.tagline { margin-top: 6.5vh; font-size: clamp(18px, 2.1vw, 30px); color: var(--fg); line-height: 1.45; }

.scene3d {
  position: absolute; inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 32%;
  pointer-events: none;
  z-index: 0;
}
.slide .wrap { position: relative; z-index: 1; }

.hexa3d {
  position: relative;
  width: 220px;
  height: clamp(190px, 26vh, 240px);
  perspective: 900px;
  animation: hexFloat 7s ease-in-out infinite alternate;
}
@keyframes hexFloat {
  from { transform: translateY(-7px); }
  to { transform: translateY(9px); }
}
.prism-tilt {
  position: absolute; inset: 0;
  transform: rotateX(-14deg);
  transform-style: preserve-3d;
}
.prism {
  --pw: clamp(88px, 12vh, 110px);
  --ph: clamp(150px, 21vh, 196px);
  position: absolute; left: 50%; top: 50%;
  width: var(--pw); height: var(--ph);
  margin: calc(var(--ph) / -2) 0 0 calc(var(--pw) / -2);
  transform-style: preserve-3d;
  animation: prismSpin 15s linear infinite;
}
@keyframes prismSpin { to { transform: rotateY(360deg); } }
.prism b {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(35,35,41,.42), rgba(14,14,16,.5));
  border: 1.5px solid rgba(255,107,26,.5);
  box-shadow: 0 0 28px -8px rgba(255,107,26,.4), inset 0 1px 0 rgba(255,255,255,.07);
}
.prism b:nth-child(1) { transform: rotateY(0deg) translateZ(calc(var(--pw) * 0.866)); }
.prism b:nth-child(2) { transform: rotateY(60deg) translateZ(calc(var(--pw) * 0.866)); }
.prism b:nth-child(3) { transform: rotateY(120deg) translateZ(calc(var(--pw) * 0.866)); }
.prism b:nth-child(4) { transform: rotateY(180deg) translateZ(calc(var(--pw) * 0.866)); }
.prism b:nth-child(5) { transform: rotateY(240deg) translateZ(calc(var(--pw) * 0.866)); }
.prism b:nth-child(6) { transform: rotateY(300deg) translateZ(calc(var(--pw) * 0.866)); }
.hexcore {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 26px rgba(255,107,26,.5));
}

.cube {
  position: absolute;
  width: var(--cs); height: var(--cs);
  transform-style: preserve-3d;
}
.cube.big { right: 5vw; top: 16%; animation: tumble 17s linear infinite; }
.cube.small { left: 7vw; top: 62%; animation: tumbleBack 23s linear infinite; opacity: .75; }
@keyframes tumble { to { transform: rotateX(360deg) rotateY(720deg); } }
@keyframes tumbleBack { to { transform: rotateX(-360deg) rotateY(-720deg); } }
.cube b {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--px);
  font-size: calc(var(--cs) * 0.34);
  color: var(--accent);
  text-shadow: 0 0 22px rgba(255,107,26,.6);
  background: rgba(19, 19, 22, .72);
  border: 2px solid rgba(255,107,26,.45);
  box-shadow: inset 0 0 44px rgba(255,107,26,.08);
}
.cube b:nth-child(1) { transform: rotateY(0deg) translateZ(calc(var(--cs) / 2)); }
.cube b:nth-child(2) { transform: rotateY(90deg) translateZ(calc(var(--cs) / 2)); }
.cube b:nth-child(3) { transform: rotateY(180deg) translateZ(calc(var(--cs) / 2)); }
.cube b:nth-child(4) { transform: rotateY(270deg) translateZ(calc(var(--cs) / 2)); }
.cube b:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--cs) / 2)); }
.cube b:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--cs) / 2)); }

@media (prefers-reduced-motion: reduce) {
  .prism, .hexa3d, .tile, .cube { animation: none; }
}
@media (max-width: 900px) {
  .scene3d, .prism-tilt { display: none; }
  .tile { transform: none; animation: none; }
}

.cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(20px, 3vw, 48px); align-items: start; }

.term {
  position: relative;
  background: var(--bg-el);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 24px 60px -20px rgba(0,0,0,.8);
}
.term::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(127,127,127,0.04) 0px, rgba(127,127,127,0.04) 1px,
    transparent 1px, transparent 3px);
}
.term-head {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.term-head i { width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); }
.term-head i:nth-child(1) { background: #f87171; }
.term-head i:nth-child(2) { background: #facc15; }
.term-head i:nth-child(3) { background: #4ade80; }
.term-head span { margin-left: 8px; font-family: var(--mono); font-size: 12px; color: var(--fg-subtle); }
.term-body { padding: clamp(16px, 2vw, 28px); font-family: var(--mono); font-size: clamp(13px, 1.35vw, 18px); line-height: 2.1; }
.tl.err { color: var(--bad); }

.biglist { list-style: none; padding-right: clamp(0px, 11vw, 150px); }
.biglist li {
  font-size: clamp(16px, 1.8vw, 24px);
  padding: clamp(10px, 1.6vh, 18px) 0 clamp(10px, 1.6vh, 18px) 38px;
  position: relative;
  color: var(--fg);
  line-height: 1.45;
}
.biglist li::before {
  content: "✕";
  position: absolute; left: 4px;
  color: var(--bad);
  font-weight: 700;
}

.def { font-size: clamp(18px, 2.1vw, 30px); line-height: 1.55; color: var(--fg-muted); margin-bottom: 4vh; }
.def b { color: var(--fg); }

.fakewin {
  background: var(--bg-el);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px -24px rgba(0,0,0,.85), 0 0 0 1px rgba(255,107,26,.08);
}
.fw-head {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 12px;
}
.fw-head i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.fw-brand { color: var(--accent); margin-left: 10px; }
.fw-url { color: var(--fg-subtle); margin-left: auto; }
.fw-body { display: grid; grid-template-columns: 200px 1fr; min-height: clamp(220px, 34vh, 340px); }
.fw-nav { border-right: 1px solid var(--border); padding: 12px 0; font-size: clamp(12px, 1.15vw, 15px); }
.fw-nav div { padding: 8px 18px; color: var(--fg-muted); }
.fw-nav div.on { color: var(--fg); background: var(--accent-soft); border-left: 2px solid var(--accent); }
.fw-main { padding: clamp(14px, 1.8vw, 24px); display: flex; flex-direction: column; gap: 12px; }
.fw-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: clamp(12px, 1.5vw, 18px);
  font-size: clamp(13px, 1.25vw, 16px);
}
.fw-dim { color: var(--fg-subtle); font-family: var(--mono); font-size: .85em; margin-left: auto; }
.chip {
  font-family: var(--mono); font-size: .78em;
  padding: 3px 9px; border-radius: 4px;
  border: 1px solid var(--border-strong);
}
.chip.ok { color: var(--good); border-color: rgba(74,222,128,.3); background: rgba(74,222,128,.12); }
.chip.warn { color: var(--warn); border-color: rgba(250,204,21,.3); background: rgba(250,204,21,.12); }
.chip.info { color: var(--info); border-color: rgba(96,165,250,.3); background: rgba(96,165,250,.12); }

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 1.8vw, 26px);
  perspective: 1600px;
  counter-reset: feat;
}
.tile {
  position: relative;
  background: linear-gradient(150deg, #1d1d23 0%, #131316 55%, #0e0e10 100%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: clamp(16px, 2.4vh, 26px) clamp(14px, 1.6vw, 24px);
  display: flex; flex-direction: column; gap: 8px;
  transform-style: preserve-3d;
  box-shadow:
    0 0 0 1px rgba(255,107,26,.12),
    0 0 34px -12px rgba(255,107,26,.38),
    0 24px 44px -20px rgba(0,0,0,.85),
    inset 0 1px 0 rgba(255,255,255,.08);
  animation: tileFloat 7s ease-in-out infinite alternate;
  animation-delay: calc(var(--d, 0) * -0.9s);
}
.tile:nth-child(3n+1) { transform: rotateY(9deg) rotateX(3deg); }
.tile:nth-child(3n+2) { transform: rotateX(4deg); }
.tile:nth-child(3n) { transform: rotateY(-9deg) rotateX(3deg); }
@keyframes tileFloat {
  from { translate: 0 0 0; }
  to { translate: 0 -4px 30px; }
}
.tile::before {
  counter-increment: feat;
  content: counter(feat, decimal-leading-zero);
  font-family: var(--mono);
  font-size: clamp(10px, 1vw, 13px);
  color: var(--accent);
  opacity: .8;
  letter-spacing: .12em;
}
.tile b { font-size: clamp(16px, 1.65vw, 23px); letter-spacing: -0.01em; }
.tile span { font-size: clamp(12px, 1.15vw, 15px); color: var(--fg-muted); line-height: 1.5; }

.arch { display: flex; flex-direction: column; align-items: center; gap: clamp(6px, 1vh, 12px); }
.arch-row { display: flex; gap: clamp(8px, 1vw, 14px); justify-content: center; flex-wrap: wrap; width: 100%; }
.archbox {
  background: var(--bg-el);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: clamp(10px, 1.5vh, 18px) clamp(16px, 2vw, 30px);
  text-align: center;
}
.archbox b { display: block; font-size: clamp(15px, 1.6vw, 22px); }
.archbox span { display: block; margin-top: 4px; font-family: var(--mono); font-size: clamp(11px, 1.05vw, 14px); color: var(--fg-muted); }
.archbox.wide { min-width: min(680px, 80%); }
.archbox.accent { border-color: var(--accent-border); box-shadow: 0 0 28px -8px rgba(255,107,26,.45); }
.archbox.accent b { color: var(--accent); }
.archbox.dim { border-style: dashed; }
.archbox.sm { font-family: var(--mono); font-size: clamp(11px, 1.1vw, 15px); padding: clamp(8px, 1.2vh, 13px) clamp(10px, 1.3vw, 18px); color: var(--fg-muted); }
.arch-arrow { color: var(--accent); font-size: clamp(11px, 1.2vw, 15px); line-height: 1; }

.road { list-style: none; max-width: 900px; }
.road li {
  padding: clamp(12px, 2.2vh, 22px) 0 clamp(12px, 2.2vh, 22px) 46px;
  position: relative;
  border-bottom: 1px dashed var(--border);
}
.road li::before {
  content: "→";
  position: absolute; left: 2px;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.2em;
}
.road b { font-size: clamp(17px, 1.9vw, 26px); letter-spacing: -0.01em; }
.road span { display: block; margin-top: 4px; font-size: clamp(13px, 1.25vw, 16px); color: var(--fg-muted); }

.px-title {
  font-family: var(--px);
  font-size: clamp(26px, 4.4vw, 56px);
  color: var(--accent);
  text-shadow: 0 0 40px rgba(255,107,26,.55);
  margin-top: 6vh;
  line-height: 1.4;
}
.qz-rules { margin-top: 5vh; font-size: clamp(16px, 1.9vw, 26px); color: var(--fg); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.qz-sep { color: var(--accent); }
.qz-cta { margin-top: 6vh; font-size: clamp(20px, 2.6vw, 38px); }
.qz-cta b { color: var(--accent); font-family: var(--px); font-size: .9em; }
.qz-live { margin-top: 7vh; display: flex; gap: clamp(18px, 3vw, 44px); font-size: clamp(13px, 1.4vw, 18px); color: var(--fg-muted); }
.qz-live b { color: var(--fg); font-size: 1.25em; }

.podium { margin-top: 2vh; display: grid; grid-template-columns: repeat(2, minmax(280px, 460px)); gap: clamp(16px, 2.4vw, 34px); justify-content: center; width: 100%; }
.waiting { grid-column: 1 / -1; font-size: clamp(16px, 1.8vw, 24px); color: var(--fg-muted); padding: 8vh 0; }
.win {
  background: var(--bg-el);
  border: 2px solid var(--accent-border);
  border-radius: 14px;
  padding: clamp(22px, 4vh, 40px) clamp(18px, 2vw, 30px);
  box-shadow: 0 0 60px -18px rgba(255,107,26,.55);
  animation: winPop .6s cubic-bezier(.2,.8,.25,1.15) both;
}
.win.brain { border-color: rgba(74,222,128,.4); box-shadow: 0 0 60px -18px rgba(74,222,128,.5); animation-delay: .25s; }
@keyframes winPop {
  from { opacity: 0; transform: scale(.7) translateY(30px); }
  to { opacity: 1; transform: none; }
}
.win .w-title { font-family: var(--px); font-size: clamp(13px, 1.4vw, 19px); color: var(--accent); }
.win.brain .w-title { color: var(--good); }
.win .w-emoji { font-size: clamp(52px, 7vw, 96px); margin-top: 2.4vh; line-height: 1.15; }
.win .w-name { font-size: clamp(24px, 3vw, 44px); font-weight: 800; letter-spacing: -0.02em; margin-top: 1.4vh; word-break: break-word; }
.win .w-score { font-family: var(--mono); margin-top: 1.6vh; font-size: clamp(14px, 1.5vw, 20px); color: var(--fg-muted); }
.win .w-score b { color: var(--fg); }
.totals { margin-top: 5vh; font-size: clamp(12px, 1.3vw, 16px); color: var(--fg-subtle); }

.qr-widget {
  position: fixed;
  right: clamp(14px, 2vw, 34px);
  bottom: clamp(48px, 8vh, 70px);
  z-index: 44;
  text-align: center;
  animation: qrIn .5s ease both;
}
@keyframes qrIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; } }
.qr-card {
  background: #f2ede3;
  padding: 9px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--accent-border), 0 0 34px -8px rgba(255,107,26,.5);
  display: inline-block;
}
#qr-el svg { display: block; width: clamp(96px, 11vw, 136px); height: clamp(96px, 11vw, 136px); }
.qr-cap { margin-top: 9px; font-family: var(--px); font-size: 8px; line-height: 1.7; color: var(--accent); }
.qr-live { margin-top: 6px; font-size: 11px; color: var(--fg-muted); }
.qr-live b { color: var(--fg); }

.hud-bottom {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(16px, 2vw, 34px);
  z-index: 45;
}
.admin-chip {
  font-size: 11px; color: var(--warn);
  border: 1px solid rgba(250,204,21,.3);
  background: rgba(250,204,21,.08);
  padding: 4px 10px; border-radius: 4px;
}
.hidden { display: none !important; }

#confetti { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
