:root {
  color-scheme: light;
  --forest: #245A49;
  --deep-green: #183F34;
  --warm-white: #FAF8F2;
  --paper: #FFFFFF;
  --ink: #171A18;
  --muted: #526159;
  --sage: #DDE9D4;
  --sage-deep: #B9CEAE;
  --pale-blue: #DCEFF4;
  --gold: #C99B45;
  --gold-pale: #F1E4C6;
  --error: #A4443E;
  --error-pale: #F7E6E2;
  --line: #D9DDD7;
  --shadow-sm: 0 8px 24px rgba(15, 46, 37, 0.08);
  --shadow-md: 0 20px 55px rgba(15, 46, 37, 0.13);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 30px;
  --content-width: 1180px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
  --font-music: "Apple Symbols", "Segoe UI Symbol", "Noto Music", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--warm-white);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 3%, rgba(220, 239, 244, 0.72), transparent 24rem),
    var(--warm-white);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
input {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.view h1[tabindex="-1"]:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  border: 0;
  margin: -1px;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  color: #FFFFFF;
  background: var(--deep-green);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, var(--content-width));
  min-height: 104px;
  margin: 0 auto;
  padding: 20px 0;
}

.brand-button {
  min-width: 230px;
  min-height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-lockup {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 15px;
}

.brand-name {
  display: block;
  padding: 9px 14px 10px;
  border-radius: 4px;
  color: #FFFFFF;
  background: var(--forest);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand-tagline {
  position: absolute;
  top: 42px;
  left: 43px;
  width: max-content;
  color: var(--ink);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.055em;
  text-shadow: 0 2px 3px rgba(23, 26, 24, 0.17);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(23, 63, 50, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 6px 20px rgba(15, 46, 37, 0.05);
  backdrop-filter: blur(14px);
}

.nav-button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 720;
}

.nav-button:hover,
.nav-button[aria-current="page"],
.nav-button[aria-expanded="true"] {
  color: #FFFFFF;
  background: var(--forest);
}

.nav-chart {
  color: #765619;
  background: var(--gold-pale);
}

.nav-tooltip {
  position: fixed;
  z-index: 100;
  width: min(320px, calc(100vw - 24px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  color: #FFFFFF;
  background: var(--deep-green);
  box-shadow: 0 14px 36px rgba(15, 46, 37, 0.24);
  pointer-events: none;
}

.nav-tooltip::before {
  position: absolute;
  top: -7px;
  left: var(--tooltip-arrow-left, 50%);
  width: 14px;
  height: 14px;
  background: var(--deep-green);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.nav-tooltip p {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.nav-tooltip-touch-hint {
  position: relative;
  z-index: 1;
  display: none;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--gold-pale);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-tooltip.is-touch .nav-tooltip-touch-hint {
  display: block;
}

main {
  display: block;
  min-height: calc(100vh - 178px);
}

.view {
  width: min(100% - 40px, var(--content-width));
  margin: 0 auto;
  animation: view-in 320ms ease both;
}

.content-view {
  padding: 54px 0 84px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 780;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
}

.primary-button {
  color: #FFFFFF;
  background: var(--forest);
  box-shadow: 0 10px 20px rgba(23, 63, 50, 0.18);
}

.primary-button:hover {
  background: var(--deep-green);
  box-shadow: 0 14px 28px rgba(23, 63, 50, 0.23);
}

.gold-button {
  color: var(--deep-green);
  background: var(--gold);
  box-shadow: 0 10px 22px rgba(201, 155, 69, 0.26);
}

.gold-button:hover {
  background: #D6A952;
}

.secondary-button {
  border-color: rgba(23, 63, 50, 0.2);
  color: var(--forest);
  background: #FFFFFF;
}

.danger-button {
  color: #FFFFFF;
  background: var(--error);
}

.text-button,
.back-button {
  min-height: 44px;
  padding: 5px 0;
  border: 0;
  color: var(--forest);
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: rgba(23, 63, 50, 0.28);
  text-underline-offset: 4px;
}

.welcome-view {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(400px, 0.95fr);
  align-items: center;
  gap: clamp(40px, 8vw, 108px);
  min-height: calc(100vh - 178px);
  padding: 58px 0 90px;
}

.hero-copy h1 {
  max-width: 700px;
  margin-bottom: 25px;
  color: var(--ink);
  font-size: clamp(50px, 6.5vw, 88px);
  font-weight: 730;
  line-height: 0.98;
}

.hero-copy h1 span {
  color: var(--forest);
}

.hero-intro {
  max-width: 610px;
  margin-bottom: 35px;
  color: #59635D;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.6;
}

.welcome-form {
  max-width: 640px;
}

.welcome-form > label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 780;
}

.input-action-row {
  display: flex;
  gap: 10px;
}

input[type="text"] {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid #C9D0CA;
  border-radius: 13px;
  color: var(--ink);
  background: #FFFFFF;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(23, 26, 24, 0.04);
}

input[type="text"]:focus {
  border-color: var(--forest);
}

.input-action-row input {
  flex: 1 1 250px;
}

.input-action-row .button {
  flex: 0 0 auto;
}

.form-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.hero-card {
  position: relative;
  min-height: 510px;
  overflow: hidden;
  padding: 36px;
  border: 1px solid rgba(23, 63, 50, 0.1);
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.hero-card::before {
  position: absolute;
  top: -90px;
  right: -76px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: var(--pale-blue);
  content: "";
}

.hero-card::after {
  position: absolute;
  bottom: -85px;
  left: -60px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: var(--sage);
  content: "";
}

.hero-card-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mini-badge {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--deep-green);
  background: var(--sage);
  font-size: 12px;
  font-weight: 780;
}

.preview-notes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 42px 0 34px;
}

.preview-notes span {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--forest);
  background: var(--warm-white);
  font-family: var(--font-music);
  font-size: 29px;
  font-weight: 700;
}

.preview-notes span:first-child,
.preview-notes span:last-child {
  color: #FFFFFF;
  background: var(--forest);
}

.preview-rule {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  margin-left: auto;
  padding: 13px 18px 13px 13px;
  border-radius: 16px;
  background: var(--gold-pale);
}

.rule-number {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 12px;
  color: #FFFFFF;
  background: var(--gold);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
}

.preview-rule p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.staff-lines {
  position: absolute;
  right: 0;
  bottom: 30px;
  left: 0;
  z-index: 1;
  display: grid;
  gap: 9px;
  transform: rotate(-4deg);
}

.staff-lines i {
  display: block;
  height: 1px;
  background: rgba(23, 63, 50, 0.16);
}

.staff-lines b {
  position: absolute;
  bottom: -35px;
  left: 76px;
  color: rgba(23, 63, 50, 0.22);
  font-family: var(--font-music);
  font-size: 80px;
  font-weight: 400;
}

.intro-view {
  display: grid;
  min-height: calc(100vh - 178px);
  padding: 50px 0 90px;
  place-items: center;
}

.lesson-card {
  position: relative;
  width: min(100%, 900px);
  overflow: hidden;
  padding: clamp(36px, 7vw, 76px);
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.lesson-card::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 12px;
  height: 100%;
  background: var(--sage);
  content: "";
}

.lesson-number {
  position: absolute;
  top: -36px;
  right: 34px;
  color: rgba(23, 63, 50, 0.055);
  font-family: var(--font-display);
  font-size: 170px;
  font-weight: 850;
  line-height: 1;
}

.lesson-card h1 {
  position: relative;
  margin-bottom: 28px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.04;
}

.lesson-card blockquote {
  position: relative;
  max-width: 750px;
  margin: 0;
  padding: 0 0 0 23px;
  border-left: 5px solid var(--gold);
  color: #3C4640;
  font-family: var(--font-display);
  font-size: clamp(18px, 2.5vw, 25px);
  font-weight: 650;
  line-height: 1.55;
}

.alphabet-run {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 9px;
  margin: 42px 0;
}

.alphabet-run span {
  position: relative;
  display: grid;
  min-height: 70px;
  place-items: center;
  border-radius: 12px;
  color: var(--forest);
  background: var(--sage);
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 780;
}

.alphabet-run .repeat-letter {
  color: #FFFFFF;
  background: var(--forest);
}

.repeat-letter small {
  position: absolute;
  bottom: 5px;
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lesson-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.page-heading {
  max-width: 770px;
  margin-bottom: 38px;
}

.page-heading h1 {
  margin-bottom: 16px;
  font-size: clamp(39px, 5vw, 62px);
  line-height: 1.04;
}

.page-heading > p:last-child,
.page-heading > div > p:last-child {
  max-width: 670px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.heading-with-stat {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  max-width: none;
}

.mastery-dial {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 174px;
  padding: 13px 17px;
  border: 1px solid rgba(23, 63, 50, 0.12);
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.mastery-dial strong {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
}

.mastery-dial span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  text-transform: uppercase;
}

.linear-progress {
  height: 5px;
  margin-bottom: 32px;
  overflow: hidden;
  border-radius: 999px;
  background: #E4E8E3;
}

.linear-progress span,
.mini-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--forest), var(--gold));
  transition: width 420ms ease;
}

.journey-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
  counter-reset: journey;
}

.journey-card {
  position: relative;
  min-height: 148px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid #DDE1DC;
  border-radius: 17px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  box-shadow: 0 5px 15px rgba(15, 46, 37, 0.04);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
  counter-increment: journey;
}

.journey-card::before {
  position: absolute;
  top: 13px;
  right: 14px;
  color: #A6AEA8;
  content: counter(journey, decimal-leading-zero);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.journey-card:not(:disabled):hover {
  z-index: 2;
  border-color: var(--sage-deep);
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
}

.journey-card-key {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-music);
  font-size: 31px;
  font-weight: 750;
  line-height: 1.1;
}

.journey-card-subtitle {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.card-status {
  position: absolute;
  right: 16px;
  bottom: 15px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #707A73;
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-dots {
  display: flex;
  gap: 4px;
}

.status-dots i {
  display: block;
  width: 7px;
  height: 7px;
  border: 1px solid #97A199;
  border-radius: 50%;
}

.status-dots i.is-filled {
  border-color: var(--forest);
  background: var(--forest);
}

.journey-card.is-current {
  border-color: var(--forest);
  background: var(--pale-blue);
}

.journey-card.is-current::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--forest);
  content: "";
}

.journey-card.is-mastered {
  border-color: var(--forest);
  color: #FFFFFF;
  background: var(--forest);
}

.journey-card.is-mastered::before,
.journey-card.is-mastered .journey-card-subtitle,
.journey-card.is-mastered .card-status {
  color: rgba(255, 255, 255, 0.76);
}

.journey-card.is-mastered .status-dots i {
  border-color: var(--gold);
  background: var(--gold);
}

.journey-card.is-locked {
  border-style: dashed;
  color: #919993;
  background: rgba(242, 242, 237, 0.7);
  box-shadow: none;
}

.journey-next-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 26px;
  padding: 22px 25px;
  border-radius: 18px;
  color: #FFFFFF;
  background: var(--deep-green);
}

