/* =========================================================
   Test effects and per-test polish (used with js/fx.js)
   ========================================================= */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fx-shard { position: absolute; margin: -3px; animation: fxshard .7s cubic-bezier(.15, .7, .35, 1) forwards; }
@keyframes fxshard { to { transform: translate(var(--dx), calc(var(--dy) + 26px)) rotate(var(--rot)); opacity: 0; } }
.fx-ring { position: absolute; border: 4px solid; border-radius: 50%; animation: fxring .6s cubic-bezier(.2, .6, .3, 1) forwards; }
@keyframes fxring { from { transform: scale(.4); opacity: 1; } to { transform: scale(3); opacity: 0; border-width: 1px; } }
.fx-text { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font: 800 1.2rem/1 var(--font-head);
  text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 14px currentColor; animation: fxtext 1.05s ease-out forwards; }
.fx-text.big { font-size: 1.8rem; }
@keyframes fxtext { 0% { transform: translate(-50%, -20%) scale(.6); opacity: 0; } 18% { transform: translate(-50%, -80%) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translate(-50%, -210%) scale(1); opacity: 0; } }
.fx-shake { animation: shake .32s ease-in-out; }
.fx-pop { animation: fxpop .32s cubic-bezier(.3, .7, .4, 1.6); }
@keyframes fxpop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
.fx-glow { animation: fxglow .5s ease-out; }
@keyframes fxglow { 0% { box-shadow: 0 0 0 0 var(--glow); } 30% { box-shadow: 0 0 0 6px var(--glow), 0 0 30px var(--glow); } 100% { box-shadow: 0 0 0 0 transparent; } }
.fx-wave { animation: fxwave .5s cubic-bezier(.3, .7, .4, 1.5) var(--wd, 0ms) both; }
@keyframes fxwave { 0% { transform: scale(1); filter: brightness(1); } 40% { transform: scale(1.1); filter: brightness(1.5); } 100% { transform: scale(1); filter: brightness(1); } }
.combo { color: var(--text); transition: background .2s; }
.combo.hot { background: linear-gradient(90deg, #FF8A3D, #FF4F4F); color: #fff; box-shadow: 0 0 18px rgba(255,120,60,.6); }
.combo.hot i { display: inline-block; animation: flicker .2s ease-in-out infinite alternate; }
@keyframes flicker { from { transform: scaleY(.85); } to { transform: scaleY(1.1); } }

/* Reaction: lightning crack + speed rating */
.react-pad { position: relative; overflow: hidden; }
.react-crack { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; }
.react-crack.show { animation: crack .6s ease-out forwards; }
@keyframes crack { 0% { opacity: 1; } 60% { opacity: .85; } 100% { opacity: 0; } }
.react-rating { font: 800 1.3rem/1 var(--font-head); padding: 8px 14px; border-radius: var(--r-pill); background: rgba(14,20,51,.85); color: #FFC94A; animation: popin .35s cubic-bezier(.3,.7,.4,1.6) both; }
.react-pad .wait-dots i { display: inline-block; width: 12px; height: 12px; margin: 0 4px; border-radius: 50%; background: var(--ink); animation: waitdot 1.2s ease-in-out infinite; }
.react-pad .wait-dots i:nth-child(2) { animation-delay: .2s; } .react-pad .wait-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes waitdot { 0%, 100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-8px); opacity: 1; } }
.dot.on { animation: fxpop .3s cubic-bezier(.3, .7, .4, 1.6); }

/* Number memory: digits pop in one by one + answer comparison */
.big-number .dg { display: inline-block; animation: digitin .35s cubic-bezier(.3, .7, .4, 1.6) both; }
@keyframes digitin { from { transform: translateY(14px) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.compare { display: grid; gap: 10px; font: 800 1.7rem/1.1 var(--font-head); letter-spacing: .08em; }
.compare .ok { color: var(--green); }
.compare .bad { color: var(--coral); text-decoration: underline; }
.compare small { font: 700 .8rem/1 var(--font-body); letter-spacing: 0; color: var(--muted); display: block; margin-bottom: 4px; }

/* Memory tiles: 3D flip */
.color-grid { perspective: 700px; }
.mem-tile.lit { animation: flipin .35s cubic-bezier(.3, .7, .4, 1.3); }
@keyframes flipin { from { transform: rotateY(180deg) scale(.9); } to { transform: rotateY(0) scale(1.04); } }
.mem-tile.ok { animation: flipin .3s ease-out; box-shadow: 0 0 16px var(--purple); }
.mem-tile.bad { animation: shake .3s ease-in-out; }
.seq-progress { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 14px; }
.seq-progress i { width: 12px; height: 12px; border-radius: 50%; background: var(--surface-3); transition: background .15s, transform .15s; }
.seq-progress i.on { background: var(--c); transform: scale(1.25); box-shadow: 0 0 10px var(--c); }
.t-sequence .mem-tile.lit, .t-sequence .mem-tile.ok { background: var(--c); box-shadow: 0 0 22px var(--c); }

/* Pitch: sound rings around the playing note, gap meter */
.note { position: relative; }
.note.playing { background: var(--c); box-shadow: 0 0 30px var(--c); }
.note.playing::before, .note.playing::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid var(--c); animation: soundring .9s ease-out infinite; }
.note.playing::after { animation-delay: .3s; }
@keyframes soundring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
.gap-meter { width: min(320px, 90%); }
.gap-meter .bar { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.gap-meter .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--c), #fff); border-radius: inherit; transition: width .5s cubic-bezier(.3,.7,.4,1.2); }
.gap-meter small { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* Rhythm / beat: tap ripples, timelines, metronome */
.tap-pad { position: relative; overflow: hidden; }
.tap-ripple { position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: rgba(255,255,255,.45); pointer-events: none; animation: tapripple .5s ease-out forwards; }
@keyframes tapripple { to { transform: scale(9); opacity: 0; } }
.timeline { width: min(460px, 100%); display: grid; gap: 8px; }
.timeline .row { position: relative; height: 26px; border-radius: 99px; background: var(--surface-2); }
.timeline .row b { position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); font: 700 .75rem/1 var(--font-body); color: var(--muted); white-space: nowrap; }
.timeline .mk { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; animation: popin .3s cubic-bezier(.3,.7,.4,1.6) both; }
.timeline .mk.target { background: var(--text); }
.timeline .mk.you { background: var(--c); box-shadow: 0 0 10px var(--c); }
.timeline-wrap { padding-left: 46px; width: min(506px, 100%); }
.metronome { width: 110px; height: 120px; }
.metronome .arm { transform-origin: 55px 100px; transform: rotate(0); }
.metronome.swing .arm { animation: swing 1.2s ease-in-out infinite; }
@keyframes swing { 0%, 100% { transform: rotate(-26deg); } 50% { transform: rotate(26deg); } }

/* Count: dots pop in fast; reveal number */
.dot-field i { animation: popin .12s ease-out both; }
.count-reveal { font: 800 3.4rem/1 var(--font-head); color: var(--c); text-shadow: 0 0 24px var(--c); }

/* Focus / math */
.word-tile { transition: box-shadow .15s; }
.word-tile.good { box-shadow: 0 0 0 4px var(--green), 0 0 26px var(--green); }
.word-tile.bad { box-shadow: 0 0 0 4px var(--coral), 0 0 26px var(--coral); }
.timebar.urgent span { background: var(--coral); }
.timebar.urgent { animation: fxpop .5s ease-in-out infinite; }
.math-q.fly { animation: flyout .3s ease-in forwards; }
.math-q.in { animation: popin .3s cubic-bezier(.3,.7,.4,1.6) both; }
@keyframes flyout { to { transform: translateY(-50px) scale(.7); opacity: 0; } }

/* Inner Clock: dial + result gauge */
.dial { width: 190px; height: 190px; }
.dial .track { fill: none; stroke: var(--surface-3); stroke-width: 12; }
.dial .prog { fill: none; stroke: var(--c); stroke-width: 12; stroke-linecap: round; filter: drop-shadow(0 0 8px var(--c)); }
.dial .face { fill: var(--surface-2); }
.dial text { font: 800 34px var(--font-head); fill: var(--text); }
.dial.hidden-time .prog { stroke: var(--muted); opacity: .3; filter: none; }
.dial.hidden-time { animation: fxpop 1.2s ease-in-out infinite; }
.gauge { position: relative; width: min(420px, 100%); height: 56px; }
.gauge .line { position: absolute; left: 0; right: 0; top: 20px; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--coral), var(--yellow) 35%, var(--green) 50%, var(--yellow) 65%, var(--coral)); }
.gauge .tgt { position: absolute; left: 50%; top: 8px; width: 3px; height: 30px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.gauge .you { position: absolute; top: 12px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: var(--c); box-shadow: 0 0 14px var(--c); transition: left .9s cubic-bezier(.3, .7, .4, 1.2); }
.gauge small { position: absolute; top: 40px; font-size: .75rem; color: var(--muted); }
