:root {
  --bg: #0b0b0f;
  --surface: #14141b;
  --surface-2: #1b1b25;
  --border: #26262f;
  --border-bright: #3a3a48;
  --text: #eaeaf0;
  --muted: #8f8f9c;
  --accent: #8b7cf6;
  --accent-bright: #a99cff;
  --accent-dim: rgba(139, 124, 246, 0.14);
  --warn: #f0c05a;
  --radius: 14px;
  --font: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

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

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------- Nav ---------- */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(11, 11, 15, 0.7);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 700; font-size: 20px; letter-spacing: -0.5px; }
.logo .fx { color: var(--accent-bright); }
.nav-links { display: flex; gap: 28px; font-size: 15px; color: var(--muted); }
.nav-links a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 92vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-content { position: relative; z-index: 2; padding: 0 24px; }
.hero h1 {
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 700; letter-spacing: -2px; line-height: 1.05;
}
.hero h1 .accent { color: var(--accent-bright); }
.hero p {
  margin: 20px auto 0; max-width: 560px;
  font-size: clamp(16px, 2vw, 19px); color: var(--muted);
}
.hero-cta {
  display: inline-block; margin-top: 36px; padding: 14px 32px;
  background: var(--accent); color: #0b0b0f; font-weight: 600;
  border-radius: 999px; font-size: 16px;
  transition: transform 0.2s ease, background 0.2s ease;
}
.hero-cta:hover { transform: translateY(-2px); background: var(--accent-bright); }
.hero-hint {
  margin-top: 16px; font-size: 13px; color: var(--muted); opacity: 0.7;
}

/* ---------- Sections ---------- */
section { padding: 90px 0; }
.section-label {
  font-size: 13px; text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent-bright); margin-bottom: 12px;
}
h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -1px; margin-bottom: 14px; }
.section-sub { color: var(--muted); max-width: 620px; margin-bottom: 48px; }

/* ---------- Experience layer ---------- */
body.page-enter { opacity: 0; }
body.page-enter.page-in { opacity: 1; transition: opacity 0.45s ease; }
body.page-leave { opacity: 0 !important; transition: opacity 0.2s ease !important; }

body.custom-cursor, body.custom-cursor a, body.custom-cursor button,
body.custom-cursor input, body.custom-cursor label, body.custom-cursor select { cursor: none; }
#cur-dot {
  position: fixed; left: -3px; top: -3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent-bright);
  pointer-events: none; z-index: 100002;
}
#cur-ring {
  position: fixed; left: -17px; top: -17px; width: 34px; height: 34px;
  border-radius: 50%; border: 1.5px solid rgba(139, 124, 246, 0.5);
  pointer-events: none; z-index: 100002;
  transition: width 0.25s ease, height 0.25s ease, left 0.25s ease, top 0.25s ease, background 0.25s ease;
}
#cur-ring.hovering {
  width: 54px; height: 54px; left: -27px; top: -27px;
  background: rgba(139, 124, 246, 0.1);
}

