/* =========================================================================
   KeyJourney — styles
   ========================================================================= */
:root {
  --bg: #f5f6fb; --card: #ffffff; --ink: #1e293b; --muted: #64748b; --line: #e2e8f0;
  --brand: #4f46e5; --brand-2: #7c3aed; --accent: #f59e0b; --ok: #16a34a; --bad: #dc2626;
  --side: linear-gradient(180deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  --radius: 16px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 24px rgba(15,23,42,.06);
  --phase: #4f46e5;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 15.5px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 30px; letter-spacing: -.02em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
code { background: #eef2ff; padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.lead { font-size: 18px; }
.center { text-align: center; justify-content: center; }
.ok { color: var(--ok); } .no { color: var(--bad); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grad { background: linear-gradient(90deg, #6366f1, #ec4899, #f59e0b); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: 220px; background: var(--side); color: #fff; display: flex; flex-direction: column; padding: 18px 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 21px; margin: 0 6px 26px; }
.brand b { color: #fbbf24; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { color: #e0e7ff; padding: 11px 12px; border-radius: 12px; display: flex; gap: 12px; align-items: center; font-weight: 600; transition: background .15s; }
.nav a span { width: 24px; text-align: center; font-size: 18px; }
.nav a:hover { background: rgba(255,255,255,.08); }
.nav a.on { background: #fff; color: #312e81; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.side-foot { margin-top: auto; font-size: 12px; color: #a5b4fc; padding: 8px; }
.app { margin-left: 220px; min-height: 100vh; }
main { padding: 22px 28px 60px; max-width: 1240px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; gap: 18px; align-items: center; padding: 10px 28px; background: rgba(245,246,251,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.tb-ring { position: relative; width: 52px; height: 52px; }
.tb-ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.tb-ring circle { fill: none; stroke-width: 4; }
.tb-ring .bg { stroke: #e2e8f0; } .tb-ring .fg { stroke: #22c55e; stroke-linecap: round; transition: stroke-dasharray .5s; }
.tb-ring span { position: absolute; inset: 0; display: grid; place-content: center; font-weight: 800; font-size: 14px; text-align: center; line-height: 1; }
.tb-ring small { display: block; font-size: 9px; color: var(--muted); font-weight: 600; }
.tb-item { display: flex; align-items: baseline; gap: 5px; }
.tb-item b { font-size: 18px; } .tb-item small { color: var(--muted); }
.tb-level { min-width: 200px; }
.tb-level small { color: var(--muted); }
.xpbar { height: 7px; background: #e2e8f0; border-radius: 99px; overflow: hidden; margin: 3px 0; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #ec4899); border-radius: 99px; }
.tb-midi { margin-left: auto; font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; border: 1px solid #eef0f6; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .grid2 + .grid2 { margin-top: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.chip { display: inline-block; color: #fff; font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 99px; letter-spacing: .02em; vertical-align: middle; }

/* ---------- buttons & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 12px; font: inherit; font-weight: 650; cursor: pointer; transition: transform .08s, box-shadow .15s, background .15s; white-space: nowrap; }
.btn:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 24px; font-size: 17px; border-radius: 14px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.on { background: #eef2ff; border-color: #a5b4fc; color: #3730a3; }
.btn.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(99,102,241,.45); } 50% { box-shadow: 0 0 0 9px rgba(99,102,241,0); } }
input, select { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink); }
input[type=range] { padding: 0; accent-color: var(--brand); }
input[type=checkbox] { accent-color: var(--brand); width: 17px; height: 17px; }
label { display: flex; gap: 8px; align-items: center; }
.chk { gap: 6px; font-size: 14px; cursor: pointer; }
.seg { display: inline-flex; background: #eef0f6; padding: 4px; border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 650; color: #475569; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; }
.seg button.on { background: #fff; color: #312e81; box-shadow: 0 2px 6px rgba(15,23,42,.1); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.stars { color: #f59e0b; letter-spacing: 1px; font-size: 14px; white-space: nowrap; }
.stars.big { font-size: 40px; letter-spacing: 6px; }

/* ---------- keyboard ---------- */
.kb { position: relative; height: 180px; user-select: none; touch-action: none; background: #111827; border-radius: 10px 10px 12px 12px; padding: 0; box-shadow: 0 10px 30px rgba(15,23,42,.25), inset 0 6px 0 #1f2937; overflow: hidden; }
.kb-compact { height: 120px; }
.key { position: absolute; top: 0; cursor: pointer; transition: background .06s; }
.key.white { height: 100%; background: linear-gradient(180deg, #f8fafc 0%, #fff 75%, #e2e8f0 100%); border: 1px solid #94a3b8; border-top: 0; border-radius: 0 0 7px 7px; z-index: 1; }
.key.white.colored { background: linear-gradient(180deg, #fff 0%, #fff 60%, color-mix(in srgb, var(--kc) 30%, #fff) 100%); }
.key.black { height: 62%; background: linear-gradient(180deg, #1f2937 0%, #0b1220 100%); border-radius: 0 0 5px 5px; z-index: 2; box-shadow: 0 3px 4px rgba(0,0,0,.45), inset 0 -4px 0 #374151; }
.klabel { position: absolute; bottom: 7px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 700; color: #475569; pointer-events: none; }
.khint { position: absolute; top: 4px; left: 0; right: 0; text-align: center; font-size: 10px; color: #94a3b8; pointer-events: none; font-family: ui-monospace, monospace; }
.key.black .khint { color: #6b7280; top: auto; bottom: 6px; }
.kmark { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); min-width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; pointer-events: none; }
.kmark:empty { display: none; }
.key.black .kmark { bottom: 12px; min-width: 18px; height: 18px; font-size: 11px; }
.key.white.pressed { background: linear-gradient(180deg, #c7d2fe, #a5b4fc); }
.key.black.pressed { background: #4338ca; }
.key.target { background: linear-gradient(180deg, #fff7ed, #fde68a) !important; box-shadow: inset 0 0 0 3px #f59e0b; animation: glow 1s infinite alternate; }
.key.black.target { background: linear-gradient(180deg, #b45309, #f59e0b) !important; }
.key.target .kmark { background: #ea580c; }
@keyframes glow { to { box-shadow: inset 0 0 0 3px #f59e0b, 0 0 18px #fbbf24; } }
.key.demo { background: linear-gradient(180deg, #c7d2fe, #818cf8) !important; }
.key.demo .kmark { background: #3730a3; }
.key.lh { background: linear-gradient(180deg, #fed7aa, #fb923c) !important; }
.key.lh .kmark { background: #9a3412; }
.key.good { background: linear-gradient(180deg, #bbf7d0, #4ade80) !important; }
.key.good .kmark { background: #15803d; }
.key.bad { background: linear-gradient(180deg, #fecaca, #f87171) !important; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- staff ---------- */
.staff-svg { display: block; color: #1e293b; max-width: 100%; height: auto; }
.staff-svg .sl { stroke: #64748b; stroke-width: 1.1; }
.staff-svg .bl { stroke: #334155; stroke-width: 1.5; }
.staff-svg .ledger { stroke: #334155; stroke-width: 1.4; }
.staff-svg .head { fill: currentColor; stroke: currentColor; stroke-width: .5; }
.staff-svg .head.hollow { fill: #fff; stroke-width: 2; }
.staff-svg .stem { stroke: currentColor; stroke-width: 1.5; }
.staff-svg .flag, .staff-svg .tie { fill: none; stroke: currentColor; stroke-width: 2; }
.staff-svg .dot { fill: currentColor; }
.staff-svg .acc { fill: currentColor; font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", serif; }
.staff-svg .tsig { font: 900 26px Georgia, "Times New Roman", serif; text-anchor: middle; fill: currentColor; }
.staff-svg .mnum { font-size: 11px; fill: #94a3b8; }
.staff-svg .finger { font: 700 12px system-ui; text-anchor: middle; fill: #4338ca; }
.staff-svg .nname { font: 800 13px system-ui; text-anchor: middle; }
.staff-svg .trip { font: italic 700 12px Georgia, serif; text-anchor: middle; fill: currentColor; }
.staff-svg .ev { transition: opacity .2s; }
.staff-svg .ev.active { color: #f59e0b; }
.staff-svg .ev.active .head { stroke: #f59e0b !important; stroke-width: 3 !important; filter: drop-shadow(0 0 5px rgba(245,158,11,.9)); }
.staff-svg .ev.done { opacity: .35; }
.staff-svg .ev.okish { color: #0ea5e9; }
.staff-svg .ev.missed { color: #dc2626; }
.staff-svg .ev.missed .head { fill: #dc2626 !important; stroke: #dc2626 !important; }

/* ---------- toasts, modal, confetti ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #1e1b4b; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: tin .3s; max-width: 380px; }
.toast.xp { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.toast.badge { background: linear-gradient(135deg, #b45309, #f59e0b); }
.toast.warn { background: #9a3412; }
.toast.out { opacity: 0; transform: translateY(10px); transition: .5s; }
.tb-badge { font-size: 20px; }
@keyframes tin { from { opacity: 0; transform: translateY(14px); } }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 90; animation: fade .2s; padding: 16px; }
.modal { background: #fff; border-radius: 22px; padding: 30px; max-width: 520px; width: 100%; box-shadow: 0 30px 80px rgba(0,0,0,.35); animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: scale(.85); opacity: 0; } }
.result { text-align: center; }
.result .acc { font-size: 46px; font-weight: 900; color: var(--brand); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 110%; transform: rotate(720deg) translateX(60px); } }

/* ---------- welcome ---------- */
.welcome { max-width: 900px; margin: 10px auto; }
.wl-hero { display: flex; gap: 26px; align-items: center; margin-bottom: 20px; }
.wl-hero h1 { font-size: 40px; }
.wl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.wl-form { display: flex; flex-direction: column; gap: 14px; max-width: 620px; margin: 10px auto; }
.wl-form label { flex-direction: column; align-items: stretch; gap: 4px; font-weight: 650; }

/* ---------- today ---------- */
.hero { display: flex; justify-content: space-between; gap: 20px; align-items: center; background: linear-gradient(120deg, color-mix(in srgb, var(--phase) 16%, #fff), #fff 70%); border: 1px solid color-mix(in srgb, var(--phase) 25%, #fff); border-radius: 22px; padding: 24px 28px; margin-bottom: 18px; }
.hero h1 { margin-top: 10px; }
.track { display: inline-block; padding: 6px 12px; border-radius: 10px; font-size: 14px; }
.track.ok { background: #dcfce7; } .track.warn { background: #ffedd5; }
.session-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.timer { display: flex; gap: 12px; align-items: center; }
.timer .t { font: 800 28px ui-monospace, "Cascadia Mono", Menlo, monospace; color: #312e81; }
.blocks { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.block { display: grid; grid-template-columns: 56px 44px 1fr auto auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #fafbff; transition: .2s; }
.block .b-ch { grid-column: 3 / 4; font-size: 13.5px; color: #92400e; background: #fef3c7; padding: 6px 10px; border-radius: 8px; }
.block:has(.b-ch) { grid-template-columns: 56px 44px 1fr auto auto; grid-template-areas: "m i t a c" "m i ch a c"; }
.block:has(.b-ch) .b-min { grid-area: m; } .block:has(.b-ch) .b-icon { grid-area: i; } .block:has(.b-ch) .b-txt { grid-area: t; } .block:has(.b-ch) .b-ch { grid-area: ch; } .block:has(.b-ch) .btn { grid-area: a; } .block:has(.b-ch) .b-check { grid-area: c; }
.block.done { background: #f0fdf4; border-color: #bbf7d0; }
.b-min { font-size: 22px; font-weight: 800; color: var(--phase); text-align: center; line-height: 1; }
.b-min small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.b-icon { font-size: 28px; text-align: center; }
.b-txt b { display: block; } .b-txt small { color: var(--muted); }
.b-check { width: 32px; height: 32px; border-radius: 99px; border: 2px solid #cbd5e1; background: #fff; cursor: pointer; font-weight: 900; color: #fff; }
.block.done .b-check { background: var(--ok); border-color: var(--ok); }
.session-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.song-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.song-chip { background: #f1f5f9; padding: 8px 12px; border-radius: 12px; color: var(--ink); font-weight: 600; font-size: 14px; }
.song-chip:hover { background: #e0e7ff; }
.lesson-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; color: var(--ink); margin-bottom: 4px; }
.lesson-row:hover { background: #f1f5f9; }
.lesson-row .stars { margin-left: auto; }
.lesson-row small { display: block; color: var(--muted); }
.lesson-row.done > span:first-child { color: var(--ok); font-weight: 900; }
.lesson-row .num { width: 30px; height: 30px; border-radius: 99px; background: var(--phase); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.lesson-row.done .num { background: var(--ok); }

/* ---------- journey ---------- */
.phase { background: #fff; border-radius: 20px; padding: 18px; margin-bottom: 18px; border: 1px solid #eef0f6; box-shadow: var(--shadow); border-top: 6px solid var(--phase); }
.ph-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.ph-head p { margin: 0; color: var(--muted); }
.ph-icon { font-size: 34px; width: 58px; height: 58px; display: grid; place-items: center; background: color-mix(in srgb, var(--phase) 15%, #fff); border-radius: 16px; }
.weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.wk { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: #f8fafc; color: var(--ink); border: 2px solid transparent; transition: .15s; }
.wk:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.wk.cur { border-color: var(--phase); background: color-mix(in srgb, var(--phase) 9%, #fff); }
.wk.locked { opacity: .55; filter: grayscale(.6); }
.wk-n { width: 42px; height: 42px; border-radius: 12px; background: var(--phase); color: #fff; font-weight: 900; font-size: 18px; display: grid; place-items: center; flex: none; }
.wk.done .wk-n { background: linear-gradient(135deg, #f59e0b, #eab308); }
.wk-t { flex: 1; min-width: 0; }
.wk-t small { color: var(--muted); font-weight: 600; } .wk-t b { display: block; font-size: 14px; }
.wk-bar { height: 5px; background: #e2e8f0; border-radius: 9px; margin-top: 5px; overflow: hidden; }
.wk-bar i { display: block; height: 100%; background: var(--phase); }
.plan { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.plan-day { background: #f8fafc; border-radius: 12px; padding: 10px; font-size: 12.5px; }
.plan-day.done { background: #f0fdf4; }
.plan-day b { display: block; margin-bottom: 4px; color: var(--phase); }
.plan-day div { margin-bottom: 4px; } .plan-day span { color: var(--muted); font-weight: 700; }
.challenge-card { background: linear-gradient(120deg, #fffbeb, #fff); border-color: #fde68a; margin-top: 18px; }

/* ---------- lesson ---------- */
.lesson { max-width: 1060px; margin: 0 auto; }
.lesson-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.lh-title { flex: 1; } .lh-title h2 { margin: 4px 0 0; font-size: 24px; }
.lh-progress { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--phase); border-radius: 99px; transition: width .4s; }
.lesson-video { display: none; width: 100%; border-radius: 16px; margin-bottom: 14px; background: #000; max-height: 420px; }
.lesson-video.show { display: block; }
.step-card { background: #fff; border-radius: 22px; padding: 28px; box-shadow: var(--shadow); border: 1px solid #eef0f6; min-height: 380px; animation: stepin .3s; }
@keyframes stepin { from { opacity: 0; transform: translateY(8px); } }
.step-card h3 { font-size: 23px; color: #1e1b4b; }
.txt { font-size: 17px; line-height: 1.65; margin-bottom: 14px; }
.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center; }
.vis { min-width: 0; }
.ill-box { background: linear-gradient(160deg, #f8fafc, #eef2ff); border-radius: 18px; padding: 16px; }
.ill-box.center { display: grid; place-items: center; min-height: 240px; }
.ill { width: 100%; height: auto; display: block; }
.ill .pulse { animation: beatp 2s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes beatp { 0%, 20% { transform: scale(1.25); } 40%, 100% { transform: scale(1); } }
.tip { background: #fffbeb; border: 1px solid #fde68a; padding: 12px 14px; border-radius: 12px; font-size: 15px; margin-bottom: 12px; }
.lesson-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 10px; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dots i { width: 10px; height: 10px; border-radius: 99px; background: #cbd5e1; }
.dots i.done { background: var(--phase); opacity: .5; } .dots i.cur { background: var(--phase); transform: scale(1.35); }
.video-frame { background: #0f172a; border-radius: 18px; padding: 12px; color: #e2e8f0; }
.vf-top { display: flex; justify-content: space-between; font-size: 13px; padding: 0 4px 10px; color: #94a3b8; }
.rec { color: #f87171; font-weight: 800; letter-spacing: .08em; }
.vf-staff { background: #fff; border-radius: 12px; padding: 8px; margin-bottom: 10px; max-height: 330px; overflow: auto; }
.vf-bar { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.vf-bar .chk { color: #cbd5e1; }
.vf-prog { flex: 1; height: 6px; background: #334155; border-radius: 9px; overflow: hidden; min-width: 120px; }
.vf-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #818cf8, #f472b6); }
.play-staff { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; margin-bottom: 10px; }
.play-status { display: flex; gap: 14px; align-items: center; margin: 8px 0 12px; flex-wrap: wrap; }
.ps-msg { font-size: 17px; font-weight: 650; color: #1e1b4b; }
.ps-score { color: var(--muted); font-weight: 700; }
.quiz { max-width: 720px; margin: 0 auto; text-align: center; }
.q-tag { display: inline-block; background: #eef2ff; color: #4338ca; font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 99px; margin-bottom: 10px; }
.q-vis { margin: 10px auto 14px; max-width: 560px; }
.mini-staff { max-width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.opt { padding: 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; transition: .12s; color: var(--ink); }
.opt:hover:not(.locked) { border-color: #a5b4fc; background: #eef2ff; transform: translateY(-2px); }
.opt.right { border-color: #22c55e; background: #dcfce7; }
.opt.wrong { border-color: #ef4444; background: #fee2e2; animation: shake .3s; }
.opt.locked { cursor: default; }
.explain { margin-top: 14px; min-height: 26px; font-size: 16px; }
.find-count { font-size: 18px; margin: 6px 0 14px; }
.tap-staff { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.tap-area { display: flex; gap: 22px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.tap-pad { width: 170px; height: 120px; border-radius: 22px; background: linear-gradient(135deg, #f97316, #ec4899); color: #fff; font: 900 28px system-ui; display: grid; place-content: center; text-align: center; cursor: pointer; user-select: none; box-shadow: 0 10px 0 #9d174d; transition: transform .05s, box-shadow .05s; position: relative; line-height: 1.1; }
.tap-pad small { font-size: 11px; font-weight: 600; opacity: .9; }
.tap-pad.big { width: 240px; height: 150px; }
.tap-pad.hit { transform: translateY(8px); box-shadow: 0 2px 0 #9d174d; }
.tap-pad.counting::after { content: attr(data-count); position: absolute; inset: 0; display: grid; place-items: center; font-size: 60px; background: rgba(30,27,75,.85); border-radius: 22px; }
.tap-score { font-size: 46px; font-weight: 900; color: var(--brand); }
.ear { text-align: center; max-width: 620px; margin: 0 auto; }
.ear-round { color: var(--muted); font-weight: 700; margin-bottom: 10px; }

/* ---------- song player ---------- */
.pl-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.pl-title { flex: 1; } .pl-title h2 { margin: 0; font-size: 26px; }
.pl-best { text-align: right; } .pl-best small { display: block; color: var(--muted); }
.pl-about { background: #f1f5f9; padding: 10px 14px; border-radius: 12px; margin: 12px 0; }
.pl-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tempo-ctl input { width: 110px; }
.pl-stage { display: grid; gap: 0; background: #fff; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.pl-sheet { max-height: 300px; overflow: auto; padding: 8px 14px; scroll-behavior: smooth; }
.pl-fall { position: relative; height: 260px; background: radial-gradient(ellipse at bottom, #312e81 0%, #0f172a 75%); }
.pl-fall canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pl-msg { position: absolute; top: 10px; left: 0; right: 0; text-align: center; color: #e0e7ff; font-size: 15px; pointer-events: none; }
.pl-stage[data-view=sheet] .pl-fall { display: none; }
.pl-stage[data-view=fall] .pl-sheet { display: none; }
.pl-stage[data-view=fall] .pl-fall { height: 380px; }
.pl-stage[data-view=sheet] .pl-sheet { max-height: 420px; }
.pl-kb .kb { border-radius: 0; }
.pl-bar { display: flex; gap: 16px; align-items: center; margin-top: 14px; }
.pl-prog { flex: 1; height: 10px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.pl-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #ec4899); }
.pl-live { min-width: 170px; font-weight: 650; text-align: right; }

/* ---------- songs & games grids ---------- */
.songs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.song-card { background: #fff; border-radius: 18px; padding: 14px; color: var(--ink); border: 1px solid #eef0f6; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; transition: .15s; border-top: 5px solid var(--lv); }
.song-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15,23,42,.12); }
.song-card.locked { opacity: .5; }
.sc-top { display: flex; justify-content: space-between; }
.lvl { font-size: 11px; font-weight: 800; color: var(--lv); text-transform: uppercase; letter-spacing: .06em; }
.sc-art { font-size: 40px; height: 76px; display: grid; place-items: center; background: color-mix(in srgb, var(--lv) 10%, #fff); border-radius: 12px; margin: 6px 0; }
.song-card small { color: var(--muted); font-size: 12.5px; }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.game-card { background: #fff; border-radius: 20px; padding: 20px; border: 1px solid #eef0f6; box-shadow: var(--shadow); border-top: 6px solid var(--gc); }
.gc-icon { font-size: 40px; width: 70px; height: 70px; display: grid; place-items: center; background: color-mix(in srgb, var(--gc) 14%, #fff); border-radius: 18px; margin-bottom: 8px; }
.gc-levels { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.gc-levels a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; color: var(--ink); background: #f8fafc; font-size: 14px; }
.gc-levels a:hover { background: color-mix(in srgb, var(--gc) 12%, #fff); }
.gc-levels b { width: 24px; height: 24px; border-radius: 8px; background: var(--gc); color: #fff; display: grid; place-items: center; font-size: 12px; }
.gc-levels em { margin-left: auto; color: #f59e0b; font-style: normal; }

/* ---------- game screens ---------- */
.game-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.gh-title { display: flex; gap: 12px; align-items: center; flex: 1; }
.gh-title h2 { margin: 0 0 4px; }
.gicon { font-size: 34px; } .gicon.huge { font-size: 80px; }
.hud { display: flex; gap: 10px; }
.hud div { background: #fff; border-radius: 14px; padding: 6px 16px; text-align: center; border: 1px solid var(--line); min-width: 84px; }
.hud small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.hud b { font-size: 22px; color: var(--gc); }
.game-body { background: #fff; border-radius: 22px; padding: 26px; box-shadow: var(--shadow); min-height: 420px; border-top: 6px solid var(--gc); }
.g-intro { text-align: center; max-width: 560px; margin: 20px auto; }
.ninja { text-align: center; }
.ninja-card { display: inline-block; background: linear-gradient(160deg, #eef2ff, #fff); border-radius: 22px; padding: 10px 40px; position: relative; }
.ninja-staff { width: 260px; margin: 0 auto; }
.ninja-staff.slash { animation: slash .35s; }
@keyframes slash { 0% { transform: scale(1); } 40% { transform: scale(1.15) rotate(-4deg); filter: drop-shadow(0 0 12px #22c55e); } 100% { transform: scale(1); } }
.combo { font-weight: 800; color: #ea580c; min-height: 24px; }
.letters { display: flex; gap: 10px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.letter { width: 66px; height: 66px; border-radius: 18px; border: 0; background: var(--lc); color: #fff; font: 900 28px system-ui; cursor: pointer; box-shadow: 0 6px 0 color-mix(in srgb, var(--lc) 60%, #000); transition: transform .05s; }
.letter:active { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--lc) 60%, #000); }
.finder { text-align: center; }
.prompt { font-size: 30px; font-weight: 700; margin-bottom: 4px; }
.prompt b { font-size: 54px; color: var(--gc); display: inline-block; min-width: 80px; }
.finder-kb { margin-top: 18px; }
.rr-staff { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.mem { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 12px; max-width: 760px; margin: 0 auto; }
.mem .card { padding: 0; margin: 0; border: 0; background: transparent; box-shadow: none; height: 118px; cursor: pointer; font: inherit; }
.mem .inner { position: relative; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.mem .card.flip .inner { transform: rotateY(180deg); }
.mem .back, .mem .front { position: absolute; inset: 0; border-radius: 16px; display: grid; place-items: center; backface-visibility: hidden; padding: 8px; }
.mem .back { background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; font-size: 40px; box-shadow: var(--shadow); }
.mem .front { background: #fff; transform: rotateY(180deg); border: 2px solid #ddd6fe; font-weight: 700; font-size: 14px; color: #1e1b4b; }
.mem .front .sym { width: 74px; height: 74px; }
.mem .card.matched .front { border-color: #22c55e; background: #f0fdf4; }

/* ---------- studio ---------- */
.studio-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.title-in { font-size: 20px; font-weight: 800; min-width: 220px; }
.studio-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.studio-tools .seg button { padding: 4px 10px; } .studio-tools .seg svg { width: 26px; height: 38px; }
.studio-tools .seg small { font-size: 11px; }
.studio-sheet { min-height: 200px; }
.print-title { display: none; }
.studio-kb { margin-bottom: 14px; }
.studio-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.comp { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.comp .muted { margin-right: auto; font-size: 13px; }

/* ---------- progress ---------- */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 16px; padding: 14px; text-align: center; box-shadow: var(--shadow); border: 1px solid #eef0f6; }
.stat b { display: block; font-size: 26px; color: var(--brand); }
.stat small { color: var(--muted); font-weight: 600; }
.skill { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 10px; font-weight: 600; }
.sbar { height: 12px; background: #eef0f6; border-radius: 99px; overflow: hidden; }
.sbar i { display: block; height: 100%; border-radius: 99px; }
.cal { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal-col { display: flex; flex-direction: column; gap: 3px; }
.cal i { width: 13px; height: 13px; border-radius: 3px; background: #eef0f6; }
.cal .c1 { background: #c7d2fe; } .cal .c2 { background: #818cf8; } .cal .c3 { background: #6366f1; } .cal .c4 { background: #3730a3; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 12px; border-radius: 16px; background: #f8fafc; opacity: .45; filter: grayscale(1); }
.badge.got { opacity: 1; filter: none; background: linear-gradient(160deg, #fffbeb, #fff); border: 1px solid #fde68a; }
.b-ic { font-size: 34px; }
.badge b { display: block; font-size: 14px; } .badge small { color: var(--muted); font-size: 12px; }
.settings { display: flex; flex-direction: column; gap: 12px; }
.settings h3 { margin-top: 8px; }

/* ---------- certificate ---------- */
.cert-wrap { max-width: 900px; margin: 0 auto; }
.cert { position: relative; background: linear-gradient(160deg, #fffbeb, #fff 40%, #eef2ff); padding: 50px; text-align: center; border-radius: 10px; box-shadow: var(--shadow); margin-bottom: 18px; }
.cert-border { position: absolute; inset: 14px; border: 3px double #b45309; border-radius: 6px; pointer-events: none; }
.cert h1 { font-family: Georgia, serif; font-size: 40px; color: #78350f; }
.cert h2 { font-family: Georgia, serif; font-size: 44px; color: #312e81; border-bottom: 2px solid #f59e0b; display: inline-block; padding: 0 30px 6px; }
.cert-stats { display: flex; justify-content: center; gap: 30px; margin: 20px 0; }
.cert-stats b { display: block; font-size: 30px; color: #4338ca; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .weeks { grid-template-columns: repeat(2, 1fr); } .stats { grid-template-columns: repeat(3, 1fr); } .plan { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px) {
  .side { position: static; width: auto; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto; }
  .brand { margin: 0 12px 0 0; } .side-foot { display: none; }
  .nav { flex-direction: row; } .nav a { padding: 8px 10px; }
  .app { margin-left: 0; }
  main { padding: 16px; }
  .grid2, .split, .wl-grid { grid-template-columns: 1fr; }
  .tb-midi { display: none; }
}
@media (max-width: 600px) { .weeks, .opts { grid-template-columns: 1fr; } .block { grid-template-columns: 44px 1fr auto; } .b-icon { display: none; } .stats { grid-template-columns: repeat(2, 1fr); } .plan { grid-template-columns: repeat(2, 1fr); } }

/* ---------- print (sheet music & certificate) ---------- */
@media print {
  .side, .topbar, #toasts, .studio-top, .studio-tools, .studio-kb, .studio-actions, .studio > .card:last-child, .page-head, .noprint { display: none !important; }
  .app { margin: 0; } main { padding: 0; }
  .card { box-shadow: none; border: 0; }
  .print-title { display: block; text-align: center; font-family: Georgia, serif; }
  body { background: #fff; }
}
