/* Hymnphony Learn. Montserrat only; weights 400 to 600. */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1d2433;
  --soft: #5d6779;
  --line: #d9dde5;
  --navy: #2f4a6e;
  --gold: #c99a3f;
  --gold-ink: #8a6420;
  --right: #2f8f5b;
  --wrong: #c0453b;
  --staff: #3a4558;
  --accent-bg: #eaf0f7;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.06), 0 8px 24px rgba(20, 30, 50, 0.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1622; --card: #172131; --ink: #eef1f6; --soft: #a3aec0; --line: #2a374b;
    --navy: #8fb1dc; --gold: #d8ad5a; --gold-ink: #e2bd73; --right: #5cc28b; --wrong: #ef7a70;
    --staff: #c9d2e0; --accent-bg: #1d2a3e; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1622; --card: #172131; --ink: #eef1f6; --soft: #a3aec0; --line: #2a374b;
  --navy: #8fb1dc; --gold: #d8ad5a; --gold-ink: #e2bd73; --right: #5cc28b; --wrong: #ef7a70;
  --staff: #c9d2e0; --accent-bg: #1d2a3e; --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.6 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
b, strong { font-weight: 600; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 12px max(16px, calc((100vw - 1080px) / 2)); background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 26px; height: 24px; }
.m-navy { fill: var(--navy); } .m-gold { fill: var(--gold); }
.word { font-weight: 600; letter-spacing: 0.28em; font-size: 14px; }
#nav { display: flex; gap: 26px; margin-left: auto; font-size: 15px; font-weight: 500; }
#nav a { color: var(--soft); transition: color 0.2s; }
#nav a:hover { color: var(--ink); }
.tools { display: flex; gap: 4px; }
.icon { width: 40px; height: 40px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; color: var(--soft); }
.icon:hover { background: var(--accent-bg); color: var(--ink); }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon svg .fill { fill: currentColor; stroke: none; }
.icon[aria-pressed="false"] .wave { opacity: 0; }
.menu { display: none; }
@media (max-width: 720px) {
  .menu { display: grid; }
  #nav { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; margin: 0; padding: 6px 16px 14px;
    background: var(--bg); box-shadow: var(--shadow); display: none; }
  #nav.open { display: flex; }
  #nav a { padding: 12px 4px; font-size: 17px; }
  .tools { margin-left: auto; }
}

main { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* hero */
.hero { padding: 72px 0 40px; max-width: 720px; }
.eyebrow { color: var(--gold-ink); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; font-size: 13px; margin: 0 0 14px; }
h1 { font-weight: 600; font-size: clamp(34px, 6vw, 56px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 18px; }
.lead { color: var(--soft); font-size: clamp(17px, 2.2vw, 20px); margin: 0 0 28px; max-width: 620px; }
.lead.small { font-size: 17px; margin-bottom: 22px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 500; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0f1622; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0f1622; } }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn.big { min-height: 54px; padding: 0 40px; font-size: 18px; }
.link { border: 0; background: none; color: var(--soft); cursor: pointer; padding: 10px; font-size: 15px; }
.link:hover { color: var(--ink); }

h2.section { font-weight: 600; font-size: clamp(26px, 3.6vw, 34px); margin: 56px 0 8px; letter-spacing: -0.01em; }

/* lessons */
.lesson { display: grid; grid-template-columns: 52px 1fr; gap: 18px; padding: 34px 0; }
.num { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: var(--navy); font-weight: 600; }
h3 { font-weight: 600; font-size: 22px; margin: 4px 0 10px; }
.body > p { margin: 0 0 12px; max-width: 680px; }
.hint, .cap { color: var(--soft); font-size: 15px; }
.cap { margin: 0 0 4px; }
.cap b { color: var(--ink); letter-spacing: 0.08em; }
.card { background: var(--card); border-radius: 18px; padding: 14px 16px 10px; box-shadow: var(--shadow); margin: 12px 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; gap: 0; } .lesson { grid-template-columns: 1fr; gap: 6px; } }
.tell { margin: 0; min-height: 1.6em; color: var(--navy); font-weight: 500; font-size: 15px; text-align: center; }
.check { margin-top: 14px; }
.result { color: var(--soft); margin: 10px 0 0; font-size: 15px; }