/* ---------- Site Lab panel ---------- */
#lab-btn {
  position: fixed; right: 22px; bottom: 22px; width: 52px; height: 52px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--border-bright);
  color: var(--accent-bright); font-size: 22px; cursor: pointer; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.25s ease, border-color 0.25s ease;
}
#lab-btn:hover { transform: rotate(60deg) scale(1.08); border-color: var(--accent); }
#lab-panel {
  position: fixed; right: 22px; bottom: 86px; width: 290px;
  max-width: calc(100vw - 44px); max-height: calc(100vh - 120px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-bright);
  border-radius: 16px; padding: 20px; z-index: 100000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: none;
}
#lab-panel.open { display: block; }
.lab-title { font-weight: 600; font-size: 16px; }
.lab-sub { font-size: 12px; color: var(--muted); margin: 4px 0 14px; }
.lab-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.lab-presets button {
  min-width: 0; padding: 7px 4px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font: 10px var(--font); cursor: pointer;
}
.lab-presets button:hover, .lab-presets button.active { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.lab-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; font-size: 14px; cursor: pointer;
}
.lab-row input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.lab-tag {
  font-size: 10px; color: var(--accent-bright); background: var(--accent-dim);
  padding: 2px 7px; border-radius: 999px; margin-left: 8px; vertical-align: 1px;
}
.try-live {
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 4px 14px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--accent); color: var(--accent-bright);
  transition: background 0.2s ease, color 0.2s ease;
}
.try-live:hover { background: var(--accent-dim); }
.try-live.active { background: var(--accent); color: #0b0b0f; }
.try-live-remove {
  font-family: var(--font); font-size: 12px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
}
.try-live-remove:hover { color: var(--text); border-color: var(--border-bright); }
.try-live-view {
  font-size: 12px; font-weight: 600; color: var(--accent-bright);
  align-self: center; padding: 4px 6px;
}
.try-live-view:hover { text-decoration: underline; }

.lab-slot { margin: 10px 0; }
.lab-slot-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; margin-bottom: 6px; color: var(--text);
}
.lab-hint { font-size: 10px; color: var(--muted); margin-left: 6px; }
.lab-link { font-size: 11px; color: var(--accent-bright); }
.lab-link:hover { text-decoration: underline; }
.lab-slot select {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: var(--font);
  font-size: 13px; padding: 8px 10px; outline: none; cursor: pointer;
}
.lab-slot select:focus { border-color: var(--accent); }
.lab-divider { border-top: 1px solid var(--border); margin: 14px 0 6px; }
.lab-reset, .lab-share {
  margin-top: 12px; width: 100%; font-family: var(--font); font-size: 13px;
  padding: 8px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
}
.lab-share { color: var(--accent-bright); border-color: var(--accent); }
.lab-reset:hover, .lab-share:hover { color: var(--text); border-color: var(--accent); }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1); }
.reveal.revealed { opacity: 1; transform: none; }

.marquee {
  overflow: hidden; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 16px 0; user-select: none;
}
.marquee-inner {
  display: flex; gap: 48px; width: max-content;
  animation: marquee 30s linear infinite;
  font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted);
  white-space: nowrap;
}
.marquee-inner b { color: var(--accent-bright); font-weight: 600; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .marquee-inner { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 30px; flex-wrap: wrap; }
.filter-btn {
  font-family: var(--font); font-size: 14px; padding: 8px 20px;
  border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active { background: var(--accent); color: #0b0b0f; border-color: var(--accent); font-weight: 600; }
.effect-card.hidden { display: none; }

/* ---------- Effect cards ---------- */
.effects-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}
.effect-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease;
  display: block;
}
.effect-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card-preview {
  height: 180px; background: var(--bg); position: relative;
  border-bottom: 1px solid var(--border); overflow: hidden;
}
.card-preview canvas { width: 100%; height: 100%; display: block; }
.card-body { padding: 18px 20px 20px; }
.card-title { font-weight: 600; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-dim); color: var(--accent-bright);
  letter-spacing: 0.5px;
}
.badge.soon { background: rgba(143, 143, 156, 0.12); color: var(--muted); }
.card-desc { margin-top: 8px; font-size: 14px; color: var(--muted); }
.card-soon-preview {
  height: 180px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--border);
  background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 12px, var(--surface) 12px, var(--surface) 24px);
}

/* ---------- About ---------- */
.about-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px;
}
.about-box p { color: var(--muted); max-width: 720px; }
.about-box p + p { margin-top: 14px; }
.about-box strong { color: var(--text); }

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border); padding: 42px 0 28px;
  color: var(--muted); font-size: 14px;
}
.footer-grid {
  display: grid; grid-template-columns: minmax(240px, 1.5fr) 1fr 1fr;
  gap: 26px 48px; align-items: start;
}
.footer-brand .logo { display: inline-block; color: var(--text); margin-bottom: 7px; }
.footer-brand p { max-width: 330px; }
.footer-links, .footer-social { display: grid; gap: 8px; align-content: start; }
.footer-links a, .footer-links button {
  width: max-content; padding: 0; border: 0; background: none; color: var(--muted);
  font: inherit; cursor: pointer; text-align: left;
}
.footer-links a:hover, .footer-links button:hover { color: var(--accent-bright); }
.footer-social span { color: var(--muted); }
.footer-social small {
  margin-left: 5px; padding: 2px 6px; border-radius: 999px;
  background: var(--surface); color: var(--muted); font-size: 9px; text-transform: uppercase;
}
.footer-note { grid-column: 1 / -1; padding-top: 22px; border-top: 1px solid var(--border); font-size: 12px; }

