@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700;800;900&family=Noto+Music&display=swap');

:root {
  color-scheme: dark;
  --night: #071128;
  --console: #091932;
  --edge: #163051;
  --white: #f7f8fa;
  --muted: #bdcde0;
  --turquesa: #48e8df;
  --lila: #bf9aff;
  --tile: #e2d7ff;
  --paper: #fff;
  --ink: #11151c;
  --red: #e0332f;
  --line-gap: clamp(13px, 1.95vw, 30px);
  --clef-width: clamp(42px, 8vw, 124px);
  --meter-width: clamp(24px, 4.8vw, 74px);
  --staff-start: calc(var(--clef-width) + var(--meter-width));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  color: var(--white);
  background: radial-gradient(ellipse at 75% 20%, #0c1931 0, transparent 55%), var(--night);
  font: 16px/1.45 Geist, system-ui, sans-serif;
}
.studio-waves { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.studio-waves i { position: absolute; display: block; width: 78vw; height: clamp(90px, 15vw, 240px); border-radius: 50%; }
.studio-waves i:nth-child(1) { top: -12vw; left: -25vw; rotate: -13deg; background: linear-gradient(100deg, #0b3161, #10234d); }
.studio-waves i:nth-child(2) { top: -11vw; right: -47vw; rotate: 24deg; background: linear-gradient(135deg, #2a416f, #2f235c); }
.studio-waves i:nth-child(3) { bottom: -9vw; right: -13vw; rotate: -8deg; background: linear-gradient(90deg, #152448, #30225d 54%, #124b6c); }
.studio-waves i:nth-child(4) { bottom: -10vw; right: -27vw; rotate: -3deg; background: linear-gradient(90deg, #071631, #093458); }

h1, h2, p { margin-top: 0; }
h1, h2, .brand { font-weight: 850; letter-spacing: -.045em; }
a { color: var(--white); text-underline-offset: 4px; }
button, input { font: inherit; }
button, .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35em;
  min-height: 44px;
  padding: 9px 15px;
  cursor: pointer;
  border: 1px solid var(--edge);
  border-radius: 10px;
  color: var(--white);
  background: #122440;
  font-weight: 700;
}
button:hover { background: #1c3756; }
button:disabled { opacity: .55; cursor: default; }
:where(a, button, input, summary):focus-visible { outline: 3px solid #54d9ff; outline-offset: 4px; }
.primary { color: #041825; background: var(--turquesa); border-color: transparent; text-decoration: none; }
.primary:hover { background: #84fff4; }
.primary:active { background: #38d4d0; }
.row, .tiles { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.masthead, main { width: min(94%, 1480px); margin-inline: auto; }
.masthead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(14px, 5vw, 75px); padding: clamp(18px, 2.2vw, 32px) clamp(0px, 1.8vw, 24px) 14px; }
.brand { display: inline-flex; align-items: center; gap: .36em; text-decoration: none; font-size: clamp(27px, 3.85vw, 60px); line-height: 1; }
.brand-accent { color: var(--turquesa); }
.wave-mark { display: inline-flex; align-items: center; gap: .07em; height: 1em; }
.wave-mark i { display: block; width: .13em; height: 36%; border-radius: 8px; background: var(--turquesa); }
.wave-mark i:nth-child(2) { height: 72%; }
.wave-mark i:nth-child(3) { height: 100%; }
.wave-mark i:nth-child(4) { height: 50%; }
.studio-wave { justify-self: center; display: flex; align-items: center; justify-content: center; width: 100%; max-width: 650px; gap: clamp(3px, .54vw, 8px); height: 54px; }
.studio-wave::before, .studio-wave::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, #1996c1); }
.studio-wave::after { transform: rotate(180deg); }
.studio-wave i { width: 3px; height: 7px; border-radius: 4px; background: linear-gradient(#55e9e7, #117b9c); }
.studio-wave i:nth-child(3n) { height: 26px; }
.studio-wave i:nth-child(4n) { height: 33px; background: linear-gradient(var(--lila), #7554c0); }
.studio-wave i:nth-child(5n) { height: 44px; }
.studio-wave i:nth-child(7n) { height: 55px; background: linear-gradient(var(--lila), #7554c0); }
.score { font-size: .84rem; text-align: right; color: var(--muted); font-weight: 700; }

main { padding: clamp(22px, 3vw, 46px) 0 56px; }
.studio-heading, .hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); align-items: center; }
.studio-heading { margin-inline: clamp(0px, 2.7vw, 42px) clamp(0px, 1.4vw, 22px); }
.studio-heading h2, .hero h1 { margin: 0; font-size: clamp(40px, 5.65vw, 88px); line-height: 1.02; }
.studio-heading h2:focus { outline: none; }
.studio-heading h2::after, .hero h1::after { content: ""; display: block; width: clamp(46px, 6vw, 95px); height: clamp(6px, .75vw, 12px); margin-top: .15em; border-radius: 20px; background: var(--turquesa); }
.studio-heading p, .hero p { margin: .28em 0 0; color: var(--white); font-size: clamp(18px, 2.65vw, 41px); line-height: 1.16; letter-spacing: -.03em; }

.transport { position: relative; display: flex; align-items: center; gap: clamp(5px, 1vw, 16px); padding: clamp(8px, 1.35vw, 21px); min-width: 0; border: 2px solid var(--edge); border-radius: clamp(16px, 1.8vw, 28px); background: var(--console); box-shadow: inset 0 1px 7px #153a5860; }
#audio { display: flex; align-items: center; gap: clamp(6px, 2.5vw, 38px); flex: 1; min-width: 0; }
#audio .listen { flex: 1; min-height: clamp(52px, 6.25vw, 96px); border-radius: clamp(11px, 1.3vw, 20px); font-size: clamp(21px, 3.05vw, 46px); }
.listen::before { content: ""; flex: none; width: .89em; height: .94em; background: currentColor; clip-path: polygon(0 0,100% 50%,0 100%); margin-right: .15em; }
#audio .replay, .volume-control summary { flex: none; display: grid; place-items: center; width: clamp(40px, 5.75vw, 88px); min-height: 44px; padding: 0; color: var(--white); background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
#audio .replay { width: clamp(45px, 6.7vw, 103px); border-left: 2px solid var(--edge); border-radius: 0 6px 6px 0; padding-left: clamp(3px, 1vw, 15px); font-size: clamp(33px, 4.6vw, 68px); line-height: 1; font-weight: 400; }
#audio .replay:hover, .volume-control summary:hover { background: #142b47; }
.volume-control summary { list-style: none; }
.volume-control summary::-webkit-details-marker { display: none; }
.speaker-icon { position: relative; width: clamp(24px, 3.6vw, 55px); aspect-ratio: 1; }
.speaker-icon::before { content: ""; position: absolute; top: 10%; left: 0; width: 64%; height: 80%; background: currentColor; clip-path: polygon(0 33%,33% 33%,85% 0,100% 0,100% 100%,85% 100%,33% 67%,0 67%); }
.speaker-icon::after { content: ""; position: absolute; width: 48%; height: 65%; top: 16%; right: 0; border: .12em double currentColor; border-width: 0 .28em 0 0; border-radius: 50%; }
.volume-control label, .volume-control input { position: absolute; right: 12px; z-index: 2; width: 200px; background: var(--console); padding: 10px; }
.volume-control label { top: calc(100% + 5px); border: 1px solid var(--edge); border-radius: 10px 10px 0 0; }
.volume-control input { top: calc(100% + 44px); margin: 0; accent-color: var(--turquesa); border: 1px solid var(--edge); border-radius: 0 0 10px 10px; }

.score-panel { margin: clamp(19px, 2.25vw, 35px) 0 0; padding: clamp(18px, 3.9vw, 60px) clamp(13px, 4.5vw, 70px) clamp(22px, 3.3vw, 51px); border-radius: clamp(14px, 1.8vw, 28px); color-scheme: only light; background-color: #fff; color: var(--ink); box-shadow: 0 16px 52px #020a194d; }
.score-panel:has(#board:empty):has(#pulse[hidden]) { display: none; }
.staff, .hero-score {
  --staff-height: calc(var(--line-gap) * 4 + 1px);
  display: grid;
  grid-template-columns: var(--clef-width) var(--meter-width) repeat(2, minmax(0, 1fr));
  align-items: center;
  min-height: clamp(128px, 13vw, 200px);
  background: repeating-linear-gradient(to bottom, var(--ink) 0 2px, transparent 2px var(--line-gap)) center / 100% var(--staff-height) no-repeat;
}
.clef, .hero-score span { font: clamp(60px, 10vw, 151px)/1 "Noto Music", "Apple Symbols", serif; text-align: center; transform: translateY(calc(var(--line-gap) * .22)); }
.meter { font: 800 clamp(22px, 4.4vw, 68px)/.88 Georgia, serif; text-align: left; letter-spacing: -.055em; }
.bar { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); place-items: center; height: var(--staff-height); border-right: 2px solid var(--ink); }
.bar:last-child { border-right: clamp(4px, .65vw, 10px) double var(--ink); }
.bar.is-playing { background: #d3edff3d; }
.legacy-measure-number {
  position: absolute;
  bottom: calc(100% + 7px);
  inset-inline-start: 6px;
  color: #4f657d;
  font-size: .79rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.25;
  pointer-events: none;
}
.bar.is-playing .legacy-measure-number { color: #17685f; }
.note { position: relative; width: clamp(31px, 3.45vw, 53px); min-height: 34px; height: clamp(34px, 3.45vw, 53px); padding: 0; border: 1px dashed #879aaf; border-radius: 50%; background: #fff; color: #526479; }
.note:hover { background: #e5f2fd; }
.note.filled { border-color: transparent; background: transparent; font-size: 0; }
.note.filled::before { content: ""; position: absolute; left: 50%; top: 50%; width: clamp(13px, 1.45vw, 22px); height: clamp(8px, .88vw, 13px); border-radius: 50%; transform: translate(-50%, -50%) rotate(-16deg); background: var(--ink); }
.note.filled::after { content: ""; position: absolute; left: calc(50% + clamp(5px, .63vw, 9px)); bottom: 50%; height: clamp(23px, 2.5vw, 38px); border-left: 2px solid var(--ink); }
.note.sol { top: var(--line-gap); }
.note.mi { top: calc(var(--line-gap) * 2); }
.note.do { top: calc(var(--line-gap) * 3); background: linear-gradient(var(--ink),var(--ink)) center / 85% 1px no-repeat; }
.note.filled.wrong { border-color: #b01f2a; background-color: #fbe3df; }
.note.filled.correct { border-color: #377241; background-color: #e2f2db; }
.score-panel [data-slot].is-playing { outline: 2px solid #236787; outline-offset: 2px; }
.score-panel [data-slot]:not(.note) { color: var(--ink); background: white; border-color: #93abc2; }
.score-panel [data-slot]:not(.note).wrong { background: #fbe3df; }
.score-panel [data-slot]:not(.note).correct { background: #e2f2db; }
.score-panel .tiles { justify-content: center; }
.pulse-track { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: clamp(10px, 1.2vw, 19px); }
.score-panel:has(.staff) .pulse-track { margin-left: var(--staff-start); }
.pulse-bar { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: center; color: #455b70; }
.measure-label { grid-column: 1/-1; text-align: center; font-weight: 700; font-size: .75rem; }
.score-panel:has(.staff) .measure-label { position: absolute; overflow: hidden; width: 1px; height: 1px; clip-path: inset(50%); }
.pulse-dot { position: relative; height: clamp(24px, 2.1vw, 32px); }
.pulse-dot::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: clamp(2px, .23vw, 4px); transform: translateY(-50%); background: #a0adba; }
.pulse-bar:first-child .pulse-dot:nth-child(2)::before { left: 50%; }
.pulse-bar:last-child .pulse-dot:last-child::before { right: 50%; }
.pulse-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: clamp(10px, 1.5vw, 23px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #8998a5; }
.pulse-dot.is-playing::after { background: var(--red); outline: 2px solid #fff; transform: translate(-50%, -50%) scale(1.12); }

.studio-actions { display: flex; justify-content: center; align-items: center; gap: clamp(14px, 2.75vw, 42px); margin: clamp(20px, 2.1vw, 33px) auto 0; }
#palette { justify-content: center; }
#palette button[data-tile] { min-height: 54px; color: #081525; background: var(--tile); border: 2px solid #f7fbff; }
#palette button[data-tile]:hover { background: #f1eaff; }
#palette button[data-tile][aria-pressed=true] { background: var(--turquesa); border-color: var(--turquesa); box-shadow: inset 0 0 0 2px #18766f; }
#palette .note-tile { display: grid; justify-items: center; width: clamp(102px, 16vw, 245px); min-height: clamp(91px, 11.6vw, 179px); padding: 9px 14px 12px; border-radius: clamp(12px, 1.4vw, 22px); font-size: clamp(24px, 3.4vw, 52px); line-height: 1; }
.note-tile .mini-staff { width: 68%; min-width: 60px; border: 0; }
.note-tile .mini-clef { display: none; }
#check { min-height: clamp(54px, 8.2vw, 126px); padding-inline: clamp(18px, 4vw, 65px); font-size: clamp(21px, 3.6vw, 55px); border-radius: clamp(12px, 1.55vw, 24px); white-space: nowrap; }
#check span { font-weight: 850; }
.note-hint, .feedback { margin: 12px 0 0; color: var(--muted); text-align: center; }
.feedback:empty { display: none; }
.feedback button { margin-left: 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; margin: 24px 0 12px; }
.toolbar a { font-weight: 700; font-size: clamp(16px, 1.75vw, 26px); }
.toolbar a span { margin-right: 4px; color: var(--turquesa); }
.share input { width: 100%; padding: 8px; }
.exercise-tools { padding: 12px 0; border-top: 1px solid #243b56; color: var(--muted); }
.exercise-tools summary { font-weight: 700; cursor: pointer; }
.exercise-tools .row, .exercise-tools p { margin: 12px 0 0; }

.measure-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.measure-option { display: grid; gap: 6px; width: clamp(100px, 15vw, 205px); }
.measure-tile { display: grid; justify-items: start; width: 100%; min-height: 88px; padding: 8px 12px; text-align: left; }
.mini-staff { position: relative; display: flex; align-items: center; justify-content: space-evenly; width: 100%; min-width: 66px; height: 56px; border-right: 2px solid var(--ink); background: repeating-linear-gradient(to bottom, var(--ink) 0 1px, transparent 1px 8px) center / 100% 33px no-repeat; }
.mini-clef { font: 34px/1 "Noto Music", "Apple Symbols", serif; color: var(--ink); }
.mini-note { position: relative; width: 11px; height: 7px; border-radius: 50%; background: var(--ink); transform: rotate(-15deg); }
.mini-note::after { content: ""; position: absolute; bottom: 3px; right: 0; height: 15px; border-right: 2px solid var(--ink); transform: rotate(15deg); transform-origin: bottom; }
.mini-sol { top: 8px; }
.mini-mi { top: 16px; }
.mini-do { top: 24px; }
.mini-do::before { content: ""; position: absolute; left: -4px; right: -4px; top: 3px; border-top: 1px solid var(--ink); }

.hero { padding: clamp(22px, 4vw, 60px) clamp(0px, 2.7vw, 42px); }
.hero p { font-size: clamp(18px, 2.1vw, 32px); }
.hero .primary { margin-top: 20px; font-size: clamp(16px, 1.7vw, 25px); min-height: 53px; }
.hero-score { position: relative; min-height: clamp(155px, 20vw, 300px); grid-template-columns: 1fr; padding: 0 clamp(15px, 3vw, 45px); background-color: var(--paper); background-clip: padding-box; background-size: 85% var(--staff-height); border-radius: clamp(14px, 1.8vw, 28px); color: var(--ink); color-scheme: only light; }
.hero-score span { justify-self: start; width: var(--clef-width); }
.hero-score i { position: absolute; width: clamp(8px, 1.15vw, 16px); aspect-ratio: 1; top: 87%; left: 37%; border-radius: 50%; background: #8998a5; }
.hero-score i:nth-of-type(2) { left: 52%; background: var(--red); }
.hero-score i:nth-of-type(3) { left: 67%; }
.hero-score i:nth-of-type(4) { left: 82%; }
.catalog-title { margin: 18px 0 14px; font-size: clamp(24px, 3vw, 42px); }
.catalog { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,250px),1fr)); gap: 12px; }
.catalog a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 65px; padding: 12px 17px; text-decoration: none; border: 1px solid var(--edge); border-radius: 12px; background: var(--console); font-weight: 700; }
.catalog a::after { content: "→"; color: var(--lila); }
.catalog a:hover { background: #1c284b; border-color: #66548f; }

#guide { width: min(670px, calc(100% - 28px)); border: 1px solid var(--edge); border-top: 6px solid var(--turquesa); border-radius: 16px; padding: clamp(18px, 4vw, 36px); color: var(--white); background: var(--console); }
#guide::backdrop { background: #030a19bb; }
#guide h2 { margin-bottom: .35em; font-size: clamp(28px, 4vw, 48px); }
#guide-step { color: var(--turquesa); }
#guide-demo { padding-bottom: 16px; color: var(--turquesa); font-weight: 700; }
#guide-demo .mini-staff { width: min(100%, 255px); margin-bottom: 8px; background-color: white; border-radius: 6px; }
.guide-beats { display: grid; grid-template-columns: repeat(4,1fr); width: min(100%,250px); padding: 8px; color-scheme: only light; background: white; border-radius: 6px; }
.guide-beats i { position: relative; height: 32px; }
.guide-beats i:nth-child(2) { border-right: 1px solid var(--edge); }
.guide-beats i::before,.guide-beats i::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); }
.guide-beats i::before { top: 4px; width: 2px; height: 10px; background: var(--ink); }
.guide-beats i::after { bottom: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); opacity: 0; animation: guide-beat 2.2s steps(1) infinite; }
.guide-beats i:nth-child(2)::after { animation-delay: .55s; }
.guide-beats i:nth-child(3)::after { animation-delay: 1.1s; }
.guide-beats i:nth-child(4)::after { animation-delay: 1.65s; }
@keyframes guide-beat { 0% { opacity: 1; } 25%,100% { opacity: 0; } }
@media(prefers-reduced-motion: reduce) {
  .guide-beats i::after { animation: none; }
  .guide-beats i:first-child::after { opacity: 1; }
}
@media(max-width: 760px) {
  .masthead { grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  .studio-wave { display: none; }
  .studio-heading, .hero { grid-template-columns: 1fr; gap: 16px; }
  .studio-heading { margin-inline: 0; }
  .transport { width: min(100%,475px); }
  #audio .listen { min-height: 49px; }
  .studio-actions { flex-wrap: wrap; }
  .score { font-size: .75rem; }
  .hero { padding-top: 0; }
}
@media(max-width: 395px) {
  .studio-actions { display: grid; }
  .score-panel { padding-inline: 9px; }
}
