/* Practice Time: warm, bold, kid-friendly. Mobile-first (375–430px), fine on tablets. */

:root {
  color-scheme: light;
  --bg: #fff5e6;
  --bg-glow: #ffe2b8;
  --surface: #ffffff;
  --surface-2: #fff0d9;
  --ink: #2b1a31;
  --ink-soft: #6f5b70;
  --border: #f1dcc0;
  --primary: #ff5b3a;
  --primary-deep: #d23c1e;
  --primary-ink: #ffffff;
  --secondary: #ffc23d;
  --secondary-deep: #dd9a0c;
  --secondary-ink: #2b1a31;
  --accent: #7b4dff;
  --accent-deep: #5a2fe0;
  --accent-ink: #ffffff;
  --mint: #16b38f;
  --mint-deep: #0c8a6d;
  --gold: #ffb800;
  --danger: #e0344b;
  --ring-track: #ffe3bd;
  --avatar-bg: #ffd66b;
  --shadow: 0 10px 30px rgb(120 60 20 / 12%);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --tap: 48px;
  --tabbar-h: 68px;
  --page-max: 640px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1c1330;
    --bg-glow: #2e1f52;
    --surface: #2a1f45;
    --surface-2: #362a5c;
    --ink: #fff4e6;
    --ink-soft: #c9b9dc;
    --border: #45376c;
    --primary: #ff6b4a;
    --primary-deep: #c2401f;
    --secondary: #ffc94d;
    --secondary-deep: #c48d10;
    --accent: #a88bff;
    --accent-deep: #7656e0;
    --accent-ink: #1c1330;
    --mint: #2fd0a9;
    --mint-deep: #13957a;
    --ring-track: #3d3068;
    --avatar-bg: #ffc94d;
    --shadow: 0 10px 30px rgb(0 0 0 / 35%);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 14px;
}

.center {
  text-align: center;
}

.eyebrow {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- App frame ---------- */

.app {
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100dvh;
  font-weight: 700;
  color: var(--ink-soft);
}

.loading-note {
  font-size: 56px;
  color: var(--primary);
  animation: bob 1.2s ease-in-out infinite;
}

.panels {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 12px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  display: grid;
  gap: 16px;
}

.app-parent .panels {
  padding-bottom: calc(env(safe-area-inset-bottom) + 32px);
}

.panel {
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 12px;
}

.card-title {
  font-size: 20px;
  font-weight: 800;
}

.section-title {
  font-size: 22px;
  font-weight: 900;
}

.list-heading {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Buttons ---------- */

.btn {
  min-height: var(--tap);
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}

.btn:active:not(:disabled) {
  transform: translateY(4px);
}

.btn:disabled {
  opacity: 0.55;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: 0 5px 0 var(--primary-deep);
}

.btn-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--primary-deep);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-ink);
  box-shadow: 0 5px 0 var(--secondary-deep);
}

.btn-secondary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--secondary-deep);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 5px 0 var(--accent-deep);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 5px 0 #a51d31;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--border);
}

.btn-done {
  background: color-mix(in srgb, var(--mint) 18%, var(--surface));
  color: var(--ink);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--mint) 55%, transparent);
  flex-direction: column;
  gap: 0;
  line-height: 1.2;
}

.btn-done:disabled {
  opacity: 1;
}

.btn-stamp {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.btn-xl {
  min-height: 68px;
  font-size: 24px;
  border-radius: 24px;
}

.btn-small {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 15px;
}

.btn-pill {
  min-height: 40px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  font-size: 15px;
}

.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}

.icon-btn:disabled {
  opacity: 0.35;
}

.icon-btn-lg {
  min-width: 56px;
  min-height: 56px;
  font-size: 20px;
}

.icon-btn-danger {
  color: var(--danger);
}

.link-btn {
  min-height: var(--tap);
  padding: 8px 20px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.back-btn {
  justify-self: start;
  min-height: var(--tap);
  padding: 8px 16px 8px 8px;
  border: 0;
  background: none;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink-soft);
}

/* ---------- Notes, chips, toast ---------- */

.inline-note {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-weight: 700;
  text-align: center;
}