.journey-next-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.journey-next-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.journey-next-card .button {
  flex: 0 0 auto;
  color: var(--deep-green);
  background: var(--sage);
}

.practice-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 13px;
}

.practice-card {
  position: relative;
  min-height: 125px;
  padding: 18px;
  border: 1px solid #D8DED8;
  border-radius: 16px;
  background: #FFFFFF;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.practice-card:hover {
  border-color: var(--forest);
  box-shadow: var(--shadow-sm);
  transform: translateY(-3px);
}

.practice-card strong {
  display: block;
  margin-bottom: 15px;
  color: var(--forest);
  font-family: var(--font-music);
  font-size: 29px;
}

.practice-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.practice-card .mastery-check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--deep-green);
  background: var(--gold-pale);
  font-size: 12px;
}

.game-view {
  padding: 22px 0 78px;
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 50px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.back-button {
  justify-self: start;
  text-decoration: none;
}

.game-context {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.attempt-pips {
  display: flex;
  justify-self: end;
  gap: 6px;
}

.attempt-pips span {
  display: grid;
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  place-items: center;
  border: 1px solid #C7CEC8;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.attempt-pips span.is-done {
  border-color: var(--forest);
  color: #FFFFFF;
  background: var(--forest);
}

.attempt-pips span.no-hint {
  border-color: var(--gold);
  color: var(--deep-green);
  background: var(--gold-pale);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 28px;
}

.game-main {
  min-width: 0;
  padding: clamp(25px, 4vw, 48px);
  border: 1px solid rgba(23, 63, 50, 0.1);
  border-radius: 25px;
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.game-heading h1 {
  margin-bottom: 0;
  font-family: var(--font-music);
  font-size: clamp(43px, 5vw, 66px);
  line-height: 1;
}

.key-orbit {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--sage-deep);
  border-radius: 50%;
  background: var(--sage);
  box-shadow: inset 0 0 0 7px #FFFFFF;
}

.key-orbit span {
  color: var(--forest);
  font-family: var(--font-music);
  font-size: 24px;
  font-weight: 750;
}

.core-rule {
  color: var(--muted);
  font-size: 13px;
}

.compact-rule {
  margin: 16px 0 28px;
}

.core-rule strong {
  color: var(--ink);
}

.scale-board-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 3px 12px;
  scroll-behavior: smooth;
  scrollbar-color: var(--sage-deep) transparent;
  scrollbar-width: thin;
}

.scale-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(78px, 1fr));
  gap: 8px;
  min-width: 680px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-pattern-caption {
  min-width: 680px;
  margin: 12px 0 1px;
  color: var(--forest);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-pattern-caption span {
  margin-left: 8px;
  color: var(--muted);
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: none;
}

.step-pattern {
  display: grid;
  grid-template-columns: repeat(8, minmax(78px, 1fr));
  gap: 8px;
  min-width: 680px;
  margin: 0;
  padding: 0 0 5px;
}

.step-pattern-item {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  color: var(--forest);
  transform: translateX(calc(50% + 4px));
}

.step-pattern-item::before {
  position: absolute;
  z-index: 0;
  right: -4px;
  left: -4px;
  height: 1px;
  background: #C9D4CB;
  content: "";
}

.step-pattern-item b {
  position: relative;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--sage-deep);
  border-radius: 999px;
  background: var(--sage);
  box-shadow: 0 2px 5px rgba(15, 46, 37, 0.08);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 850;
}

