/* Lesson fun layer: tap board, hit effects, step stars, lesson-clear card. Only transform and opacity move. Orange = the beat that sounds now and the pad you press. */
:root {
  --fx-perfect: #4cc38a; --fx-good: #8fb4e8; --fx-miss: #ff8a8e;
}
.fun-layer { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.fun-layer > i { position: absolute; font-style: normal; will-change: transform, opacity; }
.fun-ripple { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--fx-good); }
.fun-spark { width: 8px; height: 8px; border-radius: 50%; background: var(--fx-good); }
.fun-word { font: 800 1.5rem/1 var(--font-display); letter-spacing: .02em; white-space: nowrap; text-shadow: 0 2px 0 oklch(0 0 0 / .45); }
.v-perfect.fun-ripple { border-color: var(--fx-perfect); } .v-perfect.fun-spark { background: var(--fx-perfect); } .v-perfect.fun-word { color: var(--fx-perfect); font-size: 1.9rem; }
.v-good.fun-ripple { border-color: var(--fx-good); } .v-good.fun-spark { background: var(--fx-good); } .v-good.fun-word { color: var(--fx-good); }
.v-miss.fun-ripple { border-color: var(--fx-miss); } .v-miss.fun-spark { background: var(--fx-miss); } .v-miss.fun-word { color: var(--fx-miss); font-size: 1.2rem; }
.v-pad.fun-ripple { border-color: var(--accent); } .v-pad.fun-spark { background: var(--accent); }

/* the board fills the whole row of the controls */
.fun-board { flex: 1 1 100%; display: grid; gap: var(--sp-3, 12px); min-width: 0; }
.fun-board > * { margin: 0; }

/* count-in: big 3 · 2 · 1 · Go in the middle of the screen (wherever the board is scrolled), one per click (tap-player.js); presses still reach the pad */
.fun-count { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; pointer-events: none; background: color-mix(in srgb, var(--bg, #111) 45%, transparent); }
.fun-count[hidden] { display: none; }
.fun-count-n { font-size: clamp(4.5rem, 22vw, 9rem); font-weight: 800; line-height: 1; color: var(--accent, #f28c45); text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.fun-count-n.pop { animation: fun-count-pop 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes fun-count-pop { from { transform: scale(1.35); opacity: 0.3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fun-count-n.pop { animation: none; } }

/* beat lamps: a row, one per beat; the sounding beat is lit orange */
.fun-lamps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fun-lamp { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0; border: 0; border-radius: 10px; background: var(--surface-3); color: var(--muted); box-shadow: inset 0 1px 0 oklch(1 0 0 / .05); font: inherit; touch-action: manipulation; }
.fun-lamp.down { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--text) 18%, transparent); }
.fun-lamp-n { position: absolute; top: 3px; left: 7px; font-size: .7rem; opacity: .7; }
.fun-lamp-dot { font-size: 1.3rem; line-height: 1; color: var(--accent); }
.fun-lamp.mark { outline: 2px solid color-mix(in oklab, var(--accent) 60%, transparent); outline-offset: -2px; }
.fun-lamp.lit .fun-lamp-dot { color: var(--on-accent); }
.fun-lamp.lit { background: var(--accent); box-shadow: 0 0 10px color-mix(in oklab, var(--accent) 70%, transparent); }

.fun-hud { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4, 16px); }
.fun-combo { margin: 0; display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.fun-combo small { font-size: .8rem; }
.fun-combo-n { display: inline-block; min-width: 2ch; font-size: 1.7rem; font-weight: 700; color: var(--text); transform-origin: left center; }
.fun-combo.hot .fun-combo-n { color: var(--fx-perfect); }
.fun-need { margin: 0; font-size: .8rem; color: var(--muted); }
.fun-xp { height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-3); }
.fun-xp-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--fx-perfect); transform: scaleX(0); transform-origin: left center; transition: transform 260ms var(--ease-out, ease-out); }
.fun-xp.full .fun-xp-fill { background: var(--fx-perfect); }

