:root {
  --cream: #fff8e6;
  --paper: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #1d5fd8;
  --blue-deep: #0f3d9c;
  --red: #e0152b;
  --sun: #ffd95a;
  --ok: #15803d;
  --dock-h: clamp(230px, 38vh, 380px);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; background: var(--cream); color: var(--ink); font-size: 17px;
  background-image: radial-gradient(circle at 10% -10%, #fff1b8 0, transparent 40%), radial-gradient(circle at 100% 0, #dbeafe 0, transparent 35%);
}
button, input, select { font: inherit; }

/* ---- top bar */
.topbar { display: flex; align-items: center; gap: 18px; padding: 4px 18px; background: var(--paper); border-bottom: 1px solid #e5e7eb; box-shadow: 0 2px 10px rgba(15, 23, 42, .06); flex: 0 0 auto; position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand__logo { display: block; width: auto; height: 84px; margin: -4px 0; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font-weight: 900; font-size: 22px; color: var(--blue); letter-spacing: .2px; }
.brand__by { font-weight: 800; font-size: 14px; color: var(--red); }
.tabs { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.tab { border: 0; background: transparent; padding: 9px 14px; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab:hover { background: #eef2ff; color: var(--blue-deep); }
.tab.is-active { background: var(--blue); color: #fff; }
.tabs--pills { margin: 6px 0 12px; }
.tabs--pills .tab { background: #fff; border: 1px solid var(--line); font-weight: 600; padding: 6px 12px; font-size: 15px; }
.tabs--pills .tab.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill { border: 0; border-radius: 999px; padding: 8px 16px; font-weight: 800; cursor: pointer; }
.pill--idle { background: #e2e8f0; color: #475569; }
.pill--ok { background: #dcfce7; color: var(--ok); }
.pill--ok::before { content: "● "; }
.pill--bad { background: #fee2e2; color: #b91c1c; }

/* ---- screens */
.screen-wrap { flex: 1 1 auto; overflow: auto; min-height: 0; }
.screen { max-width: 1100px; margin: 0 auto; padding: 22px 26px 30px; }
.screen__title { margin: 0 0 8px; font-size: 32px; font-weight: 900; color: var(--blue-deep); }
.screen h2 { margin: 22px 0 8px; font-size: 18px; color: var(--blue-deep); }
.hint { color: var(--muted); margin: 4px 0 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.btn { border: 2px solid var(--blue); background: #fff; color: var(--blue-deep); border-radius: 12px; padding: 9px 18px; font-weight: 800; cursor: pointer; }
.btn:hover { background: #eef2ff; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: var(--blue-deep); }
.btn--ghost { border-color: var(--line); color: var(--muted); }

.status { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: 18px; background: #fff; border: 3px solid var(--line); font-size: 26px; font-weight: 900; }
.status__icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; color: #475569; font-size: 26px; flex: 0 0 auto; }
.status--connected { border-color: #86efac; background: #f0fdf4; color: var(--ok); }
.status--connected .status__icon { background: var(--ok); color: #fff; }
.status--error { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.status--error .status__icon { background: #b91c1c; color: #fff; }
.steps { font-size: 19px; line-height: 1.7; }
.devices { margin: 16px 0; }
.device { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.device.is-current { border-color: #86efac; }
.device__name { font-weight: 800; }
.first-test { margin-top: 22px; padding: 18px 22px; background: #fff; border-radius: 18px; border: 3px solid var(--sun); }
.first-test h2 { margin-top: 0; font-size: 22px; }
.checklist { list-style: none; padding: 0; margin: 10px 0; font-size: 19px; }
.checklist li { padding: 4px 0; color: var(--muted); }
.checklist li.is-done { color: var(--ok); font-weight: 800; }
.check { display: inline-block; width: 26px; font-weight: 900; }
.first-test__card { margin: 10px 0; }

/* ---- the note card */
.note-card { display: flex; align-items: center; gap: 26px; background: #fff; border-radius: 22px; padding: 14px 30px; border: 4px solid var(--note, #cbd5e1); box-shadow: 0 8px 26px rgba(15, 61, 156, .12); min-height: 150px; }
.note-card--empty { justify-content: center; border-color: var(--line); box-shadow: none; }
.note-card__hint { color: var(--muted); font-size: 20px; font-weight: 700; text-align: center; }
.note-card__letter { font-size: 96px; font-weight: 900; line-height: 1; min-width: 90px; text-align: center; }
.note-card__solfege { font-size: 40px; font-weight: 800; color: #334155; min-width: 100px; }
.note-card__staff svg { height: 130px; width: auto; display: block; }
.note-card--black .note-card__letter { font-size: 64px; }
.note-card__exact { margin-left: auto; font-size: 16px; color: var(--muted); font-weight: 700; text-align: right; }
.freeplay__stage { display: grid; gap: 14px; margin-top: 8px; }
.freeplay__held-title { font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; min-height: 38px; }
.chip { background: #fff; border: 3px solid var(--note); border-radius: 999px; padding: 4px 14px; font-weight: 800; font-size: 18px; }

/* ---- diagnostic */
.diag-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 12px 0; }
.diag-cell { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.diag-cell__k { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 800; }
.diag-cell__v { font-size: 24px; font-weight: 900; color: var(--blue-deep); margin-top: 2px; word-break: break-word; }
.log { background: #fff; border: 1px solid var(--line); border-radius: 14px; max-height: 260px; overflow: auto; }
.log table { width: 100%; border-collapse: collapse; font-size: 15px; }
.log th, .log td { text-align: left; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.log th { position: sticky; top: 0; background: #f8fafc; color: var(--muted); }

/* ---- songs */
.library__bar { display: flex; gap: 10px; margin: 8px 0; }
.search { flex: 1; max-width: 420px; }
.search, select { border: 2px solid var(--line); border-radius: 12px; padding: 9px 14px; background: #fff; }
.song-list { display: grid; gap: 10px; }
.song { display: flex; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 18px; }
.song.is-playing { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.song__main { flex: 1; min-width: 0; }
.song__title { font-weight: 900; font-size: 19px; }
.song__meta { color: var(--muted); font-size: 14px; margin: 2px 0 6px; }
.tag { display: inline-block; background: #eef2ff; color: var(--blue-deep); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 800; margin-right: 6px; }

.library__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.library__head .screen__title { margin-bottom: 0; }

/* ---- add a song */
.addsong label { display: block; margin: 14px 0 6px; font-weight: 800; }
.addsong input[type=text], .addsong input[type=number], .addsong textarea { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fff; }
.addsong textarea { min-height: 170px; font-size: 20px; line-height: 1.5; resize: vertical; letter-spacing: .5px; }
.addsong__row { display: flex; gap: 16px; flex-wrap: wrap; }
.addsong__row > div { flex: 1; min-width: 180px; }
.addsong__status { margin: 8px 0; font-weight: 800; color: var(--ok); }
.addsong__status.is-bad { color: #b91c1c; }
.howto { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; margin: 10px 0; }
.howto code { background: #eef2ff; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.howto ul { margin: 6px 0 0; padding-left: 22px; line-height: 1.6; }

/* ---- settings */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; margin-bottom: 8px; }
.setting__text { display: flex; flex-direction: column; }
.setting small { color: var(--muted); }
.setting input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--blue); }

/* ---- keyboard dock */
.dock { flex: 0 0 auto; background: linear-gradient(#1e293b, #0f172a); padding: 8px 14px 14px; border-top: 1px solid #0b1224; }
.dock__tools { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: #334155; border-radius: 999px; padding: 3px; }
.seg__btn { border: 0; background: transparent; color: #cbd5e1; padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg__btn.is-active { background: #fff; color: var(--blue-deep); }
.volume { display: flex; align-items: center; gap: 8px; margin-left: auto; margin-right: 12px; }
.volume__icon { font-size: 20px; }
.volume__slider { width: 120px; accent-color: var(--blue); cursor: pointer; }
.volume__test { border: 2px solid var(--blue); background: #fff; color: var(--blue-deep); font-weight: 700; font-size: 14px; border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.volume__test:hover { background: var(--blue); color: #fff; }
.dock-hint { color: #94a3b8; font-size: 14px; margin-left: auto; }

.vk { position: relative; height: var(--dock-h); user-select: none; -webkit-user-select: none; touch-action: none; }
.vk__surface { position: absolute; inset: 0; }
.vk__key { position: absolute; top: 0; box-sizing: border-box; cursor: pointer; transition: background-color .18s ease-out, transform .12s ease-out; }
.vk__key.is-down { transition: none; }   /* lighting up is instant, so the screen never lags behind the finger; letting go fades */
.vk__key--white { bottom: 0; background: #fff; border: 1px solid #94a3b8; border-top: 0; border-radius: 0 0 9px 9px; display: flex; flex-direction: column; align-items: center; padding-top: 14%; overflow: hidden; z-index: 1; }
.vk__cap { position: absolute; top: 0; left: 0; right: 0; height: 12%; background: var(--note); }
.vk__octave { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; line-height: 1.05; overflow: hidden; font-size: clamp(9px, calc(var(--kw) * .2), 13px); color: #64748b; font-weight: 700; }
.vk__letter { font-size: clamp(14px, calc(var(--kw) * .5), 50px); font-weight: 900; line-height: 1; color: var(--note); }
.vk__solfege { font-size: clamp(10px, calc(var(--kw) * .27), 21px); font-weight: 800; color: #334155; margin-top: 3px; }
.vk__staff { margin-top: 6px; display: block; flex: 0 1 auto; min-height: 0; }
.vk__staff svg { display: block; width: clamp(28px, calc(var(--kw) * .8), 64px); height: auto; max-height: 100%; }
.vk[data-detail="medium"] .vk__staff,
.vk[data-detail="small"] .vk__staff, .vk[data-detail="small"] .vk__solfege,
.vk[data-detail="color"] .vk__staff, .vk[data-detail="color"] .vk__solfege, .vk[data-detail="color"] .vk__letter, .vk[data-detail="color"] .vk__octave { display: none; }
.vk[data-detail="small"] .vk__octave { display: none; }

.vk__key--black { height: 60%; z-index: 3; background: linear-gradient(#111827, #1f2937); border-radius: 0 0 7px 7px; border: 1px solid #000; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; box-shadow: 0 3px 5px rgba(0, 0, 0, .45); }
.vk__black-name { display: flex; flex-direction: column; align-items: center; color: #e2e8f0; font-weight: 800; font-size: clamp(8px, calc(var(--kw) * .2), 13px); line-height: 1.15; }
.vk[data-detail="color"] .vk__black-name, .vk[data-detail="small"] .vk__black-name { display: none; }

.vk__key--white.is-down { background: var(--note); transform: translateY(2px); box-shadow: inset 0 0 22px rgba(255, 255, 255, .35); }
.vk__key--white.is-down .vk__letter, .vk__key--white.is-down .vk__solfege, .vk__key--white.is-down .vk__octave { color: #fff; }
.vk__key--white.is-down .vk__cap { background: rgba(0, 0, 0, .25); }
.vk__key--white.is-sustained { background: color-mix(in srgb, var(--note) 22%, #fff); }
.vk__key--black.is-down { background: linear-gradient(#475569, #64748b); box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255, 255, 255, .8); transform: translateY(2px); }
.vk__key--black.is-sustained { background: #334155; }
.vk__key.is-target { animation: vk-target 1s ease-in-out infinite; }
@keyframes vk-target { 0%, 100% { box-shadow: 0 0 0 3px var(--note); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--note) 45%, transparent), 0 0 20px var(--note); } }
.vk__key.is-correct { animation: vk-correct .6s ease-out; }
@keyframes vk-correct { 0% { box-shadow: 0 0 0 0 var(--note); } 40% { box-shadow: 0 0 0 10px var(--note), 0 0 34px #fff; } 100% { box-shadow: 0 0 0 0 transparent; } }
.vk__key.is-wrong { animation: vk-wrong .45s ease-out; }
@keyframes vk-wrong { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* ---- play along */
body[data-screen="play"] .screen-wrap { overflow: hidden; display: flex; flex-direction: column; }
.play { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.play__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; background: var(--paper); border-bottom: 1px solid var(--line); }
.play__title { display: flex; flex-direction: column; line-height: 1.1; margin-right: auto; min-width: 0; }
.play__title strong { font-size: 20px; color: var(--blue-deep); }
.play__title small { color: var(--muted); font-weight: 700; }
.seg--light { background: #e2e8f0; }
.seg--light .seg__btn { color: #475569; }
.seg--light .seg__btn.is-active { background: var(--blue); color: #fff; }
.play__lane { position: relative; flex: 1 1 auto; min-height: 150px; overflow: hidden; }
.play__canvas { position: absolute; inset: 0; display: block; }
.play__next { position: absolute; top: 10px; right: 14px; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .96); border-radius: 18px; padding: 8px 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }
.play__next:empty { display: none; }
.next__label { font-weight: 900; color: var(--muted); text-transform: uppercase; font-size: 13px; letter-spacing: .6px; }
.next__item { display: flex; align-items: center; gap: 8px; border-left: 5px solid var(--note); padding-left: 10px; }
.next__letter { font-size: 40px; font-weight: 900; line-height: 1; color: var(--note); }
.next__solfege { font-size: 20px; font-weight: 800; color: #334155; }
.next__staff svg { height: 56px; width: auto; display: block; }
.next__more { font-weight: 900; color: var(--muted); font-size: 20px; }
.play__center { position: absolute; left: 0; right: 0; top: 38%; transform: translateY(-50%); text-align: center; pointer-events: none; color: #fff; }
.play__center > * { pointer-events: auto; }
.play__center p { margin: 12px 0 0; font-size: 18px; font-weight: 700; color: #cbd5e1; }
.play__start { border: 0; background: var(--sun); color: #3b2a00; font-size: 30px; font-weight: 900; padding: 16px 44px; border-radius: 999px; cursor: pointer; box-shadow: 0 8px 28px rgba(0, 0, 0, .4); }
.play__start:hover { background: #ffe58a; }
.play__count { font-size: 120px; font-weight: 900; line-height: 1; text-shadow: 0 6px 30px rgba(0, 0, 0, .6); opacity: .92; }
.play__tip { display: inline-block; background: rgba(255, 255, 255, .95); color: var(--blue-deep); font-weight: 900; font-size: 22px; padding: 8px 22px; border-radius: 999px; }
.play__result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11, 18, 36, .78); }
.play__result[hidden] { display: none; }
.result { background: #fff; border-radius: 26px; padding: 22px 38px; text-align: center; max-width: 560px; box-shadow: 0 16px 50px rgba(0, 0, 0, .5); }
.result h2 { margin: 4px 0; font-size: 30px; color: var(--blue-deep); }
.result p { margin: 6px 0; }
.result__stars { font-size: 56px; letter-spacing: 8px; color: #cbd5e1; line-height: 1; }
.result__stars .is-on { color: #f5b800; text-shadow: 0 2px 0 #b98700; }
.result__label { color: var(--muted); font-weight: 800; }
.result .chips { justify-content: center; }
.result .actions { justify-content: center; }

@media (max-width: 1000px) { .diag-grid { grid-template-columns: repeat(2, 1fr); } .note-card { flex-wrap: wrap; } .topbar { flex-wrap: wrap; } }
@media (prefers-reduced-motion: reduce) { .vk__key, .vk__key.is-target, .vk__key.is-correct, .vk__key.is-wrong { animation: none; transition: none; } }

/* ---- song library: cards, favorites, details */
.song { position: relative; }
.fav { border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; color: #cbd5e1; padding: 0 4px; align-self: flex-start; }
.fav.is-on { color: #f5b800; }
.fav:hover { color: #f5b800; }
.song__title--button { border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; color: var(--ink); font: inherit; font-weight: 900; font-size: 19px; }
.song__title--button:hover { color: var(--blue); }
.song__buttons { display: flex; gap: 8px; align-items: center; }
.song__details { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.song__details dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 8px; font-size: 15px; }
.song__details dt { color: var(--muted); font-weight: 700; }
.song__details dd { margin: 0; }
.tag--mine { background: #fef3c7; color: #92400e; }
.notice { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 12px; padding: 10px 14px; margin: 10px 0; font-weight: 600; }
.notice:empty { display: none; }
.notice--warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.notice--bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.btn--small { padding: 4px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---- add song */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 16px 18px; cursor: pointer; }
.choice:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(29, 95, 216, .15); }
.choice__icon { display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; background: #eef2ff; color: var(--blue-deep); font-weight: 900; font-size: 20px; }
.choice__title { font-weight: 900; font-size: 18px; color: var(--blue-deep); }
.choice__text { color: var(--muted); font-size: 14px; line-height: 1.4; }

/* ---- workshop */
.workshop { max-width: 1180px; }
.ws__top { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.ws__field { display: flex; flex-direction: column; font-weight: 800; font-size: 13px; color: var(--muted); gap: 3px; flex: 1; min-width: 200px; }
.ws__field input, .ws__meta input, .ws__meta select, .insp__pitch select, .insp__row input, .panel textarea, .record__row input[type=number], .record__row select, .tidy select { border: 2px solid var(--line); border-radius: 10px; padding: 7px 10px; background: #fff; font-size: 16px; color: var(--ink); }
.ws__buttons { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin: 8px 0; }
.panel p { margin: 0 0 8px; }
.panel code, .addsong code { background: #eef2ff; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.panel textarea { width: 100%; min-height: 110px; font-size: 20px; line-height: 1.5; letter-spacing: .5px; resize: vertical; }
.lengths, .insp__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.lengths__label { font-weight: 800; color: var(--muted); min-width: 84px; }
.seg__btn--dark { border: 2px solid var(--line); background: #fff; color: #475569; border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: 14px; cursor: pointer; }
.seg__btn--dark.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.ws__meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 14px 0 4px; font-weight: 700; }
.ws__meta input[type=number] { width: 84px; }
.ws__group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.record__row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 6px 0 12px; font-weight: 700; }
.record__row .check { display: inline-flex; align-items: center; gap: 6px; }
.record__stage { display: flex; align-items: center; gap: 18px; }
.record__status { font-size: 20px; font-weight: 800; color: var(--blue-deep); flex: 1; }
.record__btn { width: 76px; height: 76px; border-radius: 50%; border: 6px solid #fecaca; background: #dc2626; cursor: pointer; box-shadow: 0 4px 14px rgba(220, 38, 38, .35); }
.record__btn.is-recording { border-radius: 18px; animation: rec-pulse 1s ease-in-out infinite; }
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, .18); } }
.strip { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; min-height: 110px; }
.strip > .hint { margin: 8px; }
.strip__bar { display: flex; align-items: flex-start; border-left: 3px solid #94a3b8; padding-left: 4px; color: #94a3b8; font-weight: 800; font-size: 12px; margin-left: 4px; }
.step { display: flex; flex-direction: column; gap: 4px; align-items: stretch; justify-content: flex-end; border-radius: 12px; padding: 4px; }
.step.is-selected { background: #eff6ff; }
.step--rest { color: #94a3b8; justify-content: center; align-items: center; font-style: italic; font-size: 13px; min-width: 50px; }
.step--rest small { display: block; font-size: 11px; }
.step__notes { display: flex; flex-direction: column; gap: 3px; }
.step__note { display: flex; align-items: baseline; justify-content: center; gap: 2px; min-width: 46px; border: 3px solid var(--note); background: #fff; border-radius: 12px; padding: 4px 6px; cursor: pointer; color: var(--note); }
.step__note b { font-size: 22px; line-height: 1; }
.step__note small { font-size: 11px; color: var(--muted); font-weight: 800; }
.step__note.is-selected { background: var(--note); color: #fff; }
.step__note.is-selected small { color: #fff; }
.step__note.is-left { border-style: dashed; }
.step__len { border: 0; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; padding: 2px 0; }
.inspector { background: #fff; border: 2px solid var(--blue); border-radius: 16px; padding: 12px 18px; margin: 12px 0; }
.inspector h3 { margin: 0 0 6px; color: var(--blue-deep); }
.insp__pitch { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-weight: 700; margin: 6px 0; }
.insp__big { display: flex; align-items: baseline; gap: 10px; border-left: 8px solid var(--note); padding-left: 12px; }
.insp__big b { font-size: 44px; color: var(--note); line-height: 1; }
.insp__big span { font-size: 22px; font-weight: 800; color: #334155; }
.insp__big small { color: var(--muted); font-weight: 800; }
.insp__row input { width: 76px; }

/* ---- import */
.picks { display: grid; gap: 8px; margin: 12px 0; }
.pick { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 16px; cursor: pointer; }
.pick.is-on { border-color: var(--blue); background: #f5f9ff; }
.pick.is-off { opacity: .55; cursor: default; }
.pick input { width: 22px; height: 22px; accent-color: var(--blue); }
.pick__main { display: flex; flex-direction: column; flex: 1; }
.pick__main small { color: var(--muted); }
.notes-list { margin: 8px 0; padding-left: 22px; color: #78350f; font-weight: 600; }
.tidy { display: block; margin: 10px 0; font-weight: 700; }

/* the keyboard takes less room on screens that are not about playing it */
body[data-screen="songs"], body[data-screen="addsong"], body[data-screen="import"], body[data-screen="sheet"], body[data-screen="workshop"], body[data-screen="settings"], body[data-screen="midi"], body[data-screen="connect"] { --dock-h: clamp(215px, 24vh, 250px); }

/* ---- play tools */
.speedpick { display: inline-flex; align-items: center; gap: 4px; }
.speedpick select { border: 2px solid var(--line); border-radius: 10px; padding: 4px 8px; background: #fff; font-weight: 800; font-size: 15px; }
.play__tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 6px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.tool { border: 2px solid var(--line); background: #fff; color: #475569; border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: 14px; cursor: pointer; }
.tool:hover { border-color: var(--blue); }
.tool.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.tool:disabled { opacity: .4; cursor: default; }
.tool-group { display: inline-flex; align-items: center; gap: 6px; }
.tool-label { font-size: 14px; font-weight: 700; color: var(--muted); }
.play__tools select { border: 2px solid var(--line); border-radius: 8px; padding: 2px 6px; background: #fff; font-size: 14px; }
.play__staffwrap { height: 172px; flex: 0 0 auto; border-bottom: 3px solid #0b1224; }
.play__staffwrap[hidden] { display: none; }
.play__staff { display: block; width: 100%; height: 100%; }
.checkline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.staffedit { background: #16213a; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.staffedit canvas { display: block; cursor: pointer; }
.staffedit input[type=range] { width: calc(100% - 24px); margin: 6px 12px 10px; accent-color: var(--sun); }
.insp__staff svg { height: 84px; width: auto; display: block; background: #fff; border-radius: 8px; }

/* ---- sheet music import and review */
.pages__bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; font-weight: 700; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pg { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px; opacity: .6; }
.pg.is-on { border-color: var(--blue); opacity: 1; }
.pg__thumb { background: #f1f5f9; border-radius: 10px; display: grid; place-items: center; min-height: 140px; overflow: hidden; }
.pg__thumb canvas { max-width: 100%; max-height: 300px; display: block; }
.pg__label { font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pg__label small { color: var(--muted); font-weight: 600; }
.pg__tools { display: flex; gap: 6px; flex-wrap: wrap; }
.pg__adjust { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.pg__adjust label { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.pg__adjust input[type=range] { flex: 1; accent-color: var(--blue); }
.reading { max-width: 640px; margin: 30px auto; text-align: center; }
.reading__bar { height: 18px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.reading__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), #38bdf8); transition: width .4s; }
.reading__step { font-size: 22px; font-weight: 800; color: var(--blue-deep); margin: 14px 0 4px; }
.sheetpanel { background: #fff; border: 2px solid var(--blue); border-radius: 16px; margin: 12px 0; overflow: hidden; }
.sheetpanel__bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 14px; background: #eff6ff; font-weight: 700; }
.sheetpanel__view { max-height: 360px; overflow: auto; background: #e2e8f0; }
.sheetpanel__stage { position: relative; width: 100%; max-width: 1100px; margin: 0 auto; }
.sheetpanel__stage img { display: block; width: 100%; height: auto; }
.sheetpanel__layer { position: absolute; inset: 0; }
.sbox { position: absolute; box-sizing: border-box; border-radius: 6px; }
.sbox--note { border: 3px solid #1d5fd8; background: rgba(29, 95, 216, .18); box-shadow: 0 0 0 3px rgba(255, 255, 255, .8); }
.sbox--measure { border: 2px dashed #1d5fd8; background: rgba(29, 95, 216, .05); }
.sbox--unsure { border: 3px solid #f59e0b; background: rgba(245, 158, 11, .22); cursor: pointer; }
.step__note { position: relative; }
.step__note.is-unsure { border-color: #f59e0b; border-style: dashed; }
.step__note .warn { position: absolute; top: -8px; right: -6px; background: #f59e0b; color: #fff; border-radius: 50%; width: 16px; height: 16px; font-size: 11px; font-style: normal; font-weight: 900; display: grid; place-items: center; }

.play__sheetwrap { height: 190px; flex: 0 0 auto; border-bottom: 3px solid #0b1224; }
.play__sheetwrap[hidden] { display: none; }
.play__sheet { display: block; width: 100%; height: 100%; }
.licenses { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; max-height: 280px; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.licenses[hidden] { display: none; }

/* ---- the library home: Start here path and collections */
.song__composer { color: var(--muted); font-weight: 700; font-size: 15px; }
.song__version { color: var(--blue); font-weight: 800; font-size: 13px; margin-left: 6px; }
.versions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.crumb { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.collections { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 10px; }
.collection { display: flex; flex-direction: column; gap: 4px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px 18px; cursor: pointer; }
.collection:hover { border-color: var(--blue); box-shadow: 0 6px 18px rgba(29, 95, 216, .15); }
.collection__icon { width: 40px; height: 40px; border-radius: 12px; background: #eef2ff; color: var(--blue-deep); display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.collection__title { font-weight: 900; font-size: 18px; color: var(--blue-deep); }
.collection__text { color: var(--muted); font-size: 14px; line-height: 1.35; }
.collection__count { color: var(--blue); font-weight: 800; font-size: 13px; margin-top: auto; padding-top: 4px; }
.path { background: linear-gradient(135deg, #fff7d6, #e6f0ff); border: 2px solid #fcd34d; border-radius: 20px; padding: 14px 20px; margin: 6px 0 16px; }
.path__head h2 { margin: 0; }
.path__head p { margin: 2px 0 8px; color: #475569; }
.path ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.path li { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, .8); border-radius: 14px; padding: 8px 12px; }
.path li.is-next { background: #fff; box-shadow: 0 0 0 3px var(--blue); }
.path li.is-done { opacity: .75; }
.path__num { width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; color: #475569; display: grid; place-items: center; font-weight: 900; flex: 0 0 auto; }
.path li.is-done .path__num { background: var(--ok); color: #fff; }
.path li.is-next .path__num { background: var(--blue); color: #fff; }
.path__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.path__text small { color: var(--muted); font-weight: 600; }
.library__bar select { max-width: 250px; }

/* ---- first run */
.welcome { position: fixed; inset: 0; z-index: 50; background: rgba(11, 18, 36, .72); display: grid; place-items: center; padding: 20px; }
.welcome__card { background: #fff; border-radius: 28px; padding: 26px 34px; max-width: 640px; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.welcome__logo { border-radius: 50%; }
.welcome__card h1 { margin: 8px 0; color: var(--blue-deep); font-size: 32px; }
.welcome__choices { display: grid; gap: 12px; margin: 16px 0 8px; }
.welcome__btn { display: flex; flex-direction: column; gap: 4px; border: 3px solid var(--line); background: #fff; border-radius: 20px; padding: 16px 20px; cursor: pointer; text-align: left; font-size: 17px; }
.welcome__btn strong { font-size: 22px; color: var(--blue-deep); }
.welcome__btn span { color: var(--muted); }
.welcome__btn:hover, .welcome__btn:focus-visible { border-color: var(--blue); }
.welcome__btn--main { border-color: var(--sun); background: #fffbeb; }
.welcome__hint { color: var(--muted); font-size: 14px; }
.reportask__card { width: min(520px, 100%); text-align: left; }
.reportask__card h1 { text-align: center; }
.reportask__form { display: grid; gap: 14px; margin-top: 12px; }
.reportask__form label { display: grid; gap: 6px; font-weight: 700; color: var(--blue-deep); }
.reportask__form small { font-weight: 400; color: var(--muted); }
.reportask__form input[type=text], .reportask__form textarea { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fff; font: inherit; font-weight: 400; color: inherit; }
.reportask__form input[type=text]:focus-visible, .reportask__form textarea:focus-visible { border-color: var(--blue); outline: none; }
.reportask__form .actions { justify-content: center; }
.library__bar { flex-wrap: wrap; align-items: center; }
.library__bar .search { flex: 1 1 240px; min-width: 200px; }

/* ---- editions: Pro badge, the Pro card (Free only), the companion book card */
.pro-badge { display: inline-block; background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .6px; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.procard { background: linear-gradient(135deg, #eef2ff, #fff7ed); border: 2px solid #c7d2fe; border-radius: 20px; padding: 14px 20px; margin: 14px 0; }
.procard h2 { margin: 0 0 4px; }
.procard p { margin: 4px 0 10px; color: #475569; }
.pronote { color: var(--muted); margin: 6px 0 0; }
.linklike { border: 0; background: transparent; padding: 0; color: var(--blue); font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.teaser__card { max-width: 520px; }
.teaser__actions { justify-content: center; }
.bookcard { position: relative; display: flex; gap: 16px; align-items: center; background: #fff; border: 2px solid #fde68a; border-radius: 20px; padding: 12px 44px 12px 14px; margin: 14px 0; }
.bookcard h2 { margin: 0 0 4px; font-size: 18px; }
.bookcard p { margin: 0 0 8px; color: #475569; font-size: 15px; }
.bookcard__cover { flex: 0 0 100px; height: 137px; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #ed1c24, #f7941d, #d4b000, #2eaf43, #00a6d6, #4e4ba8, #8854a2); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.bookcard__cover img { width: 100px; height: 137px; object-fit: cover; display: block; }
.bookcard__fallback { display: none; color: #fff; font-weight: 900; font-size: 13px; text-align: center; padding: 6px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.bookcard__cover.is-text img { display: none; }
.bookcard__cover.is-text .bookcard__fallback { display: block; }
.bookcard__close { position: absolute; top: 6px; right: 8px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: #94a3b8; cursor: pointer; padding: 2px 8px; }
.bookcard__close:hover { color: var(--ink); }
.about__links { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- players (profiles) */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; line-height: 1; flex: 0 0 auto; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .18); }
.avatar--small { width: 30px; height: 30px; font-size: 18px; }
.avatar--big { width: 56px; height: 56px; font-size: 32px; }
.profile-chip { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 14px 3px 4px; cursor: pointer; font-weight: 800; color: var(--ink); max-width: 190px; }
.profile-chip:hover { border-color: var(--blue); }
.profile-chip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chip[hidden] { display: none; }
.profile-list { display: grid; gap: 10px; margin: 14px 0 6px; }
.profile { display: flex; align-items: center; gap: 14px; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; flex-wrap: wrap; }
.profile.is-current { border-color: var(--blue); }
.profile__main { flex: 1 1 160px; font-size: 18px; min-width: 0; }
.profile__main input { font-size: 17px; padding: 6px 10px; border: 2px solid var(--line); border-radius: 10px; max-width: 230px; }
.profile__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-new { display: grid; gap: 10px; justify-items: start; margin-bottom: 18px; }
.profile-new input { font-size: 17px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 12px; width: min(320px, 100%); }
.avatar-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick__btn { width: 48px; height: 48px; border-radius: 50%; border: 3px solid transparent; font-size: 26px; cursor: pointer; line-height: 1; }
.avatar-pick__btn.is-on { border-color: var(--blue); box-shadow: 0 0 0 2px #fff inset; }
.who__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 14px; }
.who__btn { display: grid; justify-items: center; gap: 8px; width: 140px; padding: 14px 10px; border: 3px solid var(--line); border-radius: 20px; background: #fff; cursor: pointer; font-size: 18px; font-weight: 800; color: var(--ink); }
.who__btn:hover, .who__btn:focus-visible { border-color: var(--blue); }
.who__btn.is-current { border-color: var(--blue); background: #eff6ff; }
.who__btn .avatar--big { width: 72px; height: 72px; font-size: 42px; }
.welcome__lang { display: flex; justify-content: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
@media (max-width: 1500px) { .profile-chip__name { display: none; } .profile-chip { padding: 3px; } }

/* ---- Find the Note */
.find__setup, .find__stage { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 18px 22px; max-width: 760px; }
.find__row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.find__label { font-weight: 800; min-width: 120px; }
.find__start { font-size: 20px; padding: 12px 36px; }
.find__stage { text-align: center; }
.find__count { color: var(--muted); font-weight: 700; margin: 0 0 6px; }
.find__big { font-size: 120px; line-height: 1.05; font-weight: 900; color: var(--note, var(--ink)); min-height: 150px; display: flex; align-items: center; justify-content: center; }
.find__big--staff svg { width: 260px; height: auto; max-height: 170px; }
.find__msg { font-size: 22px; font-weight: 800; min-height: 32px; margin: 4px 0 10px; }
.find__msg.is-good { color: var(--ok); }
.find__msg.is-bad { color: var(--red); }
.find__result { background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 18px 22px; max-width: 760px; text-align: center; }
body.find-hide-names .vk__letter, body.find-hide-names .vk__solfege, body.find-hide-names .vk__staff, body.find-hide-names .vk__octave { visibility: hidden; }
.news__list { text-align: left; max-width: 460px; margin: 10px auto 16px; padding-left: 22px; font-size: 18px; }
.news__list li { margin-bottom: 8px; }
.topbar .tab { padding: 9px 11px; }

/* ---- My progress */
.progress__head { display: flex; align-items: center; gap: 14px; }
.progress__head .screen__title { margin: 0; }
.statcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0 4px; max-width: 860px; }
.statcard { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 12px 16px; text-align: center; }
.statcard strong { display: block; font-size: 38px; line-height: 1.1; color: var(--blue-deep); }
.statcard span { color: var(--muted); font-weight: 700; }
.statcard.is-hot { border-color: #fb923c; background: #fff7ed; }
.statcard.is-hot strong { color: #c2410c; }
.pathbar { height: 16px; background: #e2e8f0; border-radius: 999px; overflow: hidden; max-width: 860px; }
.pathbar span { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #16a34a); border-radius: 999px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-width: 980px; }
.badge { background: #f1f5f9; border: 2px dashed #cbd5e1; border-radius: 18px; padding: 12px 14px; text-align: center; opacity: .72; }
.badge strong { display: block; }
.badge small { display: block; color: var(--muted); }
.badge__icon { display: block; font-size: 40px; line-height: 1.2; filter: grayscale(1); }
.badge.is-earned { background: #fffbe6; border: 2px solid var(--sun); opacity: 1; box-shadow: 0 3px 10px rgba(234, 179, 8, .25); }
.badge.is-earned .badge__icon { filter: none; }
.stars span { color: #cbd5e1; font-size: 20px; }
.stars span.is-on { color: #f59e0b; }
.plain { list-style: none; padding: 0; margin: 0 0 12px; }
.plain li { margin-bottom: 4px; }
.recentlist { display: grid; gap: 6px; max-width: 860px; }
.recentrow { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; flex-wrap: wrap; }
.recentrow__name { flex: 1 1 200px; font-weight: 800; }
.btn--danger { border-color: var(--red); color: var(--red); }

/* ---- Help */
.help__item { background: #fff; border: 2px solid var(--line); border-radius: 16px; margin-bottom: 8px; max-width: 860px; }
.help__item summary { cursor: pointer; padding: 12px 18px; font-weight: 800; font-size: 18px; }
.help__item[open] { border-color: var(--blue); }
.help__body { padding: 0 20px 14px; }
.help__body ol { margin: 0; padding-left: 22px; }
.help__body li { margin-bottom: 6px; }
.help-btn { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: #fff; color: var(--blue-deep); font-weight: 900; font-size: 18px; cursor: pointer; flex: 0 0 auto; }
.help-btn:hover { border-color: var(--blue); }

/* ---- keyboard users and gentler motion */
:where(button, a, input, select, summary, [tabindex]):focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }

/* ---- a smaller window: keep the top bar on one row */
@media (max-width: 1620px) {
  .topbar { gap: 8px; padding: 4px 10px; }
  .brand__logo { height: 62px; width: auto; }
  .topbar .tab { padding: 8px 8px; font-size: 15px; }
  .volume__slider { width: 90px; }
  .pill { padding: 6px 10px; font-size: 14px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabs { flex-wrap: nowrap; gap: 2px; }
}
@media (max-width: 1340px) {
  .brand__logo { height: 52px; }
  .topbar .tab { padding: 7px 6px; font-size: 14px; }
  .volume__slider { width: 70px; }
  .volume__test { display: none; }
  .pill { max-width: 130px; }
}
.play__words { background: #fffdf5; border-bottom: 1px solid var(--line); padding: 8px 18px; max-height: 120px; overflow: auto; white-space: pre-wrap; font-size: 17px; line-height: 1.45; flex: 0 0 auto; }
.play__words[hidden] { display: none; }
.pg__persp { margin-top: 8px; }
.persp__canvas { display: block; max-width: 100%; border: 2px solid var(--line); border-radius: 10px; touch-action: none; cursor: crosshair; background: #fff; }