.step-pattern-item small {
  position: absolute;
  z-index: 1;
  bottom: -2px;
  padding: 0 4px;
  color: var(--muted);
  background: var(--warm-white);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.step-pattern-item.half-step b {
  color: var(--deep-green);
  border-color: #D1AE68;
  background: var(--gold-pale);
}

.game-main .step-pattern-item small,
.challenge-board-shell .step-pattern-item small {
  background: #FFFFFF;
}

.note-slot {
  min-width: 0;
}

.note-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 105px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #D8DED9;
  border-radius: 14px;
  background: var(--warm-white);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.note-button:hover:not(:disabled) {
  border-color: var(--sage-deep);
}

.note-button.is-active {
  border: 2px solid var(--forest);
  background: var(--pale-blue);
  box-shadow: 0 0 0 4px rgba(220, 239, 244, 0.7);
  transform: translateY(-3px);
}

.note-button.is-tonic {
  color: #FFFFFF;
  border-color: var(--forest);
  background: var(--forest);
}

.note-button.is-error {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-pale);
}

.note-button.is-correct {
  color: var(--deep-green);
  border-color: var(--sage-deep);
  background: var(--sage);
}

.degree-number {
  position: absolute;
  top: 8px;
  left: 10px;
  color: #8A948D;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.is-tonic .degree-number {
  color: rgba(255, 255, 255, 0.62);
}

