:root {
  --bg: #040404;
  --head: #E8E8EC;
  --body: #B9BEC6;
  --label: #787C82;
  --accent: #5FE3D0;
  --rule: rgba(120, 124, 130, 1);
  --edge: rgba(185, 190, 198, 0.3);
  --panel: rgba(4, 4, 4, 0.84);
  --glow-accent: rgba(95, 227, 208, 0.28);
  --glow-head: rgba(232, 232, 236, 0.12);
  --control-height: 48px;
  --tap: 44px;
  --strip-height: 24px;
  --frame-inset: 18px;
  --gutter: 28px;
  --duration-fast: 150ms;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  padding: 56px 0;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cpath d='M60 0H0V60' fill='none' stroke='rgba(185,190,198,0.05)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 60px 60px;
  color: var(--body);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

/* Static scanlines: above the field, below the content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='3'%3E%3Crect width='1' height='1' fill='rgba(4,4,4,0.35)'/%3E%3C/svg%3E");
}

::selection { background: #5FE3D0; color: #040404; }

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

/* Frame and strips */
.frame { position: fixed; inset: var(--frame-inset); border: 1px solid var(--edge); pointer-events: none; z-index: 2; }
.frame i { position: absolute; width: 12px; height: 12px; border: 0 solid var(--body); }
.frame i:nth-child(1) { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.frame i:nth-child(2) { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.frame i:nth-child(3) { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.frame i:nth-child(4) { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

.strip {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  height: var(--strip-height);
  padding: 0 calc(var(--frame-inset) + 8px);
  background: var(--bg);
  color: var(--label);
  font-size: 10px;
  line-height: var(--strip-height);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}
.strip-top { top: 0; }
.strip-bottom { bottom: 0; }

/* Layout */
main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: calc(720px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}
section { margin: 0 0 20px; scroll-margin-top: 48px; }
#deck { scroll-margin-top: 220px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  padding: 20px 16px;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.panel:hover { border-color: rgba(95, 227, 208, 0.35); box-shadow: 0 0 24px -8px var(--glow-accent); }
.panel p { margin: 12px 0 0; }
.panel > :first-child { margin-top: 0; }

h1, h2, h3 {
  margin: 0;
  color: var(--head);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  overflow-wrap: anywhere;
}
h1 { font-size: clamp(26px, 7.4vw, 60px); line-height: 1.15; text-shadow: 0 0 24px var(--glow-head); }
h2 { font-size: 16px; }
h3 { font-size: 13px; }
.panel h3 + p { margin-top: 10px; }

.label {
  margin: 0;
  color: var(--label);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.panel .eyebrow { margin: 0 0 16px; }
.panel .sub { margin: 16px 0 24px; color: var(--body); font-size: 15px; }
.panel .micro { margin: 12px 0 0; color: var(--label); font-size: 11px; line-height: 1.5; }
.emph { color: var(--head); font-weight: 500; }
.count { color: var(--label); font-size: 11px; letter-spacing: 0.2em; }
.line { color: var(--head); text-align: center; margin-top: 12px; }
.caption { color: var(--body); font-size: 13px; }

a { color: var(--body); text-underline-offset: 3px; transition: color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast); }
a:hover { color: var(--head); }

/* Buttons and chips */
.btn, .watch, .chips button, .modes button, .tiers button, .answers button, .next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 16px;
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: transparent;
  color: var(--body);
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast), background-color var(--duration-fast), box-shadow var(--duration-fast);
}
.btn { min-height: var(--control-height); font-size: 13px; }
.btn:hover, .watch:hover, .chips button:hover, .modes button:hover, .tiers button:hover,
.answers button:hover:not(:disabled), .next:hover {
  color: var(--head);
  border-color: var(--head);
  box-shadow: 0 0 10px var(--glow-head);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover, .btn-primary:focus-visible { color: var(--bg); border-color: var(--accent); box-shadow: 0 0 18px var(--glow-accent); }
[aria-pressed="true"] { color: var(--head); border-color: var(--head); box-shadow: 0 0 10px var(--glow-head); }
.tiers button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); box-shadow: 0 0 14px var(--glow-accent); }
button:disabled { opacity: 0.45; cursor: default; }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible,
[tabindex]:focus-visible { outline: 1px solid var(--head); outline-offset: 3px; box-shadow: 0 0 10px var(--glow-head); }

.actions { display: flex; flex-direction: column; gap: 12px; }

/* Hero */
.hero { padding-top: 24px; }
.hero .fx-mount { margin-top: 24px; }
.hero-new { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; padding: 10px 14px; border: 1px solid var(--accent); color: var(--accent); font-size: 12px; letter-spacing: 0.12em; text-decoration: none; transition: box-shadow 150ms ease, background-color 150ms ease; }
.hero-new:hover, .hero-new:focus-visible { background: rgba(95, 227, 208, 0.08); box-shadow: 0 0 18px var(--glow-accent); }
.hero-new__tag { background: var(--accent); color: var(--bg); padding: 2px 6px; font-weight: 800; }

/* fx layer (fx.js, copied from deck.css). Selectors never match with JS off. */
.fx-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 300ms; }
.fx-bg-on .fx-bg { opacity: 1; }
.fx-bg-on body { background-color: transparent; }

.fx-cursor-dot, .fx-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9;
  pointer-events: none;
  border-radius: 2px;
  will-change: transform;
}
.fx-cursor-dot { width: 6px; height: 6px; background: var(--head); }
.fx-cursor-ring { width: 32px; height: 32px; border: 1px solid var(--label); transition: border-color var(--duration-fast); }
.fx-cursor-ring.is-link { border-color: var(--accent); }
.fx-cursor-dot.is-hidden, .fx-cursor-ring.is-hidden { opacity: 0; }
.fx-cursor-on, .fx-cursor-on a, .fx-cursor-on button { cursor: none; }
.fx-cursor-on input { cursor: text; }

