:root {
  color-scheme: light;
  --ink: #1d241f;
  --muted: #70786f;
  --paper: #f4efe6;
  --card: #fffdf8;
  --line: #d9d1c4;
  --green: #285f4b;
  --green-dark: #174735;
  --lime: #d6f06e;
  --orange: #e96b3a;
  --wood-1: #8f5d39;
  --wood-2: #6f4229;
  --shadow: 0 18px 45px rgba(49, 38, 25, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(214, 240, 110, 0.15), transparent 26rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid rgba(29, 36, 31, 0.12);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--lime);
  background: var(--green-dark);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 23px;
  font-style: italic;
  font-weight: 700;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: 0.02em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 0.14em; }

.round-count { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 12px; }
.round-count strong { color: var(--ink); font-family: Georgia, serif; font-size: 25px; font-weight: 500; }

.hero { padding: 48px 0 44px; text-align: center; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.pulse-dot { width: 7px; height: 7px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 0 5px rgba(233, 107, 58, 0.12); }

.note-stage { display: grid; grid-template-columns: 1fr 178px 1fr; align-items: center; gap: 44px; }

.note-card {
  position: relative;
  display: grid;
  width: 178px;
  height: 178px;
  place-items: center;
  color: var(--card);
  background: var(--green-dark);
  border: 6px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(29, 36, 31, 0.15), 0 18px 32px rgba(23, 71, 53, 0.2);
}

.note-card::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(214, 240, 110, 0.35); border-radius: 50%; }
.note-card span { font-family: Georgia, "Times New Roman", serif; font-size: 112px; line-height: 1; transform: translateY(-3px); }
.note-card.accidental span { font-size: 72px; letter-spacing: -0.06em; transform: translate(-3px, -2px); }
.note-card.pop span { animation: note-pop 320ms ease; }
@keyframes note-pop { 0% { opacity: 0; transform: scale(0.65) rotate(-8deg); } 100% { opacity: 1; transform: scale(1) rotate(0) translateY(-3px); } }

.side-action {
  display: inline-flex;
  width: 150px;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.side-action:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(29, 36, 31, 0.1); }
.side-action:active { transform: translateY(0); }
.reveal-action { justify-self: end; background: var(--card); }
.next-action { justify-self: start; color: white; background: var(--green); border-color: var(--green); }
.action-icon { font-size: 18px; font-weight: 400; }
.instruction { margin: 22px 0 0; color: var(--muted); font-size: 13px; }