.note-display {
  color: inherit;
  font-family: var(--font-music);
  font-size: 28px;
  font-weight: 750;
  line-height: 1;
}

.note-empty {
  color: #B8BFB9;
  font-family: var(--font-sans);
  font-size: 25px;
  font-weight: 400;
}

.note-pending::after {
  position: absolute;
  bottom: 9px;
  color: var(--forest);
  content: "choose ♭ ♮ ♯";
  font-family: var(--font-sans);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.feedback-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 57px;
  margin: 8px 0 19px;
  padding: 10px 14px;
  border: 1px solid #E3E6E2;
  border-radius: 13px;
  color: #5E6862;
  background: #F8F8F4;
}

.feedback-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.feedback-icon {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: var(--forest);
  background: var(--sage);
  font-family: var(--font-music);
  font-size: 18px;
}

.feedback-panel.is-error {
  border-color: #E9C5C0;
  color: #76302C;
  background: var(--error-pale);
}

.feedback-panel.is-error .feedback-icon {
  color: #FFFFFF;
  background: var(--error);
}

.feedback-panel.is-hint {
  border-color: #E5D3AB;
  color: #684E1D;
  background: var(--gold-pale);
}

.feedback-panel.is-hint .feedback-icon {
  color: #FFFFFF;
  background: var(--gold);
}

.feedback-panel.is-success {
  border-color: var(--sage-deep);
  color: var(--deep-green);
  background: var(--sage);
}

.feedback-panel.is-success .feedback-icon {
  color: #FFFFFF;
  background: var(--forest);
}

.entry-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.54fr) auto;
  align-items: end;
  gap: 14px;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.control-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.selection-readout {
  margin-bottom: 8px;
  color: var(--forest);
  font-size: 10px;
  font-weight: 750;
}

.letter-controls {
  display: grid;
  grid-template-columns: repeat(7, minmax(44px, 1fr));
  gap: 5px;
}

.letter-controls button,
.accidental-controls button,
.clear-button {
  min-width: 44px;
  min-height: 50px;
  border: 1px solid #C9D0CA;
  border-radius: 11px;
  background: #FFFFFF;
  font-weight: 800;
}

