@import url("https://fonts.googleapis.com/css2?family=Arima:wght@400;500;600&family=Lato:wght@400;700&display=swap");

/* MusicMate components. Plain CSS classes, no script. Every color, shadow and radius is a token. */

[class^="mm-"], [class^="mm-"] *, [class^="mm-"] *::before, [class^="mm-"] *::after { box-sizing: border-box; }
[class^="mm-"]:focus-visible, [class^="mm-"] :focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

/* Button */
.mm-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); min-height: 52px; padding: 10px 20px; border-radius: var(--radius-sm); border: 2px solid var(--ink); background: transparent; color: var(--ink); font: 700 18px/24px var(--font-sans); text-decoration: none; cursor: pointer; }
.mm-btn--primary { background: var(--action); border-color: var(--action); color: var(--on-action); box-shadow: var(--shadow-lift); }
.mm-btn--primary:hover { box-shadow: var(--shadow-lift), var(--shadow-glow-pink); }
.mm-btn--danger { border-color: var(--danger); color: var(--danger); }
.mm-btn--small { min-height: 44px; padding: 6px 14px; font-size: 14px; line-height: 20px; }
.mm-btn--big { min-height: 68px; width: 100%; font-size: 22px; line-height: 28px; }
.mm-btn:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

/* IconButton */
.mm-icon-btn { display: grid; place-items: center; flex: none; width: 52px; height: 52px; padding: 0; border-radius: 50%; border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: 700 24px/1 var(--font-sans); cursor: pointer; }
.mm-icon-btn--small { width: 44px; height: 44px; font-size: 20px; }
.mm-icon-btn:disabled { opacity: 0.35; cursor: default; }

/* Switch */
.mm-switch { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 44px; padding: 4px 12px 4px 14px; border-radius: var(--radius-pill); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: 700 18px/24px var(--font-sans); white-space: nowrap; cursor: pointer; }
.mm-switch__track { position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px; background: var(--ink-muted); transition: background 0.15s; }
.mm-switch__knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); transition: transform 0.15s; }
.mm-switch__state { min-width: 1.8em; text-align: left; color: var(--ink-muted); }
.mm-switch[aria-checked="true"] { border-color: var(--go); }
.mm-switch[aria-checked="true"] .mm-switch__track { background: var(--go); }
.mm-switch[aria-checked="true"] .mm-switch__knob { transform: translateX(20px); }
.mm-switch[aria-checked="true"] .mm-switch__state { color: var(--go); }
.mm-switch[aria-busy="true"] .mm-switch__track { background: var(--gold); }
.mm-switch[aria-busy="true"] .mm-switch__knob { transform: translateX(10px); background: var(--on-gold); }
@media (prefers-reduced-motion: reduce) { .mm-switch__track, .mm-switch__knob { transition: none; } }

/* Field */
.mm-field { display: block; color: var(--ink); font: 400 18px/26px var(--font-sans); }
.mm-field__label { display: block; margin: 0 0 6px; font-weight: 700; line-height: 24px; }
.mm-field__input { display: block; width: 100%; min-height: 52px; padding: 12px; border-radius: var(--radius-md); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: inherit; }
textarea.mm-field__input { min-height: 96px; resize: vertical; }
.mm-field__hint { margin: 4px 0 0; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.mm-field__error { margin: 4px 0 0; color: var(--danger); font-size: 14px; line-height: 20px; font-weight: 700; }
.mm-field--error .mm-field__input { border-color: var(--danger); }

/* Choice */
.mm-choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--radius-md); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: 400 18px/26px var(--font-sans); cursor: pointer; }
.mm-choice input { flex: none; width: 24px; height: 24px; margin: 1px 0 0; accent-color: var(--go); }
.mm-choice__title { display: block; font-weight: 700; }
.mm-choice__detail { display: block; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.mm-choice:has(input:checked) { border-color: var(--go); }

/* Card */
.mm-card { padding: var(--space-2); border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--surface); color: var(--ink); font: 400 16px/22px var(--font-sans); box-shadow: var(--shadow-lift); }
.mm-card__title { margin: 0 0 var(--space-1); font: 400 24px/32px var(--font-sans); }
.mm-card p { margin: 0; }
.mm-card p + p { margin-top: var(--space-2); }
.mm-card--plum { border-color: transparent; border-radius: var(--radius-sm); background: var(--gradient-plum, var(--plum)); color: var(--lavender); box-shadow: var(--shadow-lift), var(--shadow-glow-plum); }
.mm-card--center { text-align: center; }
.mm-card__chips { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-1); }
.mm-card--center .mm-card__chips { justify-content: center; }