.fretboard-section {
  padding: 27px 28px 22px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(29, 36, 31, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 21px; }
.section-kicker { margin: 0 0 4px; color: var(--orange); font-size: 10px; font-weight: 800; letter-spacing: 0.16em; }
.section-heading h1 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.answer-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.answer-status > span:first-child { color: #b9b7ae; font-size: 9px; }
.answer-status.visible { color: var(--green); }
.answer-status.visible > span:first-child { color: var(--lime); filter: drop-shadow(0 0 3px rgba(40, 95, 75, 0.45)); }

.fretboard-scroll { overflow-x: auto; padding: 2px 2px 14px; scrollbar-color: #b7b0a4 transparent; scrollbar-width: thin; }
.fretboard-scroll:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }
.fretboard-wrap { width: 100%; }
.fret-numbers, .fret-markers { display: grid; grid-template-columns: clamp(28px, 5.3vw, 62px) repeat(12, minmax(0, 1fr)); }
.fret-numbers { margin-bottom: 7px; color: var(--muted); font-size: 10px; text-align: center; }
.fret-numbers span:first-child { color: var(--green); font-weight: 700; }

.fretboard {
  position: relative;
  display: grid;
  grid-template-columns: clamp(28px, 5.3vw, 62px) repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(4, 48px);
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0, rgba(255,255,255,0.025) 2px, transparent 2px, transparent 5px),
    linear-gradient(90deg, var(--wood-1), var(--wood-2) 70%, #74492f);
  border: 2px solid #58331f;
  border-radius: 7px;
  box-shadow: inset 0 0 22px rgba(23, 12, 6, 0.22);
}

.fret-cell {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 2px solid rgba(235, 222, 197, 0.65);
}
.fret-cell.open { background: #efe8dd; border-right: 5px solid #e1d2b4; }
.fret-cell::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: calc(100% + 4px);
  height: var(--string-size, 2px);
  background: linear-gradient(#ddd, #777 48%, #f7f7f7 56%, #666);
  box-shadow: 0 1px 1px rgba(0,0,0,0.45);
}

.string-label {
  position: relative;
  z-index: 3;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--card);
  background: var(--green-dark);
  border: 2px solid #efe8dd;
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
  display: none;
}

.answer-note {
  position: relative;
  z-index: 4;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--green-dark);
  background: var(--lime);
  border: 2px solid #fff7dc;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(20, 40, 30, 0.35);
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.06em;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 180ms ease, transform 180ms ease;
}
.fretboard.show-answer .answer-note.match { opacity: 1; transform: scale(1); }

.fret-markers { height: 18px; align-items: center; justify-items: center; }
.marker-dot { width: 6px; height: 6px; background: #a9a296; border-radius: 50%; }
.double-marker { display: flex; gap: 8px; }
.fretboard-hint { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.hint-line { width: 22px; height: 1px; background: var(--orange); }

.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.control-card { position: relative; padding: 22px 24px 19px; overflow: hidden; background: var(--card); border: 1px solid rgba(29, 36, 31, 0.1); border-radius: 16px; }
.control-title-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: center; }
.control-icon { display: grid; width: 42px; height: 42px; place-items: center; color: var(--green); background: #e5eee6; border-radius: 11px; font-size: 21px; }
.accidental-card .control-icon { font-family: Georgia, serif; font-size: 17px; font-weight: 700; }
.string-count-card .control-icon { font-size: 26px; line-height: 1; }
.control-card h2 { margin: 0 0 4px; font-size: 14px; }
.control-card p { margin: 0; color: var(--muted); font-size: 11px; }

.switch { position: relative; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { display: block; width: 45px; height: 25px; padding: 3px; background: #d7d4cc; border-radius: 20px; transition: background 180ms ease; }
.switch-thumb { display: block; width: 19px; height: 19px; background: white; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,0.25); transition: transform 180ms ease; }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--orange); outline-offset: 3px; }

.setting-row { display: flex; align-items: center; justify-content: space-between; margin-top: 19px; padding-top: 15px; border-top: 1px solid #ebe6dd; color: var(--muted); font-size: 12px; opacity: 0.45; pointer-events: none; transition: opacity 180ms ease; }
.setting-row.enabled { opacity: 1; pointer-events: auto; }
.number-field { display: flex; height: 31px; align-items: center; overflow: hidden; color: var(--ink); background: var(--paper); border: 1px solid #ddd6cb; border-radius: 8px; }
.number-field button { width: 29px; height: 100%; padding: 0; background: transparent; border: 0; cursor: pointer; }
.number-field button:hover { background: #e8e1d6; }
.number-field input { width: 30px; padding: 0; text-align: center; background: transparent; border: 0; outline: 0; font-weight: 700; appearance: textfield; }
.number-field input::-webkit-inner-spin-button { display: none; }
.number-field span { padding-right: 4px; color: var(--muted); font-size: 10px; }
.speed-fields { display: flex; align-items: center; gap: 8px; }
.equals { color: var(--muted); font-size: 13px; }
.timer-track { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: transparent; }
.timer-track span { display: block; width: 0; height: 100%; background: var(--orange); }

.speak-now {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 19px;
  color: var(--green-dark);
  background: #edf2e8;
  border: 1px solid #dbe4d5;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 160ms ease, transform 160ms ease;
}
.speak-now:hover { background: #e1eadb; transform: translateY(-1px); }
.speak-now:active { transform: translateY(0); }
.speak-now span { color: var(--orange); font-size: 10px; }

.voice-source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}
.voice-source-row select {
  min-width: 112px;
  height: 32px;
  padding: 0 30px 0 10px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #ddd6cb;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}
.voice-source-row select:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.string-count-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 19px; }
.string-count-options label { cursor: pointer; }
.string-count-options input { position: absolute; opacity: 0; pointer-events: none; }
.string-count-options span { display: grid; min-height: 34px; place-items: center; color: var(--muted); background: var(--paper); border: 1px solid #ddd6cb; border-radius: 8px; font-size: 11px; transition: color 160ms ease, background 160ms ease, border-color 160ms ease; }
.string-count-options input:checked + span { color: var(--card); background: var(--green); border-color: var(--green); }
.string-count-options input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding-top: 25px; color: var(--muted); font-size: 10px; }
footer > span { margin-right: 3px; color: var(--ink); font-weight: 700; }
footer a { margin-left: 8px; color: var(--muted); text-underline-offset: 2px; }
footer a:hover { color: var(--green); }
kbd { padding: 3px 6px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; font-family: inherit; font-size: 9px; }

.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; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 74px; }
  .round-count span { display: none; }
  .hero { padding: 35px 0 31px; }
  .note-stage { grid-template-columns: 1fr 132px 1fr; gap: 12px; }
  .note-card { width: 132px; height: 132px; }
  .note-card span { font-size: 84px; }
  .note-card.accidental span { font-size: 54px; }
  .side-action { width: 48px; height: 48px; min-height: 48px; padding: 0; border-radius: 50%; }
  .side-action span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .reveal-action { justify-self: end; }
  .next-action { justify-self: start; }
  .fretboard-section { margin-inline: -12px; padding-inline: 16px; border-radius: 0; }
  .fretboard { grid-template-rows: repeat(4, 42px); }
  .answer-note { width: 24px; height: 24px; font-size: 13px; }
  .fret-numbers { font-size: 9px; }
  .controls { grid-template-columns: 1fr; }
  footer { flex-wrap: wrap; }
}

@media (min-width: 761px) and (max-width: 1040px) {
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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