.letter-controls button {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 18px;
}

.letter-controls button:hover,
.letter-controls button.is-selected,
.accidental-controls button:hover,
.accidental-controls button.is-selected {
  color: #FFFFFF;
  border-color: var(--forest);
  background: var(--forest);
}

.accidental-controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.accidental-controls button {
  display: flex;
  min-width: 66px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px 7px;
}

.accidental-controls button span {
  font-size: 7px;
  letter-spacing: 0.07em;
}

.accidental-controls button b {
  font-family: var(--font-music);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.05;
}

.clear-button {
  min-width: 83px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
}

.clear-button:hover {
  color: var(--error);
  border-color: #D7A8A3;
  background: var(--error-pale);
}

.game-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 27px;
  padding-top: 22px;
  border-top: 1px solid #E5E8E4;
}

.hint-button {
  color: var(--forest);
  border-color: var(--sage-deep);
  background: var(--sage);
}

.check-button {
  min-width: 190px;
}

.game-side {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.side-card {
  padding: 19px;
  border: 1px solid #DDE2DD;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 6px 20px rgba(15, 46, 37, 0.04);
}

.side-card-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.side-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 25px;
}

.mini-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #E1E5E1;
}

.keyboard-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

kbd {
  padding: 2px 4px;
  border: 1px solid #CDD3CE;
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink);
  background: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 750;
}

.challenge-intro-view {
  display: grid;
  min-height: calc(100vh - 178px);
  place-items: center;
}

.challenge-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.72fr);
  gap: clamp(40px, 8vw, 100px);
  width: 100%;
  padding: 38px 0 72px;
}

.challenge-copy h1 {
  margin-bottom: 24px;
  font-size: clamp(47px, 7vw, 82px);
  line-height: 0.98;
}

.challenge-copy > p:last-of-type {
  max-width: 650px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.challenge-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 33px 0 0;
  padding: 0;
  list-style: none;
}

.challenge-rules li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid #D8DDD8;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 700;
}

.challenge-rules li span {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 820;
}

.challenge-card {
  min-height: 440px;
  padding: 35px;
  border-radius: 26px;
  color: #FFFFFF;
  background: var(--deep-green);
  box-shadow: var(--shadow-md);
}

.challenge-lock,
.challenge-ready {
  display: flex;
  height: 100%;
  min-height: 370px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.lock-icon,
.ready-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: var(--gold);
  font-size: 25px;
}

.challenge-card h2 {
  margin-bottom: 10px;
  font-size: 30px;
}

.challenge-card p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  line-height: 1.55;
}

.challenge-card .primary-button {
  margin-top: 17px;
  color: var(--deep-green);
  background: var(--sage);
}

.challenge-ready label {
  margin-bottom: 7px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
  font-weight: 750;
}

.challenge-ready input {
  margin-bottom: 5px;
  border-color: rgba(255, 255, 255, 0.35);
}

.challenge-ready .gold-button {
  width: 100%;
  margin-top: 18px;
}

.field-error {
  min-height: 18px;
  margin: 0;
  color: #FFD0C9 !important;
  font-size: 11px !important;
}

.challenge-view {
  width: min(100% - 40px, 1040px);
  padding: 16px 0 75px;
}

.challenge-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 15px;
}

