:root { color-scheme: light; --paper: #f7f3e9; --ink: #252723; --blue: #2b50e6; --line: #d5d2c9; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.5; }
header { max-width: 1120px; margin: auto; padding: 28px 32px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -.025em; }
.version { font-size: .875rem; color: #62645e; }
main { max-width: 1024px; margin: 64px auto; padding: 0 32px; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.1; letter-spacing: -.045em; margin: 0 0 18px; }
.instruction { margin: 0 0 36px; max-width: 42rem; }
.workspace { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); padding: 22px 0; }
.measure-heading { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 26px; }
h2 { margin: 0; font-size: 1rem; }
.measure-heading > span { font-size: .875rem; color: #62645e; }
.timeline { position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); touch-action: none; user-select: none; -webkit-user-select: none; }
.position { position: relative; min-width: 0; min-height: 164px; padding: 0; border: 0; border-right: 1px dashed var(--line); background: transparent; color: inherit; font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.position:first-child { border-left: 2px solid #86877e; }
.position:nth-child(2n) { border-right: 2px solid #86877e; }
.label { display: flex; height: 44px; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; }
.offbeat .label { font-size: 1.125rem; font-weight: 400; color: #6b6d65; }
.pulse { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.beat-marker { height: 24px; display: flex; justify-content: center; align-items: center; }
.event-space { display: flex; align-items: center; justify-content: center; height: 94px; border-top: 1px solid var(--rhythm-border, var(--line)); border-bottom: 1px solid var(--rhythm-border, var(--line)); background: var(--rhythm-surface, #eeebe2); }
.event { height: 40px; width: calc(100% - 8px); background: var(--rhythm-cell-empty, transparent); border: 1px solid var(--rhythm-border, #d0cec4); border-radius: 2px; }
.position[aria-pressed="true"] .event { visibility: hidden; }
.events-layer { position: absolute; z-index: 2; left: 0; right: 0; top: 68px; height: 94px; pointer-events: none; }
.duration-event { position: absolute; top: calc(50% - 20px); height: 40px; border-radius: 2px; background: var(--blue); }
.duration-event.preview { opacity: .7; }
.position:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; z-index: 1; }
@media (hover: hover) { .position:hover .event-space { background: var(--rhythm-hover, #e4e4dc); } }
.legend { display: flex; gap: 24px; margin-top: 24px; font-size: .875rem; flex-wrap: wrap; }
.legend > span { display: flex; gap: 9px; align-items: center; }
.event-key { width: 20px; height: 10px; background: var(--blue); }
.note { font-size: .875rem; color: #62645e; margin-top: 22px; }
.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: 600px) { header { padding: 20px 16px; } main { margin-top: 40px; padding: 0 12px; } .instruction { margin-bottom: 28px; } .position { min-height: 172px; } .event-space { height: 102px; } .version { font-size: .8125rem; } }
@media (max-width: 600px) { .events-layer { height: 102px; } }
.playhead { position: absolute; z-index: 3; left: 0; top: 61px; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); border: 2px solid var(--paper); transform: translateX(-50%); pointer-events: none; }
.timeline[aria-busy="true"] .position { cursor: default; }
.timeline[aria-busy="true"] .position:hover .event-space { background: var(--rhythm-surface, #eeebe2); }
.playback-controls { display: flex; align-items: flex-start; gap: 32px; flex-wrap: wrap; margin-top: 24px; }
.transport { display: flex; gap: 10px; flex-wrap: wrap; }
.transport button { min-height: 44px; min-width: 80px; padding: 8px 20px; border: 1px solid var(--ink); border-radius: 3px; background: transparent; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.transport #play, .transport #listen { background: var(--blue); border-color: var(--blue); color: white; }
.transport button:disabled { opacity: .45; cursor: default; }
.transport button:focus-visible, #bpm:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.tempo { display: grid; grid-template-columns: auto minmax(100px, 180px); column-gap: 16px; align-items: center; max-width: 100%; }
.tempo label { font-size: .875rem; font-weight: 700; min-width: 72px; }
#bpm { width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--blue); cursor: pointer; }
#tempo-hint { grid-column: 1 / -1; font-size: .875rem; color: #62645e; }
.playback-controls + .note { min-height: 1.5em; }
@media (max-width: 600px) { .playback-controls { gap: 16px 24px; } }
.playback-options { min-width: 210px; }
.option { display: grid; grid-template-columns: 1fr 40px 28px; align-items: center; gap: 8px; min-height: 44px; font-size: .875rem; cursor: pointer; }
.option > span:first-child { font-weight: 700; }
.option input { appearance: none; -webkit-appearance: none; margin: 0; width: 40px; height: 24px; border: 1px solid #86877e; border-radius: 14px; background: #deded6; cursor: pointer; }
.option input::before { content: ''; display: block; width: 16px; height: 16px; margin: 3px; border-radius: 50%; background: var(--ink); }
.option input:checked { background: var(--blue); border-color: var(--blue); }
.option input:checked::before { transform: translateX(16px); background: white; }
.option input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.option input:disabled { opacity: .5; cursor: default; }
#options-hint { font-size: .875rem; color: #62645e; }
.mode-switch { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 24px; }
.mode-switch button { font: inherit; font-size: .875rem; font-weight: 700; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 10px 16px; min-height: 44px; cursor: pointer; touch-action: manipulation; }
.mode-switch button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); background: #e9edff; }
.mode-switch button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.duration-event.correct { background: #246748; }
.duration-event.duration, .duration-event.extra { background: #a13e36; }
.duration-event .feedback-symbol { display: block; text-align: center; color: white; font-size: 1rem; line-height: 40px; font-weight: 700; }
#comparison { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
#comparison h2 { margin-bottom: 12px; }
.original-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); position: relative; height: 104px; }
.original-cell { border-right: 1px dashed var(--line); text-align: center; padding-top: 4px; font-size: 1.125rem; color: #62645e; }
.original-cell:first-child { border-left: 2px solid #86877e; }
.original-cell:nth-child(2n) { border-right: 2px solid #86877e; }
.original-cell:nth-child(2n+1) { font-weight: 700; color: var(--ink); }
.original-grid .duration-event { top: 48px; background: transparent; border: 2px solid var(--blue); }
.original-grid .playhead { top: 34px; }
#result-message { margin: 20px 0 12px; font-weight: 700; }
.feedback-details { margin: 0; padding-left: 20px; font-size: .875rem; }
.feedback-details li { margin: 6px 0; }
#rhythm-choice { display: flex; gap: 12px; align-items: center; margin: -12px 0 24px; flex-wrap: wrap; }
#rhythm-choice label { font-size: .875rem; font-weight: 700; }
#rhythm-select { font: inherit; font-size: 1rem; min-height: 44px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: var(--paper); }
#pad-area { margin-top: 24px; }
#performance-pad { display: block; width: 100%; min-height: 180px; padding: 24px; font: inherit; font-weight: 800; font-size: 1.75rem; color: var(--blue); background: #e9edff; border: 2px solid var(--blue); border-radius: 6px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#performance-pad:disabled { border-color: var(--line); color: #62645e; background: #eeebe2; cursor: default; }
#performance-pad[aria-pressed="true"] { color: white; background: var(--blue); }
#performance-pad:focus-visible, #rhythm-select:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
#pad-help { font-size: .875rem; color: #62645e; margin: 10px 0 0; }
.timeline[data-readonly="true"] .position { cursor: default; }

/* Keep the instrument and its instruction nonselectable, not the page. */
#pad-area, #pad-area * { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-user-drag: none; }

.timeline[data-readonly="true"], .timeline[data-readonly="true"] * { touch-action: auto; }
.timeline[data-readonly="true"] .position { pointer-events: none; }
.position.bar-start { border-left: 3px solid var(--ink); }
@media (pointer: coarse) {
  #performance-pad { transition: none !important; animation: none !important; transform: none !important; }
}

#exercise-choice { margin: -12px 0 24px; }
#exercise-select, #sound-select { font: inherit; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); color: var(--ink); }
.sound-choice { display: flex; align-items: center; gap: 8px; font-size: .875rem; }

.timeline[data-beat-one="true"] .position:first-child .pulse { background: var(--blue); transform: scale(1.2); transition: none; animation: none; }

.position.minor-subdivision .label { font-size: .875rem; color: #898b83; }
.timeline[data-sixteenths="true"] .position { border-right: 1px dashed var(--line); }
.timeline[data-sixteenths="true"] .position.mainbeat { border-left: 2px solid #86877e; }
.position.bar-start, .original-cell.bar-start { border-left: 3px solid var(--ink); }
.original-grid[data-sixteenths="true"] .original-cell:nth-child(2n) { border-right: 1px dashed var(--line); }
.original-grid[data-sixteenths="true"] .original-cell:nth-child(2n+1) { font-weight: 400; color: #62645e; }
.original-grid[data-sixteenths="true"] .original-cell.quarter-start { border-left: 2px solid #86877e; font-weight: 700; color: var(--ink); }
.timeline[data-sixteenths="true"] .position.bar-start, .original-grid[data-sixteenths="true"] .original-cell.bar-start { border-left: 3px solid var(--ink); }

.listen-actions { display: flex; flex-direction: column; gap: 6px; }
.listen-actions:has(#listen[hidden]) { display: none; }
#bar-listen { display: flex; gap: 6px; }
.transport #bar-listen button { min-width: 54px; min-height: 36px; padding: 5px 9px; font-size: .8125rem; font-weight: 400; }
.transport { align-items: flex-start; }

#save-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; font-size: .875rem; }
#save-controls input { font: inherit; padding: 10px; width: 160px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper); }
#save-controls button, #delete-saved { font: inherit; padding: 10px; min-height: 44px; border: 1px solid var(--line); background: transparent; border-radius: 3px; cursor: pointer; }
#save-status { flex-basis: 100%; }
#saved-mobile-hint { font-size: .8125rem; color: #62645e; }

.playback-fill { position: absolute; inset: 0; background: #ed8735; transform: scaleX(0); transform-origin: left center; border-radius: inherit; pointer-events: none; }
.duration-event .feedback-symbol { position: relative; z-index: 1; }
.position[data-cue="true"] .pulse { background: var(--blue); transform: scale(1.2); transition: none; }
.timeline[data-strong-cue="true"] .position[data-cue="true"] .pulse { transform: scale(1.8); }

#beat-controls { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 4px; margin-top: 12px; }
#beat-controls label { display: flex; flex-direction: column; gap: 2px; font-size: .75rem; color: #62645e; }
#beat-controls select { font: inherit; font-size: .8125rem; min-width: 0; width: 100%; min-height: 36px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; }
#mixed-notice { font-size: .875rem; color: #8c3a21; }
.timeline .position { border-right: 1px dashed var(--line); }
.timeline .position.mainbeat { border-left: 2px solid #86877e; }
.timeline .position.bar-start { border-left: 3px solid var(--ink); }
.original-grid .original-cell { font-weight: 400; border-right: 1px dashed var(--line); }
.original-grid .original-cell.quarter-start { font-weight: 700; border-left: 2px solid #86877e; }
.original-grid .original-cell.bar-start { border-left: 3px solid var(--ink); }

#save-controls #clear-rhythm { border-color: transparent; color: #62645e; padding-inline: 8px; }
#save-controls #clear-rhythm:hover { color: var(--ink); text-decoration: underline; }

/* Learn adds guidance around the same practice surface. Tool modes keep their layout. */
main[data-learn-view]:not([data-learn-view=""]) > #tool-title,
main[data-learn-view]:not([data-learn-view=""]) > #instructions,
main[data-learn-view]:not([data-learn-view=""]) > #exercise-choice,
main[data-learn-view]:not([data-learn-view=""]) > #rhythm-choice,
main[data-learn-view]:not([data-learn-view=""]) > #subdivision-control,
main[data-learn-view]:not([data-learn-view=""]) > #mixed-notice,
main[data-learn-view]:not([data-learn-view=""]) > #save-controls,
main[data-learn-view]:not([data-learn-view=""]) .sound-choice,
main[data-learn-view]:not([data-learn-view=""]) #build-options { display:none !important; }
main[data-learn-view="home"] > .workspace, main[data-learn-view="intro"] > .workspace, main[data-learn-view="complete"] > .workspace,
main[data-learn-view="home"] > .playback-controls, main[data-learn-view="intro"] > .playback-controls, main[data-learn-view="complete"] > .playback-controls,
main[data-learn-view="home"] > #pad-area, main[data-learn-view="intro"] > #pad-area, main[data-learn-view="complete"] > #pad-area,
main[data-learn-view="home"] > #playback-status, main[data-learn-view="intro"] > #playback-status, main[data-learn-view="complete"] > #playback-status { display:none !important; }
#learn-panel { margin-bottom:24px; }
#learn-panel h1 { font-size:clamp(1.8rem,4vw,2.75rem); margin-bottom:12px; }
#learn-panel button { font:inherit; cursor:pointer; min-height:44px; padding:9px 14px; color:var(--ink); background:transparent; border:1px solid var(--line); border-radius:3px; touch-action:manipulation; }
#learn-panel button:focus-visible, #learn-panel summary:focus-visible { outline:3px solid var(--blue); outline-offset:3px; }
/* Learn transitions focus the heading for screen readers, not as a control. */
#learn-panel h1[tabindex="-1"]:focus { outline:none; }
#learn-panel .learn-primary { background:var(--blue); color:white; border-color:var(--blue); font-weight:700; }
#learn-panel .learn-back { border:0; padding-left:0; color:#62645e; }
.learn-intro { max-width:42rem; margin:0 0 24px; }
.learn-eyebrow { color:#62645e; font-size:.8125rem; margin:12px 0 8px; }
.learn-path { list-style:none; padding:0; margin:16px 0; border-top:1px solid var(--line); }
#learn-panel .learn-path button { width:100%; border:0; border-bottom:1px solid var(--line); border-radius:0; padding:18px 0; display:grid; grid-template-columns:42px 1fr auto; gap:12px; align-items:center; text-align:left; font-weight:700; }
.learn-number { color:var(--blue); font-size:.875rem; }
.learn-path small { font-size:.75rem; color:#62645e; font-weight:400; }
.learn-storage,.learn-small { font-size:.8125rem; color:#62645e; }
.learn-future { border-top:1px solid var(--line); margin-top:32px; padding-top:24px; color:#62645e; }
.learn-future ol { columns:2; padding-left:26px; line-height:2; font-size:.875rem; }
.learn-tags { list-style:none; display:flex; gap:8px; flex-wrap:wrap; padding:0; margin:10px 0 20px; }
.learn-tags li { background:#eeebe2; padding:5px 9px; font-size:.8125rem; border-radius:3px; }
.learn-method { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.learn-method > span { font-weight:700; font-size:.875rem; margin-right:4px; }
#learn-panel button[aria-pressed="true"] { background:#e9edff; border-color:var(--blue); color:var(--blue); }
.learn-method-note { font-size:.8125rem; color:#62645e; margin:8px 0 12px; }
.learn-help { margin:12px 0 18px; max-width:42rem; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.learn-help summary { padding:12px 0; cursor:pointer; font-size:.875rem; font-weight:700; }
.learn-help p { font-size:.875rem; margin:0 0 12px; }
.learn-exercise-actions { display:flex; flex-wrap:wrap; gap:8px; }
.learn-exercise-cue { max-width:42rem; font-size:.9375rem; margin:8px 0 16px; }
.learn-diagram { display:flex; gap:20px; flex-wrap:wrap; margin:20px 0 26px; max-width:660px; }
.learn-mini { flex:1 1 240px; }
.learn-bar-name { font-size:.75rem; color:#62645e; }
.learn-mini-count { display:grid; text-align:center; margin-top:8px; }
.learn-mini-count span { color:#62645e; }
.learn-mini-count .strong { color:var(--ink); font-weight:700; }
.learn-mini-count i { display:block; height:18px; font-size:.65rem; font-style:normal; }
.learn-mini-events { position:relative; height:24px; margin-top:6px; background:var(--rhythm-surface, #eeebe2); }
.learn-mini-events > span { position:absolute; height:16px; top:4px; background:var(--blue); border-radius:2px; }
@media(max-width:600px){
  #learn-panel .learn-path button { grid-template-columns:28px 1fr; gap:3px 8px; padding:14px 0; }
  .learn-path small { grid-column:2; }
  .learn-future ol { columns:1; }
  main[data-learn-view="exercise"] .label { font-size:1.1rem; }
  main[data-learn-view="exercise"] .offbeat .label { font-size:.875rem; }
  #learn-panel .learn-primary { min-height:48px; }
  main[data-learn-view="exercise"] #performance-pad { min-height:140px; }
}
/* Two-bar Foundation practice wraps into two readable bars on narrow screens. */
.timeline { --learn-row-height:164px; }
.timeline[data-stacked="true"] { grid-template-columns:repeat(8,minmax(0,1fr)) !important; }
.timeline[data-stacked="true"] .duration-event[data-row="1"] { transform:translateY(var(--learn-row-height)); }
.original-grid[data-stacked="true"] { grid-template-columns:repeat(8,minmax(0,1fr)) !important; grid-template-rows:104px 104px; height:208px; }
.original-grid[data-stacked="true"] .duration-event[data-row="1"] { transform:translateY(104px); }
@media(max-width:600px){.timeline { --learn-row-height:172px; }}
main[data-learn-view="exercise"] { display:flex; flex-direction:column; }
main[data-learn-view="exercise"] > #learn-panel { order:1; margin-bottom:12px; }
main[data-learn-view="exercise"] > .playback-controls { order:2; margin:0 0 20px; gap:16px 24px; }
main[data-learn-view="exercise"] > .workspace { order:3; }
main[data-learn-view="exercise"] > #pad-area { order:4; }
main[data-learn-view="exercise"] > #playback-status { order:5; }
main[data-learn-view="exercise"] #animation-control { display:none !important; }
main[data-learn-view="exercise"] #learn-panel h1 { font-size:clamp(1.7rem,3vw,2.1rem); }
main[data-learn-view="exercise"] .learn-help { margin:8px 0 12px; }
main[data-learn-view="exercise"] .learn-exercise-cue { margin:6px 0 10px; }

/* Optional coaching: concise first, details on request; never an overlay. */
.learn-coach { align-self:start; margin:12px 0; border:1px solid var(--line); border-radius:3px; background:#f1eee5; font-size:.8125rem; }
.learn-coach summary { cursor:pointer; padding:12px; min-height:44px; font-weight:700; }
.coach-body { padding:0 12px 12px; }
#learn-panel .coach-body h2 { font-size:.875rem; margin:0 0 8px; }
.coach-steps { padding-left:20px; margin:0 0 8px; line-height:1.7; }
.coach-details { border-top:1px solid var(--line); margin-bottom:8px; }
.coach-details summary { padding:10px 0; font-weight:400; }
.coach-details p { margin:0 0 12px; }
.coach-count { display:block; font-weight:700; color:var(--blue); margin-top:4px; }
.coach-body-cue { border-top:1px solid var(--line); padding-top:10px; }
#learn-panel .coach-body button { font-size:.8125rem; padding:6px 10px; }
@media(min-width:1000px){
  main[data-learn-view="exercise"] > #learn-panel { display:grid; grid-template-columns:minmax(0,1fr) 250px; column-gap:24px; align-items:start; }
  main[data-learn-view="exercise"] > #learn-panel > * { grid-column:1; }
  main[data-learn-view="exercise"] > #learn-panel > .learn-coach { grid-column:2; grid-row:1 / span 20; margin:0; }
}

/* Learn keeps the explanation visible; only physical coaching is collapsible. */
.learn-explanation { max-width:42rem; font-size:.875rem; margin:8px 0 12px; }
.learn-preview { margin-bottom:16px; }
.learn-preview-status { font-size:.8125rem; color:#62645e; margin-left:10px; }
main[data-learn-view="exercise"] #tempo-hint { display:none; }

main[data-learn-view="exercise"] > #learn-footer { order:6; margin-top:16px; }
#learn-footer button { font:inherit; min-height:44px; padding:9px 14px; border:1px solid var(--line); border-radius:3px; background:transparent; color:var(--ink); cursor:pointer; touch-action:manipulation; }
#learn-footer .learn-primary { background:var(--blue); border-color:var(--blue); color:white; font-weight:700; }
#learn-footer button:focus-visible { outline:3px solid var(--blue); outline-offset:3px; }

/* Parent navigation stays secondary and outside the app tabs. */
.header-brand { display:flex; align-items:center; gap:20px; }
.skill-map-link { font-size:.8125rem; color:#62645e; text-decoration:none; display:inline-flex; align-items:center; min-height:32px; }
.skill-map-link[hidden] { display:none; }
.skill-map-link:hover { color:var(--ink); text-decoration:underline; text-underline-offset:3px; }
.skill-map-link:focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
@media (max-width:600px) {
  .header-brand { display:contents; }
  header .version { order:1; }
  .skill-map-link { order:2; flex-basis:100%; min-height:44px; }
}

/* Beginner lesson introductions: one control zone and a physical cue. */
.learn-intro-controls { display:flex; flex-wrap:wrap; align-items:center; gap:12px 20px; margin:16px 0 24px; }
.learn-intro-controls .learn-preview, .learn-intro-controls .learn-method { margin:0; }
.learn-intro-controls .learn-method { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
/* Labels mark exact onset points, including future eighth-note positions. */
.learn-onsets { margin-left:10px; margin-right:10px; }
.learn-onsets .learn-mini-count { display:block; position:relative; height:50px; text-align:center; }
.learn-onsets .learn-mini-count > span { position:absolute; top:0; transform:translateX(-50%); }
.learn-onsets .learn-mini-count > span::after { content:""; position:absolute; left:50%; top:24px; height:32px; border-left:1px solid var(--line); z-index:0; }
.learn-onsets .learn-mini-count i { position:relative; z-index:1; }
.learn-intro-coach { display:flex; gap:24px; align-items:center; max-width:660px; padding:24px; margin:20px 0 16px; border:1px solid var(--line); background:#fff; border-radius:14px; }
#learn-panel .learn-intro-coach h2 { font-size:1.0625rem; margin:0 0 10px; }
.learn-intro-coach p { font-size:.875rem; color:#555950; margin:8px 0; line-height:1.55; }
.learn-physical-cue { width:132px; height:132px; flex:0 0 132px; display:grid; place-items:center; border-radius:10px; background:#faf8f2; color:#666d5e; }
.learn-physical-cue svg { width:100px; height:100px; }
.learn-coach-copy { min-width:0; }
@media(max-width:600px){.learn-intro-controls { gap:10px 14px; }.learn-intro-controls .learn-method { flex-basis:100%; }.learn-intro-coach { gap:14px; padding:18px; align-items:flex-start; }.learn-physical-cue { width:64px; height:80px; flex-basis:64px; }.learn-physical-cue svg { width:60px; height:70px; }}

/* Beginner Learn: shared onset geometry, calm coaching and unified controls. */
.learn-onsets .learn-mini-count > span::after { display:none; }
main[data-refined-learn="true"][data-learn-view="exercise"] #learn-panel { display:block; }
main[data-refined-learn="true"][data-learn-view="exercise"] .timeline { margin:0 10px; }
main[data-refined-learn="true"][data-learn-view="exercise"] .position { border:0 !important; }
main[data-refined-learn="true"][data-learn-view="exercise"] .position::before { content:""; position:absolute; left:0; top:56px; bottom:0; border-left:1px dashed var(--line); }
main[data-refined-learn="true"][data-learn-view="exercise"] .position.mainbeat::before { border-left:2px solid #86877e; }
main[data-refined-learn="true"][data-learn-view="exercise"] .label, main[data-refined-learn="true"][data-learn-view="exercise"] .beat-marker { position:relative; width:max-content; min-width:9px; transform:translateX(-50%); }
main[data-refined-learn="true"][data-learn-view="exercise"] .sound-choice { display:none; }
main[data-refined-learn="true"][data-learn-view="exercise"] .playback-controls { gap:16px 24px; margin:12px 0 28px; }
#learn-practice-method .learn-method { display:flex; align-items:center; gap:8px; margin:0; }
#learn-practice-method button { font:inherit; padding:10px 14px; min-height:44px; background:transparent; border:1px solid var(--line); border-radius:3px; color:var(--ink); cursor:pointer; }
#learn-practice-method button[aria-pressed="true"] { color:var(--blue); border-color:var(--blue); background:#e9edff; }
main[data-refined-learn="true"][data-learn-view="exercise"] #pad-help { font-size:.8125rem; color:#62645e; }
@media(max-width:600px){main[data-refined-learn="true"][data-learn-view="exercise"] .transport, #learn-practice-method { flex-basis:100%; }}

main[data-refined-learn="true"][data-learn-view="exercise"] #playback-status { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }

main[data-refined-learn="true"][data-learn-view="exercise"] .playhead { display:none; }

main[data-refined-learn="true"][data-learn-view="exercise"] #animation-control:not([hidden]) { display:flex !important; }

.learn-intro-coach[data-cue-visual="subdivision"] { flex-direction:column; align-items:stretch; gap:20px; }
.learn-subdivision-cue { display:grid; grid-template-columns:repeat(8,minmax(0,1fr)); max-width:360px; width:100%; padding:12px 0; border-bottom:1px solid var(--line); text-align:center; }
.learn-subdivision-cue .cue-beat { font-weight:700; color:var(--ink); }
.learn-subdivision-cue .cue-offbeat { color:#707369; }
.learn-subdivision-cue i { display:block; height:18px; font-size:.65rem; font-style:normal; }
.learn-cue-steps { list-style:none; counter-reset:cue-step; margin:14px 0 0; padding:0; }
.learn-cue-steps li { counter-increment:cue-step; position:relative; padding-left:34px; margin-top:16px; }
.learn-cue-steps li::before { content:counter(cue-step,decimal-leading-zero); position:absolute; left:0; top:1px; font-size:.8125rem; font-weight:700; color:#707369; }
.learn-cue-steps h3 { font-size:.9375rem; margin:0; }
.learn-cue-steps p { margin:5px 0; }
.learn-cue-steps .learn-cue-count { font-weight:700; color:var(--ink); word-spacing:4px; }

#learn-backing { flex-basis:100%; align-items:center; gap:8px; margin:0; font-size:.875rem; }
#learn-piano-cue { color:#62645e; margin-left:10px; font-size:.8125rem; }

.learn-backing-row { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:16px 0; font-size:.875rem; }
.learn-piano-cue, #learn-piano-cue { display:inline-flex; align-items:center; gap:6px; margin-left:8px; color:var(--muted, #62645e); font-size:.8125rem; font-weight:400; }
.learn-piano-cue svg { flex-shrink:0; }
@media(max-width:600px){ .learn-backing-row .learn-piano-cue { margin-left:0; flex-basis:100%; } }

/* Beginner mobile navigation and the shared Learn practice stack. */
@media (max-width:600px) {
  body:has(#skill-map-link:not([hidden])) header { padding:8px 12px; }
  body:has(#skill-map-link:not([hidden])) header .version { display:none; }
  body:has(#skill-map-link:not([hidden])) .header-brand { display:flex; width:100%; justify-content:space-between; gap:8px; }
  body:has(#skill-map-link:not([hidden])) .skill-map-link { flex-basis:auto; min-height:44px; white-space:nowrap; }
  body:has(#skill-map-link:not([hidden])) main { margin-top:16px; padding-bottom:max(24px,env(safe-area-inset-bottom)); }
  body:has(#skill-map-link:not([hidden])) main > .mode-switch[aria-label="Mode"] { display:grid; grid-template-columns:1fr 1fr 1.65fr 1.35fr; gap:4px; margin-bottom:18px; }
  body:has(#skill-map-link:not([hidden])) main > .mode-switch[aria-label="Mode"] button { min-width:0; min-height:44px; padding:6px 3px; font-size:clamp(.6875rem,3.1vw,.8125rem); white-space:nowrap; }
  main[data-refined-learn="true"] #learn-panel .learn-backing-row { margin:10px 0 8px; gap:6px 8px; }
  main[data-refined-learn="true"] .learn-intro-controls { margin:8px 0 18px; gap:8px 14px; }
  main[data-refined-learn="true"] #learn-panel .learn-intro-controls button,
  main[data-refined-learn="true"] #learn-panel .learn-backing-row button { min-height:44px; padding:8px 12px; font-size:.875rem; }
  main[data-refined-learn="true"][data-learn-view="exercise"] { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); column-gap:12px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > * { grid-column:1 / -1; min-width:0; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > .playback-controls { display:contents; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .playback-controls > * { order:2; grid-column:1 / -1; min-width:0; margin:0 0 12px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .playback-controls > .transport { order:4; margin:12px 0; gap:8px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > #pad-area { order:5; margin-top:0; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #target-loop-control { grid-column:1; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #animation-control { grid-column:2; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #learn-backing { margin-bottom:12px; gap:6px 8px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .transport button,
  main[data-refined-learn="true"][data-learn-view="exercise"] #learn-practice-method button,
  main[data-refined-learn="true"][data-learn-view="exercise"] #learn-backing button { min-height:44px; padding:8px 12px; font-size:.875rem; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .tempo { flex-wrap:wrap; max-width:100%; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .measure-heading { gap:8px; flex-wrap:wrap; }
}

/* The same Learn exercise hierarchy on desktop: settings, score, transport, pad. */
@media (min-width:601px) {
  main[data-refined-learn="true"][data-learn-view="exercise"] { display:grid; grid-template-columns:max-content max-content minmax(0,1fr); column-gap:24px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > * { grid-column:1 / -1; min-width:0; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > .playback-controls { display:contents; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .playback-controls > * { order:2; grid-column:1 / -1; min-width:0; margin:0 0 16px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #learn-backing { margin-bottom:16px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #target-loop-control { grid-column:1; }
  main[data-refined-learn="true"][data-learn-view="exercise"] #animation-control { grid-column:2; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .tempo { grid-column:3; flex-wrap:wrap; justify-content:flex-start; gap:12px; }
  main[data-refined-learn="true"][data-learn-view="exercise"] .playback-controls > .transport { order:4; margin:12px 0; }
  main[data-refined-learn="true"][data-learn-view="exercise"] > #pad-area { order:5; margin-top:0; }
}

/* Beginner Build shares the settings → score → transport → save hierarchy. */
main[data-beginner-build="true"] { display:grid; grid-template-columns:repeat(3,max-content) minmax(0,1fr); column-gap:20px; }
main[data-beginner-build="true"] > * { grid-column:1 / -1; min-width:0; }
main[data-beginner-build="true"] > .playback-controls,
main[data-beginner-build="true"] #build-options { display:contents; }
main[data-beginner-build="true"] .playback-controls > *,
main[data-beginner-build="true"] #build-options > * { order:1; min-width:0; margin:0 0 16px; }
main[data-beginner-build="true"] .sound-choice { grid-column:1 / -1; }
main[data-beginner-build="true"] #build-options .option:has(#loop) { grid-column:1; }
main[data-beginner-build="true"] #animation-control { grid-column:2; }
main[data-beginner-build="true"] #build-options .option:has(#metronome) { grid-column:3; }
main[data-beginner-build="true"] .tempo { grid-column:4; }
main[data-beginner-build="true"] #options-hint { grid-column:1 / -1; font-size:.8125rem; }
main[data-beginner-build="true"] > .workspace { order:2; }
main[data-beginner-build="true"] .playback-controls > .transport { order:3; grid-column:1 / -1; margin:12px 0; }
main[data-beginner-build="true"] > #save-controls { order:4; margin-top:0; }
main[data-beginner-build="true"] > #playback-status { order:5; }
@media(max-width:900px){
  main[data-beginner-build="true"] { grid-template-columns:repeat(3,minmax(0,1fr)); column-gap:10px; }
  main[data-beginner-build="true"] .tempo { grid-column:1 / -1; }
}
@media(max-width:600px){
  main[data-beginner-build="true"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
  main[data-beginner-build="true"] #build-options .option:has(#metronome) { grid-column:1 / -1; }
  main[data-beginner-build="true"] .transport { gap:8px; }
  main[data-beginner-build="true"] .transport button { padding:8px 10px; font-size:.875rem; min-height:44px; }
  main[data-beginner-build="true"] .measure-heading { flex-wrap:wrap; gap:8px; }
  main[data-beginner-build="true"] #save-controls { gap:8px; }
  main[data-beginner-build="true"] #save-controls button { font-size:.8125rem; }
}
main[data-beginner-build="true"] .sound-choice { order:1; }
main[data-beginner-build="true"] #build-options .option:has(#loop) { order:2; }
main[data-beginner-build="true"] #animation-control { order:3; }
main[data-beginner-build="true"] #build-options .option:has(#metronome) { order:4; }
main[data-beginner-build="true"] .tempo { order:5; justify-content:start; }
main[data-beginner-build="true"] #options-hint { order:6; }
main[data-beginner-build="true"] > .workspace { order:7; }
main[data-beginner-build="true"] .playback-controls > .transport { order:8; }
main[data-beginner-build="true"] > #save-controls { order:9; }
main[data-beginner-build="true"] > #playback-status { order:10; }
/* Visible beginner Build sound/length choices; continuous wrapped rhythm data. */
main[data-beginner-build="true"] .sound-choice { display:none; }
main[data-beginner-build="true"] #build-sound,
main[data-beginner-build="true"] #build-length { order:1; grid-column:1 / -1; display:flex; align-items:center; gap:8px; margin:0 0 12px; font-size:.875rem; }
.timeline[data-build-rows="true"][data-stacked="true"] { grid-template-columns:repeat(16,minmax(0,1fr)) !important; }
@media(max-width:899px){.timeline[data-build-rows="true"][data-stacked="true"] { grid-template-columns:repeat(8,minmax(0,1fr)) !important; }}
@media(max-width:600px){
 main[data-beginner-build="true"] #build-sound button,main[data-beginner-build="true"] #build-length button { padding:8px 12px; min-height:44px; }
}
/* Standalone beginner Play Along: settings → rhythm → transport → performance. */
main[data-beginner-along="true"] { display:grid; grid-template-columns:max-content max-content minmax(0,1fr); column-gap:24px; }
main[data-beginner-along="true"] > * { grid-column:1 / -1; min-width:0; }
main[data-beginner-along="true"] > .playback-controls { display:contents; }
main[data-beginner-along="true"] .playback-controls > * { order:1; grid-column:1 / -1; min-width:0; margin:0 0 16px; }
main[data-beginner-along="true"] #along-sound { align-items:center; gap:8px; font-size:.875rem; }
main[data-beginner-along="true"][data-along-simple-sound="true"] .sound-choice { display:none; }
main[data-beginner-along="true"] #target-loop-control { order:2; grid-column:1; }
main[data-beginner-along="true"] #animation-control { order:3; grid-column:2; }
main[data-beginner-along="true"] .tempo { order:4; grid-column:3; justify-content:start; }
main[data-beginner-along="true"] > .workspace { order:5; }
main[data-beginner-along="true"] .playback-controls > .transport { order:6; margin:12px 0; }
main[data-beginner-along="true"] > #pad-area { order:7; margin-top:0; }
main[data-beginner-along="true"] > #playback-status { order:8; }
.transport #next-rhythm { background:var(--blue); border-color:var(--blue); color:white; }
@media(max-width:900px){
 main[data-beginner-along="true"] { grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:12px; }
 main[data-beginner-along="true"] .tempo { grid-column:1 / -1; }
}
@media(max-width:600px){
 main[data-beginner-along="true"] .transport { gap:8px; }
 main[data-beginner-along="true"] .transport button,main[data-beginner-along="true"] #along-sound button { min-height:44px; padding:8px 12px; font-size:.875rem; }
 main[data-beginner-along="true"] .measure-heading { flex-wrap:wrap; gap:8px; }
}

/* Keep each Build switch atomic while the outer group wraps naturally. */
main[data-beginner-along="true"] #along-switches,
main[data-beginner-build="true"] #build-options {
  display:flex; flex-wrap:wrap; align-items:center; gap:8px 20px;
  grid-column:1 / -1; order:2; min-width:0; margin:0 0 12px;
}
main[data-beginner-along="true"] #along-switches .option,
main[data-beginner-build="true"] #build-options .option {
  display:inline-flex; flex:0 0 auto; align-items:center; justify-content:flex-start;
  gap:8px; width:auto; min-width:0; margin:0; white-space:nowrap;
}
main[data-beginner-along="true"] #along-switches .option input,
main[data-beginner-build="true"] #build-options .option input { flex-shrink:0; }
main[data-beginner-along="true"] #along-switches .option input + span,
main[data-beginner-build="true"] #build-options .option input + span { margin-left:-4px; }
main[data-beginner-build="true"] #build-options #options-hint { flex-basis:100%; margin:0; }
main[data-beginner-build="true"] .tempo { grid-column:1 / -1; }

main[data-beginner-along="true"] #along-switches { grid-column:1 / 3; }

/* Keep visible-rhythm playback paint inside each event, including wrapped parts. */
main[data-beginner-build="true"] .duration-event,
main[data-beginner-along="true"] .duration-event { overflow:hidden; }

/* Brand-specific subtle grid separators; structural beat/bar lines stay dark. */
.timeline, .original-grid { --line:var(--rhythm-border, #d5d2c9); }
