* { margin: 0; padding: 0; box-sizing: border-box; }

/* Palette borrowed from Yoto's: warm marshmallow background, "fruit punch"
   orange-red as the primary, peach / blue-bird accents, near-black text.
   --c0..--c5 tint the song cards (picked per song id, see cardColor()). */
:root {
  --bg: #f6f1e7;
  --surface: #ffffff;
  --surface-subtle: #fbf9f6;
  --wool: #ebe5dc;
  --text: #1e1c1c;
  --text-dim: #6e6868;
  --primary: #f45134;
  --primary-deep: #d02215;
  --primary-ink: #ffffff;
  --peach: #ffdac5;
  --blue: #1471d9;
  --success: #138a5e;
  --c0: #f45436;
  --c1: #ffb84d;
  --c2: #1471d9;
  --c3: #ffd0b5;
  --c4: #5cc7a0;
  --c5: #a98bf0;
  /* fallback-icon colour on each card tint; light tints get a darker ink */
  --c0-ink: #fff;
  --c1-ink: #9a4a00;
  --c2-ink: #fff;
  --c3-ink: #d02215;
  --c4-ink: #fff;
  --c5-ink: #fff;
  --shadow-card: 0 2px 0 rgba(30, 28, 28, 0.06), 0 10px 24px -12px rgba(30, 28, 28, 0.25);
  --shadow-float: 0 14px 40px -10px rgba(30, 28, 28, 0.35);
  --press: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  --display: "Fredoka", "Nunito", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --body: "Nunito", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Bedtime: a soft night-sky version rather than pure black */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1830;
    --surface: #2a2645;
    --surface-subtle: #241f3b;
    --wool: #3a3559;
    --text: #f7f2ea;
    --text-dim: #b3acc9;
    --primary: #ff6a4d;
    --primary-deep: #e0442a;
    --peach: #4a3a52;
    --success: #5cd6a0;
    --c3: #f2b896;
    --shadow-card: 0 10px 24px -12px rgba(0, 0, 0, 0.7);
    --shadow-float: 0 14px 40px -10px rgba(0, 0, 0, 0.8);
  }
}

html, body { min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* no double-tap zoom from excited little fingers */
}

.hidden { display: none !important; }

button {
  font-family: var(--body);
  font-weight: 800;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
}

/* Lucide icons via Iconify; .solid fills them */
.icon {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}
.icon.solid { fill: currentColor; stroke-width: 1.5; }

/* ---------- shared buttons ---------- */

/* The "chunky" look: vertical gradient plus an inner bottom edge, so buttons
   read as something you can press — Yoto's primary button treatment. */
.chunky-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-deep));
  color: var(--primary-ink);
  font-size: 16px;
  box-shadow: var(--press);
  transition: transform 0.08s;
}
.chunky-btn:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18); }
.chunky-btn:disabled { opacity: 0.5; cursor: wait; }

.ghost-btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--wool);
  color: var(--text);
  font-size: 15px;
}
.ghost-btn:active { transform: translateY(1px); }
.ghost-btn.on { background: var(--text); color: var(--bg); }

.round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
  box-shadow: var(--press), var(--shadow-card);
  transition: transform 0.08s;
}
.round-btn:active { transform: translateY(2px) scale(0.97); }
.round-btn .icon { width: 22px; height: 22px; }
.round-btn.primary {
  background: linear-gradient(to bottom, var(--primary), var(--primary-deep));
  color: var(--primary-ink);
}
.round-btn.big { width: 68px; height: 68px; }
.round-btn.big .icon { width: 28px; height: 28px; }
.round-btn.huge { width: 96px; height: 96px; }
.round-btn.huge .icon { width: 40px; height: 40px; }

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 15px;
  box-shadow: var(--shadow-card);
}
.pill-btn .icon { width: 18px; height: 18px; }
.pill-btn.active { background: var(--text); color: var(--bg); }

/* ---------- header ---------- */

/* Scrolls away with the page like a book's title page; album pages hide it.
   Only the real safe-area inset is added: in a Safari tab the viewport already
   starts below the status bar (inset 0), and home-screen app mode reports the
   actual inset, so any fixed extra offset just doubles up as blank space. */
.topbar {
  position: relative;
  padding-top: env(safe-area-inset-top);
}
body.in-album .topbar { display: none; }
body.in-album .library { padding-top: calc(14px + env(safe-area-inset-top)); }