.inline-note.is-ok {
  background: color-mix(in srgb, var(--mint) 18%, var(--surface));
  color: var(--ink);
}

.inline-note.is-warn {
  background: color-mix(in srgb, var(--secondary) 30%, var(--surface));
  color: var(--ink);
}

.field-error {
  color: var(--danger);
  font-weight: 700;
  font-size: 15px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--ink);
}

.chip-soft {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.chip-muted {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.chip-earned {
  background: var(--primary);
  color: var(--primary-ink);
}

.chip-approved {
  background: var(--accent);
  color: var(--accent-ink);
}

.chip-cash {
  background: var(--gold);
  color: #2b1a31;
}

.chip-saved {
  background: var(--mint);
  color: #fff;
}

.chip-override {
  background: #ff8fb1;
  color: #2b1a31;
}

.chip-review {
  background: var(--danger);
  color: #fff;
}

.chip-running {
  background: var(--mint);
  color: #fff;
}

.toast {
  position: fixed;
  z-index: 60;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  box-shadow: var(--shadow);
  transform: translate(-50%, -150%);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ---------- Confirm sheet ---------- */

.sheet-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(20 10 30 / 50%);
  animation: fade-in 160ms ease;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 20px);
  border-radius: 28px 28px 0 0;
  background: var(--surface);
  display: grid;
  gap: 12px;
  text-align: center;
  animation: slide-up 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.sheet-grip {
  justify-self: center;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
}

.sheet-title {
  font-size: 30px;
  font-weight: 900;
}

.sheet-message {
  color: var(--ink-soft);
}

.sheet-actions {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

/* ---------- Photo crop sheet ---------- */

.crop-stage {
  position: relative;
  justify-self: center;
  width: min(78vw, 320px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--ink);
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.crop-stage:active {
  cursor: grabbing;
}

.crop-image {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
}

/* Everything outside the circle is dimmed, so she sees exactly what the avatar will show. */
.crop-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(20 10 30 / 55%);
  outline: 3px solid var(--surface);
  pointer-events: none;
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 900;
  color: var(--ink-soft);
}

.crop-zoom input {
  flex: 1;
  min-height: var(--tap);
  accent-color: var(--accent);
}

/* ---------- Auth: profiles + PIN ---------- */

.auth-screen {
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 20px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 20px;
  text-align: center;
}

.brand {
  display: grid;
  gap: 6px;
}

.brand-notes {
  font-size: 34px;
  color: var(--primary);
  letter-spacing: 8px;
}

.brand-title {
  font-size: clamp(38px, 11vw, 52px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-soft);
}

.profile-grid {
  width: 100%;
  display: grid;
  gap: 16px;
}

.profile-card {
  width: 100%;
  padding: 24px;
  border: 3px solid var(--border);
  border-radius: 32px;
  background: var(--surface);
  box-shadow: 0 8px 0 var(--border), var(--shadow);
  display: grid;
  justify-items: center;
  gap: 6px;
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.profile-card:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--border);
}

.profile-avatar {
  width: 128px;
  height: 128px;
  display: block;
}

.profile-name {
  font-size: 30px;
  font-weight: 900;
}

.profile-instrument {
  color: var(--ink-soft);
  font-weight: 700;
  text-transform: capitalize;
}

.guitar-icon {
  width: 100%;
  height: 100%;
  display: block;
}

.pin-screen {
  align-content: start;
  gap: 14px;
}

.pin-avatar {
  width: 96px;
  height: 96px;
}

.parent-badge {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 48px;
}

.pin-title {
  font-size: 32px;
  font-weight: 900;
}

.pin-sub {
  color: var(--ink-soft);
  font-weight: 700;
}

.pin-dots {
  display: flex;
  gap: 18px;
  padding: 10px 0;
}

.pin-dots span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--ink-soft);
  transition: background 120ms ease, transform 120ms ease;
}

.pin-dots span.is-filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

.pin-dots.shake {
  animation: shake 420ms ease;
}

.pin-message {
  min-height: 24px;
  font-weight: 800;
  color: var(--danger);
}

