:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --surface: #fffcf7;
  --ink: #28241f;
  --muted: #6e665c;
  --line: #e7dfd1;
  --amber: #ffce6d;
  --amber-dark: #985711;
  --gold-ink: #76480d;
  --soft-gold: #f9edd6;
  --wood: #24201d;
  --page-gutter: 40px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, select { font: inherit; }
button { color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid #986410; outline-offset: 4px; }
svg { display: inline-block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; }
.shell {
  --left-gutter: max(var(--page-gutter), env(safe-area-inset-left));
  --right-gutter: max(var(--page-gutter), env(safe-area-inset-right));
  width: min(1200px, calc(100% - var(--left-gutter) - var(--right-gutter)));
  margin-left: max(var(--left-gutter), calc((100% - 1200px) / 2));
}
.mast { padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); background: #f9f6ef; }
.mast-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand, .mast-controls, .top-score { display: flex; align-items: center; }
.brand { gap: 11px; }
.brand-icon { width: 37px; height: 37px; border-radius: 11px; display: grid; place-items: center; background: var(--amber); color: #2a2115; box-shadow: inset 0 0 0 1px #eeb853; }
.brand-icon svg { width: 22px; height: 22px; stroke-width: 1.9; }
.brand-word { display: grid; gap: 2px; font-weight: 850; font-size: 19px; line-height: 1; letter-spacing: .07em; }
.brand-word strong { font-weight: inherit; white-space: nowrap; }
.brand-word span { font: 700 9px/1.1 var(--mono); color: var(--muted); letter-spacing: .17em; }
[lang="en"] .brand-word { letter-spacing: -.025em; }
[lang="en"] .brand-subtitle, [lang="en"] .footer-translation { display: none; }
.mast-controls { gap: 12px; }
.top-score { min-height: 37px; gap: 7px; padding: 0 12px; font-size: 12px; background: #f2ebdd; border: 1px solid #e9dfce; border-radius: 8px; color: #5c4b35; }
.top-score svg { width: 16px; height: 16px; color: #91601c; }
.top-score strong, .score-total { font-family: var(--mono); }
.top-score strong { font-size: 13px; padding-left: 2px; }
.score-total { color: #796e61; }
.sound-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); display: grid; place-items: center; }
.sound-button:hover { background: var(--soft-gold); }
.sound-button svg { width: 17px; height: 17px; }
.map-link { display: none; }
.language-link { min-width: 44px; min-height: 38px; display: grid; place-items: center; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: #5c4b35; font-size: 12px; font-weight: 750; }
.language-link:hover { background: var(--soft-gold); }
.intro { position: relative; min-height: 158px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 4px 21px; }
.eyebrow { display: flex; align-items: center; gap: 9px; font: 700 11px/1.4 var(--mono); letter-spacing: .15em; color: #786850; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #c88329; box-shadow: 0 0 0 3px #efdfc4; margin-left: 3px; }
.eyebrow-rule { width: 20px; height: 1px; background: #b8a283; }
h1, h2, p { margin: 0; }
.intro h1 { margin: 11px 0 10px; font-size: clamp(36px, 4.4vw, 60px); letter-spacing: -.06em; font-weight: 850; line-height: 1.16; }
.intro h1 > span { color: #9a551b; }
.intro h1 > .hero-lead { color: inherit; }
[lang="en"] .eyebrow-en, [lang="en"] .eyebrow-rule { display: none; }
.intro p { color: var(--muted); font-size: 15px; line-height: 1.6; letter-spacing: .055em; }
.staff { width: min(29%, 308px); height: auto; margin-right: 24px; stroke: none; stroke-width: 1; overflow: visible; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) 303px; gap: 22px; align-items: start; }
.challenge, .roadmap { background: var(--surface); border: 1px solid #e6ddce; border-radius: 18px; box-shadow: 0 4px 8px #46331705, 0 16px 40px #46331706; }
.challenge { min-width: 0; padding: 21px; scroll-margin-top: 14px; }
.level-head { position: relative; min-height: 76px; padding: 1px 2px 0; }
.level-tag { font: 800 11px/1.2 var(--mono); color: #92561a; letter-spacing: .16em; margin-bottom: 10px; }
.level-head h2 { font-size: clamp(24px, 2.5vw, 33px); letter-spacing: -.035em; line-height: 1.24; margin-bottom: 7px; }
.level-head h2:focus, #result-title:focus { outline: none; }
.level-head p { color: var(--muted); font-size: 13px; line-height: 1.65; padding-bottom: 1px; }
.badges { display: flex; gap: 6px; position: absolute; right: 1px; top: 0; }
.badges span { background: #f4eee3; color: #6e5b40; font-size: 11px; border: 1px solid #eee5d7; border-radius: 999px; padding: 4px 9px; white-space: nowrap; }
.badges span:first-child { background: #faecd1; border-color: #f4e4c3; color: #794e16; }
.phase-bar { display: flex; align-items: center; gap: 10px; margin: 10px 0 13px; padding: 5px 9px; min-height: 40px; border-radius: 9px; border: 1px solid #eee6d9; background: #f6f2e9; }
.phase { display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 5px 12px; color: #746a5d; border-radius: 6px; font-size: 12px; white-space: nowrap; }
.phase b { font: 700 10px/1 var(--mono); color: #786b58; }
.phase.active { background: #fbdfab; color: #5e3a10; font-weight: 750; }
.phase.active b { color: #6f4718; }
.phase-line { flex: 0 1 24px; height: 1px; background: #ded4c3; }
.piano { overflow: hidden; border: 1px solid #1f1915; border-radius: 13px; background: linear-gradient(110deg, #332c25, #29241f 56%, #332c26); padding: 0 16px; box-shadow: 0 4px 0 #dfd5c7, inset 0 1px 0 #ffffff22; }
.piano-top, .piano-bottom { color: #d6c9b5; font-size: 11px; display: flex; align-items: center; gap: 8px; }
.piano-top { min-height: 37px; justify-content: space-between; }
.instrument { display: inline-flex; align-items: center; gap: 7px; letter-spacing: .17em; font: 700 10px/1 var(--mono); }
.instrument i { width: 5px; height: 5px; border-radius: 50%; background: #ffcc6a; box-shadow: 0 0 7px #daa048b3; }
.piano-top #piano-info { color: #f3d097; }
.keys-scroll { position: relative; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #9c8262 #302820; padding-bottom: 1px; }
.keys { --min-white: 39px; --visible-whites: var(--white-count); position: relative; isolation: isolate; display: flex; min-width: calc(var(--visible-whites) * var(--min-white)); height: clamp(160px, 13vw, 211px); border-radius: 0 0 7px 7px; background: #27211c; padding-top: 3px; box-shadow: inset 0 3px #8b402e; }
.key { border: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; padding: 0; min-width: 0; isolation: isolate; touch-action: manipulation; user-select: none; -webkit-touch-callout: none; }
.key:focus-visible { z-index: 4; outline: 2px solid #bc7f18; outline-offset: -4px; }
.key.white { width: calc(100% / var(--visible-whites)); height: 100%; border: 1px solid #544d42; border-top: 0; border-radius: 0 0 6px 6px; background: linear-gradient(#e3dace 0%, #fffdfa 17%, #fff9ee 92%, #e6dac6 93%); box-shadow: inset 0 -3px #fff9ee77; }
.key.white.locked { background: linear-gradient(#c5bfb4 0%, #eee8dd 18%, #e8e1d6 92%, #c6bcb0 93%); box-shadow: inset 0 -3px #f7f0e638; }
.key.black { position: absolute; top: 3px; z-index: 2; left: calc(100% / var(--visible-whites) * var(--position)); width: calc(61% / var(--visible-whites)); height: 61%; transform: translateX(-50%); border-radius: 0 0 5px 5px; border: 1px solid #211c18; border-top: 0; color: #ffedcd; background: linear-gradient(95deg, #25221e 0%, #453c33 17%, #393128 82%, #211c19 100%); box-shadow: 0 5px 4px #211b1660, inset 0 -7px #191613, inset 0 -8px #453a2d; }
.key.black.locked { color: #aa9b8b; background: linear-gradient(95deg, #24201d 0%, #3a342e 17%, #332c26 82%, #201c19 100%); }
.key.black:focus-visible { z-index: 4; }
.key-face { pointer-events: none; display: grid; gap: 2px; align-content: end; justify-items: center; padding-bottom: 12px; min-height: 42px; width: 100%; }
.key-face strong { font-size: clamp(12px, 1.55vw, 19px); line-height: 1.15; font-weight: 750; color: #4e3317; white-space: nowrap; }
.key-note { font: 650 10px/1.3 var(--mono); color: #746551; }
.key-face i { display: none; width: 6px; height: 6px; border-radius: 50%; background: #bc7b24; margin: 3px 0 4px; }
.key.new-note .key-face i { display: block; }
.key-face kbd { margin-top: 4px; min-width: 17px; height: 16px; line-height: 14px; padding-inline: 2px; border: 1px solid #dcd0bd; background: #fffaf1; border-radius: 3px; color: #685947; font: 650 9px/14px var(--mono); text-align: center; }
.key-face svg { width: 13px; height: 13px; color: #918574; margin-bottom: 11px; }
.key.black .key-face { padding-bottom: 13px; }
.key.black .key-face strong { color: #ffebc8; font-size: clamp(10px, 1.3vw, 15px); }
.key.black .key-face svg { color: #a49687; width: 10px; height: 10px; margin-bottom: 1px; }
.key.black .key-face kbd { border-color: #65523b; background: #30261d; color: #efdbbc; }
.key.black .key-face i { background: #e3a849; }
.key.white { --key-active: linear-gradient(#ebbc72, #ffe2a8 25%, #ffe5b4 93%, #dca85a 94%); }
.key.black { --key-active: linear-gradient(90deg, #5b3c20, #785325 24%, #764f20 84%, #4a2e18); }
@media (hover: hover) {
  .key.available:where(:hover) { background: var(--key-active); }
}
.key.available:where(:active), .key.struck, .key.selected { background: var(--key-active); }
.key.white.right-note { background: linear-gradient(#93bc9e, #d9edd6 25%, #deefda 92%, #8eae8c 93%); }
.key.white.wrong-note { background: linear-gradient(#d09987, #f5d6cb 25%, #f9ddd4 92%, #cc9f91 93%); }
.key.black.right-note { background: linear-gradient(90deg, #243b2c, #3e674c 28%, #355d44 82%, #203829); }
.key.black.wrong-note { background: linear-gradient(90deg, #56322b, #884b3e 28%, #7a3c2f 82%, #502e26); }
.piano-bottom { min-height: 34px; justify-content: center; font-size: 11px; letter-spacing: .04em; }
.piano-bottom svg { width: 15px; height: 15px; }
.piano-guide { display: flex; align-items: center; justify-content: center; gap: 7px; }
.piano-range { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 6px; }
.range-button { display: inline-flex; align-items: center; gap: 3px; padding: 4px 7px; min-height: 32px; border: 0; border-radius: 6px; background: transparent; color: #ffe6b4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.range-button[aria-disabled="true"] { color: #b2a697; cursor: default; }
#piano-low svg { transform: rotate(180deg); }
.range-hint { text-align: center; }
.panel { margin-top: 15px; min-height: 69px; border: 1px solid #eee4d3; border-radius: 11px; padding: 10px 15px; background: #f8f3e9; }
.panel-main { display: flex; align-items: center; justify-content: space-between; gap: 13px; min-height: 46px; }
.panel-copy { min-width: 0; }
.panel-copy > strong { font-size: 15px; font-weight: 800; line-height: 1.5; }
.panel-copy p { font-size: 12px; color: var(--muted); line-height: 1.65; margin-top: 2px; }
.controls { display: flex; align-items: stretch; gap: 7px; flex: none; }
.control { min-height: 43px; padding: 8px 13px; border: 1px solid #ebad45; border-radius: 8px; color: #332415; background: var(--amber); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; box-shadow: 0 2px 0 #d7a55144; }
.control svg { width: 16px; height: 16px; }
.control.primary:hover:not(:disabled) { background: #ffbd4c; }
.control.secondary { background: #fffcf6; border-color: #e2d7c5; color: #5b4c37; box-shadow: none; }
.control.secondary:hover:not(:disabled) { background: #f0e5d1; }
.control:disabled { background: #edddbd; border-color: #e5d6b7; color: #6e5a3a; box-shadow: none; }
.question-meta { display: flex; align-items: center; gap: 8px; color: #7a5528; font: 700 11px/1.4 var(--mono); margin: 0 0 3px; }
.question-dots { display: inline-flex; gap: 4px; }
.question-dots i { width: 7px; height: 7px; border-radius: 100%; background: #d9d0c0; }
.question-dots i.on { background: #aa691d; }
.question-dots i.good { background: #457552; }
.question-dots i.bad { background: #ac5743; }
.text-good { color: #346141; }
.text-bad { color: #954731; }
.quiz-tools { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 8px; padding-top: 7px; border-top: 1px solid #eae1d2; }
.quiz-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 7px; padding: 4px 10px; border: 1px solid #dfd2bc; border-radius: 8px; background: var(--surface); color: #543d21; font-size: 12px; font-weight: 700; line-height: 1.2; text-align: left; }
.quiz-action svg { width: 19px; height: 19px; stroke-width: 1.8; }
.quiz-action:active { background: #f7e4c0; }
@media (hover: hover) {
  .quiz-action:hover:not([aria-disabled="true"]) { background: var(--soft-gold); }
}
.quiz-action[aria-disabled="true"] { color: #786957; background: #f2ede3; }
.selection { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
.selection:empty { display: none; }
.selection span { padding: 3px 5px; border-radius: 4px; background: #f7e2bc; color: #624213; font: 700 11px/1.2 var(--mono); }
.text-button { min-height: 24px; flex: none; background: transparent; border: 0; border-radius: 3px; padding: 2px 0; color: #715331; font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.text-button svg { width: 13px; height: 13px; }
.scale-select { margin-top: 7px; font-size: 12px; color: var(--muted); }
.scale-select select { max-width: 100%; background: var(--surface); border: 1px solid #dfd4bf; border-radius: 6px; color: var(--ink); padding: 5px 8px; }
.roadmap { padding: 17px 15px 12px; }
.road-head { display: flex; gap: 10px; align-items: center; padding-inline: 2px; cursor: pointer; list-style: none; }
.road-head::-webkit-details-marker { display: none; }
.road-head:focus-visible { outline: 2px solid #986410; outline-offset: 4px; border-radius: 5px; }
.map-chevron { width: 15px; height: 15px; margin-left: auto; color: #827057; transition: transform .17s ease; }
.roadmap[open] .map-chevron { transform: rotate(90deg); }
.road-icon { width: 38px; height: 38px; background: #f8ebd2; color: #87541d; border-radius: 9px; display: grid; place-items: center; }
.road-icon svg { width: 19px; height: 19px; }
.road-head strong { display: block; font-size: 17px; line-height: 1.25; }
.road-head small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.progress { height: 4px; border-radius: 5px; overflow: hidden; margin: 14px 2px 12px; background: #eae1d2; }
.progress span { display: block; height: inherit; border-radius: inherit; background: #b87926; transition: width .25s ease; }
.road-item { border-bottom: 1px solid #eee7dc; border-radius: 0; }
.road-item:last-child { border: 0; }
.road-item.current-chapter { background: #fbefd8; border: 1px solid #f0dfbc; border-radius: 9px; }
.road-trigger { position: relative; width: 100%; display: flex; gap: 8px; align-items: center; text-align: left; padding: 8px 6px; min-height: 52px; background: transparent; border: 0; border-radius: 7px; }
.road-trigger:hover { background: #f7f0e4; }
.current-chapter .road-trigger:hover { background: #f6e7cc; }
.chapter-icon { display: grid; place-items: center; height: 28px; width: 28px; border-radius: 7px; background: #f0ebe2; color: #87765f; flex: none; font: 750 14px/1 Georgia, serif; }
.current-chapter .chapter-icon { color: #704411; background: #f9d891; }
.chapter-icon svg { width: 13px; height: 13px; }
.road-label { display: grid; min-width: 0; gap: 3px; margin-right: auto; }
.road-label strong { color: #453c30; font-size: 13px; line-height: 1.2; }
.road-label small { font-size: 10px; color: #766c60; }
.road-count { font: 650 10px/1 var(--mono); color: #786a58; flex: none; }
.road-trigger > svg { width: 12px; height: 12px; color: #8c7960; transition: transform .17s ease; }
.expanded .road-trigger > svg { transform: rotate(90deg); }
.level-list { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; padding: 0 6px 8px; }
.level-chip { display: grid; place-items: center; min-height: 27px; padding: 0; border: 1px solid #e6dccb; border-radius: 5px; font: 750 10px/1 var(--mono); background: #fcf7ed; color: #634f33; }
.level-chip svg { width: 11px; height: 11px; }
.level-chip:disabled { color: #897c6b; background: #f4ecdf; }
.level-chip.completed { background: #e4eddb; border-color: #c9d8be; color: #34583b; }
.level-chip:hover:not(:disabled) { background: #ffe2a5; }
.level-chip.current-level { background: var(--amber); color: #352511; border-color: #dba64a; }
.tip { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; border: 1px dashed #d9c9ae; border-radius: 11px; padding: 12px 13px; color: #735535; }
.tip svg { width: 17px; height: 17px; margin-top: 1px; }
.tip strong { display: block; font-size: 12px; }
.tip p { font-size: 11px; line-height: 1.6; color: var(--muted); margin-top: 3px; }
footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 66px; padding-bottom: env(safe-area-inset-bottom); color: #786e60; font-size: 11px; letter-spacing: .035em; }
footer span:first-child { display: inline-flex; align-items: center; gap: 6px; }
footer svg { width: 12px; height: 12px; color: #a57742; }
.footer-divider { color: #a99579; }
@media (max-width: 1060px) {
  :root { --page-gutter: 26px; }
  .studio { grid-template-columns: minmax(0, 1fr) 275px; gap: 16px; }
  .challenge { padding: 20px; }
}
@media (max-width: 1100px), (pointer: coarse) and (max-width: 1180px) {
  :root { --page-gutter: clamp(12px, 3vw, 28px); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  .intro { min-height: 118px; padding-block: 12px 16px; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, .55fr); align-items: start; gap: 12px; }
  .roadmap { padding: 12px; scroll-margin-top: 12px; }
  .road-head { min-height: 44px; }
  .tip { margin-top: 0; }
  .keys { height: clamp(170px, 27vw, min(250px, 29vh)); }
  .map-link { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 5px; padding-inline: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: #5c4b35; font-size: 12px; white-space: nowrap; }
  .map-link svg { width: 16px; height: 16px; }
  .sound-button { width: 44px; height: 44px; }
  .language-link { min-height: 44px; }
  .control { min-height: 48px; }
  .level-list { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 6px; }
  .level-chip { min-height: 44px; font-size: 12px; }
}
@media (max-width: 580px) {
  .mast-inner { min-height: 56px; }
  .mast-controls { gap: 6px; }
  .brand { gap: 7px; }
  .brand-icon { width: 32px; height: 32px; border-radius: 8px; }
  .brand-word { font-size: 17px; }
  .brand-word span { font-size: 8px; }
  .top-score { min-height: 34px; padding-inline: 7px; gap: 4px; }
  .top-score svg { width: 13px; height: 13px; }
  .top-score-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .intro { min-height: 0; padding: 16px 1px 14px; }
  .eyebrow { font-size: 10px; gap: 7px; letter-spacing: .09em; }
  .intro h1 { font-size: clamp(29px, 8vw, 42px); margin: 6px 0 5px; }
  .intro p { font-size: 13px; letter-spacing: .01em; }
  .staff { display: none; }
  .challenge { padding: 10px; border-radius: 14px; }
  .level-head { min-height: 0; }
  .level-head h2 { margin-top: 8px; margin-bottom: 4px; }
  .level-head p { font-size: 13px; }
  .level-tag { padding-top: 5px; }
  .badges { gap: 4px; }
  .badges span { font-size: 10px; padding: 3px 6px; }
  .phase-bar { margin: 8px 0 10px; min-height: 34px; padding: 3px; gap: 2px; }
  .phase { flex: 1 1 0; padding: 4px 2px; font-size: 12px; }
  .phase b, .phase-line { display: none; }
  .piano { padding-inline: 8px; border-radius: 10px; }
  .piano-top { min-height: 33px; font-size: 11px; padding-inline: 2px; }
  .instrument { font-size: 9px; letter-spacing: .1em; }
  .keys { --visible-whites: var(--phone-white-count); height: clamp(152px, 44vw, 202px); }
  .key.extra-range { display: none; }
  .panel { padding: 10px; margin-top: 10px; }
  .panel-main { align-items: stretch; flex-direction: column; gap: 8px; }
  .panel-copy p { font-size: 13px; line-height: 1.5; }
  .controls { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .control { min-height: 48px; font-size: 14px; padding-inline: 7px; }
  .quiz-tools { flex-wrap: wrap; gap: 4px 8px; }
  .quiz-action { flex: 1 1 0; }
  .selection:not(:empty) { flex-basis: 100%; }
  .sidebar { grid-template-columns: 1fr; gap: 10px; }
  .roadmap { padding: 8px 12px; border-radius: 14px; }
  .tip { padding: 9px 11px; }
  footer { min-height: 52px; font-size: 10px; }
}
@media (max-width: 370px) {
  .mast-controls { gap: 4px; }
  .map-link { width: 44px; padding-inline: 0; }
  .map-link span, .top-score svg { display: none; }
  .brand-icon { width: 28px; height: 28px; }
  .brand-word { font-size: 16px; }
}
@media (max-width: 580px) and (max-height: 740px) and (orientation: portrait) {
  .intro { padding-block: 10px 11px; }
  .keys { height: clamp(136px, 39vw, 164px); }
}
@media (max-width: 360px) and (max-height: 660px) and (orientation: portrait) {
  .mast-inner { min-height: 52px; }
  .intro p { display: none; }
  .keys { height: 128px; }
}
@media (max-width: 580px), (pointer: coarse), (max-height: 520px) and (max-width: 1000px) and (orientation: landscape) {
  .keys { --min-white: 44px; }
  .keys.has-playable-black { --min-white: 54px; }
  .key.black { width: calc(67% / var(--visible-whites)); }
  .key-face strong { font-size: clamp(14px, 2vw, 20px); }
  .key.black .key-face strong { font-size: clamp(12px, 1.6vw, 16px); }
  .range-button, .text-button, .scale-select select { min-height: 44px; }
  .text-button { padding-inline: 7px; font-size: 12px; }
  .scale-select select { font-size: 16px; }
}
@media (max-width: 580px), (hover: none), (max-height: 520px) and (max-width: 1000px) and (orientation: landscape) {
  .key-face kbd, .keyboard-guide, .piano-guide svg { display: none; }
}
@media (max-height: 520px) and (max-width: 1000px) and (orientation: landscape) {
  .mast-inner { min-height: 50px; }
  .intro { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
  .studio { margin-top: 9px; }
  .challenge { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 31%); gap: 7px 10px; padding: 9px; align-items: start; }
  .level-head, .phase-bar { grid-column: 1 / -1; }
  .level-head { min-height: 0; }
  .level-head h2 { margin: 0 0 2px; font-size: 22px; }
  .level-head p { font-size: 12px; line-height: 1.4; }
  .level-tag { padding: 0; margin-bottom: 4px; }
  .phase-bar { min-height: 32px; margin: 0; padding-block: 2px; }
  .piano { min-width: 0; padding-inline: 8px; }
  .piano-top { min-height: 29px; }
  .keys { height: clamp(110px, 36vh, 172px); }
  .panel { min-width: 0; margin-top: 0; padding: 8px; }
  .panel-main { align-items: stretch; flex-direction: column; gap: 6px; }
  .panel-copy p { font-size: 12px; line-height: 1.45; }
  .controls { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .control { min-height: 44px; padding-inline: 2px; font-size: 12px; gap: 3px; }
  .control > span { white-space: normal; }
  .control svg { width: 13px; height: 13px; }
  .quiz-tools { flex-wrap: wrap; gap: 0 5px; margin-top: 5px; padding-top: 3px; }
  .quiz-action { flex: 1 1 0; gap: 4px; padding-inline: 5px; font-size: 11px; }
  .quiz-action svg { width: 16px; height: 16px; }
  .selection:not(:empty) { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