/* ---------- About / How it works page ---------- */
.about-page { padding: 150px 0 90px; }
.about-hero { max-width: 760px; margin-bottom: 64px; }
.about-hero h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.04; letter-spacing: -2px; }
.about-hero p { margin-top: 20px; max-width: 650px; color: var(--muted); font-size: 18px; }
.how-grid { display: grid; gap: 28px; }
.how-card {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 36px; align-items: center; padding: 34px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.how-copy .step { font-family: var(--mono); color: var(--accent-bright); font-size: 12px; }
.how-copy h2 { margin: 8px 0 10px; font-size: 28px; }
.how-copy p { color: var(--muted); }
.mini-lab {
  min-height: 240px; padding: 20px; border-radius: 12px; border: 1px solid var(--border);
  background: #0d0d13; overflow: hidden;
}
.mini-stage {
  min-height: 104px; display: grid; place-items: center; border-radius: 9px;
  border: 1px solid var(--border); background: #09090d; position: relative; overflow: hidden;
}
.mini-orb { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 35px rgba(139,124,246,.5); }
.mini-controls { margin-top: 14px; display: grid; gap: 10px; }
.mini-controls label { display: flex; align-items: center; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 12px; }
.mini-controls input[type="range"] { max-width: 180px; }
.mini-code { font-family: var(--mono); font-size: 11px; color: #c7c7d4; padding: 9px 10px; border-radius: 7px; background: #08080c; }
.mini-code.changed { background: rgba(240,192,90,.12); color: var(--warn); }
.mini-preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mini-preset {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: transparent; color: var(--muted); font: 12px var(--font); cursor: pointer;
}
.mini-preset.active { border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.mini-share-url { margin: 16px 0 12px; padding: 10px; background: #08080c; border-radius: 8px; overflow-wrap: anywhere; font: 11px var(--mono); color: var(--accent-bright); }
.mini-copy { padding: 8px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #0b0b0f; font: 600 12px var(--font); cursor: pointer; }
.about-cta { margin-top: 54px; text-align: center; }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand, .footer-note { grid-column: 1 / -1; }
  .how-card { grid-template-columns: 1fr; padding: 24px; }
  .about-page { padding-top: 120px; }
}

/* ---------- Effect page ---------- */
.effect-page { padding-top: 110px; padding-bottom: 80px; }
.back-link { color: var(--muted); font-size: 14px; }
.back-link:hover { color: var(--accent-bright); }
.effect-header { margin: 18px 0 28px; }
.effect-header h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -1px; }
.effect-meta { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

.stage-wrap { position: relative; }
/* the stage is a demo, not a document: long-press must never pop the copy/select
   menu or paint blue selection over a button (the mobile-QA lesson, 17.07) */
.stage-wrap, .stage-wrap * {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.stage-wrap input, .stage-wrap textarea { -webkit-user-select: text; user-select: text; }
.tinker-btn, .compare-btn, .copy-btn, .share-btn, .try-live, .try-live-remove, .filter-btn {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#stage {
  width: 100%; height: 380px; display: block;
  background: #08080c; border: 1px solid var(--border); border-radius: var(--radius);
}
/* DOM stages (everything that isn't a bare canvas): the id rule above outranks the
   per-effect class rules, so centering must be re-asserted at id specificity —
   otherwise every text/button demo sits in the top-left corner instead of center stage */
div#stage {
  display: flex; align-items: center; justify-content: center;
  height: auto; min-height: 380px;
}
/* the scroll stages are windows, not centered boxes — they keep block flow */
div#stage.scroll-stage { display: block; height: 380px; min-height: 0; }
/* ---------- Split Reveal stage ---------- */
.sr-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; cursor: pointer; overflow: hidden;
}
.sr-text {
  font-size: clamp(22px, 4.4vw, 46px); font-weight: 700; line-height: 1.25;
  letter-spacing: -0.5px; text-align: center; max-width: 90%;
}
.sr-word { display: inline-block; vertical-align: bottom; }
.sr-in { display: inline-block; will-change: transform, opacity, filter; }
.sr-hint {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 12px; color: var(--muted); opacity: 0.65; pointer-events: none;
}

/* ---------- Gradient Shine stage ---------- */
.gs-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden;
}
.gs-text {
  font-size: clamp(26px, 5vw, 56px); font-weight: 700; letter-spacing: -1px;
  text-align: center; max-width: 90%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  will-change: background-position;
}

/* ---------- Shine Sweep stage ---------- */
.ss-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden;
}
.ss-btn {
  position: relative; overflow: hidden;
  padding: 16px 44px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #0b0b0f;
  font-family: var(--font); font-weight: 600; font-size: 17px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ss-btn.ss-lift:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(139, 124, 246, 0.35); }
.ss-label { position: relative; z-index: 1; }
.ss-beam {
  position: absolute; top: -20%; height: 140%; left: -40%;
  opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.95), rgba(255,255,255,0));
}