.keypad {
  width: 100%;
  max-width: 320px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.key {
  aspect-ratio: 1.25;
  min-height: 64px;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 5px 0 var(--border), inset 0 0 0 2px var(--border);
  font-size: 32px;
  font-weight: 800;
  transition: transform 70ms ease, box-shadow 70ms ease;
}

.key:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--border), inset 0 0 0 2px var(--border);
  background: var(--surface-2);
}

.key-back {
  font-size: 26px;
  color: var(--ink-soft);
}

.keypad.is-locked .key {
  opacity: 0.4;
}

/* ---------- Kid top bar + tab bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar-text {
  flex: 1;
  min-width: 0;
}

.topbar-title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-btn {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  background: none;
}

.avatar-frame {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary);
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-edit {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  font-size: 18px;
  line-height: 22px;
  border: 2px solid var(--surface);
}

.avatar-btn.is-busy .avatar-frame {
  animation: pulse 900ms ease-in-out infinite;
}

.parent-mark {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 26px;
}

.tabbar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px max(12px, env(safe-area-inset-left)) calc(env(safe-area-inset-bottom) + 6px) max(12px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 2px solid var(--border);
}

@media (min-width: 700px) {
  .tabbar {
    grid-template-columns: repeat(3, 180px);
  }
}

.tab {
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: none;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
}

.tab svg {
  width: 30px;
  height: 30px;
  padding: 3px;
  border-radius: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: background 150ms ease;
}

.tab[aria-selected="true"] {
  color: var(--primary);
}

.tab[aria-selected="true"] svg {
  width: 44px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
}

/* ---------- Practice timer ---------- */

.timer-card {
  justify-items: center;
  padding-top: 24px;
  position: relative;
  overflow: hidden;
}

/* A faint five-line staff behind the ring: the music motif. */
.timer-card::before {
  content: "";
  position: absolute;
  inset: 34% -10% auto;
  height: 76px;
  background: repeating-linear-gradient(to bottom, var(--border) 0 2px, transparent 2px 19px);
  opacity: 0.6;
  pointer-events: none;
}

.ring-wrap {
  position: relative;
  width: min(76vw, 300px);
  aspect-ratio: 1;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  display: block;
}

.ring-track,
.ring-fill {
  fill: var(--surface);
  stroke-width: 20;
}

.ring-track {
  stroke: var(--ring-track);
}

.ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 900ms linear, stroke 300ms ease;
}

.timer-card.is-done .ring-fill {
  stroke: var(--mint);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.clock {
  font-size: clamp(56px, 17vw, 80px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.clock.is-idle {
  color: var(--ink-soft);
}

.ring-caption {
  max-width: 200px;
  font-weight: 800;
  font-size: 16px;
  color: var(--ink-soft);
}

.timer-card.is-done .ring-caption {
  color: var(--mint-deep);
}

.timer-card.is-running .clock {
  color: var(--ink);
}

.timer-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 6px;
}

.timer-actions .btn-block {
  grid-column: 1 / -1;
}

.btn-start {
  min-height: 76px;
  font-size: 30px;
}

.btn-start-icon {
  font-size: 24px;
}

/* ---------- Songs ---------- */

.songs-header {
  display: grid;
  gap: 2px;
}

.song-list,
.history,
.session-list,
.manager-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.song-row {
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.song-row.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.song-note {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--secondary);
  color: var(--secondary-ink);
  font-size: 20px;
  font-weight: 900;
}

.song-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.song-title {
  font-weight: 800;
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-artist {
  color: var(--ink-soft);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player {
  background: var(--surface-2);
  box-shadow: none;
  border-width: 3px;
}

.player.is-looping {
  border-color: var(--accent);
}

.player-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.player-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.15;
}

.player-artist {
  color: var(--ink-soft);
  font-weight: 700;
}

.yt-frame {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.yt-frame iframe,
.yt-frame > div {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.player-main {
  display: flex;
  align-items: center;
  gap: 14px;
}

.play-btn {
  flex: none;
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 5px 0 var(--primary-deep);
  display: grid;
  place-items: center;
}

.play-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--primary-deep);
}

.play-btn:disabled {
  opacity: 0.5;
}

.play-icon {
  width: 0;
  height: 0;
  margin-left: 6px;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent var(--primary-ink);
}

.play-btn.is-playing .play-icon {
  width: 24px;
  height: 28px;
  margin-left: 0;
  border: 0;
  background: linear-gradient(to right, var(--primary-ink) 0 8px, transparent 8px 16px, var(--primary-ink) 16px 24px);
}

.scrub {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.scrubber {
  --fill: 0%;
  width: 100%;
  height: var(--tap);
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.scrubber::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--fill), var(--ring-track) var(--fill));
}

.scrubber::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--fill), var(--ring-track) var(--fill));
}