/* the pad: big, instant, never delayed by the browser */
.fun-pad { position: relative; width: 100%; min-height: 148px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; font-size: 1rem; transition: none; }
.fun-pad-dot { font-size: 2rem; line-height: 1; }
.fun-pad-label { font: 600 .85rem/1 var(--font-display); opacity: .85; }
.fun-flash { position: absolute; inset: 0; border-radius: inherit; opacity: 0; pointer-events: none; background: var(--fx-good); }
[data-fun-lesson] .hd-controls .btn { position: relative; }
.fun-flash.v-perfect { background: var(--fx-perfect); } .fun-flash.v-good { background: var(--fx-good); } .fun-flash.v-miss { background: var(--fx-miss); } .fun-flash.v-pad { background: oklch(1 0 0 / .55); }
.fun-pad.is-live { box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 60%, transparent); }
.fun-pad:active { transform: none; }
.fun-start { justify-self: start; }

/* cleared step */
.fun-clear { display: flex; align-items: center; gap: var(--sp-4, 16px); margin: var(--sp-4, 16px) 0 0; }
.fun-clear-word { font: 800 1.35rem/1 var(--font-display); color: var(--fx-perfect); }
.fun-clear-xp { font-size: .85rem; color: var(--muted); }
.fun-stars { display: inline-flex; gap: 4px; }
.fun-star { font-style: normal; font-size: 1.7rem; line-height: 1; color: color-mix(in oklab, var(--surface-3) 80%, var(--accent) 6%); }
.fun-star.on { color: var(--accent); text-shadow: 0 0 10px color-mix(in oklab, var(--accent) 55%, transparent); }

/* lesson-clear card */
.fun-extra { display: block; }
.fun-card { margin: var(--sp-4, 16px) 0; padding: var(--sp-5, 24px); border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 1px 0 oklch(1 0 0 / .06); }
.fun-card-title { margin: 0 0 var(--sp-3, 12px); font-size: 1.1rem; }
.fun-card .fun-stars { margin: 0 0 var(--sp-4, 16px); } .fun-card .fun-star { font-size: 2.4rem; }
.fun-xp-lesson { height: 12px; }
.fun-stats.n2 { grid-template-columns: repeat(2, 1fr); }
.fun-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3, 12px); margin: 0 0 var(--sp-4, 16px); }
.fun-stat { margin: 0; display: grid; gap: 4px; } .fun-stat small { color: var(--muted); font-size: .75rem; } .fun-stat b { font-size: 1.3rem; }
.fun-retry { display: block; width: auto; min-height: 44px; margin: 0 auto; padding: 0 var(--sp-4, 16px); background: transparent; border: 0; box-shadow: none; color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.fun-retry:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) { .fun-xp-fill { transition: none; } .fun-layer > i { will-change: auto; } }
.hd-hint:empty { display: none; }

/* harmony play-to-hear pads (lesson steps) and chord strip pads (Chord Lab) */
.hk-blocks { display: grid; gap: var(--sp-4, 16px); flex: 1 1 100%; }
.hk-pads-help { margin: 0; color: var(--muted); font-size: .9rem; }
.hk-block { display: grid; gap: var(--sp-2, 8px); }
.hk-block-label { margin: 0; font-weight: 600; }
.hk-pads { display: flex; flex-wrap: wrap; gap: var(--sp-2, 8px); }
.hk-pad { position: relative; flex: 1 1 56px; min-height: 64px; min-width: 56px; padding: 0 var(--sp-2, 8px); font: 600 .95rem var(--mono); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.hk-pad.is-next, .cl-chord.is-next { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 14px color-mix(in oklab, var(--accent) 55%, transparent); }
.hk-block.is-played .hk-pad { border-color: var(--fx-perfect); }
.cl-chord[role="button"] { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; min-height: 56px; }
