:root {
  color-scheme: light;
}

@font-face {
  font-family: "BravuraText";
  src: url("../assets/fonts/bravura/BravuraText.woff") format("woff");
  font-display: block;
}

:root {
  --page: oklch(0.965 0.007 230);
  --surface: oklch(0.992 0.004 230);
  --surface-muted: oklch(0.94 0.009 230);
  --ink: oklch(0.235 0.025 245);
  --muted: oklch(0.48 0.025 245);
  --line: oklch(0.84 0.012 230);
  --accent: oklch(0.52 0.13 205);
  --accent-strong: oklch(0.43 0.14 205);
  --accent-soft: oklch(0.9 0.045 205);
  --good: oklch(0.58 0.12 148);
  --good-soft: oklch(0.92 0.05 148);
  --bad: oklch(0.58 0.15 28);
  --bad-soft: oklch(0.93 0.045 28);
  --focus: oklch(0.67 0.13 275);
  --shadow: 0 18px 50px color-mix(in oklch, var(--ink), transparent 90%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

button {
  cursor: pointer;
  font-weight: 700;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 160ms ease-out;
}

button:hover:not(:disabled) {
  border-color: color-mix(in oklch, var(--accent), var(--line) 35%);
  background: color-mix(in oklch, var(--surface), var(--accent-soft) 55%);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in oklch, var(--focus), transparent 45%);
  outline-offset: 2px;
}

button:disabled {
  cursor: default;
}

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

.app-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 28px;
}

.screen {
  display: grid;
  gap: 18px;
}

.hero-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 780;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.25;
}

.lede,
.intro-panel p {
  max-width: 64ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.settings-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.field,
.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.field select {
  min-width: 142px;
  padding: 0 34px 0 12px;
}

.toggle-field {
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.intro-panel,
.legend-panel,
.history-panel,
.practice-surface,
.feedback-banner,
.summary-screen {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel,
.legend-panel,
.history-panel,
.practice-surface,
.summary-screen {
  padding: 22px;
}

.primary-action,
.secondary-action {
  padding: 0 18px;
}

.primary-action {
  border-color: transparent;
  background: var(--accent);
  color: oklch(0.985 0.006 230);
}

.primary-action:hover:not(:disabled) {
  border-color: transparent;
  background: var(--accent-strong);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
}

.history-list strong {
  color: var(--ink);
}

.empty-state {
  margin-bottom: 0;
  color: var(--muted);
}

.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-bar span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.stats-bar strong {
  color: var(--ink);
  font-size: 18px;
}

.practice-surface {
  display: grid;
  gap: 16px;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-row button {
  padding: 0 14px;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.answer-button {
  display: grid;
  place-items: center;
  min-height: 58px;
  padding: 6px;
  background: var(--surface);
}

.answer-button.is-selected {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.answer-button.is-correct {
  border-color: var(--good);
  background: var(--good-soft);
}

.answer-button.is-selected.is-correct {
  border-color: var(--good);
  background: color-mix(in oklch, var(--good-soft), var(--accent-soft) 35%);
}

.pitch-name {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 54px;
  font-size: 19px;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.pitch-letter {
  min-width: 0.75em;
}

.font-bravura {
  font-family: "BravuraText", "Segoe UI Symbol", serif;
  font-weight: 400;
}

.accidental {
  display: inline-block;
  width: 0.95em;
  font-size: 1.72em;
  line-height: 0.58;
  color: currentColor;
  text-align: left;
  transform: translateY(0.1em);
}

.accidental-sharp {
  width: 0.78em;
}

.accidental-quarterSharp {
  width: 0.7em;
}

.accidental-threeQuarterSharp {
  width: 0.9em;
}

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

.feedback-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.feedback-banner.good {
  border-color: var(--good);
  background: var(--good-soft);
}

.feedback-banner.bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.feedback-banner strong {
  margin-right: 8px;
}

.feedback-banner span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.next-row {
  display: flex;
  justify-content: end;
}

.summary-screen {
  justify-items: start;
  max-width: 560px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}

.summary-grid div {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.summary-grid span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.summary-grid strong {
  font-size: 32px;
}

.app-message {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .hero-block,
  .practice-header {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .settings-strip {
    justify-content: start;
  }

  h1 {
    font-size: 28px;
  }

  .legend-grid {
    grid-template-columns: 1fr;
  }

  .answer-grid {
    gap: 7px;
  }

  .answer-button {
    min-height: 50px;
  }

  .pitch-name {
    min-width: 46px;
    font-size: 16px;
  }

  .control-row button {
    flex: 1 1 150px;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 12px;
  }

  .intro-panel,
  .legend-panel,
  .history-panel,
  .practice-surface,
  .summary-screen {
    padding: 16px;
  }

  .answer-grid {
    gap: 6px;
  }

  .answer-button {
    min-height: 46px;
    padding: 4px;
  }

  .pitch-name {
    font-size: 15px;
  }

  .pitch-name {
    min-width: 41px;
  }
}