/* Chip */
.mm-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 14px; border-radius: var(--radius-pill); border: 2px solid transparent; background: var(--moss); color: var(--lavender); font: 400 18px/24px var(--font-sans); white-space: nowrap; }
.mm-chip--plum { background: var(--gradient-plum, var(--plum)); background-origin: border-box; }
.mm-chip--gold { border-color: var(--on-gold); background: var(--gold); color: var(--on-gold); font-weight: 700; }
.mm-chip--outline { border-color: var(--ink-muted); background: transparent; color: var(--ink-muted); }
.mm-chip--small { min-height: 24px; padding: 0 10px; font-size: 13px; line-height: 18px; }

/* Banner */
.mm-banner { display: flex; align-items: flex-start; gap: var(--space-2); padding: var(--space-2); border-radius: var(--radius-sm); background: var(--gradient-plum, var(--plum)); color: var(--lavender); font: 400 16px/22px var(--font-sans); box-shadow: var(--shadow-lift), var(--shadow-glow-plum); }
.mm-banner__body { flex: 1; min-width: 0; }
.mm-banner__title { margin: 0 0 4px; font: 400 24px/32px var(--font-sans); }
.mm-banner p { margin: 0; }
.mm-banner__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.mm-banner .mm-btn { border-color: var(--lavender); color: var(--lavender); }
.mm-banner .mm-btn--primary { background: var(--lavender); color: var(--plum); box-shadow: none; }
.mm-banner--notice { border: 2px solid var(--on-gold); background: var(--gold); color: var(--on-gold); box-shadow: none; }

/* Row */
.mm-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: var(--radius-md); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: 400 18px/26px var(--font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.mm-row__grow { flex: 1 1 12em; min-width: 0; }
.mm-row__name { display: block; font-weight: 700; }
.mm-row__meta { display: block; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.mm-row__meta--done { color: var(--go); font-weight: 700; }
.mm-row__chev { color: var(--ink-muted); font-size: 26px; line-height: 1; }
div.mm-row { cursor: default; border-color: var(--moss); }

/* Avatar */
.mm-avatar { display: grid; place-items: center; flex: none; width: 52px; height: 52px; overflow: hidden; border-radius: 50%; background: var(--plum); color: var(--lavender); font: 700 22px/1 var(--font-sans); }
.mm-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.mm-avatar--lg { width: 96px; height: 96px; font-size: 40px; }
.mm-avatar--xl { width: 196px; height: 196px; font-size: 72px; }
.mm-avatar--ring { border: 4px solid transparent; background: linear-gradient(var(--plum), var(--plum)) padding-box, var(--gradient-ring, var(--pink)) border-box; box-shadow: var(--shadow-glow-pink); }
.mm-avatar--xl.mm-avatar--ring { border-width: 8px; }
.mm-avatar-stack { display: flex; flex: none; }
.mm-avatar-stack > * + * { margin-left: -14px; box-shadow: 0 0 0 2px var(--surface); }

/* Tile */
.mm-tile { display: grid; gap: 2px; padding: 14px; border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lift); }
.mm-tile__num { font: 700 28px/34px var(--font-sans); }
.mm-tile__label { color: var(--ink-muted); font: 400 14px/20px var(--font-sans); }

/* Days */
.mm-days { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mm-day { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink-muted); font: 700 14px/1 var(--font-sans); }
.mm-day--on { border-color: var(--on-gold); background: var(--gold); color: var(--on-gold); }
.mm-day--today { box-shadow: 0 0 0 2px var(--ground), 0 0 0 5px var(--ink); }
.mm-days--small .mm-day { width: 26px; height: 26px; font-size: 11px; }

/* Toast */
.mm-toast { display: inline-block; max-width: min(520px, calc(100vw - 32px)); padding: 14px 18px; border-radius: var(--radius-md); background: var(--ink); color: var(--ground); font: 700 18px/24px var(--font-sans); box-shadow: var(--shadow-lift); }

/* Dialog */
.mm-dialog { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 22px; border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--ground); color: var(--ink); font: 400 18px/26px var(--font-sans); box-shadow: var(--shadow-lift), var(--shadow-glow-plum); }
.mm-dialog--wide { width: min(760px, 100%); }
.mm-dialog__title { margin: 0 0 var(--space-1); font: 700 28px/34px var(--font-sans); }
.mm-dialog p { margin: 0 0 var(--space-2); }
.mm-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- App pieces ---------- */

/* Row: number badge */
.mm-row__num { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--plum); color: var(--lavender); font: 700 22px/1 var(--font-sans); }

/* PillButton */
.mm-pill-btn { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 4px 14px; border-radius: var(--radius-pill); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); font: 700 18px/24px var(--font-sans); white-space: nowrap; cursor: pointer; }
.mm-pill-btn[aria-pressed="true"] { border-color: var(--go); background: var(--go); color: var(--ground); }

