.training-sections { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.is-rhythm main > :not(.training-sections):not(.rhythm-trainer):not(.mixer-control):not(.lite-pro-access) { display: none; }
.is-rhythm .mixer-control .drum-pattern-control, .is-rhythm .mixer-control .accompaniment-chord-control { display: none; }
main > .mixer-control { order: 0; margin-block: 14px; }
.rhythm-trainer { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--surface); }
.rhythm-trainer[hidden] { display: none; }
.rhythm-trainer__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.rhythm-trainer h2 { margin: 0; font-size: 1.2rem; }
.rhythm-trainer__header span, .rhythm-trainer__status, .rhythm-trainer__position { color: var(--muted); font-size: .8rem; }
.rhythm-trainer__settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.rhythm-trainer__views { margin-bottom: 16px; }
.rhythm-trainer__views button { min-height: 44px; }
.rhythm-presets { margin-bottom: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-strong); }
.rhythm-presets__fields { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.rhythm-presets p { margin: 12px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.rhythm-trainer__dice[hidden], .rhythm-presets[hidden], .rhythm-trainer__settings > [hidden] { display: none; }
.rhythm-cell.is-bar-start { border-left-width: 3px; }
@media (max-width: 480px) { .rhythm-presets__fields { grid-template-columns: 1fr; gap: 10px; } }
.rhythm-trainer [data-rhythm-duration-control][hidden] { display: none; }
.rhythm-trainer [data-rhythm-duration-control] { margin-top: 14px; }
.rhythm-trainer fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.rhythm-trainer legend, .rhythm-trainer .field__label { display: block; margin-bottom: 6px; color: var(--muted); font-size: .8rem; }
.rhythm-trainer .segmented-control { display: flex; }
.rhythm-trainer .segmented-control button { flex: 1 1 0; min-width: 0; padding-inline: 0; }
.rhythm-trainer__levels { margin-bottom: 16px; }
.rhythm-trainer__levels button { min-height: 44px; }
.rhythm-trainer__advanced { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 16px; }
.rhythm-trainer__advanced[hidden] { display: none; }
.rhythm-trainer__advanced > .field { min-width: 0; }
.rhythm-trainer__advanced > label[hidden] { display: none; }
.rhythm-trainer__advanced p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .75rem; }
.rhythm-trainer select { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-strong); color: var(--text); font-size: .85rem; }
.rhythm-trainer select:disabled { opacity: .45; }
.rhythm-trainer__transport { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-top: 18px; }
.rhythm-trainer .tempo-stepper { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.rhythm-trainer__click { display: flex; align-items: center; gap: 8px; font-size: .85rem; cursor: pointer; }
.rhythm-trainer__click input { width: 18px; height: 18px; accent-color: var(--accent); }
.rhythm-trainer__metronome { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; max-width: 100%; }
.rhythm-trainer .rhythm-trainer__beats { width: max-content; max-width: 100%; flex: 0 0 auto; flex-wrap: wrap; }
.rhythm-trainer .rhythm-trainer__beats button { flex: 0 0 36px; width: 36px; min-height: 36px; }
.rhythm-trainer__beats button.is-accent { box-shadow: inset 0 -3px 0 currentColor; font-weight: 700; }
.rhythm-trainer[data-rhythm-level="advanced"] .rhythm-trainer__metronome { flex: 0 1 360px; }
.rhythm-trainer__metronome-modes { flex-basis: 100%; }
.rhythm-trainer .rhythm-trainer__metronome-modes button { min-height: 36px; padding: 4px; font-size: .75rem; line-height: 1.2; white-space: normal; }
.rhythm-trainer__metronome-modes[hidden], .rhythm-trainer__metronome-modes button[hidden], .rhythm-trainer__counting[hidden] { display: none; }
.rhythm-trainer__counting { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.rhythm-trainer .rhythm-accompaniment { margin-top: 16px; }
.rhythm-accompaniment__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.rhythm-accompaniment .rhythm-trainer__click { gap: 6px; min-height: 36px; font-size: .8rem; white-space: nowrap; }
.rhythm-accompaniment input { width: 16px; height: 16px; }
.rhythm-accompaniment__chord { display: flex; align-items: center; gap: 6px; }
.rhythm-accompaniment__drums { display: flex; align-items: center; gap: 6px; }
.rhythm-accompaniment__drums select { width: 162px; min-height: 36px; padding: 6px; }
.rhythm-accompaniment__chord select { width: 60px; min-height: 36px; padding: 6px; }
.rhythm-accompaniment__chord select:last-child { width: 72px; }
.rhythm-trainer__position { margin: 20px 0 8px; }
.rhythm-trainer__pattern-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.rhythm-trainer__pattern-header .rhythm-trainer__position { flex: 1 1 130px; min-width: 0; margin: 0; }
.rhythm-trainer__random-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.rhythm-trainer__random-controls .rhythm-trainer__dice { margin-left: 0; }
.rhythm-trainer__dice { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 8px; min-height: 44px; margin-left: auto; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-strong); color: var(--text); font: inherit; font-size: .8rem; font-weight: 600; white-space: nowrap; cursor: pointer; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease; }
.rhythm-trainer__dice svg { width: 24px; height: 24px; overflow: visible; stroke: currentColor; stroke-width: 1.5; }
.rhythm-trainer__dice rect { fill: var(--surface-strong); }
.rhythm-trainer__dice circle { fill: currentColor; stroke: none; }
.rhythm-trainer__dice:hover, .rhythm-trainer__dice.is-active { color: var(--accent-strong); border-color: var(--accent); }
.rhythm-trainer__dice:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface-strong)); }
.rhythm-trainer__dice:active { transform: translateY(2px); background: var(--accent); color: var(--accent-text); border-color: var(--accent); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .25); }
.rhythm-trainer__dice:active rect { fill: var(--accent); }
.rhythm-trainer__dice g { transform-box: fill-box; transform-origin: center; }
.rhythm-trainer__dice.is-rolling .rhythm-trainer__die--back { animation: rhythm-die-back 500ms ease-in-out; }
.rhythm-trainer__dice.is-rolling .rhythm-trainer__die--front { animation: rhythm-die-front 500ms ease-in-out; }
@keyframes rhythm-die-back { 0%, 100% { transform: none; } 30% { transform: translate(-2px, -1px) rotate(-16deg); } 65% { transform: translate(1px, 1px) rotate(12deg); } }
@keyframes rhythm-die-front { 0%, 100% { transform: none; } 30% { transform: translate(2px, 1px) rotate(16deg); } 65% { transform: translate(-1px, -1px) rotate(-12deg); } }
@media (prefers-reduced-motion: reduce) { .rhythm-trainer__dice { transition: none; } .rhythm-trainer__dice.is-rolling .rhythm-trainer__die--back, .rhythm-trainer__dice.is-rolling .rhythm-trainer__die--front { animation: none; } }
.rhythm-notation { margin-bottom: 8px; color: var(--text); overflow-x: auto; }
.rhythm-notation svg { display: block; width: 100%; height: auto; max-height: 112px; fill: currentColor; }
.rhythm-notation line { stroke: currentColor; stroke-width: 1.2; }
.rhythm-notation__staff { opacity: .4; stroke-width: .8 !important; }
.rhythm-notation .rhythm-notation__beam { stroke-width: 3; }
.rhythm-notation__stroke { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.rhythm-notation__clef { font-family: "Noto Music", "Segoe UI Symbol", serif; font-size: 34px; }
.rhythm-notation .is-current { color: var(--accent-strong); fill: currentColor; }
.rhythm-timeline { max-width: 100%; overflow-x: auto; }
.rhythm-beat-numbers { position: relative; height: 20px; min-width: calc(var(--rhythm-visible-steps, 16) * 18px); margin-bottom: 5px; color: var(--accent-strong); font-size: .8rem; font-weight: 600; }
.rhythm-beat-numbers span { position: absolute; transform: translateX(-50%); }
.rhythm-trainer[data-rhythm-level="advanced"] .rhythm-beat-numbers span:not(.is-group-start) { color: var(--muted); }
.rhythm-trainer[data-rhythm-level="advanced"] .rhythm-beat-numbers .is-group-start { font-weight: 700; }
.rhythm-grid { display: grid; grid-template-columns: repeat(var(--rhythm-steps, 16), minmax(0, 1fr)); min-width: calc(var(--rhythm-visible-steps, 16) * 18px); gap: 4px; }
.rhythm-grid.is-mixed { column-gap: 0; }
.rhythm-grid.is-mixed .rhythm-cell { margin-right: 3px; }
.rhythm-cell { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; padding: 8px 0; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-strong); color: var(--muted); font-size: .8rem; }
.rhythm-cell.is-beat-start { border-left: 2px solid var(--accent); }
.rhythm-cell i { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.rhythm-cell.has-note { color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.rhythm-cell.has-note i { background: var(--accent); }
.rhythm-cell.is-held { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.rhythm-cell.is-held i { width: 100%; height: 2px; margin: 3px 0; border-radius: 0; background: var(--accent); }
.rhythm-cell.is-current { outline: 2px solid var(--focus); outline-offset: -2px; }
.rhythm-cell.is-current.has-note { background: var(--accent); color: var(--accent-text); }
.rhythm-cell.is-current.has-note i { background: var(--accent-text); }
.rhythm-trainer__status { min-height: 1.5em; margin: 10px 0 16px; }
.rhythm-trainer__play { width: 100%; min-height: 44px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--accent-text); font-weight: 700; cursor: pointer; }
.rhythm-trainer.is-playing .rhythm-trainer__play { background: var(--surface-strong); color: var(--accent-strong); }
.rhythm-trainer__play:disabled { opacity: .5; cursor: default; }
.rhythm-trainer__lock { display: none; margin: 10px 0 0; font-size: .8rem; color: var(--muted); text-align: center; }
.penta-lite .rhythm-trainer__lock { display: block; }
@media (max-width: 480px) {
  .rhythm-trainer { padding: 14px; }
  .rhythm-trainer__header { gap: 8px; }
  .rhythm-trainer h2 { font-size: 1.05rem; }
  .rhythm-trainer__header span { font-size: .72rem; }
  .rhythm-trainer__settings { gap: 10px; }
  .rhythm-trainer [data-rhythm-sound] { font-size: .75rem; }
  .rhythm-beat-numbers, .rhythm-grid { gap: 2px; }
  .rhythm-cell { border-radius: 4px; font-size: .6rem; }
  .rhythm-cell i { width: 6px; height: 6px; }
}


@media (max-width: 560px) {
  .rhythm-trainer[data-rhythm-bars="1"] .rhythm-beat-numbers,
  .rhythm-trainer[data-rhythm-bars="1"] .rhythm-grid { min-width: 0; }
  .rhythm-trainer[data-rhythm-bars="1"] .rhythm-cell i { max-width: 100%; }
}

.rhythm-editor[hidden], .rhythm-trainer.is-manual > .rhythm-notation, .rhythm-trainer.is-manual > .rhythm-timeline { display: none; }
.rhythm-editor { min-width: 0; margin-top: 16px; }
.rhythm-editor button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-strong); color: var(--text); font: inherit; font-size: .78rem; cursor: pointer; touch-action: manipulation; }
.rhythm-editor button:hover, .rhythm-editor button:focus-visible { border-color: var(--accent); }
.rhythm-editor button:active { transform: translateY(1px); }
.rhythm-editor button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rhythm-editor button:disabled { opacity: .35; cursor: default; }
.rhythm-editor__toolbar, .rhythm-editor__durations, .rhythm-editor__modifiers, .rhythm-editor__entry, .rhythm-editor__actions, .rhythm-editor__actions > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.rhythm-editor__toolbar { align-items: stretch; gap: 12px; }
.rhythm-editor__durations { flex: 1 1 260px; flex-wrap: nowrap; }
.rhythm-editor__durations button, .rhythm-editor__modifiers button { flex: 1 1 0; flex-direction: column; gap: 0; min-width: 34px; padding: 3px 5px; font-size: 1.3rem; }
.rhythm-editor__modifiers { flex: 0 1 100px; flex-wrap: nowrap; }
.rhythm-editor button small { font-size: .62rem; line-height: 1.4; }
.rhythm-editor__glyph { font-family: "Bravura", "Noto Music", "Segoe UI Symbol", serif; font-size: 25px; line-height: 33px; }
.rhythm-editor__entry { margin-top: 12px; }
.rhythm-editor__entry label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .75rem; }
.rhythm-editor__entry input { width: 54px; min-height: 38px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-strong); color: var(--text); font: inherit; text-align: center; }
.rhythm-editor__actions { justify-content: space-between; margin-top: 12px; }
.rhythm-editor__actions > div:first-child button { min-width: 38px; font-size: 1.1rem; }
.rhythm-editor__help, .rhythm-editor__hint { margin: 12px 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.rhythm-editor__hint { min-height: 1.5em; }
.rhythm-editor__score { display: grid; gap: 12px; min-width: 0; }
.rhythm-editor__bar { min-width: 0; padding: 10px 0 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-strong); overflow: hidden; }
.rhythm-editor__bar-title { padding-inline: 12px; color: var(--muted); font-size: .72rem; }
.rhythm-editor__bar-scroll { overflow-x: auto; }
.rhythm-editor__bar svg { display: block; max-width: none; }
.rhythm-editor [data-editor-hit] { cursor: crosshair; pointer-events: all; stroke: transparent; }
.rhythm-editor [data-editor-hit]:hover { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.rhythm-editor__cursor { fill: color-mix(in srgb, var(--accent) 20%, transparent); stroke: var(--accent); stroke-width: 1; pointer-events: none; }
.rhythm-editor [data-editor-hit]:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.rhythm-editor g.is-current { color: var(--accent); fill: var(--accent); }
.rhythm-editor [data-editor-hit].is-current { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
@media (max-width: 480px) {
  .rhythm-trainer__views button { font-size: .72rem; }
  .rhythm-editor__toolbar { gap: 8px; }
  .rhythm-editor__durations { flex-basis: 100%; }
  .rhythm-editor__modifiers { flex-basis: 100px; }
  .rhythm-editor__actions > div:last-child { gap: 5px; }
  .rhythm-editor__actions button { padding: 6px 8px; font-size: .7rem; }
  .rhythm-editor__entry { gap: 5px; }
  .rhythm-editor__entry button { flex: 1 1 auto; }
}

.rhythm-groove { margin-top: 14px; padding: 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--surface-strong)); }
.rhythm-groove[hidden] { display: none; }
.rhythm-groove__controls { display: grid; grid-template-columns: minmax(100px, 180px) auto; justify-content: start; align-items: end; gap: 10px; }
.rhythm-groove__controls .field { min-width: 0; }
.rhythm-groove__controls .rhythm-trainer__dice { min-height: 44px; margin: 0; }
.rhythm-groove > p { margin: 10px 0 0; line-height: 1.5; text-transform: none; letter-spacing: normal; }
@media (max-width: 560px) { .rhythm-groove__controls { grid-template-columns: minmax(0, 1fr) auto; } }
@media (max-width: 380px) { .rhythm-groove__controls { grid-template-columns: minmax(0, 1fr); } }

.rhythm-groove__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.rhythm-groove__header h3 { margin: 0; font-size: .95rem; line-height: 1.4; }
.rhythm-groove__help { position: relative; flex: 0 0 auto; }
.rhythm-groove__help summary { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); font-weight: 700; cursor: pointer; list-style: none; }
.rhythm-groove__help summary::-webkit-details-marker { display: none; }
.rhythm-groove__help summary:hover, .rhythm-groove__help[open] summary { color: var(--accent); border-color: var(--accent); }
.rhythm-groove__help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rhythm-groove__help-content { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(320px, calc(100vw - 96px)); padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-strong); color: var(--text); box-shadow: 0 8px 24px #0006; font-size: .8rem; font-weight: 400; line-height: 1.55; }
.rhythm-groove__help-content p { margin: 0; }
.rhythm-groove__help-content p + p { margin-top: 10px; }

.rhythm-groove__help[hidden] { display: none; }