/* ---------- 3D Press Button stage ---------- */
.pb-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden;
}
.pb-wrap { position: relative; display: inline-block; }
.pb-front {
  position: relative; z-index: 1;
  padding: 16px 46px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #0b0b0f;
  font-family: var(--font); font-weight: 600; font-size: 17px;
  will-change: transform;
}
.pb-edge {
  position: absolute; inset: 0; border-radius: 999px;
  background: #5b4fc4;
}
.pb-shadow {
  position: absolute; left: 8%; right: 8%; bottom: -12px; height: 10px;
  background: rgba(0, 0, 0, 0.5); border-radius: 50%; filter: blur(6px);
  opacity: 0.5;
}

/* ---------- Wavy Text stage ---------- */
.wt-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden;
}
.wt-text {
  font-size: clamp(24px, 4.6vw, 52px); font-weight: 700; letter-spacing: 0.5px;
  text-align: center; max-width: 90%; white-space: pre-wrap;
}
.wt-ch { display: inline-block; will-change: transform; }

/* ---------- Neon Flicker stage ---------- */
.nf-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden; background: #050508;
}
.nf-text {
  font-size: clamp(26px, 5vw, 56px); font-weight: 700; letter-spacing: 3px;
  text-align: center; max-width: 90%; text-transform: uppercase;
  color: #ffd9f2;
}
.nf-ch { display: inline-block; will-change: opacity, text-shadow; }

/* ---------- Blur Focus Reveal stage ---------- */
.bf-stage {
  display: flex; align-items: center; justify-content: center;
  padding: 30px; overflow: hidden; cursor: pointer;
}
.bf-text {
  font-size: clamp(22px, 4.4vw, 46px); font-weight: 700; line-height: 1.3;
  letter-spacing: -0.5px; text-align: center; max-width: 90%;
}
.bf-word { display: inline-block; will-change: filter, opacity, transform; }
.bf-hint {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 12px; color: var(--muted); opacity: 0.65; pointer-events: none;
}

/* ---------- Decrypt Reveal stage ---------- */
.dr-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; cursor: pointer; background: #050807; }
.dr-text { font-family: var(--mono); font-size: clamp(18px, 3.6vw, 34px); font-weight: 400; letter-spacing: 1px; text-align: center; max-width: 92%; color: #4ade80; }
.dr-ch { display: inline-block; white-space: pre; }

/* ---------- Circular Text stage ---------- */
.ct-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; }
.ct-ring { position: relative; will-change: transform; }
.ct-ch { position: absolute; left: 50%; top: 50%; font-weight: 700; letter-spacing: 0; will-change: transform; }

