:root {
  --text: #6b6375;
  --text-h: #08060d;
  --bg: #fff;
  --border: #e5e4e7;
  --code-bg: #f4f3ec;
  --accent: #aa3bff;
  --accent-bg: rgba(170, 59, 255, 0.1);
  --accent-border: rgba(170, 59, 255, 0.5);
  --social-bg: rgba(244, 243, 236, 0.5);
  --shadow:
    rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;

  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --heading: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 18px/145% var(--sans);
  letter-spacing: 0.18px;
  color-scheme: light dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  @media (max-width: 1024px) {
    font-size: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #9ca3af;
    --text-h: #f3f4f6;
    --bg: #16171d;
    --border: #2e303a;
    --code-bg: #1f2028;
    --accent: #c084fc;
    --accent-bg: rgba(192, 132, 252, 0.15);
    --accent-border: rgba(192, 132, 252, 0.5);
    --social-bg: rgba(47, 48, 58, 0.5);
    --shadow:
      rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
  }

  #social .button-icon {
    filter: invert(1) brightness(2);
  }
}

body {
  margin: 0;
}

#root {
  width: 1126px;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  border-inline: 1px solid var(--border);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

h1,
h2 {
  font-family: var(--heading);
  font-weight: 500;
  color: var(--text-h);
}

h1 {
  font-size: 56px;
  letter-spacing: -1.68px;
  margin: 32px 0;
  @media (max-width: 1024px) {
    font-size: 36px;
    margin: 20px 0;
  }
}
h2 {
  font-size: 24px;
  line-height: 118%;
  letter-spacing: -0.24px;
  margin: 0 0 8px;
  @media (max-width: 1024px) {
    font-size: 20px;
  }
}
p {
  margin: 0;
}

code,
.counter {
  font-family: var(--mono);
  display: inline-flex;
  border-radius: 4px;
  color: var(--text-h);
}

code {
  font-size: 15px;
  line-height: 135%;
  padding: 4px 8px;
  background: var(--code-bg);
}
.app {
  width: 100%;
  max-width: min(1200px, calc(100vw - 1.25rem));
  margin: 0 auto;
  padding: 0.65rem clamp(0.65rem, 2vw, 1.25rem);
  display: grid;
  gap: 0.65rem;
  color: #1f2937;
  box-sizing: border-box;
}

.child-practice-sync-status {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.app-footer-sync-status {
  margin: 10px auto 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

.app-footer-sync-status .child-practice-sync-status {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #dbe3ef;
  background: #f1f5f9;
  color: #64748b;
}

.app-footer-sync-status .child-practice-sync-status--synced {
  color: #166534;
  background: #ecfdf5;
  border-color: rgba(22, 101, 52, 0.22);
}

.app-footer-sync-status .child-practice-sync-status--warning,
.app-footer-sync-status .child-practice-sync-status--waiting {
  color: #9a3412;
  background: #fffbeb;
  border-color: rgba(180, 83, 9, 0.28);
}

.app-footer-sync-status .child-practice-sync-status--syncing,
.app-footer-sync-status .child-practice-sync-status--saved {
  color: #475569;
  background: #f1f5f9;
  border-color: rgba(71, 85, 105, 0.22);
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 28rem;
  display: grid;
  gap: 0.7rem;
}

/* Login card is always light; global `h1` uses `--text-h` which is light in dark mode. */
.auth-card h1 {
  margin: 0 0 0.35rem;
  color: #111827;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: clamp(1.45rem, 4.2vw, 1.85rem);
  line-height: 1.2;
}

.auth-subtitle {
  margin: 0;
  color: #4b5563;
}

.auth-setup-message {
  margin: 0;
  padding: 0.55rem;
  border-radius: 8px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.95rem;
  line-height: 1.4;
}

.auth-form {
  display: grid;
  gap: 0.45rem;
}

.auth-form label {
  font-weight: 400;
  color: #1f2937;
}

.auth-form input {
  min-height: 44px;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  padding: 0 0.6rem;
  font-size: 1rem;
  color: #111827;
  background: #ffffff;
}

.auth-submit-button {
  margin-top: 0.2rem;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-error {
  margin: 0;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.5rem;
  line-height: 1.35;
}

.auth-status {
  width: 100%;
  max-width: min(1200px, calc(100vw - 1.25rem));
  margin: 0.5rem auto 0;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.auth-status-main {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.auth-status-email {
  margin: 0;
  color: #374151;
  font-size: 0.9rem;
}

.auth-status-warning {
  margin: 0;
  color: #92400e;
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-status-ok {
  margin: 0;
  color: #166534;
  font-size: 0.84rem;
  line-height: 1.35;
}

.auth-status-actions {
  display: inline-flex;
}

.auth-status-button {
  min-height: 36px;
  border: none;
  border-radius: 8px;
  padding: 0 0.75rem;
  background: #374151;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.auth-status-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.sync-status-panel {
  width: 100%;
  max-width: min(1200px, calc(100vw - 1.25rem));
  margin: 0.35rem auto 0;
  padding: 0.65rem 0.75rem;
}

.sync-status-panel h2 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
}

.sync-status-grid {
  display: grid;
  gap: 0.2rem;
}

.sync-status-grid p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
  color: #374151;
}

.sync-status-actions {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.sync-status-actions button {
  min-height: 38px;
  width: fit-content;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  background: #f9fafb;
  color: #1f2937;
  font-weight: 600;
  padding: 0 0.7rem;
  cursor: pointer;
}

.sync-status-actions button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.sync-status-muted {
  margin: 0;
  font-size: 0.83rem;
  color: #4b5563;
}

.sync-status-error {
  margin: 0;
  font-size: 0.83rem;
  color: #b91c1c;
}

.sync-status-ok {
  color: #2a6b30;
  font-weight: 500;
}

.sync-status-warn {
  color: #7a5800;
  font-weight: 500;
}

/* ── Curriculum queue section inside SyncStatusPanel ─────────────────────── */
.sync-status-curriculum {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
}

.sync-status-curriculum__heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #374151;
}

.sync-status-error-list {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.83rem;
  color: #b91c1c;
}

.sync-prep-panel {
  width: 100%;
  max-width: min(1200px, calc(100vw - 1.25rem));
  margin: 0.35rem auto 0;
  padding: 0.65rem 0.75rem;
}

.admin-tools-dashboard {
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

.admin-tool-section {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  text-align: left;
}

.admin-tool-section-summary {
  cursor: pointer;
  list-style: none;
  padding: 0.6rem 0.75rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: #1f2937;
  text-align: left;
}

.admin-tool-section-summary::-webkit-details-marker {
  display: none;
}

.admin-tool-section-body {
  border-top: 1px solid #e5e7eb;
  padding: 0.6rem 0.7rem 0.65rem;
  display: grid;
  gap: 0.55rem;
  text-align: left;
}

.admin-health-grid {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  text-align: left;
}

.admin-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-start;
}

.admin-tools-dashboard > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.24rem;
  font-weight: 700;
  text-align: left;
}

.admin-tools-dashboard .sync-prep-list-block,
.admin-tools-dashboard .sync-prep-status-list,
.admin-tools-dashboard .sync-prep-user-grid,
.admin-tools-dashboard .sync-prep-user-card,
.admin-tools-dashboard .sync-prep-seed-results,
.admin-tools-dashboard .sync-status-panel,
.admin-tools-dashboard .sync-status-grid,
.admin-tools-dashboard .sync-status-actions,
.admin-tools-dashboard .progress-backup-panel,
.admin-tools-dashboard .progress-backup-summary,
.admin-tools-dashboard .progress-backup-actions,
.admin-tools-dashboard .progress-backup-import-options,
.admin-tools-dashboard .progress-backup-preview,
.admin-tools-dashboard .music-data-check-card,
.admin-tools-dashboard .music-data-check,
.admin-tools-dashboard .music-data-grid,
.admin-tools-dashboard .music-data-row,
.admin-tools-dashboard .user-profile-debug-card,
.admin-tools-dashboard .user-profile-debug-body,
.admin-tools-dashboard .user-profile-debug-dl,
.admin-tools-dashboard .user-profile-debug-row {
  text-align: left;
}

.admin-tools-dashboard .sync-prep-list-block h3,
.admin-tools-dashboard .sync-status-panel h2,
.admin-tools-dashboard .progress-backup-panel > h2,
.admin-tools-dashboard .music-data-check-toggle,
.admin-tools-dashboard .user-profile-debug-toggle {
  font-weight: 700;
}

.admin-tools-dashboard .sync-prep-list-block h3 {
  font-size: 1.02rem;
}

.two-hand-test-lab-wrap {
  padding-top: 0.55rem;
}

.two-hand-test-lab {
  margin: 0;
  padding: 0.75rem;
}

.two-hand-test-lab > h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.two-hand-test-lab-note {
  margin: 0 0 0.65rem;
  color: #334155;
  font-size: 0.88rem;
}

.two-hand-test-lab-grid {
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.two-hand-test-lab-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 0.5rem;
  align-items: start;
}

.two-hand-test-lab-row dt {
  font-weight: 700;
  color: #1f2937;
}

.two-hand-test-lab-row dd {
  margin: 0;
  color: #0f172a;
}

.two-hand-test-lab-actions {
  margin-top: 0.7rem;
}

.number-stepper {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.number-stepper-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #334155;
}

.number-stepper-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.number-stepper-button {
  height: 2.6rem;
  width: 2.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
}

.number-stepper-button:disabled {
  opacity: 0.55;
}

.number-stepper-value {
  height: 2.6rem;
  width: clamp(4.5rem, 18vw, 5.2rem);
  padding: 0 0.35rem;
  border: 1px solid #dbe2ea;
  border-radius: 9px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.number-stepper__controls {
  display: inline-grid;
  grid-template-columns: 42px minmax(64px, 82px) 42px;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
}

.number-stepper__button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  touch-action: manipulation;
}

.number-stepper__value {
  min-width: 64px;
  max-width: 82px;
  width: auto;
  height: 42px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-prep-panel h2 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.sync-prep-status-list {
  display: grid;
  gap: 0.2rem;
  margin: 0 0 0.55rem;
}

.sync-prep-status-list p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.35;
}

.sync-prep-list-block {
  margin: 0.55rem 0 0;
  padding-top: 0.45rem;
  border-top: 1px solid #e5e7eb;
}

.sync-prep-list-block h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: #1f2937;
}

.sync-prep-list-block ul {
  margin: 0;
  padding-left: 1.1rem;
}

.sync-prep-list-block li {
  margin: 0.15rem 0;
  font-size: 0.84rem;
  line-height: 1.35;
  color: #374151;
}

.sync-prep-note {
  margin: 0;
  font-size: 0.83rem;
  color: #4b5563;
  line-height: 1.35;
}

.sync-prep-warning {
  color: #92400e;
}

.sync-prep-ok {
  color: #166534;
}

.sync-prep-user-grid {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.sync-prep-user-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  padding: 0.45rem 0.5rem;
  display: grid;
  gap: 0.18rem;
}

.sync-prep-user-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.3;
  color: #374151;
}

.sync-prep-actions {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.35rem;
}

.sync-prep-actions button {
  min-height: 38px;
  width: fit-content;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  background: #f9fafb;
  color: #1f2937;
  font-weight: 600;
  padding: 0 0.7rem;
  cursor: pointer;
}

.sync-prep-actions button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.sync-prep-file-label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
  width: fit-content;
  font-size: 0.84rem;
  color: #374151;
}

.sync-prep-file-label input[type='file'] {
  font-size: 0.82rem;
}

.sync-prep-checkbox-row {
  margin-top: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: #374151;
}

.sync-prep-checkbox-row input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
}

.sync-prep-seed-results {
  margin-top: 0.5rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  display: grid;
  gap: 0.2rem;
}

.sync-prep-seed-results p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.sync-prep-seed-results h4 {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  color: #1f2937;
}

.sync-prep-seed-results button {
  margin-top: 0.25rem;
  min-height: 36px;
  width: fit-content;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  background: #f9fafb;
  color: #1f2937;
  font-weight: 600;
  padding: 0 0.65rem;
  cursor: pointer;
}

.sync-prep-seed-results ul {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
}

.account-profile-gate {
  min-height: calc(100vh - 5rem);
  display: grid;
  place-items: center;
  padding: 0.75rem;
  box-sizing: border-box;
}

.account-profile-card {
  width: 100%;
  max-width: 34rem;
  display: grid;
  gap: 0.6rem;
}

.account-profile-card h2,
.account-profile-card p {
  margin: 0;
}

.account-profile-gate-button {
  min-height: 42px;
  width: fit-content;
  border: none;
  border-radius: 8px;
  background: #1d4ed8;
  color: #ffffff;
  font-weight: 600;
  padding: 0 0.8rem;
  cursor: pointer;
}

.account-profile-gate-error {
  margin: 0;
  color: #b91c1c;
  font-size: 0.84rem;
}

.user-profile-locked-note {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #4b5563;
}

/* Title card (left) + welcome card (right) on wide screens */
.app-top-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: stretch;
  min-width: 0;
}

.app-top-row .app-header {
  min-width: 0;
}

.app-top-row .welcome-panel {
  min-width: 0;
}

@media (min-width: 768px) {
  .app-top-row {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 12px;
  }

  .app-top-row .welcome-panel {
    margin: 0;
    max-width: none;
  }
}

.welcome-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
}

.welcome-panel__message-row {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.welcome-panel-title,
.welcome-panel__title {
  margin: 0;
  line-height: 1;
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.welcome-panel-message,
.welcome-panel__phrase {
  margin: 0;
  line-height: 1;
  font-size: 0.95rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.welcome-panel__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  justify-self: end;
  flex-shrink: 0;
}

.welcome-panel-signout,
.welcome-panel__signout {
  justify-self: end;
  align-self: center;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 0;
  padding: 7px 14px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.welcome-panel-signout:hover,
.welcome-panel__signout:hover {
  background: #f1f5f9;
}

.welcome-panel-signout:disabled,
.welcome-panel__signout:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

@media (max-width: 380px) {
  .welcome-panel__message-row {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  .welcome-panel-message,
  .welcome-panel__phrase {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
}

.card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Top header cards: equal height, compact, beat global `.card` on this row */
.app-top-row > .app-header.app-header--compact.app-title-card.card,
.app-top-row > .welcome-panel.card {
  box-sizing: border-box;
  min-height: 52px;
  padding: 6px 14px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.app-top-row > .app-header.app-header--compact.app-title-card.card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #e9fff6 55%, #fff3df 100%);
  border: 1px solid rgba(135, 156, 205, 0.35);
}

.app-top-row > .welcome-panel.card {
  background: #fafbfc;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.app-header h1 {
  margin: 0;
  font-size: 2rem;
  color: #111827;
}

.app-header--compact {
  padding: 0;
}

/* Override global index.css `h1` (large size / letter-spacing / margins) for title card */
.app-top-row .app-header.app-title-card h1,
.app-header.app-title-card h1 {
  margin: 0;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(95deg, #4f46e5 0%, #0d9488 42%, #c026d3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  text-rendering: geometricPrecision;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 1024px) {
  .app-top-row .app-header.app-title-card h1,
  .app-header.app-title-card h1 {
    font-size: 1.3rem;
    letter-spacing: -0.03em;
  }
}

/* Welcome colour themes (class set once per sign-in in App.jsx) */
.app-top-row > .welcome-panel.welcome-panel--theme-blue .welcome-panel__title,
.app-top-row > .welcome-panel.welcome-panel--theme-blue .welcome-panel-title {
  color: #1d4ed8;
}

.app-top-row > .welcome-panel.welcome-panel--theme-blue .welcome-panel__phrase,
.app-top-row > .welcome-panel.welcome-panel--theme-blue .welcome-panel-message {
  color: #475569;
}

.app-top-row > .welcome-panel.welcome-panel--theme-blue.card {
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
  border-color: rgba(29, 78, 216, 0.22);
}

.app-top-row > .welcome-panel.welcome-panel--theme-green .welcome-panel__title,
.app-top-row > .welcome-panel.welcome-panel--theme-green .welcome-panel-title {
  color: #047857;
}

.app-top-row > .welcome-panel.welcome-panel--theme-green .welcome-panel__phrase,
.app-top-row > .welcome-panel.welcome-panel--theme-green .welcome-panel-message {
  color: #4b5563;
}

.app-top-row > .welcome-panel.welcome-panel--theme-green.card {
  background: linear-gradient(180deg, #fbfffd 0%, #f0fdf7 100%);
  border-color: rgba(4, 120, 87, 0.22);
}

.app-top-row > .welcome-panel.welcome-panel--theme-orange .welcome-panel__title,
.app-top-row > .welcome-panel.welcome-panel--theme-orange .welcome-panel-title {
  color: #c2410c;
}

.app-top-row > .welcome-panel.welcome-panel--theme-orange .welcome-panel__phrase,
.app-top-row > .welcome-panel.welcome-panel--theme-orange .welcome-panel-message {
  color: #5b4b36;
}

.app-top-row > .welcome-panel.welcome-panel--theme-orange.card {
  background: linear-gradient(180deg, #fffdfb 0%, #fff7ed 100%);
  border-color: rgba(194, 65, 12, 0.2);
}

.app-top-row > .welcome-panel.welcome-panel--theme-rose .welcome-panel__title,
.app-top-row > .welcome-panel.welcome-panel--theme-rose .welcome-panel-title {
  color: #be185d;
}

.app-top-row > .welcome-panel.welcome-panel--theme-rose .welcome-panel__phrase,
.app-top-row > .welcome-panel.welcome-panel--theme-rose .welcome-panel-message {
  color: #52525b;
}

.app-top-row > .welcome-panel.welcome-panel--theme-rose.card {
  background: linear-gradient(180deg, #fffafc 0%, #fdf2f8 100%);
  border-color: rgba(190, 24, 93, 0.2);
}

.app-top-row > .welcome-panel.welcome-panel--theme-indigo .welcome-panel__title,
.app-top-row > .welcome-panel.welcome-panel--theme-indigo .welcome-panel-title {
  color: #4338ca;
}

.app-top-row > .welcome-panel.welcome-panel--theme-indigo .welcome-panel__phrase,
.app-top-row > .welcome-panel.welcome-panel--theme-indigo .welcome-panel-message {
  color: #475569;
}

.app-top-row > .welcome-panel.welcome-panel--theme-indigo.card {
  background: linear-gradient(180deg, #fafbff 0%, #eef2ff 100%);
  border-color: rgba(67, 56, 202, 0.22);
}

.stage-label {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  color: #4b5563;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.card h2 {
  color: #111827;
}

.status-text {
  margin: 0;
}

.status-ok {
  margin: 0.5rem 0 0;
  color: #166534;
  font-weight: 600;
}

.status-muted {
  margin: 0.5rem 0 0;
  color: #4b5563;
}

.status-error {
  margin: 0.5rem 0 0;
  color: #b91c1c;
  font-weight: 600;
}

.status-warn {
  margin: 0.5rem 0 0;
  color: #b45309;
  font-weight: 600;
}

/* Compact MIDI panel (Status + Controls + Key state) */
.midi-panel-card {
  padding: 0.55rem 0.65rem;
}

.midi-panel-title {
  margin: 0;
  font-size: 1.1rem;
  color: #111827;
  flex: 0 0 auto;
}

.midi-panel-row--compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem 0.45rem;
}

.midi-panel-status {
  flex: 0 1 auto;
  margin: 0;
  max-width: 100%;
  font-size: 0.88rem;
  line-height: 1.35;
  color: #374151;
}

.midi-panel-connect {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 0.65rem;
}

.midi-panel-input-group {
  flex: 1 1 13rem;
  min-width: 0;
  max-width: 100%;
}

.midi-panel-select-with-selected {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
}

.midi-panel-select {
  flex: 1 1 13rem;
  min-width: min(100%, 11rem);
  max-width: 100%;
  box-sizing: border-box;
  min-height: 48px;
}

.midi-panel-error {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.midi-panel-key {
  margin: 0;
  flex: 0 0 auto;
}

.midi-panel-active-notes {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  word-break: break-word;
}

.midi-panel-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.music-data-check-card {
  padding: 0.5rem 0.65rem;
}

/* Phase 14 — Progress backup panel polish */
.progress-backup-panel {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
}

.progress-backup-panel > h2 {
  margin: 0;
  font-size: 1.05rem;
}

.progress-backup-panel > p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #374151;
}

.progress-backup-summary {
  display: grid;
  gap: 0.3rem;
  margin: 0;
  padding: 0.5rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
  min-width: 0;
}

.progress-backup-summary p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.3;
  word-break: break-word;
}

.progress-backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: stretch;
}

.progress-backup-actions button {
  flex: 1 1 11rem;
  min-width: min(100%, 10.5rem);
  min-height: 46px;
  padding: 0.28rem 0.65rem;
  font-size: 0.93rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #9ca3af;
  color: #ffffff;
  background: #1d4ed8;
  cursor: pointer;
}

.progress-backup-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.progress-backup-import-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.7rem;
  padding: 0.42rem 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  min-width: 0;
}

.progress-backup-import-options p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: #374151;
}

.progress-backup-import-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  font-size: 0.86rem;
  color: #1f2937;
  min-width: 0;
}

.progress-backup-import-options input[type='radio'] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.progress-backup-message {
  margin: 0.25rem 0 0;
  padding: 0.36rem 0.45rem;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.32;
}

.progress-backup-warning {
  margin: 0;
  padding: 0.45rem 0.52rem;
  border-radius: 8px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  display: grid;
  gap: 0.32rem;
  min-width: 0;
}

.progress-backup-warning p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.35;
}

.progress-backup-warning label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  min-height: 40px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.progress-backup-preview {
  margin: 0;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.progress-backup-preview h3 {
  margin: 0 0 0.1rem;
  font-size: 0.92rem;
  color: #1e3a8a;
}

.progress-backup-preview p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.3;
  word-break: break-word;
}

.progress-backup-preview button {
  margin-top: 0.2rem;
  min-height: 46px;
  width: 100%;
  padding: 0.28rem 0.65rem;
  font-size: 0.93rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  color: #ffffff;
  background: #1d4ed8;
  cursor: pointer;
}

.progress-backup-preview button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (min-width: 768px) {
  .progress-backup-actions button {
    flex: 0 1 auto;
    min-width: 12.5rem;
  }

  .progress-backup-preview button {
    width: fit-content;
    min-width: 12rem;
  }
}

.music-data-check-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  color: #111827;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
}

.music-data-check-toggle:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.music-data-check-chevron {
  color: #6b7280;
  font-weight: 400;
}

.music-data-check-body {
  margin-top: 0.45rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
}

.controls {
  display: grid;
  gap: 0.75rem;
  align-items: center;
}

.connect-button,
select {
  min-height: 48px;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid #9ca3af;
  padding: 0 0.75rem;
}

.connect-button {
  background: #1d4ed8;
  color: #ffffff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.connect-button:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.audio-controls {
  margin-top: 0.75rem;
}

.web-audio-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.5rem;
}

.web-audio-status-card .web-audio-state-text {
  margin: 0;
  font-size: 0.95rem;
  flex: 0 1 auto;
}

.web-audio-status-card .web-audio-hint-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  flex: 1 1 12rem;
  min-width: 0;
}

.web-audio-status-line .status-ok,
.web-audio-status-line .status-muted {
  margin: 0;
}

.audio-controls--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
  margin-top: 0.35rem;
}

.audio-controls--inline .connect-button {
  flex: 1 1 auto;
  min-width: min(10rem, 100%);
  min-height: 48px;
}

@media (min-width: 900px) {
  .web-audio-status-card .audio-controls--inline {
    flex-wrap: nowrap;
  }

  .web-audio-status-card .audio-controls--inline .connect-button {
    flex: 1 1 0;
    min-width: 0;
  }
}

.selected-input,
.active-notes,
.empty-state {
  margin: 0.75rem 0 0;
}

.key-indicator {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
}

.key-indicator.up {
  background: #e5e7eb;
  color: #374151;
}

.key-indicator.down {
  background: #dcfce7;
  color: #166534;
}

.message-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.message-list li {
  display: grid;
  gap: 0.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.75rem;
  background: #f9fafb;
}

.midi-messages-card .message-list--compact {
  gap: 0;
  max-height: 11rem;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fafafa;
}

.midi-messages-card .message-list--compact li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  padding: 0.28rem 0.45rem;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  background: transparent;
  font-size: 0.82rem;
  line-height: 1.25;
}

.midi-messages-card .message-list--compact li:last-child {
  border-bottom: none;
}

.midi-messages-card .midi-msg-type {
  font-weight: 700;
  min-width: 4.25rem;
}

.midi-messages-card .midi-msg-note {
  font-weight: 600;
  color: #1d4ed8;
}

.midi-messages-card .midi-msg-meta {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  flex: 1 1 auto;
  min-width: 0;
}

.midi-messages-card .empty-state--compact {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.music-data-check .music-data-grid {
  display: grid;
  gap: 0.5rem;
}

.music-data-check .music-data-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.music-data-check .music-data-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.music-data-check .music-data-row-full {
  grid-template-columns: 1fr;
}

.music-data-check .music-data-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.95rem;
}

.music-data-check .music-data-value {
  color: #1f2937;
  font-size: 0.95rem;
  word-break: break-word;
}

@media (min-width: 700px) {
  .app {
    padding: 1.5rem;
  }

  .controls {
    grid-template-columns: 220px 1fr;
  }

  .controls label {
    grid-column: 1 / -1;
  }

  .music-data-check .music-data-row:not(.music-data-row-full) {
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 0.75rem;
  }

  .music-data-check .music-data-row-full .music-data-value {
    padding-left: 0;
  }
}

/* Stage 6 — User profile panel (readable on dark page background) */
.user-profile-panel {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  text-align: left;
}

.user-profile-panel--compact {
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.user-profile-panel-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  color: #111827;
}

.user-profile-panel-title--inline {
  margin: 0;
  flex: 0 0 auto;
  font-size: 0.92rem;
  line-height: 1.2;
}

.user-profile-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.user-profile-toolbar--single-row {
  flex: 1 1 14rem;
  min-width: 0;
}

.user-profile-active-select--compact {
  flex: 1 1 12rem;
  min-width: 0;
  min-height: 44px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #9ca3af;
  padding: 0.35rem 0.5rem;
  color: #111827;
  background: #ffffff;
  box-sizing: border-box;
}