.timer-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.timer-block span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-block strong {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.timer-block.is-urgent strong {
  color: var(--error);
}

.challenge-heading {
  text-align: center;
}

.challenge-heading .eyebrow {
  margin-bottom: 4px;
}

.challenge-heading h1 {
  margin: 0;
  font-family: var(--font-music);
  font-size: 37px;
}

.challenge-count {
  display: flex;
  align-items: baseline;
  justify-self: end;
  gap: 5px;
}

.challenge-count strong {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 30px;
}

.challenge-count span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.challenge-track {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}

.challenge-track span {
  height: 5px;
  border-radius: 999px;
  background: #DBE0DB;
}

.challenge-track span.is-complete {
  background: var(--forest);
}

.challenge-track span.is-current {
  background: var(--gold);
}

.challenge-board-shell {
  padding: clamp(25px, 4vw, 43px);
  border-radius: 25px;
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.challenge-board-shell > .compact-rule {
  margin-top: 0;
}

.challenge-feedback {
  margin-top: 10px;
}

.challenge-entry {
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.55fr) auto;
}

.challenge-check {
  width: 100%;
  margin-top: 24px;
}

.result-view {
  display: grid;
  min-height: calc(100vh - 178px);
  place-items: center;
}

.result-card {
  width: min(100%, 640px);
  padding: clamp(35px, 7vw, 68px);
  border-radius: 28px;
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.result-symbol {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto 27px;
  place-items: center;
  border-radius: 50%;
  color: #FFFFFF;
  background: var(--forest);
  font-family: var(--font-music);
  font-size: 31px;
}

.result-card h1 {
  margin-bottom: 14px;
  font-size: clamp(39px, 6vw, 58px);
}

.result-card > p:not(.eyebrow) {
  max-width: 460px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 34px;
}

.celebration-view {
  position: relative;
  display: grid;
  min-height: calc(100vh - 178px);
  overflow: hidden;
  place-items: center;
  border-radius: 30px;
  color: #FFFFFF;
  background:
    radial-gradient(circle at 22% 22%, rgba(201, 155, 69, 0.24), transparent 18rem),
    radial-gradient(circle at 83% 72%, rgba(220, 239, 244, 0.13), transparent 22rem),
    var(--deep-green);
}

.celebration-content {
  position: relative;
  z-index: 2;
  padding: 70px 24px;
  text-align: center;
}

.achievement-seal {
  display: grid;
  width: 88px;
  height: 88px;
  margin: 0 auto 30px;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  box-shadow: inset 0 0 0 7px rgba(201, 155, 69, 0.13);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
}

.celebration-content .eyebrow {
  color: var(--gold);
}

.celebration-content h1 {
  margin-bottom: 23px;
  color: #FFFFFF;
  font-size: clamp(48px, 8vw, 84px);
  line-height: 0.98;
}

.celebration-content p:not(.eyebrow) {
  margin-bottom: 32px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 18px;
}

.celebration-sparkles i {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: sparkle 2.4s ease-out both;
}

.celebration-sparkles i:nth-child(1) { top: 18%; left: 13%; animation-delay: 80ms; }
.celebration-sparkles i:nth-child(2) { top: 28%; right: 14%; width: 5px; height: 5px; animation-delay: 240ms; }
.celebration-sparkles i:nth-child(3) { bottom: 22%; left: 22%; width: 6px; height: 6px; animation-delay: 420ms; }
.celebration-sparkles i:nth-child(4) { right: 25%; bottom: 18%; animation-delay: 170ms; }
.celebration-sparkles i:nth-child(5) { top: 13%; left: 40%; width: 4px; height: 4px; animation-delay: 520ms; }
.celebration-sparkles i:nth-child(6) { top: 50%; right: 8%; width: 4px; height: 4px; animation-delay: 310ms; }

.harmony-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  max-width: none;
}

.harmony-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.download-status {
  min-height: 24px;
  margin: -18px 0 17px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.chart-preview-viewport {
  overflow: hidden;
  padding: 18px;
  border: 1px solid #DDE1DD;
  border-radius: 18px;
  background: #ECEDE9;
  box-shadow: inset 0 2px 8px rgba(23, 26, 24, 0.06);
}

.chart-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
}

.harmony-chart {
  position: absolute;
  top: 0;
  left: 0;
  width: 816px;
  height: 1056px;
  overflow: hidden;
  padding: 48px 42px 32px;
  color: #111411;
  background: #FFFFFF;
  font-family: Arial, Helvetica, sans-serif;
  transform: scale(var(--chart-scale, 1));
  transform-origin: top left;
}

.harmony-chart.is-capturing {
  position: fixed;
  top: 0;
  left: -10000px;
  z-index: -1;
  transform: none;
}

.chart-masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  min-height: 103px;
}

.chart-title-block h2 {
  margin: 0 0 6px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 54px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 0.9;
}

.chart-student-line {
  display: flex;
  gap: 15px;
  color: #4E554F;
  font-size: 10px;
}

.chart-student-line strong {
  color: #151815;
}

.chart-brand {
  padding-top: 2px;
  text-align: right;
}

.chart-brand-name {
  display: inline-block;
  padding: 8px 10px;
  color: #FFFFFF;
  background: var(--forest);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.chart-brand-tagline {
  display: block;
  margin-top: 2px;
  margin-right: -1px;
  color: #171A18;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(23, 26, 24, 0.16);
}

.chart-grid {
  display: grid;
  grid-template-columns: 92px 40px repeat(13, 1fr);
  grid-template-rows: 30px repeat(15, 48px);
  width: 100%;
  border-top: 1px solid #151815;
  border-left: 1px solid #151815;
}

.chart-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #151815;
  border-bottom: 1px solid #151815;
  line-height: 1;
}