/* staff */
.staffbox { width: 100%; }
.staff { display: block; width: 100%; height: auto; max-height: 230px; overflow: visible; }
.staff .line { stroke: var(--staff); stroke-width: 1; opacity: 0.55; }
.staff .ledger { opacity: 0.7; }
.staff .ink { fill: var(--ink); }
.staff .clef { fill: var(--staff); }
.staff .label { fill: var(--soft); font: 500 9px 'Montserrat', sans-serif; letter-spacing: 0.04em; }
.staff .hit { fill: transparent; cursor: pointer; outline: none; }
.staff .note .ink { transition: fill 0.2s; }
.staff .note.lit .ink, .staff .note:focus-within .ink { fill: var(--gold); }
.staff .note.lit .label { fill: var(--gold-ink); }
.staff .note.is-right .ink { fill: var(--right); }
.staff .note.is-wrong .ink { fill: var(--wrong); }
.staff .note.pop { transform-box: fill-box; transform-origin: center; animation: pop 0.28s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.94); } }

/* quizzes */
.quiz { display: grid; gap: 12px; }
.quiz .q { max-width: 380px; width: 100%; margin: 0 auto; }
.quiz .q .staff { max-height: 300px; }
.quiz.mini { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); max-width: 520px; margin-top: 12px; }
.quiz.mini .q { max-width: 260px; }
.options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 560px) { .options { grid-template-columns: repeat(2, 1fr); } }
.opt {
  position: relative; min-height: 64px; border-radius: 16px; border: 1px solid var(--line); background: var(--card);
  font-size: 24px; font-weight: 500; cursor: pointer; transition: transform 0.12s, background 0.2s, border-color 0.2s;
}
.quiz.mini .opt { min-height: 52px; font-size: 20px; }
.opt:hover:not(:disabled) { border-color: var(--navy); transform: translateY(-1px); }
.opt:active:not(:disabled) { transform: scale(0.98); }
.opt-key { position: absolute; top: 6px; right: 10px; font-size: 11px; color: var(--soft); font-weight: 500; }
@media (hover: none) { .opt-key { display: none; } }
.opt.right { background: color-mix(in srgb, var(--right) 16%, var(--card)); border-color: var(--right); }
.opt.wrong { background: color-mix(in srgb, var(--wrong) 14%, var(--card)); border-color: var(--wrong); animation: shake 0.3s; }
.opt:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.say { margin: 0; min-height: 1.6em; text-align: center; color: var(--soft); font-weight: 500; }
.timer { height: 6px; border-radius: 6px; background: var(--accent-bg); overflow: hidden; max-width: 380px; width: 100%; margin: 0 auto; }
.timer i { display: block; height: 100%; background: var(--navy); transform-origin: left; transition: background 0.3s; }
.timer i.late { background: var(--gold); }