.user-profile-add-bottom {
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  border-style: dashed;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.user-profile-add-bottom-toggle {
  width: 100%;
  min-height: 44px;
  padding: 0.35rem 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.user-profile-add-bottom-toggle:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.user-profile-add-bottom .user-profile-inline-add {
  margin-top: 0.4rem;
}

.user-profile-inline-add {
  margin-top: 0.45rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  display: grid;
  gap: 0.4rem;
}

.user-profile-new-name-input--compact {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid #9ca3af;
  padding: 0.35rem 0.5rem;
}

.user-profile-inline-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.user-profile-save-user-button {
  min-height: 44px;
  padding: 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: #1d4ed8;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.user-profile-cancel-button {
  min-height: 44px;
  padding: 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  background: #e5e7eb;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.user-profile-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.user-profile-debug-card {
  padding: 0.5rem 0.65rem;
}

.user-profile-debug-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  color: #111827;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
}

.user-profile-debug-toggle:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.user-profile-debug-chevron {
  color: #6b7280;
  font-weight: 400;
}

.user-profile-debug-body {
  margin-top: 0.45rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
}

.user-profile-debug-dl {
  margin: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.user-profile-debug-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}

.user-profile-debug-row dt {
  margin: 0;
  font-weight: 600;
  color: #4b5563;
}

.user-profile-debug-row dd {
  margin: 0;
  color: #111827;
  font-variant-numeric: tabular-nums;
  text-align: right;
  word-break: break-all;
}

/* Stage 7 Chord Trainer — compact layout for iPad landscape + desktop */
.chord-trainer-panel {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 0.4rem 0.5rem 0.45rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  text-align: left;
}

.chord-trainer-panel h2 {
  color: #111827;
  margin: 0 0 0.16rem;
  font-size: 1.08rem;
  line-height: 1.15;
}

/* Stage 9 — MIDI target radio in panel title (compact, shared name with Scale Trainer) */
.trainer-panel-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-height: 0;
  font-size: 1.08rem;
  line-height: 1.15;
}

.trainer-panel-title-label {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
  color: #111827;
}

.trainer-panel-title-label input[type='radio'] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin: 0;
  accent-color: #4f46e5;
  vertical-align: middle;
}

.trainer-panel-title-label:focus-within {
  outline: none;
}

.trainer-panel-title-label:focus-within input[type='radio'] {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.trainer-panel-title-text {
  display: inline;
  font-weight: inherit;
}

.chord-trainer-panel h3 {
  color: #111827;
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
}

.chord-trainer-controls {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  margin: 0.16rem 0 0.2rem;
}

.chord-trainer-controls-primary,
.chord-trainer-controls-secondary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.28rem 0.4rem;
  min-width: 0;
}

.chord-trainer-field {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}

.chord-trainer-field > label:first-child,
.chord-trainer-panel .chord-trainer-field > label[for] {
  font-weight: 600;
  color: #374151;
  font-size: 0.8rem;
  line-height: 1.2;
}

.chord-trainer-panel fieldset.chord-trainer-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 0.18rem 0.35rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.22rem 0.32rem 0.28rem;
  margin: 0;
  min-width: 0;
}

.chord-trainer-panel fieldset.chord-trainer-field legend {
  font-weight: 600;
  color: #374151;
  font-size: 0.78rem;
  line-height: 1.2;
  padding: 0 0.15rem;
  flex: 1 0 100%;
  width: 100%;
}

.chord-trainer-panel fieldset.chord-trainer-field label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: #1f2937;
  margin: 0;
  min-height: 40px;
  padding: 0.1rem 0.22rem;
  flex: 1 1 auto;
  min-width: min(7.5rem, 100%);
  cursor: pointer;
  box-sizing: border-box;
}

.chord-trainer-panel fieldset.chord-trainer-field input[type='checkbox'],
.chord-trainer-panel fieldset.chord-trainer-field input[type='radio'] {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.chord-trainer-field--hand-radios label,
.chord-trainer-field--display-mode label {
  min-height: 40px;
}

.chord-display-options.chord-trainer-field--display-mode {
  gap: 0.15rem 0.3rem;
}

.chord-display-option {
  min-width: min(7rem, 100%);
}

/* ---------- Chord type multi-select dropdown ---------- */
.chord-type-dropdown {
  position: relative;
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.chord-type-dropdown-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chord-type-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-height: 38px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-strong, #9ca3af);
  background: #fff;
  color: var(--text-main, #111827);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.chord-type-dropdown-trigger:focus-visible {
  outline: 2px solid var(--blue, #2563eb);
  outline-offset: 1px;
}

.chord-type-dropdown-summary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.chord-type-dropdown-caret {
  font-size: 0.7rem;
  color: var(--text-muted, #6b7280);
  flex: 0 0 auto;
}

.chord-type-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0.15rem;
  padding: 0.45rem 0.55rem;
  background: #fff;
  border: 1px solid var(--border-strong, #9ca3af);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  max-width: 100%;
  box-sizing: border-box;
}

.chord-type-dropdown-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  font-size: 0.85rem;
  color: var(--text-main, #111827);
  cursor: pointer;
  padding: 0.1rem 0.15rem;
  border-radius: 4px;
  white-space: nowrap;
}

.chord-type-dropdown-row:hover {
  background: var(--blue-soft, #eef2ff);
}

.chord-type-dropdown-row > input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--blue, #2563eb);
  flex: 0 0 auto;
}

.chord-trainer-panel select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  font-size: 0.92rem;
  line-height: 1.25;
  color: #111827;
  background: #ffffff;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
}

.chord-trainer-message {
  margin: 0.2rem 0;
  padding: 0.32rem 0.42rem;
  border-radius: 8px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Chord Trainer inactive (MIDI routed to Scale) — matches Scale Trainer paused banner look */
.chord-trainer-banner {
  margin: 0.12rem 0 0.22rem;
}

.chord-trainer-banner--paused {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.chord-trainer-question-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
  margin: 0.16rem 0 0.2rem;
  min-width: 0;
  align-items: start;
}

.chord-trainer-question-main {
  min-width: 0;
}

.chord-trainer-question-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  width: 100%;
}

.chord-trainer-question-row .chord-trainer-question,
.chord-trainer-question-row .chord-question-card {
  margin: 0;
}

.chord-trainer-question,
.chord-question-card {
  margin: 0.18rem 0;
  padding: 0.45rem 0.55rem 0.5rem;
  border-radius: 10px;
  border: 2px solid #c7d2fe;
  background: #eef2ff;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.chord-trainer-question-row .chord-trainer-question {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  box-sizing: border-box;
}

.chord-trainer-question-content {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 0.28rem 0.65rem;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

.chord-trainer-question-content .chord-trainer-question-main-text {
  margin: 0;
  flex: 0 1 auto;
  justify-content: center;
  min-width: 0;
}

.chord-trainer-question-subtext {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  text-align: center;
  font-size: clamp(0.92rem, 2vw, 1.08rem);
  font-weight: 500;
  line-height: 1.22;
  color: #4338ca;
}

.chord-question-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem 0.65rem;
  margin: 0;
}

.chord-question-main--name,
.chord-question-main--roman {
  justify-content: center;
}

.chord-question-main--both {
  gap: 0.45rem 0.85rem;
  /* Roman size in "Both"; chord name uses calc(var * 1.5) so name is 1.5x roman. */
  --chord-roman-fs: clamp(1.85rem, 4.8vw, 2.85rem);
}

/* Chord-question card: 3 stacked rows — title, notation, footer.
   Each row is a normal flex-column child, no fixed heights, no absolute
   positioning. The card hugs its content. */
.chord-trainer-question,
.chord-question-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chord-question-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.65rem;
  width: 100%;
  min-width: 0;
  text-align: center;
  margin: 0;
}

.chord-question-notation-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: visible;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.chord-question-notation-row .staff-display {
  background: transparent;
  /* Clear the inline minHeight the renderer sets so the wrapper hugs the SVG
     instead of holding open a fixed gap. */
  min-height: 0 !important;
  overflow: visible !important;
}

.chord-question-notation-row .staff-display svg {
  display: block;
  background: transparent;
  overflow: visible;
}

/* Footer row: subtitle right-aligned, normal flow (NOT absolute over staff). */
.chord-question-footer-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.chord-question-footer-row > .chord-question-subtitle {
  margin: 0;
  text-align: right;
  font-size: 0.78rem;
  line-height: 1.2;
  opacity: 0.85;
}

@media (max-width: 640px) {
  .chord-question-footer-row {
    justify-content: center;
  }
  .chord-question-footer-row > .chord-question-subtitle {
    text-align: center;
  }
}

.chord-name-large {
  font-size: clamp(3.2rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1;
  color: #1e1b4b;
  letter-spacing: -0.02em;
}

.chord-question-main--both .chord-name-large.chord-roman {
  font-size: var(--chord-roman-fs);
}

.chord-question-main--both .chord-name-large:not(.chord-roman) {
  font-size: calc(var(--chord-roman-fs) * 1.5);
}

.chord-roman.chord-name-large {
  font-weight: 800;
}

.chord-question-subtitle {
  margin: 0;
  font-weight: 600;
  color: #4338ca;
  line-height: 1.28;
  text-align: center;
}

.chord-question-subtitle.chord-trainer-question-subtext {
  font-weight: 500;
  line-height: 1.22;
}

.chord-trainer-feedback-inline {
  margin: 0.2rem 0 0;
  text-align: center;
  font-size: clamp(0.8rem, 1.9vw, 0.95rem);
  font-weight: 700;
  line-height: 1.3;
  color: #312e81;
}

.chord-question-placeholder {
  margin: 0.15rem 0 0;
  text-align: center;
}

.chord-trainer-question.chord-trainer-question--wrong {
  background: #fef2f2;
  border-color: #f87171;
}

.chord-trainer-question.chord-trainer-question--wrong .chord-name-large,
.chord-trainer-question.chord-trainer-question--wrong .chord-question-subtitle,
.chord-trainer-question.chord-trainer-question--wrong .chord-trainer-question-subtext,
.chord-trainer-question.chord-trainer-question--wrong .chord-trainer-feedback-inline {
  color: #991b1b;
}

.chord-trainer-question.correct {
  background: #dcfce7;
  border-color: #22c55e;
}

.chord-trainer-question.correct .chord-name-large,
.chord-trainer-question.correct .chord-question-subtitle,
.chord-trainer-question.correct .chord-trainer-question-subtext,
.chord-trainer-question.correct .chord-trainer-feedback-inline {
  color: #14532d;
}

.chord-trainer-answer-controls {
  margin: 0;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: stretch;
  width: 100%;
}

.chord-trainer-answer-controls button {
  min-height: 52px;
  min-width: 0;
  width: 100%;
  font-size: 0.98rem;
  font-weight: 600;
  color: #ffffff;
  background: #1d4ed8;
  border: none;
  border-radius: 8px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  flex: 0 0 auto;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chord-trainer-answer-controls button:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.chord-trainer-next-button {
  background: #ffffff;
  color: #1d4ed8;
  border: 2px solid #1d4ed8;
}

.chord-trainer-next-button:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.chord-trainer-answer {
  margin-top: 0.25rem;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
}

.chord-trainer-inline-answer {
  margin: 0;
  padding: 0.32rem 0.42rem;
  max-height: min(52vh, 20rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chord-trainer-inline-answer h3 {
  margin: 0 0 0.18rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.chord-trainer-answer p {
  margin: 0.14rem 0;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.3;
}

.chord-trainer-inline-answer p {
  margin: 0.08rem 0;
  font-size: 0.78rem;
  line-height: 1.28;
  color: #334155;
}

.chord-trainer-answer strong {
  color: #0f172a;
}

.chord-trainer-inline-answer strong {
  color: #0f172a;
  font-weight: 600;
}

.chord-trainer-answer-beside-diagram.chord-trainer-inline-answer {
  max-height: min(42vh, 18rem);
}

/* Tablet+: Root / Scale / Mode on one row */
@media (min-width: 600px) {
  .chord-trainer-controls-primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.3rem 0.45rem;
  }

  .chord-trainer-panel fieldset.chord-trainer-field label {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* iPad landscape + desktop: second row = positions | hand | display in three columns */
@media (min-width: 768px) {
  .chord-trainer-question-row {
    grid-template-columns: minmax(0, 1fr) minmax(12rem, 16rem);
    column-gap: 0.65rem;
    row-gap: 0.45rem;
    margin: 0.12rem 0 0.18rem;
    align-items: start;
  }

  .chord-trainer-question-row .chord-trainer-question {
    min-height: 0;
    padding: clamp(0.5rem, 1.2vw, 0.75rem) clamp(0.65rem, 1.6vw, 0.9rem);
  }

  .chord-trainer-question-content {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(0.75rem, 2.2vw, 1.2rem);
  }

  .chord-trainer-question-content .chord-trainer-question-main-text {
    align-items: baseline;
  }

  .chord-trainer-question-content .chord-trainer-question-subtext {
    width: auto;
    max-width: min(38%, 14rem);
    text-align: left;
    align-self: flex-end;
    line-height: 1.18;
    margin-bottom: 0.2rem;
  }

  .chord-trainer-panel {
    padding: 0.45rem 0.55rem 0.5rem;
  }

  .chord-trainer-controls-secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.28rem 0.4rem;
    align-items: stretch;
  }

  .chord-trainer-controls-secondary .chord-trainer-field {
    min-height: 100%;
  }

  .chord-trainer-panel fieldset.chord-trainer-field {
    flex-direction: row;
    flex-wrap: nowrap;
    padding: 0.2rem 0.28rem 0.26rem;
  }

  .chord-trainer-panel fieldset.chord-trainer-field legend {
    flex: 1 0 100%;
  }

  .chord-trainer-panel fieldset.chord-trainer-field label {
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
  }

  .chord-display-options.chord-trainer-field--display-mode {
    gap: 0.12rem 0.25rem;
  }

  .chord-display-option {
    min-width: 0;
    flex: 1 1 auto;
  }
}

@media (min-width: 900px) {
  .chord-trainer-panel {
    padding: 0.48rem 0.6rem 0.52rem;
  }
}

@media (max-width: 599px) {
  .chord-trainer-panel fieldset.chord-trainer-field label {
    flex: 1 1 100%;
  }
}

/* Tighter gap before embedded Chord Progress inside trainer panel */
.chord-trainer-panel .chord-progress-section {
  margin: 0.35rem 0 0.2rem;
}

/* Chord progress bars (Stage 8) — reusable; not tied to ChordTrainer layout */
.chord-progress-section {
  margin: 0.65rem 0;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  max-width: 100%;
  box-sizing: border-box;
}

.chord-progress-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
}

.chord-progress-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #374151;
  line-height: 1.25;
}

.progress-panel-title,
.chord-progress-header h2.progress-panel-title,
.chord-progress-header h3.progress-panel-title,
.scale-progress-header h2.progress-panel-title,
.scale-progress-header h3.progress-panel-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.progress-panel-top-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  min-width: min(100%, 17rem);
}

.progress-panel-stats {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.28rem;
  min-width: min(100%, 18.5rem);
}

.progress-panel-stat-pill {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.38rem 0.72rem;
  white-space: nowrap;
  box-sizing: border-box;
}

.progress-panel-stat-label {
  font-size: 0.875rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  font-weight: 600;
  color: #0f172a;
}

.progress-panel-stat-value {
  font-size: clamp(0.9rem, 1.55vw, 0.98rem);
  line-height: 1.2;
  color: #0b1220;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-panel-stat-line {
  display: inline-flex;
  align-items: baseline;
  gap: 0.14rem;
}

.chord-progress-header--trainer {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
}

.chord-progress-header--trainer h2 {
  flex: 0 1 auto;
  min-width: 0;
}

.chord-progress-session-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1rem;
  margin: 0;
  font-size: clamp(0.92rem, 2vw, 1.08rem);
  line-height: 1.3;
  color: #374151;
  flex: 1 1 auto;
  justify-content: center;
  min-width: min(100%, 12rem);
}

.chord-progress-session-stat {
  white-space: nowrap;
}

.chord-progress-session-stat strong {
  color: #1f2937;
  font-weight: 700;
}

.chord-progress-session-stat-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #111827;
}

.chord-progress-header--trainer .chord-progress-toggle-row {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: min(100%, 10.5rem);
}

@media (min-width: 720px) {
  .chord-progress-header--trainer {
    flex-wrap: nowrap;
  }

  .chord-progress-session-stats {
    flex: 0 1 auto;
    justify-content: flex-start;
    min-width: 0;
  }

  .chord-progress-header--trainer .chord-progress-toggle-row {
    flex: 0 0 auto;
    min-width: 0;
  }
}

.chord-progress-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.chord-progress-toggle {
  min-width: 5rem;
  min-height: 32px;
  padding: 0.2rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chord-progress-toggle:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.chord-progress-toggle:active {
  transform: scale(0.98);
}

.chord-progress-toggle-active,
.chord-progress-toggle-active:hover {
  border-color: #172554;
  background: #1e3a8a;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(23, 37, 84, 0.45);
}

/* Compact horizontal bar chart — all chords visible in one band */
.chord-progress-chart {
  margin-top: 0.5rem;
  padding: 0.45rem 0.3rem 0.35rem;
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.chord-progress-grid {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.3rem 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.chord-progress-y-axis {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}

.chord-progress-y-axis-spacer {
  flex-shrink: 0;
  height: calc(1.15rem + 0.12rem);
}

.chord-progress-y-axis-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 6.75rem;
  padding-right: 0.35rem;
  border-right: 1px solid #e5e7eb;
  box-sizing: border-box;
}

.chord-progress-y-tick {
  font-size: 0.65rem;
  line-height: 1;
  color: #9ca3af;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.chord-progress-columns-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: visible;
}

.chord-progress-bars.chord-progress-columns {
  list-style: none;
  margin: 0;
  padding: 0 0.05rem 0.1rem 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  column-gap: 0.28rem;
  row-gap: 0.35rem;
  width: 100%;
  min-width: 0;
  align-items: end;
  box-sizing: border-box;
}

.chord-progress-column {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.chord-progress-column-pct {
  font-size: 0.72rem;
  line-height: 1.15;
  min-height: 1.15rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #4b5563;
}

.chord-progress-column-bar,
.chord-progress-bar-track {
  width: 100%;
  max-width: 100%;
  height: 6.75rem;
  margin: 0.12rem 0 0.28rem;
  position: relative;
  background-color: #e5e7eb;
  background-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(50% - 0.5px),
    rgba(255, 255, 255, 0.65) calc(50% - 0.5px),
    rgba(255, 255, 255, 0.65) calc(50% + 0.5px),
    transparent calc(50% + 0.5px),
    transparent 100%
  );
  border-radius: 7px;
  overflow: hidden;
  box-sizing: border-box;
}

.chord-progress-column-fill,
.chord-progress-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, #4f46e5, #a5b4fc);
  border-radius: 0 0 5px 5px;
  min-height: 0;
  transition: height 0.25s ease;
}

.chord-progress-column-label {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  color: #1f2937;
  word-break: break-word;
  max-width: 100%;
  hyphens: auto;
}

.chord-progress-column-meta {
  margin-top: 0.12rem;
  font-size: 0.68rem;
  line-height: 1.2;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.chord-progress-empty {
  margin: 0.65rem 0 0.15rem;
  padding: 0.55rem 0.5rem;
  font-size: 0.98rem;
  line-height: 1.4;
  color: #6b7280;
  background: #ffffff;
  border-radius: 8px;
  border: 1px dashed #d1d5db;
}

@media (min-width: 600px) {
  .chord-progress-bars.chord-progress-columns {
    column-gap: 0.38rem;
    row-gap: 0.4rem;
  }

  .chord-progress-column-bar,
  .chord-progress-bar-track {
    height: 7.25rem;
  }

  .chord-progress-y-axis-labels {
    height: 7.25rem;
  }
}

/* Last-resort horizontal scroll only on very narrow widths */
@media (max-width: 319px) {
  .chord-progress-columns-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .chord-progress-bars.chord-progress-columns {
    min-width: 16.5rem;
  }

  .chord-progress-column-pct {
    font-size: 0.65rem;
  }

  .chord-progress-column-label {
    font-size: 0.74rem;
  }

  .chord-progress-column-meta {
    font-size: 0.62rem;
  }
}

/* Stage 9 — Scale Trainer panel (Chord Trainer–like, touch-friendly) */
.scale-trainer-panel {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  color: #1f2937;
  text-align: left;
}

.scale-trainer-panel.card {
  padding: 0.4rem 0.5rem 0.45rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.scale-trainer-panel h2 {
  margin: 0 0 0.14rem;
  font-size: 1.06rem;
  line-height: 1.15;
  color: #111827;
}

.scale-trainer-banner {
  margin: 0.12rem 0 0.22rem;
}

.scale-trainer-banner--paused {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.scale-trainer-quarter-note-note {
  margin: 0 0 0.28rem;
  padding: 0.28rem 0.4rem;
  font-size: 0.78rem;
  line-height: 1.32;
  color: #1e3a8a;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

/* Stage 11 — Scale Trainer metronome + timing feedback */
.metronome-controls {
  margin: 0.12rem 0 0.22rem;
  padding: 0.45rem 0.5rem 0.5rem;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  display: grid;
  gap: 0.45rem;
}

.metronome-controls-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.22rem;
}

.metronome-controls-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #111827;
}

.metronome-use-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.metronome-use-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: #4f46e5;
}

.metronome-status-msg {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.32;
  color: #4b5563;
}

.metronome-status-msg--warn {
  color: #92400e;
  font-weight: 600;
}

/* Compact single-row layout for all metronome controls */
.metronome-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
}

.metronome-controls-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.38rem 0.45rem;
}

.metronome-controls-section--final-feedback {
  background: #fcfcff;
}

.metronome-section-title {
  margin: 0 0 0.32rem;
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 700;
  color: #1f2937;
}

.metronome-settings-grid {
  display: grid;
  gap: 0.3rem;
  grid-template-columns: auto auto auto auto auto auto;
  align-items: end;
  justify-content: flex-start;
}

.metronome-setting-field {
  display: grid;
  gap: 0.14rem;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #374151;
}

.metronome-setting-field input {
  width: auto;
  min-height: 30px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid #9ca3af;
  padding: 0.1rem 0.3rem;
  background: #ffffff;
  color: #111827;
  box-sizing: border-box;
}

.metronome-setting-field select {
  width: auto;
  min-height: 30px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid #9ca3af;
  padding: 0.1rem 0.3rem;
  background: #ffffff;
  color: #111827;
  box-sizing: border-box;
}

.metronome-setting-field input:disabled,
.metronome-setting-field select:disabled {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #d1d5db;
  opacity: 1;
  cursor: not-allowed;
}

.metronome-controls-section--exercise {
  background: #f8fbff;
}

.metronome-exercise-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: flex-end;
}

.metronome-setting-field--exercise-picker {
  width: min(11rem, 100%);
}

.metronome-setting-field--start .metronome-toggle-button {
  width: auto;
}

.metronome-setting-field--bpm input,
.metronome-setting-field--accuracy input,
.metronome-setting-field--tolerance input {
  width: 84px;
}

.metronome-setting-field--signature select {
  width: 104px;
}

.metronome-setting-field--sound select {
  width: 176px;
}

.metronome-exercise-grid .metronome-setting-field input {
  width: 102px;
}

.metronome-exercise-grid .metronome-setting-field--exercise-picker select {
  width: 150px;
}

.metronome-setting-field--wide {
  grid-column: span 2;
}

.metronome-exercise-timer-status {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #334155;
  font-weight: 600;
}

.metronome-exercise-ladder-status {
  color: #1e3a8a;
}

.metronome-exercise-lock-msg {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  line-height: 1.25;
  font-weight: 600;
  color: #6b7280;
}

.metronome-setting-field small {
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.2;
}

.metronome-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.3rem;
}

