/* Charcoal, ivory and brass. Original geometry inspired by darbuka inlay. */
.analytics-disclosure { margin: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: .75rem; line-height: 1.5; }
:root {
  color-scheme: dark;
  --bg: #111315;
  --paper: #1a1d20;
  --white: #f0ebe2;
  --ink: #f0ebe2;
  --muted: #a0a6a8;
  --line: #34383a;
  --green: #cbb27e;
  --green-light: #302d26;
  --copper: #cbb27e;
  --sand: #302b24;
  --danger: #eda092;
  --shadow: 0 8px 28px #00000016;
  --accent: #cbb27e;
  --accent-hover: #dfc99b;
  --teal: #91b9b7;
  --surface: #202427;
  --field: #171a1c;
  --subtle: #c0c4c2;
  --serif: 'Iowan Old Style', 'Baskerville', 'Palatino Linotype', Georgia, serif;
  font-family: 'Avenir Next', Avenir, Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
}
html, body { min-width: 0; background: var(--bg); color: var(--ink); }
body { background-image: radial-gradient(ellipse at 85% 0%, #51412b20, transparent 700px); }
::selection { background: #cbb27e40; color: var(--ink); }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button, .button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; font-weight: 500; min-height: 44px; padding: 10px 16px; transition: border-color .18s, background .18s, color .18s; }
button:hover:not(:disabled), .button:hover { background: #2a2e30; border-color: #575a57; }
button.primary { background: var(--accent); border-color: var(--accent); color: #181a19; font-weight: 650; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.selected, button[aria-pressed=true]:not(.favourite) { background: var(--green-light); color: var(--accent-hover); border-color: #6a5f46; }
button.ghost { background: transparent; border-color: transparent; color: var(--subtle); }
button.ghost:hover:not(:disabled) { background: #ffffff08; border-color: #ffffff08; color: var(--ink); }
button.small { font-size: 12px; }
button.danger { color: var(--danger); }
button:disabled { opacity: .4; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: var(--accent-hover); text-underline-offset: 4px; }
input, select, textarea { color: var(--ink); background: var(--field); border: 1px solid #3b4143; border-radius: 9px; min-height: 44px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: #90999b; }
input[type=range], input[type=checkbox] { accent-color: var(--accent); }

/* Native inputs keep label clicks and Space; the switch makes both states explicit. */
.check { min-height: 44px; min-width: 0; gap: 12px; font-size: 14px; line-height: 1.4; color: var(--ink); }
.check-label { min-width: 0; }
.switch-control { position: relative; display: inline-grid; grid-template-columns: 3ch 44px; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; min-height: 44px; font-size: 12px; }
.switch-control input[type=checkbox] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 44px; margin: 0; padding: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { grid-column: 2; grid-row: 1; width: 44px; height: 26px; border: 1px solid #737c80; border-radius: 999px; background: #343b3e; transition: background .18s ease, border-color .18s ease; }
.switch-track::after { content: ''; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: var(--ink); box-shadow: 0 1px 3px #00000030; transition: transform .18s ease, background .18s ease; }
.switch-state { grid-column: 1; grid-row: 1; text-align: right; color: var(--muted); }
.switch-on { display: none; }
.switch-control input:checked ~ .switch-track { background: var(--accent); border-color: var(--accent); }
.switch-control input:checked ~ .switch-track::after { transform: translateX(18px); background: var(--bg); }
.switch-control input:checked ~ .switch-state { color: var(--accent-hover); }
.switch-control input:checked ~ .switch-state .switch-on { display: inline; }
.switch-control input:checked ~ .switch-state .switch-off { display: none; }
.check:hover .switch-control input:not(:disabled) ~ .switch-track { border-color: var(--accent-hover); }
.switch-control input:focus-visible ~ .switch-track { outline: 2px solid var(--accent); outline-offset: 4px; }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.switch-control input:disabled { cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after { transition: none; } }
@media (forced-colors: active) {
  .switch-track { forced-color-adjust: none; background: Canvas; border-color: ButtonText; }
  .switch-track::after { background: ButtonText; }
  .switch-control input:checked ~ .switch-track { background: Highlight; border-color: Highlight; }
  .switch-control input:checked ~ .switch-track::after { background: HighlightText; }
  .switch-control input:focus-visible ~ .switch-track { outline-color: Highlight; }
}

h1 { font-family: var(--serif); font-size: clamp(38px, 4.3vw, 60px); font-weight: 400; letter-spacing: -1.8px; line-height: 1.13; margin: 14px 0; }
h2 { font-size: 19px; font-weight: 550; letter-spacing: -.4px; }
h3 { font-weight: 500; }
p { line-height: 1.65; }
.ui-icon { width: 20px; height: 20px; flex-shrink: 0; }
.subtitle { font-size: 15px; line-height: 1.65; color: var(--muted); max-width: 610px; }
.hint, small, .fine-print { color: var(--muted); }
.fine-print { font-size: 12px; text-align: center; margin-top: 30px; }
.field-label { color: var(--subtle); font-size: 12px; font-weight: 500; }
.badge, .badge.green, .badge.sand { color: #c6ba9e; background: #cbb27e0c; border: 1px solid #cbb27e26; border-radius: 5px; font-size: 9px; font-weight: 500; letter-spacing: .08em; padding: 4px 7px; }
.badge.sand { color: #b7cecd; background: #91b9b70c; border-color: #91b9b726; }
.skip-link { color: var(--bg); background: var(--accent); }

/* Main destinations, tucked into a disclosure menu on small screens. */
.site-header { position: sticky; top: 0; z-index: 50; background: #111315ed; border-top: 2px solid #b89e673b; border-bottom: 1px solid #ffffff0d; backdrop-filter: blur(18px); }
.header-inner { max-width: 1280px; margin: auto; min-height: 88px; padding: 0 40px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
.site-brand { display: inline-flex; align-items: center; justify-self: start; gap: 12px; padding: 0; border: 0; background: none; color: inherit; text-decoration: none; text-align: left; min-height: 54px; }
.site-brand:hover:not(:disabled) { border: 0; background: none; }
.brand-mark { width: 44px; height: 44px; }
.brand-name strong { font-family: var(--serif); display: block; font-size: 26px; font-weight: 500; letter-spacing: -.6px; line-height: 1.1; }
.brand-name small { display: block; margin-top: 5px; font-size: 8px; letter-spacing: .24em; color: var(--muted); }
.top-tabs { display: flex; justify-content: center; align-self: stretch; align-items: stretch; gap: 19px; }
.top-tabs :is(button, a) { position: relative; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 0 3px; gap: 9px; font-size: 13px; white-space: nowrap; }
.top-tabs :is(button, a):hover:not(:disabled) { color: var(--ink); background: none; }
.top-tabs :is(button, a).active { color: var(--accent-hover); background: none; }
.top-tabs :is(button, a).active::after { content: ''; position: absolute; bottom: -1px; height: 2px; left: 0; right: 0; background: var(--accent); }
.top-tabs .ui-icon { width: 17px; height: 17px; opacity: .8; }
.navigation-toggle { display: none; }
.header-status { justify-self: end; }
.save-state { color: var(--teal); font-size: 12px; }
.save-state.state-saving, .save-state.state-dirty { color: var(--accent); }
.save-state.state-conflict, .save-state.state-error { color: var(--danger); }
.app-content { margin-left: 0; padding-bottom: 160px; }
#main-content { scroll-margin-top: 110px; }
#main-content:focus-visible { outline: none; }
.page { max-width: 1280px; padding: 42px 40px 45px; }
.page-heading { align-items: center; margin-bottom: 35px; gap: 28px; }
.page-heading h1 { margin-top: 0; }
.heading-actions { max-width: none; }
.heading-actions:empty { display: none; }
.notice { max-width: 1200px; margin: 20px auto 0; background: #1c2b27; border-color: #3b5d50; color: #c5dfd1; font-size: 13px; }
.notice.error-notice { background: #322320; border-color: #6d443b; color: #edbeb3; }

/* Let the rhythms lead; reserve the inlay for the masthead. */
.library-intro { display: flex; justify-content: space-between; align-items: center; gap: 32px; margin: -5px 0 30px; position: relative; }
.library-intro .page-heading { margin: 0; position: relative; z-index: 1; }
.library-intro h1 { font-size: clamp(44px, 5vw, 68px); letter-spacing: -2.5px; }
.intro-inlay { width: 225px; height: 185px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.intro-inlay::before { content: ''; position: absolute; inset: -30px -50px; background: url('./assets/inlay-pattern.svg') center / 110px; opacity: .1; mask-image: radial-gradient(ellipse, #000, transparent 72%); }
.intro-inlay img { width: 178px; height: 178px; }
.library-toolbar { display: flex; flex-direction: row; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: nowrap; }
.search-field { position: relative; flex: 1; min-width: 0; }
.search-field>.ui-icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.library-toolbar .search-field input { width: 100%; min-width: 0; padding-left: 47px; height: 48px; font-size: 14px; background: var(--field); }
.library-toolbar select[aria-label='Filter by meter'] { flex: none; width: 192px; min-width: 0; min-height: 48px; font-size: 13px; background: var(--field); }
.collection-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; margin: 0 0 22px; }
.collection-options { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.library-details-toggle { font-size: 12px; padding: 7px 12px; min-height: 38px; background: transparent; white-space: nowrap; }
.library-details-toggle[aria-expanded=true] { color: var(--accent-hover); border-color: #6a5f46; background: var(--green-light); }
.filter-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.filter-tabs button { color: var(--muted); background: transparent; border-color: transparent; font-size: 12px; padding: 7px 13px; border-radius: 7px; min-height: 38px; }
.filter-tabs button[aria-pressed=true] { color: var(--accent-hover); border-color: #cbb27e30; background: #cbb27e0e; }
.filter-tabs button:hover:not(:disabled) { color: var(--ink); border-color: var(--line); background: #ffffff04; }
.collection-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rhythm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.rhythm-card { position: relative; isolation: isolate; background: linear-gradient(145deg, #1d2023, #191c1e); border-color: #34383a; border-radius: 14px; padding: 18px 22px 0; box-shadow: 0 4px 20px #00000012; overflow: hidden; transition: border-color .18s, box-shadow .18s; }
.rhythm-card:hover { transform: none; border-color: #796c50; box-shadow: 0 9px 35px #00000030; }
.card-top { margin-bottom: 12px; }
.card-top .badge { font-size: 9px; }
.favourite { border: 0; color: #8e9698; width: 34px; min-width: 34px; height: 34px; min-height: 34px; border-radius: 50%; background: transparent; padding: 7px; }
.favourite:hover:not(:disabled) { background: #cbb27e12; color: var(--accent); border: 0; }
.favourite[aria-pressed=true] { color: var(--accent); }
.favourite[aria-pressed=true] svg { fill: var(--accent); }
.favourite .ui-icon { width: 18px; height: 18px; }
.card-title { margin: 0 0 20px; gap: 12px; align-items: center; }
.card-title h3 { font-family: var(--serif); font-size: 27px; font-weight: 400; letter-spacing: -.6px; margin: 0; min-height: 0; line-height: 1.1; }
.card-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-name h3 { min-width: 0; overflow-wrap: anywhere; }
/* Stretch the native practice button over the card; keep its other controls above it. */
.card-practice { display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-align: inherit; }
.card-practice:hover:not(:disabled) { background: transparent; color: inherit; border: 0; }
.card-practice::after { content: ''; position: absolute; inset: 0; z-index: 1; cursor: pointer; border-radius: 14px; }
.card-practice:focus-visible { outline: none; }
.card-practice:focus-visible::after { outline: 2px solid var(--accent); outline-offset: -3px; }
.card-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.rhythm-card .card-play, .rhythm-card .favourite { position: relative; z-index: 2; }
.card-play { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 40px; width: 40px; height: 40px; min-height: 40px; padding: 9px; border-radius: 50%; color: var(--accent-hover); background: #cbb27e0b; border-color: #cbb27e40; }
.card-play:hover:not(:disabled), .card-play.is-playing { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.card-play .ui-icon { width: 19px; height: 19px; }
.card-play[data-icon=play] .ui-icon { fill: currentColor; stroke: none; }
.card-title .meter-pill { flex-shrink: 0; }
.rhythm-card:not(:has(.card-meta)) .pulse-rail { margin-bottom: 18px; }
.rhythm-card:has(.rhythm-card-copy) .card-title { margin-bottom: 8px; }
.rhythm-card-copy { flex: 1; margin-bottom: 20px; }
.rhythm-arabic { display: inline-block; font-family: Tahoma, 'Geeza Pro', Arial, sans-serif; font-size: 21px; font-weight: 400; letter-spacing: normal; line-height: 1.7; color: var(--accent-hover); }
.rhythm-region { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 5px 0 9px; }
.rhythm-summary { color: var(--subtle); font-size: 13px; line-height: 1.7; margin: 0; }
.rhythm-heading { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: .05em .3em; max-width: 100%; }
.rhythm-heading-english { white-space: nowrap; }
.rhythm-heading-translation { display: inline-flex; align-items: baseline; gap: .35em; letter-spacing: normal; }
.rhythm-heading-separator { color: var(--muted); font-size: .55em; }
.rhythm-heading-arabic { max-width: 100%; font-size: clamp(23px, 3vw, 30px); }
.rhythm-names { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr); gap: 8px 16px; margin: 0 0 20px; }
.rhythm-names dt { color: var(--muted); font-size: 12px; }
.rhythm-names dd { margin: 0; overflow-wrap: anywhere; }
.rhythm-names bdi[lang=ar] { font-family: Tahoma, 'Geeza Pro', Arial, sans-serif; font-size: 18px; line-height: 1.7; }
.rhythm-sources { padding-inline-start: 20px; margin-bottom: 0; }
.rhythm-sources li { margin-block: 8px; overflow-wrap: anywhere; }
.rhythm-practice-tip { margin: 16px 0 8px; max-width: 80ch; }
.practice-backing-track { max-width: 880px; margin: 24px auto 0; }
.practice-backing-track .panel-heading { margin-bottom: 10px; }
.backing-track-intro { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.backing-track-screen { display: block; position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #171b1c; border-radius: 8px; }
.backing-track-screen.skills-video-cover { border: 1px solid var(--line); }
.backing-track-caption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin: 18px 0 10px; }
.backing-track-caption h3 { font-size: 16px; margin: 0; }
.backing-track-credit { font-size: 12px; }
.backing-track-actions { margin-top: 16px; font-size: 13px; }
@media (max-width: 540px) {
  .rhythm-heading { font-size: clamp(26px, 7.5vw, 36px); letter-spacing: -.8px; }
  .rhythm-heading-arabic { font-size: clamp(20px, 5.5vw, 24px); }
  .rhythm-names { grid-template-columns: 1fr; gap: 4px; }
  .rhythm-names dd { margin-bottom: 10px; }
}
.meter-pill { font-size: 15px; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--subtle); }
.compact .pulse-lane { gap: 5px; }
.compact .pulse-cell { min-height: 37px; border-radius: 5px; }
.compact .pulse-cell strong { font-family: inherit; font-size: 12px; font-weight: 500; }
.card-meta { color: var(--muted); font-size: 11px; margin: 13px 0 0; padding: 10px 0 17px; gap: 6px; }
.card-meta>span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Practice, readable notation, and live ensemble controls. */
.panel, .disclosure, .composition-block { background: var(--paper); border-color: var(--line); box-shadow: var(--shadow); border-radius: 13px; }
.panel p, .disclosure-body p { color: var(--subtle); }
.practice-breadcrumb { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: 11px; letter-spacing: .08em; margin-top: 0; }
.practice-breadcrumb button { font-size: 12px; letter-spacing: 0; }
.practice-breadcrumb a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 12px; letter-spacing: 0; text-decoration: none; }
.practice-breadcrumb a .ui-icon { width: 16px; }
.practice-page .page-heading { margin-bottom: 22px; }
.practice-page .page-heading>div { min-width: 0; max-width: 100%; }
.practice-page .tempo-panel { padding: 20px 28px; background: linear-gradient(105deg, #25251f, #1b1f21); border-color: #45443a; }
.tempo-number strong { font-family: var(--serif); color: var(--accent-hover); }
.tempo-number>span, .tempo-ticks { color: var(--muted); }
.tempo-controls { display: flex; align-items: center; gap: 12px; }
.tempo-controls>.field { flex: 1; min-width: 0; }
.tempo-step { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 23px; line-height: 1; color: var(--accent-hover); }
.tempo-slider .tempo-ticks { margin-inline: 56px; }
.variation-bar select { background: var(--field); }
.variation-bar { flex-wrap: wrap; row-gap: 14px; }
.rhythm-neighbours { gap: 12px; margin-left: auto; }
.rhythm-neighbours button { min-height: 48px; min-width: 132px; gap: 10px; padding: 12px 18px; border-color: #596062; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; line-height: 1.4; }
.rhythm-neighbours button:hover:not(:disabled) { border-color: var(--accent); background: var(--green-light); color: var(--accent-hover); }
.rhythm-neighbours button:active:not(:disabled) { background: #3b3529; }
.rhythm-neighbours .ui-icon { width: 20px; height: 20px; color: var(--accent-hover); }
.rhythm-neighbours button:first-child .ui-icon { transform: rotate(180deg); }
.segmented { background: var(--bg); border-color: var(--line); border-radius: 9px; }
.segmented button { color: var(--muted); background: transparent; }
.segmented button[aria-pressed=true] { background: #32322b; color: var(--accent-hover); box-shadow: 0 1px 6px #00000033; }
.practice-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 20px; }
.practice-controls .segmented button { white-space: nowrap; }
.practice-controls>.field { flex-direction: row; align-items: center; gap: 10px; }
.practice-controls select { min-width: 115px; }
.instrument-row { border-color: #ffffff0b; }
.instrument-toggle, .instrument-toggle[aria-pressed=true] { background: none; color: var(--ink); border-color: transparent; }
.instrument-toggle:hover:not(:disabled) { background: #ffffff05; }
.instrument-icon { background: #263330; border-color: #3e5650; color: #a8c4b7; }
.instrument-icon.dahola { background: #342e26; border-color: #594a36; color: #d7ba91; }
.instrument-icon.bendir { background: #302e29; border-color: #514b3f; color: #c1b59a; }
.instrument-icon.riq { background: #273234; border-color: #405456; color: var(--teal); }
.instrument-icon.sagats { background: #343023; border-color: #5b5134; color: #d6bf7b; }
.instrument-switch { background: #454b4d; }
.instrument-switch::after { background: #ece9df; }
.instrument-toggle[aria-pressed=true] .instrument-switch { background: #788e80; }
.instrument-solo[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.instrument-mix input::-webkit-slider-runnable-track { background: #42494b; }
.instrument-mix input::-webkit-slider-thumb { background: #a6b7ac; }
.instrument-mix input[type=range] { accent-color: #a6b7ac; }
.instrument-part, .instrument-part[aria-pressed=true], .instrument-part:hover:not(:disabled) { background: transparent; border-color: transparent; }
.ensemble-cell { background: #23282b; border-bottom-color: #394145; }
.ensemble-cell.beat-start { background: #2b3234; border-left-color: #4e5c60; }
.ensemble-hit { background: #7da9a6; color: #101d1d; }
.bass-hit .ensemble-hit { background: #c0a775; color: #221e15; }
.ghost-hit .ensemble-hit { background: #4d6564; color: #d2e0da; }
.metal-hit .ensemble-hit { background: #ac9d73; color: #201d14; }
.ensemble-rest { color: #8c989b; }
.ensemble-counts span { color: var(--muted); }
.ensemble-cell.playing { background: #535347; outline-color: var(--accent-hover); box-shadow: inset 0 3px 0 var(--accent-hover); }
.ensemble-cell.playing .ensemble-hit { filter: brightness(1.2); }
.ensemble-long .instrument-controls, .ensemble-long .ensemble-ruler>span { background: var(--paper); box-shadow: 10px 0 12px var(--paper); }
.long-cycle-scroll { scrollbar-color: #626665 #23282b; }
.ensemble-cell.group-start, .ensemble-counts .group-start { border-left-color: #9c8b65; }
.ensemble-counts .group-start, .cycle-count-guide strong { color: var(--accent-hover); }
.legend-dum { background: #c0a775; }
.legend-tek { background: #7da9a6; }
.compact .pulse-cell, .pulse-cell { background: #24292c; border-color: #353d40; color: #a0a9aa; }
.compact .pulse-cell.attack, .pulse-cell.attack { background: #273b3c; border-color: #435f5f; color: #bed6d2; }
.compact .pulse-cell.bass, .pulse-cell.bass { background: #3c3527; border-color: #66583b; color: #dfc796; }
.pulse-cell.playing { background: var(--accent); border-color: var(--accent-hover); outline-color: var(--accent-hover); color: var(--bg); }
.pulse-cell.playing small { color: #403b2d; }
.notation-bar { border-color: var(--line); background: var(--field); }
.notation-bar.current-measure { border-color: #9c8b65; box-shadow: none; }
.bar-caption { background: var(--surface); color: var(--subtle); border-color: var(--line); }
.staff-svg { color: var(--ink); }
.staff-label, .hand-label { fill: var(--subtle); }
.staff-playhead { stroke: var(--accent); }
.disclosure>summary { color: var(--ink); }

/* Skills and linked lessons. */
.section-header { margin-bottom: 20px; }
.section-header h2 { font-size: 18px; font-weight: 500; }
.skill-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.skill-card { display: flex; flex-direction: column; padding: 24px 21px 0; background: linear-gradient(145deg, #202527, #1a1d20); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.skill-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 32px; }
.skill-number { color: #9f9378; font-family: var(--serif); font-size: 26px; }
.skill-rhythm { color: var(--teal); font-size: 12px; letter-spacing: .08em; }
.skill-card h3 { font-size: 17px; margin-bottom: 11px; }
.skill-card p { font-size: 12px; color: var(--muted); margin-bottom: 24px; flex: 1; }
.skill-open { margin: 0 -21px; border: 0; border-top: 1px solid #ffffff0b; border-radius: 0; background: #ffffff02; font-size: 12px; padding: 13px 21px; color: var(--accent); justify-content: space-between; }
.skill-open:hover:not(:disabled) { background: #cbb27e0b; border-color: #cbb27e28; }
.skill-open .ui-icon { width: 16px; }
.lessons-heading { margin-top: 48px; }
.library-tools { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 24px; }
.library-tools>.field:first-child { flex: 1; }
.library-tools>.field:last-child { min-width: 190px; }
.lesson-grid { gap: 20px; }
.lesson-card { padding: 24px; grid-template-columns: 44px 1fr; }
.lesson-monogram { width: 42px; height: 48px; background: #303329; color: var(--accent-hover); border: 1px solid #4b4b3c; border-radius: 9px; font-family: var(--serif); }
.lesson-card h2 { color: var(--ink); font-size: 21px; font-family: var(--serif); font-weight: 400; }
.lesson-card .button-row button, .lesson-card .button-row .button { font-size: 12px; }
.lesson-card .button-row .button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.credit-details summary { color: var(--muted); font-size: 11px; }
.video-player iframe { border-radius: 8px; }

/* Skills: curated playlists and videos with players that load on demand. */
.skills-page .page-heading { margin-bottom: 28px; }
.skills-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.skills-tabs a { display: flex; align-items: center; gap: 9px; padding: 13px 0; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.skills-tabs a[aria-current="page"] { color: var(--accent-hover); border-bottom-color: var(--accent); }
.skills-tabs a>span { font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--surface); }
.skills-playlist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.skills-playlist-card { min-width: 0; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--paper); display: flex; flex-direction: column; }
.skills-playlist-cover-link { display: block; }
.skills-playlist-cover { position: relative; aspect-ratio: 16 / 7; background: #232829; overflow: hidden; border-bottom: 1px solid var(--line); }
.skills-playlist-cover img { width: 100%; height: 100%; object-fit: cover; }
.skills-playlist-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, #0009); pointer-events: none; }
.skills-playlist-count { position: absolute; bottom: 14px; right: 16px; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #ffffff30; border-radius: 6px; background: #171b1cdd; color: #fff; font-size: 11px; z-index: 1; }
.skills-playlist-count .ui-icon { width: 13px; height: 13px; }
.skills-playlist-body { padding: 24px; display: flex; flex: 1; flex-direction: column; align-items: flex-start; }
.skills-playlist-body h3 { margin: 13px 0 10px; font: 400 27px/1.25 var(--serif); overflow-wrap: anywhere; }
.skills-playlist-body h3 a { color: var(--ink); text-decoration: none; }
.skills-playlist-body>p { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.skills-playlist-link { display: flex; justify-content: space-between; align-items: center; gap: 16px; width: 100%; padding-top: 24px; margin-top: auto; font-size: 12px; text-decoration: none; }
.skills-back { display: inline-block; margin-bottom: 24px; font-size: 12px; text-decoration: none; }
.skills-playlist-heading { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.skills-playlist-heading h2 { font: 400 34px/1.2 var(--serif); margin: 12px 0; }
.skills-playlist-heading p { color: var(--muted); font-size: 14px; margin: 0; }
.skills-playlist-heading>button { flex-shrink: 0; }
.skills-playlist-videos { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 22px; }
.skills-playlist-videos>li { min-width: 0; }
.skills-video-card.skills-series-video { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.skills-sequence { color: var(--accent-hover); }
.skills-next-video { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; text-align: left; width: 100%; margin-top: 18px; padding: 12px; }
.skills-next-video>span { font-size: 10px; color: var(--muted); }
.skills-next-video>strong { grid-column: 1; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.skills-next-video>.ui-icon { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.skills-filter-panel { margin-bottom: 32px; }
.skills-filter-fields { display: grid; grid-template-columns: minmax(210px, 2fr) repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.skills-filter-fields.has-source-filter, .skills-filter-fields.has-language-filter { grid-template-columns: minmax(210px, 2fr) repeat(4, minmax(0, 1fr)); }
.skills-filter-fields.has-source-filter.has-language-filter { grid-template-columns: minmax(210px, 2fr) repeat(5, minmax(0, 1fr)); }
.skills-filter-fields .field { margin: 0; min-width: 0; }
.skills-filter-fields input, .skills-filter-fields select { width: 100%; min-width: 0; }
.skills-filter-fields .field-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.skills-active-filters { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.skills-page .section-header { gap: 16px; flex-wrap: wrap; }
.skills-page .section-header .muted { font-size: 12px; }
.skills-video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; }
.skills-video-card { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.skills-video-card.is-watching { border-color: var(--accent); }
.skills-video-screen { display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; position: relative; background: #171b1c; overflow: hidden; flex-shrink: 0; }
.skills-video-cover { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0; color: #fff; }
.skills-video-cover:hover { background: #232829; }
.skills-video-cover:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; }
.skills-video-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.skills-video-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 45%, #000a); pointer-events: none; }
.skills-play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: #171b1cd9; border: 1px solid #ffffff60; z-index: 1; }
.skills-play-icon .ui-icon { width: 24px; height: 24px; margin-left: 3px; }
.skills-video-cover:hover .skills-play-icon { background: var(--accent); color: #171b1c; border-color: var(--accent); }
.skills-watch-label { position: absolute; bottom: 15px; left: 18px; font-size: 12px; font-weight: 500; z-index: 1; }
.skills-player { scroll-margin-top: 90px; }
.skills-player iframe { display: block; position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.skills-player.source-instagram { aspect-ratio: 9 / 14; max-height: 640px; }
.skills-video-body { padding: 22px; flex: 1; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.skills-video-body .badge { font-size: 9px; }
.skills-video-body h3 { font-size: 18px; line-height: 1.45; margin: 12px 0 6px; overflow-wrap: anywhere; }
.skills-creator { color: var(--muted); font-size: 12px; margin: 0 0 16px; overflow-wrap: anywhere; }
.skills-publisher { color: var(--muted); font-size: 11px; margin: -8px 0 16px; overflow-wrap: anywhere; }
.skills-notes { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--subtle); margin: 0 0 15px; }
.skills-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.skills-tag { border: 1px solid #ffffff12; border-radius: 6px; min-height: 30px; padding: 4px 8px; color: var(--subtle); font-size: 11px; background: #ffffff04; overflow-wrap: anywhere; max-width: 100%; }
.skills-video-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; margin-top: 18px; min-height: 30px; }
.skills-video-actions a { color: var(--muted); font-size: 11px; text-decoration: none; }
.skills-video-actions a:hover { color: var(--accent-hover); text-decoration: underline; }
.skills-player-hint { font-size: 11px; color: var(--muted); margin: 12px 0 0; }
.skills-empty { text-align: center; }
@media (max-width: 800px) {
  .skills-filter-fields, .skills-filter-fields.has-source-filter, .skills-filter-fields.has-language-filter, .skills-filter-fields.has-source-filter.has-language-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .skills-filter-fields>.field:first-child { grid-column: 1/-1; }
  .skills-video-card.skills-series-video { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .skills-filter-fields, .skills-filter-fields.has-source-filter, .skills-filter-fields.has-language-filter, .skills-filter-fields.has-source-filter.has-language-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .skills-filter-fields select, .skills-filter-fields input { font-size: 13px; }
  .skills-video-grid, .skills-playlist-grid { grid-template-columns: minmax(0, 1fr); }
  .skills-playlist-body { padding: 20px; }
  .skills-playlist-heading { flex-direction: column; align-items: flex-start; gap: 18px; }
  .skills-playlist-heading h2 { font-size: 28px; }
  .skills-video-body { padding: 18px; }
  .skills-page .section-header h2 { font-size: 17px; }
}

/* Arrangements and the saved document tools. */
.empty-state { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 58px 28px; }
.empty-state>.ui-icon { width: 32px; height: 32px; color: var(--accent); margin-bottom: 22px; }
.empty-state h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; }
.empty-state p { font-size: 14px; }
.arrangement-inlay { width: 88px; height: 88px; opacity: .65; margin: 0 auto 23px; }
.arrangement-steps { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; color: var(--subtle); margin: 26px 0; font-size: 12px; }
.arrangement-steps span { display: flex; align-items: center; gap: 8px; }
.arrangement-steps b { color: var(--accent); font-size: 10px; font-weight: 500; border: 1px solid #60563f; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; }
.arrangement-list { display: flex; flex-direction: column; gap: 18px; }
.arrangement-row { display: flex; align-items: center; gap: 28px; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.arrangement-row-content { flex: 1; min-width: 0; }
.arrangement-row h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; margin: 0 0 12px; overflow-wrap: anywhere; }
.arrangement-row h2 a { color: var(--ink); text-decoration: none; }
.arrangement-row h2 a:hover { color: var(--accent-hover); }
.arrangement-row-meta { color: var(--subtle); font-size: 13px; margin-bottom: 8px; }
.arrangement-sequence { color: var(--muted); font-size: 12px; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.arrangement-row-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.arrangement-row-actions .primary { min-width: 110px; }
.arrangement-back { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0 20px; font-size: 13px; text-decoration: none; }
.composition-detail .page-heading h1 { overflow-wrap: anywhere; }
.arrangement-editor { border-top: 1px solid var(--line); padding-top: 28px; }
.arrangement-editor-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 22px; }
.arrangement-editor-heading h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; margin: 0; }
.arrangement-editor-heading p { margin: 0; font-size: 12px; }
.arrangement-editor>.field { max-width: 550px; }
.arrangement-editor .empty-state h3 { font-family: var(--serif); font-size: 27px; font-weight: 400; }
.add-block-bar { display: block; background: #212626; border: 1px solid #3b4543; padding: 23px; }
.add-block-bar>h3 { margin: 0 0 18px; font-size: 16px; font-weight: 500; }
.add-rhythm-fields { display: flex; align-items: end; gap: 18px; }
.add-rhythm-fields>.field:first-child { flex: 1; }
.add-rhythm-fields input { width: 120px; }
.add-rhythm-advanced { margin-top: 16px; border-top: 1px solid var(--line); }
.add-rhythm-advanced>summary { min-height: 48px; padding: 14px 0; cursor: pointer; font-size: 12px; color: var(--ink); }
.add-rhythm-advanced>summary::marker { color: var(--accent); }
.add-rhythm-advanced>summary span { margin-left: 12px; color: var(--muted); font-size: 11px; }
.add-rhythm-advanced>summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.add-rhythm-options { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 3fr); align-items: start; gap: 24px; padding: 6px 0 20px; }
.add-rhythm-instruments { border: 0; padding: 0; margin: 0; min-width: 0; }
.add-rhythm-instruments legend { padding: 0; margin-bottom: 5px; font-size: 11px; color: var(--muted); font-weight: 650; letter-spacing: .03em; }
.instrument-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.instrument-choices .check { min-height: 44px; gap: 9px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--field); }
.instrument-choices .check:has(input:checked) { background: #333027; border-color: #655a42; color: var(--accent-hover); }
.add-rhythm-instruments .hint { margin: 8px 0 0; font-size: 11px; }
.add-rhythm-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.add-rhythm-summary { margin: 0; }
.add-rhythm-summary.warning-text { color: var(--danger); }
.composition-summary { background: #2c2c25; color: var(--accent-hover); border: 1px solid #4c4a3c; }
.composition-summary span { color: var(--subtle); }
.composition-summary strong { font-family: var(--serif); }
.composition-block { padding: 25px; }
.block-number { background: #302d26; color: var(--accent); border: 1px solid #514936; }
.block-heading h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; margin: 0; }
.block-heading .badge { font-size: 9px; }
.block-fields .field-label, .block-duration small { color: var(--muted); }
.document-row { border-color: var(--line); }
.readonly-banner { background: #302c22; border-color: #615337; color: #dfcea8; }
@media (max-width: 760px) {
  .arrangement-row { flex-direction: column; align-items: stretch; padding: 22px; gap: 20px; }
  .arrangement-row h2 { font-size: 27px; }
  .arrangement-row-actions { flex-wrap: wrap; }
  .arrangement-row-actions button { flex: 1; }
  .arrangement-sequence { white-space: normal; overflow-wrap: anywhere; }
  .arrangement-editor { padding-top: 24px; }
  .add-rhythm-options { grid-template-columns: 1fr; gap: 18px; }
  .add-rhythm-options>.field { max-width: 300px; }
  .composition-block { display: block; }
  .block-number { display: none; }
  .block-actions { width: 100%; min-width: 0; margin-top: 18px; display: flex; flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .block-actions button { flex: 1 0 auto; min-width: 44px; min-height: 44px; }
}
@media (max-width: 420px) {
  .arrangement-row-actions button { flex-basis: 100%; }
  .block-heading h3 { font-size: 23px; }
  .add-rhythm-fields { flex-direction: column; align-items: stretch; gap: 14px; }
  .add-rhythm-fields input { width: 100%; }
  .add-rhythm-advanced>summary span { display: block; margin: 6px 0 0 15px; }
  .add-rhythm-footer { flex-direction: column; align-items: stretch; }
  .instrument-choices .check { flex: 1 0 auto; }
}


/* Dialogs share the palette, including native form controls. */
.modal { color: var(--ink); background: var(--paper); border: 1px solid #505450; border-radius: 16px; box-shadow: 0 25px 100px #000000bb; }
.modal::backdrop { background: #080a0bb8; backdrop-filter: blur(8px); }
.modal-heading, .modal-actions { border-color: var(--line); background: var(--surface); }
.modal-heading h2 { color: var(--ink); font-family: var(--serif); font-size: 27px; font-weight: 400; }
.modal-body { color: var(--subtle); }
.modal-body .hint { color: var(--muted); }
.modal-body .panel { background: var(--field); }
.mixer-track { border-color: var(--line); }
.mixer-track-title { font-size: 13px; }
.mixer-controls { flex-wrap: wrap; }
.mixer-controls>.field { flex: 1 1 140px; }
.mixer-controls .check, .mixer-controls .field-label { font-size: 11px; }
@media (max-width: 540px) {
  .mixer-controls>.field { flex-basis: 100%; }
  .mixer-controls>.check { flex: 1 1 100px; }
  .modal .mixer-controls { column-gap: 12px; }
}

@media (min-width: 1500px) { .page { padding-top: 54px; } }
@media (max-width: 1050px) {
  .header-inner { grid-template-columns: 1fr auto; gap: 0 18px; padding: 13px 28px 0; }
  .site-brand { grid-column: 1; grid-row: 1; }
  .header-status { grid-column: 2; grid-row: 1; }
  .top-tabs { grid-column: 1 / -1; grid-row: 2; margin-top: 10px; min-height: 47px; }
  .top-tabs { gap: 20px; }
  .header-status { min-width: 30px; }
  .page { padding: 34px 28px 42px; }
  .rhythm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skill-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notice { margin-inline: 28px; }
}
@media (max-width: 760px) {
  .header-inner { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; padding: 12px 22px; min-height: 70px; }
  .site-brand { grid-column: 1; grid-row: 1; min-height: 45px; gap: 9px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name strong { font-size: 23px; }
  .brand-name small { font-size: 7px; margin-top: 3px; }
  .header-status { grid-column: 2; grid-row: 1; min-width: 0; }
  .navigation-toggle { grid-column: 3; grid-row: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; min-width: 44px; font-size: 12px; background: transparent; }
  .navigation-toggle[aria-expanded=true] { color: var(--accent-hover); border-color: #6a5f46; background: var(--green-light); }
  .top-tabs { display: none; position: absolute; top: calc(100% + 6px); left: 22px; right: 22px; margin: 0; min-height: 0; padding: 8px; gap: 4px; max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px #00000066; }
  .top-tabs.is-open { display: flex; flex-direction: column; }
  .top-tabs :is(button, a) { flex-shrink: 0; justify-content: flex-start; text-align: left; font-size: 14px; min-height: 48px; line-height: 1.3; gap: 12px; padding: 12px 14px; border-radius: 7px; white-space: normal; }
  .top-tabs :is(button, a):hover:not(:disabled) { background: #ffffff08; }
  .top-tabs :is(button, a).active { background: var(--green-light); }
  .top-tabs :is(button, a).active::after { top: 12px; bottom: 12px; left: 0; right: auto; width: 2px; height: auto; }
  .top-tabs .ui-icon { width: 18px; height: 18px; }
  .app-content { margin-left: 0; padding-bottom: 163px; }
  .page { padding: 30px 22px 36px; }
  #main-content { scroll-margin-top: 90px; }
  .library-intro { margin-bottom: 28px; gap: 0; }
  .intro-inlay { width: 110px; height: 140px; }
  .intro-inlay img { width: 106px; height: 106px; }
  .intro-inlay::before { inset: -10px -20px; background-size: 75px; }
  .library-intro h1 { font-size: 46px; }
  .library-intro .subtitle { font-size: 13px; max-width: 260px; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 18px; }
  .library-toolbar { gap: 10px; }
  .library-toolbar select[aria-label='Filter by meter'] { width: 165px; }
  .rhythm-card { padding-inline: 18px; }
  .card-title h3 { font-size: 25px; }
  .collection-toolbar { gap: 8px; align-items: flex-start; }
  .filter-tabs { gap: 4px; }
  .filter-tabs button { padding: 7px 10px; }
  .collection-count { padding-top: 0; }
  .notice { margin-inline: 22px; }
  .library-tools>.field:last-child { min-width: 140px; }
}
@media (max-width: 600px) {
  .rhythm-neighbours { width: 100%; margin-left: 0; }
  .rhythm-neighbours button { flex: 1; min-width: 0; padding-inline: 12px; }
  .rhythm-neighbours button>span { min-width: 0; overflow-wrap: anywhere; }
  .header-inner { padding-inline: 17px; }
  .top-tabs { left: 17px; right: 17px; }
  .page, .practice-page { padding: 25px 17px 35px; }
  h1 { font-size: 39px; letter-spacing: -1.5px; }
  .library-intro { margin-bottom: 19px; }
  .library-intro h1 { font-size: 43px; letter-spacing: -1.8px; }
  .intro-inlay { display: none; }
  .library-intro .subtitle { font-size: 13px; max-width: 100%; }
  .library-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 8px; margin-bottom: 14px; }
  .library-toolbar .search-field input { height: 45px; min-height: 45px; font-size: 13px; padding-left: 37px; }
  .search-field>.ui-icon { left: 12px; width: 16px; }
  .library-toolbar select[aria-label='Filter by meter'] { width: 100%; min-height: 45px; padding-inline: 8px; font-size: 11px; }
  .collection-toolbar { flex-direction: column; gap: 8px; margin-bottom: 17px; }
  .collection-options { width: 100%; justify-content: space-between; }
  .filter-tabs { gap: 4px; width: 100%; }
  .filter-tabs button { flex: 1; min-height: 36px; padding: 7px 9px; font-size: 11px; white-space: nowrap; }
  .collection-count { padding: 0; font-size: 10px; }
  .rhythm-grid { grid-template-columns: 1fr; gap: 15px; }
  .rhythm-card { padding: 16px 21px 0; }
  .card-title { margin: 0 0 18px; }
  .card-title h3 { font-size: 28px; }
  .card-top .badge { font-size: 9px; }
  .compact .pulse-cell { min-height: 37px; }
  .compact .pulse-cell strong { font-size: 12px; }
  .card-meta { font-size: 11px; margin-top: 10px; }
  .skill-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .skill-card { padding: 17px 15px 0; }
  .skill-top { flex-direction: column; align-items: flex-start; gap: 7px; margin-bottom: 23px; }
  .skill-rhythm { font-size: 10px; }
  .skill-card h3 { font-size: 15px; }
  .skill-card p { font-size: 11px; }
  .skill-open { padding: 10px 15px; margin-inline: -15px; font-size: 11px; }
  .skill-open .ui-icon { width: 14px; }
  .section-header { gap: 12px; }
  .section-header>span { font-size: 10px; }
  .section-header h2 { font-size: 17px; }
  .lessons-heading { margin-top: 36px; }
  .library-tools { gap: 12px; flex-direction: column; align-items: stretch; }
  .library-tools .field { min-width: 0; }
  .lesson-card { padding: 20px; grid-template-columns: 1fr; }
  .lesson-monogram { display: none; }
  .lesson-card h2 { font-size: 24px; }
  .practice-page .tempo-panel { padding: 18px; flex-direction: column; align-items: stretch; gap: 14px; }
  .tempo-number { flex-direction: row; justify-content: center; gap: 8px; }
  .tempo-controls { gap: 8px; }
  .tempo-slider .tempo-ticks { margin-inline: 52px; }
  .ensemble-panel { padding: 20px 14px; }
  .practice-controls>.field { width: 100%; justify-content: space-between; }
  .practice-controls select { flex: 1; max-width: 180px; }
  .empty-state { padding: 40px 20px; }
  .empty-state h2 { font-size: 27px; }
  .arrangement-steps { flex-direction: column; align-items: center; gap: 14px; }
  .composition-block { padding: 19px; }
  .block-fields .field { flex: 1; min-width: 106px; }
  .notice { margin-inline: 17px; }
}
@media (max-width: 420px) { .navigation-toggle>span { display: none; } }
@media (max-width: 380px) {
  .filter-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { button, .rhythm-card { transition: none; } }
@media print {
  .site-header { display: none!important; }
  :root { color-scheme: light; --ink: #202524; --subtle: #424b49; --line: #c9cdca; --paper: #fff; --bg: #fff; }
  .staff-svg { color: #163f50; }
  .staff-label, .hand-label { fill: #163f50; }
  .notation-bar, .bar-caption { background: #fff; color: #202524; border-color: #c9cdca; }
}

/* Bundled journal articles and the instrument guide. */
.journal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.journal-card { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px #00000012; transition: border-color .18s, box-shadow .18s; }
.journal-card:hover { border-color: #796c50; box-shadow: 0 12px 34px #00000030; }
.journal-art { min-height: 190px; display: flex; align-items: center; justify-content: center; gap: 28px; background: #252a29 url('./assets/inlay-pattern.svg') center / 150px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.journal-art::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, #252a29d9, #202426f0); }
.journal-art img { position: relative; width: 110px; height: 110px; }
.journal-art>span { position: relative; font: 36px var(--serif); letter-spacing: .04em; color: var(--accent); }
.journal-card:nth-child(3) .journal-art { background-color: #252829; }
.journal-copy { padding: 28px 30px; flex: 1; display: flex; flex-direction: column; }
.reading-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; color: var(--muted); font-size: 12px; }
.reading-meta>span+span::before { content: '·'; margin-right: 20px; }
.journal-copy h2 { font-family: var(--serif); font-size: 31px; line-height: 1.18; font-weight: 400; margin: 20px 0 14px; }
.journal-copy p { color: var(--muted); font-size: 14px; max-width: 490px; flex: 1; }
.journal-open { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 24px; color: var(--accent); font-size: 13px; }
.journal-open .ui-icon { width: 18px; }
.journal-featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.35fr 1fr; }
.journal-featured .journal-copy { grid-column: 1; grid-row: 1; padding: 42px; }
.journal-featured .journal-art { grid-column: 2; grid-row: 1; border: 0; border-left: 1px solid var(--line); flex-direction: column; gap: 10px; }
.journal-featured .journal-art img { width: 165px; height: 165px; }
.journal-featured .journal-art>span { font-size: 60px; }
.journal-featured h2 { font-size: 43px; }
.reading-page { max-width: 940px; }
.reading-back { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0 25px; font-size: 13px; text-decoration: none; }
.reading-page .page-heading { margin-bottom: 18px; }
.reading-page>.reading-meta { border-bottom: 1px solid var(--line); padding-bottom: 25px; margin-bottom: 36px; }
.reading-body p { color: var(--subtle); font-size: 16px; line-height: 1.85; }
.reading-body p.reading-lead { font-size: 19px; color: #dddcd4; line-height: 1.8; }
.reading-body section { margin-top: 35px; }
.reading-body h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; line-height: 1.2; margin-bottom: 15px; }
.reading-points { padding-left: 23px; color: var(--subtle); font-size: 16px; line-height: 1.8; }
.reading-points li { padding-left: 5px; margin-bottom: 13px; }
.reading-points li::marker { color: var(--accent); }
.reading-sources { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 17px; }
.article-figure, .article-video { margin: 28px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); overflow: hidden; }
.article-figure>a { display: block; background: #202728; }
.article-figure>a:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; }
.article-figure img { display: block; width: 100%; height: auto; }
.learning-timeline { background: #202728; }
.learning-timeline-heading { padding: 28px 32px 0; }
.learning-timeline-heading h2 { margin: 9px 0 8px; font: 400 32px/1.2 var(--serif); }
.reading-body .learning-timeline-heading p { margin: 0; font-size: 14px; color: var(--muted); }
.learning-timeline-stages { list-style: none; padding: 0; margin: 26px 32px 28px; }
.learning-timeline-stages li { position: relative; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 18px; padding: 0 0 26px 32px; }
.learning-timeline-stages li::before { content: ''; position: absolute; left: 5px; top: 10px; bottom: -10px; width: 1px; background: #746749; }
.learning-timeline-stages li::after { content: ''; position: absolute; left: 0; top: 7px; width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px #202728; }
.learning-timeline-stages li:last-child { padding-bottom: 0; }
.learning-timeline-stages li:last-child::before { display: none; }
.learning-timeline-time { color: var(--accent); font-size: 18px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.learning-timeline-detail { min-width: 0; }
.learning-timeline-detail h3 { margin: 0 0 5px; font-size: 17px; font-weight: 500; line-height: 1.45; color: var(--ink); }
.reading-body .learning-timeline-detail p { margin: 0; color: var(--subtle); font-size: 14px; line-height: 1.6; }
.learning-timeline figcaption { border-top: 1px solid var(--line); }
.learning-timeline-download { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
@media (max-width: 600px) {
  .learning-timeline-heading { padding: 24px 20px 0; }
  .learning-timeline-heading h2 { font-size: 28px; }
  .learning-timeline-stages { margin: 24px 20px; }
  .learning-timeline-stages li { grid-template-columns: minmax(0, 1fr); gap: 6px; padding-left: 26px; }
  .learning-timeline-time { font-size: 17px; }
}
.anatomy-heading { padding: 24px 28px 20px; }
.anatomy-heading h3 { font-family: var(--serif); font-size: 32px; font-weight: 400; margin: 8px 0 0; }
.anatomy-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 28px; padding: 0 28px 24px; }
.anatomy-photo { display: block; position: relative; border-radius: 8px; overflow: hidden; }
.anatomy-photo:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.anatomy-marker, .anatomy-number { display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0; border-radius: 50%; font-size: 13px; font-weight: 600; line-height: 1; }
.anatomy-marker { position: absolute; width: 28px; height: 28px; transform: translate(-50%, -50%); background: #263b37; color: #fff9df; border: 2px solid #fff9df; box-shadow: 0 1px 5px #0008; }
.anatomy-key { margin: 0; display: grid; gap: 18px; }
.anatomy-key dt { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.anatomy-number { width: 24px; height: 24px; color: var(--accent); border: 1px solid var(--line); }
.anatomy-key dd { margin: 5px 0 0 34px; font-size: 13px; line-height: 1.65; color: var(--subtle); }
.anatomy-figure figcaption { border-top: 1px solid var(--line); }
.anatomy-figure .reading-source { font-size: inherit; }
.article-figure figcaption, .article-video figcaption { padding: 20px 24px; }
.reading-body figcaption p, .learn-content figcaption p { font-size: 14px; line-height: 1.75; margin: 0 0 12px; }
.reading-body .article-credit, .learn-content .article-credit { display: block; font-size: 12px; line-height: 1.7; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.article-video h3 { font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.3; margin: 0 0 8px; }
.reading-body .article-watch-prompt, .learn-content .article-watch-prompt { margin: 18px 0 12px; color: var(--subtle); }
.article-watch-prompt strong { color: var(--accent); font-weight: 500; }
.article-video-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 13px; }
.article-video-actions>a { display: inline-flex; align-items: center; min-height: 44px; }
.article-video .skills-video-screen { min-height: 220px; }
.article-video .skills-video-cover[disabled] { opacity: 1; }
.article-video .skills-video-cover[disabled] .skills-play-icon { opacity: .35; }
@media (max-width: 480px) {
  .article-figure figcaption, .article-video figcaption { padding: 16px; }
  .article-video h3 { font-size: 23px; }
}
.reading-source { display: inline-block; color: var(--accent); font-size: 12px; line-height: 1.6; padding-block: 5px; }
.reading-patterns { border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 22px; margin-top: 25px; }
.reading-patterns>div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.reading-patterns strong { font-size: 14px; font-weight: 500; }
.reading-patterns code { background: #2e3535; border-radius: 5px; color: #c4dbd4; padding: 9px 12px; font-size: 16px; letter-spacing: .06em; white-space: nowrap; }
.reading-try { margin-top: 40px; padding: 30px; border: 1px solid #4b4c3e; border-radius: 14px; background: #252a29; }
.reading-try h2 { font-family: var(--serif); font-size: 30px; font-weight: 400; margin-bottom: 15px; }
.reading-try p { font-size: 14px; }
.reading-actions { margin-top: 22px; }
.more-reading { border-top: 1px solid var(--line); margin-top: 48px; padding-top: 28px; }
.more-reading h2 { font-size: 15px; margin-bottom: 18px; }
.more-reading>a { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); color: var(--accent); text-decoration: none; }
.history-feature { display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.history-illustration { background: #242a2a; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 30px 20px; gap: 13px; }
.history-illustration img { width: 210px; height: auto; aspect-ratio: 4 / 5; object-fit: cover; }
.history-illustration>span { font-size: 9px; color: var(--muted); letter-spacing: .2em; }
.history-intro { padding: 38px 42px; }
.history-intro h2, .history-section h2 { font-family: var(--serif); font-size: 32px; line-height: 1.2; font-weight: 400; margin: 0 0 20px; }
.history-intro p, .history-section p { font-size: 15px; line-height: 1.8; color: var(--subtle); }
.history-section { margin-top: 50px; }
.history-section .section-header { margin-bottom: 14px; }
.history-section .section-header h2 { margin: 0; }
.history-section-intro { max-width: 740px; }
.history-timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; margin-top: 28px; }
.history-timeline article { padding: 24px 0 5px 27px; border-left: 2px solid #595441; position: relative; }
.history-timeline article::before { content: ''; position: absolute; left: -6px; top: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px var(--bg); }
.history-date { color: var(--accent); font-size: 12px; letter-spacing: .06em; }
.history-timeline h3 { margin: 17px 0 14px; font-size: 18px; }
.rhythm-context { display: flex; gap: 50px; align-items: center; padding: 36px 40px; border-radius: 15px; border: 1px solid var(--line); background: var(--paper); }
.rhythm-context>div:first-child { flex: 1; }
.history-symbol { width: 170px; flex-shrink: 0; }
.history-symbol img { width: 100%; height: auto; }
.rhythm-glossary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin: 28px 0 18px; }
.rhythm-glossary>div { border: 1px solid var(--line); background: var(--paper); padding: 23px; border-radius: 12px; }
.rhythm-glossary dt { display: flex; flex-direction: column; gap: 17px; font-size: 15px; font-weight: 550; }
.glossary-symbol { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 8px; background: #252a29; color: var(--accent); font: 24px var(--serif); }
.rhythm-glossary dd { margin: 13px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* A browsable instrument and performance guide. */
.guide-anchor { scroll-margin-top: 120px; }
.guide-anchor:focus-visible { outline: none; }
.instrument-guide-list { container-type: inline-size; margin-top: 28px; border-bottom: 1px solid var(--line); }
.instrument-photo-guide { container-type: inline-size; margin: 28px 0; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.instrument-photo-heading h3 { margin: 10px 0 12px; font: 30px/1.25 var(--serif); }
.instrument-photo-heading p { margin: 0 0 24px; color: var(--subtle); font-size: 14px; line-height: 1.75; }
.instrument-photo-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px 16px; }
.instrument-photo-card { grid-column: span 2; margin: 0; min-width: 0; }
.instrument-photo-goblet { grid-column: span 3; }
.instrument-photo-link { position: relative; display: flex; align-items: center; justify-content: center; height: 165px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #121512; }
.instrument-photo-goblet .instrument-photo-link { height: 235px; }
.instrument-photo-link img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.instrument-photo-link img[hidden] { display: none; }
.instrument-photo-link:hover, .instrument-photo-link:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 3px; }
.instrument-photo-enlarge { position: absolute; right: 7px; top: 7px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 5px; background: #151915dd; color: var(--accent-hover); font-size: 15px; }
.instrument-photo-card figcaption { padding-top: 14px; }
.instrument-photo-card figcaption>strong { display: block; font: 23px/1.3 var(--serif); color: var(--ink); }
.instrument-photo-card figcaption>p { margin: 5px 0 8px; color: var(--subtle); font-size: 12px; line-height: 1.6; }
.instrument-photo-credit { color: var(--muted); font-size: 10px; line-height: 1.7; overflow-wrap: anywhere; }
.instrument-photo-credit .reading-source { font-size: inherit; }
.instrument-photo-kind { display: block; margin-bottom: 7px; color: var(--accent); font-size: 10px; line-height: 1.5; letter-spacing: .06em; text-transform: uppercase; }
.darbuka-type-guide .instrument-photo-link { height: 220px; }
.darbuka-type-guide .instrument-photo-card:nth-child(4) { grid-column: 2 / span 2; }
.darbuka-type-guide .instrument-photo-card:nth-child(5) { grid-column: 4 / span 2; }
.reading-body .instrument-photo-note { margin: -8px 0 24px; color: var(--muted); font-size: 12px; line-height: 1.7; }
@container (max-width: 570px) {
  .instrument-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument-photo-card, .instrument-photo-goblet { grid-column: auto; }
  .darbuka-type-guide .instrument-photo-card:nth-child(n+4) { grid-column: auto; }
  .instrument-photo-link, .instrument-photo-goblet .instrument-photo-link { height: 190px; }
  .darbuka-type-guide .instrument-photo-link { height: 190px; }
}
@container (max-width: 350px) {
  .instrument-photo-grid { grid-template-columns: 1fr; gap: 26px; }
  .instrument-photo-link, .instrument-photo-goblet .instrument-photo-link { height: 220px; }
  .darbuka-type-guide .instrument-photo-link { height: 220px; }
  .instrument-photo-credit { font-size: 11px; }
}
@media (max-width: 600px) {
  .instrument-photo-guide { padding: 18px; }
  .instrument-photo-heading h3 { font-size: 27px; }
}
.instrument-guide-entry { display: grid; grid-template-columns: minmax(190px, .8fr) minmax(0, 1.7fr); align-items: start; gap: 20px 28px; padding: 30px 0; border-top: 1px solid var(--line); scroll-margin-top: 130px; }
.instrument-guide-title { grid-column: 1 / -1; }
.instrument-guide-title h3 { font-family: var(--serif); font-size: 27px; line-height: 1.25; font-weight: 400; margin: 0 0 8px; }
.instrument-guide-title span { display: block; color: var(--muted); font-size: 11px; line-height: 1.7; }
.instrument-guide-entry .instrument-photo-card { grid-column: auto; }
.instrument-guide-entry .instrument-photo-link { height: 240px; }
.instrument-guide-copy>p { margin: 0; font-size: 14px; }
.instrument-guide-copy .listening-tip { margin-top: 20px; }
.instrument-guide-copy .reading-sources { margin-top: 12px; gap: 4px 16px; }
@container (max-width: 570px) {
  .instrument-guide-entry { grid-template-columns: 1fr; gap: 18px; }
  .instrument-guide-copy>p { font-size: 15px; }
}
.listening-tip { border-left: 2px solid #cbb27e38; padding-left: 19px; }
.listening-tip>span { color: var(--accent); font-size: 9px; letter-spacing: .17em; }
.history-section .listening-tip p { font-size: 13px; color: var(--muted); line-height: 1.8; margin: 8px 0 0; }
.melodic-heading { margin-top: 40px; }
.melodic-heading h3 { font-size: 21px; margin-bottom: 10px; }
.melodic-heading p { color: var(--muted); font-size: 14px; }
.melodic-guide-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 23px; }
.melodic-guide-grid article { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); padding: 24px; }
.guide-kind { color: var(--accent); font-size: 10px; letter-spacing: .06em; }
.melodic-guide-grid h3 { font: 27px var(--serif); margin: 15px 0 12px; }
.melodic-guide-grid p { font-size: 13px; flex: 1; }
.melodic-guide-grid .reading-source { font-size: 11px; }
.performance-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.performance-guide-card { display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); padding: 30px; }
.performance-guide-card h3 { font: 32px var(--serif); margin: 13px 0 16px; }
.performance-guide-card>p { font-size: 14px; flex: 1; }
.performance-guide-card .listening-tip { margin: 10px 0 18px; }
.journal-art>span { max-width: 65%; }
.journal-featured .journal-darbuka img { width: 200px; height: 200px; }
.journal-featured .journal-darbuka>span { font-size: 35px; letter-spacing: .16em; }
@media (max-width: 1050px) {
  #main-content { scroll-margin-top: 150px; }
  .guide-anchor { scroll-margin-top: 165px; }
  .melodic-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-feature { grid-template-columns: 235px minmax(0, 1fr); }
  .history-intro { padding: 28px; }
  .history-illustration img { width: 190px; }
  .rhythm-glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  #main-content { scroll-margin-top: 195px; }
  .guide-anchor { scroll-margin-top: 205px; }
  .performance-guide-grid { grid-template-columns: 1fr; }
  .journal-featured { grid-template-columns: 1fr; }
  .journal-featured .journal-art { grid-column: 1; grid-row: 1; min-height: 200px; border: 0; border-bottom: 1px solid var(--line); flex-direction: row; gap: 25px; }
  .journal-featured .journal-copy { grid-column: 1; grid-row: 2; padding: 28px; }
  .journal-featured .journal-art img { width: 130px; height: 130px; }
  .journal-featured h2 { font-size: 34px; }
  .journal-art { gap: 15px; }
  .journal-art img { width: 80px; height: 80px; }
  .journal-art>span { font-size: 24px; }
  .journal-copy { padding: 24px; }
  .journal-copy h2 { font-size: 28px; }
  .history-feature { grid-template-columns: 1fr; }
  .history-illustration { padding: 20px; }
  .history-illustration img { width: 170px; }
  .history-timeline { gap: 25px; }
  .history-symbol { display: none; }
  .rhythm-context { padding: 28px; }
}
@media (max-width: 600px) {
  .melodic-guide-grid { grid-template-columns: 1fr; gap: 14px; }
  .melodic-guide-grid article, .performance-guide-card { padding: 24px; }
  .melodic-guide-grid p, .performance-guide-card>p { font-size: 14px; }
  .reading-points { font-size: 15px; }
  .journal-featured .journal-darbuka img { width: 115px; height: 115px; }
  .journal-featured .journal-darbuka>span { font-size: 23px; letter-spacing: .02em; }
  .journal-grid { grid-template-columns: 1fr; gap: 20px; }
  .journal-copy, .journal-featured .journal-copy { padding: 25px; }
  .journal-art, .journal-featured .journal-art { min-height: 165px; }
  .journal-art img, .journal-featured .journal-art img { width: 105px; height: 105px; }
  .journal-art>span { font-size: 30px; }
  .reading-page .page-heading h1 { font-size: 39px; }
  .reading-meta { font-size: 11px; gap: 8px 12px; }
  .reading-meta>span+span::before { margin-right: 12px; }
  .reading-body p { font-size: 15px; }
  .reading-body p.reading-lead { font-size: 17px; }
  .reading-body h2 { font-size: 27px; }
  .reading-patterns { padding: 15px; }
  .reading-patterns code { font-size: 13px; letter-spacing: 0; }
  .reading-try { padding: 24px; }
  .reading-try h2 { font-size: 28px; }
  .more-reading>a { font-size: 14px; }
  .history-intro { padding: 27px 24px; }
  .history-intro h2, .history-section h2 { font-size: 29px; }
  .history-timeline { grid-template-columns: 1fr; gap: 25px; }
  .history-section { margin-top: 38px; }
  .rhythm-context { padding: 25px; }
  .rhythm-glossary { gap: 12px; }
  .rhythm-glossary>div { padding: 18px 15px; }
  .rhythm-glossary dt { font-size: 14px; }
  .rhythm-glossary dd { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .journal-card { transition: none; } }

.reading-route .app-content { padding-bottom: 20px; }

/* Learn keeps its topic menu beside a focused reading page. */
.learn-page { display: grid; grid-template-columns: 218px minmax(0, 1fr); align-items: start; gap: 48px; }
.learn-sidebar { position: sticky; top: 118px; min-width: 0; }
.learn-sidebar-heading { padding: 0 16px 22px; }
.learn-sidebar-heading h2 { margin: 0 0 8px; font: 32px var(--serif); }
.learn-sidebar-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.learn-toggle { display: none; }
#learn-navigation { max-height: calc(100dvh - 218px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #51544b transparent; padding: 5px 7px 8px 5px; }
.learn-sections, .learn-rhythm-links { display: flex; flex-direction: column; gap: 3px; }
.learn-nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border-radius: 7px; color: var(--subtle); font-size: 13px; line-height: 1.4; text-decoration: none; border-left: 2px solid transparent; }
.learn-nav-link:hover { color: var(--ink); background: #ffffff05; }
.learn-nav-link[aria-current=page] { color: var(--accent-hover); background: #cbb27e10; border-left-color: var(--accent); }
.learn-nav-link .ui-icon { width: 17px; height: 17px; color: var(--muted); }
.learn-nav-link[aria-current=page] .ui-icon { color: var(--accent); }
.learn-rhythm-heading { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin: 22px 12px 10px; padding-top: 21px; font-size: 9px; letter-spacing: .12em; color: var(--muted); }
.learn-rhythm-links .learn-nav-link { justify-content: space-between; min-height: 38px; padding-block: 8px; font-size: 12px; }
.learn-rhythm-links small { font-size: 10px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.learn-content { min-width: 0; padding-left: 36px; border-left: 1px solid var(--line); }
.learn-content .article-video, .learn-content .article-figure { min-width: 0; }
.history-article { max-width: 900px; }
.history-article .history-lead { font-size: 19px; line-height: 1.85; color: #dddcd4; margin: 24px 0 30px; }
.history-contents { border-block: 1px solid var(--line); margin: 28px 0 32px; }
.history-contents>summary { display: flex; align-items: center; gap: 16px; min-height: 60px; padding: 12px 2px; cursor: pointer; list-style: none; font-size: 14px; color: var(--ink); }
.history-contents>summary::-webkit-details-marker { display: none; }
.history-contents>summary>span { flex: 1; }
.history-contents>summary small { font-size: 11px; color: var(--muted); }
.history-contents>summary .ui-icon { width: 16px; height: 16px; color: var(--accent); }
.history-contents[open]>summary .ui-icon { transform: rotate(180deg); }
.history-contents ol { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 30px; padding: 0 0 16px; margin: 0; list-style: none; }
.history-contents button { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 8px; width: 100%; min-height: 44px; text-align: left; background: transparent; border: 0; border-radius: 5px; font-size: 13px; color: var(--subtle); }
.history-contents button:hover { color: var(--accent-hover); background: var(--surface); }
.history-contents button span { font-size: 14px; color: var(--accent); }
.history-chapter { margin-top: 50px; padding-top: 8px; scroll-margin-top: 120px; }
.history-chapter>h2 { font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1.25; margin: 0 0 22px; text-wrap: balance; }
.history-passage { margin: 0 0 24px; }
.history-passage>h3 { font-size: 18px; line-height: 1.45; font-weight: 500; margin: 30px 0 12px; }
.history-passage>p, .history-milestones p { font-size: 16px; line-height: 1.85; color: var(--subtle); margin: 0 0 10px; }
.learn-prose { max-width: 800px; }
.reading-topic { scroll-margin-top: 120px; }
.reading-topic>p>strong, .learn-prose .history-passage>p>strong { color: var(--ink); font-weight: 500; }
.reading-note-symbol { display: inline-block; min-width: 24px; margin-right: 8px; color: var(--accent); font-family: var(--serif); text-align: center; }
.reading-citation>a { display: inline-block; min-width: 24px; padding: 0 2px; text-align: center; font-size: 12px; line-height: 24px; font-variant-numeric: tabular-nums; color: var(--accent); text-decoration: none; border-radius: 3px; }
.reading-citation>a:hover, .reading-citation>a:focus-visible { color: var(--accent-hover); background: #cbb27e18; text-decoration: underline; text-underline-offset: 3px; }
.reading-source-preview { position: fixed; z-index: 80; display: block; width: min(290px, calc(100vw - 24px)); padding: 14px 16px; border: 1px solid #69614e; border-radius: 8px; background: #262a25; box-shadow: 0 8px 30px #0006; text-align: left; font-size: 12px; line-height: 1.6; color: var(--subtle); overflow-wrap: anywhere; }
.reading-source-preview[hidden] { display: none; }
.reading-source-preview strong { display: block; font-weight: 500; font-size: 13px; color: var(--ink); }
.reading-source-preview>span { display: block; color: var(--muted); margin-top: 5px; }
.history-photo>a { background: #161915; }
.history-photo img { max-height: 520px; object-fit: contain; }
.history-photo img[hidden], .photo-fallback { display: none; }
.photo-unavailable .photo-fallback { display: block; padding: 36px 24px; font-size: 14px; }
.history-milestones { list-style: none; margin: 24px 0; padding: 0 0 0 8px; }
.history-milestones li { position: relative; padding: 0 0 30px 27px; border-left: 1px solid #595441; }
.history-milestones li:last-child { padding-bottom: 0; }
.history-milestones li::before { content: ''; position: absolute; top: 4px; left: -5px; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 5px var(--bg); }
.history-milestones .history-milestone-title { margin: 8px 0; font-size: 16px; line-height: 1.45; color: var(--ink); }
.history-milestones p { font-size: 15px; }
.history-milestone-date { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.history-date-note { border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; font-size: 10px; color: var(--muted); }
.history-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin: 24px 0 14px; }
.history-materials { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.65; text-align: left; }
.history-materials caption { text-align: left; padding: 18px; color: var(--ink); background: var(--paper); font-weight: 500; font-size: 15px; }
.history-materials th, .history-materials td { padding: 14px 16px; vertical-align: top; border-top: 1px solid var(--line); }
.history-materials thead th { font-weight: 500; color: var(--muted); font-size: 12px; }
.history-materials tbody th { font-weight: 500; width: 18%; }
.history-materials td { color: var(--subtle); }
.reading-rhythm-comparison { min-width: 480px; }
.reading-rhythm-comparison th, .reading-rhythm-comparison td { text-align: center; }
.reading-rhythm-comparison th:first-child { text-align: left; width: 24%; }
.reading-rhythm-comparison td { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; font-weight: 600; }
.reading-bibliography { border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; margin: 38px 0; background: var(--paper); }
.reading-bibliography summary { cursor: pointer; font-size: 15px; line-height: 1.6; color: var(--accent); }
.reading-bibliography p { font-size: 13px; line-height: 1.75; color: var(--muted); }
.reading-bibliography ol { padding-left: 20px; }
.reading-bibliography li { margin-top: 20px; color: var(--muted); font-size: 12px; }
.reading-bibliography li p { margin: 6px 0 0; }
.history-next { display: flex; flex-wrap: wrap; gap: 14px 24px; margin-top: 24px; font-size: 14px; }
@media (max-width: 620px) {
  .anatomy-heading { padding: 20px 20px 16px; }
  .anatomy-layout { grid-template-columns: 1fr; padding: 0 20px 22px; gap: 22px; }
  .anatomy-photo { width: 100%; max-width: 360px; justify-self: center; }
  .anatomy-key { gap: 16px; }
  .history-article .history-lead { font-size: 17px; }
  .history-contents ol { grid-template-columns: 1fr; }
  .history-chapter { margin-top: 38px; }
  .history-chapter>h2 { font-size: 28px; }
  .history-passage>p { font-size: 15px; }
  .history-materials th, .history-materials td { padding: 12px 10px; }
  .history-materials { min-width: 460px; }
  .reading-bibliography { padding: 18px; }
}
.roll-guide-card .article-video { margin-bottom: 0; }
.learn-content .page-heading { margin-bottom: 30px; }
.practice-page .page-heading h1, .learn-content .page-heading h1 { font-size: clamp(38px, 4vw, 54px); overflow-wrap: anywhere; }
.practice-page .page-heading .subtitle, .learn-content .subtitle { max-width: 720px; }
/* Keep the normal section gap after the Learn topic cards. */
.learn-content>div>.history-section:first-of-type:not(.learn-rhythm-grid + .history-section) { margin-top: 0; }
.learn-content .history-feature { grid-template-columns: 190px minmax(0, 1fr); }
.learn-content .history-illustration img { width: 155px; max-width: 100%; }
.learn-content .history-intro { padding: 28px; }
.learn-content .history-intro h2, .learn-content .history-section h2 { font-size: 29px; }
.learn-content .melodic-guide-grid, .learn-content .rhythm-glossary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.learn-content .history-symbol { width: 120px; }
.learn-content .rhythm-context { gap: 24px; padding: 28px; }
.learn-content .button { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; margin-top: 10px; border: 1px solid #6a5f46; border-radius: 8px; text-decoration: none; font-size: 13px; }
.learn-content .button:hover { background: #cbb27e10; }
.learn-rhythm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.learn-rhythm-card { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); text-decoration: none; color: var(--ink); }
.learn-rhythm-card:hover { border-color: #796c50; }
.learn-card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.learn-card-title h2 { font: 27px var(--serif); margin: 0 0 10px; }
.learn-rhythm-card .rhythm-arabic { align-self: flex-start; font-size: 18px; }
.learn-rhythm-card p { color: var(--muted); font-size: 12px; margin: 10px 0 20px; flex: 1; }
.learn-card-open { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--accent); }
.learn-card-open .ui-icon { width: 17px; }
.learn-rhythm-meta { margin: -9px 0 30px; }
.learn-rhythm-meta>span+span::before { content: none; }
.learn-pattern { padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.learn-pattern-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.learn-pattern-heading h2 { font: 27px var(--serif); margin: 0; }
.learn-pattern-heading .guide-kind { flex-shrink: 0; }
.learn-pattern p { color: var(--subtle); font-size: 14px; }
.learn-pattern .hint { color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.learn-pattern-scroll { max-width: 100%; overflow-x: auto; margin-top: 24px; padding: 4px 0 12px; }
.learn-pattern .pulse-rail { overflow: visible; margin: 0; }
.learn-pattern .pulse-lane { grid-template-columns: repeat(var(--pulses), minmax(42px, 1fr)); }
.learn-pattern .pulse-cell { min-width: 42px; }
.learn-pattern .pulse-track-name { display: none; }
.learn-pattern .reading-actions { margin-top: 22px; }
.learn-pattern .reading-actions button+button { background: transparent; color: var(--accent); border-color: #6a5f46; }
.learn-rhythm-page .rhythm-sources { padding-left: 20px; }
.learn-rhythm-page .rhythm-sources a { overflow-wrap: anywhere; }
.learn-neighbours { display: flex; justify-content: space-between; gap: 24px; padding-top: 24px; margin-top: 40px; border-top: 1px solid var(--line); }
.learn-neighbours a { display: flex; flex-direction: column; gap: 7px; text-decoration: none; }
.learn-neighbours>a:last-child { text-align: right; }
.learn-neighbours small { font-size: 11px; }
.learn-neighbours span { font: 23px var(--serif); }

/* The stroke guide uses the same symbols as the practice player. */
.stroke-intro { max-width: 710px; color: var(--subtle); font-size: 15px; line-height: 1.8; margin: -6px 0 30px; }
.stroke-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.stroke-guide-card { min-width: 0; padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.stroke-guide-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.stroke-symbol { display: grid; place-items: center; flex: 0 0 49px; width: 49px; height: 56px; border: 1px solid #435f5f; border-radius: 10px; background: #273b3c; color: #bed6d2; font: 30px var(--serif); }
.stroke-dum .stroke-symbol { background: #3c3527; border-color: #66583b; color: #dfc796; }
.stroke-rest .stroke-symbol { background: #24292c; border-color: #353d40; color: var(--muted); }
.stroke-pop .stroke-symbol { background: #2a2931; border-color: #514b62; color: #c8bddc; }
.stroke-guide-heading .guide-kind { line-height: 1.6; }
.stroke-guide-heading h2 { font: 27px var(--serif); line-height: 1.2; margin: 6px 0 0; }
.stroke-guide-card p, .stroke-details dd { color: var(--subtle); font-size: 14px; line-height: 1.8; }
.stroke-details { margin: 23px 0; }
.stroke-details dt, .stroke-practice-tip h3 { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 500; }
.stroke-details dd { margin: 0 0 17px; }
.stroke-practice-tip { padding: 17px 19px; border-left: 2px solid #5b604a; background: #ffffff03; }
.stroke-practice-tip p { margin: 0; font-size: 13px; }
.stroke-guide-card .stroke-note { margin: 20px 0 0; color: var(--muted); font-size: 12px; }
.stroke-guide-card .reading-sources { flex-direction: column; align-items: flex-start; gap: 3px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.stroke-guide-card .reading-source { overflow-wrap: anywhere; }
.stroke-ornaments>div { margin-top: 24px; }
.stroke-ornaments h3 { font-size: 17px; margin-bottom: 10px; }
.stroke-guide-link { display: inline-block; min-height: 36px; padding: 8px 0; font-size: 12px; }
.roll-jump-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 22px; }
.roll-jump-links button { min-height: 40px; padding: 8px 14px; border-radius: 20px; color: var(--subtle); font-size: 12px; }
.roll-jump-links button:hover { color: var(--accent); border-color: var(--accent); }
.roll-guide-card { scroll-margin-top: 110px; }
.roll-symbol { color: #dfc796; background: #3c3527; border-color: #66583b; }
.roll-sequence { margin: 22px 0; }
.roll-sequence figcaption { color: var(--muted); font-size: 11px; line-height: 1.7; margin-bottom: 10px; }
.roll-sequence ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.roll-sequence li { min-width: 32px; text-align: center; padding: 8px 10px; border: 1px solid #435f5f; border-radius: 6px; background: #273b3c; color: #bed6d2; font-size: 12px; }
.roll-practice ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-left: 20px; }
.roll-practice li { padding-left: 5px; }
.roll-practice li::marker { color: var(--accent); }
.roll-practice h3 { font-size: 16px; margin: 0 0 10px; }
.roll-practice p { font-size: 13px; }
@media (max-width: 1050px) {
  .stroke-guide-grid { grid-template-columns: 1fr; }
  .roll-practice ol { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 600px) {
  .stroke-guide-card { padding: 22px; }
  .stroke-guide-heading { gap: 14px; }
  .stroke-guide-heading h2 { font-size: 25px; }
  .stroke-guide .reading-actions, .roll-guide .reading-actions { flex-direction: column; }
}
@media (min-width: 761px) and (max-width: 1050px) {
  .learn-page { grid-template-columns: 175px minmax(0, 1fr); gap: 24px; }
  .learn-sidebar { top: 165px; }
  #learn-navigation { max-height: calc(100dvh - 265px); }
  .learn-content { padding-left: 24px; }
  .learn-content .history-feature, .learn-content .performance-guide-grid { grid-template-columns: 1fr; }
  .learn-content .history-illustration { padding: 20px; }
  .learn-content .history-illustration img { width: 150px; }
  .learn-content .history-timeline { grid-template-columns: 1fr; }
  .learn-content .history-symbol { display: none; }
  .learn-rhythm-card { padding: 18px; }
  .learn-card-title { flex-wrap: wrap; gap: 0 8px; }
  .learn-pattern-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 760px) {
  .learn-page { display: block; }
  .learn-sidebar { position: static; margin-bottom: 30px; padding: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
  .learn-sidebar-heading { display: none; }
  .learn-toggle { display: flex; width: 100%; gap: 12px; padding: 10px; border: 0; background: transparent; text-align: left; justify-content: flex-start; }
  .learn-toggle>span { min-width: 0; flex: 1; }
  .learn-toggle small, .learn-toggle strong { display: block; }
  .learn-toggle small { font-size: 10px; font-weight: 400; margin-bottom: 3px; }
  .learn-toggle strong { font-size: 14px; font-weight: 500; }
  .learn-toggle>.ui-icon { color: var(--accent); width: 18px; }
  .learn-toggle[aria-expanded=true]>.ui-icon:last-child { transform: rotate(180deg); }
  #learn-navigation { display: none; max-height: 55dvh; padding: 8px; border-top: 1px solid var(--line); margin-top: 5px; }
  .learn-sidebar.is-open #learn-navigation { display: block; }
  .learn-rhythm-links .learn-nav-link { min-height: 44px; font-size: 13px; }
  .learn-content { padding-left: 0; border: 0; }
  .learn-content .history-feature { grid-template-columns: 1fr; }
  .learn-content .history-illustration { padding: 20px; }
  .learn-pattern-heading { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 600px) {
  .learn-rhythm-grid, .learn-content .melodic-guide-grid { grid-template-columns: 1fr; }
  .learn-content .history-intro, .learn-pattern { padding: 22px; }
  .learn-content .rhythm-glossary { gap: 10px; }
  .learn-content .rhythm-glossary>div { padding: 17px; }
  .learn-content .history-timeline { grid-template-columns: 1fr; }
  .learn-pattern .reading-actions { flex-direction: column; }
}
.transport[hidden] { display: none; }

/* One practice dock: choose, play and adjust without leaving the rhythm. */
.app-content { padding-bottom: calc(var(--transport-height, 230px) + 48px + env(safe-area-inset-bottom)); }
.transport {
  position: fixed; z-index: 60; left: 50%; right: auto; bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%); width: calc(100% - 56px); max-width: 1200px; min-height: 0;
  padding: 16px 20px 11px; border: 1px solid #69604b; border-radius: 20px;
  background: linear-gradient(120deg, #292b28fa, #202427fa 48%); box-shadow: 0 12px 48px #00000080, 0 1px 0 #ffffff08 inset;
  backdrop-filter: blur(24px); max-height: calc(100dvh - 90px); overflow-y: auto;
}
.transport-main { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(185px, .9fr) minmax(270px, 1.4fr) 44px; gap: 20px; align-items: center; }
.transport-current { display: flex; align-items: center; gap: 14px; min-width: 0; }
.transport-meter { flex: 0 0 47px; min-height: 51px; border: 1px solid #cbb27e30; border-radius: 10px; background: #cbb27e08; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--accent-hover); }
.transport-meter strong { font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.transport-meter>span { font-size: 7px; letter-spacing: .12em; color: #b5ac97; }
.transport-source { display: block; min-width: 0; max-width: none; flex: 1; }
.transport-title { display: flex; justify-content: flex-start; gap: 9px; border: 0; background: transparent; border-radius: 6px; max-width: 100%; min-height: 35px; padding: 0 3px; text-align: left; color: var(--ink); }
.transport-title>span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--serif); font-size: 24px; line-height: 1.35; }
.transport-title>.ui-icon { width: 15px; height: 15px; color: var(--accent); }
.transport-title:hover:not(:disabled) { background: #ffffff06; color: var(--accent-hover); }
.transport-variation { display: block; width: auto; max-width: 100%; min-height: 30px; height: 30px; padding: 2px 24px 2px 3px; border: 0; border-radius: 5px; font-size: 11px; color: var(--subtle); background-color: transparent; cursor: pointer; }
.transport-variation:hover { background-color: #ffffff06; }
.transport-kind { display: block; margin: 3px 0 7px 3px; font-size: 11px; color: var(--muted); }
.transport-buttons { display: grid; grid-template-columns: minmax(0, 1fr) 54px minmax(0, 1fr); align-items: center; gap: 12px; }
.transport-play { display: grid; place-items: center; width: 54px; height: 54px; min-width: 54px; min-height: 54px; padding: 0; border-radius: 50%; border: 1px solid var(--accent); background: var(--accent); color: #1c1e1b; box-shadow: 0 3px 16px #cbb27e15; }
.transport-play:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.transport-play .ui-icon { width: 26px; height: 26px; stroke-width: 1.7; }
.transport-play[data-icon=play] .ui-icon { fill: currentColor; }
.transport-play[data-icon=pause] .ui-icon { stroke-width: 4; }
.transport-skip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 48px; padding: 5px 2px; border: 0; background: transparent; color: var(--subtle); }
.transport-skip>.ui-icon { width: 21px; height: 21px; }
.transport-skip>span { font-size: 10px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transport-skip:hover:not(:disabled) { background: #ffffff06; color: var(--accent-hover); }
.sequence-buttons { display: flex; justify-content: center; gap: 18px; }
.sequence-buttons>.transport-skip { width: 44px; }
.transport-main>button.transport-more { display: grid; place-items: center; align-self: center; width: 44px; min-height: 44px; padding: 0; border-color: #cbb27e33; border-radius: 50%; background: transparent; color: var(--ink); grid-column: 4; grid-row: 1; }
.transport-more>.ui-icon { width: 24px; height: 24px; fill: currentColor; }
.transport-tempo { min-width: 0; }
.transport-tempo-caption { display: flex; justify-content: space-between; padding: 0 6px; margin-bottom: 1px; font-size: 9px; color: var(--muted); }
.transport-tempo-caption>span:first-child { letter-spacing: .14em; }
.transport-tempo-controls { display: flex; align-items: center; gap: 9px; }
.transport-tempo .tempo-step { flex: 0 0 32px; width: 32px; min-height: 44px; height: 44px; border: 0; background: transparent; color: var(--subtle); font-size: 23px; padding: 0; }
.transport-tempo .tempo-step:hover:not(:disabled) { background: #ffffff08; color: var(--accent-hover); }
.transport input.transport-tempo-slider { flex: 1; width: 100%; min-width: 0; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.transport-tempo-slider::-webkit-slider-runnable-track { height: 5px; border-radius: 5px; background: linear-gradient(to right, var(--accent) 0 var(--tempo-fill), #535956 var(--tempo-fill) 100%); }
.transport-tempo-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border: 2px solid #e9d7b1; border-radius: 50%; background: var(--accent-hover); margin-top: -8.5px; box-shadow: 0 2px 8px #00000055; }
.transport-tempo-slider::-moz-range-track { height: 5px; border-radius: 5px; background: #535956; }
.transport-tempo-slider::-moz-range-progress { height: 5px; border-radius: 5px; background: var(--accent); }
.transport-tempo-slider::-moz-range-thumb { width: 19px; height: 19px; border: 2px solid #e9d7b1; border-radius: 50%; background: var(--accent-hover); box-shadow: 0 2px 8px #00000055; }
.transport-bpm { display: flex; flex-direction: column; justify-content: center; align-items: center; flex: 0 0 57px; border-left: 1px solid #ffffff12; padding-left: 8px; }
.transport-bpm input { width: 100%; min-height: 31px; height: 31px; padding: 0; border: 0; border-radius: 4px; background: transparent; font-size: 23px; line-height: 1; font-weight: 500; font-variant-numeric: tabular-nums; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.transport-bpm input::-webkit-inner-spin-button, .transport-bpm input::-webkit-outer-spin-button { appearance: none; -webkit-appearance: none; margin: 0; }
.transport-bpm>span { font-size: 8px; letter-spacing: .1em; color: var(--muted); line-height: 1.4; }
.transport-block-tempo { font-size: 12px; color: var(--subtle); text-align: center; }
.transport-statusline { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid #ffffff0b; padding-top: 8px; margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.transport-statusline>span { text-transform: capitalize; min-width: 0; }
.transport-statusline>div { display: flex; gap: 6px; flex-shrink: 0; }
.transport-detail { display: block; min-height: 0; margin: 7px 0 0; font-size: 11px; line-height: 1.5; color: var(--accent-hover); white-space: normal; overflow: visible; overflow-wrap: anywhere; text-align: left; }
.transport-detail:empty { display: none; }
.transport-detail.transport-warning { color: var(--danger); max-height: 20vh; overflow-y: auto; }

/* Focus stays inside these native dialogs; Escape and outside taps dismiss them. */
.player-sheet { width: 430px; max-width: calc(100vw - 28px); }
.player-sheet .modal-heading { padding: 18px 21px; background: transparent; }
.player-sheet .modal-heading h2 { font-size: 25px; }
.player-sheet .modal-heading .icon-button { border: 0; background: transparent; color: var(--muted); min-width: 44px; }
.player-sheet .modal-body { padding: 12px; max-height: 65dvh; }
.player-sheet .modal-actions:empty { display: none; }
.player-options { display: flex; flex-direction: column; gap: 3px; }
.player-option { display: flex; align-items: center; justify-content: flex-start; gap: 15px; padding: 16px 12px; border: 0; background: transparent; text-align: left; }
.player-option>.ui-icon:first-child { width: 23px; height: 23px; color: var(--accent); }
.player-option>span { flex: 1; }
.player-option strong, .player-option small { display: block; }
.player-option strong { font-size: 14px; font-weight: 500; color: var(--ink); }
.player-option small { font-size: 11px; margin-top: 3px; line-height: 1.5; }
.player-option>.ui-icon:last-child { width: 15px; color: var(--muted); }
.rhythm-picker-search { position: sticky; top: 0; z-index: 1; background: var(--paper); }
.rhythm-picker-search input { width: 100%; padding-left: 39px; }
.rhythm-picker-search>.ui-icon { left: 12px; width: 17px; }
.rhythm-picker-count { margin: 11px 9px 0; color: var(--muted); font-size: 11px; }
.rhythm-picker-group { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); padding: 15px 9px 7px; margin: 0; }
.rhythm-picker-item { display: flex; align-items: center; justify-content: flex-start; gap: 14px; padding: 11px; width: 100%; border: 1px solid transparent; background: transparent; text-align: left; }
.rhythm-picker-item[aria-current=true] { background: var(--green-light); border-color: #cbb27e30; }
.picker-meter { display: grid; place-items: center; width: 39px; height: 39px; flex-shrink: 0; border-radius: 8px; border: 1px solid var(--line); font-size: 12px; color: var(--accent-hover); }
.picker-name { flex: 1; min-width: 0; }
.picker-name strong { display: block; font-size: 15px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.picker-name small { display: block; font-size: 11px; }
.rhythm-picker-item>.ui-icon { width: 17px; color: var(--accent); }
.picker-empty { padding: 18px 10px; color: var(--muted); }
.session-fields>.field, .metronome-fields>.field { margin-bottom: 18px; }
.session-fields>.check, .metronome-fields>.check { margin-bottom: 15px; }
.metronome-fields>.check { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; min-height: 52px; }

@media (max-width: 1050px) and (min-width: 761px) {
  .transport-main { grid-template-columns: minmax(180px, 1fr) minmax(180px, .85fr) minmax(225px, 1fr) 44px; gap: 12px; }
  .transport { width: calc(100% - 36px); padding-inline: 16px; }
  .transport-current { gap: 9px; }
  .transport-buttons { gap: 5px; }
  .transport-title>span { font-size: 21px; }
  .transport-tempo-controls { gap: 3px; }
  .transport-bpm { flex-basis: 49px; }
}
@media (max-width: 760px) {
  .transport { width: calc(100% - 24px); bottom: max(10px, env(safe-area-inset-bottom)); padding: 10px 15px 9px; border-radius: 18px; }
  .transport-main { grid-template-columns: minmax(0, 1fr) 44px; gap: 7px 10px; }
  .transport-current { grid-column: 1; grid-row: 1; gap: 12px; }
  .transport-main>button.transport-more { grid-column: 2; grid-row: 1; }
  .transport-title>span { font-size: 24px; }
  .transport-variation { font-size: 11px; }
  .transport-meter { flex-basis: 44px; min-height: 48px; }
  .transport-buttons { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); gap: 20px; width: 100%; max-width: 420px; justify-self: center; }
  .transport-play { width: 52px; height: 52px; min-width: 52px; min-height: 52px; }
  .transport-skip { flex-direction: row; gap: 10px; min-height: 44px; }
  .transport-skip>span { width: auto; font-size: 11px; }
  .skip-previous { flex-direction: row-reverse; }
  .transport-tempo, .transport-block-tempo { grid-column: 1 / -1; grid-row: 3; }
  .transport-tempo-caption { display: none; }
  .transport-tempo-controls { gap: 5px; }
  .transport-tempo .tempo-step { flex-basis: 32px; width: 32px; }
  .transport-bpm { flex-basis: 59px; }
  .transport-statusline { font-size: 10px; margin-top: 4px; padding-top: 7px; gap: 8px; }
  .transport-detail { font-size: 11px; }
  .player-sheet { position: fixed; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); margin: 0 auto; width: 460px; border-radius: 20px; }
  .player-sheet .modal-body { max-height: 62dvh; }
  .player-sheet .modal-heading { padding: 13px 19px; }
  .rhythm-picker { bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .transport { padding-inline: 11px; }
  .transport-current { gap: 9px; }
  .transport-title>span { font-size: 22px; }
  .transport-buttons { gap: 12px; }
  .transport-skip { gap: 6px; }
  .transport-skip>span { font-size: 10px; }
}

/* Standalone metronome: a legible pulse and quiet, tactile controls. */
.metronome-page { max-width: 1160px; margin-inline: auto; }
.metronome-page .page-heading { margin-bottom: 30px; }
.metronome-page .subtitle { max-width: 660px; }
.metro-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.metro-main, .metro-sidebar { display: grid; gap: 20px; min-width: 0; }
.metro-panel { min-width: 0; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.metro-console { padding: 26px 30px 22px; background: linear-gradient(150deg, #27282355, transparent 45%), var(--paper); }
.metro-console-top, .metro-section-heading, .metro-pattern-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metro-eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: .18em; }
.metro-eyebrow .ui-icon { width: 17px; height: 17px; }
.metro-live-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.metro-live-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #676d6f; }
.metro-live-status.is-playing { color: var(--accent-hover); }
.metro-live-status.is-playing::before { background: var(--accent); box-shadow: 0 0 10px #cbb27e55; }
.metro-tempo { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 22px 0 4px; }
.metro-tempo-value { display: grid; text-align: center; }
.metro-tempo-value input { width: 220px; min-width: 0; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); text-align: center; font-family: inherit; font-size: clamp(64px, 8vw, 94px); font-weight: 400; line-height: 1.1; letter-spacing: -5px; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.metro-tempo-value input::-webkit-inner-spin-button, .metro-tempo-value input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.metro-tempo-value input:hover { border-color: var(--line); }
.metro-tempo-value>span { color: var(--accent); font-size: 10px; letter-spacing: .2em; }
.metro-step { width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 25px; font-weight: 400; flex-shrink: 0; }
.metro-unit-hint { text-align: center; color: var(--muted); font-size: 12px; margin: 15px 0; }
.metro-slider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; }
.metro-slider input { flex: 1; min-width: 0; width: 100%; padding-inline: 0; border: 0; background: transparent; }
.metro-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .8fr) 48px; gap: 10px; margin-top: 12px; }
.metro-actions button { min-height: 50px; justify-content: center; }
#metro-reset { padding: 0; }
.metro-tap-hint { text-align: center; font-size: 11px; min-height: 18px; margin: 10px 0 22px; }
.metro-announcement { font-size: 12px; line-height: 1.5; color: var(--teal); margin: 0; }
.metro-announcement:not(:empty) { padding: 12px; background: #91b9b70b; border: 1px solid #91b9b726; border-radius: 8px; margin: 0 0 20px; }
.metro-pattern-heading { border-top: 1px solid var(--line); padding-top: 23px; }
.metro-panel h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 15px; font-weight: 500; letter-spacing: -.2px; }
.metro-panel h2 .ui-icon { width: 18px; height: 18px; color: var(--accent); }
.metro-meter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 24px; }
.metro-meter select { padding: 8px; min-width: 60px; min-height: 42px; text-align: center; font-size: 16px; }
.metro-meters { display: flex; flex-wrap: wrap; gap: 7px; margin: 15px 0 20px; }
.metro-meters button { flex: 1; min-width: 42px; min-height: 36px; padding: 6px 8px; font-size: 11px; border-radius: 6px; background: transparent; }
.metro-beats { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 9px; }
.metro-beat { position: relative; display: flex; flex-direction: column; gap: 5px; min-height: 104px; padding: 13px 5px 10px; border-radius: 10px; background: #202427; }
.metro-beat-number { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metro-beat-mark { height: 18px; line-height: 18px; font-size: 12px; }
.metro-beat-label { font-size: 10px; }
.metro-beat.level-accent { color: var(--accent-hover); background: #302c24; border-color: #6a5f46; }
.metro-beat.level-soft { color: var(--muted); }
.metro-beat.level-soft .metro-beat-mark { font-size: 24px; }
.metro-beat.level-mute { color: var(--muted); border-style: dashed; background: #171a1c; }
.metro-beat.is-current { border-color: var(--accent-hover); box-shadow: 0 0 0 2px var(--accent), inset 0 -4px 0 var(--accent); background: #3b352a; color: var(--ink); }
.metro-beat.is-current.is-silent { box-shadow: 0 0 0 2px var(--teal), inset 0 -4px 0 var(--teal); border-color: var(--teal); background: #253133; }
.metro-pattern-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 6px; margin-top: 11px; }
.metro-pattern-tools .hint { font-size: 11px; margin: 0; }
.metro-pattern-tools button { min-height: 36px; padding: 6px 0; }
.metro-mute-hint { font-size: 11px; margin: 0 0 26px; }
.metro-section-heading { margin-bottom: 20px; }
.metro-section-heading .hint { font-size: 10px; }
.metro-subdivisions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.metro-subdivisions button { display: flex; flex-direction: column; justify-content: center; gap: 7px; min-height: 67px; padding: 9px 3px; font-size: 10px; }
.metro-subdivision-marks { height: 18px; font-size: 13px; white-space: pre; }
.metro-change-hint { margin: 18px 0 0; font-size: 11px; }
.metro-sidebar .field { margin-bottom: 18px; }
.metro-sidebar .field select, .metro-sidebar .field input { width: 100%; min-width: 0; }
.metro-sidebar .hint, .metro-training .hint { font-size: 11px; line-height: 1.6; }
.metro-sidebar p:last-child { margin-bottom: 0; }
.metro-clock { font-size: 52px; font-weight: 400; text-align: center; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -2px; margin-top: 24px; }
.metro-clock-label { font-size: 11px; text-align: center; color: var(--muted); margin: 6px 0 22px; }
.metro-duration { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metro-timer progress { display: block; width: 100%; height: 4px; margin: 0 0 20px; accent-color: var(--accent); border: 0; border-radius: 2px; overflow: hidden; }
.metro-timer progress::-webkit-progress-bar { background: var(--line); }
.metro-timer progress::-webkit-progress-value { background: var(--accent); }
.metro-timer-presets { display: flex; gap: 6px; margin: 0 0 22px; }
.metro-timer-presets button { flex: 1; padding: 6px 3px; min-height: 34px; font-size: 10px; }
.metro-volume-label { display: flex; justify-content: space-between; }
.metro-volume-label output { color: var(--accent); }
.metro-training { padding: 0; }
.metro-training summary { cursor: pointer; padding: 20px 24px; font-size: 13px; }
.metro-training summary .hint { display: inline-block; margin-left: 10px; }
.metro-training>p, .metro-training-fields { margin: 0 24px 20px; }
.metro-training-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.metro-training-fields select { width: 100%; min-width: 0; }
.metro-footnote { text-align: center; color: var(--muted); font-size: 11px; margin: 26px 0 0; }
.metronome-page [hidden] { display: none !important; }
@media (max-width: 900px) {
  .metro-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
  .metro-console { padding-inline: 20px; }
  .metro-panel:not(.metro-console):not(.metro-training) { padding: 20px; }
  .metro-tempo { gap: 14px; }
  .metro-tempo-value input { width: 175px; font-size: 76px; }
  .metro-beats { grid-template-columns: repeat(auto-fit, minmax(55px, 1fr)); gap: 8px; }
}
@media (max-width: 760px) {
  .metro-layout { grid-template-columns: minmax(0, 1fr); }
  .metro-sidebar { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .metro-tempo-value input { width: 200px; font-size: 86px; }
}
@media (max-width: 520px) {
  .metronome-page { padding-inline: 17px; }
  .metronome-page .page-heading { margin-bottom: 24px; }
  .metro-console { padding: 20px 16px; }
  .metro-sidebar { grid-template-columns: minmax(0, 1fr); }
  .metro-tempo { gap: 12px; }
  .metro-tempo-value input { width: 154px; font-size: 76px; }
  .metro-step { width: 40px; height: 44px; }
  .metro-actions { grid-template-columns: minmax(0, 1fr) minmax(92px, .85fr) 44px; gap: 7px; }
  .metro-actions button { padding-inline: 8px; font-size: 12px; }
  .metro-beats { grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 8px; }
  .metro-beat { min-height: 95px; }
  .metro-meters { gap: 6px; }
  .metro-meters button { flex: 1 0 calc(25% - 6px); }
  .metro-section-heading .hint { max-width: 100px; text-align: right; }
  .metro-subdivisions { gap: 5px; }
  .metro-subdivisions button { font-size: 9px; }
  .metro-subdivision-marks { font-size: 11px; }
  .metro-meter select { min-width: 52px; font-size: 14px; }
  .metro-training summary { padding-inline: 18px; }
  .metro-training summary .hint { display: block; margin: 6px 0 0 17px; }
}