/* fx figures (fx-home.js): collapsed without JS, space reserved when scripting is on */
.fx-mount { display: none; pointer-events: none; }
@media (scripting: enabled) { .fx-mount { display: block; } }
html.fx-hypercube-on .fx-mount--hypercube,
html.fx-merkaba-on .fx-mount--merkaba,
html.fx-scope-on .fx-mount--scope { display: block; }
.fx-fig { display: block; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 200ms; }
html.fx-hypercube-on .fx-mount--hypercube .fx-fig,
html.fx-merkaba-on .fx-mount--merkaba .fx-fig,
html.fx-scope-on .fx-mount--scope .fx-fig { opacity: 1; }
.fx-mount--hypercube { height: 200px; }
.fx-mount--merkaba { height: 220px; order: -1; }
.fx-mount--scope { height: 100px; margin-bottom: 12px; border: 1px solid var(--edge); background: var(--panel); }

/* Method and strands */
.method-grid, .strand-grid { display: grid; gap: 12px; }

/* Archive */
.head { margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips button { flex: 1 1 auto; min-width: 56px; }
#archive-count { margin-top: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.ep { display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.ep img, .sr-item img { display: block; width: 100%; height: auto; border: 1px solid var(--edge); }
.ep h3 { font-size: 11px; letter-spacing: 0.06em; line-height: 1.4; }
.ep p, .sr-item p { margin: 0; }
.ep .tag { color: var(--label); font-size: 10px; letter-spacing: 0.3em; }
.ep .watch, .sr-item .watch { margin-top: auto; }
.panel .status { margin: 0; color: var(--label); font-size: 11px; font-weight: 800; letter-spacing: 0.2em; }
.textcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  aspect-ratio: 400 / 711;
  padding: 12px;
  border: 1px solid var(--edge);
  text-align: center;
  color: var(--head);
}
.textcard-num { font-size: 28px; font-weight: 800; letter-spacing: 0.1em; }
.textcard-title { font-size: 12px; letter-spacing: 0.1em; }

/* Lab */
.toys { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.toy-canvas { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto; background: var(--bg); border: 1px solid var(--edge); }
.ctl { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.modes { flex-direction: row; flex-wrap: wrap; }
.modes button { flex: 1 1 56px; padding: 0 8px; }
#toy-chladni .modes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
#toy-chladni .modes button { min-width: 0; padding: 0 2px; letter-spacing: 0.05em; }
#filters-readout { color: var(--head); font-size: 14px; font-weight: 800; letter-spacing: 0.1em; }
input[type="range"] { width: 100%; height: var(--tap); margin: 0; background: transparent; accent-color: var(--head); cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--edge); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -8px; border: 0; border-radius: 2px; background: var(--head); box-shadow: 0 0 10px var(--glow-head); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--edge); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 2px; background: var(--head); box-shadow: 0 0 10px var(--glow-head); }
.ladder-list, .tiers { margin: 12px 0 0; padding: 0; list-style: none; }
.ladder-list li { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--edge); }
.tiers li + li { margin-top: 8px; }
.tiers button { display: flex; justify-content: space-between; width: 100%; }
.toy .watch { margin-top: 12px; }
.toy .label { margin-top: 12px; }

