:root {
  --night: #241b3f;
  --night-deep: #100c24;
  --tile: #8c3f73;
  --tile-dark: #512448;
  --leaf: #66a344;
  --leaf-dark: #335e2a;
  --sun: #f5c84c;
  --electric: #71d8d0;
  --paper: #f6f0df;
  --paper-deep: #e9dec3;
  --ink: #1d2a26;
  --muted: #66706b;
  --white: #fffdf6;
  --danger: #c44b3c;
  --shadow: 0 18px 50px rgb(7 20 32 / 16%);
  --display: "STKaiti", "KaiTi", "Kaiti SC", serif;
  --body: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --utility: "SFMono-Regular", "Menlo", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  line-height: 1.6;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}
.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  color: var(--night);
  background: var(--sun);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.hero {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  color: var(--white);
  background:
    radial-gradient(circle at 80% 18%, rgb(244 200 74 / 13%), transparent 20%),
    linear-gradient(145deg, var(--night), var(--night-deep));
}
.hero::after {
  position: absolute;
  right: -5%;
  bottom: -120px;
  left: -5%;
  height: 260px;
  content: "";
  background: repeating-linear-gradient(165deg, #413250 0 44px, #17132a 45px 49px, #59405d 50px 92px);
  border-top: 10px solid #7f6290;
  transform: rotate(-2deg);
  transform-origin: center;
}
.topbar, .hero-grid, main > section {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid rgb(255 255 255 / 16%);
}
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  color: var(--night);
  background: var(--sun);
  border-radius: 50% 50% 45% 55%;
  place-items: center;
  transform: rotate(-8deg);
}
.sound-toggle, .text-button, .label-toggle, .metronome-button {
  color: inherit;
  background: transparent;
  border: 0;
}
.sound-toggle { padding: 8px; color: #d9e1e7; }
.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 70px;
  align-items: center;
  padding: 78px 0 150px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--tile);
  font: 700 12px/1.3 var(--utility);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.hero .eyebrow { color: var(--sun); }
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 690px;
  margin-bottom: 28px;
  font: 700 clamp(54px, 7vw, 96px)/.98 var(--display);
  letter-spacing: -.04em;
}
h1 em { color: var(--sun); font-style: normal; }
.hero-lead { max-width: 620px; color: #d4dde4; font-size: 17px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 34px; }
.primary-button, .secondary-button {
  min-height: 46px;
  padding: 11px 20px;
  font-weight: 750;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 5px 0 rgb(0 0 0 / 22%);
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary-button { color: #192314; background: var(--sun); }
.secondary-button { color: var(--white); background: var(--leaf-dark); }
.primary-button:hover, .secondary-button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 rgb(0 0 0 / 22%); }
.primary-button:active, .secondary-button:active { transform: translateY(2px); box-shadow: 0 2px 0 rgb(0 0 0 / 22%); }
.primary-button:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .5; transform: none; }
.text-button { padding: 12px; color: #dfe7eb; text-decoration: underline; text-underline-offset: 4px; }

.roof-scene { position: relative; min-height: 390px; }
.moon {
  position: absolute;
  top: 0;
  right: 30px;
  width: 150px;
  height: 150px;
  background: #f8dfa0;
  border-radius: 50%;
  box-shadow: 0 0 70px rgb(244 200 74 / 30%);
}
.moon::after {
  position: absolute;
  top: 25px;
  left: 28px;
  width: 28px;
  height: 28px;
  content: "";
  background: #dfc985;
  border-radius: 50%;
  box-shadow: 58px 40px 0 10px #e9d391, 12px 80px 0 -2px #e5cf8c;
}
.roof-line {
  position: absolute;
  top: 150px;
  right: 0;
  left: 0;
  height: 120px;
  background: repeating-linear-gradient(165deg, #3d344b 0 28px, #171426 29px 33px, #554263 34px 60px);
  border-top: 8px solid #89709a;
  transform: rotate(-5deg);
  box-shadow: var(--shadow);
}
.chimney { position: absolute; top: -70px; left: 14%; width: 64px; height: 78px; background: #6d3b31; border: 7px solid #4e2b25; }
.plant-pot {
  position: absolute;
  top: -54px;
  left: 28%;
  display: grid;
  width: 72px;
  height: 62px;
  color: var(--sun);
  font-size: 30px;
  background: #253c47;
  border: 6px solid var(--electric);
  border-radius: 8px;
  place-items: center;
  transform: rotate(5deg);
}
.zombie {
  position: absolute;
  top: -86px;
  right: 18%;
  width: 70px;
  height: 98px;
  transition: right .8s cubic-bezier(.2,.8,.2,1);
  transform: rotate(5deg);
}
.zombie-head {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 8px;
  display: grid;
  width: 52px;
  height: 52px;
  color: #24152d;
  font-size: 18px;
  background: var(--electric);
  border: 4px solid #314f5a;
  border-radius: 45% 45% 20% 20%;
  place-items: center;
}
.zombie-body { position: absolute; bottom: 0; left: 12px; width: 52px; height: 58px; background: #5b4768; border: 5px solid #292037; transform: skew(-8deg); }
.distance-card {
  position: absolute;
  right: 10px;
  bottom: 0;
  left: 10px;
  padding: 18px 22px;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--paper-deep);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.distance-card > div:first-child { display: flex; align-items: baseline; justify-content: space-between; }
.utility-label { color: var(--muted); font: 700 11px var(--utility); letter-spacing: .1em; text-transform: uppercase; }
.distance-card strong { font: 700 25px var(--display); }
.distance-track { height: 8px; margin: 10px 0 8px; overflow: hidden; background: #cfc5ac; border-radius: 10px; }
.distance-track span { display: block; width: 0%; height: 100%; background: var(--leaf); transition: width .8s ease; }
.distance-card p { margin: 0; color: var(--muted); font-size: 12px; }

main { position: relative; }
.mission-strip {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: -24px;
  overflow: hidden;
  background: var(--white);
  border: 1px solid #d9ceb5;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.mission-strip article { display: grid; grid-template-columns: auto 1fr; gap: 0 12px; padding: 20px; border-right: 1px solid #ddd2ba; }
.mission-strip article:last-child { border: 0; }
.mission-strip span { grid-row: 1 / 3; color: var(--tile); font: 800 12px var(--utility); }
.mission-strip small { color: var(--muted); }

.practice-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); padding: 95px 0 80px; }
.lesson-sidebar { padding-right: 34px; border-right: 1px solid #cfc3a9; }
.sidebar-heading h2 { font: 700 32px var(--display); }
.week-list { display: grid; gap: 8px; }
.week-button {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.week-button:hover { background: #ece3ce; }
.week-button.active { color: var(--white); background: var(--night); }
.week-button.locked { opacity: .52; }
.week-number { display: grid; width: 34px; height: 34px; font: 700 12px var(--utility); border: 1px solid currentColor; border-radius: 50%; place-items: center; }
.week-copy strong, .week-copy small { display: block; }
.week-copy small { opacity: .72; }
.week-status { font-size: 16px; }
.reset-progress { margin: 24px 10px 0; padding: 6px 0; color: var(--muted); background: transparent; border: 0; border-bottom: 1px solid currentColor; font-size: 12px; }

.lesson-content { min-width: 0; padding-left: 48px; }
.lesson-heading { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; }
.lesson-heading h2 { margin-bottom: 12px; font: 700 clamp(36px, 5vw, 58px)/1.05 var(--display); }
.difficulty { flex: none; padding: 6px 10px; color: var(--tile-dark); background: #f0d3bd; border: 1px solid #d99e79; border-radius: 100px; font: 700 12px var(--utility); }
.lesson-goal { max-width: 760px; color: var(--muted); font-size: 17px; }
.ten-minute-plan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 30px 0; overflow: hidden; background: #cfc3a9; border: 1px solid #cfc3a9; border-radius: 10px; }
.plan-step { padding: 16px; background: var(--white); }
.plan-step span { display: block; color: var(--tile); font: 800 11px var(--utility); }
.plan-step strong { display: block; margin: 3px 0; }
.plan-step small { color: var(--muted); }

.training-console { overflow: hidden; background: var(--white); border: 1px solid #cfc3a9; border-radius: 14px; box-shadow: var(--shadow); }
.console-topline { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 18px 22px; color: var(--white); background: var(--night); }
.console-topline strong { display: block; margin-top: 3px; }
.timer { display: flex; gap: 8px; align-items: center; }
.timer span { min-width: 66px; font: 700 22px var(--utility); }
.timer button { padding: 7px 10px; color: var(--night); background: var(--sun); border: 0; border-radius: 5px; font-size: 12px; font-weight: 750; }
.mode-tabs { display: flex; padding: 15px 22px 0; border-bottom: 1px solid #ded5c2; }
.mode-tab { padding: 8px 14px 11px; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; }
.mode-tab.active { color: var(--ink); border-color: var(--tile); font-weight: 750; }
.score-card { min-height: 260px; padding: 28px 22px 20px; }
.staff-wrap { overflow-x: auto; }
.staff-svg { display: block; min-width: 600px; width: 100%; height: 150px; }
.staff-line { stroke: #26302c; stroke-width: 1.6; }
.note-head { fill: #26302c; }
.note-stem { stroke: #26302c; stroke-width: 2; }
.note-label { fill: var(--tile); font: 700 10px var(--utility); }
.number-score { display: flex; gap: 9px; align-items: flex-end; justify-content: center; min-height: 70px; padding-top: 12px; }
.number-note { position: relative; display: grid; min-width: 44px; height: 48px; font: 700 24px var(--display); border-bottom: 2px solid #404943; place-items: center; }
.number-note small { position: absolute; top: -13px; color: var(--tile); font: 700 9px var(--utility); }
.score-hint { margin-top: 14px; padding: 10px 12px; color: #4d554f; background: #f0eadb; border-left: 4px solid var(--sun); font-size: 13px; }
.score-card.staff-only .number-score { display: none; }
.score-card.number-only .staff-wrap { display: none; }
.playback-row { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding: 18px 22px; background: #eee6d4; border-block: 1px solid #ded5c2; }
.tempo-control { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; font-size: 12px; }
.tempo-control input { width: 100%; accent-color: var(--tile); }
.metronome-button, .label-toggle { padding: 6px 0; color: var(--leaf-dark); border-bottom: 1px solid currentColor; font-weight: 700; }
.keyboard-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 10px; }
.keyboard-heading small { display: block; color: var(--muted); }
.keyboard-scroll { overflow-x: auto; padding: 0 22px 12px; }
.piano { position: relative; display: flex; min-width: 700px; height: 168px; padding-top: 2px; user-select: none; }
.white-key {
  position: relative;
  flex: 1;
  height: 162px;
  padding: 0;
  background: linear-gradient(#fff, #eee9df);
  border: 1px solid #6f756f;
  border-radius: 0 0 7px 7px;
  box-shadow: inset 0 -8px 0 #ddd7ca;
}
.white-key span { position: absolute; right: 0; bottom: 12px; left: 0; font: 700 11px var(--utility); }
.black-key {
  position: absolute;
  z-index: 2;
  top: 2px;
  width: 7.4%;
  height: 98px;
  padding: 0;
  color: var(--white);
  background: linear-gradient(100deg, #111, #303532 65%, #0b0b0b);
  border: 0;
  border-radius: 0 0 5px 5px;
  box-shadow: 0 6px 4px rgb(0 0 0 / 28%);
  transform: translateX(-50%);
}
.black-key span { position: absolute; right: 0; bottom: 9px; left: 0; font: 700 9px var(--utility); }
.piano.hide-labels span { display: none; }
.piano-key.active { background: var(--sun); box-shadow: inset 0 -6px 0 #c39421; }
.black-key.active { background: var(--tile); box-shadow: inset 0 -5px 0 var(--tile-dark); }
.piano-key.target { outline: 4px solid var(--leaf); outline-offset: -5px; }
.check-row { display: flex; gap: 20px; align-items: center; justify-content: space-between; padding: 20px 22px 24px; }
.practice-check { display: flex; gap: 10px; align-items: flex-start; max-width: 420px; }
.practice-check input { flex: none; width: 20px; height: 20px; accent-color: var(--leaf); }
.complete-button { flex: none; }
.coach-note { display: flex; gap: 16px; margin-top: 22px; padding: 18px 20px; color: #dfe7eb; background: var(--night); border-radius: 10px; }
.coach-note p { margin: 3px 0 0; color: #becbd2; }
.coach-icon { display: grid; flex: none; width: 38px; height: 38px; color: var(--night); background: var(--sun); border-radius: 50%; place-items: center; }

.mic-trainer {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  color: var(--white);
  background: #625877;
  border: 1px solid #625877;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.mic-copy, .pitch-display { padding: 24px; background: var(--night); }
.mic-copy h3 { margin-bottom: 8px; font: 700 30px/1.1 var(--display); }
.mic-copy p:not(.eyebrow) { color: #c8c3d4; }
.pitch-display { background: #17132b; }
.pitch-display > strong { display: block; margin: 4px 0 14px; color: var(--sun); font: 800 34px var(--utility); }
.detected-row { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: baseline; }
.detected-row span, .detected-row small { color: #aaa3bb; }
.detected-row b { color: var(--electric); font: 800 40px/1 var(--utility); }
.detected-row small { text-align: right; }
.tuner-rail { position: relative; height: 10px; margin: 18px 0; background: linear-gradient(90deg, var(--tile), #625877 43%, var(--leaf) 50% 57%, #625877 57%, var(--tile)); border-radius: 10px; }
.tuner-center { position: absolute; top: -4px; left: 50%; width: 2px; height: 18px; background: var(--white); }
.tuner-rail i { position: absolute; top: -6px; left: 50%; width: 14px; height: 22px; background: var(--sun); border: 2px solid #302514; border-radius: 3px; transition: left .12s linear; transform: translateX(-50%); }
.pitch-display p { margin: 0; color: #aaa3bb; font-size: 12px; }
.pitch-display.listening { box-shadow: inset 0 0 0 2px var(--electric); }
.pitch-display.matched { box-shadow: inset 0 0 0 3px var(--leaf); }

.method-section { padding: 90px 0; border-top: 1px solid #cfc3a9; }
.section-heading { display: flex; gap: 70px; align-items: flex-end; justify-content: space-between; }
.section-heading h2 { max-width: 760px; margin-bottom: 34px; font: 700 clamp(38px, 6vw, 68px)/1.05 var(--display); }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.method-grid article { padding: 28px; background: var(--white); border-top: 5px solid var(--tile); box-shadow: 0 10px 30px rgb(31 36 30 / 8%); }
.method-symbol { display: grid; width: 48px; height: 48px; margin-bottom: 25px; color: var(--white); background: var(--leaf-dark); border-radius: 50%; place-items: center; font: 700 22px var(--display); }
.method-grid h3 { margin-bottom: 8px; font: 700 26px var(--display); }
.method-grid p { margin-bottom: 0; color: var(--muted); }
.copyright-note { display: grid; grid-template-columns: .8fr 1.2fr; gap: 50px; margin-bottom: 70px; padding: 34px; color: var(--white); background: var(--tile-dark); border-radius: 14px; }
.copyright-note .eyebrow { color: var(--sun); }
.copyright-note h2 { margin: 0; font: 700 32px var(--display); }
.copyright-note > p { margin: 0; color: #eadbd6; }
.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 13px 18px;
  color: var(--white);
  background: var(--leaf-dark);
  border: 2px solid #8fbb72;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; padding-top: 48px; }
  .roof-scene { min-height: 340px; }
  .mission-strip { grid-template-columns: repeat(2, 1fr); }
  .mission-strip article:nth-child(2) { border-right: 0; }
  .mission-strip article:nth-child(-n+2) { border-bottom: 1px solid #ddd2ba; }
  .practice-shell { grid-template-columns: 1fr; }
  .lesson-sidebar { min-width: 0; width: 100%; padding: 0 0 24px; border: 0; border-bottom: 1px solid #cfc3a9; }
  .week-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    grid-template-columns: none;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .lesson-content { padding: 40px 0 0; }
  .method-grid { grid-template-columns: 1fr; }
  .mic-trainer { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .topbar, .hero-grid, main > section { width: min(100% - 24px, 1180px); }
  .topbar { padding: 16px 0; }
  .brand span:last-child { display: none; }
  .sound-toggle { font-size: 12px; }
  .hero { min-height: 780px; }
  .hero-grid { gap: 30px; padding: 50px 0 140px; }
  h1 { font-size: 51px; }
  .hero-lead { font-size: 15px; }
  .roof-scene { min-height: 310px; }
  .moon { width: 100px; height: 100px; }
  .roof-line { top: 105px; }
  .distance-card { right: 0; left: 0; }
  .mission-strip { grid-template-columns: 1fr; margin-top: -16px; }
  .mission-strip article { border-right: 0; border-bottom: 1px solid #ddd2ba; }
  .mission-strip article:nth-child(3) { display: none; }
  .practice-shell { padding: 65px 0; }
  .week-list { grid-auto-columns: 165px; grid-template-columns: none; }
  .lesson-heading { display: block; }
  .difficulty { display: inline-block; margin-bottom: 14px; }
  .ten-minute-plan { grid-template-columns: 1fr; }
  .console-topline { align-items: flex-start; }
  .timer { flex-wrap: wrap; justify-content: flex-end; }
  .timer span { width: 100%; text-align: right; }
  .playback-row { grid-template-columns: 1fr; }
  .tempo-control { grid-template-columns: 1fr; }
  .keyboard-heading, .check-row { align-items: flex-start; flex-direction: column; }
  .complete-button { width: 100%; }
  .section-heading { display: block; }
  .copyright-note { grid-template-columns: 1fr; gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
