/* Music app in the RaiseSteady look (P2-122, 2 Nov 2026): paper ground, navy 2px edges, hard offset shadows,
   pill buttons (navy with yellow text), Orbitron headings, Geist text. Earlier direction "Manuscript" by P2-92.
   Notes are always ink; colour marks state (right green, wrong red, current violet), always with an icon or text.
   Sizes are in rem so the layout follows the reader's font size (tested at 20 px and 110% zoom).
   Reduced motion keeps the same timings as fades. */

/* Georgian letters: FiraGO by bBox Type (SIL OFL 1.1, licences/FiraGO-OFL.txt). unicode-range keeps the files from
   loading until Georgian text is on screen; Latin and Cyrillic fall through to the stacks below. */
@font-face { font-family: "FiraGO Georgian"; src: url("../fonts/firago-georgian-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO Georgian"; src: url("../fonts/firago-georgian-medium.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
@font-face { font-family: "FiraGO Georgian"; src: url("../fonts/firago-georgian-bold.woff2") format("woff2"); font-weight: 600 900; font-display: swap; unicode-range: U+10A0-10FF, U+1C90-1CBF, U+2D00-2D2F; }
/* Geist by Vercel and Orbitron by Matt McInerney (SIL OFL 1.1, licences/Geist-OFL.txt, licences/Orbitron-OFL.txt),
   the RaiseSteady site's fonts, self-hosted. Both cover Latin only: Cyrillic falls through to the system font. */
@font-face { font-family: "Geist"; src: url("../fonts/geist-latin-ext.woff2") format("woff2"); font-weight: 300 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist"; src: url("../fonts/geist-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Orbitron"; src: url("../fonts/orbitron-variable.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --navy: #282858; --yellow: #FEDB71; --mint: #75C5A8; --coral: #FB7D7E;
  --paper: #F5F5F0; --card: #FFFFFF; --card-2: #F4EDFF; --ink: #1A1A1A; --ink-soft: #4A4A68; --line: #D9D9E8;
  --staff: #282858; --accent: #282858; --accent-bg: #FEDB71; --current: #6A4FD0; --good: #1C7547; --good-bg: #BFFFE6;
  --bad: #B0261D; --bad-bg: #FFE1E1; --gold: #946600; --warm: #C4501A; --ghost: #8A8AA6;
  --heading: #282858; --on-ink: #FEDB71; --shadow: rgba(40, 40, 88, .18); --press: #282858; --edge-c: #282858; --lift-c: #282858;
  --edge: 2px solid var(--edge-c); --lift: 4px 4px 0 var(--lift-c); --lift-down: 1px 1px 0 var(--lift-c); --lift-card: 6px 6px 0 var(--lift-c);
  --display: "FiraGO Georgian", Orbitron, Geist, Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "FiraGO Georgian", Geist, Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: "FiraGO Georgian", Geist, Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 24px; --r-small: 14px; --gap: 1rem; --tab-h: 4.25rem;
  --fade: 180ms; --move: 220ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121230; --card: #1D1D44; --card-2: #2A2A58; --ink: #F5F5F0; --ink-soft: #C2C2DC; --line: #3C3C6E;
    --staff: #E6E6F2; --accent: #FEDB71; --accent-bg: #45406B; --current: #FEDB71; --good: #63CF95; --good-bg: #173A30;
    --bad: #FF8F80; --bad-bg: #3E1F2A; --gold: #FEDB71; --warm: #FB7D7E; --ghost: #8080A8;
    --heading: #F5F5F0; --on-ink: #1A1A3A; --shadow: rgba(0, 0, 0, .45); --press: #05051A; --edge-c: #A6A6DC; --lift-c: #05051A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121230; --card: #1D1D44; --card-2: #2A2A58; --ink: #F5F5F0; --ink-soft: #C2C2DC; --line: #3C3C6E;
  --staff: #E6E6F2; --accent: #FEDB71; --accent-bg: #45406B; --current: #FEDB71; --good: #63CF95; --good-bg: #173A30;
  --bad: #FF8F80; --bad-bg: #3E1F2A; --gold: #FEDB71; --warm: #FB7D7E; --ghost: #8080A8;
  --heading: #F5F5F0; --on-ink: #1A1A3A; --shadow: rgba(0, 0, 0, .45); --press: #05051A; --edge-c: #A6A6DC; --lift-c: #05051A;
  color-scheme: dark;
}

/* ---- Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 700; letter-spacing: .01em; color: var(--heading); }
.serif { font-family: var(--serif); font-weight: 600; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.15; }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.6rem); line-height: 1.2; }
h3 { font-size: 1rem; font-weight: 700; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.icon { width: 1.25em; height: 1.25em; flex: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; background: var(--ink); color: var(--on-ink); padding: .6rem 1rem; border-radius: var(--r-small); }
.skip:focus { top: 1rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }
[tabindex="-1"]:focus { outline: none; }   /* headings focused for screen readers after a page change */
[hidden] { display: none !important; }

/* ---- App frame: content, then the tab bar (bottom on phones and iPads, a side rail on wide screens) */
.app { min-height: 100vh; min-height: 100dvh; }
.main { padding: max(1.25rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) calc(var(--tab-h) + 2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left)); outline: none; }
.page { max-width: 46rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.page.narrow { max-width: 40rem; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: .25rem;
  padding: .4rem max(.5rem, env(safe-area-inset-left)) calc(.4rem + env(safe-area-inset-bottom)); background: var(--card);
  border-top: var(--edge); }
.tabs a { flex: 1; max-width: 9rem; min-height: 3.25rem; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .15rem; text-decoration: none; color: var(--ink-soft); font-size: .8rem; font-weight: 600; border-radius: var(--r-small); text-align: center; line-height: 1.15; padding: .25rem; }
.tabs a svg { width: 1.5rem; height: 1.5rem; }
.tabs a[aria-current] { color: var(--ink); background: var(--accent-bg); box-shadow: inset 0 0 0 2px var(--edge-c); border-radius: 999px; }
.no-tabs .tabs { display: none; }
.no-tabs .main { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
@media (min-width: 1100px) {
  .app { display: grid; grid-template-columns: 7.5rem 1fr; }
  .tabs { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; padding: 1.5rem .5rem; border-top: 0; border-right: var(--edge); }
  .tabs a { flex: none; max-width: none; min-height: 4.5rem; }
  .main { padding-bottom: 2rem; }
  .no-tabs .app, body.no-tabs .app { grid-template-columns: 1fr; }
}

/* ---- Buttons and small parts */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; min-width: 2.75rem;
  padding: .55rem 1.2rem; border-radius: 999px; border: var(--edge); background: var(--card); color: var(--ink);
  font: 600 1rem/1.2 var(--sans); text-decoration: none; cursor: pointer; box-shadow: var(--lift);
  transition: transform var(--fade), box-shadow var(--fade), background-color var(--fade); touch-action: manipulation; }
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--lift-c); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.primary { background: var(--accent); color: var(--on-ink); border-color: var(--edge-c); box-shadow: var(--lift); }
.btn.big { min-height: 3.25rem; padding: .75rem 1.6rem; font-size: 1.1rem; border-radius: 999px; }
.btn.small { min-height: 2.75rem; padding: .4rem .9rem; font-size: .95rem; }
.btn.ghost, .btn.ghost:hover:not(:disabled) { background: transparent; border-color: transparent; box-shadow: none; transform: none; }
.btn.ghost:hover { background: var(--card-2); }
.btn.danger { color: var(--bad); border-color: currentColor; }
.btn.icon-btn { padding: 0; width: 2.75rem; }
.btn.record { background: var(--card); }
.btn.record svg { color: var(--bad); }
.btn.record.on { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.record.on svg { color: #fff; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.button-row.center { justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.75rem; padding: .3rem .8rem; border: var(--edge);
  border-radius: 999px; background: var(--card); font-weight: 650; font-size: .95rem; text-decoration: none; }
.flame { color: var(--warm); }
.eyebrow { font-size: .85rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.lead { font-size: 1.1rem; color: var(--ink-soft); }
.sub, .hint, .fine { color: var(--ink-soft); }
.fine { font-size: .9rem; }
.tag { align-self: flex-start; font-size: .85rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: var(--card-2); }
.card { background: var(--card); border: var(--edge); border-radius: var(--r); padding: 1.25rem; box-shadow: var(--lift-card); }
a.card { display: flex; align-items: center; gap: 1rem; text-decoration: none; }
a.card:active { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.card-icon { width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-bg); color: var(--accent); border: var(--edge); }
.card-icon .icon { width: 1.5rem; height: 1.5rem; }
.card-text { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.card-text strong { font: 700 1.15rem/1.25 var(--display); color: var(--heading); }
.card-text span { color: var(--ink-soft); }
.icon.end { color: var(--ink-soft); }
.ring svg { width: 1.6rem; height: 1.6rem; }
.ring-bg, .ring-fg { fill: none; stroke-width: 5; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--good); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 18px 18px; }
.brand-mark { display: inline-flex; align-items: center; gap: .4rem; font: 800 1.3rem var(--display); color: var(--heading); }
.brand-mark .icon { color: var(--accent); }

/* ---- Notation: always ink; state colours with a matching icon or message nearby */
.staff-svg, .score-svg, .preview-svg { width: 100%; height: auto; color: var(--ink); overflow: visible; }
.staff-lines, .barline { color: var(--staff); }
.note.is-current { color: var(--current); }
.note.is-correct { color: var(--good); }
.note.is-wrong { color: var(--bad); }
.note.is-ghost { color: var(--ghost); }
.note.is-selected { color: var(--current); }
.staff-card { background: var(--card); border: var(--edge); border-radius: var(--r); padding: clamp(.5rem, 2vw, 1.25rem) clamp(.75rem, 3vw, 2rem); }
.staff-card .staff-svg { max-height: 16rem; }

/* ---- Home */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.hello { color: var(--ink-soft); margin-bottom: -.75rem; }
.continue { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.continue-text { flex: 1 1 15rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.continue-text .btn { margin-top: .5rem; }
.continue-art { flex: 1 1 12rem; max-width: 18rem; }
.listen-card { background: var(--card); }
.listen-card .card-icon.mic { background: var(--bad-bg); color: var(--bad); }
.listen-card .listen-art { flex: 0 1 11rem; min-width: 7rem; }
@media (max-width: 560px) { .listen-card { flex-wrap: wrap; } .listen-card .card-text { flex: 1 1 12rem; } .listen-card .listen-art { flex: 1 1 100%; max-width: 15rem; } }
.review-card .card-icon { background: var(--good-bg); color: var(--good); }
.week { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.week-days { list-style: none; padding: 0; display: flex; gap: .4rem; }
.week-days li { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.wd-dot { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; background: var(--card); }
.wd-dot .icon { width: 1.1rem; height: 1.1rem; }
.week-days li.met .wd-dot { background: var(--good); border-color: var(--good); color: var(--card); }
.week-days li.today .wd-dot { border-color: var(--ink); }
.wd-letter { font-size: .8rem; color: var(--ink-soft); font-weight: 650; }
.week-text { display: flex; gap: .4rem; align-items: center; color: var(--ink-soft); font-weight: 600; }
.path { display: flex; flex-direction: column; gap: 1.5rem; margin-top: .5rem; }
.unit { display: flex; flex-direction: column; gap: .6rem; }
.unit-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.unit-head h3 { font: 700 1.1rem var(--display); color: var(--heading); }
.unit-meta, .unit-blurb { color: var(--ink-soft); font-size: .95rem; }
.unit.locked .unit-head h3 { color: var(--ink-soft); }
.nodes { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .9rem 1.1rem; position: relative; }
.node { display: flex; flex-direction: column; align-items: center; gap: .3rem; width: 4.25rem; }
.node-btn { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-decoration: none; }
.node-btn b { width: 4rem; height: 4rem; border-radius: 50%; display: grid; place-items: center; font: 700 1.3rem var(--serif);
  background: var(--card); border: var(--edge); box-shadow: var(--lift); transition: transform var(--fade), box-shadow var(--fade); }
a.node-btn:active b { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.node.done b { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.node.open b { background: var(--accent); border-color: var(--accent); color: var(--on-ink); box-shadow: var(--lift), 0 0 0 6px var(--accent-bg); }
.node.locked b { border: 2px dashed var(--ink-soft); color: var(--ink-soft); background: transparent; box-shadow: none; }
.node-stars { font-style: normal; font-size: .85rem; letter-spacing: .08em; color: var(--gold); min-height: 1.2em; }
.node.open .node-stars { color: var(--accent); font-weight: 700; letter-spacing: 0; }
.skip-btn { align-self: flex-start; }

/* ---- Lesson */
.lesson { max-width: 46rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; min-height: calc(100dvh - 3rem); }
.lesson-top { display: flex; align-items: center; gap: .75rem; }
.lesson-bar { flex: 1; height: .9rem; border-radius: 99px; background: var(--card-2); border: var(--edge); overflow: hidden; }
.lesson-bar span { display: block; height: 100%; width: 0; background: var(--good); border-radius: 99px; transition: width var(--move) ease; }
.combo { min-width: 0; font-weight: 700; color: var(--accent); opacity: 0; transition: opacity var(--fade); white-space: nowrap; font-size: .95rem; }
.combo.show { opacity: 1; }
.stage { display: flex; flex-direction: column; gap: 1rem; }
.question, .teach { display: flex; flex-direction: column; gap: 1rem; animation: enter var(--move) ease both; }
.prompt { font: 600 clamp(1.35rem, 1.1rem + 1vw, 1.8rem)/1.2 var(--serif); text-align: center; margin-top: .25rem; }
.hint-line { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink-soft); font-size: .95rem; }
.hint-line .icon { color: var(--accent); margin-top: .1em; }
.letter-pad { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(4.25rem, 1fr)); }
.letter-pad.n2 { grid-template-columns: repeat(2, minmax(0, 12rem)); justify-content: center; }
.letter-pad.n3 { grid-template-columns: repeat(3, minmax(0, 10rem)); justify-content: center; }
.letter-pad.n4 { grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr)); }
.key-btn { min-height: 4.25rem; border-radius: 14px; border: var(--edge); background: var(--card); color: var(--ink); cursor: pointer;
  box-shadow: var(--lift); transition: transform var(--fade), box-shadow var(--fade), background-color var(--fade), border-color var(--fade); touch-action: manipulation; }
.key-btn .key-name { font: 600 clamp(1.4rem, 1.2rem + 1vw, 2rem) var(--serif); }
.key-btn.wide .key-name { font-size: clamp(1.2rem, 1rem + .8vw, 1.6rem); }
.key-btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.key-btn:disabled { cursor: default; }
.key-btn.is-correct { background: var(--good-bg); border-color: var(--good); color: var(--good); }
.key-btn.is-wrong { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.key-btn.is-answer { border: 3px solid var(--good); }
.under-pad { display: flex; justify-content: center; }
.timer { height: .45rem; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.timer span { display: block; height: 100%; width: 100%; background: var(--ink-soft); transform-origin: left; }
.timer.run span { animation: drain linear forwards; }
.teach { text-align: center; align-items: center; }
.teach .staff-card { width: 100%; }
.teach-title { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); }
.teach-tip { max-width: 34rem; font-size: 1.1rem; }
.teach-tip.soft { color: var(--ink-soft); font-size: 1rem; }
.feedback { min-height: 0; display: flex; flex-direction: column; gap: .35rem; border-radius: var(--r); }
.feedback:empty { display: none; }
.feedback.good, .feedback.bad { padding: 1rem 1.25rem; animation: rise var(--move) ease both; }
.feedback.good { background: var(--good-bg); color: var(--good); border-top: 3px solid var(--good); }
.feedback.bad { background: var(--bad-bg); border-top: 3px solid var(--bad); }
.feedback.bad .fb-title { color: var(--bad); }
.fb-title { display: flex; align-items: center; gap: .5rem; font: 600 1.3rem/1.25 var(--serif); }
.fb-detail { color: var(--ink); }
.feedback.good .fb-detail { color: var(--good); }
.fb-note { font-weight: 600; color: var(--ink); }
.feedback .btn.primary { align-self: flex-start; margin-top: .4rem; }
.summary { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; padding-top: 1rem; }
.summary h2 { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); outline: none; }
.stars { display: flex; gap: .5rem; }
.star { width: 3.5rem; height: 3.5rem; color: var(--line); }
.star .icon { width: 100%; height: 100%; }
.star.on { color: var(--gold); animation: pop 420ms cubic-bezier(.2, 1.4, .4, 1) both; }
.star.on:nth-child(2) { animation-delay: 140ms; }
.star.on:nth-child(3) { animation-delay: 280ms; }
.summary-stats { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.summary-stats div { background: var(--card); border: var(--edge); border-radius: var(--r-small); padding: .6rem 1rem; min-width: 7rem; }
.summary-stats dt { font-size: .85rem; color: var(--ink-soft); }
.summary-stats dd { font: 600 1.35rem var(--serif); }
.summary-note { max-width: 32rem; display: flex; gap: .4rem; align-items: center; justify-content: center; }
.summary-note.strong { font-weight: 700; }
.badge-row { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.badge-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 999px; background: var(--accent-bg); color: var(--ink); font-weight: 650; }
.badge-chip .icon { color: var(--gold); }

/* ---- Piano keyboard (answers). Keys never get narrower than 50 px (white) and 30 px (black): a wide range scrolls. */
.piano-strip { max-width: 100%; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: thin; padding-bottom: 2px; }
.piano { position: relative; height: 9rem; max-width: 40rem; width: 100%; min-width: calc(var(--whites, 8) * 50px); margin: 0 auto; user-select: none; -webkit-user-select: none; }
.pk { position: absolute; top: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
/* Keys look like a piano in both themes: ivory and black. */
.pk.white { height: 100%; background: #FFFFFF; border: 2px solid #282858; border-radius: 0 0 8px 8px; z-index: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: .4rem; container-type: inline-size; }
.pk.black { height: 60%; background: #282858; border: 2px solid #1A1A3A; border-radius: 0 0 6px 6px; z-index: 2; }
.pk-label { display: flex; flex-direction: column; align-items: center; font-size: .75rem; line-height: 1.1; color: #5B5348; font-weight: 650; }
.pk-sub { max-width: 100%; font-size: .65rem; font-weight: 600; overflow-wrap: anywhere; text-align: center; }
/* Russian and Georgian words run long: a word wider than its button breaks instead of spilling over; Russian
   buttons hyphenate (headings do not: a split word there reads badly). English is untouched. */
html:not([lang^="en"]) :is(button, .btn, .chip, .choice, .key-btn, label, h1, h2, h3) { overflow-wrap: anywhere; }
/* Tab labels never break inside a word ("პროგრეს/ი"): a little smaller instead, as tab bars are. */
html:not([lang^="en"]) .tabs a { font-size: .74rem; }
html[lang="ru"] :is(button, .btn, .choice, .chip) { hyphens: auto; -webkit-hyphens: auto; }
@container (max-width: 3rem) { .pk-sub { display: none; } }
.pk.middle-c { background: #E6ECFA; }
.pk.is-correct { background: var(--good) !important; }
.pk.is-wrong { background: var(--bad) !important; }
.pk.is-answer { outline: 3px solid var(--good); outline-offset: -3px; }

/* ---- Listen & Write */
.page-head { display: flex; flex-direction: column; gap: .35rem; }
.live { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
@media (max-width: 640px) { .live { grid-template-columns: 1fr; } }
.live-main { display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.live-name { font: 600 clamp(3rem, 2.4rem + 3vw, 4.5rem)/1 var(--serif); min-height: 1em; }
.live-cents { color: var(--ink-soft); font-size: .95rem; }
.tuner { display: flex; align-items: center; gap: .5rem; width: 100%; max-width: 16rem; color: var(--ink-soft); font-family: var(--serif); }
.tuner .track { position: relative; flex: 1; height: 1.75rem; border-radius: 99px; background: linear-gradient(90deg, transparent 0 40%, var(--good-bg) 40% 60%, transparent 60%), var(--card-2); border: var(--edge); }
.needle { position: absolute; top: 15%; bottom: 15%; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--ink); transition: left 90ms linear; }
.needle.in-tune { background: var(--good); }
.live-side { display: flex; flex-direction: column; gap: .75rem; }
.meter { height: .6rem; border-radius: 99px; background: var(--card-2); overflow: hidden; border: var(--edge); }
.meter span { display: block; height: 100%; width: 0; background: var(--good); transition: width 80ms linear; }
.live-status { min-height: 3em; }
.live-buttons { display: flex; align-items: center; gap: 1rem; }
.beat-dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--card-2); border: var(--edge); }
.beat-dot.on { animation: beat 300ms ease-out; }
.beat-dot.accent { background: var(--accent-bg); }
.listen-options { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.segmented { display: inline-flex; border: var(--edge); border-radius: var(--r-small); overflow: hidden; background: var(--card); }
.segmented button { min-height: 2.75rem; padding: .4rem 1rem; border: 0; background: transparent; font-weight: 650; cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--ink); color: var(--on-ink); }
.mini-field { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--ink-soft); font-weight: 650; }
.mini-field select, .field select { min-height: 2.75rem; padding: .35rem 2rem .35rem .75rem; border: var(--edge); border-radius: var(--r-small);
  background: var(--card); color: var(--ink); font-size: 1rem; font-weight: 500; }
.timed-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; width: 100%; }
.stepper { display: inline-flex; align-items: center; gap: .25rem; border: var(--edge); border-radius: var(--r-small); background: var(--card); }
.stepper .btn { font-size: 1.3rem; }
.stepper-value { min-width: 9rem; text-align: center; font-weight: 700; }
.stepper-value small { font-weight: 500; color: var(--ink-soft); }
.check { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; }
.check input, .field.toggle input { width: 1.4rem; height: 1.4rem; accent-color: var(--ink); }
.score-card { display: flex; flex-direction: column; gap: .75rem; }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.score-info { color: var(--ink-soft); font-size: .95rem; }
.score { position: relative; min-height: 6rem; }
.score .note[data-id] { cursor: pointer; }
.score-empty { position: absolute; inset: auto 0 .5rem 0; text-align: center; color: var(--ink-soft); }
.select-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .5rem; border-radius: var(--r-small); background: var(--accent-bg); }
.sel-name { font: 600 1.2rem var(--serif); margin-right: auto; padding-left: .25rem; }
.actions .btn { flex: 0 0 auto; }
.form-note { min-height: 1.5em; color: var(--ink-soft); }
.form-note .button-row { display: inline-flex; margin-left: .25rem; }
.pieces { display: flex; flex-direction: column; gap: .5rem; }
.piece-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.piece-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; background: var(--card); border: var(--edge); border-radius: var(--r-small); padding: .25rem; }
.piece-ask { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .25rem .6rem .4rem; }
.piece-open { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-height: 2.75rem; padding: .4rem .6rem; border: 0; background: transparent; cursor: pointer; text-align: left; }
.piece-title { font: 600 1.05rem var(--serif); }
.piece-meta { color: var(--ink-soft); font-size: .9rem; }
.piece-list input { flex: 1; min-height: 2.75rem; padding: .3rem .6rem; border: 2px solid var(--accent); border-radius: 8px; background: var(--card); }

/* ---- Progress and Practise */
.card.muted { opacity: .6; display: flex; align-items: center; gap: 1rem; }
.stat-card { display: flex; flex-direction: column; gap: .75rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; }
.stat-big { font: 600 1.6rem/1.2 var(--serif); }
.xp-bar { height: .75rem; border-radius: 99px; background: var(--card-2); border: var(--edge); overflow: hidden; }
.xp-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.note-map { display: flex; flex-direction: column; gap: .75rem; }
.map-svg { overflow-x: auto; }
.map-svg .staff-svg { min-width: 32rem; }
.map-legend { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.map-legend li { padding-left: 1.4rem; position: relative; }
.map-legend li::before { content: ""; position: absolute; left: 0; top: .35em; width: .9rem; height: .9rem; border-radius: 50%; }
.m-good::before { background: var(--good); }
.m-learning::before { background: var(--accent); }
.m-new::before { background: var(--ghost); }
.badges { display: flex; flex-direction: column; gap: .75rem; }
.badge-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .6rem; }
.badge-grid li { display: flex; gap: .75rem; align-items: center; padding: .75rem; border: var(--edge); border-radius: var(--r-small); background: var(--card); }
.badge-grid li:not(.got) { color: var(--ink-soft); }
.badge-icon { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); flex: none; }
.badge-grid li.got .badge-icon { background: var(--accent-bg); color: var(--gold); }
.badge-text { display: flex; flex-direction: column; }
.badge-text span { font-size: .9rem; }

/* ---- Forms (Settings) */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field > label { font-weight: 650; }
.field.toggle { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; align-items: center; }
.field.toggle .hint { grid-column: 2; }
.range-row { display: flex; align-items: center; gap: .75rem; }
.range-row input[type="range"] { flex: 1; min-height: 2.75rem; accent-color: var(--ink); }
.range-row output { min-width: 4.5rem; font-weight: 700; }
.file-btn { position: relative; }
.row-link { display: flex; align-items: center; gap: .75rem; min-height: 3rem; padding: .5rem 1rem; text-decoration: none; background: var(--card); border: var(--edge); border-radius: var(--r-small); }
.row-link .icon.end { margin-left: auto; }
.back-link { display: inline-flex; align-items: center; gap: .25rem; min-height: 2.75rem; text-decoration: none; color: var(--ink-soft); font-weight: 650; align-self: flex-start; }
.plain-list { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.error-page { max-width: 30rem; margin: 3rem auto; text-align: center; }
.noscript { padding: 2rem; text-align: center; }

/* ---- Welcome */
.welcome { max-width: 40rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; padding-top: 1rem; }
.welcome-top { display: flex; align-items: center; gap: 1rem; }
.dots { display: flex; gap: .4rem; }
.dots span { width: 2rem; height: .4rem; border-radius: 99px; background: var(--line); }
.dots span.on { background: var(--ink); }
.welcome-step { display: flex; flex-direction: column; gap: 1.25rem; animation: enter var(--move) ease both; }
.welcome-hero { display: flex; flex-direction: column; gap: 1rem; padding: 2rem 0 .5rem; }
.welcome-hero h1 { font-size: clamp(2rem, 1.5rem + 2.5vw, 3rem); }
.welcome-hero + .btn { align-self: flex-start; }
/* Language menu on every screen (P2-122), as on raisesteady.com: a pill with the current code and a caret, opening a
   list of the three languages in their own names. The current one is marked by weight and a mark, not colour only. */
.lang-bar { display: flex; justify-content: flex-end; margin-bottom: .5rem; }
.lang-menu { position: relative; flex: none; }
.lang-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; padding: 0 .8rem 0 .9rem; border: var(--edge);
  border-radius: 999px; background: var(--card); color: var(--ink); box-shadow: var(--lift); font: 700 .8rem/1 var(--sans);
  letter-spacing: .04em; cursor: pointer; }
.lang-btn::after { content: ""; width: .4rem; height: .4rem; margin-top: -.2rem; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform var(--fade) ease; }
.lang-btn[aria-expanded="true"]::after { transform: rotate(225deg); margin-top: .2rem; }
.lang-btn:hover, .lang-btn[aria-expanded="true"] { background: var(--accent-bg); }
.lang-btn:active { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.lang-list { position: absolute; top: calc(100% + .6rem); right: 0; z-index: 30; min-width: 13rem; padding: .4rem; display: flex;
  flex-direction: column; gap: .15rem; border: var(--edge); border-radius: var(--r-small); background: var(--card); box-shadow: var(--lift);
  animation: fade var(--fade) ease both; }
.lang-list button { display: flex; align-items: center; gap: .7rem; width: 100%; min-height: 2.75rem; padding: .5rem .65rem; border: 0;
  border-radius: 10px; background: none; color: var(--ink); font: 500 1rem/1.2 var(--sans); text-align: left; cursor: pointer; }
.lang-list button b { min-width: 1.8rem; font-size: .75rem; letter-spacing: .04em; color: var(--ink-soft); }
.lang-list button:hover { background: var(--card-2); }
.lang-list button[aria-current] { font-weight: 700; }
.lang-list button[aria-current]::after { content: "✓"; margin-left: auto; font-weight: 700; }   /* i18n-ignore */
.lesson-top .lang-btn { box-shadow: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .6rem; }
.choice-list { display: flex; flex-direction: column; gap: .6rem; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; min-height: 3.5rem; padding: .8rem 1rem; text-align: left;
  border: var(--edge); border-radius: var(--r-small); background: var(--card); cursor: pointer; box-shadow: var(--lift); }
.choice:active { transform: translate(3px, 3px); box-shadow: var(--lift-down); }
.choice-label { font-weight: 700; font-size: 1.05rem; }
.choice-sub { color: var(--ink-soft); font-size: .92rem; }

/* ---- Motion: gentle entrances; with Reduce Motion the same timings become plain fades */
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 100% { opacity: 1; transform: scale(1); } }
@keyframes beat { 0% { transform: scale(1.5); background: var(--accent); } 100% { transform: scale(1); } }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeBeat { 0% { background: var(--accent); } 100% { background: var(--card-2); } }
@media (prefers-reduced-motion: reduce) {
  .question, .teach, .welcome-step, .feedback.good, .feedback.bad, .star.on { animation-name: fade; }
  .beat-dot.on { animation-name: fadeBeat; }
  .btn:active:not(:disabled), .key-btn:active:not(:disabled), a.node-btn:active b, .choice:active, a.card:active, .lang-btn:active { transform: none; }
  .lang-btn::after { transition-property: none; }   /* the list itself fades in both modes */
  .needle, .meter span, .lesson-bar span { transition-property: none; }
}

/* ---- Print: only the music */
@media print {
  .tabs, .page-head, .live, .listen-options, .select-bar, .actions, .form-note, .pieces, .score-head .score-info, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .main { padding: 0; }
  .score-svg { color: #000; }
}

.mic-check { gap: .5rem; }
.mic-heard { font: 600 1.1rem var(--serif); min-height: 1.5em; }