/* Quiz */
.quiz-fallback { margin: 16px 0 0; padding-left: 24px; }
.quiz-fallback summary { cursor: pointer; color: var(--head); }
.quiz-fallback details { padding: 8px 0; }
.quiz-live { margin-top: 16px; }
.statement { color: var(--head); font-size: 15px; line-height: 1.6; }
.answers { display: flex; gap: 12px; margin-top: 16px; }
.answers button { flex: 1 1 0; min-height: var(--control-height); }
.reveal { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--edge); }
.verdict { color: var(--head); font-weight: 800; letter-spacing: 0.2em; }
.next { margin-top: 16px; width: 100%; min-height: var(--control-height); }

/* Fact */
.fact { color: var(--head); font-size: 16px; line-height: 1.6; }

/* Series */
.block { margin-bottom: 12px; }
.scroller, .previews {
  display: flex;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0 0 12px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.sr-item { flex: 0 0 160px; display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; }
.sr-title { margin: 0; color: var(--head); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; line-height: 1.4; text-transform: uppercase; }
.previews li { flex: 0 0 160px; scroll-snap-align: start; }
.previews figure { margin: 0; }
.previews img { display: block; width: 160px; height: auto; border: 1px solid var(--edge); }
.previews figcaption { margin-top: 8px; color: var(--label); font-size: 10px; letter-spacing: 0.3em; }

/* Form */
form { display: flex; flex-direction: column; gap: 12px; }
input[type="email"], button[type="submit"] {
  width: 100%;
  height: var(--control-height);
  margin: 0;
  padding: 0 14px;
  border-radius: 2px;
  font-family: inherit;
  font-size: 14px;
  transition: color var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
}
input[type="email"] { border: 1px solid rgba(185, 190, 198, 0.3); background: transparent; color: var(--head); }
input[type="email"]::placeholder { color: var(--label); opacity: 1; }
input[type="email"]:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 12px rgba(95, 227, 208, 0.30); }
button[type="submit"] {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.2em;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(95, 227, 208, 0.18);
}
button[type="submit"]:hover { color: var(--head); border-color: var(--head); box-shadow: 0 0 14px rgba(95, 227, 208, 0.35); }
button[type="submit"]:focus-visible { box-shadow: 0 0 14px rgba(95, 227, 208, 0.35); }

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100% - 2 * var(--gutter)));
  margin: 0 auto;
  padding: 20px 16px;
  color: var(--label);
  font-size: 11px;
  line-height: 1.7;
}
.site-footer p { margin: 12px 0 0; }
.social { margin: 0; padding: 0; list-style: none; }
.social a { display: inline-block; padding: 6px 0; letter-spacing: 0.1em; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #040404; }
::-webkit-scrollbar-thumb { background: rgba(120, 124, 130, 0.6); }
::-webkit-scrollbar-thumb:hover { background: #5FE3D0; }

@media (min-width: 768px) {
  .actions { flex-direction: row; }
  .method-grid { grid-template-columns: 1fr 220px 1fr; align-items: stretch; }
  .fx-mount--merkaba { order: 0; align-self: center; }
  .strand-grid { grid-template-columns: repeat(3, 1fr); }
  form { flex-direction: row; }
  input[type="email"] { flex: 1 1 auto; width: auto; }
  button[type="submit"] { flex: 0 0 auto; width: auto; padding: 0 24px; }
}

/* Shop items */
.shop-item { margin: 20px 0 0; padding: 20px 0 0; border-top: 1px solid var(--edge); }
.shop-item:first-of-type { margin-top: 16px; }
.shop-item img { display: block; width: 120px; height: auto; margin: 0 0 16px; border: 1px solid var(--edge); }
.shop-item .btn { margin-top: 16px; }
.shop-copy > :first-child { margin-top: 0; }

@media (min-width: 768px) {
  .shop-item--journal { display: grid; grid-template-columns: 120px 1fr; column-gap: 24px; align-items: start; }
  .shop-item--journal img { margin: 0; }
}

@media (min-width: 1024px) {
  main { max-width: calc(1120px + 2 * var(--gutter)); }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .toys { grid-template-columns: repeat(2, 1fr); }
  .hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; column-gap: 32px; padding: 40px 32px; }
  .hero .fx-mount { grid-column: 2; grid-row: 1 / span 5; height: 340px; margin-top: 0; }
  .hero > :not(.fx-mount) { grid-column: 1; }
  .site-footer { width: min(1120px, calc(100% - 2 * var(--gutter))); }
}

@media (min-width: 1024px) and (pointer: fine) {
  .panel { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}

@media (max-width: 359px) {
  .strip { padding: 0 22px; letter-spacing: 0.15em; }
  :root { --gutter: 24px; }
}

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