:root {
  --bg: #0b0e17; --panel: #131828; --panel2: #1a2136; --line: #263050; --text: #e8ecf8; --muted: #8a94b4;
  --accent: #5be37d; --warn: #ffd93c; --bad: #ff5c6c;
  --c-weak: #ff5c6c; --c-learn: #5be37d; --c-exp: #3cd6ff; --c-forget: #ffd93c; --c-fresh: #e056ff;
  --u: 44px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 "Segoe UI", system-ui, sans-serif; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: #3a4a7a; }
button.primary { background: linear-gradient(180deg, #3fd163, #26a548); border-color: #2fbd55; color: #04210e; font-weight: 700; }
button.danger { color: var(--bad); }
select, input[type=number] { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
input[type=number] { width: 60px; }
kbd { background: var(--panel2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; }
h3, h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; gap: 22px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 18px; letter-spacing: .02em; }
.stat { display: flex; flex-direction: column; min-width: 64px; }
.stat label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--warn); font-weight: 700; }
.spacer { flex: 1; }
.badge { font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.badge.ok { color: var(--accent); border-color: #2c6a3e; }

main { display: grid; gap: 14px; padding: 14px 18px; grid-template-columns: minmax(520px, 1.1fr) minmax(360px, 1fr); max-width: 1500px; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; position: relative; min-width: 0; }
.kbd, .analysis { grid-column: 1 / -1; }
.play { padding: 0; overflow: hidden; background: #070a12; }
#highway { display: block; width: 100%; height: 480px; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: rgba(7,10,18,.78); padding: 20px; }
.overlay.hidden { display: none; }
.overlay h2 { margin: 0 0 8px; font-size: 30px; }
.overlay p { color: var(--muted); max-width: 420px; }

.side svg { width: 100%; max-height: 210px; }
.fingerName { text-align: center; font-size: 18px; font-weight: 700; margin: 2px 0 12px; min-height: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chip { min-width: 26px; text-align: center; padding: 2px 6px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; text-transform: uppercase; }
.chip.new { border-color: var(--accent); color: var(--accent); }
.levelProg { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.levelProg .p { display: flex; align-items: center; gap: 4px; }
.levelProg .bar { width: 46px; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.levelProg .bar i { display: block; height: 100%; background: var(--accent); }
.mastery { font-size: 12px; margin-bottom: 12px; }
.mrow { display: grid; grid-template-columns: 78px 70px 1fr; gap: 8px; align-items: center; padding: 3px 0; }
.mrow .bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.mrow .bar i { display: block; height: 100%; }
.mrow span:last-child { color: var(--muted); }
.mnote { color: var(--muted); margin-top: 6px; line-height: 1.35; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 13px; color: var(--muted); }
.controls label { display: flex; align-items: center; gap: 6px; }

#hands .fing { fill: #232c47; stroke: #34406a; stroke-width: 1.5; transition: fill .12s, filter .12s; }
#hands .palm { fill: #1b2340; stroke: #2c3860; stroke-width: 1.5; }
#hands .fing.on { filter: drop-shadow(0 0 8px var(--fc)); fill: var(--fc); stroke: #fff; }

.kbHead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.kbHead h3 { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 4px 12px; }
.seg button.on { background: var(--panel2); color: var(--accent); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.kb { position: relative; margin: 0 auto; }
.key { position: absolute; border-radius: 7px; background: #1c2440; border: 1px solid #2c3860; border-bottom: 3px solid var(--fc, #2c3860);
  color: #cdd6f5; text-align: center; transition: background .15s, transform .08s; user-select: none; }
.key .b { position: absolute; left: 0; right: 0; bottom: 26%; font-weight: 700; font-size: calc(var(--u) * .36); text-transform: uppercase; }
.key.wide .b { font-size: calc(var(--u) * .26); font-weight: 600; text-transform: none; color: #8a94b4; }
.key .s { position: absolute; left: 6px; top: 3px; font-size: calc(var(--u) * .24); color: #8a94b4; }
.key .a { position: absolute; right: 5px; top: 3px; font-size: calc(var(--u) * .22); color: #6b76a0; }
.key.home::after { content: ""; position: absolute; left: 38%; right: 38%; bottom: 7px; height: 2px; background: #8a94b4; border-radius: 1px; }
.key.dim { opacity: .45; }
.key.fingerTint { background: color-mix(in srgb, var(--fc) 14%, #1c2440); }
.key.next { background: var(--fc); color: #07101f; transform: translateY(2px); box-shadow: 0 0 22px 4px var(--fc); border-color: #fff; z-index: 2; }
.key.next .s, .key.next .a { color: #07101f; }
.key.pressed { outline: 2px solid #fff; }
.key.bad { animation: shake .25s; background: var(--bad) !important; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); padding: 8px 14px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tab { display: none; }
.tab.on { display: block; }
.row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; color: var(--muted); }
.tableWrap { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 10px; text-align: right; border-bottom: 1px solid #1d2540; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; z-index: 1; }
td:first-child, th:first-child { text-align: left; font-family: Consolas, monospace; font-size: 15px; }
.pill { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.st-mastered { background: #17402a; color: #5be37d; }
.st-improving { background: #17383f; color: #3cd6ff; }
.st-regressing { background: #4a1d27; color: #ff8a98; }
.st-errors { background: #4a331a; color: #ffb35c; }
.st-slow { background: #3a3417; color: #ffd93c; }
.st-unseen { background: #232c47; color: #8a94b4; }
.stack { display: inline-flex; width: 90px; height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.stack i { display: block; height: 100%; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
canvas { width: 100%; }
.sessList { max-height: 170px; overflow: auto; font-size: 12px; color: var(--muted); }
.listRow { display: flex; align-items: center; gap: 10px; padding: 3px 0; border-bottom: 1px solid #1d2540; }
.listRow .nm { font-family: Consolas, monospace; font-size: 15px; width: 64px; color: var(--text); }
.listRow .grow { flex: 1; }
.barlegend { margin-top: 10px; font-size: 12px; color: var(--muted); }
.barlegend i { display: inline-block; width: 10px; height: 10px; margin: 0 4px 0 12px; border-radius: 2px; }
.footer { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 1000px) { main { grid-template-columns: 1fr; } .two { grid-template-columns: 1fr; } }