.chart-header-cell {
  color: #2D332E;
  background: #FFFFFF;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart-header-cell.degree {
  font-size: 10px;
}

.chart-cell.shaded {
  background: #E2EDD9;
}

.chart-key-cell {
  gap: 3px;
  justify-content: flex-start;
  padding: 0 4px;
  background: #FFFFFF;
}

.chart-key-cell strong {
  width: 27px;
  flex: 0 0 auto;
  font-family: var(--font-music);
  font-size: 13px;
  text-align: center;
}

.chart-note-cell {
  font-family: var(--font-music);
  font-size: 15px;
  font-weight: 700;
}

.mini-staff {
  position: relative;
  width: 55px;
  height: 31px;
  flex: 0 0 auto;
}

.mini-staff-line {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: #171A18;
}

.mini-staff-line:nth-child(1) { top: 6px; }
.mini-staff-line:nth-child(2) { top: 11px; }
.mini-staff-line:nth-child(3) { top: 16px; }
.mini-staff-line:nth-child(4) { top: 21px; }
.mini-staff-line:nth-child(5) { top: 26px; }

.mini-clef {
  position: absolute;
  top: 1px;
  left: 1px;
  z-index: 2;
  font-family: var(--font-music);
  font-size: 29px;
  font-weight: 400;
  line-height: 1;
}

.mini-key-accidental {
  position: absolute;
  z-index: 3;
  font-family: var(--font-music);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.chart-row-number {
  color: #566057;
  font-size: 9px;
  font-weight: 800;
}

.chart-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 45px;
  color: #515851;
  font-size: 7px;
  letter-spacing: 0.025em;
}

.chart-footer strong {
  color: var(--forest);
  font-size: 8px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, var(--content-width));
  min-height: 74px;
  margin: 0 auto;
  border-top: 1px solid rgba(23, 63, 50, 0.1);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.site-footer button {
  min-height: 44px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reset-dialog {
  width: min(calc(100% - 32px), 480px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--ink);
  background: #FFFFFF;
  box-shadow: 0 25px 90px rgba(15, 46, 37, 0.28);
}

.reset-dialog::backdrop {
  background: rgba(15, 46, 37, 0.62);
  backdrop-filter: blur(3px);
}

.reset-dialog form {
  padding: 35px;
}

.dialog-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 50%;
  color: var(--error);
  background: var(--error-pale);
  font-size: 24px;
}

.reset-dialog h2 {
  margin-bottom: 10px;
  font-size: 28px;
}