.topbar-inner,
.parent-inner,
.library > * {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

/* Centered like a book's title page: logo + name, then a dedication line */
.topbar-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  text-align: center;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: linear-gradient(to bottom, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: var(--press);
  transform: rotate(-6deg);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.brand-mark .icon { width: 25px; height: 25px; }
/* Press-and-hold feedback: a ring fills in while the hold counts down */
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 20px;
  border: 3px solid var(--primary);
  opacity: 0;
  transform: scale(0.85);
}
.brand-mark.holding::after {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.2s, transform var(--hold, 1.2s) linear;
}
.brand-mark.holding { animation: wiggle 0.3s ease-in-out infinite alternate; }
@keyframes wiggle {
  from { transform: rotate(-9deg) scale(0.96); }
  to { transform: rotate(-3deg) scale(0.96); }
}
.brand-mark.unlocked { background: linear-gradient(to bottom, var(--success), #0c6a47); }

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* Dedication, set like the one in the front of a storybook */
.dedication {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.2;
  color: var(--text-dim);
}
.dedication::before,
.dedication::after {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

/* ---------- parent panel ---------- */

.parent-panel {
  padding: 4px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}
.parent-inner {
  padding: 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 2px dashed var(--wool);
}
.parent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.parent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--success);
}
.parent-chip .icon { width: 18px; height: 18px; }
.parent-actions { display: flex; gap: 8px; }
#parent-exit { display: inline-grid; place-items: center; padding: 0 12px; }
#parent-exit .icon { width: 18px; height: 18px; }

.add-form { display: flex; gap: 8px; }
.add-form input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 18px;
  border: 2px solid var(--wool);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text);
  font: 700 16px var(--body); /* 16px: iOS won't zoom on focus */
  outline: none;
}
.add-form input:focus { border-color: var(--primary); }
.add-form input::placeholder { color: var(--text-dim); font-weight: 600; }

/* ---------- library ---------- */

.library {
  padding: 18px max(16px, env(safe-area-inset-right)) calc(130px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}


.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px 20px;
}
.empty-art { width: 170px; height: auto; margin-bottom: 16px; }
.empty-title { font-family: var(--display); font-weight: 600; font-size: 22px; }
.empty-sub { margin-top: 6px; color: var(--text-dim); font-size: 15px; }
.empty-sub .icon { width: 16px; height: 16px; }

/* Song cards — portrait Yoto-card shape: big rounded art, chunky title below */
.song-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 16px;
}
@media (max-width: 380px) {
  .song-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; }
}

.card { position: relative; min-width: 0; }
.card.playable { cursor: pointer; }

.card-art {
  position: relative;
  aspect-ratio: 1;
  border-radius: 22px;
  background: var(--tint) center / cover no-repeat;
  box-shadow: var(--shadow-card);
  display: grid;
  place-items: center;
  color: var(--ink, #fff);
  overflow: hidden;
  transition: transform 0.15s;
}
.card-art > .icon { width: 44%; height: 44%; stroke-width: 2; }
.card.playable:active .card-art { transform: scale(0.96); }
@media (hover: hover) {
  .card.playable:hover .card-art { transform: translateY(-3px) rotate(-1deg); }
}
.card.active .card-art {
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--primary), var(--shadow-card);
}

/* Album cards look like a little deck: two tinted cards peek out behind */
.album-card .card-art {
  margin: 12px 12px 0 0;
  box-shadow:
    6px -6px 0 -1px color-mix(in srgb, var(--tint) 60%, var(--bg)),
    12px -12px 0 -2px color-mix(in srgb, var(--tint) 30%, var(--bg)),
    var(--shadow-card);
}
.album-card.active .card-art {
  box-shadow:
    0 0 0 4px var(--bg), 0 0 0 7px var(--primary),
    var(--shadow-card);
}

.card-count {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 700 14px/30px var(--display);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.card-count .icon { width: 16px; height: 16px; }

/* Dancing bars on the card that's playing */
.eq {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  padding: 7px 8px;
  border-radius: 999px;
  background: var(--primary);
}
.eq i {
  display: block;
  width: 4px;
  height: 100%;
  border-radius: 2px;
  background: #fff;
  animation: eq 0.9s ease-in-out infinite;
  transform-origin: bottom;
}
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
body.paused .eq i { animation-play-state: paused; }

/* Not-ready-yet veil (queued / fetching / failed) */
.card-veil {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(30, 28, 28, 0.45);
  color: #fff;
  font-size: 14px;
}
.card-veil .icon { width: 26px; height: 26px; }
.card-veil .retry {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--primary-deep);
  font-size: 13px;
}