.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--primary);
}

.scrubber::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--primary);
}

.scrub-times {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.control-row {
  display: grid;
  gap: 6px;
}

.control-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.chip-group,
.loop-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.loop-group {
  grid-template-columns: 1fr 1fr 1fr;
}

.speed-chip,
.loop-btn {
  min-height: var(--tap);
  border: 2px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-weight: 900;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.speed-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 0 var(--accent-deep);
}

.loop-btn.is-set {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--secondary-ink);
}

.loop-btn span {
  font-weight: 700;
  font-size: 14px;
}

.loop-clear {
  color: var(--ink-soft);
}

/* ---------- Week ---------- */

.week-hero {
  justify-items: center;
  text-align: center;
  gap: 14px;
}

.days-big {
  font-size: 30px;
  font-weight: 900;
}

.days-num {
  font-size: 64px;
  color: var(--primary);
  vertical-align: -6px;
}

.slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2.5vw, 14px);
}

.pick {
  width: clamp(46px, 14vw, 64px);
  height: auto;
  display: block;
}

.pick path:first-child {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 3;
}

.pick.is-filled path:first-child {
  fill: var(--primary);
  stroke: var(--primary-deep);
}

.pick-check {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pick.is-filled {
  animation: pop 360ms cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.minutes-line {
  font-size: 20px;
  font-weight: 900;
}

.week-hero.is-goal {
  background: linear-gradient(160deg, color-mix(in srgb, var(--secondary) 40%, var(--surface)), var(--surface) 70%);
  border-color: var(--secondary);
}

.celebrate {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.burst {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 48px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) 25%, transparent);
  animation: spin-pop 900ms ease both;
}

.celebrate-title {
  font-size: 40px;
  font-weight: 900;
}

.celebrate-money {
  font-size: 26px;
  font-weight: 900;
  color: var(--mint-deep);
}

@media (prefers-color-scheme: dark) {
  .celebrate-money,
  .timer-card.is-done .ring-caption {
    color: var(--mint);
  }
}

.dayrow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.day {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 8px 0 22px;
  border-radius: 16px;
}

.day-letter {
  font-weight: 900;
  color: var(--ink-soft);
}

.day-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
}

.day.is-counted .day-dot {
  background: var(--mint);
  border-color: var(--mint);
}

.day.is-partial .day-dot {
  border-color: var(--secondary);
  background: color-mix(in srgb, var(--secondary) 35%, transparent);
}

