@font-face {
  font-family: Lato;
  src: url('/assets/fonts/lato-latin-400-normal.woff2');
}
@font-face {
  font-family: Lato;
  font-weight: 700;
  src: url('/assets/fonts/lato-latin-700-normal.woff2');
}
@font-face {
  font-family: Playfair;
  src: url('/assets/fonts/playfair-display-latin-500-normal.woff2');
}
:root {
  --paper: #f5f0e4;
  --surface: #fffdf8;
  --ink: #26241f;
  --green: #365e53;
  --blue: #355c79;
  --gold: #896119;
  --line: #d3c9b5;
  --quiet: #625e55;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 Lato, sans-serif; }
main { max-width: 960px; padding: 20px; margin: auto; }
h1 { font: 30px/1.2 Playfair, Georgia, serif; margin: 0; }
p { margin: 8px 0; }
a { color: var(--green); text-underline-offset: 3px; }
.lesson-return, #activity-links, .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lesson-return, #activity-links { gap: 10px 18px; margin-bottom: 12px; font-size: 14px; }
#activity-links a[aria-current] { font-weight: 700; text-decoration-thickness: 2px; }
#activity { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
#prompt { max-width: 64ch; margin-bottom: 13px; }
#route-notice:empty, #feedback:empty { display: none; }
#feedback { border-left: 3px solid var(--green); padding: 4px 9px; background: #edf2eb; }
button, select {
  min-height: 44px;
  max-width: 100%;
  border: 1px solid #998d75;
  border-radius: 5px;
  padding: 7px 10px;
  background: var(--surface);
  color: var(--ink);
  font: 700 15px/1.25 Lato, sans-serif;
}
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
button.primary { color: white; background: var(--green); border-color: var(--green); }
button[aria-pressed="true"] { background: #e8eee8; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.family-mode {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  margin: 10px 0 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.family-mode label { position: relative; cursor: pointer; }
.family-mode input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.family-mode span {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 0 12px;
  border-radius: 4px;
  font-weight: 700;
}
.family-mode input:checked + span { background: var(--green); color: white; }
.family-mode input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.family-key label, .rhythm-controls label { font-weight: 700; }
.family-key select {
  min-width: 112px;
  border: 0;
  border-bottom: 1px solid var(--gold);
  border-radius: 0;
  padding-left: 4px;
  background: transparent;
  font-weight: 400;
}
.build-prompt { margin: 12px 0 0; }
.build-prompt + .pitch-scroll { margin-top: 4px; }
.degrees { gap: 4px; }
.degrees button { min-width: 44px; }
.pitch-scroll, .music-scroll { overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; }
.pitch-scroll { margin-top: 12px; padding: 4px; }
.pitches { display: flex; gap: 4px; width: max-content; }
.pitches button, .root-note { min-width: 45px; text-align: center; }
.root-note { display: grid; align-content: center; padding: 2px 6px; background: #f4e9cb; border: 1px solid var(--gold); border-radius: 5px; font-weight: 700; }
.root-note small { font-size: 10px; color: #704d0d; }
.scroll-hint { color: var(--quiet); font-size: 13px; }
.chord-result { display: flex; align-items: center; gap: 0 14px; flex-wrap: wrap; }
.chord-spelling { margin: 0 0 5px; font-weight: 700; }
.position, .staff-label, .transport, .guide, .share { color: var(--quiet); font-size: 14px; }
.position { font-variant-numeric: tabular-nums; }
.transport { min-height: 1.45em; margin-top: 4px; }
.listen-controls { margin-top: 10px; }
.toggle { display: flex; align-items: center; gap: 5px; min-height: 44px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--green); }
.music-scroll { margin: 9px 0; padding-bottom: 4px; }
.timeline {
  position: relative;
  display: grid;
  grid-template-columns: 80px repeat(var(--beats), 42px);
  grid-template-rows: 44px;
  width: max-content;
}
.timeline > * { grid-row: 1; }
.timeline .row-label { grid-column: 1; align-self: center; padding-left: 3px; }
.timeline .beat { position: relative; border-bottom: 1px solid var(--line); border-left: 1px solid #e9e1d1; text-align: center; }
.timeline .bar-start { border-left-color: #94866e; }
.axis { grid-template-rows: 28px; font-size: 14px; color: var(--quiet); }
.timeline .block {
  z-index: 1;
  display: flex;
  align-items: center;
  width: auto;
  min-width: 0;
  padding: 0 0 0 8px;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid #c8c0ab;
  border-radius: 4px;
  color: var(--ink);
  background: #f3ecdc;
  font-weight: 700;
}
.timeline .chord-picker {
  appearance: none;
  display: block;
  padding: 0 14px 0 7px;
  background: #eef3ee;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: right 8px center, right 5px center;
  background-repeat: no-repeat;
  background-size: 3px 4px;
  cursor: pointer;
}
.timeline .chord-picker.selected { border-color: var(--green); }
.timeline .chord-picker:focus-visible { outline-offset: -3px; }
@media (forced-colors: active) {
  .timeline .chord-picker { appearance: auto; padding-inline: 3px; background-image: none; }
}
.timeline.phrase {
  width: min(100%, var(--phrase-width));
  grid-template-columns: minmax(0, 80fr) repeat(var(--beats), minmax(0, 42fr));
}
.phrase + .notation { max-width: 100%; height: auto; }
.phrase .block { padding-inline: 6px; }
.change-buttons { flex-wrap: nowrap; }
.timeline .playing {
  z-index: 2;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  background: #94bfed36;
  pointer-events: none;
}
.staff-label { margin: 7px 0 0; }
.rhythm-staff { width: max-content; }
.notation, .legacy svg { display: block; }
.notation line, .legacy .staff, .legacy .stem { stroke: #6e675c; stroke-width: .9; }
.notation .repeat-barline { fill: var(--ink); }
.notation .tie, .legacy .tie { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.music { font: 40px Bravura, serif; fill: var(--ink); }
.legacy .chord, .legacy .roman, .legacy .small { font: 14px Lato, sans-serif; fill: var(--ink); }
.guide summary { cursor: pointer; min-height: 44px; padding-top: 9px; }
.guide p { max-width: 72ch; }
[hidden] { display: none !important; }
html.embedded, html.embedded body { background: transparent; }
html.embedded body { overflow: hidden; }
html.embedded body > header, html.embedded .ct-site-header, html.embedded .ct-site-footer,
html.embedded .lesson-return, html.embedded #activity-links, html.embedded .share { display: none !important; }
html.embedded main { max-width: none; padding: 0 0 5px; }
html.embedded .guide { margin-left: 4px; }
@media (max-width: 500px) {
  main { padding: 12px; }
  #activity { padding: 12px; }
  h1 { font-size: 25px; }
  .degrees {
    flex-basis: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(44px, 1fr));
  }
  .home-listen button { padding-inline: 8px; }
  .chord-result { gap: 0 5px; }
}

@media (min-width: 840px) {
  .scroll-hint { display: none; }
}

.family-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-top: 10px;
  overscroll-behavior-x: contain;
}
.family-score { position: relative; width: max-content; }
.family-select {
  position: absolute;
  inset: 0 0 0 var(--family-gutter);
  display: grid;
  grid-template-columns: repeat(7, var(--family-column));
}
.family-cell {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border: 0;
  border-radius: 3px;
  padding-bottom: 5px;
  background: transparent;
}
.family-cell[aria-pressed="true"] {
  background: #365e5312;
  box-shadow: inset 0 -2px var(--green);
}
.family-cell:hover { background-color: #365e5312; }
.family-cell.playing { background: #94bfed42; box-shadow: inset 0 -3px var(--blue); }
.family-cell:focus-visible { outline-offset: -3px; }
.family-symbol { fill: var(--ink); font: 700 16px Lato, sans-serif; }
.chord-result { margin-top: 9px; }

.rhythm-toolbar { gap: 8px 20px; margin-top: 10px; }
.rhythm-toolbar .listen-controls { margin-top: 0; }
.reattack-controls { font-size: 14px; }
.reattack-controls .toggle { margin-left: 4px; }
.timeline .reattack-block {
  border-left: 2px dashed var(--green);
  background: #eef3ee;
}

.version-mode { margin: 0; grid-template-columns: repeat(2, minmax(62px, 1fr)); }
.harmony-label { fill: var(--ink); font: 700 14px Lato, sans-serif; }