.card-title {
  margin-top: 10px;
  padding: 0 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card.active .card-title { color: var(--primary); }
.card-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0 2px;
  font-size: 13px;
  color: var(--text-dim);
}
.card-sub .icon { width: 13px; height: 13px; }

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- album page ---------- */

.album-back { display: inline-flex; align-items: center; gap: 6px; }
.album-back .icon { width: 18px; height: 18px; }

.album-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 18px 0 22px;
  text-align: center;
}
@media (min-width: 640px) {
  .album-hero { flex-direction: row; align-items: flex-end; text-align: left; }
}
.album-cover {
  width: min(64vw, 260px);
  aspect-ratio: 1;
  flex-shrink: 0;
  border-radius: 28px;
  background: var(--tint) center / cover no-repeat;
  box-shadow: 0 0 0 6px var(--surface), var(--shadow-float);
  display: grid;
  place-items: center;
  color: var(--ink, #fff);
  transform: rotate(-2deg);
}
.album-cover .icon { width: 42%; height: 42%; stroke-width: 2; }
.album-info { min-width: 0; }
.album-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(22px, 5.5vw, 30px);
  line-height: 1.2;
}
.album-meta { margin-top: 6px; color: var(--text-dim); font-size: 15px; }
.album-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
@media (min-width: 640px) {
  .album-actions { justify-content: flex-start; }
}
.album-actions .chunky-btn { min-height: 54px; padding: 0 28px; font-size: 18px; }

/* Numbered track list, like the chapter list on a Yoto card page */
.tracklist {
  list-style: none;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.trk {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
  padding: 10px 16px;
}
.trk + .trk { border-top: 2px solid var(--surface-subtle); }
.trk.playable { cursor: pointer; }
.trk.playable:active { background: var(--surface-subtle); }
.trk-num {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--wool);
  font: 700 15px var(--display);
}
.trk.active .trk-num { background: var(--primary); color: #fff; }
.trk-num .eq { position: static; height: 20px; padding: 0; background: none; gap: 2px; }
.trk-num .eq i { width: 3px; }
.trk-title {
  flex: 1;
  min-width: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
}
.trk.active .trk-title { color: var(--primary); }
.trk:not(.playable) .trk-title { color: var(--text-dim); }
.trk-dur {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.trk-dur .icon { width: 14px; height: 14px; }
.trk-status { flex-shrink: 0; font-size: 13px; color: var(--text-dim); }
.trk-status.error { color: var(--primary-deep); }
.trk .retry {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--peach);
  color: var(--primary-deep);
  font-size: 13px;
}

/* ---------- edit mode: the grid becomes a reorderable list ---------- */

.song-grid.editing { display: block; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.row-art {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--tint) center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--ink, #fff);
  flex-shrink: 0;
}
.row-info { flex: 1; min-width: 0; }
.row-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-rename {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0;
  text-align: left;
  color: inherit;
}
.row-rename span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-rename .icon { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-dim); }
.row-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
}
.row-sub .err { color: var(--primary-deep); overflow: hidden; text-overflow: ellipsis; }
.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--wool);
  font-size: 11px;
  flex-shrink: 0;
}

.del-circle, .drag-handle, .row-dl {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}
.del-circle { color: var(--primary-deep); }
.del-circle .icon { width: 24px; height: 24px; }
.drag-handle { color: var(--text-dim); cursor: grab; touch-action: none; }
.row-dl { color: var(--blue); background: var(--surface-subtle); }
.row-dl .icon { width: 20px; height: 20px; }
.row-dl:disabled { opacity: 0.5; }
/* Every track is in the offline cache */
.row-dl.done { color: var(--success); }
.row.caching .row-detail { color: var(--blue); }
.row.dragging {
  position: relative;
  z-index: 5;
  box-shadow: var(--shadow-float);
  transform-origin: center;
}

/* ---------- mini player ---------- */