/* the game */
.panel { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 26px; }
.setup { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
@media (max-width: 760px) { .setup { grid-template-columns: 1fr; } .panel { padding: 18px; } }
.field { display: grid; gap: 10px; align-content: start; }
.lbl { font-weight: 600; font-size: 15px; display: flex; justify-content: space-between; gap: 10px; }
.lbl output { color: var(--soft); font-weight: 500; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--accent-bg); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; border-radius: 10px; min-height: 42px; cursor: pointer; font-weight: 500; color: var(--soft); transition: background 0.2s, color 0.2s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 30, 50, 0.12); }
.seg.tall button { min-height: 58px; display: grid; place-content: center; gap: 2px; line-height: 1.2; padding: 6px 4px; }
.seg small { font-size: 11.5px; font-weight: 400; color: var(--soft); }
input[type="range"] { width: 100%; accent-color: var(--navy); height: 28px; }
input[type="range"]:disabled { opacity: 0.4; }
.tick { display: flex; gap: 8px; align-items: center; color: var(--soft); font-size: 15px; cursor: pointer; }
.tick input { accent-color: var(--navy); width: 18px; height: 18px; }
.go { display: grid; justify-items: center; gap: 10px; margin-top: 26px; }
.go .preview { max-width: 190px; }
.soft { color: var(--soft); font-size: 14px; margin: 0; }
@media (hover: none) { .keys { display: none; } }
.play { display: grid; gap: 14px; }
.hud { display: flex; justify-content: space-between; gap: 12px; color: var(--soft); font-size: 15px; }
.hud b { color: var(--ink); font-weight: 600; }
.play .link { justify-self: center; }
.sum .big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.sum .big b { font-size: 56px; font-weight: 500; line-height: 1; color: var(--navy); }
.sum .big span { color: var(--soft); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
@media (max-width: 560px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stats div { background: var(--accent-bg); border-radius: 14px; padding: 12px 14px; display: grid; }
.stats b { font-size: 22px; font-weight: 600; }
.stats span { color: var(--soft); font-size: 13.5px; }
h4 { font-weight: 600; font-size: 16px; margin: 18px 0 8px; }
.missed-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.missed { width: 120px; background: var(--accent-bg); border-radius: 14px; padding: 4px 6px; }

/* app */
.app { text-align: center; padding: 80px 0 40px; max-width: 640px; margin: 0 auto; }
.app h2 { font-weight: 600; font-size: clamp(26px, 3.6vw, 34px); margin: 0 0 10px; }
.app p { color: var(--soft); margin: 0 0 22px; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; max-width: 1080px; margin: 0 auto; padding: 28px 16px 40px; color: var(--soft); font-size: 14px; }
.foot p { margin: 0; }
.credit b { font-weight: 600; color: var(--ink); }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

/* ---------------------------------------------------------------- the course */
.course { display: grid; gap: 18px; padding-bottom: 20px; }
.part { background: var(--card); border-radius: 22px; box-shadow: var(--shadow); padding: 22px 22px 10px; display: grid; grid-template-columns: 260px 1fr; gap: 20px; }
@media (max-width: 760px) { .part { grid-template-columns: 1fr; gap: 6px; padding: 18px 16px 8px; } }
.part-n { color: var(--gold-ink); font-weight: 600; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; }
.part-head h2 { font-weight: 600; font-size: 24px; margin: 6px 0 6px; }
.part-head p { color: var(--soft); margin: 0 0 10px; font-size: 15px; }
.sessions { list-style: none; margin: 0; padding: 0; }
.sessions a { display: flex; align-items: center; gap: 14px; padding: 12px 8px; border-radius: 14px; transition: background 0.2s; }
.sessions a:hover { background: var(--accent-bg); }
.sn { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: var(--navy); font-weight: 600; font-size: 15px; }
.done .sn { background: var(--navy); color: var(--card); }
.sn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.st { display: grid; flex: 1; min-width: 0; }
.st b { font-weight: 600; }
.st small { color: var(--soft); font-size: 14px; }
.sb { color: var(--gold-ink); font-weight: 500; font-size: 14px; }

/* ---------------------------------------------------------------- a session */
.crumbs { display: flex; gap: 10px; padding-top: 28px; color: var(--soft); font-size: 14px; }
.crumbs a { color: var(--navy); font-weight: 500; }
.crumbs span::before { content: '/'; margin-right: 10px; opacity: 0.5; }
.sess-head { padding: 18px 0 8px; max-width: 720px; }
.sess-head h1 { font-size: clamp(30px, 5vw, 46px); margin-bottom: 10px; }
.sess-head .lead { margin-bottom: 10px; }
.lesson-body { max-width: 780px; }
.lesson-body > p { margin: 0 0 14px; }
.tip { background: var(--accent-bg); border-radius: 14px; padding: 12px 16px; color: var(--ink); font-size: 15px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.card-foot .tell { text-align: left; flex: 1; }
.cap { margin: 0 0 4px; }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 36px 0 10px; }
.game { padding-top: 10px; }
.field.wide { grid-column: 1 / -1; }

/* figures in the game */
.prompt { text-align: center; font-weight: 500; font-size: 18px; margin: 0; }
.figure { min-height: 120px; display: grid; place-items: center; }
.quiz .q.wide { max-width: 560px; }
.figure.wide { max-width: 420px; }
.ear { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-bg); color: var(--navy); margin: 20px auto; }
.ear svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.replay { justify-self: center; }
.options.two { grid-template-columns: repeat(2, 1fr); }
.options.three { grid-template-columns: repeat(3, 1fr); }
.options.long { grid-template-columns: repeat(2, 1fr); }
.options.long .opt { font-size: 16px; min-height: 58px; padding: 8px 12px; }
@media (max-width: 560px) { .options.three { grid-template-columns: 1fr; } .options.long { grid-template-columns: 1fr; } }
.opt small { display: block; font-size: 12px; color: var(--soft); font-weight: 400; margin-top: 2px; }

/* signs */
.sign { display: block; height: 64px; width: auto; max-width: 100%; margin: 0 auto; }
.sign.wide { width: 120px; height: 40px; }
.sign path, .sign .ink { fill: var(--ink); }
.sign .stroke { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.signs-row { display: flex; gap: 2px; justify-content: center; align-items: end; }
.signs-row .sign { height: 56px; }
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.sign-cell { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 12px 10px; display: grid; gap: 8px; align-content: start; text-align: center; }
.sign-fig { min-height: 70px; display: grid; place-items: center; }
.sign-fig .staff { max-height: 90px; }
.sign-cell p { margin: 0; font-size: 13.5px; color: var(--soft); }

/* the piano */
.kb { width: 100%; }
.piano { display: block; width: 100%; max-width: 620px; height: auto; margin: 8px auto; user-select: none; -webkit-user-select: none; }
.piano .white { fill: #fdfcf9; stroke: #9aa3b2; stroke-width: 1; cursor: pointer; transition: fill 0.15s; }
.piano .black { fill: #1d2433; cursor: pointer; transition: fill 0.15s; }
.piano .white:hover { fill: #eef2f8; }
.piano .black:hover { fill: #3a4558; }
.piano .lit.white, .piano .lit.black { fill: var(--gold); }
.piano .right { fill: var(--right) !important; }
.piano .wrong { fill: var(--wrong) !important; }
.piano .klabel { font: 500 9px 'Montserrat', sans-serif; fill: #5d6779; pointer-events: none; }

/* the tapping game */
.beat { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 22px; color: var(--navy); background: var(--accent-bg); }
.beat.on { animation: beat 0.25s ease-out; }
@keyframes beat { from { background: var(--gold); color: #fff; transform: scale(1.12); } }
.tap-row { display: flex; gap: 10px; justify-content: center; }
.tapper { justify-self: center; width: min(100%, 360px); min-height: 110px; border-radius: 26px; border: 1px solid var(--line); background: var(--accent-bg); font-size: 22px; font-weight: 500; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tapper.hit { animation: hit 0.18s ease-out; }
@keyframes hit { from { background: var(--navy); color: #fff; transform: scale(0.98); } }

/* the ones you missed */
.missed { width: 170px; background: var(--accent-bg); border-radius: 14px; padding: 8px; cursor: pointer; }
.missed .staff { max-height: 110px; }
.missed .ear { width: 56px; height: 56px; margin: 6px auto; }
.missed .ear svg { width: 28px; height: 28px; }
.missed .sign { height: 44px; }
.missed p { margin: 4px 0 0; font-size: 12.5px; color: var(--soft); line-height: 1.4; }
.staff .ghost .ink { fill: var(--soft); opacity: 0.35; }
.staff .label { font-size: 9px; }

.quiz .q .staff.grand { max-height: 380px; }
.lesson-body .staff.grand { max-height: 330px; }

/* sign in */
.signin { border: 1px solid var(--line); background: var(--card); border-radius: 12px; min-height: 38px; padding: 0 14px; font-weight: 500; font-size: 14px; cursor: pointer; margin-right: 4px; white-space: nowrap; }
.signin.in { color: var(--navy); }
.dlg { border: 0; border-radius: 22px; padding: 26px 24px 20px; width: min(420px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 20, 40, 0.3); }
.dlg::backdrop { background: rgba(10, 16, 28, 0.45); backdrop-filter: blur(3px); }
.dlg h2 { font-weight: 600; font-size: 22px; margin: 0 0 6px; }
.dlg-close { position: absolute; top: 10px; right: 10px; margin: 0; }
.gbtn { min-height: 44px; margin: 18px 0 8px; display: flex; justify-content: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--soft); font-size: 13px; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.email-form { display: grid; gap: 10px; }
.email-form input { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 0 14px; font: inherit; }
.email-form input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
#learn-code { letter-spacing: 0.4em; font-size: 20px; text-align: center; }
.err { color: var(--wrong); font-size: 14px; min-height: 1.4em; margin: 8px 0 0; }
.fine { color: var(--soft); font-size: 12.5px; margin: 6px 0 0; }
.fine a { color: var(--navy); }
@media (max-width: 420px) { .signin { padding: 0 10px; } .word { display: none; } }
