/* ============================================================
   SYNAPSE — juice: transitions, ripples, combos, celebrations,
   demos, onboarding and challenge micro-animations
   ============================================================ */

#fx-top { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

/* ---------- screen warp ---------- */
.warp { position: fixed; inset: 0; pointer-events: none; }
.warp i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0%, rgba(46, 230, 255, 0.18) 45%, transparent 70%);
  animation: warpGrow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.warp i.r2 { background: none; border: 3px solid rgba(255, 255, 255, 0.55); box-shadow: 0 0 30px var(--c), inset 0 0 30px var(--c); animation-duration: 0.55s; }
@keyframes warpGrow { 0% { transform: scale(0.2); opacity: 1; } 100% { transform: scale(60); opacity: 0; } }

/* ---------- ripple ---------- */
.ripple-wrap { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; z-index: 0; }
.ripple-wrap i { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.12) 40%, transparent 70%); transform: scale(0); animation: ripple 0.6s ease-out forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.btn > span, .option > span, .mode-chip > b, .mode-chip > small { position: relative; z-index: 1; }

/* ---------- logo interactions ---------- */
.logo-md { font-size: clamp(2.2rem, 9vw, 3.4rem); }
.logo-word span.is-jump { animation: letterJump 0.6s var(--ease-spring), letterJumpGlow 0.6s var(--ease-spring), letterHue 10s linear infinite; animation-delay: 0s, 0s, calc(var(--i) * -0.35s); }
.logo-word.is-flow span.is-jump { animation: letterJump 0.6s var(--ease-spring), letterJumpGlow 0.6s var(--ease-spring); animation-delay: 0s; }
.logo-mark.is-jump { animation: markSpin 0.7s var(--ease-spring); }
@keyframes letterJump { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-0.35em) scale(1.25) rotate(-6deg); } 70% { transform: translateY(0.04em) scale(0.95); } 100% { transform: translateY(0) scale(1); } }
@keyframes letterJumpGlow { 35% { filter: drop-shadow(0 0 22px #fff); } }
@keyframes markSpin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(1.3); } 100% { transform: rotate(360deg) scale(1); } }
.logo-word span, .logo-mark { cursor: pointer; }

/* ---------- home: PLAY core ---------- */
.play-orbit { position: absolute; inset: -18px; border-radius: 50%; animation: spin 9s linear infinite; pointer-events: none; }
.play-orbit i { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 12px #2ee6ff, 0 0 24px #b07bff; left: 50%; top: -4px; margin-left: -4px; transform-origin: 4px calc(50% + 4px + var(--o, 0px)); }
.play-orbit i:nth-child(2) { top: auto; bottom: -4px; background: #ff4fd8; box-shadow: 0 0 12px #ff4fd8; }
.play-orbit i:nth-child(3) { left: -4px; top: 50%; margin: -4px 0 0; width: 6px; height: 6px; background: #34f5c5; box-shadow: 0 0 12px #34f5c5; }
.play-orbit i:nth-child(4) { left: auto; right: -4px; top: 50%; margin: -4px 0 0; width: 5px; height: 5px; background: #ffc53d; box-shadow: 0 0 12px #ffc53d; }
@keyframes spin { to { transform: rotate(360deg); } }
.play-btn.is-charging { transform: scale(0.93); }
.play-btn.is-charging .play-glow,
.play-btn.is-charging .play-glow.is-hover { opacity: 0; }
.play-btn.is-charging .play-glow.is-hot { opacity: 1; }
/* Charging speeds the orbit up to one turn per 1.4s without touching the 9s spin (changing its
   duration made the dots jump): a second layer adds 1/1.66 turn per second only while pressed. */
.play-orbit-boost { position: absolute; inset: 0; animation: spin 1.66s linear infinite paused; will-change: transform; }
.play-btn.is-charging .play-orbit-boost { animation-play-state: running; }
/* scale/fade on the compositor; the brightness/blur flash runs as a separate effect */
.play-btn.is-launch { animation: launch 0.32s var(--ease-out) forwards, launchFx 0.32s var(--ease-out) forwards; }
@keyframes launch { 0% { transform: scale(0.93); } 40% { transform: scale(1.22); } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes launchFx { 40% { filter: brightness(1.6); } 100% { filter: brightness(2) blur(4px); } }

/* ---------- home: sliding mode glider ---------- */
.mode-chips { position: relative; }
.chip-glider {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 79, 216, 0.28), rgba(46, 230, 255, 0.28));
  border: 1px solid rgba(200, 210, 255, 0.35);
  box-shadow: 0 0 22px -6px rgba(176, 123, 255, 0.8);
  transition: transform 0.35s var(--ease-spring), width 0.35s var(--ease-spring);
  pointer-events: none;
}
.mode-chip.is-active { background: transparent; border-color: transparent; box-shadow: none; }

/* ---------- play: HUD heat, bumps, multiplier ---------- */
.hud { --heat: 0; }
.hud .flame { transform: scale(calc(1 + var(--heat) * 0.6)); transform-origin: 50% 80%; }
.hud.is-hot .flame { filter: drop-shadow(0 0 calc(6px + var(--heat) * 14px) #ffb02e); }
.hud-streak-row { display: flex; align-items: baseline; gap: 5px; }
.hud-mult { font-style: normal; font-family: var(--font-mono); font-size: 0.68rem; color: #ffb02e; text-shadow: 0 0 8px rgba(255, 176, 46, 0.7); }
/* (filters live in their own @keyframes: a filter in the same keyframes keeps the transform off the GPU) */
.bump { animation: bump 0.35s var(--ease-spring), bumpGlow 0.35s var(--ease-spring); display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes bumpGlow { 40% { filter: brightness(1.6); } }
.pause-btn span { letter-spacing: -0.1em; }

/* ---------- play: flying points ---------- */
.fly-pts {
  position: fixed;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 0 14px var(--c), 0 0 28px var(--c);
  pointer-events: none;
  white-space: nowrap;
  will-change: transform, opacity;
}

/* ---------- play: combo words ---------- */
.combo-text {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 10vw, 4rem);
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0 24px var(--c), 0 0 60px var(--c), -3px 0 #ff4fd8, 3px 0 #2ee6ff;
  white-space: nowrap;
  pointer-events: none;
  animation: combo 1.05s var(--ease-out) forwards, comboBlur 1.05s var(--ease-out) forwards;
  z-index: 20;
}
.combo-text.is-out { animation: fadeOut 0.2s forwards; }
@keyframes combo {
  0% { transform: translate(-50%, -50%) scale(2.6) rotate(-8deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(0.92) rotate(-4deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1.06) rotate(-4deg); }
  75% { transform: translate(-50%, -58%) scale(1) rotate(-4deg); opacity: 1; }
  100% { transform: translate(-50%, -80%) scale(0.9) rotate(-4deg); opacity: 0; }
}
@keyframes comboBlur { 0% { filter: blur(8px); } 18% { filter: blur(0); } }

/* ---------- play: countdown ---------- */
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 25; }
.countdown span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(5rem, 26vw, 9rem);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 40px var(--skill), 0 0 90px var(--skill);
  animation: count var(--step, 1s) var(--ease-out) forwards;
}
.countdown span.is-go { font-size: clamp(4rem, 20vw, 7rem); background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 0 30px rgba(176, 123, 255, 0.8)); }
@keyframes count { 0% { transform: scale(2.2); opacity: 0; } 18% { transform: scale(1); opacity: 1; } 82% { transform: scale(0.96); opacity: 1; } 100% { transform: scale(0.7); opacity: 0; } }

/* ---------- overlays get their own dimmed backdrop ---------- */
.play-overlay.is-on { background: radial-gradient(ellipse at 50% 30%, rgba(10, 12, 32, 0.55), rgba(5, 6, 15, 0.8)); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fadeIn 0.25s both; }
body.low-power .play-overlay.is-on { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(5, 6, 15, 0.88); }
.stage.is-clearing { transition: opacity 0.25s, transform 0.25s; opacity: 0; transform: scale(0.97); }

/* ---------- intro card: demo + exit ---------- */
.intro-card.is-out { animation: cardOut 0.22s ease-in forwards, cardOutBlur 0.22s ease-in forwards; }
@keyframes cardOut { to { opacity: 0; transform: translateY(-20px) scale(0.92); } }
@keyframes cardOutBlur { to { filter: blur(4px); } }

/* ---------- summary stars ---------- */
.stars { display: flex; justify-content: center; gap: 10px; margin: 12px 0 -4px; }
.star { font-size: 2.4rem; line-height: 1; color: rgba(255, 255, 255, 0.1); transform: scale(0); }
.star.is-in { animation: starIn 0.45s var(--ease-spring) forwards; }
.star.is-on.is-in { color: #ffc53d; text-shadow: 0 0 18px rgba(255, 197, 61, 0.9), 0 0 40px rgba(255, 79, 216, 0.5); }
.star:nth-child(2) { font-size: 3rem; margin-top: -8px; }
@keyframes starIn { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
.badge-new { border-color: rgba(255, 197, 61, 0.6); color: #ffd97a; }

/* ---------- celebrations ---------- */
.celebrate { position: fixed; inset: 0; z-index: 96; display: grid; place-items: center; pointer-events: auto; background: radial-gradient(circle at center, rgba(10, 12, 32, 0.6), rgba(3, 4, 12, 0.92)); animation: fadeIn 0.25s both; padding: 20px; }
.celebrate.is-out { animation: fadeOut 0.3s both; }
.cel-rays {
  position: absolute;
  width: 125vmax;
  height: 125vmax;
  left: 50%;
  top: 50%;
  margin: -62.5vmax 0 0 -62.5vmax;
  animation: spin 14s linear infinite;
  will-change: transform;
}
.cel-body { position: relative; text-align: center; display: grid; justify-items: center; gap: 8px; animation: celIn 0.6s var(--ease-spring) both; }
@keyframes celIn { from { transform: scale(0.4); opacity: 0; } }
.cel-icon { position: relative; isolation: isolate; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; color: #05060f; background: var(--c); animation: pulseIcon 1.2s ease-in-out infinite; }
/* the glow breathes by cross-fading two pre-painted shadows (animating box-shadow repaints every frame) */
.cel-icon::before, .cel-icon::after { content: ''; position: absolute; inset: 0; border-radius: 50%; z-index: -1; pointer-events: none; }
.cel-icon::before { box-shadow: 0 0 40px var(--c), 0 0 100px var(--c); animation: glowOut 1.2s ease-in-out infinite; }
.cel-icon::after { box-shadow: 0 0 60px var(--c), 0 0 140px var(--c); opacity: 0; animation: glowIn 1.2s ease-in-out infinite; }
@keyframes pulseIcon { 50% { transform: scale(1.1); } }
@keyframes glowOut { 50% { opacity: 0; } }
@keyframes glowIn { 50% { opacity: 1; } }
.cel-kicker { margin-top: 10px; font-family: var(--font-display); font-weight: 700; letter-spacing: 0.32em; font-size: 0.85rem; color: var(--c); }
.cel-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.4rem, 11vw, 4.6rem); letter-spacing: 0.1em; color: #fff; text-shadow: 0 0 30px var(--c); line-height: 1.05; }
.cel-sub { color: var(--muted); font-size: 1.05rem; }
.cel-body .demo { margin-top: 10px; }

/* ---------- results grade stamp ---------- */
.res-score-row { display: flex; align-items: center; justify-content: center; gap: 18px; }
.grade-stamp {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 22px;
  border: 3px solid var(--c);
  color: var(--c);
  transform: rotate(-12deg) scale(0);
  opacity: 0;
  box-shadow: 0 0 30px -4px var(--c), inset 0 0 20px -6px var(--c);
}
.grade-stamp small { font-size: 0.58rem; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: -8px; }
.grade-stamp b { font-family: var(--font-display); font-size: 3rem; line-height: 1; text-shadow: 0 0 20px var(--c); }
.grade-stamp.is-in { animation: stamp 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes stamp { 0% { transform: rotate(-30deg) scale(3); opacity: 0; } 60% { transform: rotate(-10deg) scale(0.9); opacity: 1; } 100% { transform: rotate(-12deg) scale(1); opacity: 1; } }

/* ---------- profile stars ---------- */
.ch-stars { margin-left: 8px; color: #ffc53d; font-size: 0.8rem; letter-spacing: 0.05em; text-shadow: 0 0 8px rgba(255, 197, 61, 0.6); }

/* ---------- challenge micro-animations ---------- */
.board .cell.is-ghost { opacity: 0.38; }
.board .cell.is-ghost svg { filter: grayscale(0.3); }
.is-pop { animation: popIn 0.4s var(--ease-spring); }
@keyframes popIn { 0% { transform: scale(0.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.flex-frame { touch-action: none; cursor: grab; }
.flex-stim { transition: transform 0.12s; }
.flex-stim.fly-left { transition: transform 0.22s ease-in, opacity 0.22s; transform: translateX(-180%) rotate(-25deg) scale(0.7) !important; opacity: 0; }
.flex-stim.fly-right { transition: transform 0.22s ease-in, opacity 0.22s; transform: translateX(180%) rotate(25deg) scale(0.7) !important; opacity: 0; }
.flex-stim.is-bad.fly-left, .flex-stim.is-bad.fly-right { filter: drop-shadow(0 0 16px #ff4d6d); }
.flex-stim.is-ok.fly-left, .flex-stim.is-ok.fly-right { filter: drop-shadow(0 0 16px #3dff9a); }
.spark-burst { position: absolute; inset: 10%; border-radius: 50%; border: 3px solid #2ee6ff; box-shadow: 0 0 20px #2ee6ff; animation: burstRing 0.45s ease-out forwards; pointer-events: none; }
@keyframes burstRing { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.hit-wave { position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 3px solid var(--ok); box-shadow: 0 0 24px var(--ok); animation: burstRing 0.55s ease-out forwards; pointer-events: none; }
.dual-cell { position: relative; }
.dual-cell .hit-wave { width: 100%; height: 100%; margin: 0; left: 0; top: 0; }
.is-flip { animation: flipCard 0.32s ease-in-out; }
.is-flip.is-ok { color: var(--ok) !important; border-color: var(--ok) !important; text-shadow: 0 0 14px rgba(61, 255, 154, 0.8) !important; }
.is-flip.is-bad { color: #ff8da1 !important; border-color: var(--bad) !important; text-shadow: none !important; }
@keyframes flipCard { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.mirror-src { perspective: 700px; }
.swap-ico { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; background: conic-gradient(#ff4d6d 0 50%, #4d7cff 50% 100%); box-shadow: 0 0 10px rgba(77, 124, 255, 0.6); animation: spin 3s linear infinite; vertical-align: middle; }
.mgrid.is-match { box-shadow: 0 0 0 2px var(--ok), 0 0 40px -6px var(--ok); }

/* ---------- demos ---------- */
.demo {
  --d-red: #ff4d6d;
  --d-blue: #4d7cff;
  --d-yellow: #ffe14d;
  --d-green: #3dff7a;
  --d-pink: #ff5cd6;
  position: relative;
  width: 240px;
  height: 118px;
  margin: 2px auto 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.demo svg.shape { filter: drop-shadow(0 0 5px var(--c)); }
.d-tap { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); border: 2px solid #fff; box-shadow: 0 0 16px #fff; animation: dTap 0.65s ease-out forwards; pointer-events: none; }
@keyframes dTap { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }
.d-grid { display: grid; grid-template-columns: repeat(var(--c), 34px); gap: 6px; }
.d-grid .dc { position: relative; width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, 0.06); display: grid; place-items: center; padding: 5px; transition: background 0.2s, box-shadow 0.2s; }
.d-grid .dc.ok { background: rgba(61, 255, 154, 0.2); box-shadow: 0 0 0 2px var(--ok), 0 0 14px rgba(61, 255, 154, 0.6); }
.d-sym { width: 100%; height: 100%; display: block; opacity: 0; transform: scale(0.6); transition: opacity 0.18s, transform 0.18s; }
.d-sym.on { opacity: 1; transform: scale(1); }
.d-sym svg { width: 100%; height: 100%; }
.d-q { position: absolute; right: 12px; top: 10px; display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-weight: 800; font-size: 0.85rem; color: var(--warn); opacity: 0; transition: opacity 0.2s; }
.d-q svg { width: 20px; height: 20px; }
.d-q.on { opacity: 1; }
.demo-echo .d-grid, .demo-nexus .d-grid { margin-right: 60px; }
.d-dense { grid-template-columns: repeat(4, 26px); gap: 4px; }
.d-dense .dc { width: 26px; height: 26px; padding: 3px; border-radius: 6px; }
.d-mask { position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(176, 123, 255, 0.4) 0 6px, rgba(46, 230, 255, 0.4) 6px 12px); opacity: 0; }
.d-mask.on { opacity: 1; }
.d-opts { position: absolute; inset: auto 0 12px 0; display: flex; justify-content: center; gap: 10px; opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s; }
.d-opts.on { opacity: 1; transform: none; }
.d-opts b { width: 40px; height: 40px; border-radius: 10px; padding: 7px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); display: grid; place-items: center; transition: box-shadow 0.2s, border-color 0.2s; }
.d-opts b svg { width: 100%; height: 100%; }
.d-opts b.ok { border-color: var(--ok); box-shadow: 0 0 14px rgba(61, 255, 154, 0.7); }
.d-colors b { background: var(--c); box-shadow: 0 0 10px var(--c); border-radius: 50%; width: 26px; height: 26px; }
.d-colors b.ok { box-shadow: 0 0 0 3px var(--ok), 0 0 16px var(--ok); }
.demo-onesecond .d-grid { transform: translateY(-10px); }
.d-arena { position: absolute; inset: 8px; }
.d-dot { position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #dfe7ff); box-shadow: 0 0 10px #dfe7ff; transition: transform 0.75s cubic-bezier(0.5, 0, 0.5, 1); }
.d-dot.pink { background: radial-gradient(circle at 35% 35%, #fff, #ff4fd8); box-shadow: 0 0 0 4px rgba(255, 79, 216, 0.4), 0 0 14px #ff4fd8; }
.d-dot.ok { box-shadow: 0 0 0 4px var(--ok), 0 0 14px var(--ok); }
.d-pairs { display: grid; gap: 4px; font-family: var(--font-mono); font-weight: 800; font-size: 1.15rem; }
.d-pairs span { opacity: 0; transform: translateX(-10px); transition: opacity 0.25s, transform 0.25s; }
.d-pairs span.on { opacity: 1; transform: none; }
.d-ans { display: inline-block; color: var(--warn); }
.d-ans.flip { color: var(--ok); animation: flipCard 0.35s; text-shadow: 0 0 12px rgba(61, 255, 154, 0.8); }
.d-nodes { grid-template-columns: repeat(3, 28px); gap: 8px; }
.d-nodes .dc { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(150, 165, 255, 0.3); background: none; }
.d-node { width: 30%; height: 30%; border-radius: 50%; background: rgba(150, 165, 255, 0.3); transition: all 0.08s; }
.d-nodes .dc.lit { border-color: #2ee6ff; box-shadow: 0 0 14px #2ee6ff; }
.d-nodes .dc.lit .d-node { width: 64%; height: 64%; background: #2ee6ff; }
.d-nodes .dc.decoy { border-color: #ff4d6d; }
.d-nodes .dc.decoy .d-node { width: 60%; height: 60%; border-radius: 0; background: #ff4d6d; clip-path: polygon(20% 0, 50% 30%, 80% 0, 100% 20%, 70% 50%, 100% 80%, 80% 100%, 50% 70%, 20% 100%, 0 80%, 30% 50%, 0 20%); }
.d-nodes .dc.ok { box-shadow: 0 0 0 2px var(--ok), 0 0 16px var(--ok); background: none; }
.d-rule { position: absolute; left: 10px; top: 8px; display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.d-rule svg { width: 18px; height: 18px; }
.d-center { width: 56px; height: 56px; border-radius: 14px; padding: 6px; opacity: 0; transform: scale(0.7); transition: opacity 0.12s, transform 0.12s, box-shadow 0.15s; }
.d-center.on { opacity: 1; transform: scale(1); }
.d-center.ok { box-shadow: 0 0 0 3px var(--ok), 0 0 20px var(--ok); }
.d-center svg { width: 100%; height: 100%; }
.d-mirror { display: flex; align-items: center; gap: 16px; perspective: 400px; }
.d-mirror > b { color: var(--skill); font-size: 1.6rem; text-shadow: 0 0 10px var(--skill); }
.d-mgrid { display: grid; grid-template-columns: repeat(3, 22px); gap: 3px; transition: transform 0.7s cubic-bezier(0.6, 0, 0.2, 1); }
.d-mgrid.flip { transform: rotateY(180deg); }
.d-mgrid .dc { width: 22px; height: 22px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); }
.d-mgrid i { display: block; width: 100%; height: 100%; border-radius: 4px; }
.d-mgrid i.on { background: #4d8dff; box-shadow: 0 0 8px #4d8dff; }
.d-mgrid .dc:first-child i.on { background: #ffe14d; box-shadow: 0 0 8px #ffe14d; }
.d-iso { display: flex; align-items: center; gap: 10px; }
.d-iso > b { color: var(--muted); font-size: 1.4rem; }
.d-ref, .d-spin { position: relative; width: 92px; height: 92px; display: grid; }
.d-ref svg, .d-frame svg { width: 100%; height: 100%; }
.d-frame { grid-area: 1 / 1; opacity: 0; transition: opacity 0.12s; }
.d-frame.on { opacity: 1; }
.d-flex { display: flex; align-items: center; gap: 14px; margin-top: -14px; }
.d-side { width: 36px; height: 50px; border-radius: 10px; border: 1px solid var(--line-hi); display: grid; place-items: center; color: var(--muted); }
.d-frame-box { width: 56px; height: 56px; border-radius: 14px; border: 2px solid #2ee6ff; padding: 10px; overflow: visible; }
.d-stim { display: block; width: 100%; height: 100%; opacity: 0; transition: transform 0.35s ease-in, opacity 0.2s; }
.d-stim.on { opacity: 1; }
.d-stim.fly-l { transform: translateX(-70px) rotate(-20deg); opacity: 0; }
.d-stim.fly-r { transform: translateX(70px) rotate(20deg); opacity: 0; }
.d-stim svg { width: 100%; height: 100%; }
.d-flex-rule { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--muted); }
.d-flex-rule svg { width: 14px; height: 14px; }
.d-banner { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 6, 15, 0.86); font-family: var(--font-display); font-weight: 700; letter-spacing: 0.14em; font-size: 1.4rem; text-shadow: 0 0 16px #34f5c5, -2px 0 #ff4fd8, 2px 0 #2ee6ff; opacity: 0; transform: scale(1.4); transition: opacity 0.15s, transform 0.25s var(--ease-spring); }
.d-banner.on { opacity: 1; transform: scale(1); }
.d-field { position: absolute; inset: 0; }
.d-fdot { position: absolute; width: 20px; height: 20px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); opacity: 0; transform: scale(0.4); transition: opacity 0.08s, transform 0.08s; }
.d-fdot.on { opacity: 1; transform: scale(1); }
.demo-decision .d-q, .demo-nexus .d-q { left: 0; right: 0; top: 14px; justify-content: center; font-size: 0.95rem; }
.demo-nexus .d-q svg { width: 18px; height: 18px; }
.demo-decision .d-opts { bottom: 18px; }
.demo-nexus .d-grid { transition: opacity 0.2s; }
.d-dual { display: flex; align-items: center; gap: 18px; }
.d-dual .d-grid { grid-template-columns: repeat(3, 28px); gap: 4px; }
.d-dual .dc { width: 28px; height: 28px; padding: 4px; }
.d-count { font-family: var(--font-mono); font-weight: 800; font-size: 2rem; color: #4d7cff; text-shadow: 0 0 12px #4d7cff; min-width: 1.2em; text-align: center; }

/* ---------- onboarding ---------- */
.onboarding { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: calc(16px + env(safe-area-inset-top)) 0 calc(18px + env(safe-area-inset-bottom)); overflow: hidden; }
.onb-skip { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 0; z-index: 2; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); color: var(--muted); font-weight: 600; cursor: pointer; }
.onb-viewport { flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y; }
.onb-track { display: flex; height: 100%; transition: transform 0.45s var(--ease-out); }
.onb-track.is-dragging { transition: none; }
.onb-slide { flex: 0 0 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px 10px; gap: 10px; }
.onb-slide h2 { margin: 18px 0 0; font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: 0.04em; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.onb-slide p { margin: 0; max-width: 420px; color: var(--muted); font-size: 1.05rem; }
.onb-slide > * { opacity: 0; transform: translateY(16px); transition: opacity 0.5s, transform 0.5s var(--ease-out); }
.onb-slide.is-active > * { opacity: 1; transform: none; }
/* off-screen slides don't animate (they resume when shown or while being dragged into view) */
.onb-track:not(.is-dragging) .onb-slide:not(.is-active) * { animation-play-state: paused; }
.onb-slide.is-active > *:nth-child(2) { transition-delay: 0.12s; }
.onb-slide.is-active > *:nth-child(3) { transition-delay: 0.22s; }
.onb-visual { position: relative; display: grid; justify-items: center; gap: 14px; min-height: 230px; align-content: center; }
.onb-core { width: 240px; height: 240px; place-items: center; }
.core-orbit { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed rgba(176, 123, 255, 0.35); animation: spin 12s linear infinite; }
.core-orbit::before { content: ''; position: absolute; inset: 30px; border-radius: 50%; border: 1px solid rgba(46, 230, 255, 0.25); }
.core-orbit i { position: absolute; width: 12px; height: 12px; border-radius: 50%; top: -6px; left: calc(50% - 6px); background: #ff4fd8; box-shadow: 0 0 16px #ff4fd8; }
.core-orbit i:nth-child(2) { top: auto; bottom: -6px; background: #2ee6ff; box-shadow: 0 0 16px #2ee6ff; }
.core-orbit i:nth-child(3) { top: calc(50% - 6px); left: -6px; background: #ffc53d; box-shadow: 0 0 16px #ffc53d; }
.onb-core .logo { flex-direction: column; gap: 10px; }
.onb-radar { width: 220px; height: 220px; }
.onb-radar .radar-shape, .onb-radar .radar-stroke { transition: all 0.8s; }
.onb-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 360px; }
.onb-chips .skill-chip { animation: popIn 0.4s var(--ease-spring) both; }
.onb-adapt { width: min(320px, 86vw); }
.adapt-track { position: relative; width: 100%; height: 16px; border-radius: 10px; background: linear-gradient(90deg, #34f5c5, #2ee6ff, #b07bff, #ff4fd8, #ff5470); opacity: 0.85; }
.adapt-zone { position: absolute; left: 70%; width: 20%; top: -10px; bottom: -10px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 18px rgba(255, 255, 255, 0.6); }
.adapt-zone span { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.75rem; white-space: nowrap; }
/* the rail spans the track, so translateX(%) of the rail == position along the track (compositor-only) */
.adapt-rail { position: absolute; inset: 0; pointer-events: none; transform: translateX(30%); animation: adapt 4s ease-in-out infinite; will-change: transform; }
.adapt-marker { position: absolute; top: 50%; left: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: #fff; box-shadow: 0 0 20px #fff; }
@keyframes adapt { 0% { transform: translateX(25%); } 30% { transform: translateX(96%); } 55% { transform: translateX(72%); } 75% { transform: translateX(86%); } 100% { transform: translateX(80%); } }
.adapt-labels { display: flex; justify-content: space-between; width: 100%; color: var(--dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.adapt-bars { display: flex; align-items: flex-end; gap: 8px; height: 90px; }
.adapt-bars i { width: 20px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #b07bff, transparent); animation: growUp 0.8s var(--ease-out) both; transform-origin: bottom; }
.clock { position: relative; width: 140px; height: 140px; }
.clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.clock-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 8; }
/* progress arc: r=52, stroke 8 in a 120 viewBox → ring inset 4/120, stroke 8/120 of the clock size.
   Each half-ring ("arm") rotates into its clipped half; cap + head give the round line caps. */
.clock { --cs: 140px; --sw: calc(var(--cs) * 8 / 120); }
.clock-sweep { position: absolute; inset: 0; filter: drop-shadow(0 0 8px #34f5c5); }
.cs-half { position: absolute; top: 0; width: 50%; height: 100%; overflow: hidden; }
.cs-r { right: 0; }
.cs-l { left: 0; }
.cs-arm { position: absolute; top: 0; width: 100%; height: 100%; overflow: hidden; will-change: transform; }
.cs-r .cs-arm { left: -100%; transform-origin: 100% 50%; animation: csR 3.5s infinite; }
.cs-l .cs-arm { left: 100%; transform-origin: 0 50%; animation: csL 3.5s infinite; }
.cs-arm i { position: absolute; top: calc(100% * 4 / 120); width: calc(200% * 112 / 120); height: calc(100% * 112 / 120); box-sizing: border-box; border-radius: 50%; border: var(--sw) solid #34f5c5; }
.cs-r .cs-arm i { left: calc(200% * 4 / 120); }
.cs-l .cs-arm i { right: calc(200% * 4 / 120); }
.cs-cap, .cs-head i { position: absolute; left: 50%; top: calc(var(--cs) * 4 / 120); width: var(--sw); height: var(--sw); margin-left: calc(var(--sw) / -2); border-radius: 50%; background: #34f5c5; }
.cs-head { position: absolute; inset: 0; animation: csHead 3.5s infinite; will-change: transform; }
.cs-cap, .cs-head i { animation: csShow 3.5s step-end infinite; }
/* where the two halves meet at 6 o'clock: a 2px patch hides the anti-aliasing seam once the second half starts */
.cs-seam { position: absolute; left: calc(50% - 1px); width: 2px; top: calc(var(--cs) * 108 / 120); height: var(--sw); background: #34f5c5; opacity: 0; animation: csSeam 3.5s step-end infinite; }
/* same pacing as the old ease-in-out 0→70% sweep: ease-in to half, ease-out to full, hold */
@keyframes csR { 0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.42, 0, 1, 1); } 35%, 100% { transform: rotate(180deg); } }
@keyframes csL { 0%, 35% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0, 0, 0.58, 1); } 70%, 100% { transform: rotate(180deg); } }
@keyframes csHead { 0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.42, 0, 1, 1); } 35% { transform: rotate(180deg); animation-timing-function: cubic-bezier(0, 0, 0.58, 1); } 70%, 100% { transform: rotate(360deg); } }
@keyframes csShow { 0% { opacity: 0; } 0.1%, 100% { opacity: 1; } }
@keyframes csSeam { 0% { opacity: 0; } 35.5%, 100% { opacity: 1; } }
.clock b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 2.6rem; }
.onb-note { max-width: 360px; color: var(--dim) !important; font-size: 0.78rem !important; }
.onb-footer { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.onb-dots { display: flex; gap: 8px; }
.onb-dots i { width: 8px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); transition: width 0.3s, background 0.3s; cursor: pointer; }
.onb-dots i.is-on { width: 26px; background: var(--accent); }
.onb-next { min-width: 220px; }

/* ---------- in-app document (privacy policy) ---------- */
.doc-overlay { place-items: stretch; padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); }
.doc-sheet { position: relative; max-width: 760px; width: 100%; margin: 0 auto; overflow-y: auto; border-radius: 20px; background: #0b0d26; border: 1px solid var(--line-hi); padding: 18px 22px 30px; -webkit-user-select: text; user-select: text; }
.doc-close { position: sticky; top: 0; float: right; z-index: 2; }
.doc-body h1 { font-family: var(--font-display); font-size: 1.4rem; background: var(--accent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc-body h2 { font-size: 1rem; color: var(--violet); margin-top: 1.6em; }
.doc-body p, .doc-body li { color: var(--muted); }
.doc-body hr { border: none; border-top: 1px solid var(--line); margin: 30px 0; }
.doc-body a { color: var(--cyan); text-underline-offset: 2px; }

/* ---------- reduced motion ---------- */
body.reduce-motion .play-orbit, body.reduce-motion .play-orbit-boost, body.reduce-motion .cel-rays, body.reduce-motion .core-orbit { animation: none !important; }
body.reduce-motion .star, body.reduce-motion .grade-stamp { transform: none; opacity: 1; }
body.low-power .cel-rays { animation-duration: 20s; }

/* Touch devices: the animated demo shows the controls; keyboard tips are noise. */
body.is-touch .intro-controls { display: none; }