/* MusicBar */
.mm-musicbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 2px solid var(--moss); background: var(--ground); color: var(--ink); font: 400 18px/26px var(--font-sans); }
.mm-musicbar__title { flex: 1; min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mm-timer { display: inline-flex; align-items: center; gap: var(--space-1); font: 700 18px/24px var(--font-sans); font-variant-numeric: tabular-nums; }
.mm-timer__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: mm-pulse 1.2s infinite; }
@keyframes mm-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .mm-timer__dot { animation: none; } }

/* PageBar */
.mm-pagebar { display: flex; align-items: center; gap: var(--space-1); padding: 6px 12px; border-top: 2px solid var(--moss); background: var(--ground); color: var(--ink); font: 400 18px/26px var(--font-sans); }
.mm-pagebar__label { min-width: 4.2em; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.mm-pagebar__status { flex: 0 1 auto; min-width: 0; margin-left: auto; overflow: hidden; color: var(--ink-muted); font-size: 14px; line-height: 20px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.mm-pagebar__status--warn { color: var(--danger); font-weight: 700; }

/* Metronome */
.mm-metro { display: grid; gap: 12px; width: min(320px, 100%); padding: 14px; border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--surface); color: var(--ink); font: 400 16px/22px var(--font-sans); box-shadow: var(--shadow-lift); }
.mm-metro__row { display: flex; align-items: center; gap: 10px; }
.mm-metro__big { display: grid; flex: 1; text-align: center; }
.mm-metro__num { font: 700 40px/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.mm-metro__unit, .mm-metro__label { color: var(--ink-muted); font-size: 14px; line-height: 20px; white-space: nowrap; }
.mm-metro input[type="range"] { width: 100%; height: 44px; margin: 0; accent-color: var(--go); }
.mm-metro .mm-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--ground); }

/* Meter */
.mm-meter { position: relative; height: 34px; overflow: hidden; border-radius: 17px; border: 2px solid var(--ink-muted); background: var(--surface); }
.mm-meter__zone { position: absolute; top: 0; bottom: 0; width: 16.67%; }
.mm-meter__zone::before { content: ""; position: absolute; inset: 0; background: var(--go); opacity: 0.25; }
.mm-meter__zone--left { left: 0; border-right: 2px solid var(--go); }
.mm-meter__zone--right { right: 0; border-left: 2px solid var(--go); }
.mm-meter__mid { position: absolute; top: 6px; bottom: 6px; left: 50%; width: 1px; background: var(--ink-muted); }
.mm-meter__dot { position: absolute; top: 3px; left: 50%; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--ink); }
.mm-meter__dot--hit { background: var(--go); box-shadow: 0 0 0 2px var(--ink); }
.mm-meter__ends { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ink); font: 700 14px/20px var(--font-sans); }

/* StatusPill */
.mm-status-pill { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 44px; padding: 6px 14px; border-radius: var(--radius-pill); background: var(--ink); color: var(--ground); font: 700 16px/22px var(--font-sans); font-variant-numeric: tabular-nums; box-shadow: var(--shadow-lift); }
.mm-status-pill__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ground); animation: mm-pulse 1.2s infinite; }
.mm-status-pill:has(.mm-btn) { padding: 6px 6px 6px 14px; }
.mm-status-pill .mm-btn { border-radius: var(--radius-pill); border-color: var(--ground); color: var(--ground); }
@media (prefers-reduced-motion: reduce) { .mm-status-pill__dot { animation: none; } }

/* PersonButton */
.mm-person { display: grid; justify-items: center; gap: var(--space-1); padding: 6px; border: none; border-radius: var(--radius-md); background: none; color: var(--ink); font: 700 28px/34px var(--font-sans); cursor: pointer; }
.mm-person:active .mm-avatar { transform: scale(0.94); }
.mm-person .mm-avatar { transition: transform 0.15s; }
@media (prefers-reduced-motion: reduce) { .mm-person .mm-avatar { transition: none; } }

/* Video */
.mm-video { position: relative; display: grid; place-items: center; overflow: hidden; aspect-ratio: 16 / 9; border-radius: var(--radius-md); background: var(--stage); color: var(--paper); font: 700 18px/24px var(--font-sans); text-align: center; }
.mm-video video { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--stage); }
.mm-video__cap { position: absolute; top: 10px; left: 12px; padding: 3px 12px; border-radius: var(--radius-pill); border: 2px solid var(--paper); background: var(--stage); color: var(--paper); font-size: 14px; line-height: 20px; pointer-events: none; }
.mm-video__play { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; width: 100%; border: none; background: none; color: var(--paper); font: inherit; cursor: pointer; }
.mm-video__tri { display: grid; place-items: center; width: 96px; height: 96px; padding-left: 8px; border-radius: 50%; background: var(--lavender); color: var(--plum); font-size: 42px; line-height: 1; box-shadow: var(--shadow-glow-plum); }