.reset-dialog p {
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sparkle {
  0% { opacity: 0; transform: scale(0.3) translateY(16px); }
  40% { opacity: 1; }
  100% { opacity: 0.35; transform: scale(1) translateY(-18px); }
}

@media (max-width: 1000px) {
  .welcome-view {
    grid-template-columns: 1fr 390px;
    gap: 48px;
  }

  .journey-grid,
  .practice-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-side {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-panel,
  .challenge-entry {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 0.65fr);
  }

  .clear-button {
    grid-column: 2;
    justify-self: end;
    width: 120px;
  }

  .challenge-hero {
    gap: 50px;
  }
}

@media (max-width: 800px) {
  .site-header {
    min-height: 96px;
  }

  .main-nav {
    gap: 2px;
  }

  .nav-button {
    padding: 0 9px;
    font-size: 11px;
  }

  .welcome-view {
    grid-template-columns: 1fr;
    padding-top: 40px;
  }

  .hero-card {
    min-height: 420px;
  }

  .challenge-hero {
    grid-template-columns: 1fr;
  }

  .challenge-card {
    min-height: auto;
  }

  .challenge-lock,
  .challenge-ready {
    min-height: 330px;
  }

  .harmony-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .scale-board,
  .step-pattern {
    grid-template-columns: repeat(8, minmax(72px, 1fr));
    min-width: 640px;
  }

  .step-pattern-caption {
    min-width: 640px;
  }

  .download-status {
    text-align: left;
  }
}

@media (max-width: 680px) {
  body {
    background:
      radial-gradient(circle at 100% 0%, rgba(220, 239, 244, 0.65), transparent 17rem),
      var(--warm-white);
  }

  .site-header,
  .view,
  .site-footer {
    width: min(100% - 28px, var(--content-width));
  }

  .site-header {
    align-items: flex-start;
    min-height: 132px;
    flex-direction: column;
    padding-top: calc(15px + env(safe-area-inset-top));
  }

  .brand-button {
    min-height: 54px;
  }

  .main-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 4px;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    flex: 0 0 auto;
    padding: 0 12px;
  }

  main {
    min-height: calc(100vh - 206px);
  }

  .welcome-view,
  .intro-view,
  .challenge-intro-view,
  .result-view {
    min-height: calc(100vh - 206px);
  }

  .welcome-view {
    padding: 35px 0 65px;
  }

  .hero-copy h1 {
    font-size: clamp(43px, 13.7vw, 64px);
  }

  .hero-intro {
    font-size: 16px;
  }

  .input-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .input-action-row input {
    flex-basis: auto;
  }

  .hero-card {
    min-height: 390px;
    padding: 25px;
  }

  .preview-notes span {
    min-height: 60px;
  }

  .lesson-card {
    padding: 35px 24px 42px;
  }

  .lesson-number {
    right: 5px;
    font-size: 120px;
  }

  .alphabet-run {
    grid-template-columns: repeat(4, 1fr);
  }

  .alphabet-run span {
    min-height: 58px;
  }

  .lesson-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .content-view {
    padding: 36px 0 64px;
  }

  .heading-with-stat {
    align-items: flex-start;
    flex-direction: column;
    gap: 22px;
  }

  .journey-grid,
  .practice-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .journey-card {
    min-height: 139px;
  }

  .journey-next-card {
    align-items: stretch;
    flex-direction: column;
  }

  .game-view {
    width: 100%;
    padding-bottom: 60px;
  }

  .game-topbar {
    width: calc(100% - 28px);
    margin-right: auto;
    margin-left: auto;
  }

  .game-context {
    display: none;
  }

  .game-topbar {
    grid-template-columns: 1fr auto;
  }

  .game-main {
    padding: 25px 14px 28px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .game-side {
    width: calc(100% - 28px);
    margin: 0 auto;
  }

  .key-orbit {
    width: 62px;
    height: 62px;
  }

  .scale-board-wrap {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
    scroll-padding-inline: 14px;
  }

  .scale-board,
  .step-pattern {
    grid-template-columns: repeat(8, 76px);
    min-width: max-content;
  }

  .step-pattern-caption {
    min-width: 664px;
  }

  .note-button {
    min-height: 96px;
  }

  .entry-panel,
  .challenge-entry {
    grid-template-columns: 1fr;
  }

  .accidental-group {
    grid-column: 1;
  }

  .clear-button {
    grid-column: 1;
    justify-self: end;
  }

  .letter-controls button,
  .accidental-controls button {
    min-height: 53px;
  }

  .game-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .check-button {
    min-width: 0;
  }

  .challenge-topbar {
    grid-template-columns: 1fr 1fr;
    width: calc(100% - 8px);
    margin-right: auto;
    margin-left: auto;
  }

  .challenge-heading {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 9px;
  }

  .challenge-count {
    grid-column: 2;
    grid-row: 1;
  }

  .challenge-view {
    width: 100%;
  }

  .challenge-track {
    width: calc(100% - 28px);
    margin-right: auto;
    margin-left: auto;
  }

  .challenge-board-shell {
    padding: 25px 14px 30px;
    border-radius: 0;
  }

  .challenge-board-shell .scale-board-wrap {
    margin-right: -14px;
    margin-left: -14px;
  }

  .result-actions,
  .harmony-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .celebration-view {
    width: 100%;
    min-height: calc(100vh - 206px);
    border-radius: 0;
  }

  .chart-preview-viewport {
    margin-right: -14px;
    margin-left: -14px;
    padding: 9px;
    border-radius: 0;
  }

  .site-footer {
    min-height: 100px;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding: 15px 0;
  }
}

@media (max-width: 390px) {
  .journey-grid,
  .practice-grid {
    grid-template-columns: 1fr 1fr;
  }

  .journey-card {
    min-height: 132px;
    padding: 14px;
  }

  .journey-card-key {
    font-size: 27px;
  }

  .card-status {
    right: 13px;
    bottom: 12px;
    left: 13px;
  }

  .letter-controls {
    gap: 3px;
  }

  .letter-controls button {
    min-width: 42px;
  }

  .challenge-card {
    padding: 28px 22px;
  }
}

@media (orientation: landscape) and (max-height: 680px) and (min-width: 700px) {
  .welcome-view {
    min-height: auto;
    padding-top: 26px;
  }

  .hero-card {
    min-height: 390px;
  }

  .challenge-hero {
    align-items: center;
    padding-top: 20px;
  }

  .challenge-card {
    min-height: 350px;
  }

  .challenge-lock,
  .challenge-ready {
    min-height: 280px;
  }
}

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