.day-minutes {
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.day.is-future {
  opacity: 0.5;
}

.day.is-today {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.today-tag {
  position: absolute;
  bottom: 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.streak-card {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
}

.streak-flame {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  background: var(--surface-2);
  color: var(--ink-soft);
}

.streak-card.has-streak .streak-flame {
  background: linear-gradient(160deg, var(--secondary), var(--primary));
  color: #fff;
}

/* ---------- Money ---------- */

.jars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.jar-card {
  margin: 0;
  padding: 16px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  justify-items: center;
  gap: 8px;
}

.jar {
  width: min(100%, 150px);
  height: auto;
  display: block;
}

.jar-glass {
  fill: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.jar-outline {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linejoin: round;
}

.jar-lid {
  fill: var(--ink);
}

.jar-shine {
  fill: none;
  stroke: #fff;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.5;
}

.jar-cash .jar-fill,
.jar-cash .jar-wave {
  fill: var(--gold);
}

.jar-savings .jar-fill,
.jar-savings .jar-wave {
  fill: var(--mint);
}

.jar-wave {
  opacity: 0.6;
}

.jar-fill {
  transition: y 600ms ease, height 600ms ease;
}

.jar-coin {
  fill: #ffe066;
  stroke: #d49a00;
  stroke-width: 2;
}

.jar-card figcaption {
  display: grid;
  justify-items: center;
}

.jar-name {
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 14px;
}

.jar-total {
  font-size: 36px;
  font-weight: 900;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.history-row {
  padding: 12px 0;
  border-bottom: 2px dashed var(--border);
  display: grid;
  gap: 8px;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.history-main > div {
  display: grid;
}

.history-amount {
  font-size: 24px;
  font-weight: 900;
  color: var(--mint-deep);
}

@media (prefers-color-scheme: dark) {
  .history-amount {
    color: var(--mint);
  }
}

.history-amount.is-zero {
  color: var(--ink-soft);
}

.override-note {
  font-style: italic;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* ---------- Parent ---------- */

/* ---------- Parent: kid switcher ---------- */

.kid-switch {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--border);
}

.kid-switch[hidden] {
  display: none;
}

.kid-tab {
  min-height: var(--tap);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  display: grid;
  line-height: 1.1;
  padding: 6px 12px;
}

.kid-tab strong {
  font-size: 18px;
  font-weight: 900;
}

.kid-tab span {
  font-size: 13px;
  font-weight: 700;
}

.kid-tab.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 0 var(--accent-deep);
}

.week-picker {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  text-align: center;
  padding: 12px;
}

.week-picker-label {
  display: grid;
}

.week-picker-label strong {
  font-size: 20px;
  font-weight: 900;
}

.rule {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 800;
}

.rule-ok {
  background: color-mix(in srgb, var(--mint) 20%, var(--surface));
}

.rule-short {
  background: color-mix(in srgb, var(--secondary) 30%, var(--surface));
}

.rule-override {
  background: color-mix(in srgb, #ff8fb1 35%, var(--surface));
}

.mini-days {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.mini-day {
  display: grid;
  justify-items: center;
  padding: 6px 0;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
}

.mini-day strong {
  font-size: 16px;
  color: var(--ink);
}

.mini-day.is-counted {
  background: var(--mint);
  color: #fff;
}

.mini-day.is-counted strong {
  color: #fff;
}

.mini-day.is-partial {
  background: color-mix(in srgb, var(--secondary) 35%, var(--surface));
}

.mini-day.is-today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.action-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 560px) {
  .action-grid {
    grid-template-columns: 1fr 1fr;
  }

  .override-form {
    grid-column: 1 / -1;
  }
}

.override-form,
.song-form,
.add-session {
  display: grid;
  gap: 10px;
}

.song-form {
  padding-top: 12px;
  border-top: 2px dashed var(--border);
}

label {
  display: grid;
  gap: 4px;
  font-weight: 800;
  font-size: 15px;
}

label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
}

label.check input {
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

input:not([type="checkbox"]):not([type="range"]),
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 17px;
  font-weight: 600;
}

input[type="file"] {
  padding: 10px;
}

textarea {
  resize: vertical;
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
}

.session-row {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
}

.session-row.is-flagged {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.session-when {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.session-edit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.minutes-input {
  width: 96px !important;
  text-align: center;
  font-weight: 900 !important;
  font-variant-numeric: tabular-nums;
}

.session-edit .icon-btn-danger {
  margin-left: auto;
}

.manager-row {
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 8px;
}

.manager-text {
  display: grid;
  min-width: 0;
}

.manager-text strong {
  overflow-wrap: anywhere;
}

.manager-actions {
  display: flex;
  gap: 8px;
}

.manager-actions .icon-btn-danger {
  margin-left: auto;
}

.pin-btn {
  color: var(--ink-soft);
}

.pin-btn.is-on {
  background: var(--secondary);
  border-color: var(--secondary);
  color: var(--secondary-ink);
}

.progress {
  position: relative;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--ring-track);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
}

.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent);
  opacity: 0.55;
  transition: width 200ms ease;
}

.progress span {
  position: relative;
}

/* ---------- Tablet ---------- */

@media (min-width: 700px) {
  .ring-wrap {
    width: 340px;
  }

  .clock {
    font-size: 88px;
  }

  .auth-screen {
    max-width: 520px;
  }
}

/* ---------- Motion ---------- */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(6px); }
}

@keyframes pop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

@keyframes spin-pop {
  0% { transform: scale(0.3) rotate(-120deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