.mini-player {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 10px;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  cursor: pointer;
}
.mini-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--wool);
}
#mini-progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: 0 2px 2px 0; }
.mini-cover {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--tint, var(--c3)) center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--ink, #fff);
  flex-shrink: 0;
}
.mini-cover .icon { width: 26px; height: 26px; }
.mini-meta { flex: 1; min-width: 0; }
.mini-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-uploader {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-player .round-btn { width: 50px; height: 50px; }

/* ---------- now playing sheet ---------- */

/* The page behind dims and softens, so the sheet reads as a card lifted
   above it rather than a page swap */
.np-scrim {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(30, 24, 40, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
}
.np-scrim.open { opacity: 1; pointer-events: auto; }

.np-sheet {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  border-radius: 30px 30px 0 0;
  /* tint follows the playing song's card colour */
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--tint, var(--c3)) 45%, var(--bg)) 0%, var(--bg) 70%);
  /* lift: a soft upward shadow plus a hairline highlight along the top edge */
  box-shadow:
    0 -18px 48px -12px rgba(30, 24, 40, 0.45),
    0 -2px 10px rgba(30, 24, 40, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translateY(calc(100% + 60px));
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.np-sheet.open { transform: translateY(0); }
/* Finger-following while swiping down: no easing between frames */
.np-sheet.dragging, .np-scrim.dragging { transition: none; }
@media (prefers-color-scheme: dark) {
  .np-scrim { background: rgba(5, 3, 15, 0.6); }
  .np-sheet {
    box-shadow:
      0 -18px 48px -12px rgba(0, 0, 0, 0.8),
      inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }
}
@media (min-width: 640px) {
  .np-sheet { top: calc(28px + env(safe-area-inset-top)); }
}

.sheet-inner {
  min-height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px max(20px, env(safe-area-inset-right))
    calc(28px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* Header row: close chevron on the left, grab handle centred on the sheet,
   both kept clear of the rounded top edge */
.sheet-head {
  position: relative;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
}
.sheet-grabber {
  position: absolute;
  top: 0;
  left: 50%;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 999px;
  background: var(--text);
  opacity: 0.22;
}
.sheet-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -6px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(30, 24, 40, 0.08);
}
.sheet-close .icon { width: 24px; height: 24px; }
.sheet-close:active { transform: scale(0.94); }

.sheet-stage {
  width: 100%;
  display: grid;
  place-items: center;
  padding: 10px 0 26px;
}
.sheet-cover {
  width: min(78vw, 340px, 42vh);
  aspect-ratio: 1;
  border-radius: 34px;
  background: var(--tint, var(--c3)) center / cover no-repeat;
  box-shadow: 0 0 0 8px var(--surface), var(--shadow-float);
  display: grid;
  place-items: center;
  color: var(--ink, #fff);
  animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}
.sheet-cover .icon { width: 42%; height: 42%; stroke-width: 2; }
.np-sheet.paused .sheet-cover { animation-play-state: paused; }

.sheet-meta { width: 100%; text-align: center; }
.sheet-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 24px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sheet-uploader { margin-top: 4px; color: var(--text-dim); font-size: 15px; }

.seek-block { width: 100%; margin-top: 22px; }
.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Fat, easy-to-grab progress bar */
#seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--primary) var(--pct, 0%), var(--wool) var(--pct, 0%));
  outline: none;
  cursor: pointer;
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
#seek::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 4px solid var(--primary);
}

.sheet-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 22px;
}
.mode-row { display: flex; gap: 10px; margin-top: 26px; }

/* ---------- password modal ---------- */

.pw-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 28, 28, 0.45);
}
.pw-card {
  width: min(340px, 100%);
  padding: 26px 22px 22px;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  text-align: center;
}
.pw-badge {
  display: inline-grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 20px;
  background: var(--peach);
  color: var(--primary-deep);
}
.pw-badge .icon { width: 28px; height: 28px; }
.pw-title { margin-top: 12px; font-family: var(--display); font-weight: 600; font-size: 22px; }
.pw-sub { margin-top: 4px; font-size: 14px; color: var(--text-dim); }
#pw-input {
  width: 100%;
  height: 50px;
  margin-top: 18px;
  padding: 0 18px;
  border: 2px solid var(--wool);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--text);
  font: 700 16px var(--body);
  text-align: center;
  outline: none;
}
#pw-input:focus { border-color: var(--primary); }
.pw-actions { display: flex; gap: 10px; margin-top: 14px; }
.pw-actions > * { flex: 1; min-height: 48px; }
.pw-err { min-height: 20px; margin-top: 10px; color: var(--primary-deep); font-size: 14px; }
