#rhythm-topics{margin:20px 0 30px}.rm-topic-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.rm-topic-card{text-decoration:none;background:white;border:1px solid var(--line);border-radius:13px;padding:13px;color:var(--ink);transition:transform .15s,box-shadow .15s}.rm-topic-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px #203b4410}.rm-topic-art{height:54px;background:#edf6f0;color:#377b5b;border-radius:8px;margin-bottom:9px}.rm-topic-art svg{height:100%;width:100%;fill:currentColor}.rm-topic-card:nth-child(3n+2) .rm-topic-art{background:#eef2fb;color:#557ea9}.rm-topic-card:nth-child(3n) .rm-topic-art{background:#fbf0e4;color:#ac7841}.rm-topic-card h3{font-size:18px;line-height:1.35;margin:0 0 4px}.rm-topic-card p{font-size:13px;line-height:1.45;color:var(--muted);margin:0 0 8px}.rm-topic-card>span{display:flex;justify-content:space-between;font-size:12px}.rm-progress-panel{border:1px solid var(--line);border-radius:13px;padding:18px 22px;margin:20px 0 25px;background:#f0f6f2;position:relative}.rm-progress-heading,.rm-progress-bottom{display:flex;justify-content:space-between;align-items:center;gap:16px}.rm-progress-heading strong{font-size:15px}.rm-progress-heading button{font-size:11px;padding:6px 10px;min-height:36px}#chapter-progress{display:block;width:100%;height:11px;appearance:none;background:var(--rm-track);accent-color:var(--rm-accent);border:0;border-radius:10px;overflow:hidden;margin:16px 0}#chapter-progress::-webkit-progress-bar{background:var(--rm-track)}
#chapter-progress::-webkit-progress-value{border-radius:inherit;background:linear-gradient(90deg,var(--rm-highlight),var(--rm-accent))}
#chapter-progress::-moz-progress-bar{border-radius:inherit;background:linear-gradient(90deg,var(--rm-highlight),var(--rm-accent))}
.rm-progress-links{display:flex;flex-wrap:wrap;gap:8px}.rm-progress-links a{font-size:12px;text-decoration:none;min-height:34px;padding:7px 12px;border:1px solid #cfdbd3;border-radius:7px;background:white}.rm-progress-links .rm-done{background:var(--rm-track)}.rm-progress-links a[aria-current]{border-color:var(--rm-accent);box-shadow:0 0 0 1px var(--rm-accent)}.rm-progress-bottom{margin-top:12px}.rm-progress-bottom p{font-size:11px;max-width:550px}.rm-progress-bottom button{font-size:13px;flex-shrink:0}.rm-celebration{margin-top:16px;border-top:4px solid transparent;border-image:linear-gradient(90deg,#ed7a75,#e9b34d,#b6c955,#62b593,#629ad7,#a57acb) 1;padding:15px 0 0;color:#285e46}.rm-celebration>strong{display:block;font-size:17px}.rm-teaching-frame{background:white;border:1px solid #c9d9d2;border-radius:14px;padding:22px;margin:20px 0}.rm-score{width:100%;overflow-x:auto;min-height:100px;margin:15px 0;color:#253e43}.rm-score svg{display:block}.rm-score .abcjs-note,.rm-score .abcjs-rest{cursor:pointer;outline:none}.rm-score .rm-symbol-selected{color:#b85b22;fill:#b85b22!important}.rm-score g:focus-visible{outline:2px solid #a1862e}
@media(max-width:850px){.rm-topic-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.rm-progress-bottom{align-items:start;flex-wrap:wrap}}@media(max-width:520px){.rm-topic-grid{grid-template-columns:1fr}.rm-progress-panel,.rm-teaching-frame{padding:16px}.rm-progress-heading{align-items:start}.rm-progress-links{gap:5px}.rm-progress-links a{padding:7px 8px}}
@media(prefers-reduced-motion:reduce){.rm-topic-card{transition:none}.rm-topic-card:hover{transform:none}}
.rm-teaching-frame{display:flex;flex-direction:column;gap:14px;padding:20px;margin:20px 0}.rm-teaching-header{display:flex;justify-content:space-between;align-items:center;gap:15px}.rm-teaching-header h1{--page-title-size:1.6875rem;margin:0}.rm-teaching-header button{font-size:13px;flex-shrink:0}.rm-teaching-frame .rm-progress-panel{margin:0;padding:12px 15px;border:0;box-shadow:none;background:#f0f6f2}.rm-teaching-frame .rm-progress-heading strong{font-size:13px}.rm-teaching-frame #chapter-progress{margin:10px 0}.rm-teaching-frame .rm-progress-bottom{display:none}.rm-teaching-frame .rm-progress-links a{min-height:30px;padding:5px 10px}.rm-score{height:clamp(190px,28vh,330px);min-height:0;margin:0;overflow:hidden;display:flex;align-items:center;justify-content:center}.rm-score>div{width:100%!important;height:100%!important;padding-bottom:0!important;display:flex!important;align-items:center;justify-content:center}.rm-score svg{position:static!important;width:100%!important;height:100%!important;max-height:100%;overflow:visible}.rm-beat-count{font:14px system-ui;fill:#203b44}.rm-count-selected{fill:#b85b22;font-weight:700}.rm-teaching-nav{display:flex;align-items:center;justify-content:space-between;gap:16px;border-top:1px solid var(--line);padding-top:15px}.rm-teaching-nav button{font-size:16px;min-height:48px;min-width:135px}.rm-teaching-nav>span{font-size:13px;color:var(--muted);font-variant-numeric:tabular-nums}.rm-focus-mode{overflow:hidden}.rm-teaching-fullscreen,.rm-teaching-frame:fullscreen{position:fixed;inset:0;z-index:1000;background:#fff;box-sizing:border-box;width:100%;max-width:none;height:100vh;height:100dvh;margin:0;border:0;border-radius:0;padding:clamp(12px,2.5vw,36px);display:flex;flex-direction:column;gap:clamp(10px,2vh,22px);overflow:auto}.rm-teaching-fullscreen .rm-score{flex:1;height:auto;min-height:100px}.rm-teaching-fullscreen .rm-teaching-header h1{--page-title-size:clamp(1.5rem,3vw,2.625rem)}.rm-teaching-fullscreen .rm-teaching-nav button{font-size:clamp(16px,2vw,25px);padding:13px 25px;min-width:clamp(100px,20vw,250px)}.rm-teaching-fullscreen .rm-teaching-nav{flex-shrink:0}.rm-teaching-fullscreen #rm-progress-slot{flex-shrink:0}@media(max-width:520px){.rm-teaching-frame{padding:14px}.rm-teaching-header h1{--page-title-size:1.4375rem}.rm-teaching-nav{gap:8px}.rm-teaching-nav button{min-width:0;font-size:14px;padding:10px 12px}.rm-teaching-frame .rm-progress-links{gap:5px}.rm-teaching-frame .rm-progress-links a{padding:5px 7px;font-size:11px}.rm-teaching-fullscreen .rm-teaching-nav button{padding:12px;min-width:105px}.rm-score{height:190px}.rm-teaching-fullscreen .rm-score{height:auto}}
#rm-score:not([hidden]){padding:0!important;display:flex!important}
#rm-teaching-frame:not(.rm-teaching-fullscreen) #rm-score:not([hidden]){height:auto;min-height:0;display:block!important}
#rm-teaching-frame:not(.rm-teaching-fullscreen) #rm-score svg{display:block;width:100%!important;height:auto!important;max-height:none;position:static!important}

/* Same-origin Rhythm Master frame used inside other practice tools. */
.rhythm-embed .site-header, .rhythm-embed footer { display: none; }
.rhythm-embed .shell { padding-inline: clamp(.55rem, 2vw, 1.25rem); }
.rhythm-embed-frame { display: block; width: 100%; min-height: 24rem; height: 38rem; border: 1px solid var(--line, #cbded5); border-radius: .75rem; background: white; }
.rm-animation-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 12px; }
.rm-animation-controls button { font-size: 12px; min-height: 32px; padding: 5px 9px; }
#chapter-animation-select { width: auto; }

.rm-progress-panel {
  --rm-accent: #237455;
  --rm-highlight: #5fbf94;
  --rm-track: color-mix(in srgb, var(--rm-accent) 17%, white);
}
.rm-progress-panel[data-topic="eighth"] { --rm-accent: #235c9c; --rm-highlight: #66aaf2; }
.rm-progress-panel[data-topic="rests"] { --rm-accent: #85409c; --rm-highlight: #cd8de4; }
.rm-progress-panel[data-topic="dotted"] { --rm-accent: #a14912; --rm-highlight: #f0a357; }
.rm-progress-panel[data-topic="compound"] { --rm-accent: #157281; --rm-highlight: #61cbd3; }
.rm-progress-panel[data-topic="sixteenth"] { --rm-accent: #a32c58; --rm-highlight: #ed86af; }
.rm-progress-panel[data-topic="triplets"] { --rm-accent: #705b0f; --rm-highlight: #dfbd51; }
.rm-progress-panel[data-topic="cut"] { --rm-accent: #4e4ba7; --rm-highlight: #9499f3; }
.rm-progress-panel[data-topic="syncopation"] { --rm-accent: #9e302f; --rm-highlight: #f08073; }
.rm-progress-panel[data-topic="changing"] { --rm-accent: #436823; --rm-highlight: #9abc54; }
#chapter-progress { box-shadow: inset 0 0 0 1px #253e431c; }
.rm-chapter-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 8px;
  margin-top: 16px;
}
.rm-chapter-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-decoration: none;
}
.rm-chapter-link:hover { border-color: currentColor; }
.rm-chapter-link strong { flex-shrink: 0; }
.rm-chapter-link span { color: var(--muted); font-size: .875rem; }
.rm-teaching-header { flex-wrap: wrap; gap: 8px 15px; }
.rm-teaching-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.rm-teaching-actions button { min-height: 36px; padding: 6px 10px; }
.rm-score.rm-counts-hidden .rm-count-row { display: none; }
#teaching {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: clamp(8px, 2vw, 16px);
  min-height: 0;
}
#teaching h2 { flex-shrink: 0; font-size: 1rem; margin: 0 0 6px; text-align: center; }
#teaching-image {
  width: 100%;
  max-width: none;
  min-height: 0;
  max-height: 54dvh;
  object-fit: contain;
}
.rm-teaching-fullscreen #teaching { flex: 1; min-height: 100px; }
.rm-teaching-fullscreen #teaching-image { flex: 1; max-height: none; }
.rm-teaching-fullscreen .rm-castle-scene {
  --castle-width: clamp(86px, 21dvh, 176px);
  height: clamp(52px, 12dvh, 96px);
}

#practice {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: inherit;
  min-height: 0;
}
#rhythm-topics { margin: 0; }
#rhythm-topics .section-heading,
#rm-topic-chapters .library-heading { margin: 0 0 14px; }
#rhythm-topics h1 { margin: 0; }
#rm-topic-chapters .library-heading h1 { margin: 6px 0 0; }
#rm-topic-chapters .rm-chapter-list {
  grid-template-columns: 1fr;
  gap: 6px;
}
.rm-chapter-link::after {
  content: "→" / "";
  margin-inline-start: auto;
  align-self: center;
  color: var(--green);
}
.rm-chapter-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.rm-chapter-picker:hover { background: var(--paper); }
.rm-chapter-picker:focus-within { outline: 3px solid #ac922f; outline-offset: 3px; }
#rm-chapter-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
#rm-topics-back {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #b5c6bb;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
}
#rm-topics-back:hover { background: #edf3ec; }
.rm-teaching-header { flex-shrink: 0; }
@media (min-width: 960px) {
  #rhythm-topics .rm-topic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.rm-chapter-controls {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 6px;
}
.rm-teaching-frame .rm-icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  padding: 6px;
}
#rm-fullscreen[aria-pressed="false"] .rm-collapse-icon,
#rm-fullscreen[aria-pressed="true"] .rm-expand-icon { display: none; }

#rm-topic-size { color: var(--muted); font-size: 14px; }
.rhythm-credit{margin:30px 0 0;font-size:12px}
