/* Pianotes — warm, quiet, premium. Dark library + keyboard frame, paper-white score. */
:root {
  --bg: #efebe4;
  --surface: #ffffff;
  --paper: #fffdf8;
  --ink: #1f1d1a;
  --muted: #8a8378;
  --line: #e3ddd2;
  --line-strong: #d3cbbd;
  --accent: #23395d;        /* deep navy */
  --accent-soft: #e6ecf5;
  --gold: #c99a3e;
  --gold-soft: #f6ead0;
  --rec: #d64535;
  --hl: #3d74d6;
  --good: #2e9d55;
  --warn: #d69e2e;
  --bad: #c8372d;
  --side: #1c1b19;
  --side-2: #252421;
  --side-ink: #ece6da;
  --side-muted: #8f897e;
  --shadow-sm: 0 1px 2px rgba(30, 25, 15, .06);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); }
body { display: flex; flex-direction: column; overflow: hidden; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
select, input { font: inherit; color: var(--ink); }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: #fff; }

.app { flex: 1; display: flex; min-height: 0; }

/* ───────────── Library (dark sidebar) ───────────── */
.library {
  width: 248px; flex-shrink: 0; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; min-height: 0; padding: 18px 12px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: .01em; color: #f5efe3; }
.brand-mark { width: 26px; height: 26px; color: var(--gold); }
.new-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 4px 18px; padding: 10px 12px;
  border: 1px solid #3a3733; border-radius: 10px; background: var(--side-2); color: var(--side-ink); cursor: pointer;
  font-weight: 500; transition: background .15s, border-color .15s;
}
.new-btn span { color: var(--gold); font-size: 16px; line-height: 1; }
.new-btn:hover { background: #2e2c29; border-color: #4a4640; }
.lib-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); padding: 0 10px 8px; }
.lib-scroll { flex: 1; min-height: 0; overflow-y: auto; margin-bottom: 10px; }
.lib-section + .lib-section { margin-top: 14px; }
.lib-toggle { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; cursor: pointer; text-align: left; font-family: inherit; }
.lib-toggle:hover { color: var(--side-ink); }
.lib-chev { display: inline-block; font-size: 9px; transition: transform .15s; }
.lib-toggle[aria-expanded="false"] .lib-chev { transform: rotate(-90deg); }
.lib-private { margin-left: 4px; padding: 1px 6px; border: 1px solid #3a3733; border-radius: 999px; font-size: 9px; letter-spacing: .08em; color: var(--side-muted); }
.song-list { list-style: none; margin: 0; padding: 0 2px; }
.starter-list .lvl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); opacity: .8; padding: 8px 12px 3px; cursor: default; }
.starter-list .lvl:hover { background: none; }
.starter-list .s-tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: #3a3220; color: var(--gold); }
.song-list li {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 9px; cursor: pointer; color: #d9d3c7; transition: background .12s;
}
.song-list li:hover { background: #262421; }
.song-list li.active { background: #2f2c28; color: #fff; }
.song-list .s-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.song-list .s-meta { color: var(--side-muted); font-size: 11px; }
.song-list .s-del { visibility: hidden; border: 0; background: transparent; color: var(--side-muted); cursor: pointer; font-size: 11px; padding: 2px 5px; border-radius: 5px; }
.song-list li:hover .s-del { visibility: visible; }
.song-list .s-del:hover { color: #fff; background: #3a3632; }
.song-list .s-del.armed { visibility: visible; background: var(--rec); color: #fff; }
.song-list .empty { color: var(--side-muted); cursor: default; font-size: 13px; line-height: 1.5; }
.song-list .empty:hover { background: none; }
.lib-foot { position: relative; padding: 14px 4px 0; border-top: 1px solid #2e2c29; display: flex; flex-direction: column; gap: 8px; }
.lib-row { display: flex; gap: 6px; }
.lib-link { flex: 1; padding: 8px; border: 1px solid #36332f; border-radius: 9px; background: transparent; color: #cfc8bb; cursor: pointer; font-size: 13px; }
.lib-link:hover { background: #262421; color: #fff; }
.lib-legal { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11.5px; color: var(--side-muted); padding-top: 2px; }
.lib-legal a, .lib-text-btn { color: var(--side-muted); text-decoration: none; border: 0; background: none; padding: 0; font: inherit; cursor: pointer; }
.lib-legal a:hover, .lib-text-btn:hover { color: var(--side-ink); text-decoration: underline; }

/* ───────────── Guided tour ───────────── */
.tour-ring {
  position: fixed; z-index: 900; border-radius: 12px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--gold), 0 0 0 9999px rgba(20, 17, 12, .55); transition: all .25s ease;
}
.tour-ring.center { box-shadow: 0 0 0 9999px rgba(20, 17, 12, .55); }
.tour-card {
  position: fixed; z-index: 901; width: 320px; max-width: calc(100vw - 32px); padding: 18px 18px 14px; border-radius: 14px;
  background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.28); transition: top .25s ease, left .25s ease;
}
.tour-card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.tour-card p { margin: 0; font-size: 14px; line-height: 1.5; color: #3d3a35; }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-count { flex: 1; font-size: 12px; color: var(--muted); }
.tour-btn { border: 1px solid var(--line-strong); background: #fff; border-radius: 9px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.tour-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tour-skip { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.tour-skip:hover { color: var(--ink); text-decoration: underline; }

/* ───────────── Top bar ───────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 24px 6px; }
.title-input {
  font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: -.005em; color: var(--ink);
  border: 1px solid transparent; background: transparent; padding: 3px 8px; margin-left: -8px; border-radius: 8px; min-width: 260px; max-width: 58%;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--gold); background: #fff; }
.save-state { color: var(--muted); font-size: 12px; }
.save-state u { cursor: pointer; }
.account { display: flex; align-items: center; min-width: 28px; }
.sign-in-btn { padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.song-list .empty .lib-signin { display: block; margin-top: 6px; padding: 0; }
.pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.pill-off { background: #f5e7e2; color: #a2452f; border-color: #edd3ca; }
.pill-on { background: #e5f2e7; color: #2c6c3a; border-color: #cfe5d3; }
.pill-on::before { content: "●"; margin-right: 6px; font-size: 9px; vertical-align: 1px; }
.sound { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.sound svg { width: 16px; height: 16px; }
.sound select { border: 0; background: transparent; padding: 3px 6px; cursor: pointer; max-width: 210px; }
.sound select:focus { outline: none; }

/* ───────────── Transport ───────────── */
.transport {
  position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 8px 24px 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-sm);
}
.t-group { display: flex; align-items: center; gap: 10px; }
.t-options { gap: 10px; padding-left: 14px; border-left: 1px solid var(--line); }
.round {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(30,25,15,.08);
  transition: transform .08s, box-shadow .15s, background .15s;
}
.round:hover { box-shadow: 0 4px 12px rgba(30,25,15,.14); }
.round:active { transform: scale(.96); }
.round.rec .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 3px rgba(214,69,53,.15); }
.round.rec.on { background: var(--rec); border-color: var(--rec); animation: pulse 1.6s infinite; }
.round.rec.on .dot { background: #fff; border-radius: 3px; width: 14px; height: 14px; box-shadow: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(214,69,53,.45); } 50% { box-shadow: 0 0 0 8px rgba(214,69,53,0); } }
.round.play { background: var(--accent); border-color: var(--accent); }
.round.play .tri { width: 0; height: 0; margin-left: 3px; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.round.play.on .tri { margin: 0; border: 0; width: 13px; height: 13px; background: #fff; border-radius: 3px; }
.round-mini { width: 22px; height: 22px; margin-left: -8px; margin-right: 2px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 10px; cursor: pointer; }
.round-mini:hover { color: var(--ink); border-color: var(--line-strong); }
.clock-wrap { display: flex; flex-direction: column; gap: 1px; margin-left: 4px; min-width: 96px; }
.clock { font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 500; letter-spacing: .01em; color: var(--ink); }
.clock.live { color: var(--accent); }
.rec-status { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 15px; white-space: nowrap; }
.rec-status.live { color: var(--rec); font-weight: 500; }
.beat-viz { display: flex; gap: 5px; }
.beat-viz i { width: 8px; height: 8px; border-radius: 50%; background: #e2dccf; transition: background .05s; }
.beat-viz i.on { background: var(--accent); }
.beat-viz i.on.accent { background: var(--rec); }

.seg { display: inline-flex; padding: 3px; background: #f3f0ea; border: 1px solid var(--line); border-radius: 10px; }
.seg-btn { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 500; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(30,25,15,.12); }
.mini-select { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mini-select select, .mini-select input {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; font-size: 13px; cursor: pointer;
}
.tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 500; transition: background .12s, border-color .12s;
}
.tool svg { width: 17px; height: 17px; }
.tool:hover { border-color: var(--line-strong); background: #fbfaf7; }
.tool.on, .tool.on-edit { background: var(--accent); border-color: var(--accent); color: #fff; }
.split { display: inline-flex; }
.split > .tool:first-child { border-radius: 10px 0 0 10px; }
.tool-chev { padding: 9px 9px; margin-left: -1px; border-radius: 0 10px 10px 0; font-size: 10px; color: var(--muted); }
.split > .tool.on + .tool-chev { border-color: var(--accent); }
.transport > .labels-pop { left: auto; right: 210px; width: 290px; }
.pop-row { display: flex; padding: 5px 2px; }
.pop-note { margin: 8px 2px 2px; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* ───────────── Piece strip + popovers ───────────── */
.piece-strip { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 24px 0; }
.piece-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255,255,255,.6); color: #4a453d; cursor: pointer; font-size: 13px; font-weight: 500;
}
.piece-chip:hover { background: #fff; border-color: var(--line-strong); }
.piece-chip .chev { color: var(--muted); font-size: 10px; }
.toast {
  padding: 6px 12px; border-radius: 999px; background: var(--gold-soft); color: #6d5016; border: 1px solid #ecd9ae;
  font-size: 12.5px; font-weight: 500; animation: fadein .25s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.popover {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 16px; min-width: 280px; padding: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(30,25,15,.18);
  animation: fadein .15s ease;
}
.transport > .popover { left: 60px; }
.piece-strip > .popover { left: 24px; }
.pop-up { top: auto; bottom: calc(100% + 8px); left: 4px; right: 4px; min-width: 0; color: var(--ink); }
.pop-title { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 2px 10px; }
.pop-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pop-field select, .pop-field input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; font-size: 13px; }
.pop-field select:focus, .pop-field input:focus, .mini-select select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,154,62,.15); }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; min-width: 420px; }
.pop-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.pop-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.pop-check-cell { margin-top: 18px; }
.pop-sep { height: 1px; background: var(--line); margin: 10px 0; }
.pop-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 13px; font-weight: 500; }
.pop-item small { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-top: 1px; }
.pop-item:hover { background: #f4f1eb; }
.pop-item.danger { color: var(--bad); }
.bpm { display: inline-flex; align-items: center; gap: 6px; }
.bpm input { width: 84px; }
.bpm em { font-style: normal; color: var(--muted); }
.tempo-tools { display: inline-flex; gap: 5px; }
.chip-btn { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #faf8f4; cursor: pointer; font-size: 12.5px; font-weight: 500; }
.chip-btn:hover { background: #fff; border-color: var(--line-strong); }

/* ───────────── Score ───────────── */
.paper-wrap { position: relative; flex: 1; overflow-y: auto; padding: 14px 24px 28px; }
.paper {
  position: relative; background: var(--paper); border-radius: 6px; min-height: 100%;
  box-shadow: 0 0 0 1px rgba(30,25,15,.04), 0 2px 4px rgba(30,25,15,.04), 0 18px 40px rgba(30,25,15,.08);
  padding: 30px 22px 36px; cursor: default;
}
.score svg { display: block; }
.score svg .vf-stavenote.playing path, .score svg .vf-stavenote.playing { fill: var(--hl); stroke: var(--hl); }
.tint { position: absolute; background: rgba(214,69,53,.05); border-radius: 6px; pointer-events: none; }
.tint.play { background: rgba(61,116,214,.06); }
.start-mark { position: absolute; width: 0; border-left: 2px solid var(--accent); pointer-events: none; }
.start-mark::before { content: "▶"; position: absolute; top: -16px; left: -6px; font-size: 11px; color: var(--accent); }
.playhead { position: absolute; width: 2px; background: var(--rec); opacity: .55; pointer-events: none; border-radius: 1px; }
.hint { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: var(--muted); font-size: 13px; margin: 0; pointer-events: none; }
.score svg .sel path, .score svg .sel { fill: #c26a00; stroke: #c26a00; }
.selbar { position: absolute; background: rgba(201,154,62,.10); border: 1.5px solid rgba(201,154,62,.65); border-radius: 6px; pointer-events: none; }
.score svg .pr-good path, .score svg .pr-good { fill: var(--good); stroke: var(--good); }
.score svg .pr-ok path, .score svg .pr-ok { fill: var(--warn); stroke: var(--warn); }
.score svg .pr-bad path, .score svg .pr-bad { fill: var(--bad); stroke: var(--bad); }
.score svg .pr-next path, .score svg .pr-next { fill: var(--hl); stroke: var(--hl); }

/* ───────────── Edit toolbar (floating, dark) ───────────── */
.editbar {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 20; width: min(980px, calc(100% - 40px));
  padding: 10px 14px 9px; background: rgba(28, 27, 25, .96); color: #ece6da; border-radius: 14px;
  box-shadow: 0 14px 40px rgba(20,15,5,.35); backdrop-filter: blur(6px); animation: barin .15s ease;
}
@keyframes barin { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
.main.editing .paper-wrap { padding-bottom: 130px; }
.e-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.e-group { display: inline-flex; gap: 3px; align-items: center; }
.e-play { color: #9d968a; font-size: 12px; gap: 4px; margin-left: 2px; }
.e-sep { width: 1px; height: 20px; background: #3c3935; margin: 0 4px; }
.ebtn { padding: 5px 9px; border-radius: 7px; border: 1px solid #3b3834; background: #2a2825; color: #ece6da; cursor: pointer; font-size: 12.5px; }
.ebtn:hover { background: #36332f; border-color: #4b4741; }
.ebtn.danger:hover { background: #5a2a24; border-color: #7a3a32; }
.e-status { margin-top: 7px; font-size: 12px; color: #b6afa3; min-height: 16px; }

/* ───────────── Right-click menu ───────────── */
.ctx-menu { position: fixed; z-index: 60; min-width: 236px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(30,25,15,.2); padding: 5px; font-size: 13px; animation: fadein .1s ease; }
.ctx-menu button { display: flex; justify-content: space-between; gap: 18px; width: 100%; text-align: left; padding: 7px 11px; border: 0; border-radius: 7px; background: none; color: var(--ink); cursor: pointer; }
.ctx-menu button:hover:not(:disabled) { background: #f3efe8; }
.ctx-menu button:disabled { color: var(--muted); cursor: default; }
.ctx-menu kbd { border: 0; background: none; color: var(--muted); padding: 0; font-size: 12px; }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 6px; }
.ctx-head { padding: 6px 11px 4px; font-size: 11px; color: var(--muted); }

/* ───────────── Practice ───────────── */
.card { margin: 10px 24px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); }
.practice { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 14px; }
.practice .bars { display: inline-flex; align-items: center; gap: 5px; }
.practice .bars input { width: 56px; cursor: text; }
.practice .bars em { font-style: normal; color: var(--muted); }
.btn-primary { padding: 8px 18px; border: 0; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.12); }
.p-status { color: var(--muted); font-size: 12px; }
.p-summary { flex-basis: 100%; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; padding-top: 6px; border-top: 1px solid var(--line); }
.p-summary .score-big { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.p-summary .pill-good { color: var(--good); } .p-summary .pill-ok { color: #b07a12; } .p-summary .pill-bad { color: var(--bad); }
.p-summary details { flex-basis: 100%; color: var(--muted); }
.p-summary details li { margin: 2px 0; }
.trouble { border: 1px solid #e8b9b2; background: #fff4f2; color: #9b2c22; border-radius: 7px; padding: 3px 9px; cursor: pointer; font-size: 12px; }

/* ───────────── Keyboard ───────────── */
.keys-wrap {
  position: relative; padding: 0 14px 12px; background: linear-gradient(180deg, #1d1c1a, #121110);
  box-shadow: 0 -6px 20px rgba(20,15,5,.18);
}
.felt { height: 6px; margin: 0 -14px; background: linear-gradient(180deg, #8c2424, #5e1717); box-shadow: 0 2px 4px rgba(0,0,0,.4) inset; }
.keyboard { position: relative; height: 92px; display: flex; cursor: pointer; user-select: none; touch-action: none; }
.keyboard .w:hover { background: linear-gradient(180deg, #ece8e0 0%, #fbfaf6 30%, #f4f1ea 100%); }
.keyboard .b:hover { background: linear-gradient(180deg, #151515, #3a3a3a); }
.keyboard .pending { outline: 2px solid var(--gold); outline-offset: -3px; }
.keyboard .w.pending { background: linear-gradient(180deg, #f6e7c2, #fdf6e6); }
.keyboard .w {
  flex: 1; position: relative; margin-right: 1px; border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #f2efe9 0%, #ffffff 18%, #fbfaf6 88%, #e9e5dd 100%);
  box-shadow: 0 -1px 0 rgba(0,0,0,.3) inset, 0 3px 0 #cfcac0, 0 4px 5px rgba(0,0,0,.4);
  transition: background .06s;
}
.keyboard .w.c::after { content: attr(data-label); position: absolute; bottom: 7px; left: 0; right: 0; text-align: center; font-size: 8.5px; color: #a49d91; }
.keyboard .b {
  position: absolute; top: 0; height: 60%; z-index: 2; border-radius: 0 0 3px 3px;
  background: linear-gradient(180deg, #050505 0%, #2b2b2b 70%, #3a3a3a 92%, #1a1a1a 100%);
  box-shadow: 0 -1px 0 rgba(255,255,255,.08) inset, 0 3px 5px rgba(0,0,0,.6), 1px 0 0 rgba(255,255,255,.05) inset;
}
.keyboard .w.on { background: linear-gradient(180deg, #9cc0f5, #c9dcfa); box-shadow: 0 2px 0 #7fa3d9, 0 2px 4px rgba(0,0,0,.35); }
.keyboard .b.on { background: linear-gradient(180deg, #1d4f9e, #3b74d0); }
.keyboard .w.target { background: linear-gradient(180deg, #d5e5fb, #eef4fd); }
.keyboard .b.target { background: linear-gradient(180deg, #23467e, #4a7ac4); }
.keyboard .w.sel { background: linear-gradient(180deg, #f0cf7c, #fbe6b2); box-shadow: 0 2px 0 #c99a3e, 0 3px 8px rgba(201,154,62,.55); }
.keyboard .b.sel { background: linear-gradient(180deg, #8a6219, #d3a447); box-shadow: 0 3px 8px rgba(201,154,62,.6); }
.keyboard .sel[data-name]::before {
  content: attr(data-name); position: absolute; left: 50%; transform: translateX(-50%); z-index: 5; white-space: nowrap;
  bottom: calc(100% + 12px); padding: 3px 7px; border-radius: 6px; background: var(--gold); color: #241a07; font-size: 11px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.keyboard .w.good, .keyboard .b.good { background: #5fbf7f !important; }
.keyboard .w.ok, .keyboard .b.ok { background: #e7b45a !important; }
.keyboard .w.bad, .keyboard .b.bad { background: #e0655b !important; }
.keyboard .split { position: absolute; top: -6px; bottom: -4px; width: 2px; background: var(--gold); opacity: .8; z-index: 3; border-radius: 1px; }

/* ───────────── Exercises ───────────── */
.ex-btn { margin-top: -10px; }
.ex-btn span { font-size: 15px; }
.ex-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; background: var(--gold-soft); border: 1px solid #ecd9ae; border-radius: 999px; font-size: 12px; color: #6d5626; }
.ex-chip-tag { padding: 2px 9px; border-radius: 999px; background: var(--gold); color: #fff; font-weight: 600; font-size: 11px; letter-spacing: .04em; }
.ex-chip-btn { border: 0; background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-sm); }
.ex-chip-btn:hover { background: #fffaf0; }
.ex-overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(28, 27, 25, .38); backdrop-filter: blur(2px); padding: 24px; }
.ex-modal { width: min(920px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: 0 24px 60px rgba(20, 15, 5, .25); overflow: hidden; animation: exin .18s ease-out; }
@keyframes exin { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.ex-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 26px 16px; border-bottom: 1px solid var(--line); }
.ex-head h2 { margin: 0 0 4px; font-family: var(--serif); font-size: 24px; font-weight: 600; }
.ex-head p { margin: 0; color: var(--muted); font-size: 13px; max-width: 620px; }
.ex-close { margin-left: auto; border: 0; background: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.ex-close:hover { color: var(--ink); }
.ex-body { display: grid; grid-template-columns: 1fr 320px; min-height: 0; overflow: auto; }
.ex-list { padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.ex-card { text-align: left; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s, background .12s; }
.ex-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.ex-card.on { border-color: var(--accent); background: var(--accent-soft); }
.ex-card b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.ex-card small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.ex-card .ex-done { display: inline-block; margin-top: 7px; font-size: 11px; color: var(--good); font-weight: 600; }
.ex-card.featured { grid-column: 1 / -1; background: linear-gradient(135deg, #fbf4e3, #fff); border-color: #ecd9ae; }
.ex-card.featured.on { border-color: var(--gold); background: linear-gradient(135deg, #f6ead0, #fffaf0); }
.ex-options { padding: 18px 22px 22px; border-left: 1px solid var(--line); background: #fbfaf7; display: flex; flex-direction: column; gap: 10px; }
.ex-title { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.ex-blurb { margin: -4px 0 4px; color: var(--muted); font-size: 12.5px; }
.ex-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.ex-field select, .ex-field input { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; min-width: 170px; }
.ex-bpm { display: inline-flex; align-items: center; gap: 6px; }
.ex-bpm input { min-width: 0; width: 72px; }
.ex-today { margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.ex-today button { border: 0; background: none; color: var(--hl); cursor: pointer; padding: 0; font: inherit; }
.ex-history { font-size: 12px; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px dashed var(--line-strong); }
.ex-history b { color: var(--ink); }
.ex-start { margin-top: 4px; padding: 11px 18px; font-size: 14px; }
@media (max-width: 760px) { .ex-body { grid-template-columns: 1fr; } .ex-options { border-left: 0; border-top: 1px solid var(--line); } }
.ex-group { grid-column: 1 / -1; margin: 8px 2px -2px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ex-group:first-child { margin-top: 0; }
.ex-tip { margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--accent-soft); color: #2c3d5c; font-size: 12.5px; line-height: 1.4; }
.ex-tip::before { content: "Technique tip · "; font-weight: 600; }
.ex-ladder { font-size: 12.5px; color: var(--ink); }
.prange { position: absolute; pointer-events: none; background: rgba(61, 116, 214, .07); border-top: 3px solid rgba(61, 116, 214, .55); border-radius: 4px; }
/* keys sounding during playback: right hand blue, left hand teal */
.keyboard .w.play-r { background: linear-gradient(180deg, #8fb8f3, #c4dafa); box-shadow: 0 2px 0 #6f9bd8, 0 2px 4px rgba(0,0,0,.3); }
.keyboard .b.play-r { background: linear-gradient(180deg, #1d4f9e, #4f86dc); }
.keyboard .w.play-l { background: linear-gradient(180deg, #7fcfb3, #c2eadb); box-shadow: 0 2px 0 #5aae92, 0 2px 4px rgba(0,0,0,.3); }
.keyboard .b.play-l { background: linear-gradient(180deg, #17664f, #36a281); }

/* ───────────── Markings ───────────── */
.score svg [data-mark] { cursor: pointer; }
.score svg [data-mark]:hover text, .score svg [data-mark]:hover path { fill: var(--hl); stroke: var(--hl); }
.score svg [data-mark].mk-on text, .score svg [data-mark].mk-on path { fill: var(--hl); stroke: var(--hl); }
.mark-pop { position: fixed; z-index: 70; width: 330px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 44px rgba(30,25,15,.22); padding: 14px 16px 12px; font-size: 13px; animation: exin .14s ease-out; }
.mark-pop .mp-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.mark-pop .mp-sym { min-width: 44px; padding: 4px 8px; text-align: center; border-radius: 9px; background: var(--accent-soft); font: italic 700 20px "Times New Roman", serif; color: var(--accent); }
.mark-pop .mp-head b { display: block; font-size: 15px; }
.mark-pop .mp-head small { color: var(--muted); }
.mark-pop p { margin: 6px 0; line-height: 1.45; }
.mark-pop .mp-how { color: #3c3a35; }
.mark-pop .mp-ctx { padding: 8px 10px; border-radius: 9px; background: #f6f3ec; color: #4d473d; }
.mark-pop .mp-part { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.mark-pop ul { margin: 6px 0; padding-left: 0; list-style: none; }
.mark-pop li { padding: 5px 0; border-bottom: 1px dashed var(--line); line-height: 1.4; }
.mark-pop li:last-child { border-bottom: 0; }
.mark-pop li b { font-weight: 600; }
.mark-pop .mp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mark-pop .mp-actions button { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font-size: 12.5px; }
.mark-pop .mp-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mark-pop .mp-actions button.danger { color: var(--bad); margin-left: auto; }
.mark-pop .mp-close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.mark-pop .mp-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mark-pop .mp-picker button { min-width: 46px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font: italic 700 16px "Times New Roman", serif; }
.mark-pop .mp-picker button:hover { background: var(--accent-soft); }
.mark-pop .mp-select { width: 100%; margin: 8px 0 2px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; font: inherit; }
.mark-pop input[type=text] { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; font: italic 15px "Times New Roman", serif; }
.marks-panel { position: fixed; z-index: 55; top: 150px; right: 16px; bottom: 120px; width: 330px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px rgba(30,25,15,.18); animation: exin .16s ease-out; }
.marks-panel .mk-head { display: flex; align-items: flex-start; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.marks-panel h3 { margin: 0; font-family: var(--serif); font-size: 19px; }
.marks-panel .mk-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.mk-list { flex: 1; overflow-y: auto; padding: 6px 8px; }
.mk-row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; width: 100%; text-align: left; padding: 8px; border: 0; border-radius: 9px; background: none; cursor: pointer; align-items: baseline; }
.mk-row:hover { background: #f4f1eb; }
.mk-row .mk-bar { font-size: 11.5px; color: var(--muted); }
.mk-row .mk-v { font: italic 700 15px "Times New Roman", serif; }
.mk-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.mk-group { margin: 10px 8px 2px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mk-empty { padding: 18px; color: var(--muted); font-size: 13px; }
.mk-foot { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 1560px) {
  .transport .tool { padding-left: 8px; padding-right: 8px; }
  .t-options { gap: 8px; }
  .transport { column-gap: 8px; }
}

/* ───────────── View: focus mode, keyboard size, score size ───────────── */
.view-pop { right: 24px; left: auto !important; width: 330px; }
.view-focus { width: 100%; padding: 10px; }
.view-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.view-row .seg-btn { padding: 5px 10px; }

/* Keyboard: compact keeps a thin strip that still lights up; hidden gives the music the room. */
body[data-keyboard="compact"] .keyboard { height: 36px; }
body[data-keyboard="compact"] .keyboard .w.c::after,
body[data-keyboard="compact"] .keyboard .sel[data-name]::before { display: none; }
body[data-keyboard="hidden"] .keys-wrap { display: none; }

/* With the keyboard hidden, practice hints name the notes to play instead of lighting keys. */
.hint-chip {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30;
  padding: 8px 16px; border-radius: 999px; background: var(--hl); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 6px 20px rgba(61, 116, 214, .35); pointer-events: none;
}
.hint-chip small { font-weight: 500; opacity: .8; margin-right: 6px; }

/* Focus mode: only the music and the play controls. */
.focus-exit {
  display: none; position: absolute; top: 10px; right: 24px; z-index: 40; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
  transition: opacity .4s;
}
.focus-exit:hover { color: var(--ink); }
body.focus .library, body.focus .topbar, body.focus .piece-strip { display: none; }
body.focus .focus-exit { display: block; }
body.focus .transport { margin-top: 10px; margin-right: 150px; transition: opacity .4s; }
body.focus.focus-idle .transport, body.focus.focus-idle .focus-exit { opacity: .12; }
body.focus.focus-idle .transport:hover, body.focus.focus-idle .focus-exit:hover { opacity: 1; }

/* Import: what can be opened, before choosing a file */
.import-pop { right: auto; width: 340px; z-index: 60; }
.imp-lead { margin: 0 2px 6px; font-size: 13px; color: var(--muted); }
.imp-types { list-style: none; margin: 0; padding: 0; }
.imp-types li { padding: 7px 2px; border-top: 1px solid var(--line); font-size: 13px; }
.imp-types code { font: 11.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f3f0ea; border-radius: 4px; padding: 1px 4px; margin-left: 2px; }
.imp-types small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.imp-no { margin: 8px 2px 12px; padding: 8px 10px; border-radius: 8px; background: #fbf1e1; font-size: 12px; line-height: 1.45; color: #6d5626; }
.imp-choose { width: 100%; padding: 10px; }

/* Drill: a few bars on their own, over and over */
body.drilling .library, body.drilling .topbar, body.drilling .piece-strip, body.drilling .transport, body.drilling #practiceBar { display: none; }
body.drilling .paper { margin: 0 auto; min-height: 0; }
body.drilling .paper-wrap { padding-top: 24px; }
.drill { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; }
.drill-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drill-head b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.drill-title { color: var(--muted); font-size: 13px; }
.drill-tag { padding: 2px 9px; border-radius: 999px; background: #e3f3e8; color: #24693b; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.drill-back { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.drill-back:hover { background: #f3efe8; }
.drill-save { margin-left: auto; }
.drill-save.saved { color: #8a6210; background: var(--gold-soft); border-color: #ecd9ae; }
.drill-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.drill-speed { display: inline-flex; align-items: center; gap: 4px; }
.drill-speed b { min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.drill-speed .tool { padding: 4px 10px; }
.drill-score { font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }
.drill-streak b { display: inline-block; font-family: var(--serif); font-size: 24px; color: var(--good); margin-right: 3px; vertical-align: -3px; }
.drill-streak b.pop { animation: drill-pop .5s ease-out; }
@keyframes drill-pop { 40% { transform: scale(1.45); } }
.drill-dots { display: inline-flex; gap: 4px; }
.drill-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.drill-dots i.on { background: var(--good); }
.drill-best { color: var(--muted); }
.drill-last .pill-good { color: var(--good); font-weight: 600; }
.p-drills { flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }
.p-drills-lbl { color: var(--muted); }
.drill-chip { display: inline-flex; align-items: center; border: 1px solid #bfe0c9; background: #f1faf3; border-radius: 999px; overflow: hidden; }
.drill-chip button { border: 0; background: none; font: inherit; font-size: 12px; cursor: pointer; color: #24693b; padding: 4px 4px 4px 10px; }
.drill-chip .dc-del { padding: 4px 9px 4px 4px; color: var(--muted); }
.drill-chip .dc-open:hover { text-decoration: underline; }
.drill-chip .dc-del:hover { color: var(--bad); }

/* Learn this piece: an optional plan */
.learn-panel { width: 380px; }
body.drilling .learn-panel, body.focus .learn-panel { display: none; }
.lrn-tabs { padding: 10px 16px 4px; }
.lrn-body { padding: 4px 10px 10px; }
.lrn-progress { margin: 8px 6px 4px; font-size: 12px; color: var(--muted); }
.lrn-progress .bar { height: 6px; border-radius: 3px; background: #efe9df; margin-top: 5px; overflow: hidden; }
.lrn-progress .bar i { display: block; height: 100%; background: var(--good); border-radius: 3px; transition: width .3s; }
.lrn-step { display: grid; grid-template-columns: 24px 1fr; gap: 8px; padding: 9px 6px; border-radius: 10px; }
.lrn-step:hover { background: #f8f5ef; }
.lrn-step b { font-size: 13.5px; }
.lrn-step p { margin: 2px 0 6px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.lrn-step.done b { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9b1a3; }
.lrn-check { width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: #fff; color: transparent; font-size: 11px; line-height: 1; cursor: pointer; padding: 0; }
.lrn-check:hover { border-color: var(--good); color: #9fd1ae; }
.lrn-step.done .lrn-check { background: var(--good); border-color: var(--good); color: #fff; }
.lrn-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.lrn-act { border: 1px solid var(--line-strong); background: #fff; border-radius: 7px; padding: 3px 9px; font: inherit; font-size: 12px; cursor: pointer; color: var(--ink); }
.lrn-act:hover { border-color: var(--hl); color: var(--hl); }
.lrn-act.done { border-color: #bfe0c9; background: #f1faf3; color: #24693b; }
.lrn-act.done::before { content: "✓ "; }
.lrn-more { margin: 2px 6px 6px 38px; font-size: 12px; color: var(--muted); }
.lvl-pill { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; vertical-align: 1px; }
.lvl-pill.hard { background: #fbe6e3; color: #a3352b; }
.lvl-pill.medium { background: #fbf0d9; color: #8a6210; }
.lvl-pill.easy { background: #e3f3e8; color: #24693b; }
.lrn-sec { padding: 8px 6px; border-radius: 10px; cursor: pointer; }
.lrn-sec:hover { background: #f8f5ef; }
.lrn-sec .bars { font-size: 13px; font-weight: 600; }
.lrn-sec p { margin: 2px 0 5px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.lrn-sec .hands { font-size: 11.5px; color: var(--muted); }
.lrn-intro { margin: 6px 6px 8px; font-size: 12.5px; line-height: 1.5; }
.learn-panel .mk-foot p { margin: 4px 0 0; }
/* harder bars on the score */
.lrn-bar { position: absolute; pointer-events: none; border-radius: 4px; border-top: 3px solid transparent; }
.lrn-bar.hard { background: rgba(214, 69, 53, .055); border-top-color: rgba(214, 69, 53, .55); }
.lrn-bar.medium { background: rgba(214, 160, 40, .06); border-top-color: rgba(214, 160, 40, .6); }
.lrn-bar.focus { box-shadow: inset 0 0 0 2px var(--hl); }
.learn-hint .ex-chip-tag { background: var(--hl); color: #fff; }
/* the score makes room for the Learn panel beside it */
@media (min-width: 1100px) {
  body.learning:not(.drilling):not(.focus) .paper-wrap { padding-right: 420px; }
  body.learning:not(.drilling):not(.focus) #practiceBar { margin-right: 420px; }
}

.lrn-sec .hands.yours { color: #2f6f8f; }
.lrn-link { border: 0; background: none; padding: 0; font: inherit; color: var(--hl); cursor: pointer; text-decoration: underline; }
.ex-chip .ex-back { font-weight: 600; }

/* Levels: the piece as a path of short sections, up to three stars each */
.lv-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 6px 12px; }
.lv-total { font-size: 12.5px; color: var(--muted); }
.lv-total b { font-family: var(--serif); font-size: 22px; color: var(--ink); margin-right: 2px; }
.lv-path { list-style: none; margin: 0; padding: 0 0 6px; position: relative; }
.lv-path::before { content: ""; position: absolute; left: 21px; top: 16px; bottom: 22px; width: 2px; background: var(--line); }
.lv-node { position: relative; display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 7px 8px 7px 6px; border-radius: 12px; cursor: pointer; }
.lv-node:hover { background: #f8f5ef; }
.lv-dot { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line-strong); font-size: 12px; font-weight: 600; color: var(--muted); }
.lv-node.medium .lv-dot { border-color: #e2bf6a; }
.lv-node.hard .lv-dot { border-color: #dd8a80; }
.lv-node.full .lv-dot { background: var(--gold-soft); border-color: var(--gold); color: #6d5626; }
.lv-node.next .lv-dot { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 4px rgba(37, 46, 74, .12); }
.lv-node.whole .lv-dot { border-radius: 9px; }
.lv-info b { font-size: 13px; }
.lv-x { margin-left: 6px; font-size: 11px; color: var(--muted); }
.lv-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.lv-tags i { font-style: normal; font-size: 10.5px; padding: 0 6px; border-radius: 999px; background: #f1ede6; color: #6b6458; }
.lv-stars { font-size: 14px; letter-spacing: 1px; color: #d9d1c3; }
.lv-stars .on { color: var(--gold); }
/* a level being played: the goal and the stages, in place of the drill's own controls */
.game-row { display: none; align-items: center; gap: 16px; flex-wrap: wrap; }
body.game .game-row { display: flex; }
body.game .drill-hands, body.game .drill-modes, body.game #drillLadderWrap, body.game .drill-speed, body.game #drillSave,
body.game .drill-streak, body.game #drillDots, body.game #drillBest { display: none !important; }
body.game .drill-tag { background: var(--gold-soft); color: #6d5626; }
.game-stars { font-size: 22px; letter-spacing: 2px; color: #d9d1c3; }
.game-stars .on { color: var(--gold); }
.game-stars .aim { color: var(--gold); opacity: .45; }
.game-goal { font-family: var(--serif); font-size: 16px; }
.game-stages { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.game-stages em { font-style: normal; color: var(--line-strong); }
.game-stages .now { color: var(--ink); font-weight: 600; }
.game-stages .done { color: var(--good); }
.game-combo { margin-left: auto; font-size: 13px; color: var(--good); font-weight: 600; font-variant-numeric: tabular-nums; }
.game-pop { position: absolute; z-index: 5; transform: translateX(-50%); pointer-events: none; font: italic 13px var(--serif); white-space: nowrap; animation: game-pop .9s ease-out forwards; }
.game-pop.good { color: var(--good); }
.game-pop.ok { color: #b07a12; }
.game-pop.miss, .game-pop.bad { color: var(--bad); }
@keyframes game-pop { from { opacity: 0; transform: translate(-50%, 4px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -14px); } }
/* after a level: the stars and what next */
.level-card { position: absolute; z-index: 45; left: 50%; top: 46%; transform: translate(-50%, -50%); min-width: 320px; max-width: 420px; padding: 22px 26px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(20, 15, 5, .2); text-align: center; animation: exin .2s ease-out; }
.level-card.brief { min-width: 240px; padding: 16px 22px; }
.level-card h3 { margin: 4px 0 2px; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.lc-kicker { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lc-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.lc-stars { font-size: 38px; letter-spacing: 6px; color: #e2dbcd; margin: 6px 0 2px; }
.lc-stars .on { color: var(--gold); }
.lc-stars .new { display: inline-block; animation: star-in .5s cubic-bezier(.3, 1.6, .5, 1) backwards; }
@keyframes star-in { from { transform: scale(.2); opacity: 0; } }
.lc-acts { display: flex; justify-content: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.s-ring { flex: none; width: 13px; height: 13px; margin-right: 6px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--p) * 1%), rgba(255, 255, 255, .14) 0); -webkit-mask: radial-gradient(circle, transparent 3.5px, #000 4px); mask: radial-gradient(circle, transparent 3.5px, #000 4px); }

/* Write | Practice: the two modes, in the header */
.mode-switch { display: inline-flex; padding: 3px; background: #ebe6dd; border-radius: 12px; gap: 2px; }
.mode-switch button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: none; padding: 7px 18px; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mode-switch button svg { width: 16px; height: 16px; }
.mode-switch button:hover { color: var(--ink); }
.mode-switch button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(30, 25, 15, .14); }
body[data-app="practice"] .w-only { display: none !important; }
.p-levels svg { width: 16px; height: 16px; }