/* ---------- Heart Burst stage ---------- */
.hb-stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; }
.hb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hb-btn { position: relative; z-index: 1; padding: 14px 38px; border: 1px solid #3a3a48; border-radius: 999px; cursor: pointer; background: #16161f; color: var(--text); font-family: var(--font); font-weight: 600; font-size: 16px; will-change: transform; }

/* ---------- Elastic Tabs stage ---------- */
.et-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; }
.et-tabs { position: relative; display: flex; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 999px; background: #0d0d13; }
.et-tab { position: relative; z-index: 1; padding: 10px 22px; border: none; border-radius: 999px; background: transparent; color: var(--muted); font-family: var(--font); font-weight: 600; font-size: 14px; cursor: pointer; }
.et-tab.active { color: #0b0b0f; }
.et-ind { position: absolute; top: 6px; bottom: 6px; left: 0; width: 0; border-radius: 999px; background: var(--accent); will-change: transform, width; }

/* ---------- Toggle Morph stage ---------- */
.tm-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; }
.tm-toggle { position: relative; border: none; cursor: pointer; border-radius: 999px; overflow: hidden; padding: 0; will-change: background; }
.tm-knob { position: absolute; top: 50%; border-radius: 50%; will-change: transform, border-radius; }
.tm-star { position: absolute; border-radius: 50%; background: #fff; pointer-events: none; }

/* ---------- Glow Pulse CTA stage ---------- */
.gp-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; }
.gp-btn { position: relative; padding: 16px 44px; border: none; border-radius: 999px; cursor: pointer; background: var(--accent); color: #0b0b0f; font-family: var(--font); font-weight: 600; font-size: 17px; will-change: box-shadow, transform; }

/* ---------- Skeleton Shimmer stage ---------- */
.sk-stage { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 30px; overflow: hidden; flex-wrap: wrap; }
.sk-card { width: 200px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #0d0d13; }
.sk-block { border-radius: 8px; background: #1c1c26; margin-bottom: 10px; overflow: hidden; position: relative; }
.sk-sheen { position: absolute; inset: 0; will-change: background-position; }

/* ---------- Dots Wave stage ---------- */
.dw-stage { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px; overflow: hidden; }
.dw-dot { display: inline-block; border-radius: 50%; will-change: transform, background; }

/* ---------- Percentage Counter stage ---------- */
.pc-stage { display: flex; align-items: center; justify-content: center; padding: 30px; overflow: hidden; cursor: pointer; }
.pc-num { font-family: var(--mono); font-weight: 700; font-size: clamp(40px, 9vw, 96px); letter-spacing: -3px; will-change: transform; }

/* ---------- Scroll playground stage (category 1Г) ----------
   The stage itself scrolls: a fixed-height window over a tall track.
   Effects listen to the stage's scrollTop — the page never hijacks
   the visitor's real scrollbar while they are tinkering. */
.scroll-stage {
  height: 380px; overflow-y: auto; overflow-x: hidden; position: relative;
  background: #08080c; border: 1px solid var(--border); border-radius: var(--radius);
  overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #3a3a48 transparent;
}
/* a slim, dark scrollbar that belongs to the design instead of covering it */
.scroll-stage::-webkit-scrollbar { width: 8px; }
.scroll-stage::-webkit-scrollbar-thumb { background: #3a3a48; border-radius: 4px; }
.scroll-stage::-webkit-scrollbar-thumb:hover { background: #4a4a5c; }
.scroll-stage::-webkit-scrollbar-track { background: transparent; }
/* the badges live at the stage's top-right — step them clear of the scrollbar */
.stage-wrap:has(.scroll-stage) .fps-badge { right: 28px; }
.scroll-track { position: relative; }
.scroll-pin { position: sticky; top: 0; height: 380px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.scroll-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-size: 12px; color: var(--muted); background: rgba(11,11,15,0.8);
  padding: 4px 12px; border-radius: 8px; border: 1px solid var(--border);
  pointer-events: none; z-index: 5;
}

.fps-badge {
  position: absolute; top: 14px; right: 14px;
  font-family: var(--mono); font-size: 12px; color: var(--accent-bright);
  background: rgba(11, 11, 15, 0.75); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 8px;
  transition: color 0.3s ease, border-color 0.3s ease;
}
/* honest cost meter — colour follows the real measured frame rate */
.fps-badge[data-cost="light"]    { color: #6fcf97; border-color: rgba(111, 207, 151, 0.4); }
.fps-badge[data-cost="moderate"] { color: var(--warn); border-color: rgba(240, 192, 90, 0.4); }
.fps-badge[data-cost="heavy"]    { color: #f0776a; border-color: rgba(240, 119, 106, 0.45); }
.reduced-note {
  position: absolute; left: 14px; bottom: 14px;
  font-size: 12px; color: var(--warn);
  background: rgba(11, 11, 15, 0.85); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 8px; display: none;
}

/* ---------- effect search (index) ---------- */
.effect-search {
  width: 100%; max-width: 420px; display: block;
  margin: 18px 0 4px;
  padding: 12px 18px; font: 15px var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  outline: none; transition: border-color 0.2s ease;
}
.effect-search:focus { border-color: var(--accent); }
.effect-search::placeholder { color: var(--muted); }

/* ---------- X-ray panel ---------- */
.xray {
  margin-top: 24px;
  display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 24px; align-items: start;
}
@media (max-width: 800px) { .xray { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.panel h3 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--accent-bright); margin-bottom: 16px; font-weight: 600;
}
.panel h3:not(:first-child) { margin-top: 26px; }

.layer-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 15px; }
.layer-row input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.layer-row label { cursor: pointer; }
.layer-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.param-row { margin: 14px 0; }
.param-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.param-head .val { font-family: var(--mono); color: var(--accent-bright); font-size: 13px; }
input[type="range"] {
  width: 100%; accent-color: var(--accent); cursor: pointer; height: 4px;
}

/* ---------- X-ray v2 · annotations ----------
   The link between a line of code and the control that owns it, in both directions.
   Deliberately calmer than .hl (the "you just changed this" flash) — peek is a hint
   you are pointing at something, not an event. */
.param-row.peek, .layer-row.peek {
  background: rgba(139, 124, 246, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
  border-radius: 6px;
}
.param-row.peek { padding: 6px 10px; margin: 8px -10px; }
.layer-row.peek { padding-left: 10px; padding-right: 10px; margin: 0 -10px; }
.param-row, .layer-row { transition: background 0.18s ease, box-shadow 0.18s ease; }
.code-line[data-key] { cursor: pointer; }
.code-line.peek { background: rgba(139, 124, 246, 0.14); outline: 1px solid rgba(139, 124, 246, 0.3); }
.code-line[data-key]:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { .param-row, .layer-row { transition: none; } }

/* ---------- X-ray v2 · Randomize + Reset ---------- */
.tinker-bar { display: flex; gap: 10px; margin-top: 24px; }
.tinker-btn {
  flex: 1; font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  background: var(--accent); border: 1px solid var(--accent); color: #fff;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.tinker-btn:hover { filter: brightness(1.12); }
.tinker-btn:active { transform: translateY(1px); }
.tinker-btn.ghost { flex: 0 0 auto; background: transparent; border-color: var(--border); color: var(--muted); }
.tinker-btn.ghost:hover { color: var(--text); border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tinker-btn { transition: none; } }

/* ---------- X-ray v2 · A/B hold to compare ---------- */
.compare-btn { flex: 1; }
.compare-badge {
  position: absolute; top: 14px; left: 14px;
  font-family: var(--mono); font-size: 12px; color: var(--warn);
  background: rgba(11, 11, 15, 0.85); border: 1px solid rgba(240, 192, 90, 0.4);
  padding: 4px 10px; border-radius: 8px;
  display: none;
}
body.xray-comparing .compare-badge { display: block; }
body.xray-comparing .code-panel { outline: 1px solid rgba(240, 192, 90, 0.35); }
/* your controls step back while the stage isn't theirs — otherwise an unticked layer
   that is visibly still running reads as a bug rather than as the comparison */
body.xray-comparing .param-row,
body.xray-comparing .layer-row {
  opacity: 0.4; pointer-events: none;
}

.code-panel {
  background: #0d0d13; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
}
.code-head span {
  font-family: var(--mono); font-size: 12px; color: var(--muted); flex: 1;
  /* one line, always: when compare swaps the label, the buttons must not move a pixel */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
/* narrow screens: the label gets its own (single) line above the buttons —
   still one line tall in every state, so nothing ever jumps, but readable */
@media (max-width: 620px) {
  .code-head { flex-wrap: wrap; }
  .code-head span { flex-basis: 100%; order: -1; }
}
.code-head { gap: 10px; }
.share-btn {
  background: transparent; color: var(--accent-bright);
  border: 1px solid var(--accent);
}
.share-btn:hover { background: var(--accent-dim); }
.share-btn.done { background: #6fcf97; color: #0b0b0f; border-color: #6fcf97; }
.copy-btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  background: var(--accent); color: #0b0b0f; border: none;
  padding: 8px 18px; border-radius: 8px; cursor: pointer;
  transition: background 0.2s ease;
}
.copy-btn:hover { background: var(--accent-bright); }
.copy-btn.done { background: #6fcf97; }
.code-body {
  font-family: var(--mono); font-size: 13px; line-height: 2;
  padding: 16px 8px; overflow-x: auto;
}
.code-line { padding: 0 14px; border-radius: 6px; white-space: pre; color: #c7c7d4; }
.code-line .cm { color: #5a5a6a; }
.code-line .kw { color: #a99cff; }
.code-line .num { color: #f0c05a; }
.code-line.hl { background: rgba(240, 192, 90, 0.12); outline: 1px solid rgba(240, 192, 90, 0.25); }
.code-line.off { color: #4a4a58; text-decoration: line-through; }
.code-line.off .kw, .code-line.off .num, .code-line.off .cm { color: #4a4a58; }

/* ---------- How it works ---------- */
.howto { margin-top: 48px; max-width: 760px; }
.howto h2 { font-size: 26px; }
.howto p { color: var(--muted); margin-top: 14px; }
.howto strong { color: var(--text); }
.prod-notes {
  margin-top: 28px; padding: 18px 22px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; color: var(--muted);
}
.prod-notes b { color: var(--text); }