/* Inline label + narrow number input pairs */
.metronome-inline-field {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.metronome-inline-field input {
  width: 3.5rem;
  min-height: 32px;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid #9ca3af;
  padding: 0.12rem 0.3rem;
  background: #ffffff;
  color: #111827;
  caret-color: #111827;
  box-sizing: border-box;
}

.metronome-inline-field input::placeholder {
  color: #6b7280;
}

.metronome-controls-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.metronome-toggle-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0.15rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.metronome-toggle-button--start {
  background: #1d4ed8;
}

.metronome-toggle-button--stop {
  background: #b91c1c;
}

.metronome-toggle-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.exercise-mode-free {
  background: #eff6ff;
  border-color: #dbeafe;
}

.exercise-mode-timed {
  background: #f0fdf4;
  border-color: #dcfce7;
}

.exercise-mode-beat-ladder {
  background: #fffbeb;
  border-color: #fef3c7;
}

.exercise-mode-time-ladder {
  background: #f5f3ff;
  border-color: #ede9fe;
}

.exercise-mode-streak-goal {
  background: #fff7ed;
  border-color: #ffedd5;
}

.metronome-beat-indicator {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: #4338ca;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metronome-beat-indicator--exercise {
  align-self: end;
  padding-bottom: 0.2rem;
}

/* Session average accuracy — compact inline pill */
.metronome-avg-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Average accuracy pill colour modifiers — same pass/near/fail palette as timing feedback */
.metronome-avg-pill--neutral {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.metronome-avg-pill--pass {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.metronome-avg-pill--near {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.metronome-avg-pill--fail {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
}

/* Stage 12 — auto BPM progression info pills */
.metronome-stage12-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.22rem 0.32rem;
  border-radius: 8px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.metronome-stage12-pill--neutral {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.metronome-stage12-pill.metronome-avg-pill--pass {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.metronome-stage12-pill.metronome-avg-pill--near {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.metronome-stage12-pill.metronome-avg-pill--fail {
  background: #fef2f2;
  border-color: #f87171;
  color: #b91c1c;
}

/* Per-scale timing feedback — slim coloured message below the row */
.metronome-timing-feedback {
  margin: 0;
  padding: 0.22rem 0.4rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.metronome-final-feedback-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.metronome-final-feedback-row .metronome-section-title {
  margin: 0;
  flex: 0 0 auto;
}

.metronome-final-feedback-row .metronome-timing-feedback,
.metronome-final-feedback-row .metronome-status-msg {
  flex: 0 1 auto;
  max-width: min(100%, 52rem);
}

@media (max-width: 680px) {
  .metronome-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metronome-settings-grid .metronome-setting-field input,
  .metronome-settings-grid .metronome-setting-field select,
  .metronome-exercise-grid .metronome-setting-field input,
  .metronome-exercise-grid .metronome-setting-field select {
    width: 100%;
  }

  .metronome-exercise-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metronome-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Stage 13 — small iPad/medium landscape touch polish for metronome controls */
@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {
  .metronome-controls {
    gap: 0.55rem;
    padding: 0.5rem 0.55rem 0.55rem;
  }

  .metronome-controls-section {
    padding: 0.45rem 0.5rem;
  }

  .metronome-settings-grid,
  .metronome-exercise-grid {
    gap: 0.38rem;
    min-width: 0;
  }

  .metronome-setting-field {
    gap: 0.18rem;
    font-size: 0.76rem;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .metronome-setting-field input,
  .metronome-setting-field select {
    min-height: 36px;
    font-size: 0.84rem;
    padding: 0.14rem 0.35rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .metronome-toggle-button {
    min-height: 38px;
    font-size: 0.86rem;
    padding: 0.2rem 0.8rem;
  }

  .scale-trainer-controls .chord-trainer-field,
  .scale-trainer-controls .scale-trainer-select,
  .scale-trainer-panel .chord-trainer-controls-primary,
  .scale-trainer-panel .chord-trainer-controls-secondary {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .scale-trainer-controls .scale-trainer-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Keep adjacent piano keys visually separated on iPad Safari/MidiWeb. */
  .piano-white-key {
    position: relative;
  }

  .piano-white-key::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: var(--piano-white-h);
    background: rgba(15, 23, 42, 0.2);
    pointer-events: none;
    z-index: 3;
  }

  .piano-white-key:last-child::after {
    display: none;
  }

  .piano-white-key-surface {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
  }

  .piano-black-key-surface {
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.16),
      0 0 0 1px rgba(15, 23, 42, 0.22);
  }
}

/* Green: score met or exceeded threshold */
.metronome-timing-feedback--pass {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

/* Amber: within 75 % of threshold */
.metronome-timing-feedback--near {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

/* Red: below 75 % of threshold */
.metronome-timing-feedback--fail {
  border-color: #f87171;
  background: #fef2f2;
  color: #b91c1c;
}

.scale-trainer-panel .chord-trainer-controls {
  gap: 0.14rem;
  margin: 0.08rem 0 0.12rem;
}

.scale-trainer-controls .chord-trainer-controls-primary,
.scale-trainer-controls .chord-trainer-controls-secondary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.22rem 0.32rem;
  min-width: 0;
}

.scale-trainer-panel .chord-trainer-field {
  gap: 0.1rem;
}

.scale-trainer-panel .chord-trainer-field > label:first-child,
.scale-trainer-panel .chord-trainer-field > label[for] {
  font-size: 0.76rem;
}

.scale-trainer-panel fieldset.chord-trainer-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 0.08rem 0.28rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.12rem 0.26rem 0.16rem;
  margin: 0;
  min-width: 0;
}

.scale-trainer-panel fieldset.chord-trainer-field legend {
  font-weight: 600;
  color: #374151;
  font-size: 0.72rem;
  line-height: 1.15;
  padding: 0 0.1rem;
  flex: 1 0 100%;
  width: 100%;
}

.scale-trainer-panel fieldset.chord-trainer-field label {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.82rem;
  color: #1f2937;
  margin: 0;
  min-height: 34px;
  padding: 0.04rem 0.12rem;
  flex: 1 1 auto;
  min-width: min(4.5rem, 100%);
  cursor: pointer;
  box-sizing: border-box;
}

.scale-trainer-panel fieldset.chord-trainer-field input[type='radio'] {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.scale-trainer-select,
.scale-trainer-panel select.scale-trainer-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  font-size: 0.9rem;
  line-height: 1.2;
  color: #111827;
  background: #ffffff;
  border: 1px solid #9ca3af;
  border-radius: 8px;
  padding: 0.22rem 0.42rem;
}

.scale-trainer-hand-radios {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.scale-trainer-hand-radios label {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

.scale-trainer-actions-wrap {
  margin: 0.22rem 0 0.15rem;
}

.scale-trainer-actions-row {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: stretch;
}

.scale-trainer-actions-row button {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  min-height: 44px;
  padding: 0.28rem 0.4rem;
  font-size: 0.88rem;
}

/* Show / Hide Scale: light purple (Previous / Next stay outline blue via .chord-trainer-next-button) */
.chord-trainer-answer-controls.scale-trainer-actions-row .scale-trainer-show-toggle-button {
  background: #f5f3ff;
  color: #5b21b6;
  border: 2px solid #c4b5fd;
  font-weight: 600;
}

.chord-trainer-answer-controls.scale-trainer-actions-row .scale-trainer-show-toggle-button:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

/* Restart button — amber/orange, visually distinct from blue navigation buttons */
.chord-trainer-answer-controls.scale-trainer-actions-row .scale-trainer-restart-button {
  background: #d97706;
  color: #ffffff;
  border: 2px solid #b45309;
  font-weight: 600;
}

.chord-trainer-answer-controls.scale-trainer-actions-row .scale-trainer-restart-button:focus-visible {
  outline: 2px solid #d97706;
  outline-offset: 2px;
}

.scale-trainer-question {
  margin: 0.22rem 0 0.15rem;
}

.scale-trainer-feedback {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  line-height: 1.32;
}

@media (min-width: 600px) {
  .scale-trainer-controls .chord-trainer-controls-primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scale-trainer-controls .chord-trainer-controls-secondary {
    grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .scale-trainer-hand-radios {
    flex-wrap: nowrap;
  }

  .scale-trainer-hand-radios label {
    flex: 0 1 auto;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .scale-trainer-actions-row {
    flex-direction: column;
    flex-wrap: wrap;
  }

  .scale-trainer-actions-row button {
    width: 100%;
  }
}

/* Screen reader only (diagrams) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Stage 9+ — compact theory diagrams */
.diagram-block-title {
  margin: 0 0 0.18rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: #4b5563;
  line-height: 1.2;
}

.chord-trainer-diagram-answer-row {
  display: grid;
  gap: 0.45rem;
  margin: 0.12rem 0 0.2rem;
  min-width: 0;
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}

.chord-trainer-diagram-col {
  min-width: 0;
}

.chord-trainer-diagram-col--piano {
  min-width: min(100%, 280px);
}

.chord-trainer-piano-both {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.chord-trainer-piano-both-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
}

.chord-trainer-piano-both-item {
  flex: 1 1 150px;
  min-width: 0;
}

.chord-trainer-answer-beside-diagram {
  margin: 0;
}

.chord-trainer-answer-slot {
  min-width: 0;
}

.chord-trainer-answer-slot--hidden {
  display: none;
}

@media (min-width: 700px) {
  .chord-trainer-diagram-answer-row {
    grid-template-columns: minmax(0, 1.45fr) minmax(13rem, 0.9fr);
    align-items: start;
  }

  .chord-trainer-answer-slot--hidden {
    display: block;
    visibility: hidden;
    min-height: 1px;
  }
}

.scale-trainer-diagrams {
  display: grid;
  gap: 0.4rem;
  margin: 0.12rem 0 0.18rem;
  min-width: 0;
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
}

.scale-trainer-diagram-piano-col {
  min-width: 0;
}

.scale-progress-card {
  margin-top: 0.3rem;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  background: #f9fafb;
  padding: 0.48rem 0.56rem;
}

.scale-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.scale-progress-title {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  color: #1f2937;
  font-weight: 700;
}

.scale-progress-toggle-row {
  display: inline-flex;
  gap: 0.16rem;
  background: #eef2f7;
  border-radius: 999px;
  padding: 0.12rem;
}

.scale-progress-toggle {
  border: 1px solid transparent;
  background: transparent;
  color: #374151;
  border-radius: 999px;
  padding: 0.1rem 0.52rem;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.25;
}

.scale-progress-toggle-active {
  background: #1d4ed8;
  border-color: #1e40af;
  color: #fff;
}

.scale-progress-chart {
  margin-top: 0.2rem;
}

.scale-progress-section .chord-progress-bars.chord-progress-columns {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 0.2rem;
}

.scale-progress-section .chord-progress-column-label {
  font-size: 0.7rem;
}

.scale-progress-section .chord-progress-column-meta {
  font-size: 0.62rem;
}

@media (max-width: 760px) {
  .progress-panel-top-controls {
    justify-content: flex-start;
    min-width: 0;
  }

  .progress-panel-stats {
    min-width: 0;
    width: 100%;
  }

  .scale-progress-section .chord-progress-bars.chord-progress-columns {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.scale-trainer-diagram-piano-col--hand {
  min-width: 0;
}

.scale-trainer-diagrams--both {
  grid-template-columns: minmax(0, 1fr);
}

.scale-trainer-diagrams--both .piano-keyboard-scroll {
  overflow-x: hidden;
}

.scale-trainer-diagrams--both .piano-keyboard {
  width: 100%;
  min-width: 0;
  display: block;
}

.scale-trainer-diagrams--both .piano-note-diagram--large .piano-keyboard-inner {
  --piano-white-w: clamp(0.88rem, 1.6vw, 1.28rem);
  --piano-white-h: clamp(2.55rem, 4.1vw, 3.05rem);
  --piano-black-w: clamp(0.52rem, 0.95vw, 0.74rem);
  margin-inline: auto;
}

.scale-trainer-diagrams--both-two-octaves {
  gap: 0.3rem;
}

.scale-trainer-diagrams--both-two-octaves .piano-note-diagram {
  padding: 0.24rem 0.28rem;
}

.scale-trainer-diagrams--both-two-octaves .piano-note-diagram--compact .piano-keyboard-inner {
  --piano-white-w: 0.94rem;
  --piano-white-h: 2.48rem;
  --piano-black-w: 0.54rem;
}

.scale-trainer-diagrams--both-two-octaves .piano-key-label-text,
.scale-trainer-diagrams--both-two-octaves .piano-black-key-label {
  font-size: 0.54rem;
}

@media (min-width: 700px) {
  .scale-trainer-diagrams--both {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scale-trainer-diagrams--both-two-octaves .piano-keyboard-scroll {
    overflow-x: hidden;
  }
}

.scale-trainer-diagram-path-col {
  min-width: 0;
}

@media (min-width: 640px) {
  .scale-trainer-diagram-path-col .scale-path-diagram {
    overflow-x: auto;
  }

  .scale-trainer-diagram-path-col .scale-path-steps {
    flex-wrap: nowrap;
  }
}

.scale-path-diagram {
  padding: 0.28rem 0.38rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  min-width: 0;
}

.scale-path-diagram--empty {
  background: #f9fafb;
}

.scale-path-empty-msg {
  margin: 0;
  font-size: 0.78rem;
  color: #6b7280;
}

.scale-path-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12rem 0.08rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scale-path-step {
  display: inline-flex;
  align-items: center;
  gap: 0.06rem;
  font-size: 0.78rem;
  line-height: 1.2;
}

.scale-path-step-label {
  display: inline-flex;
  min-width: 1.65rem;
  justify-content: center;
  padding: 0.14rem 0.28rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scale-path-step--done .scale-path-step-label {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.scale-path-step--current .scale-path-step-label {
  background: #eef2ff;
  border-color: #818cf8;
  color: #312e81;
  box-shadow: 0 0 0 1px #c7d2fe inset;
}

.scale-path-step--future .scale-path-step-label {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #6b7280;
}

.scale-path-arrow {
  color: #9ca3af;
  font-size: 0.72rem;
  padding: 0 0.04rem;
  user-select: none;
}

.scale-path-steps--revealed .scale-path-step-label {
  font-size: 0.8rem;
  padding: 0.16rem 0.32rem;
}

/* --- Piano: whites in a row, blacks overlaid on upper part of whites --- */
.piano-note-diagram {
  padding: 0.32rem 0.45rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.piano-note-diagram-empty {
  margin: 0;
  font-size: 0.78rem;
  color: #6b7280;
}

.piano-keyboard-scroll {
  display: flex;
  justify-content: center;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.piano-keyboard {
  display: inline-block;
  flex: 0 0 auto;
  min-width: min-content;
}

.piano-keyboard-inner {
  --piano-white-w: 1.38rem;
  --piano-white-h: 3.05rem;
  --piano-black-w: 0.78rem;
  --piano-black-body-pct: 0.62;
  --piano-white-count: 7;
  position: relative;
  width: calc(var(--piano-white-count) * var(--piano-white-w));
  max-width: 100%;
}

.piano-note-diagram--large .piano-keyboard-inner {
  --piano-white-w: 1.62rem;
  --piano-white-h: 3.4rem;
  --piano-black-w: 0.92rem;
}

.piano-note-diagram--compact .piano-keyboard-inner {
  --piano-white-w: 1.12rem;
  --piano-white-h: 2.72rem;
  --piano-black-w: 0.64rem;
}

.piano-black-label-layer {
  position: relative;
  width: 100%;
  height: 1rem;
  margin-bottom: 0.06rem;
  overflow: visible;
  pointer-events: none;
}

.piano-keys-block {
  position: relative;
  width: 100%;
  overflow: visible;
}

.piano-white-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  position: relative;
  z-index: 1;
}

.piano-black-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--piano-white-h);
  z-index: 2;
  pointer-events: none;
}

.piano-black-key-slot {
  position: absolute;
  left: calc(
    (var(--piano-after-white-index, 0) + 1) * var(--piano-white-w) - var(--piano-black-w) / 2
  );
  top: 0;
  width: var(--piano-black-w);
  height: var(--piano-white-h);
  overflow: visible;
}

.piano-black-key-label-wrap {
  position: absolute;
  left: calc(
    (var(--piano-after-white-index, 0) + 1) * var(--piano-white-w) - var(--piano-black-w) / 2 +
      var(--piano-black-w) / 2
  );
  top: 0;
  transform: translateX(-50%);
  max-width: min(5.5rem, calc(var(--piano-white-w) * 2.7));
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.piano-black-key-label-wrap:empty {
  display: none;
}

.piano-black-key-surface {
  position: absolute;
  top: 0;
  left: 0;
  height: calc(var(--piano-white-h) * var(--piano-black-body-pct));
  width: 100%;
  border-radius: 3px 3px 5px 5px;
  border: 1px solid #111827;
  background: linear-gradient(180deg, #374151 0%, #0f172a 100%);
  box-sizing: border-box;
  flex-shrink: 0;
}

.piano-white-key {
  width: var(--piano-white-w);
  flex: 0 0 var(--piano-white-w);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.piano-white-key-surface {
  height: var(--piano-white-h);
  border-radius: 3px 3px 5px 5px;
  border: 1px solid #9ca3af;
  border-right-width: 0.5px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  box-sizing: border-box;
}

.piano-white-key:first-child .piano-white-key-surface {
  border-left-width: 1px;
}

.piano-white-key:last-child .piano-white-key-surface {
  border-right-width: 1px;
}

.piano-key-surface--expected {
  border-color: #166534 !important;
  box-shadow: inset 0 0 0 2px #22c55e;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%) !important;
}

.piano-black-key-surface.piano-key-surface--expected {
  background: linear-gradient(180deg, #22c55e 0%, #166534 100%) !important;
  border-color: #bbf7d0 !important;
  box-shadow:
    inset 0 0 0 1px #dcfce7,
    0 0 0 1px #15803d;
}

.piano-key-surface--played {
  box-shadow: inset 0 0 0 1px #93c5fd, 0 0 0 1px #3b82f6;
}

.piano-white-key-surface.piano-key-surface--played {
  background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%) !important;
}

.piano-black-key-surface.piano-key-surface--played {
  background: linear-gradient(180deg, #1d4ed8 0%, #172554 100%) !important;
  border-color: #1e40af !important;
}

@keyframes piano-key-next-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.piano-key-surface--current {
  outline: 3px solid #ea580c;
  outline-offset: 0;
  position: relative;
  z-index: 2;
  animation: piano-key-next-pulse 1.2s ease-in-out infinite;
}

.piano-white-key-surface.piano-key-surface--current {
  background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%) !important;
  border-color: #ea580c !important;
}

.piano-black-key-surface.piano-key-surface--current {
  background: linear-gradient(180deg, #f97316 0%, #9a3412 100%) !important;
  border-color: #fdba74 !important;
}

.piano-black-key-slot--current {
  z-index: 3;
}

.piano-key-surface--expected.piano-key-surface--played.piano-white-key-surface {
  background: linear-gradient(180deg, #4ade80 0%, #93c5fd 100%) !important;
  border-color: #14532d !important;
}

.piano-white-label-row {
  display: flex;
  flex-direction: row;
  margin-top: 0.2rem;
}

.piano-white-label-cell {
  width: var(--piano-white-w);
  flex: 0 0 var(--piano-white-w);
  min-height: 1.15rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  text-align: center;
}

.piano-key-label-line {
  display: block;
  max-width: 100%;
}

.piano-key-label-text {
  display: block;
  font-size: clamp(0.58rem, 1.1vw, 0.72rem);
  line-height: 1.12;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  max-width: min(4.5rem, calc(var(--piano-white-w) * 2.2));
}

.piano-note-diagram--large .piano-key-label-text {
  font-size: clamp(0.62rem, 1.15vw, 0.78rem);
  max-width: min(5rem, calc(var(--piano-white-w) * 2.4));
}

.piano-black-key-label {
  display: block;
  padding: 0.02rem 0.26rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: clamp(0.56rem, 1.02vw, 0.72rem);
  line-height: 1.08;
  font-weight: 700;
  white-space: nowrap;
}

/* Next-note label emphasis: bold blue text (white key) */
.piano-key-label-text--next {
  font-weight: 700;
  color: #1d4ed8;
}

/* Next-note label emphasis: bold blue pill (black key) */
.piano-black-key-label--next {
  font-weight: 700;
  color: #1d4ed8;
  border-color: #93c5fd;
  background: #eff6ff;
}

/* =====================================================================
   Stage 18 — Practice UI redesign
   Replaces all Stage 16/16b/17 trainer styling.
   Goal: flat compact practice card, large hero, real 2-col stage on iPad.
   ===================================================================== */

:root {
  --surface: #ffffff;
  --surface-soft: #f4f7ff;
  --surface-mute: #fafbff;
  --border-soft: #dee5f5;
  --border-strong: #c8d3ee;
  --text-main: #131838;
  --text-muted: #5b6779;
  --blue: #3158e8;
  --blue-deep: #2244c5;
  --blue-soft: #e8eeff;
  --purple: #6d5dfc;
  --peach: #ffe9d8;
  --peach-deep: #ffc7a3;
  --mint: #d8f7e6;
  --sky: #d6e9ff;
  --warm-text: #8a3b16;
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 8px;
}

/* ---------- Outer trainer card: flatten the old nested boxes ---------- */
.practice-card.trainer-shell,
.practice-card.scale-trainer-panel,
.practice-card.chord-trainer-panel {
  background: var(--surface) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 2px 8px rgba(20, 30, 70, 0.05) !important;
  padding: 0.55rem 0.6rem 0.6rem !important;
  display: grid !important;
  gap: 0.45rem !important;
}

/* Defeat the inner nested .card / .trainer-section-card / .trainer-shell look */
.practice-card .trainer-section-card,
.practice-card .trainer-header-card {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.practice-card .trainer-section-title,
.practice-card .metronome-section-title {
  display: none !important;
}

/* ---------- Compact header ---------- */
.practice-card .practice-header,
.practice-card .trainer-header-card {
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding: 0.05rem 0.15rem !important;
  margin: 0 !important;
}

.practice-card h2.trainer-panel-title-row {
  margin: 0 !important;
  font-size: 1rem !important;
  line-height: 1.15 !important;
  color: var(--text-main) !important;
}

.practice-card .practice-header-title {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
}

.practice-card .practice-header-title input[type='radio'] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--blue);
}

.trainer-section-header {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 8px !important;
  flex-wrap: wrap;
}

.trainer-section-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #ffffff;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  color: #102044;
}

.trainer-section-toggle--active {
  background: #3154e8;
  border-color: #2442c5;
  color: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.35);
  transform: translateY(1px);
}

.trainer-section-toggle--inactive:hover {
  background: #eef3ff;
  border-color: #8ea2ff;
}

.trainer-section-title {
  line-height: 1;
}

.trainer-midi-pill {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  background: #eef2ff;
  color: #234;
}

.trainer-midi-pill--ready {
  background: #e8f7ee;
  color: #126b37;
}

.trainer-midi-pill--warning {
  background: #eef2ff;
  color: #3154e8;
}

.trainer-route-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #f6c66d;
  background: #fff7e6;
  color: #8a4b00;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .trainer-section-header {
    margin-bottom: 6px !important;
  }
}

@media (max-width: 640px) {
  .trainer-route-pill {
    white-space: normal;
  }
}

/* ---------- Compact notices ---------- */
.practice-card .compact-notice {
  margin: 0 !important;
  padding: 0.32rem 0.5rem !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.78rem !important;
  line-height: 1.3 !important;
  background: var(--blue-soft) !important;
  border: 1px solid #d6deff !important;
  color: #1d2c80 !important;
}

.practice-card .compact-notice.scale-trainer-banner--paused,
.practice-card .compact-notice.chord-trainer-banner--paused {
  background: #fff8e6 !important;
  border-color: #fde2a4 !important;
  color: #7a4a00 !important;
}

/* ---------- Control dock: flat horizontal grid (NOT a white box) ---------- */
.practice-card .control-dock {
  background: var(--surface-soft) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--radius) !important;
  padding: 0.45rem 0.5rem 0.5rem !important;
  box-shadow: none !important;
}

.practice-card .control-dock .chord-trainer-controls,
.practice-card .control-dock .scale-trainer-controls {
  display: grid !important;
  gap: 0.4rem !important;
  margin: 0 !important;
}

.practice-card .control-dock .chord-trainer-controls-primary,
.practice-card .control-dock .chord-trainer-controls-secondary {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.35rem 0.5rem !important;
}

.practice-card .control-field,
.practice-card .control-dock .chord-trainer-field {
  display: grid !important;
  gap: 0.18rem !important;
  min-width: 0 !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

.practice-card .control-field > label,
.practice-card .control-dock .chord-trainer-field > label[for],
.practice-card .control-dock fieldset.chord-trainer-field legend {
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  color: var(--text-muted) !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 !important;
  width: auto !important;
  flex: none !important;
}

.practice-card .control-field select,
.practice-card .control-field input,
.practice-card .scale-trainer-select,
.practice-card .control-dock select,
.practice-card .control-dock input[type='number'],
.practice-card .control-dock input[type='text'] {
  min-height: 38px !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-strong) !important;
  background: #fff !important;
  color: var(--text-main) !important;
  font-size: 0.88rem !important;
  padding: 0.25rem 0.5rem !important;
  width: 100% !important;
  box-shadow: none !important;
}

/* ---------- Option chips: replace ugly raw radio fieldsets ---------- */
.practice-card .option-chip-group {
  display: grid !important;
  gap: 0.18rem !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
}

.practice-card .option-chip-group legend {
  display: block !important;
  margin-bottom: 0.18rem !important;
}

.practice-card .option-chip-group > label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.32rem !important;
  min-height: 34px !important;
  padding: 0.15rem 0.55rem !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: var(--text-main) !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  cursor: pointer;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  white-space: nowrap;
}

.practice-card .option-chip-group > label:has(input:checked) {
  background: var(--blue-soft) !important;
  border-color: var(--blue) !important;
  color: var(--blue-deep) !important;
  font-weight: 600 !important;
}

.practice-card .option-chip-group > label > input[type='radio'],
.practice-card .option-chip-group > label > input[type='checkbox'] {
  width: 0.95rem !important;
  height: 0.95rem !important;
  accent-color: var(--blue) !important;
}

.practice-card .option-chip-group {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.25rem !important;
  align-items: center !important;
  align-content: flex-start !important;
}

@media (min-width: 700px) {
  .practice-card .control-dock .chord-trainer-controls-secondary,
  .practice-card .control-dock .scale-trainer-controls-secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-items: start !important;
  }

  .practice-card .option-chip-group {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 0.22rem !important;
  }

  .practice-card .option-chip-group > legend {
    flex: 0 0 100% !important;
  }

  .practice-card .option-chip-group > label {
    flex: 1 1 0 !important;
    justify-content: center !important;
    min-width: 0 !important;
    padding-left: 0.32rem !important;
    padding-right: 0.32rem !important;
  }
}

/* ---------- Practice stage: real 2-column on iPad landscape ---------- */
.practice-card .practice-stage {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0.5rem !important;
  margin: 0 !important;
  align-items: stretch !important;
}

.practice-card .practice-stage-main {
  display: grid !important;
  gap: 0.35rem !important;
  min-width: 0 !important;
}

.practice-card .practice-stage-aside {
  display: grid !important;
  gap: 0.4rem !important;
  align-content: start !important;
  min-width: 0 !important;
}

@media (min-width: 820px) {
  .practice-card .practice-stage {
    grid-template-columns: minmax(0, 1fr) minmax(10.5rem, 13rem) !important;
  }
}

/* ---------- Hero panel: huge chord/scale display with warm/cool wash --- */
.practice-card .hero-panel {
  display: grid !important;
  align-items: center !important;
  justify-items: center !important;
  text-align: center !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--border-soft) !important;
  padding: clamp(0.55rem, 1.6vw, 1rem) 0.7rem !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.practice-card .hero-panel--chord {
  background: linear-gradient(135deg, #f6efe4 0%, #e9dcff 100%) !important;
  border-color: #d3c2f5 !important;
}

.practice-card .hero-panel--scale {
  background: linear-gradient(135deg, var(--sky) 0%, var(--mint) 100%) !important;
  border-color: #b9d2ff !important;
}

.practice-card .hero-panel.correct {
  background: linear-gradient(135deg, #d2f7df 0%, #b6f0ce 100%) !important;
  border-color: #74d99b !important;
}

.practice-card .hero-panel.chord-trainer-question--wrong {
  background: linear-gradient(135deg, #ffe0e0 0%, #ffc8c8 100%) !important;
  border-color: #ee9a9a !important;
}

/* Defeat the legacy challenge-card boxed/padded look when used as hero */
.practice-card .hero-panel.challenge-card {
  border-width: 1px !important;
  padding: clamp(0.28rem, 0.9vw, 0.55rem) 0.45rem !important;
}

.practice-card .hero-main {
  margin: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: baseline !important;
  justify-content: center !important;
  gap: 0.4rem 0.8rem !important;
}

.practice-card .hero-panel .chord-name-large {
  font-size: clamp(3.5rem, 9vw, 6.5rem) !important;
  line-height: 0.92 !important;
  font-weight: 800 !important;
  letter-spacing: -0.025em !important;
  color: var(--text-main) !important;
}

.practice-card .hero-panel .chord-roman.chord-name-large {
  font-size: clamp(2rem, 5vw, 3.4rem) !important;
  color: #5d3a91 !important;
}

.practice-card .hero-detail {
  margin: 0.25rem 0 0 !important;
  font-size: clamp(0.82rem, 1.6vw, 1rem) !important;
  font-weight: 500 !important;
  color: var(--text-muted) !important;
  line-height: 1.25 !important;
}

.practice-card .hero-feedback {
  margin: 0.35rem 0 0 !important;
  font-size: 0.88rem !important;
  font-weight: 700 !important;
  color: #1c2e84 !important;
}

.practice-card .hero-panel.correct .hero-feedback {
  color: #15643b !important;
}

.practice-card .hero-panel.chord-trainer-question--wrong .hero-feedback {
  color: #971b1b !important;
}

.practice-card .hero-panel.chord-trainer-question--wrong .chord-name-large,
.practice-card .hero-panel.chord-trainer-question--wrong .hero-detail {
  color: #971b1b !important;
}

/* Hide the now-redundant "Chord challenge"/"Your scale quest" kickers if any remain */
.practice-card .challenge-kicker {
  display: none !important;
}

/* ---------- Keyboard panel: integrated, no big white empty box --------- */
.practice-card .keyboard-panel {
  margin: 0 !important;
  padding: 0.25rem 0.3rem 0.35rem !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--radius) !important;
  display: grid !important;
  gap: 0.25rem !important;
}

.practice-card .keyboard-panel .piano-note-diagram {
  background: #fbfcff !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--radius) !important;
  box-shadow: 0 1px 2px rgba(20, 30, 70, 0.04) !important;
  padding: 0.32rem 0.45rem !important;
}

.practice-card .chord-trainer-piano-both,
.practice-card .chord-trainer-piano-both-row {
  margin: 0 !important;
}

.practice-card .chord-trainer-piano-both-row {
  gap: 0.35rem !important;
}

/* ---------- Trainer buttons: one consistent family ---------- */
.practice-card .trainer-button,
.practice-card .practice-stage-aside button,
.practice-card .chord-trainer-answer-controls button {
  appearance: none !important;
  width: 100% !important;
  min-height: 42px !important;
  padding: 0.4rem 0.75rem !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: filter 0.12s ease, transform 0.06s ease;
}

.practice-card .trainer-button:active,
.practice-card .practice-stage-aside button:active {
  transform: translateY(1px);
}

.practice-card .trainer-button:hover {
  filter: brightness(0.97);
}

.practice-card .trainer-button--primary {
  background: var(--blue) !important;
  border-color: var(--blue-deep) !important;
  color: #fff !important;
}

.practice-card .trainer-button--secondary {
  background: var(--blue-soft) !important;
  border-color: #cdd9ff !important;
  color: var(--blue-deep) !important;
}

.practice-card .trainer-button--restart {
  background: #fff1e2 !important;
  border-color: var(--peach-deep) !important;
  color: var(--warm-text) !important;
}

.practice-card .trainer-button--speech {
  background: #edf7ee !important;
  border-color: #a8d5ac !important;
  color: #2a6b30 !important;
}

/* ---------- Reading settings toggle ---------- */
.reading-settings-card {
  padding: 0.55rem 0.85rem;
}

.reading-settings-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
  user-select: none;
}

.reading-settings-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Parent Practice Monitor dashboard ─────────────────────────────────── */
.pdash {
  padding: 0.85rem 1rem;
}

.pdash-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.pdash-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.pdash-online {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
}

.pdash-online--online {
  background: #e6f4ea;
  color: #2a6b30;
}

.pdash-online--offline {
  background: #fdf3cd;
  color: #7a5800;
}

/* Single scrollable row — never wraps regardless of profile count */
.pdash-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 260px);
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.pdash-card {
  background: var(--surface-mute, #f8f8fb);
  border: 1px solid var(--border-soft, #e0e0ec);
  border-radius: var(--radius-sm, 8px);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  text-align: left;
}

.pdash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  min-width: 0;
}

.pdash-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  min-width: 0;
  text-align: left;
}

/* Sync status badges */
.pdash-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pdash-badge--synced   { background: #e6f4ea; color: #2a6b30; }
.pdash-badge--syncing  { background: #e8f0fe; color: #1a56b0; }
.pdash-badge--pending  { background: #e8f0fe; color: #1a56b0; }
.pdash-badge--waiting  { background: #fdf3cd; color: #7a5800; }
.pdash-badge--failed   { background: #fde8e8; color: #9b1c1c; }
.pdash-badge--idle     { background: var(--surface-mute, #f0f0f6); color: var(--text-muted, #888); }

/* Stats list */
.pdash-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
}

.pdash-stat {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.pdash-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #2244c5;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left;
  margin: 0;
}

.pdash-stat-value {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  text-align: left;
  margin: 0;
}

.pdash-stat-value--muted {
  color: var(--text-muted, #888);
}

.pdash-stat--warning .pdash-stat-label,
.pdash-stat--warning .pdash-stat-value {
  color: #9b1c1c;
}

/* ── Weekly email toggle ────────────────────────────────────────────────── */

.pdash-email-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--surface-mute, #f5f5fa);
  border-radius: 10px;
  border: 1px solid var(--border, #e0e0ec);
}

.pdash-email-toggle-label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.pdash-email-toggle-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #111);
}

.pdash-email-toggle-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted, #777);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Toggle pill button */
.pdash-toggle-btn {
  flex-shrink: 0;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  background: var(--surface-stroke, #ccc);
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}

.pdash-toggle-btn--on {
  background: #4f46e5;
}

.pdash-toggle-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pdash-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform 0.2s;
  display: block;
}

.pdash-toggle-btn--on .pdash-toggle-thumb {
  transform: translateX(20px);
}

/* Status feedback */
.pdash-email-status {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.pdash-email-status--sending { background: #e8f0fe; color: #1a56b0; }
.pdash-email-status--sent    { background: #e6f4ea; color: #2a6b30; }
.pdash-email-status--error   { background: #fde8e8; color: #9b1c1c; }

.practice-card .action-stack {
  display: grid !important;
  gap: 0.4rem !important;
}

.practice-card .trainer-answer-card {
  margin-top: 0.3rem !important;
  padding: 0.45rem 0.55rem !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-soft) !important;
  background: var(--surface-mute) !important;
  font-size: 0.82rem !important;
  color: var(--text-main) !important;
}

.practice-card .trainer-answer-card h3 {
  margin: 0 0 0.25rem !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
}

.practice-card .trainer-answer-card p {
  margin: 0.12rem 0 !important;
  line-height: 1.3 !important;
}

/* Hide the legacy answer slot used inside the previous keyboard row */
.practice-card .chord-trainer-diagram-answer-row .chord-trainer-answer-slot {
  display: none !important;
}

/* ---------- Rhythm strip: compact horizontal metronome bar ---------- */
.practice-card .rhythm-strip {
  background: var(--surface-soft) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--radius) !important;
  padding: 0.4rem 0.5rem !important;
  box-shadow: none !important;
  display: grid !important;
  gap: 0.32rem !important;
}

.practice-card .rhythm-strip > * {
  margin: 0 !important;
}

.practice-card .rhythm-strip .metronome-controls-section {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

/* Scale Trainer polish: cleaner wrappers and consistent select focus */
.practice-card--scale .rhythm-strip {
  background: #f7faff !important;
  border: 1px solid #dbe5ff !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  padding: 8px 0 8px 8px !important;
  gap: 6px !important;
  box-sizing: border-box !important;
}

.practice-card--scale .rhythm-strip-row--main {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 4px !important;
  min-height: 0 !important;
  align-items: center !important;
}

.practice-card--scale .rhythm-strip .metronome-controls-section--settings,
.practice-card--scale .rhythm-strip .metronome-controls-section--exercise {
  background: transparent !important;
  border: 0 !important;
  border-radius: 12px !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.practice-card--scale .rhythm-strip .metronome-controls-section--exercise {
  background: transparent !important;
  padding: 0 !important;
  margin-top: 6px !important;
}

.practice-card .rhythm-strip-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.35rem 0.45rem !important;
}

.practice-card .rhythm-strip-row--fields {
  display: block !important;
  width: 100% !important;
}

.practice-card .rhythm-strip-row--main {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.32rem 0.42rem;
}

.practice-card .rhythm-strip-start {
  width: auto !important;
  min-width: 6rem !important;
  flex: 0 0 auto !important;
  padding: 0.45rem 0.95rem !important;
  font-weight: 700 !important;
  font-size: 0.92rem !important;
}

.practice-card .rhythm-strip-beat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  min-width: 3rem;
  justify-content: center;
}

.practice-card .rhythm-strip-beat-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}

.practice-card .rhythm-strip-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-mute);
  border: 1px solid var(--border-soft);
  font-size: 0.74rem;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.practice-card .rhythm-strip-pill strong {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.practice-card .rhythm-strip-pill.metronome-avg-pill--pass,
.practice-card .rhythm-strip-pill.metronome-avg-pill--neutral.metronome-avg-pill--pass {
  background: #dff7e6 !important;
  border-color: #93dca8 !important;
  color: #14633b !important;
}

.practice-card .rhythm-strip-pill.metronome-avg-pill--near {
  background: #fff5d6 !important;
  border-color: #f3cf76 !important;
  color: #7a4900 !important;
}

.practice-card .rhythm-strip-pill.metronome-avg-pill--fail {
  background: #ffe5e5 !important;
  border-color: #f1a0a0 !important;
  color: #911818 !important;
}

.practice-card .rhythm-strip-row--fields .metronome-settings-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  column-gap: 12px !important;
  row-gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  align-items: end !important;
  margin: 0 !important;
  padding: 0 10px 0 0 !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-setting-field {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  font-size: 0.7rem !important;
  color: var(--text-muted) !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-setting-field span {
  color: var(--text-muted) !important;
  font-size: 0.78rem !important;
  line-height: 1.1 !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}

.practice-card .rhythm-strip .metronome-setting-field input,
.practice-card .rhythm-strip .metronome-setting-field select {
  box-sizing: border-box !important;
  width: 100% !important;
  min-height: 40px !important;
  height: 40px !important;
  max-width: 100% !important;
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-strong) !important;
  background: #fff !important;
  color: var(--text-main) !important;
  font-size: 0.9rem !important;
  line-height: 1.2 !important;
  padding: 0 36px 0 12px !important;
  font-weight: 500 !important;
  text-transform: none;
  letter-spacing: 0;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.practice-card--scale .rhythm-strip .metronome-setting-field select,
.practice-card--scale .scale-trainer-controls select,
.practice-card--scale .scale-trainer-select {
  border: 1px solid #c7d2fe !important;
  border-radius: 10px !important;
  background-color: #ffffff !important;
  min-height: 42px !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.practice-card--scale .rhythm-strip .metronome-setting-field select:focus,
.practice-card--scale .rhythm-strip .metronome-setting-field select:focus-visible,
.practice-card--scale .scale-trainer-controls select:focus,
.practice-card--scale .scale-trainer-controls select:focus-visible,
.practice-card--scale .scale-trainer-select:focus,
.practice-card--scale .scale-trainer-select:focus-visible {
  border-color: #3b5bdb !important;
  box-shadow: 0 0 0 2px rgba(59, 91, 219, 0.15) !important;
  outline: none !important;
}

.practice-card--scale .rhythm-strip .metronome-setting-field--sound select {
  padding-right: 36px !important;
}

.practice-card--scale .rhythm-strip .metronome-setting-field--sound {
  padding-right: 10px !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-exercise-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  column-gap: 12px !important;
  row-gap: 6px !important;
  align-items: end !important;
  background: rgba(255, 255, 255, 0.72) !important;
  border: 0 !important;
  border-radius: var(--radius-sm) !important;
  padding: 0 !important;
  margin-top: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.practice-card--scale .rhythm-strip .metronome-exercise-grid {
  background: transparent !important;
  border: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
}

/* Keep only one metronome container border in Scale Trainer */
.practice-card--scale .rhythm-strip .rhythm-strip-row--main {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.practice-card .rhythm-strip .metronome-exercise-grid > *,
.practice-card .rhythm-strip .metronome-settings-grid > * {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-setting-field .number-stepper {
  margin: 0 !important;
  align-self: start !important;
  width: max-content !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-setting-field .number-stepper-controls,
.practice-card .rhythm-strip .metronome-setting-field .number-stepper__controls {
  justify-self: start !important;
  display: inline-grid !important;
  grid-template-columns: 40px 72px 40px !important;
  gap: 8px !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.practice-card .rhythm-strip .metronome-setting-field .number-stepper-button,
.practice-card .rhythm-strip .metronome-setting-field .number-stepper__button {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
}

.practice-card .rhythm-strip .metronome-setting-field .number-stepper-value,
.practice-card .rhythm-strip .metronome-setting-field .number-stepper__value {
  width: 72px !important;
  min-width: 72px !important;
  max-width: 72px !important;
  height: 40px !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
}

.practice-card--scale .rhythm-strip:has(.metronome-controls-section--exercise.exercise-mode-free) {
  background: rgba(237, 245, 255, 0.62) !important;
  border-color: #cfe0ff !important;
}

.practice-card--scale .rhythm-strip:has(.metronome-controls-section--exercise.exercise-mode-timed) {
  background: rgba(236, 255, 244, 0.62) !important;
  border-color: #c4efd6 !important;
}

.practice-card--scale .rhythm-strip:has(.metronome-controls-section--exercise.exercise-mode-beat-ladder) {
  background: rgba(244, 239, 255, 0.62) !important;
  border-color: #ddd0ff !important;
}

.practice-card--scale .rhythm-strip:has(.metronome-controls-section--exercise.exercise-mode-time-ladder) {
  background: rgba(255, 241, 232, 0.62) !important;
  border-color: #ffd2b7 !important;
}

.practice-card--scale .rhythm-strip:has(.metronome-controls-section--exercise.exercise-mode-streak-goal) {
  background: rgba(255, 248, 216, 0.62) !important;
  border-color: #f4e39b !important;
}

.practice-card .rhythm-strip .metronome-controls-section--exercise.exercise-mode-free .metronome-exercise-grid {
  background: rgba(237, 245, 255, 0.74) !important;
}

.practice-card .rhythm-strip .metronome-controls-section--exercise.exercise-mode-timed .metronome-exercise-grid {
  background: rgba(236, 255, 244, 0.74) !important;
}

.practice-card .rhythm-strip .metronome-controls-section--exercise.exercise-mode-beat-ladder .metronome-exercise-grid {
  background: rgba(244, 239, 255, 0.74) !important;
}

.practice-card .rhythm-strip .metronome-controls-section--exercise.exercise-mode-time-ladder .metronome-exercise-grid {
  background: rgba(255, 241, 232, 0.74) !important;
}

.practice-card .rhythm-strip .metronome-controls-section--exercise.exercise-mode-streak-goal .metronome-exercise-grid {
  background: rgba(255, 248, 216, 0.74) !important;
}

@media (max-width: 900px) {
  .practice-card .rhythm-strip-row--fields .metronome-settings-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  }

  .practice-card .rhythm-strip .metronome-exercise-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
  }
}

@media (max-width: 620px) {
  .practice-card .rhythm-strip-row--fields .metronome-settings-grid,
  .practice-card .rhythm-strip .metronome-exercise-grid {
    grid-template-columns: 1fr !important;
  }
}

.practice-card .rhythm-strip .metronome-exercise-grid .metronome-beat-indicator {
  display: none !important;
}

.practice-card .rhythm-strip .metronome-exercise-timer-status,
.practice-card .rhythm-strip .metronome-exercise-ladder-status {
  margin: 0.18rem 0 0 !important;
  font-size: 0.74rem !important;
  color: var(--blue-deep) !important;
  font-weight: 600 !important;
}

.practice-card .rhythm-strip .rhythm-strip-msg {
  margin: 0 !important;
  padding: 0.22rem 0.5rem !important;
  border-radius: var(--radius-sm) !important;
  background: #fff7e0;
  border: 1px solid #f3d585;
  color: #7a4900;
  font-size: 0.78rem;
}

.practice-card .rhythm-strip .rhythm-strip-feedback {
  margin: 0 !important;
  padding: 0.28rem 0.5rem !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
}

/* ---------- Progress panel ---------- */
.practice-card .progress-panel,
.practice-card .progress-reward-panel {
  margin: 0.2rem 0 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

.practice-card .progress-panel .trainer-pill {
  display: none !important;
}

.practice-card .progress-panel .chord-progress-section,
.practice-card .progress-panel .scale-progress-card {
  background: var(--surface-mute) !important;
  border: 1px solid var(--border-soft) !important;
  border-radius: var(--radius) !important;
  padding: 0.5rem 0.6rem !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.practice-card .progress-panel .chord-progress-header,
.practice-card .progress-panel .scale-progress-header {
  align-items: center !important;
  gap: 0.35rem 0.6rem !important;
}

.practice-card .progress-panel .progress-panel-title,
.practice-card .progress-panel .scale-progress-title {
  font-size: 0.86rem !important;
  font-weight: 700 !important;
  color: var(--text-main) !important;
  margin: 0 !important;
}

.practice-card .progress-panel .progress-panel-stat-pill {
  border-radius: 999px !important;
  background: #fff !important;
  border: 1px solid var(--border-soft) !important;
  padding: 0.18rem 0.5rem !important;
  min-height: 28px !important;
  box-shadow: none !important;
}

.practice-card .progress-panel .progress-panel-stat-label {
  font-size: 0.7rem !important;
  color: var(--text-muted) !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.practice-card .progress-panel .progress-panel-stat-value {
  font-size: 0.82rem !important;
  color: var(--text-main) !important;
  font-weight: 700 !important;
}

.practice-card .progress-panel .chord-progress-toggle,
.practice-card .progress-panel .scale-progress-toggle {
  min-height: 28px !important;
  border-radius: 999px !important;
  font-size: 0.72rem !important;
  padding: 0.1rem 0.6rem !important;
  border: 1px solid var(--border-strong) !important;
  background: #fff !important;
  color: var(--text-main) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.practice-card .progress-panel .chord-progress-toggle-active,
.practice-card .progress-panel .scale-progress-toggle-active {
  background: var(--blue) !important;
  border-color: var(--blue-deep) !important;
  color: #fff !important;
}

.practice-card .chord-progress-column-fill,
.practice-card .chord-progress-bar-fill {
  background: linear-gradient(to top, var(--blue) 0%, var(--purple) 60%, #f0a3d6 100%) !important;
}

/* ---------- Defeat the legacy `.card`/`.trainer-shell` outer styles ---- */
.practice-card.card,
.practice-card.trainer-shell {
  background: var(--surface) !important;
  border-radius: var(--radius-lg) !important;
}

/* Keep Chord Trainer option sets as one horizontal option row. */
.practice-card--chord .control-dock .chord-trainer-controls-secondary .option-chip-group {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.22rem !important;
}

.practice-card--chord .control-dock .chord-trainer-controls-secondary .option-chip-group > legend {
  grid-column: 1 / -1 !important;
  margin: 0 !important;
}

.practice-card--chord .control-dock .chord-trainer-controls-secondary .option-chip-group > label {
  min-width: 0 !important;
  width: 100% !important;
  justify-content: center !important;
  padding-left: 0.28rem !important;
  padding-right: 0.28rem !important;
}

/* Keep Scale Trainer hand focus options inline on one row. */
.practice-card--scale .control-dock .scale-trainer-hand-radios.option-chip-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 0.22rem !important;
  align-items: center !important;
}

.practice-card--scale .control-dock .scale-trainer-hand-radios.option-chip-group > legend {
  flex: 0 0 100% !important;
  margin: 0 0 0.18rem !important;
}

.practice-card--scale .control-dock .scale-trainer-hand-radios.option-chip-group > label {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
  justify-content: center !important;
}

/* ── ChildAssignmentPanel ─────────────────────────────────────────────────── */

.child-assignment-panel {
  border-left: 3px solid var(--accent);
}

.child-assignment-panel__heading {
  margin-bottom: 0.5rem;
}

.child-assignment-panel__spec-title {
  font-weight: 600;
  color: var(--text-h);
  margin: 0.25rem 0;
}

.child-assignment-panel__spec-summary,
.child-assignment-panel__spec-goal {
  margin: 0.15rem 0;
  font-size: 0.9em;
}

.child-assignment-panel__active-label,
.child-assignment-panel__idle-label {
  margin: 0 0 0.25rem;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.child-assignment-panel__btn {
  margin-top: 0.75rem;
 padding: 0.5rem 1.1rem;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.child-assignment-panel__btn:hover {
  opacity: 0.85;
}

.child-assignment-panel__btn--start {
  background: var(--blue, #1d4ed8);
  color: #fff;
}

.child-assignment-panel__btn--end {
  background: var(--border-soft, #e2e8f0);
  color: var(--text, #1e293b);
}

.child-assignment-panel__note {
  margin-top: 0.75rem;
  font-size: 0.78em;
  color: var(--text-muted, #64748b);
}

/* ChildAssignmentLaunchPanel - child-facing assignment card */

.child-assignment-launch-panel {
  border-left: 4px solid var(--green, #16a34a);
}

.child-assignment-launch-panel__badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--green, #16a34a);
  margin-bottom: 0.4rem;
}

.child-assignment-launch-panel__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-h, #0f172a);
  margin: 0 0 0.2rem;
}

.child-assignment-launch-panel__summary,
.child-assignment-launch-panel__goal {
  margin: 0.15rem 0;
  font-size: 0.88em;
  color: var(--text, #1e293b);
}

.child-assignment-launch-panel__btn {
  margin-top: 0.9rem;
  min-height: 48px;
  padding: 0 1.5rem;
  border: none;
  border-radius: 10px;
  background: var(--green, #16a34a);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s;
  touch-action: manipulation;
}

.child-assignment-launch-panel__btn:hover {
  opacity: 0.88;
}

.child-assignment-launch-panel__active-note {
  margin-top: 0.55rem;
  font-size: 0.78em;
  color: var(--text-muted, #64748b);
}

.child-assignment-launch-panel__btn:active {
  transform: scale(0.96);
  opacity: 0.75;
}

.child-assignment-launch-panel__btn--launched {
  background: var(--text-muted, #64748b);
  cursor: default;
}

.child-assignment-launch-panel__badge--passed {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  font-size: 0.88rem;
  padding: 0.25rem 0.75rem;
}

/* Progress bar */
.child-assignment-launch-panel__progress {
  margin: 0.35rem 0 0;
}

.child-assignment-launch-panel__progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.child-assignment-launch-panel__progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.child-assignment-launch-panel__progress-text {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  color: #475569;
}

/* Passed state */
.child-assignment-launch-panel__passed-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}

/* ── Task 17: motivation loop additions ─────────────────────────────────── */

/* "Today's challenge" badge */
.child-assignment-launch-panel__badge {
  font-size: 0.78rem;
}

/* Why it matters */
.child-assignment-launch-panel__why {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
}

/* Progress fill moods */
.child-assignment-launch-panel__progress-fill--nearly {
  background: #16a34a;
}
.child-assignment-launch-panel__progress-fill--streak {
  background: #7c3aed;
}
.child-assignment-launch-panel__progress-fill--improving {
  background: #2563eb;
}
.child-assignment-launch-panel__progress-fill--going,
.child-assignment-launch-panel__progress-fill--start {
  background: #3b82f6;
}

/* Encouragement phrase */
.child-assignment-launch-panel__encouragement {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}
.child-assignment-launch-panel__encouragement--nearly   { color: #166534; }
.child-assignment-launch-panel__encouragement--streak   { color: #7c3aed; }
.child-assignment-launch-panel__encouragement--improving { color: #1d4ed8; }
.child-assignment-launch-panel__encouragement--going,
.child-assignment-launch-panel__encouragement--start    { color: #475569; }

/* Stuck encouragement (gentle, shown below progress bar) */
.child-assignment-launch-panel__stuck-encouragement {
  font-size: 0.85rem;
  color: #92400e;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 0 6px 6px 0;
  padding: 0.45rem 0.7rem;
  margin: 0.4rem 0 0;
}

/* Celebration block */
.child-assignment-launch-panel__celebration {
  margin-top: 0.75rem;
}
.child-assignment-launch-panel__celebration-headline {
  font-size: 1.2rem;
  font-weight: 700;
  color: #166534;
  margin: 0 0 0.2rem;
}
.child-assignment-launch-panel__celebration-sub {
  font-size: 0.88rem;
  color: #166534;
  margin: 0 0 0.75rem;
}
.child-assignment-launch-panel__btn--replay {
  background: #166534;
  opacity: 0.85;
}
.child-assignment-launch-panel__btn--replay:hover {
  opacity: 1;
}

/* ── "What's next" banner (ChildHomeScreen) ─────────────────────────────── */
.chs__whats-next {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chs__whats-next-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}
.chs__whats-next-body {
  min-width: 0;
}
.chs__whats-next-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #16a34a;
  margin: 0 0 0.15rem;
}
.chs__whats-next-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #14532d;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* EGP: passed badge variant + progress line */
.egp__active-badge--passed {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.egp__progress-line {
  margin: 0.15rem 0;
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
}

/* ── ExerciseGeneratorPanel ─────────────────────────────────────────────────── */

.egp {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.egp__heading {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
}

/* ─ Form ─ */
.egp__form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.egp__row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.egp__row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.egp__field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.egp__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.egp__select,
.egp__input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  -webkit-appearance: none;
  appearance: none;
}

.egp__select:focus,
.egp__input:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-color: transparent;
}

.egp__warning {
  margin: 0;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 6px;
}

.egp__preview {
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  color: #334155;
  background: #f1f5f9;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.egp__preview-label {
  font-weight: 600;
  color: #64748b;
  margin-right: 0.2rem;
}

.egp__error {
  margin: 0;
  font-size: 0.82rem;
  color: #dc2626;
}

.egp__reset-title-btn {
  align-self: flex-start;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  color: #64748b;
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
}

.egp__reset-title-btn:hover {
  background: #f1f5f9;
}

/* ─ Buttons ─ */
.egp__btn {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-sizing: border-box;
}

.egp__btn:active {
  transform: scale(0.97);
}

.egp__btn--assign {
  background: #2563eb;
  color: #fff;
  margin-top: 0.25rem;
}

.egp__btn--assign:hover:not(:disabled) {
  background: #1d4ed8;
}

.egp__btn--assign:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.egp__btn--end {
  background: #ef4444;
  color: #fff;
}

.egp__btn--end:hover {
  background: #dc2626;
}

/* ─ Active assignment view ─ */
.egp__active {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.egp__active-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: flex-start;
}

.egp__active-child {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
}

.egp__spec-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.egp__spec-summary,
.egp__spec-goal {
  margin: 0;
  font-size: 0.85rem;
  color: #475569;
}

.egp__spec-message {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
  font-style: italic;
}

/* ─ Footer note ─ */
.egp__note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* ── ChildAssignmentLaunchPanel — completion/progress additions ──────────── */

.child-assignment-launch-panel__badge--passed {
  background: var(--green, #16a34a);
  color: #fff;
  font-weight: 700;
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.8em;
  display: inline-block;
  margin-bottom: 0.6rem;
}

.child-assignment-launch-panel__progress {
  margin: 0.6rem 0;
}

.child-assignment-launch-panel__progress-bar {
  background: var(--border, #e2e8f0);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.child-assignment-launch-panel__progress-fill {
  height: 100%;
  background: var(--accent, #3b82f6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.child-assignment-launch-panel__progress-text {
  font-size: 0.8em;
  color: var(--text-muted, #64748b);
  margin-top: 0.3rem;
}

.child-assignment-launch-panel__passed-note {
  margin-top: 0.75rem;
  padding: 0.6rem 0.9rem;
  background: #dcfce7;
  color: #166534;
  border-radius: 8px;
  font-size: 0.88em;
}

/* ── ChildAssignmentsSummaryPanel (casp) ─────────────────────────────────── */

.casp__heading {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: #1e293b;
}

.casp__loading,
.casp__empty {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0;
}

.casp__child {
  margin-bottom: 1rem;
}

.casp__child:last-child {
  margin-bottom: 0;
}

.casp__child-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin: 0 0 0.4rem;
}

.casp__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.casp__row {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  box-sizing: border-box;
}

.casp__row--passed {
  background: #f0fdf4;
  border-color: #bbf7d0;
  opacity: 0.85;
}

.casp__row--archived {
  opacity: 0.55;
}

.casp__row-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.casp__badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  font-size: 0.67rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.casp__badge--active {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

.casp__badge--passed {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.casp__badge--archived {
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.casp__title {
  font-size: 0.87rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
}

.casp__date {
  font-size: 0.74rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.casp__summary,
.casp__goal,
.casp__acc {
  font-size: 0.79rem;
  color: #475569;
  margin: 0;
}

.casp__goal {
  font-style: italic;
  color: #64748b;
}

@media (max-width: 600px) {
  .casp__row-header {
    flex-wrap: wrap;
  }
}

/* ── CASP actions & buttons ──────────────────────────────────────────────── */

.casp__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.casp__btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.casp__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.casp__btn--skip {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde047;
}

.casp__btn--skip:hover:not(:disabled) {
  background: #fef08a;
}

.casp__btn--archive {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.casp__btn--archive:hover:not(:disabled) {
  background: #e2e8f0;
}

.casp__btn--reset {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.casp__btn--reset:hover:not(:disabled) {
  background: #dbeafe;
}

.casp__btn--confirm {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

.casp__btn--confirm:hover:not(:disabled) {
  background: #b91c1c;
}

.casp__btn--cancel {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.casp__btn--cancel:hover:not(:disabled) {
  background: #e2e8f0;
}

.casp__confirm-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.casp__confirm-label {
  font-size: 0.82rem;
  color: #dc2626;
  font-weight: 600;
}

.casp__error {
  color: #dc2626;
  font-size: 0.85rem;
  margin: 0.25rem 0;
  padding: 0.4rem 0.7rem;
  background: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fecaca;
}

/* ── CASP stuck-child indicators ─────────────────────────────────────────── */

.casp__row--stuck {
  border-left: 3px solid #f59e0b;
}

.casp__row--stuck.casp__row--stuck .casp__stuck-badge--severe {
  /* override border colour for severe */
  border-left-color: #dc2626;
}

.casp__stuck-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  margin-left: auto;
}

.casp__stuck-badge--mild {
  background: #fef9c3;
  color: #854d0e;
}

.casp__stuck-badge--moderate {
  background: #ffedd5;
  color: #9a3412;
}

.casp__stuck-badge--severe {
  background: #fee2e2;
  color: #991b1b;
}

.casp__stuck-reasons {
  font-size: 0.78rem;
  color: #92400e;
  margin: 0.1rem 0 0;
  padding: 0.25rem 0.5rem;
  background: #fffbeb;
  border-radius: 4px;
}

/* ── EGP trainer-type toggle ─────────────────────────────────────────────── */

.egp__toggle-group {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  width: fit-content;
}

.egp__toggle-btn {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  min-height: 36px;
  min-width: 60px;
  transition: background 0.15s, color 0.15s;
  box-sizing: border-box;
}

.egp__toggle-btn + .egp__toggle-btn {
  border-left: 1px solid #cbd5e1;
}

.egp__toggle-btn--active {
  background: #1d4ed8;
  color: #fff;
}

.egp__toggle-btn--active:hover {
  background: #1e40af;
}

/* ── EGP passed-banner (compact summary above form after assignment passes) ─ */

.egp__passed-banner {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* ── EGP active-trainer label (shown in in-progress active view) ─────────── */

.egp__active-trainer {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
}

/* ── EGP MusicXML file upload ────────────────────────────────────────────── */

.egp__file-input {
  width: 100%;
  font-size: 0.85rem;
  color: #475569;
  cursor: pointer;
  padding: 0.3rem 0;
}

.egp__musicxml-ready {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #166534;
  font-weight: 600;
}

/* ─── ChildAssignmentsSummaryPanel — action buttons ─────────────────────── */

.casp__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.casp__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.85rem;
  min-height: 2rem;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.casp__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Archive — muted / secondary style */
.casp__btn--archive {
  background: transparent;
  border-color: #6b7280;
  color: #6b7280;
}

.casp__btn--archive:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #374151;
  color: #374151;
}

/* Reset — amber/warning style */
.casp__btn--reset {
  background: transparent;
  border-color: #d97706;
  color: #b45309;
}

.casp__btn--reset:hover:not(:disabled) {
  background: #fef3c7;
  border-color: #92400e;
  color: #92400e;
}

/* Confirm — red/danger style */
.casp__btn--confirm {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.casp__btn--confirm:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* Cancel — neutral ghost */
.casp__btn--cancel {
  background: transparent;
  border-color: #9ca3af;
  color: #6b7280;
}

.casp__btn--cancel:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #6b7280;
  color: #374151;
}

/* Confirmation group (label + two buttons) */
.casp__confirm-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.casp__confirm-label {
  font-size: 0.8rem;
  color: #92400e;
  font-weight: 600;
}

/* Error message inside the panel */
.casp__error {
  margin: 0.4rem 0 0.6rem;
  padding: 0.4rem 0.7rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  font-size: 0.82rem;
  color: #991b1b;
}

/* ── Offline UI ──────────────────────────────────────────────────────────── */

/* Banner shown above the child's cached assignment when offline */
.offline-banner {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.9rem;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 7px;
  font-size: 0.82rem;
  color: #92400e;
  text-align: center;
}

/* Card shown when child is offline with no cached assignment or enrolments */
.offline-no-data-panel {
  padding: 1rem 1.2rem;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.offline-no-data-panel__message {
  margin: 0;
  font-size: 0.92rem;
  color: #475569;
  text-align: center;
  line-height: 1.5;
}

/* ── ParentDashboardSummary ──────────────────────────────────────────────── */

.pds {
  margin-bottom: 0;
}

.pds__heading {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.75rem;
}

.pds__stats {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.pds__stat {
  flex: 1 1 90px;
  min-width: 80px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-align: center;
}

.pds__stat--highlight {
  background: #fff7ed;
  border-color: #fed7aa;
}

.pds__stat-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.pds__stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.pds__stat--highlight .pds__stat-value {
  color: #c2410c;
}

.pds__stat-label {
  font-size: 0.72rem;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pds__stat-sublabel {
  font-size: 0.68rem;
  color: #94a3b8;
  font-style: italic;
}

/* Needs attention list */

.pds__attention {
  margin-bottom: 0.65rem;
}

.pds__attention-heading,
.pds__wins-heading {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.35rem;
}

.pds__attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pds__attention-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.5rem;
  align-items: baseline;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  border-left: 3px solid #f59e0b;
  background: #fffbeb;
}

.pds__attention-item--severe {
  border-left-color: #dc2626;
  background: #fff1f2;
}

.pds__attention-child {
  font-weight: 700;
  color: #1e293b;
}

.pds__attention-title {
  color: #475569;
}

.pds__attention-reason {
  color: #92400e;
  font-style: italic;
  font-size: 0.78rem;
}

.pds__attention-item--severe .pds__attention-reason {
  color: #991b1b;
}

/* Wins list */

.pds__wins-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pds__wins-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: #f0fdf4;
  border-left: 3px solid #4ade80;
  font-size: 0.82rem;
}

.pds__wins-child {
  font-weight: 700;
  color: #166534;
}

.pds__wins-title {
  color: #15803d;
}

/* ── ScaleTrainer spec-mode banner ───────────────────────────────────────── */

.scale-trainer__spec-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.6rem;
  font-size: 0.82rem;
}

.scale-trainer__spec-badge {
  font-weight: 700;
  color: #1d4ed8;
  white-space: nowrap;
}

.scale-trainer__spec-title {
  color: #1e3a8a;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scale-trainer__spec-note {
  font-size: 0.74rem;
  color: #64748b;
  font-style: italic;
  white-space: nowrap;
}

/* ── ChildCelebration (Task 26 / 27) ─────────────────────────────────────── */

.child-celebration {
  background: linear-gradient(135deg, #fefce8 0%, #f0fdf4 100%);
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0;
}

.child-celebration--compact {
  padding: 0.5rem 0.75rem;
}

.child-celebration__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.child-celebration__emoji {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.child-celebration--compact .child-celebration__emoji {
  font-size: 1.4rem;
}

.child-celebration__text {
  flex: 1;
  min-width: 0;
}

.child-celebration__headline {
  font-size: 1rem;
  font-weight: 700;
  color: #166534;
  margin: 0;
}

.child-celebration--compact .child-celebration__headline {
  font-size: 0.9rem;
}

.child-celebration__sub {
  font-size: 0.82rem;
  color: #15803d;
  margin: 0.15rem 0 0;
}

.child-celebration__badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.child-celebration__badge--passed  { background: #dcfce7; color: #166534; }
.child-celebration__badge--module  { background: #dbeafe; color: #1e40af; }
.child-celebration__badge--course  { background: #fef9c3; color: #854d0e; }
.child-celebration__badge--review  { background: #f3e8ff; color: #7e22ce; }

.child-celebration__action-btn {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.55rem 1rem;
  background: #16a34a;
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}

.child-celebration__action-btn:hover {
  background: #15803d;
}

/* ── ParentActionCards (Task 44) ─────────────────────────────────────────── */
.pac { display:flex; flex-direction:column; gap:0.5rem; margin-bottom:0.5rem; }
.pac__heading { font-size:0.8rem; font-weight:700; color:#475569; text-transform:uppercase; letter-spacing:0.05em; margin:0 0 0.25rem; }
.pac__card { background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:0.65rem 0.85rem; }
.pac__card-header { display:flex; gap:0.6rem; align-items:flex-start; margin-bottom:0.4rem; }
.pac__card-icon { font-size:1.3rem; flex-shrink:0; line-height:1; }
.pac__card-headline { font-size:0.88rem; font-weight:700; color:#1e293b; margin:0; }
.pac__card-sub { font-size:0.78rem; color:#64748b; margin:0.1rem 0 0; }
.pac__card-actions { display:flex; gap:0.4rem; flex-wrap:wrap; }
.pac__action-btn { padding:0.35rem 0.7rem; font-size:0.78rem; font-weight:600; border-radius:6px; border:1px solid #cbd5e1; background:#f8fafc; color:#475569; cursor:pointer; min-height:36px; }
.pac__action-btn:hover:not(:disabled) { background:#f1f5f9; }

/* ── ConfidenceCheckIn (Task 57) ─────────────────────────────────────────── */
.cci { background:#f8fafc; border-radius:10px; padding:0.75rem 1rem; margin:0.5rem 0; text-align:center; }
.cci__question { font-size:0.95rem; font-weight:700; color:#1e293b; margin:0 0 0.6rem; }
.cci__options { display:flex; gap:0.5rem; justify-content:center; flex-wrap:wrap; }
.cci__option-btn { display:flex; flex-direction:column; align-items:center; gap:0.2rem; padding:0.5rem 0.7rem; border:1px solid #e2e8f0; border-radius:10px; background:#fff; cursor:pointer; min-width:56px; min-height:60px; transition:background 0.15s; }
.cci__option-btn:hover { background:#eff6ff; border-color:#93c5fd; }
.cci__emoji { font-size:1.5rem; line-height:1; }
.cci__label { font-size:0.72rem; color:#475569; font-weight:600; }
.cci__skip-btn { margin-top:0.5rem; background:none; border:none; color:#94a3b8; font-size:0.8rem; cursor:pointer; }

/* ── PreviewAsChild (Task 49) ────────────────────────────────────────────── */
.preview-as-child { border:2px dashed #f59e0b; border-radius:10px; padding:0.5rem; }
.preview-as-child__banner { display:flex; align-items:center; gap:0.5rem; background:#fffbeb; border-radius:6px; padding:0.35rem 0.6rem; margin-bottom:0.5rem; }
.preview-as-child__badge { font-size:0.68rem; font-weight:800; background:#f59e0b; color:#fff; padding:0.15rem 0.45rem; border-radius:4px; letter-spacing:0.05em; }
.preview-as-child__name { font-size:0.78rem; color:#78350f; }
.preview-as-child__warning { font-size:0.78rem; color:#dc2626; background:#fee2e2; border-radius:5px; padding:0.3rem 0.6rem; margin:0.2rem 0; }

/* ── DataHealthDashboard (Task 67) ───────────────────────────────────────── */
.dhd__header { display:flex; align-items:center; justify-content:space-between; cursor:pointer; user-select:none; }
.dhd__heading { font-size:1rem; font-weight:700; color:#1e293b; margin:0; }
.dhd__toggle { color:#94a3b8; font-size:1rem; }
.dhd__list { list-style:none; margin:0.5rem 0 0; padding:0; display:flex; flex-direction:column; gap:0.35rem; }
.dhd__row { display:flex; align-items:center; gap:0.5rem; font-size:0.82rem; padding:0.35rem 0.5rem; border-radius:6px; background:#f8fafc; }
.dhd__row-icon { font-size:1rem; flex-shrink:0; }
.dhd__row-text { flex:1; display:flex; flex-direction:column; }
.dhd__row-label { font-weight:600; color:#1e293b; }
.dhd__row-detail { font-size:0.74rem; color:#64748b; }
.dhd__row-status { font-size:0.72rem; font-weight:700; padding:0.15rem 0.4rem; border-radius:4px; white-space:nowrap; }
.dhd__row-status--ok   { background:#dcfce7; color:#166534; }
.dhd__row-status--warn { background:#fef9c3; color:#854d0e; }
.dhd__row-status--error{ background:#fee2e2; color:#991b1b; }
.dhd__fix-btn { font-size:0.75rem; padding:0.2rem 0.5rem; border:1px solid #cbd5e1; border-radius:5px; background:#fff; cursor:pointer; min-height:30px; }
.dhd__refresh-btn { margin-top:0.5rem; padding:0.4rem 0.8rem; border:1px solid #cbd5e1; border-radius:6px; background:#f8fafc; cursor:pointer; font-size:0.82rem; min-height:36px; }

/* ── ChildAssignmentLaunchPanel hear button (Task 61) ───────────────────── */

.child-assignment-launch-panel__hear-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  margin: 0.35rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  cursor: pointer;
  min-height: 40px;
  transition: background 0.15s;
}

.child-assignment-launch-panel__hear-btn:hover:not(:disabled) {
  background: #dbeafe;
}

.child-assignment-launch-panel__hear-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── WeeklyPracticePlan (Task 60) ────────────────────────────────────────── */

.wpp {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem;
}

.wpp__controls { margin-bottom: 1rem; }
.wpp__screen-title { font-size: 1.2rem; font-weight: 700; color: #1e293b; margin: 0 0 0.5rem; }
.wpp__btn-row { display: flex; gap: 0.5rem; }
.wpp__btn { padding: 0.5rem 1rem; border-radius: 7px; border: 1px solid #cbd5e1; cursor: pointer; font-weight: 600; min-height: 44px; }
.wpp__btn--print { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.wpp__btn--print:hover { background: #1e40af; }
.wpp__btn--close { background: #f8fafc; color: #475569; }

.wpp__page { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 1.5rem; }

.wpp__header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1e293b; padding-bottom: 0.75rem; margin-bottom: 1rem; }
.wpp__title { font-size: 1.3rem; font-weight: 800; color: #1e293b; margin: 0; }
.wpp__subtitle { font-size: 0.85rem; color: #64748b; margin: 0.1rem 0 0; }
.wpp__est-time { font-size: 0.82rem; color: #475569; font-weight: 600; white-space: nowrap; }

.wpp__section { margin-bottom: 1.25rem; }
.wpp__section-heading { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #475569; border-bottom: 1px solid #e2e8f0; padding-bottom: 0.2rem; margin: 0 0 0.5rem; }

.wpp__table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.wpp__table th, .wpp__table td { border: 1px solid #e2e8f0; padding: 0.35rem 0.5rem; text-align: center; }
.wpp__table th { background: #f8fafc; font-weight: 700; color: #1e293b; }
.wpp__day { text-align: left !important; font-weight: 600; color: #1e293b; }
.wpp__checkbox { display: inline-block; width: 18px; height: 18px; border: 1.5px solid #94a3b8; border-radius: 4px; }
.wpp__checkbox--done { border-color: #166534; }

.wpp__exercise-list { margin: 0; padding-left: 1.2rem; }
.wpp__exercise-item { margin-bottom: 0.4rem; font-size: 0.85rem; color: #1e293b; }
.wpp__exercise-detail { color: #64748b; }
.wpp__exercise-goal { display: block; font-size: 0.78rem; color: #7c3aed; font-style: italic; }
.wpp__notes { font-size: 0.85rem; color: #1e293b; background: #f8fafc; border-radius: 6px; padding: 0.5rem 0.75rem; white-space: pre-wrap; }
.wpp__passed { font-size: 0.82rem; color: #166534; }
.wpp__footer { font-size: 0.72rem; color: #94a3b8; text-align: center; border-top: 1px solid #e2e8f0; padding-top: 0.5rem; margin-top: 1rem; }

@media print {
  .wpp__screen-only { display: none !important; }
  .wpp { padding: 0; }
  .wpp__page { border: none; padding: 0; }
}

/* ── Curriculum Pack Preview Panel (parent-only) ─────────────────────────── */

.cpp-panel {
  border: 1.5px solid #7c3aed;
  border-radius: 10px;
  background: #faf5ff;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.cpp-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.cpp-panel__header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cpp-panel__badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: #7c3aed;
  color: #fff;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cpp-panel__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #4c1d95;
  margin: 0;
}

.cpp-panel__toggle {
  font-size: 0.78rem;
  background: none;
  border: 1px solid #7c3aed;
  border-radius: 5px;
  color: #7c3aed;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.cpp-panel__summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.cpp-panel__pack-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
}

.cpp-panel__status {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.cpp-panel__status--draft     { background: #fef9c3; color: #854d0e; }
.cpp-panel__status--published { background: #dcfce7; color: #166534; }
.cpp-panel__status--archived  { background: #f1f5f9; color: #64748b; }

.cpp-panel__meta {
  font-size: 0.78rem;
  color: #64748b;
}

.cpp-panel__validation {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  margin-bottom: 0.35rem;
}
.cpp-panel__validation--ok    { background: #dcfce7; color: #166534; }
.cpp-panel__validation--error { background: #fee2e2; color: #991b1b; }

.cpp-panel__body {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cpp-panel__issue-list { margin: 0; }
.cpp-panel__issue-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.25rem;
  color: #475569;
}
.cpp-panel__issue-list ul { margin: 0; padding-left: 1.2rem; }
.cpp-panel__issue { font-size: 0.78rem; margin-bottom: 0.15rem; }
.cpp-panel__issue--error   { color: #991b1b; }
.cpp-panel__issue--warning { color: #92400e; }

.cpp-panel__ex-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin: 0 0 0.35rem;
}
.cpp-panel__ex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid #e9d5ff;
}
.cpp-panel__ex-row:last-child { border-bottom: none; }
.cpp-panel__ex-id    { color: #6b21a8; font-family: monospace; min-width: 8rem; }
.cpp-panel__ex-title { flex: 1; color: #1e293b; font-weight: 600; }
.cpp-panel__ex-kind  { color: #7c3aed; font-size: 0.7rem; }
.cpp-panel__ex-hand  { color: #475569; font-size: 0.7rem; }
.cpp-panel__ex-root  { color: #475569; font-size: 0.7rem; font-weight: 700; min-width: 2rem; text-align: right; }

.cpp-panel__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cpp-panel__btn {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  border: none;
}
.cpp-panel__btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cpp-panel__btn--secondary {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #d8b4fe;
}
.cpp-panel__btn--primary {
  background: #7c3aed;
  color: #fff;
}
.cpp-panel__btn--primary:hover:not(:disabled) { background: #6d28d9; }

.cpp-panel__result {
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 5px;
}
.cpp-panel__result--ok   { background: #dcfce7; color: #166534; }
.cpp-panel__result--fail { background: #fee2e2; color: #991b1b; }

/* ── Curriculum Exercise Runner (Phase 17B) ────────────────────────────────── */
.curriculum-runner { border: 2px solid #1d4ed8; border-radius: 12px; padding: 16px; margin-top: 16px; background: #eff6ff; }
.curriculum-runner-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.curriculum-runner-title { font-size: 1rem; font-weight: 700; color: #1e40af; }
.curriculum-runner-exit { background: #e5e7eb; border: none; border-radius: 6px; padding: 6px 14px; font-size: 0.82rem; cursor: pointer; }
.curriculum-runner-stats { font-size: 0.82rem; color: #374151; margin-bottom: 10px; }
.curriculum-runner-complete { background: #d1fae5; color: #065f46; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.curriculum-runner-exit-btn { background: #065f46; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-size: 0.82rem; cursor: pointer; }
.cpp-preview-btn { background: #dbeafe; color: #1d4ed8; border: none; border-radius: 4px; padding: 2px 8px; font-size: 0.75rem; cursor: pointer; margin-left: 8px; }
/* Locked exercise notice in curriculum mode */
.curriculum-locked-notice { font-size: 0.78rem; color: #6b7280; background: #f3f4f6; border-radius: 6px; padding: 4px 10px; margin-bottom: 8px; }

/* ── Child Course Home (Phase 17C) ─────────────────────────────────────────── */
.child-course-home { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border: 2px solid #93c5fd; border-radius: 14px; padding: 20px; margin: 16px 0; }
.child-course-loading { color: #6b7280; font-style: italic; padding: 16px; background: #f9fafb; border-radius: 10px; margin: 16px 0; }
.cch-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cch-badge { background: #1d4ed8; color: #fff; border-radius: 20px; padding: 3px 12px; font-size: 0.82rem; font-weight: 600; }
.cch-course-title { font-size: 1rem; font-weight: 700; color: #1e3a8a; }
.cch-module-row, .cch-exercise-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.cch-module-label, .cch-exercise-label { font-size: 0.78rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; min-width: 68px; }
.cch-module-title, .cch-exercise-title { font-size: 0.9rem; color: #1e3a8a; }
.cch-continue-btn { background: #1d4ed8; color: #fff; border: none; border-radius: 10px; padding: 12px 28px; font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 14px; display: block; width: 100%; min-height: 48px; }
.cch-continue-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Enrolment section inside CurriculumPackPreviewPanel */
.cpp-section-label { font-size: 0.78rem; font-weight: 700; color: #374151; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.cpp-enrol-row { margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 16px; }
.cpp-enrol-note { font-size: 0.82rem; color: #555; margin-bottom: 10px; }
.cpp-enrol-btn { background: #059669; color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 0.9rem; cursor: pointer; font-weight: 600; }
.cpp-enrol-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cpp-enrol-result { margin-top: 10px; padding: 8px 14px; border-radius: 8px; font-size: 0.85rem; }
.cpp-result--success { background: #d1fae5; color: #065f46; }
.cpp-result--fail { background: #fee2e2; color: #991b1b; }

/* ── Phase 17D — completion persistence ──────────────────────────────────── */
.curriculum-runner-saving { font-size: 0.82rem; color: #1d4ed8; margin-top: 6px; animation: pulse 1s ease-in-out infinite; }
.curriculum-runner-save-error { font-size: 0.82rem; color: #b91c1c; margin-top: 6px; }
.curriculum-runner-saved-ok { font-size: 0.82rem; color: #065f46; margin-top: 6px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
/* Course complete banner */
.cch-course-complete { background: linear-gradient(135deg, #d1fae5, #a7f3d0); border: 2px solid #34d399; border-radius: 14px; padding: 24px; text-align: center; }
.cch-course-complete-emoji { font-size: 2.5rem; display: block; margin-bottom: 8px; }
.cch-course-complete-title { font-size: 1.2rem; font-weight: 800; color: #065f46; }
/* Fetch error in ChildCourseHome */
.cch-fetch-error { font-size: 0.82rem; color: #b91c1c; background: #fee2e2; border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }

/* ── Phase 17F: Pack selector in preview panel ───────────────────────────── */
.cpp-pack-selector { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.cpp-pack-selector-label { font-size: 0.78rem; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.cpp-pack-select-btn { background: #e5e7eb; color: #111827; border: none; border-radius: 6px; padding: 5px 12px; font-size: 0.82rem; cursor: pointer; }
.cpp-pack-select-btn--active { background: #1d4ed8; color: #fff; }

/* ── Phase 18A: ChildCourseHome progress display ─────────────────────────── */
.cch-position-meta { font-size: 0.75rem; color: #9ca3af; margin-left: 4px; }
.cch-progress-row { margin: 10px 0 4px; }
.cch-progress-bar-wrap { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.cch-progress-bar-fill { height: 100%; background: linear-gradient(90deg, #1d4ed8, #3b82f6); border-radius: 4px; transition: width 0.4s ease; }
.cch-progress-meta { font-size: 0.78rem; color: #6b7280; }

/* ── Phase 18A: ChildCourseHome paused state ─────────────────────────────── */
.cch-paused { background: #f3f4f6; border: 2px solid #d1d5db; border-radius: 14px; padding: 20px; text-align: center; }
.cch-paused-icon { font-size: 1.8rem; color: #6b7280; margin-bottom: 6px; font-weight: 700; letter-spacing: 4px; }
.cch-paused-title { font-size: 1.1rem; font-weight: 700; color: #374151; margin-bottom: 6px; }
.cch-paused-message { font-size: 0.9rem; color: #6b7280; margin-bottom: 10px; }
.cch-course-complete-meta { font-size: 0.85rem; color: #065f46; margin-top: 6px; }

/* ── Phase 18A: ParentCourseProgressPanel ────────────────────────────────── */
.cpp-progress-section { margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid #e5e7eb; }
.cpp-section-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; margin-bottom: 8px; display: block; }
.pcpp-panel { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; font-size: 0.88rem; }
.pcpp-loading, .pcpp-empty { color: #9ca3af; font-size: 0.85rem; padding: 8px 0; }
.pcpp-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pcpp-name { font-weight: 700; color: #111827; font-size: 1rem; }
.pcpp-status { font-size: 0.75rem; font-weight: 600; border-radius: 12px; padding: 2px 10px; }
.pcpp-status--active { background: #d1fae5; color: #065f46; }
.pcpp-status--paused { background: #fef9c3; color: #713f12; }
.pcpp-status--completed { background: #e0e7ff; color: #3730a3; }
.pcpp-status--other { background: #f3f4f6; color: #6b7280; }
.pcpp-progress-bar-wrap { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.pcpp-progress-bar-fill { height: 100%; background: linear-gradient(90deg, #059669, #34d399); border-radius: 4px; transition: width 0.4s ease; }
.pcpp-progress-meta { font-size: 0.78rem; color: #6b7280; margin-bottom: 10px; }
.pcpp-position-grid { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.pcpp-position-item { display: flex; gap: 8px; align-items: baseline; }
.pcpp-pos-label { font-size: 0.72rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.04em; min-width: 80px; }
.pcpp-pos-value { font-size: 0.85rem; color: #374151; }
.pcpp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pcpp-btn { border: none; border-radius: 7px; padding: 7px 16px; font-size: 0.83rem; font-weight: 600; cursor: pointer; }
.pcpp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pcpp-btn--pause { background: #fef3c7; color: #92400e; border: 1px solid #fbbf24; }
.pcpp-btn--resume { background: #d1fae5; color: #065f46; border: 1px solid #34d399; }
.pcpp-action-msg { font-size: 0.8rem; color: #374151; }

/* -- Phase 18B: ParentCourseProgressPanel reset accordion ------------------- */
.pcpp-reset-section { margin-top: 14px; border-top: 1px solid #e5e7eb; padding-top: 10px; }
.pcpp-reset-toggle { background: none; border: none; color: #6b7280; font-size: 0.78rem; cursor: pointer; padding: 0; text-decoration: underline; }
.pcpp-reset-toggle:hover { color: #374151; }
.pcpp-reset-body { margin-top: 10px; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pcpp-reset-warning { font-size: 0.82rem; color: #9a3412; margin: 0; line-height: 1.5; }
.pcpp-reset-check-label { font-size: 0.82rem; color: #374151; display: flex; align-items: flex-start; gap: 8px; cursor: pointer; line-height: 1.5; }
.pcpp-reset-confirm-row { display: flex; flex-direction: column; gap: 4px; }
.pcpp-reset-type-label { font-size: 0.78rem; color: #374151; }
.pcpp-reset-type-input { border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px; font-size: 0.88rem; width: 120px; font-family: monospace; letter-spacing: 0.1em; }
.pcpp-btn--reset { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.pcpp-btn--reset:not(:disabled):hover { background: #fecaca; }
.pcpp-btn--reset:disabled { opacity: 0.4; cursor: not-allowed; }
.pcpp-reset-msg { font-size: 0.82rem; margin: 0; padding: 6px 10px; border-radius: 6px; }
.pcpp-reset-msg--ok { background: #d1fae5; color: #065f46; }
.pcpp-reset-msg--error { background: #fee2e2; color: #991b1b; }
.pcpp-reset-msg--error { background: #fee2e2; color: #991b1b; }

/* ── Phase 18C: ParentCourseProgressPanel — lifecycle additions ───────────── */
.pcpp-panel--no-enrolment { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; font-size: 0.88rem; }
.pcpp-no-enrolment-text { color: #0c4a6e; margin: 0; font-weight: 500; }
.pcpp-btn--assign { background: #0ea5e9; color: #fff; border: none; }
.pcpp-btn--assign:hover:not(:disabled) { background: #0284c7; }
.pcpp-action-msg--ok    { color: #065f46; }
.pcpp-action-msg--error { color: #991b1b; }
.pcpp-destructive-section { margin-top: 14px; border-top: 1px solid #e5e7eb; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.pcpp-accordion { border-radius: 8px; overflow: hidden; border: 1px solid #e5e7eb; }
.pcpp-accordion--reset   { border-color: #fed7aa; }
.pcpp-accordion--unassign { border-color: #fca5a5; }
.pcpp-accordion-toggle { width: 100%; text-align: left; background: none; border: none; padding: 9px 14px; font-size: 0.78rem; color: #6b7280; cursor: pointer; text-decoration: underline; }
.pcpp-accordion--reset   .pcpp-accordion-toggle { color: #92400e; background: #fff7ed; }
.pcpp-accordion--unassign .pcpp-accordion-toggle { color: #991b1b; background: #fef2f2; }
.pcpp-accordion-toggle:hover { opacity: 0.8; }
.pcpp-accordion-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pcpp-accordion--reset   .pcpp-accordion-body { background: #fff7ed; }
.pcpp-accordion--unassign .pcpp-accordion-body { background: #fef2f2; }
.pcpp-accordion-warning { font-size: 0.82rem; color: #374151; margin: 0; line-height: 1.55; }
.pcpp-accordion--reset   .pcpp-accordion-warning { color: #9a3412; }
.pcpp-accordion--unassign .pcpp-accordion-warning { color: #991b1b; }
.pcpp-check-label { font-size: 0.82rem; color: #374151; display: flex; align-items: flex-start; gap: 8px; cursor: pointer; line-height: 1.5; }
.pcpp-confirm-row { display: flex; flex-direction: column; gap: 4px; }
.pcpp-confirm-type-label { font-size: 0.78rem; color: #374151; }
.pcpp-confirm-type-input { border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px; font-size: 0.88rem; width: 140px; font-family: monospace; letter-spacing: 0.1em; background: #fff; color: #111827; }
.pcpp-accordion-msg { font-size: 0.82rem; margin: 0; padding: 6px 10px; border-radius: 6px; }
.pcpp-accordion-msg--ok    { background: #d1fae5; color: #065f46; }
.pcpp-accordion-msg--error { background: #fee2e2; color: #991b1b; }
.pcpp-btn--unassign { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.pcpp-btn--unassign:not(:disabled):hover { background: #fecaca; }
.pcpp-btn--unassign:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── CurriculumPackPreviewPanel — Preview Only badge ─────────────────────── */
.cpp-preview-only-badge { display: inline-block; margin-left: 10px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; background: #fef9c3; color: #854d0e; border-radius: 10px; padding: 2px 8px; vertical-align: middle; }

/* ── CourseExerciseRunner (cer-*) ────────────────────────────────────────── */
.course-exercise-runner {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #1e1b4b;          /* deep indigo — matches child theme dark */
  color: #f1f5f9;
  padding: 0;
  box-sizing: border-box;
}

/* Header */
.cer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #312e81;
  border-bottom: 2px solid #4338ca;
  gap: 12px;
}
.cer-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #e0e7ff;
  flex: 1;
  letter-spacing: 0.01em;
}
.cer-exit-btn {
  background: #4f46e5;
  color: #fff;
  border: 2px solid #818cf8;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
}
.cer-exit-btn:hover { background: #4338ca; }

/* Preview banner */
.cer-preview-banner {
  background: #fef9c3;
  color: #713f12;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  padding: 6px 16px;
  border-bottom: 1px solid #fde68a;
}

/* Progress bar */
.cer-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px 0;
}
.cer-progress-bar-wrap {
  flex: 1;
  height: 12px;
  background: #312e81;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #4338ca;
}
.cer-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a5b4fc);
  border-radius: 6px;
  transition: width 0.35s ease;
}
.cer-progress-text {
  font-size: 1.1rem;
  font-weight: 800;
  color: #e0e7ff;
  min-width: 50px;
  text-align: right;
  letter-spacing: 0.03em;
}

/* Feedback panel (cfp-*) */
.cfp-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 20px 12px;
  text-align: center;
  min-height: 80px;
}
.cfp-hint {
  font-size: 1.05rem;
  font-weight: 600;
  color: #c7d2fe;
  line-height: 1.5;
}
.cfp-hint strong {
  color: #fff;
  font-size: 1.15rem;
  background: #4f46e5;
  padding: 2px 10px;
  border-radius: 6px;
  display: inline-block;
}
.cfp-message {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.4;
}
.cfp-correct .cfp-message { color: #6ee7b7; }
.cfp-wrong   .cfp-message { color: #fca5a5; }
.cfp-next-hint {
  font-size: 0.9rem;
  color: #a5b4fc;
  font-weight: 600;
}
.cfp-next-hint strong { color: #fff; }

/* Keyboard view container */
.course-keyboard-view,
.ckv-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px 24px;
  gap: 8px;
}

/* Completion banner */
.cer-complete {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 24px;
  text-align: center;
}
.cer-complete-message {
  font-size: 1.6rem;
  font-weight: 900;
  color: #6ee7b7;
  letter-spacing: 0.01em;
}
.cer-saving   { font-size: 0.9rem; color: #a5b4fc; }
.cer-save-error { font-size: 0.9rem; color: #fca5a5; font-weight: 600; }
.cer-saved-ok { font-size: 0.9rem; color: #6ee7b7; font-weight: 600; }
.cer-continue-btn {
  background: #6366f1;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 52px;
  letter-spacing: 0.02em;
}
.cer-continue-btn:hover { background: #4f46e5; }

/* Unsupported exercise type */
.cer-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 24px;
  text-align: center;
}
.cer-unsupported-message {
  font-size: 1.1rem;
  color: #fde68a;
  font-weight: 600;
  max-width: 400px;
  line-height: 1.5;
}
.cer-dev-detail {
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: monospace;
  background: #0f172a;
  padding: 8px 14px;
  border-radius: 6px;
  max-width: 480px;
  word-break: break-all;
}

/* ── CourseKeyboardView — stable wide keyboard (Phase 18E) ───────────────── */
/* Override the compact default so the full G2–F5 baseline range is visible.  */
/* Keys are sized to be readable by children on iPad landscape.                */

.ckv-wrap {
  width: 100%;
  padding: 16px 12px 28px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* Piano card — dark-theme-aware, light interior so keys read clearly */
.ckv-wrap .piano-note-diagram {
  background: #f8fafc;
  border: 2px solid #4338ca;
  border-radius: 10px;
  padding: 10px 14px 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Key sizing: large enough for children, scales with viewport */
.ckv-wrap .piano-keyboard-inner {
  --piano-white-w: clamp(1.4rem, 3.2vw, 2rem);
  --piano-white-h: clamp(3.8rem, 8vh, 5.2rem);
  --piano-black-w: clamp(0.85rem, 1.9vw, 1.2rem);
}

/* Keyboard scroll: left-align so tapping/scrolling starts at the low end */
.ckv-wrap .piano-keyboard-scroll {
  justify-content: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  /* Scroll indicator so the child knows they can scroll */
  scroll-behavior: smooth;
}

/* Highlighted (expected) key: strong green so it stands out against many keys */
.ckv-wrap .piano-key-surface--expected {
  background: #4ade80 !important;
}

.ckv-wrap .piano-key-surface--expected.piano-white-key-surface {
  background: #4ade80 !important;
}

.ckv-wrap .piano-key-surface--expected.piano-black-key-surface {
  background: #16a34a !important;
}

/* Label under/on expected key */
.ckv-wrap .piano-key-label-text {
  font-size: clamp(0.55rem, 1.2vw, 0.72rem);
  font-weight: 700;
  color: #166534;
}

/* ============================================================
   Phase 18C: Joelle Pack Cleanup — Pack selector type badges
   and multi-enrolment course list
   ============================================================ */

/* Pack type badges in CurriculumPackPreviewPanel selector */
.cpp-pack-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  margin-right: 5px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cpp-pack-type-badge--full { background: #1d4ed8; color: #fff; }
.cpp-pack-type-badge--sample { background: #f59e0b; color: #fff; }

/* Sample pack select button — amber tint */
.cpp-pack-select-btn--sample { border-color: #fcd34d !important; }
.cpp-pack-select-btn--sample.cpp-pack-select-btn--active { background: #fffbeb !important; color: #92400e !important; }

/* Sample pack warning in pack summary */
.cpp-pack-sample-warning {
  font-size: 0.75rem;
  color: #92400e;
  background: #fef3c7;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-weight: 600;
}

/* Show/hide test packs toggle */
.cpp-test-packs-toggle {
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  margin-left: auto;
}
.cpp-test-packs-toggle:hover { background: #e5e7eb; }
.cpp-test-packs-toggle--active { color: #92400e; background: #fef3c7; border-color: #fcd34d; }

/* ---- Multi-enrolment course list (ChildCourseHome) ---- */
.cch-multi-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}

.cch-list-item {
  background: #fff;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
}
.cch-list-item--paused {
  background: #f9fafb;
  border-color: #d1d5db;
}

.cch-list-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.cch-list-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e3a8a;
  flex: 1;
}
.cch-list-paused-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: #6b7280;
  color: #fff;
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
}
.cch-list-complete-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  border-radius: 10px;
  padding: 0.1rem 0.45rem;
}

.cch-list-module {
  font-size: 0.82rem;
  color: #374151;
  margin-bottom: 6px;
}
.cch-list-ex-pos {
  color: #6b7280;
}

.cch-list-progress-row {
  margin-bottom: 6px;
}
.cch-list-progress-bar-wrap {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}
.cch-list-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.cch-list-progress-meta { font-size: 0.75rem; color: #6b7280; }

.cch-list-continue-btn {
  font-size: 0.85rem;
  font-weight: 700;
  background: #1d4ed8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  min-height: 40px;
  cursor: pointer;
  margin-top: 4px;
  touch-action: manipulation;
}
.cch-list-continue-btn:hover { background: #1e40af; }

.cch-list-paused-msg, .cch-list-complete-msg {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 4px 0 0;
  font-style: italic;
}
.cch-list-complete-msg { color: #065f46; }
.piano-sound-status__progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #eceff1;
  overflow: hidden;
  margin: 0.25rem 0 0.4rem;
}

.piano-sound-status__bar {
  height: 100%;
  background: linear-gradient(90deg, #6da6ff, #3f7be0);
  transition: width 0.4s ease;
}

.piano-sound-status__detail {
  margin: 0 0 0.5rem;
}

.piano-sound-status__velocity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

.piano-sound-status__velocity-label {
  color: #324050;
}

.piano-sound-status__velocity-buttons {
  display: flex;
  gap: 0.25rem;
}

.piano-sound-status__velocity-btn {
  padding: 0.2rem 0.55rem;
  border: 1px solid #cfd8e3;
  border-radius: 5px;
  background: #fff;
  color: #324050;
  font-size: 0.8rem;
  cursor: pointer;
}

.piano-sound-status__velocity-btn:hover {
  background: #f4f7fb;
}

.piano-sound-status__velocity-btn.is-active {
  background: #324050;
  color: #fff;
  border-color: #324050;
}
/* ── Circle of Fifths collapsible toggle ───────────────────────────────────── */

.cof-collapsible {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 0;
}

.cof-toggle-btn {
  appearance: none;
  background: var(--blue-soft, #eef2ff);
  border: 1px solid var(--blue, #6c8eff);
  border-radius: 6px;
  color: var(--blue-deep, #3a5bd9);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 5px 14px;
  transition: filter 0.12s ease, transform 0.06s ease;
  white-space: nowrap;
}

.cof-toggle-btn:hover {
  filter: brightness(0.95);
}

.cof-toggle-btn:active {
  transform: translateY(1px);
}

/* ── Circle of Fifths ─────────────────────────────────────────────────────── */

.cof-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0 8px;
}

.cof-svg {
  width: 340px;
  height: 340px;
  display: block;
  overflow: visible;
  /* Light, single shadow — much less heavy than before */
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.18));
}

/* All interactive segments */
.cof-seg {
  cursor: pointer;
}

.cof-seg path {
  transition: fill 0.18s ease;
}

/* Typography for SVG text elements */
.cof-label-major {
  font-family: Georgia, 'Times New Roman', serif;
  pointer-events: none;
  user-select: none;
}

.cof-label-sig {
  font-family: system-ui, sans-serif;
  pointer-events: none;
  user-select: none;
}

.cof-label-minor {
  font-family: system-ui, sans-serif;
  pointer-events: none;
  user-select: none;
}

.cof-center-key {
  font-family: Georgia, 'Times New Roman', serif;
  pointer-events: none;
  user-select: none;
}

.cof-center-relative {
  font-family: system-ui, sans-serif;
  pointer-events: none;
  user-select: none;
}
/* ═══════════════════════════════════════════════════════════════════════════
   NOTATION TRAINER STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

.notation-trainer {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.notation-trainer-header {
  display: grid;
  gap: 0.5rem;
}

.notation-trainer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #1f2937;
}

/* Stage tab bar */
.notation-stage-tabs {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.notation-tab {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: #475569;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
  min-height: 44px;
}

.notation-tab:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #1f2937;
}

.notation-tab--active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.notation-tab-number {
  font-size: 0.72rem;
  font-weight: 700;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.12);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.notation-tab--active .notation-tab-number {
  background: rgba(255,255,255,0.25);
}

/* Shared settings row */
.notation-shared-settings {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.notation-setting-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.notation-setting-select {
  font-size: 0.82rem;
  padding: 0.25rem 0.5rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  max-width: 220px;
}

/* MIDI activation row */
.notation-midi-row {
  margin-top: 0.25rem;
}

.notation-activate-btn {
  padding: 0.4rem 1rem;
  border: 1.5px solid #2563eb;
  border-radius: 6px;
  background: #fff;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.notation-activate-btn:hover {
  background: #eff6ff;
}

.notation-midi-active {
  font-size: 0.8rem;
  font-weight: 600;
  color: #166534;
  margin: 0;
}

/* Sub-panel (shared by all trainer stages) */
.notation-panel {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.notation-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.notation-panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #1f2937;
}

.notation-score-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.notation-score-text {
  font-size: 0.8rem;
  color: #374151;
}

/* Instruction + hear button row */
.notation-instruction-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.notation-instruction-row .notation-instruction {
  margin: 0;
  flex: 1;
}

.notation-hear-btn {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid #7c3aed;
  border-radius: 5px;
  background: #faf5ff;
  color: #6d28d9;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  flex-shrink: 0;
}

.notation-hear-btn:hover {
  background: #ede9fe;
}

/* When Play / Stop appear together in the section controls they must look
 * like a matched pair — same height, padding, radius, font, icon gap.
 * The base .notation-stop-btn rule sits below alongside .notation-start-btn
 * and uses big-button sizing; here we down-size the in-row variant so the
 * two pill buttons line up cleanly on iPad and wrap together on narrower
 * screens. min-height 44 px so touch targets stay comfortable on iPad. */
.notation-section-controls .notation-hear-btn,
.notation-section-controls .notation-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.45rem 0.95rem;
  min-height: 44px;
  border-radius: 6px;
  border-width: 1.5px;
  border-style: solid;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
  cursor: pointer;
  touch-action: manipulation;
}

.notation-section-controls .notation-hear-btn {
  border-color: #7c3aed;
  background: #faf5ff;
  color: #6d28d9;
}
.notation-section-controls .notation-hear-btn:hover:not(:disabled) {
  background: #ede9fe;
}

.notation-section-controls .notation-stop-btn {
  border-color: #dc2626;
  background: #fee2e2;
  color: #b91c1c;
}
.notation-section-controls .notation-stop-btn:hover:not(:disabled) {
  background: #fecaca;
}

.notation-section-controls .notation-stop-btn:disabled,
.notation-section-controls .notation-hear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Staff area */
.notation-staff-area {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 0.5rem;
  min-height: 160px;
}

.staff-display svg {
  display: block;
}

/* Instructions */
.notation-instruction {
  font-size: 0.9rem;
  color: #374151;
  margin: 0;
}

/* Answer buttons */
.notation-answer-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.notation-answer-btn {
  min-width: 2.8rem;
  min-height: 44px;
  padding: 0.4rem 0.65rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}

.notation-answer-btn:hover:not(.disabled) {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.notation-answer-btn.disabled,
.notation-answer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Feedback */
.notation-feedback {
  padding: 0.5rem 0.75rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 500;
  min-width: 0;
}

.notation-feedback--correct {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.notation-feedback--wrong {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Buttons */
.notation-next-btn,
.notation-start-btn,
.notation-stop-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  border: none;
  touch-action: manipulation;
  letter-spacing: 0.01em;
}

.notation-next-btn {
  background: #2563eb;
  color: #fff;
}

.notation-next-btn:hover {
  background: #1d4ed8;
}

.notation-start-btn {
  background: #16a34a;
  color: #fff;
}

.notation-start-btn:hover {
  background: #15803d;
}

.notation-stop-btn {
  background: #dc2626;
  color: #fff;
}

.notation-stop-btn:hover {
  background: #b91c1c;
}

.notation-reset-btn,
.notation-show-btn {
  padding: 0.3rem 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 5px;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  min-height: 36px;
}

.notation-reset-btn:hover,
.notation-show-btn:hover {
  background: #e2e8f0;
}

/* Speak / read-aloud button — matches hear-btn palette but distinct colour */
.notation-speak-btn {
  padding: 0.3rem 0.75rem;
  border: 1.5px solid #0369a1;
  border-radius: 5px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  flex-shrink: 0;
}

.notation-speak-btn:hover {
  background: #e0f2fe;
}

/* Feedback row — allows speak button to sit inline with feedback text */
.notation-feedback-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* Keyboard hint */
.notation-keyboard-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 400;
}

/* Hints */
.notation-hint {
  font-size: 0.8rem;
  margin: 0;
  color: #64748b;
}

.notation-hint--muted {
  color: #94a3b8;
}

.notation-hint--ok {
  color: #166534;
}

/* Note Card Trainer */
.note-card-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  min-height: 100px;
  justify-content: center;
}

.note-card-name {
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: -0.02em;
  line-height: 1;
}

.notation-staff-reveal {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 0.5rem;
}

/* Progress row */
.notation-progress-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.notation-progress-text {
  font-size: 0.82rem;
  color: #374151;
}

.notation-accuracy {
  font-size: 0.82rem;
  font-weight: 600;
}

.notation-progress-bar-outer {
  flex: 1;
  min-width: 80px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.notation-progress-bar-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.2s;
}

.notation-expected-hint {
  font-size: 0.8rem;
}

.notation-controls {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Music Piece Trainer */
.notation-file-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.notation-file-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #374151;
}

.notation-file-input {
  font-size: 0.82rem;
  color: #374151;
  max-width: 340px;
}

.notation-file-hint {
  font-size: 0.76rem;
}

.notation-loading {
  font-size: 0.84rem;
  color: #64748b;
  font-style: italic;
  margin: 0;
}

.notation-piece-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}

.notation-piece-composer {
  font-size: 0.84rem;
  color: #475569;
}

.notation-osmd-area {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;  /* smooth scroll on iPad */
  min-height: 200px;
  transition: border-color 0.08s, box-shadow 0.08s;
}

/* Red flash when a wrong note is played */
.notation-osmd-area--wrong {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

/* Green flash when a correct note is hit during Practice Accuracy */
.notation-osmd-area--correct {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

/* Practice Accuracy v1 — running summary row.
   Compact horizontal pill row shown live during practice and after the
   session ends. Pills are sized for iPad landscape; counters stay
   readable at glance without dominating the viewport. */
.practice-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  margin: 0.5rem 0;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.practice-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #374151;
}

.practice-summary-pill--correct {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.practice-summary-pill--wrong {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.practice-summary-pill--missed {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #6b7280;
}

.practice-summary-pill--score {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
  font-size: 0.95rem;
  padding: 0.25rem 0.65rem;
}

.practice-summary-pill--score.is-warn {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

/* Practice Accuracy v1 — end-of-session summary block.
   Larger, calmer panel that lingers after Stop / natural finish so the
   child can read the result without scrolling. */
.practice-session-summary {
  margin: 0.7rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  color: #065f46;
  display: grid;
  gap: 0.4rem;
  min-width: 0;
  box-sizing: border-box;
}

.practice-session-summary-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
}

.practice-session-summary-title strong {
  font-size: 1.15rem;
}

.practice-session-summary-body {
  font-size: 0.88rem;
  display: grid;
  gap: 0.15rem;
}

.practice-session-summary-context {
  font-size: 0.82rem;
  color: #047857;
  opacity: 0.85;
}

.practice-session-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.45rem;
  margin: 0.45rem 0 0.3rem;
}

.practice-session-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.5rem;
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  min-width: 0;
  gap: 0.15rem;
}

.practice-session-summary-stat-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.practice-session-summary-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.practice-session-summary-stat-value.is-ok    { color: #047857; }
.practice-session-summary-stat-value.is-warn  { color: #b91c1c; }
.practice-session-summary-stat-value.is-muted { color: #6b7280; }

.practice-session-summary-message {
  margin-top: 0.35rem;
  padding: 0.4rem 0.55rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #065f46;
  line-height: 1.35;
}

/* Bar review (Task 2). Compact chip row inside the end-of-session
   panel. The icon column (✓/⚠) is the at-a-glance signal; the
   percentage is for parents reviewing alongside the child. */
.practice-session-bar-review {
  margin: 0.4rem 0 0.2rem;
  display: grid;
  gap: 0.25rem;
}

.practice-session-bar-review-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.practice-session-bar-review-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.practice-session-bar-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #374151;
}

.practice-session-bar-chip--strong {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.practice-session-bar-chip--practise {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

.practice-session-bar-chip-mark {
  font-weight: 700;
}

.practice-session-bar-chip-pct {
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

/* Tempo / next-step recommendation banner (Task 4). Sits between
   the encouragement message and the Practise-problem-bars button.
   Colour band reflects the result band (excellent / good / practise
   / tooHard) so the child has a quick at-a-glance read. */
.practice-session-recommendation {
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #374151;
  font-size: 0.88rem;
  line-height: 1.35;
}

.practice-session-recommendation-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: #475569;
  margin-right: 0.15rem;
}

.practice-session-recommendation--excellent {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.practice-session-recommendation--good {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.practice-session-recommendation--practise {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #78350f;
}

.practice-session-recommendation--tooHard {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

/* "Practise problem bars" action row (Task 3). Single conspicuous
   button at the bottom of the session summary; only rendered when
   problem bars exist. Styled to feel like a positive call-to-action,
   not a warning — so the child isn't discouraged by the framing. */
.practice-session-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.practice-session-summary-action-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid #1e40af;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  min-height: 44px;
  touch-action: manipulation;
}

.practice-session-summary-action-btn:hover {
  background: #1e3a8a;
  border-color: #1e3a8a;
}

.practice-session-summary-action-btn:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.45);
  outline-offset: 2px;
}

/* Practice Accuracy v1 — per-group feedback strip.
   One cell per chord group; color encodes status. The current cursor
   cell is outlined so the child can locate themselves in the section. */
.practice-feedback-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 0.4rem 0.55rem;
  margin: 0.35rem 0;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.practice-feedback-cell {
  width: 10px;
  height: 18px;
  border-radius: 2px;
  background: #e5e7eb;     /* pending */
  border: 1px solid transparent;
  flex: 0 0 auto;
}

.practice-feedback-cell--correct { background: #22c55e; }
.practice-feedback-cell--partial { background: #fbbf24; }
.practice-feedback-cell--missed  { background: #94a3b8; }
.practice-feedback-cell--wrong   { background: #ef4444; }

.practice-feedback-cell.is-current {
  outline: 2px solid #1e3a8a;
  outline-offset: 1px;
}

/* Active practice status bar (Task 6).
   Single compact line that surfaces hand mode, measure range, BPM,
   current bar, and running counts. Sits between the OSMD area and
   the per-bar feedback strip so the child sees context + score
   feedback together. Wraps gracefully on narrow viewports. */
.practice-active-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.9rem;
  padding: 0.55rem 0.85rem;
  margin: 0.5rem 0;
  border-radius: 8px;
  background: #eef2ff;
  border: 1.5px solid #c7d2fe;
  color: #1e3a8a;
  font-size: 0.92rem;
  min-width: 0;
  box-sizing: border-box;
}

.practice-active-status-context {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.2rem 0.45rem;
  font-weight: 500;
  line-height: 1.35;
}

.practice-active-status-context strong {
  color: #1e1b4b;
  font-weight: 700;
}

/* Count-in badge — appears in the active-status strip during the
   practice pre-roll so the child can see how many bars remain before
   the practice clock starts. */
.practice-active-status-countin {
  display: inline-block;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.practice-active-status-counts {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.practice-active-status-count {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #374151;
  font-variant-numeric: tabular-nums;
  min-height: 28px;
  font-size: 0.92rem;
}

.practice-active-status-count.is-ok    { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.practice-active-status-count.is-warn  { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.practice-active-status-count.is-muted { color: #6b7280; border-color: #d1d5db; background: #f9fafb; }
.practice-active-status-count.is-score { font-size: 1rem; padding: 0.25rem 0.75rem; }

/* Practice Accuracy v1 — per-bar score-level feedback strip (Task 1).
   Sits directly under the OSMD area so each bar's status reads at the
   same eye-line as the notation. One labelled cell per measure; the
   colour bands match the in-summary "strong / practise / problem" copy
   so the live cue is consistent with what the child sees at the end
   of the session. Wraps on narrow viewports without scrolling. */
.practice-bar-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.55rem;
  margin: 0.4rem 0;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  align-items: stretch;
}

.practice-bar-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 2.8rem;
  min-height: 38px;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: #e5e7eb;            /* pending */
  border: 1px solid #d1d5db;
  color: #374151;
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
}

.practice-bar-cell-num {
  font-weight: 700;
  font-size: 0.85rem;
}

.practice-bar-cell-pct {
  font-size: 0.7rem;
  opacity: 0.95;
}

.practice-bar-cell--pending {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.practice-bar-cell--strong {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.practice-bar-cell--practise {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.practice-bar-cell--missed {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #475569;
}

.practice-bar-cell--wrong {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.practice-bar-cell.is-current {
  outline: 2px solid #1e3a8a;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

/* Current expected event hint — keeps the active chord visible even
   when the OSMD cursor sits on a dense passage. */
.practice-current-expected {
  margin: 0.3rem 0;
  padding: 0.35rem 0.6rem;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  color: #1e3a8a;
  font-size: 0.88rem;
}

.practice-current-expected-label {
  font-weight: 600;
}

.practice-current-expected-bar {
  color: #4338ca;
}

.osmd-container {
  min-height: 200px;
}

.osmd-error {
  padding: 1rem;
}

.notation-section-controls {
  display: flex;
  gap: 0.5rem 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  min-width: 0;
  box-sizing: border-box;
}

.notation-section-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.notation-section-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #374151;
  white-space: nowrap;
  min-height: 36px;
}

.notation-number-input {
  width: 4.2rem;
  padding: 0.3rem 0.45rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
  min-height: 36px;
  box-sizing: border-box;
  /* Disable iOS spinner styling jitter when the number input has focus. */
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.notation-section-hint {
  font-size: 0.76rem;
}

/* Import warnings */
.notation-warnings {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  display: grid;
  gap: 0.35rem;
}

.notation-piece-deleted-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  color: #374151;
  font-size: 0.88rem;
}

.notation-warnings-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.15rem;
}

.notation-warning {
  font-size: 0.8rem;
}

.notation-warning--info  { color: #1e40af; }
.notation-warning--warn  { color: #92400e; }
.notation-warning--error { color: #991b1b; }

/* Compact / softer warning panel — used when warnings are grouped. */
.notation-warnings--compact {
  background: #fefce8;
  border-color: #fde68a;
  padding: 0.4rem 0.6rem;
  gap: 0.3rem;
  font-size: 0.78rem;
}

.notation-warnings--compact .notation-warnings-list {
  padding-left: 1rem;
}

.notation-warnings--compact .notation-warning {
  font-size: 0.78rem;
  line-height: 1.3;
}

.notation-warnings-details {
  max-height: 8rem;
  overflow-y: auto;
  padding: 0.35rem 0.5rem;
  background: #fffef0;
  border: 1px solid #fde68a;
  border-radius: 5px;
  font-size: 0.76rem;
  color: #78350f;
  display: grid;
  gap: 0.3rem;
}

.notation-warning-detail-block {
  display: grid;
  gap: 0.1rem;
}

.notation-warning-detail-summary {
  font-weight: 500;
}

.notation-warning-detail-range {
  color: #92400e;
}

.notation-warnings-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.notation-warnings-toggle {
  background: #fef3c7;
}

.notation-answer-reveal {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: #1f2937;
  padding: 0.4rem 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
}

/* iPad responsive */
@media (max-width: 600px) {
  .notation-stage-tabs {
    gap: 0.2rem;
  }

  .notation-tab {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    min-height: 44px;
  }

  .notation-tab-label {
    display: none;
  }

  .notation-tab-number {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.8rem;
  }

  .note-card-name {
    font-size: clamp(2rem, 12vw, 3.5rem);
  }

  .notation-staff-area,
  .notation-osmd-area {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .notation-answer-buttons {
    gap: 0.3rem;
  }

  .notation-answer-btn {
    min-width: 2.4rem;
    font-size: 0.9rem;
  }

  /* Section controls — tighten gap and use full-width number inputs so
     the row wraps cleanly without horizontal scroll. The fields keep
     their 36 px min-height so taps stay comfortable. */
  .notation-section-controls {
    gap: 0.4rem 0.5rem;
    padding: 0.55rem 0.65rem;
  }

  .notation-number-input {
    width: 3.6rem;
    font-size: 0.85rem;
  }

  .practice-active-status {
    font-size: 0.88rem;
    padding: 0.5rem 0.7rem;
  }

  .practice-active-status-count {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
  }
}

/* ─── Music Piece — Practice Review v1 + drill (Tasks 1, 2, 3) ─────────── */
/* The existing .practice-session-* surfaces are kept untouched; the
   classes below add the v1 Practice Review panel + drill-mode status
   banner + drill-encouragement string. Memory-only — none of this state
   reaches Firestore or localStorage. */

.mpt-drill-status,
.mpt-preview-notice {
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  min-height: 36px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  max-width: 100%;
}

.mpt-drill-status {
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.mpt-preview-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.mpt-drill-encouragement {
  margin: 0.45rem 0 0;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.mpt-practice-review {
  display: grid;
  gap: 0.55rem;
  margin: 0.6rem 0 0.3rem;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  min-width: 0;
  box-sizing: border-box;
}

.mpt-practice-review__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 0.9rem;
  flex-wrap: wrap;
}

.mpt-practice-review__title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.01em;
}

.mpt-practice-review__overall {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

/* Prominent overall % chip — the at-a-glance read for the whole attempt. */
.mpt-practice-review__percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  min-height: 44px;
  box-sizing: border-box;
}

.mpt-practice-review__overall-counts {
  font-size: 0.85rem;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.mpt-practice-review__meta {
  display: flex;
  gap: 0.45rem 0.85rem;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: #334155;
}

.mpt-practice-review__meta strong {
  color: #1f2937;
}

.mpt-practice-review__empty {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  font-size: 0.88rem;
  font-style: italic;
}

.mpt-practice-review__bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  min-width: 0;
}

.mpt-practice-review__bar {
  display: grid;
  grid-template-columns: 5rem 3.8rem 1fr minmax(7rem, auto);
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 7px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  font-size: 0.9rem;
  color: #1f2937;
  min-height: 36px;
  box-sizing: border-box;
}

.mpt-practice-review__bar-num   { font-weight: 700; }
.mpt-practice-review__bar-pct   {
  font-weight: 800;
  text-align: right;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.mpt-practice-review__bar-counts {
  color: #64748b;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.mpt-practice-review__bar-label {
  text-align: right;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* 4-band colours shared with the bar chips in the Practice Review panel.
   Slightly bolder borders so weak bars catch the eye against the white
   panel background. */
.mpt-band-excellent {
  background: #d1fae5;
  border-color: #34d399;
  color: #065f46;
}
.mpt-band-excellent .mpt-practice-review__bar-label { color: #065f46; }

.mpt-band-strong {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e3a8a;
}
.mpt-band-strong .mpt-practice-review__bar-label { color: #1e3a8a; }

.mpt-band-practise {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.mpt-band-practise .mpt-practice-review__bar-label { color: #92400e; }

.mpt-band-help {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}
.mpt-band-help .mpt-practice-review__bar-label { color: #991b1b; }

/* Overall % chip in the header uses the same band background. The chip is
   already inline-flex with its own padding; the band classes inject the
   colour scheme without touching layout. */
.mpt-practice-review__percent.mpt-band-excellent { background: #d1fae5; border-color: #34d399; color: #065f46; }
.mpt-practice-review__percent.mpt-band-strong    { background: #dbeafe; border-color: #60a5fa; color: #1e3a8a; }
.mpt-practice-review__percent.mpt-band-practise  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.mpt-practice-review__percent.mpt-band-help      { background: #fee2e2; border-color: #f87171; color: #991b1b; }

/* iPad-narrower tweak — collapse the per-bar row to a more readable
   stacked layout. The label wraps under the counts so weak bars are still
   easy to spot at glance. Min-height stays 44 px so taps still feel
   comfortable on touch. */
@media (max-width: 720px) {
  .mpt-practice-review__bar {
    grid-template-columns: 4.5rem 3.4rem 1fr;
    padding: 0.5rem 0.65rem;
  }
  .mpt-practice-review__bar-label {
    grid-column: 1 / -1;
    text-align: left;
    margin-top: 0.15rem;
  }
}

@media (max-width: 480px) {
  .mpt-practice-review__bar { grid-template-columns: 4rem 3rem 1fr; }
  .mpt-practice-review__percent { font-size: 1.15rem; }
}

/* ─── Music Piece — Sheet Library v1 ────────────────────────────────────
   Local Piece info panel + Recent pieces list. Memory + localStorage
   metadata only — no Firestore, no XML payload persistence. */

.mpt-piece-info {
  display: grid;
  gap: 0.4rem;
  margin: 0.4rem 0 0.2rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  min-width: 0;
  box-sizing: border-box;
}

.mpt-piece-info__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.9rem;
  flex-wrap: wrap;
  min-width: 0;
}

.mpt-piece-info__title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.mpt-piece-info__title strong {
  font-size: 0.98rem;
  color: #111827;
  font-weight: 700;
}

.mpt-piece-info__composer {
  font-size: 0.84rem;
  color: #475569;
}

.mpt-piece-info__toggle {
  font-size: 0.78rem;
  min-height: 32px;
}

.mpt-piece-info__grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.4rem 0.7rem;
  font-size: 0.84rem;
  color: #1f2937;
}

.mpt-piece-info__pair {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.mpt-piece-info__pair--wide {
  grid-column: 1 / -1;
}

.mpt-piece-info__pair dt {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  margin: 0;
}

.mpt-piece-info__pair dd {
  margin: 0;
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.mpt-piece-info__filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  color: #374151;
  word-break: break-all;
}

/* Recent pieces list — pill row near the file picker. Clicking a pill
   prompts for re-upload (XML payload is intentionally not cached). */
.mpt-recent-pieces {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.4rem;
  font-size: 0.82rem;
  min-width: 0;
}

.mpt-recent-pieces__label {
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.mpt-recent-pieces__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mpt-recent-pieces__item {
  display: inline-flex;
}

.mpt-recent-pieces__btn {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  max-width: 320px;
  touch-action: manipulation;
}

.mpt-recent-pieces__btn:hover,
.mpt-recent-pieces__btn:focus-visible {
  background: #f1f5f9;
  border-color: #94a3b8;
  outline: none;
}

.mpt-recent-pieces__title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.mpt-recent-pieces__loading {
  font-size: 0.74rem;
  font-weight: 500;
  color: #6b7280;
  font-style: italic;
}

.mpt-recent-pieces__filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.74rem;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}

.mpt-reupload-prompt {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem 0.9rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1.5px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.9rem;
  min-width: 0;
  box-sizing: border-box;
}

.mpt-reupload-prompt__body {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 18rem;
}

.mpt-reupload-prompt__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e3a8a;
  word-break: break-word;
}

.mpt-reupload-prompt__message {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: #1f2937;
}

.mpt-reupload-prompt__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.mpt-reupload-prompt__choose {
  min-height: 40px;
}

/* Section-controls stepper cells — keep the NumberStepper compact and
   inline alongside the other section-control items. The `--inline`
   variant tightens the spacing for the count-in row. */
.mpt-stepper-cell {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.mpt-stepper-cell--inline {
  margin-left: -0.2rem;
}

.mpt-stepper-cell .number-stepper {
  gap: 0.2rem;
}

.mpt-stepper-cell .number-stepper-label {
  font-size: 0.72rem;
}

.mpt-stepper-cell .number-stepper-button {
  height: 2.3rem;
  width: 2.3rem;
  font-size: 1rem;
}

.mpt-stepper-cell .number-stepper-value {
  height: 2.3rem;
  width: clamp(3.5rem, 14vw, 4.4rem);
  font-size: 0.92rem;
}

/* Tempo cell — stepper + label + optional Suggested chip. */
.mpt-tempo-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-left: 0.4rem;
}

.mpt-tempo-cell .number-stepper-label {
  font-size: 0.72rem;
}

.mpt-tempo-cell .number-stepper-button {
  height: 2.3rem;
  width: 2.3rem;
  font-size: 1rem;
}

.mpt-tempo-cell .number-stepper-value {
  height: 2.3rem;
  width: clamp(3.5rem, 14vw, 4.4rem);
  font-size: 0.92rem;
}

.mpt-tempo-hint {
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
}

.mpt-tempo-suggested {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1.5px solid #c4b5fd;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 28px;
  touch-action: manipulation;
}

.mpt-tempo-suggested:hover,
.mpt-tempo-suggested:focus-visible {
  background: #ede9fe;
  border-color: #a78bfa;
  outline: none;
}

/* OSMD error recovery card (Issue 2). */
.mpt-osmd-error {
  margin: 0.5rem 0 0.3rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1.5px solid #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.mpt-osmd-error__message {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #7f1d1d;
}

.mpt-osmd-error__detail {
  margin: 0;
  font-size: 0.78rem;
  color: #b91c1c;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-word;
}

@media (max-width: 600px) {
  .mpt-recent-pieces__title  { max-width: 9rem; }
  .mpt-recent-pieces__filename { display: none; }
  .mpt-piece-info__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─── Music Piece — Built-in samples + Testing checklist ─────────────── */

.mpt-samples {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.4rem;
  font-size: 0.82rem;
  min-width: 0;
}

.mpt-samples__label {
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.mpt-samples__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.mpt-samples__item {
  display: inline-flex;
}

.mpt-samples__btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1.5px solid #c4b5fd;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  touch-action: manipulation;
}

.mpt-samples__btn:hover:not(:disabled),
.mpt-samples__btn:focus-visible {
  background: #ede9fe;
  border-color: #a78bfa;
  outline: none;
}

.mpt-samples__btn--active {
  background: #6d28d9;
  border-color: #5b21b6;
  color: #fff;
}

.mpt-samples__btn--active:hover {
  background: #5b21b6;
}

.mpt-samples__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Sample description line — sits inside the Piece info panel between the
   title and the optional expanded grid. */
.mpt-piece-info__sample-desc {
  margin: 0;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  background: #f5f3ff;
  border: 1px solid #c4b5fd;
  color: #4c1d95;
  font-size: 0.86rem;
  line-height: 1.4;
}

.mpt-piece-info__sample-tag {
  display: inline-block;
  margin-right: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: #6d28d9;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: 0.05rem;
}

.mpt-piece-info__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.mpt-piece-info__tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  font-size: 0.74rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Testing checklist — collapsible <details> at the bottom of the
   trainer. Plain text list inside; no ticks persisted in v1. */
.mpt-checklist {
  margin: 0.8rem 0 0.4rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1f2937;
  font-size: 0.86rem;
}

.mpt-checklist__summary {
  cursor: pointer;
  font-weight: 700;
  color: #1f2937;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 32px;
  touch-action: manipulation;
}

.mpt-checklist__summary::-webkit-details-marker {
  display: none;
}

.mpt-checklist__summary::before {
  content: '▸';
  color: #6b7280;
  font-size: 0.9rem;
  transition: transform 0.12s;
  display: inline-block;
}

.mpt-checklist[open] .mpt-checklist__summary::before {
  transform: rotate(90deg);
}

.mpt-checklist__list {
  margin: 0.45rem 0 0.2rem;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.2rem;
  color: #374151;
  line-height: 1.4;
}

.mpt-checklist__list li {
  padding-left: 0.1rem;
}

@media (max-width: 600px) {
  .mpt-samples { font-size: 0.78rem; }
  .mpt-samples__btn { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
  .mpt-checklist__list { padding-left: 1.2rem; }
}

/* ─── Phase 14A — Notation QA Harness manual-status pills ──────────────── */
.qa-status--pending      { color: #6b7280; }
.qa-status--pass         { color: #15803d; }
.qa-status--fail         { color: #b91c1c; }
.qa-status--skip         { color: #b45309; }

.notation-qa-harness {
  display: block;
  font-size: 0.9rem;
}
.notation-qa-harness ul ol,
.notation-qa-harness ul ul {
  font-size: 0.82rem;
}
/* ============================================================
   Profile Customiser — full-page dark overlay (mirrors AdminDashboard style)
   ============================================================ */

.profile-customizer {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: #0f1117;
  color: #e2e8f0;
  overflow: hidden;
  font-family: inherit;
}

/* ---- Access denied ---- */
.profile-customizer--denied {
  align-items: center;
  justify-content: center;
}

.profile-customizer__denied-box {
  background: #161b27;
  border: 1px solid #2a3142;
  border-radius: 12px;
  padding: 2rem 2.5rem;
  text-align: center;
  max-width: 360px;
}

.profile-customizer__denied-box p {
  color: #94a3b8;
  margin: 0 0 1.25rem;
}

/* ---- Header ---- */
.profile-customizer__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #161b27;
  border-bottom: 1px solid #2a3142;
  flex-shrink: 0;
  min-height: 56px;
}

.profile-customizer__title {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.2px;
}

.profile-customizer__header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-customizer__back-btn {
  background: transparent;
  border: 1px solid #3b4252;
  color: #94a3b8;
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.profile-customizer__back-btn:hover {
  background: #1e2336;
  color: #e2e8f0;
  border-color: #4a5568;
}

.profile-customizer__save-btn {
  background: #6366f1;
  border: none;
  color: #fff;
  border-radius: 7px;
  padding: 0.4rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.profile-customizer__save-btn:hover {
  background: #4f46e5;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.profile-customizer__save-btn:active {
  background: #4338ca;
}

.profile-customizer__saved-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  animation: pc-fade-in 0.2s ease;
}

@keyframes pc-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Body ---- */
.profile-customizer__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 3rem;
}

.profile-customizer__hint {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0 0 1.25rem;
}

/* ---- Table wrapper ---- */
.profile-customizer__table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #1e2336;
}

/* ---- Table ---- */
.profile-customizer__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  table-layout: auto;
  min-width: 420px;
}

/* ---- Header row ---- */
.profile-customizer__th {
  background: #161b27;
  padding: 0;
  border-bottom: 2px solid #2a3142;
  font-weight: 600;
  text-align: center;
  vertical-align: top;
  white-space: nowrap;
}

.profile-customizer__th--component {
  text-align: left;
  padding: 0.85rem 1.1rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  width: 200px;
  min-width: 160px;
}

.profile-customizer__th--profile {
  min-width: 120px;
  padding: 0.6rem 0.75rem 0.5rem;
  border-left: 1px solid #1e2336;
}

/* ---- Profile column header ---- */
.profile-customizer__profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-bottom: 0.4rem;
}

.profile-customizer__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.profile-customizer__profile-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
}

.profile-customizer__col-actions {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  padding-bottom: 0.25rem;
}

.profile-customizer__col-action-btn {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  border-radius: 10px;
  padding: 0.12rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1.6;
}

.profile-customizer__col-action-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
}

.profile-customizer__col-action-btn--none {
  background: rgba(100, 116, 139, 0.1);
  border-color: rgba(100, 116, 139, 0.25);
  color: #64748b;
}

.profile-customizer__col-action-btn--none:hover {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
}

/* ---- Data rows ---- */
.profile-customizer__row {
  background: #13161f;
  transition: background 0.1s;
}

.profile-customizer__row:hover {
  background: #181d2c;
}

.profile-customizer__row--alt {
  background: #0f1117;
}

.profile-customizer__row--alt:hover {
  background: #131723;
}

.profile-customizer__td {
  padding: 0;
  border-top: 1px solid #1a1e2e;
}

.profile-customizer__td--label {
  padding: 0.7rem 1.1rem;
  text-align: left;
  color: #cbd5e1;
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
}

.profile-customizer__td--toggle {
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid #1a1e2e;
  padding: 0.5rem 0.75rem;
}

/* ---- Toggle switch (pill-style) ---- */
.profile-customizer__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #1e2336;
  border: 1px solid #2e3650;
  border-radius: 999px;
  padding: 0.2rem 0.5rem 0.2rem 0.3rem;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
  min-width: 64px;
  justify-content: flex-start;
}

.profile-customizer__toggle:hover {
  border-color: #3b4a6b;
}

.profile-customizer__toggle:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.profile-customizer__toggle--on {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.5);
}

.profile-customizer__toggle--on:hover {
  background: rgba(99, 102, 241, 0.26);
  border-color: rgba(99, 102, 241, 0.7);
}

.profile-customizer__toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b4252;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

.profile-customizer__toggle--on .profile-customizer__toggle-thumb {
  background: #6366f1;
  transform: none;
}

.profile-customizer__toggle-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #4a5568;
  text-transform: uppercase;
  transition: color 0.18s;
  min-width: 22px;
  text-align: left;
}

.profile-customizer__toggle--on .profile-customizer__toggle-label {
  color: #a5b4fc;
}
/* ============================================================
   CourseBuilderPanel (.cbp__*)
   Parent-facing course / module builder on the Assignments page.
   ============================================================ */

.cbp {
  max-width: 100%;
}

.cbp__heading {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.35rem;
}

.cbp__intro {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 1rem;
}

/* ---- Collapsible section ---- */
.cbp__section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.cbp__section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: #1e293b;
  text-align: left;
  min-height: 44px;
}

.cbp__section-toggle:hover {
  background: #f1f5f9;
}

.cbp__section-arrow {
  color: #94a3b8;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.cbp__section-body {
  padding: 1rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

/* ---- Form elements ---- */
.cbp__builder {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cbp__field-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cbp__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
}

.cbp__input,
.cbp__select {
  padding: 0.45rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
}

.cbp__input:focus,
.cbp__select:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

/* ---- Assignment / module picker ---- */
.cbp__hint {
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
}

.cbp__hint--muted {
  color: #94a3b8;
  font-style: italic;
}

.cbp__assignment-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cbp__assignment-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  color: #1e293b;
  text-align: left;
  min-height: 40px;
}

.cbp__assignment-item:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #93c5fd;
}

.cbp__assignment-item--added {
  background: #f0fdf4;
  border-color: #86efac;
  color: #15803d;
  cursor: default;
}

.cbp__check {
  color: #16a34a;
  font-weight: 700;
}

.cbp__tag {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #64748b;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
  text-transform: capitalize;
}

/* ---- Selected refs list ---- */
.cbp__selected-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cbp__ref-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cbp__ref-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  font-size: 0.85rem;
  min-height: 38px;
}

.cbp__ref-label {
  flex: 1;
  color: #1d4ed8;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cbp__ref-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.cbp__ref-btn {
  background: none;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: #3b82f6;
  min-width: 26px;
  min-height: 26px;
}

.cbp__ref-btn:hover:not(:disabled) {
  background: #dbeafe;
}

.cbp__ref-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cbp__ref-btn--remove {
  border-color: #fca5a5;
  color: #ef4444;
}

.cbp__ref-btn--remove:hover:not(:disabled) {
  background: #fee2e2;
}

/* ---- Existing items display ---- */
.cbp__existing-list {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cbp__existing-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 0.85rem;
}

/* ---- Save button ---- */
.cbp__save-btn {
  padding: 0.55rem 1.25rem;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  min-height: 40px;
  align-self: flex-start;
}

.cbp__save-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.cbp__save-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---- Feedback ---- */
.cbp__error {
  font-size: 0.8rem;
  color: #dc2626;
  margin: 0;
  padding: 0.4rem 0.6rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 5px;
}

.cbp__success {
  font-size: 0.8rem;
  color: #15803d;
  margin: 0;
  padding: 0.4rem 0.6rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 5px;
}

/* ── Search row ──────────────────────────────────────────────────────────── */

.cbp__search-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.cbp__input--search {
  flex: 1;
}

.cbp__search-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: #94a3b8;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  min-height: 36px;
}

.cbp__search-clear:hover {
  color: #475569;
  background: #f1f5f9;
}

/* ── Versioning warning ──────────────────────────────────────────────────── */

.cbp__versioning-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: #92400e;
}

.cbp__versioning-warning strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #78350f;
}

.cbp__versioning-list {
  margin: 0;
  padding-left: 1.2rem;
}

.cbp__versioning-list li {
  margin-bottom: 0.15rem;
}

/* ── Child progress preview ──────────────────────────────────────────────── */

.cbp__progress-preview {
  font-size: 0.82rem;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  margin-bottom: 0.5rem;
}

/* ── Tag variants ────────────────────────────────────────────────────────── */

.cbp__tag--version {
  background: #eff6ff;
  color: #1d4ed8;
}

.cbp__tag--warn {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
/* ============================================================
   Assignments Page — full-page overlay (mirrors AdminDashboard / ProfileCustomizer)
   ============================================================ */

.assignments-page {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: #0f1117;
  color: #e2e8f0;
  overflow: hidden;
  font-family: inherit;
}

/* ---- Header ---- */
.assignments-page__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #161b27;
  border-bottom: 1px solid #2a3142;
  flex-shrink: 0;
  min-height: 56px;
}

.assignments-page__back-btn {
  background: none;
  border: 1px solid #3b4a6b;
  color: #94a3b8;
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}

.assignments-page__back-btn:hover {
  background: #1e2a40;
  color: #e2e8f0;
}

.assignments-page__header-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.assignments-page__header-badge {
  background: #2563eb;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  flex-shrink: 0;
}

.assignments-page__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.assignments-page__header-spacer {
  width: 80px;
  flex-shrink: 0;
}

/* ---- Scrollable body ---- */
.assignments-page__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Weekly plan button in header */
.assignments-page__weekly-btn {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
  transition: background 0.15s;
}
.assignments-page__weekly-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Child picker in weekly plan header */
.assignments-page__child-picker {
  display: flex;
  gap: 0.3rem;
}
.assignments-page__child-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s, color 0.15s;
}
.assignments-page__child-btn--active {
  background: rgba(255,255,255,0.18);
  color: #f1f5f9;
}
.assignments-page__child-btn:hover {
  color: #e2e8f0;
}
/* ═══════════════════════════════════════════════════════════════════════════
   MusicLibrary.css — styles for MusicLibrary and MusicLibraryUpload
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Overlay / modal shell ─────────────────────────────────────────────────── */

.ml-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.ml-panel {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 900px;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

/* ── Header ────────────────────────────────────────────────────────────────── */

.ml-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

.ml-heading {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
}

.ml-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: #6b7280;
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.ml-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ── Toolbar ───────────────────────────────────────────────────────────────── */

.ml-toolbar {
  padding: 0.75rem 1.25rem;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex-shrink: 0;
}

.ml-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.ml-toolbar-row--actions {
  justify-content: space-between;
  gap: 0.75rem;
}

/* Profile tabs */
.ml-profile-tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.ml-tab {
  padding: 0.3rem 0.75rem;
  border-radius: 0.4rem;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: #374151;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ml-tab:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}
.ml-tab--active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}


/* Filter dropdowns */
.ml-toolbar-row--dropdowns {
  align-items: flex-end;
  gap: 0.75rem;
}

.ml-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ml-filter-select {
  padding: 0.35rem 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 0.4rem;
  background: #fff;
  font-size: 0.85rem;
  color: #111827;
  cursor: pointer;
  min-width: 130px;
  transition: border-color 0.15s;
}
.ml-filter-select:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Alphabetical filter */
.ml-alpha-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.ml-alpha-btn {
  min-width: 1.6rem;
  height: 1.85rem;
  padding: 0 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  box-sizing: border-box;
}
.ml-alpha-btn:hover {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}
.ml-alpha-btn--active {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

/* Action cluster — favourites toggle | view toggle | page size */
.ml-action-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.ml-fav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.7rem;
  border-radius: 0.4rem;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ml-fav-toggle:hover:not(:disabled) {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}
.ml-fav-toggle--active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}
.ml-fav-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ml-fav-toggle-star {
  color: #f59e0b;
  font-size: 0.95rem;
  line-height: 1;
}

.ml-view-toggle {
  display: inline-flex;
  border-radius: 0.4rem;
  overflow: hidden;
  border: 1px solid #d1d5db;
}

.ml-view-btn {
  padding: 0.32rem 0.7rem;
  background: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ml-view-btn + .ml-view-btn {
  border-left: 1px solid #d1d5db;
}
.ml-view-btn:hover {
  background: #f3f4f6;
}
.ml-view-btn--active {
  background: #2563eb;
  color: #fff;
}
.ml-view-btn--active:hover {
  background: #1d4ed8;
}

.ml-pagesize-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ml-pagesize-select {
  padding: 0.3rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.4rem;
  background: #fff;
  font-size: 0.82rem;
  color: #111827;
  cursor: pointer;
  min-width: 70px;
}
.ml-pagesize-select:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}

/* Result count line */
.ml-result-count {
  padding: 0.5rem 1.25rem 0;
  font-size: 0.8rem;
  color: #6b7280;
  flex-shrink: 0;
}

/* Inline error (favourites write failures) */
.ml-inline-error {
  margin: 0;
  font-size: 0.82rem;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 0.35rem;
  padding: 0.4rem 0.6rem;
}

/* Pagination */
.ml-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

.ml-page-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 0.4rem;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ml-page-btn:hover:not(:disabled) {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}
.ml-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ml-page-status {
  font-size: 0.82rem;
  color: #6b7280;
}

/* ── Body ──────────────────────────────────────────────────────────────────── */

.ml-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

.ml-empty-state {
  color: #6b7280;
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
  margin: 0;
}

.ml-error-state {
  color: #b91c1c;
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem 0;
  margin: 0;
}

/* ── Piece grid ────────────────────────────────────────────────────────────── */

.ml-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
}

/* Piece card */
.ml-piece-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  padding: 1rem 2.4rem 1rem 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  transition: box-shadow 0.15s, border-color 0.15s;
  box-sizing: border-box;
  min-width: 0;
}
.ml-piece-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

/* Clickable card (Issue 9) — whole card opens the piece on click; the
   inner action buttons (favourite, badges, Open, Edit, Delete) stop
   propagation so they never trigger the open. Focus ring on the card
   itself for keyboard accessibility. */
.ml-piece-card--clickable {
  cursor: pointer;
}

.ml-piece-card--clickable:focus-visible,
.ml-piece-row--clickable:focus-visible {
  outline: 3px solid rgba(124, 58, 237, 0.55);
  outline-offset: 2px;
  border-color: #7c3aed;
}

.ml-piece-card--clickable[aria-disabled='true'],
.ml-piece-row--clickable[aria-disabled='true'] {
  cursor: progress;
}

.ml-piece-row--clickable {
  cursor: pointer;
}

.ml-piece-row--clickable:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Assigned highlight */
.ml-piece-card--assigned {
  border-color: #7c3aed;
  border-width: 2px;
  background: #faf5ff;
}

.ml-assigned-badge {
  display: inline-block;
  background: #7c3aed;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  align-self: flex-start;
  letter-spacing: 0.02em;
}

.ml-piece-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.ml-piece-composer {
  margin: 0;
  font-size: 0.82rem;
  color: #6b7280;
}

.ml-piece-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}

/* Shared base for all clickable badge buttons */
.ml-badge-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s, border-color 0.15s;
}
.ml-badge-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.97);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.ml-badge-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

/* Difficulty badge colours — joyful palette (no amber, no red) */
.ml-difficulty-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
/* BEG — mint / soft green */
.ml-difficulty-badge--beginner {
  background: #d1fae5;
  color: #065f46;
  border-color: #a7f3d0;
}
/* INT — soft lavender (distinct from key badge cyan) */
.ml-difficulty-badge--intermediate {
  background: #f3e8ff;
  color: #7e22ce;
  border-color: #e9d5ff;
}
/* ADV — soft violet (no red) */
.ml-difficulty-badge--advanced {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #ddd6fe;
}

/* Hands badge — short label (RH / LH / BH) */
.ml-hands-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
  letter-spacing: 0.05em;
}
.ml-hands-badge--right {
  background: #fef9c3;
  color: #854d0e;
  border-color: #fde68a;
}
.ml-hands-badge--left {
  background: #fce7f3;
  color: #9d174d;
  border-color: #fbcfe8;
}
.ml-hands-badge--both {
  background: #e0e7ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

.ml-key-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  background: #cffafe;
  color: #0e7490;
  border-color: #a5f3fc;
  letter-spacing: 0.04em;
}

.ml-genre-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
  letter-spacing: 0.02em;
}

/* Assigned-to tags (parent view) */
.ml-assigned-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.1rem;
}

.ml-assigned-tag {
  font-size: 0.7rem;
  background: #ede9fe;
  color: #5b21b6;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-weight: 500;
}
.ml-assigned-tag--all {
  background: #f3f4f6;
  color: #6b7280;
}

/* Open button */
.ml-open-btn {
  margin-top: auto;
  padding: 0.45rem 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}
.ml-open-btn:hover:not(:disabled) {
  background: #1d4ed8;
}
.ml-open-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ml-open-btn--row {
  width: auto;
  padding: 0.4rem 0.9rem;
  margin-top: 0;
  flex-shrink: 0;
}

/* Favourite star button */
.ml-fav-star {
  position: absolute;
  top: 0.55rem;
  right: 0.6rem;
  background: none;
  border: none;
  padding: 0.1rem 0.25rem;
  font-size: 1.25rem;
  line-height: 1;
  color: #cbd5e1;
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  border-radius: 0.3rem;
}
.ml-fav-star:hover:not(:disabled) {
  color: #f59e0b;
  transform: scale(1.08);
}
.ml-fav-star--active {
  color: #f59e0b;
  text-shadow: 0 1px 2px rgba(245, 158, 11, 0.25);
}
.ml-fav-star--busy {
  opacity: 0.6;
}
.ml-fav-star:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.ml-fav-star:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

/* ── Rows view ──────────────────────────────────────────────────────────────── */

.ml-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ml-piece-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem 0.55rem 0.45rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  flex-wrap: wrap;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.ml-piece-row:hover {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}
.ml-piece-row--assigned {
  border-color: #7c3aed;
  background: #faf5ff;
}
.ml-piece-row .ml-fav-star {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
}

.ml-row-main {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ml-row-title-line {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
  min-width: 0;
}

.ml-row-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  word-break: break-word;
}

.ml-row-composer {
  font-size: 0.82rem;
  color: #6b7280;
}

.ml-row-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ml-row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.ml-row-actions .ml-piece-admin-row {
  margin-top: 0;
}

/* ── Parent-only edit / delete row on piece card ─────────────────────────── */

.ml-piece-admin-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.ml-edit-btn,
.ml-delete-btn {
  flex: 1;
  padding: 0.35rem 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-width: 0;
  box-sizing: border-box;
}
.ml-edit-btn:hover:not(:disabled) {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}
.ml-delete-btn {
  color: #b91c1c;
  border-color: #fecaca;
}
.ml-delete-btn:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}
.ml-edit-btn:disabled,
.ml-delete-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Edit modal ────────────────────────────────────────────────────────────── */

.ml-edit-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.ml-edit-panel {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
  width: 100%;
  max-width: 640px;
  padding: 1rem 1.25rem 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ml-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ml-edit-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.ml-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ml-edit-cancel {
  padding: 0.55rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.4rem;
  background: #fff;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ml-edit-cancel:hover:not(:disabled) {
  background: #f3f4f6;
}
.ml-edit-cancel:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Delete confirmation ─────────────────────────────────────────────────── */

.ml-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.ml-confirm-panel {
  background: #fff;
  border-radius: 0.6rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 420px;
  padding: 1.1rem 1.25rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ml-confirm-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
}

.ml-confirm-body {
  margin: 0;
  color: #374151;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ml-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.ml-confirm-delete-btn {
  padding: 0.55rem 1rem;
  background: #b91c1c;
  color: #fff;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ml-confirm-delete-btn:hover:not(:disabled) {
  background: #991b1b;
}
.ml-confirm-delete-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Upload section toggle ──────────────────────────────────────────────────── */

.ml-upload-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.ml-toggle-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(180deg, #7c3aed 0%, #6d28d9 100%);
  border: 1px solid #6d28d9;
  border-radius: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  width: auto;
  min-width: 220px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s, filter 0.15s;
}
.ml-toggle-upload-btn:hover {
  filter: brightness(1.05);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}
.ml-toggle-upload-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(124, 58, 237, 0.3);
}
.ml-toggle-upload-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.ml-toggle-upload-btn--open {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
  box-shadow: none;
}
.ml-toggle-upload-btn--open:hover {
  background: #e5e7eb;
  filter: none;
}

.ml-toggle-upload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}
.ml-toggle-upload-btn--open .ml-toggle-upload-icon {
  background: #d1d5db;
  color: #1f2937;
}

.ml-toggle-upload-text {
  white-space: nowrap;
}

/* Alpha bar empty placeholder */
.ml-alpha-empty {
  font-size: 0.75rem;
  color: #9ca3af;
  font-style: italic;
  padding: 0 0.25rem;
}

/* Clear-filters row — centred below pagination */
.ml-clear-filters-row {
  display: flex;
  justify-content: center;
}

/* Clear filters / reset button */
.ml-show-all-btn {
  padding: 0.4rem 0.95rem;
  border-radius: 0.4rem;
  border: 1px solid #7c3aed;
  background: #fff;
  color: #6d28d9;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.ml-show-all-btn:hover {
  background: #7c3aed;
  color: #fff;
  transform: translateY(-1px);
}
.ml-show-all-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Upload form (MusicLibraryUpload)
   ══════════════════════════════════════════════════════════════════════════════ */

.ml-upload-panel {
  padding: 1rem 0 0;
}

.ml-upload-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #374151;
}

.ml-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ml-upload-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.ml-upload-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #374151;
}

.ml-upload-input,
.ml-upload-select {
  padding: 0.4rem 0.55rem;
  border: 1px solid #d1d5db;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  color: #111827;
  background: #fff;
  min-width: 0;
  box-sizing: border-box;
  width: 100%;
}
.ml-upload-input:focus,
.ml-upload-select:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  border-color: #2563eb;
}
.ml-upload-input:disabled,
.ml-upload-select:disabled {
  background: #f9fafb;
  color: #9ca3af;
}

.ml-upload-fieldset {
  border: 1px solid #d1d5db;
  border-radius: 0.4rem;
  padding: 0.55rem 0.75rem;
  margin: 0;
}

.ml-upload-legend {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  padding: 0 0.25rem;
}

.ml-upload-assigned-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.3rem;
}

.ml-upload-check-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #374151;
  cursor: pointer;
}
.ml-upload-check-label input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: #7c3aed;
}

/* Drag-and-drop zone */
.ml-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  padding: 1.2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #f9fafb;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ml-dropzone:hover,
.ml-dropzone:focus {
  border-color: #2563eb;
  background: #eff6ff;
  outline: none;
}
.ml-dropzone--over {
  border-color: #2563eb;
  background: #dbeafe;
}
.ml-dropzone--has-file {
  border-color: #16a34a;
  background: #f0fdf4;
}

.ml-dropzone-hint {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
}
.ml-dropzone-hint strong {
  color: #374151;
}

.ml-dropzone-filename {
  font-size: 0.85rem;
  color: #166534;
  font-weight: 500;
  word-break: break-all;
}

/* Progress bar */
.ml-progress-wrap {
  position: relative;
  height: 1.3rem;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.ml-progress-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 9999px;
  transition: width 0.2s;
}
.ml-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  mix-blend-mode: difference;
}

.ml-upload-error {
  margin: 0;
  font-size: 0.82rem;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 0.35rem;
  padding: 0.4rem 0.6rem;
}

.ml-upload-success {
  margin: 0;
  font-size: 0.82rem;
  color: #166534;
  background: #dcfce7;
  border-radius: 0.35rem;
  padding: 0.4rem 0.6rem;
}

.ml-upload-submit {
  padding: 0.6rem 1.2rem;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.15s;
}
.ml-upload-submit:hover:not(:disabled) {
  background: #6d28d9;
}
.ml-upload-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Responsive — iPad landscape (min-width: 768px) ───────────────────────── */
@media (min-width: 768px) {
  .ml-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (max-width: 600px) {
  .ml-alpha-btn {
    min-width: 1.4rem;
    height: 1.6rem;
    padding: 0 0.3rem;
    font-size: 0.72rem;
  }
}
/* ── AppNav ─────────────────────────────────────────────────────────────────
   Horizontal scrollable nav bar. Designed for iPad landscape (1024 px) and
   desktop Chrome. Touch targets are min 44 px tall per accessibility guidance.
   ─────────────────────────────────────────────────────────────────────────── */

.app-nav {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar on Chrome/Safari while keeping scroll functionality */
  scrollbar-width: none;
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav__list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.375rem;
  margin: 0;
  padding: 0.5rem 0;
  list-style: none;
}

.app-nav__item {
  flex-shrink: 0;
}

/* Base button */
.app-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.4rem 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: transparent;
  color: #334155;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.13s ease, color 0.13s ease, border-color 0.13s ease;
  -webkit-tap-highlight-color: transparent;
}

.app-nav__btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.app-nav__btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Active / current page */
.app-nav__btn--active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.app-nav__btn--active:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* ── Page content shared styles ──────────────────────────────────────────── */

.page {
  /* pages naturally flow below the nav; no special positioning needed */
}

.page__heading {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
}

.page__placeholder {
  color: #64748b;
  font-size: 0.9375rem;
  max-width: 40rem;
  line-height: 1.6;
}

.page__not-enabled {
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 1rem;
}

/* Parent dashboard action buttons */
.parent-dashboard__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.parent-dashboard__action-btn {
  /* Inherits .admin-access-btn styles from App.css for visual consistency */
}
/* ============================================================
   CourseProgressPanel (.cpp__*)
   Child-facing course progress map.
   ============================================================ */

/* ---- Section wrapper ---- */
.cpp {
  max-width: 100%;
}

.cpp__heading {
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 1rem;
}

.cpp__loading,
.cpp__empty {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
}

.cpp__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---- Course card ---- */
.cpp__course {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.cpp__course--complete {
  border-color: #86efac;
  background: #f0fdf4;
}

.cpp__course-header {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cpp__course--complete .cpp__course-header {
  background: #dcfce7;
  border-bottom-color: #86efac;
}

.cpp__course-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpp__complete-badge {
  background: #16a34a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  flex-shrink: 0;
}

.cpp__child-message {
  width: 100%;
  font-size: 0.85rem;
  color: #475569;
  margin: 0.25rem 0 0;
  font-style: italic;
}

/* ---- Modules ---- */
.cpp__modules {
  display: flex;
  flex-direction: column;
}

.cpp__module {
  border-bottom: 1px solid #f1f5f9;
}

.cpp__module:last-child {
  border-bottom: none;
}

.cpp__module-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  font-family: inherit;
  color: #334155;
  min-height: 44px;
}

.cpp__module-header:hover {
  background: #f8fafc;
}

/* Completed module: green tint on header */
.cpp__module--complete > .cpp__module-header {
  background: #f0fdf4;
  color: #15803d;
}

.cpp__module--complete > .cpp__module-header:hover {
  background: #dcfce7;
}

.cpp__module-toggle {
  color: #94a3b8;
  font-size: 0.8rem;
  flex-shrink: 0;
  width: 14px;
}

.cpp__module-name {
  flex: 1;
  font-weight: 600;
  min-width: 0;
}

/* Completed module badge shown in header */
.cpp__module-complete-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
  flex-shrink: 0;
}

.cpp__module-progress {
  font-size: 0.78rem;
  color: #64748b;
  flex-shrink: 0;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
}

.cpp__module--complete .cpp__module-progress {
  background: #dcfce7;
  color: #15803d;
}

/* ---- Exercise list ---- */
.cpp__exercise-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem;
}

.cpp__exercise {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem 0.5rem 2.2rem;
  font-size: 0.85rem;
  min-height: 44px;
}

/* ---- Completed ---- */
/* Green background, dark green text — clearly SUCCESS, not locked */
.cpp__exercise--completed {
  background: #f0fdf4;
  color: #15803d;
  font-weight: 600;
  border-left: 3px solid #4ade80;
}

/* ---- Current ---- */
.cpp__exercise--current {
  color: #1d4ed8;
  font-weight: 600;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
}

/* ---- Locked ---- */
/* Grey, muted — only future exercises are ever locked */
.cpp__exercise--locked {
  color: #cbd5e1;
  background: transparent;
}

/* ---- Empty placeholder ---- */
.cpp__exercise--empty {
  color: #94a3b8;
  font-style: italic;
  padding-left: 1rem;
}

.cpp__exercise-icon {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.8rem;
}

.cpp__exercise-label {
  flex: 1;
}

/* ---- Badges ---- */
.cpp__exercise-badge {
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  flex-shrink: 0;
}

.cpp__exercise-badge--completed {
  background: #16a34a;
  color: #fff;
}

.cpp__exercise-badge--current {
  background: #2563eb;
  color: #fff;
}

/* ---- Start Practice button (current exercise) ---- */
.cpp__start-btn {
  font-size: 0.75rem;
  font-weight: 700;
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  min-height: 36px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.cpp__start-btn:hover {
  background: #15803d;
}

.cpp__start-btn:active {
  background: #166534;
}

/* ---- Practice Again button (completed exercises) ---- */
.cpp__replay-btn {
  font-size: 0.72rem;
  font-weight: 700;
  background: #fff;
  color: #15803d;
  border: 1.5px solid #4ade80;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  min-height: 34px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

.cpp__replay-btn:hover {
  background: #dcfce7;
  border-color: #16a34a;
}

.cpp__replay-btn:active {
  background: #bbf7d0;
}
.metrics-dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
  box-sizing: border-box;
}

.metrics-loading {
  text-align: center;
  padding: 32px;
  opacity: 0.6;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--color-surface, #fff);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-left: 4px solid transparent;
  box-sizing: border-box;
  min-width: 0;
}

.metric-card__icon {
  font-size: 1.75rem;
  margin-bottom: 4px;
}

.metric-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.metric-card__title {
  font-size: 0.8rem;
  opacity: 0.65;
  margin-top: 2px;
}

.metric-card__subtitle {
  font-size: 0.75rem;
  opacity: 0.5;
  margin-top: 4px;
}

.practice-section {
  background: var(--color-surface, #fff);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  box-sizing: border-box;
  min-width: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.empty-state {
  opacity: 0.5;
  font-size: 0.9rem;
}

.pb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.pb-name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.pb-badge {
  background: var(--color-primary-light, #e8f4fd);
  color: var(--color-primary, #2563eb);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
}

.pb-count {
  font-size: 0.8rem;
  opacity: 0.65;
}

.passport-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.passport-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
}

.stamp-emoji {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid transparent;
}

.passport-stamp--earned .stamp-emoji {
  border-color: var(--color-primary, #2563eb);
  background: var(--color-primary-light, #e8f4fd);
}

.passport-stamp--locked .stamp-emoji {
  filter: grayscale(1);
  opacity: 0.3;
}

.stamp-label {
  font-size: 0.65rem;
  text-align: center;
  margin-top: 4px;
  opacity: 0.75;
}

.balance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.balance-label {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 48px;
}

.balance-bar-track {
  flex: 1;
  height: 16px;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  display: flex;
  min-width: 0;
}

.balance-bar-scales {
  background: var(--color-primary, #2563eb);
  height: 100%;
  transition: width 0.4s ease;
}

.balance-bar-chords {
  background: var(--color-accent, #f59e0b);
  height: 100%;
  transition: width 0.4s ease;
}

.balance-counts {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  opacity: 0.65;
}

.practice-calendar {
  overflow-x: auto;
  box-sizing: border-box;
}

.calendar-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  opacity: 0.75;
}

.calendar-grid {
  display: flex;
  gap: 3px;
}

.calendar-week {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: #eee;
}

.calendar-cell--active {
  background: var(--color-primary, #2563eb);
  opacity: 0.8;
}
/* ============================================================
   Admin Dashboard — full-page dark overlay
   ============================================================ */

.admin-dashboard {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  background: #0f1117;
  color: #e2e8f0;
  overflow: hidden;
  font-family: inherit;
}

/* ---- Header ---- */
.admin-dashboard__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #161b27;
  border-bottom: 1px solid #2a3142;
  flex-shrink: 0;
  min-height: 56px;
}

.admin-dashboard__header-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-dashboard__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}

.admin-dashboard__header-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: #1e3a5f;
  color: #93c5fd;
  border: 1px solid #2563eb44;
  white-space: nowrap;
}

.admin-dashboard__header-spacer {
  width: 80px; /* mirror back button width for centering */
  flex-shrink: 0;
}

.admin-dashboard__back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid #2a3142;
  background: #1e2433;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-dashboard__back-btn:hover {
  background: #252d40;
  color: #e2e8f0;
  border-color: #3b4a63;
}

.admin-dashboard__back-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ---- Scrollable body ---- */
.admin-dashboard__body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem clamp(0.75rem, 3vw, 1.75rem) 2.5rem;
  display: grid;
  gap: 1.75rem;
}

/* ---- Section ---- */
.admin-dashboard__section {
  display: grid;
  gap: 0.75rem;
}

.admin-dashboard__section-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #1e2433;
}

/* ---- Cards ---- */
.admin-dashboard__card {
  background: #161b27;
  border: 1px solid #2a3142;
  border-radius: 10px;
  overflow: hidden;
}

.admin-dashboard__card--flush {
  /* inner components own their own padding */
}

.admin-dashboard__card--flush > * {
  /* let child panels breathe a little */
  padding: 0.75rem 1rem;
}

.admin-dashboard__card--collapsible {
  /* no extra padding — toggle does it */
}

/* ---- Collapse toggle ---- */
.admin-dashboard__collapse-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.admin-dashboard__collapse-toggle:hover {
  background: #1e2433;
  color: #f1f5f9;
}

.admin-dashboard__collapse-toggle:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.admin-dashboard__chevron {
  font-size: 0.75rem;
  color: #475569;
  flex-shrink: 0;
}

/* ---- Definition list ---- */
.admin-dashboard__dl {
  margin: 0;
  padding: 0 1rem 0.85rem;
  display: grid;
  gap: 0.3rem;
}

.admin-dashboard__dl-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #1e2433;
  font-size: 0.85rem;
}

.admin-dashboard__dl-row:last-child {
  border-bottom: none;
}

.admin-dashboard__dl-row dt {
  color: #94a3b8;
  flex-shrink: 0;
}

.admin-dashboard__dl-row dd {
  margin: 0;
  color: #e2e8f0;
  text-align: right;
}

/* ---- Music data grid ---- */
.admin-dashboard__music-grid {
  padding: 0 1rem 0.85rem;
  display: grid;
  gap: 0;
}

.admin-dashboard__music-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid #1e2433;
  font-size: 0.85rem;
  color: #94a3b8;
}

.admin-dashboard__music-row:last-child {
  border-bottom: none;
}

.admin-dashboard__music-row--full {
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}

.admin-dashboard__value {
  color: #e2e8f0;
  font-weight: 500;
  text-align: right;
}

.admin-dashboard__mono {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  font-size: 0.82rem;
  color: #a5b4fc;
}

/* ---- Lab body ---- */
.admin-dashboard__lab-body {
  padding: 0 1rem 1rem;
}

/* ---- Access denied ---- */
.admin-dashboard--denied {
  display: grid;
  place-items: center;
}

.admin-dashboard__denied-box {
  background: #161b27;
  border: 1px solid #2a3142;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  display: grid;
  gap: 1rem;
  color: #94a3b8;
}

/* ---- Child components: override colours for dark bg ---- */
.admin-dashboard .sync-status-panel,
.admin-dashboard .sync-prep-panel,
.admin-dashboard .progress-backup-panel {
  color: #e2e8f0;
}

/* ---- Ensure inner cards/sections don't double-border ---- */
.admin-dashboard__card--flush .card {
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

/* ---- Scrollbar ---- */
.admin-dashboard__body::-webkit-scrollbar {
  width: 6px;
}
.admin-dashboard__body::-webkit-scrollbar-track {
  background: #0f1117;
}
.admin-dashboard__body::-webkit-scrollbar-thumb {
  background: #2a3142;
  border-radius: 3px;
}
.admin-dashboard__body::-webkit-scrollbar-thumb:hover {
  background: #3b4a63;
}

/* ---- Responsive ---- */
@media (min-width: 720px) {
  .admin-dashboard__body {
    max-width: 960px;
    margin-inline: auto;
    width: 100%;
  }
}

/* ---- Admin access button (in welcome panel) ---- */
.admin-access-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.admin-access-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.55);
  color: #a5b4fc;
}

.admin-access-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