/* Cheer */
.mm-cheer { display: grid; justify-items: center; gap: var(--space-2); color: var(--ink); font: 700 28px/34px var(--font-sans); text-align: center; }
.mm-cheer__star { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%; border: 2px solid var(--on-gold); background: var(--gold); color: var(--on-gold); font-size: 64px; line-height: 1; animation: mm-pop 0.7s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes mm-pop { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
@media (prefers-reduced-motion: reduce) { .mm-cheer__star { animation: none; } }

/* Note */
.mm-note { display: flex; align-items: flex-start; gap: 12px; color: var(--ink); font: 400 18px/26px var(--font-sans); }
.mm-note__from { display: block; font-weight: 700; }
.mm-note p { margin: 2px 0 0; white-space: pre-wrap; }

/* ModeTile */
.mm-mode { display: grid; align-content: center; justify-items: center; gap: var(--space-1); min-height: 220px; padding: 24px 16px; border-radius: var(--radius-md); border: 2px solid var(--ink-muted); background: var(--surface); color: var(--ink); text-align: center; box-shadow: var(--shadow-lift); cursor: pointer; }
.mm-mode__title { font: 700 28px/34px var(--font-sans); }
.mm-mode__sub { color: var(--ink-muted); font: 400 16px/22px var(--font-sans); }
.mm-mode__count { font: 700 40px/1 var(--font-sans); }
.mm-mode--plum { border-color: transparent; background: var(--gradient-plum, var(--plum)); background-origin: border-box; color: var(--lavender); box-shadow: var(--shadow-lift), var(--shadow-glow-plum); }
.mm-mode--plum .mm-mode__sub { color: var(--lavender); }
.mm-mode:active { transform: scale(0.98); }

/* Piece */
.mm-piece { display: grid; align-content: start; gap: 6px; color: var(--ink); font: 400 18px/26px var(--font-sans); }
.mm-piece__cover { display: grid; place-items: center; overflow: hidden; aspect-ratio: 3 / 4; padding: 0; border-radius: var(--radius-md); border: 2px solid var(--ink-muted); background: var(--paper); box-shadow: var(--shadow-lift); cursor: pointer; }
.mm-piece__cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.mm-piece__title { font-weight: 700; line-height: 24px; overflow-wrap: anywhere; }
.mm-piece__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-1); color: var(--ink-muted); font-size: 14px; line-height: 20px; }

/* Bars */
.mm-bars { display: flex; align-items: stretch; gap: 2px; height: 120px; border-bottom: 2px solid var(--ink-muted); }
.mm-bars__col { display: flex; align-items: flex-end; flex: 1; min-width: 0; padding: 0; border: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: none; cursor: pointer; }
.mm-bars__col:hover { background: var(--surface); }
.mm-bars__bar { display: block; width: 100%; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--go); }
.mm-bars__axis { display: flex; justify-content: space-between; gap: var(--space-1); margin-top: 4px; color: var(--ink-muted); font: 400 13px/18px var(--font-sans); }
.mm-bars__cap { min-height: 22px; margin: 6px 0 0; color: var(--ink); font: 400 16px/22px var(--font-sans); }

/* WeekSwitcher */
.mm-week { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.mm-week__label { flex: 1; padding: 12px; border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--surface); font: 700 18px/24px var(--font-sans); text-align: center; }

/* Code */
.mm-code { display: inline-block; padding: 6px 12px; border-radius: var(--radius-md); border: 2px solid var(--moss); background: var(--surface); color: var(--ink); font: 700 18px/24px var(--font-mono); letter-spacing: 0.06em; }
.mm-code--recovery { display: block; padding: 16px 8px; border-style: dashed; border-color: var(--ink-muted); font-size: 24px; line-height: 32px; letter-spacing: 0.08em; text-align: center; user-select: all; -webkit-user-select: all; }

/* Table */
.mm-table { width: 100%; border-collapse: collapse; color: var(--ink); font: 400 16px/22px var(--font-sans); }
.mm-table th, .mm-table td { padding: 8px 6px; border-bottom: 1px solid var(--ink-muted); text-align: left; }
.mm-table th { font-weight: 700; }
.mm-table .mm-table__num { font-variant-numeric: tabular-nums; text-align: right; }

/* Empty */
.mm-empty { padding: 18px; border-radius: var(--radius-md); border: 2px dashed var(--ink-muted); color: var(--ink-muted); font: 400 18px/26px var(--font-sans); text-align: center; }
.mm-empty .mm-btn { margin-top: 12px; }
