/* Unison — Design System & Styles */

/* ── CSS Custom Properties ──
   Palette: "Cool Room". The --ws- prefix is legacy (Woodshed) and deliberately
   kept — it is internal only, and renaming it churns ~1200 references for zero
   user-visible gain.

   Colour roles — keep these separate, they mean different things:
     accent   action        buttons, rails, links, active states
     sky      secondary     chips, badges, selected/reference states
     violet   tertiary      brand mark depth, decorative accents
     gold     best take     the marked take + pinned comments. Nothing else.
     crimson  destructive   delete, leave group, sign out, storage >= 90%
     magenta  warning       quota pressure, non-destructive alerts
*/
:root {
  /* Dark mode — the only shipped theme; see [data-theme="light"] note below */
  --ws-background: #080B18;
  --ws-surface: #101526;
  --ws-surface-elevated: #19203A;
  --ws-accent: #4ECDC6;
  --ws-sky: #5EA9F0;
  --ws-violet: #8B6BE8;
  --ws-gold: #FFB74D;
  --ws-crimson: #F0616B;
  --ws-magenta: #E04787;
  --ws-deep-blue: #1F2A55;
  --ws-text-primary: #EDF0F7;
  --ws-text-secondary: #8D96B4;
  --ws-text-tertiary: #5A6280;

  /* Aliases for names used in a few rules that were never defined. --ws-bg had
     no fallback, so .chart-viewer was rendering transparent. */
  --ws-bg: var(--ws-background);
  --ws-text: var(--ws-text-primary);
  --ws-surface-raised: var(--ws-surface-elevated);
  --ws-border: #242C48;

  --ws-radius: 14px;
  --ws-gradient-accent: linear-gradient(to right, #8B6BE8, #5EA9F0, #4ECDC6);
  /* runs vertically: its only consumer is the 3px-wide section rail, where a
     horizontal gradient could never show more than one colour */
  --ws-gradient-brand: linear-gradient(to bottom, #8B6BE8, #5EA9F0, #4ECDC6);
}

/* Light theme is NOT reachable: data-theme="dark" is hardcoded on <html> in both
   app.html and index.html, and nothing ever changes it. These tokens are kept in
   sync with the palette so the stub doesn't rot, but shipping a real toggle means
   auditing every colour for contrast on a pale ground — a separate piece of work. */
[data-theme="light"] {
  --ws-background: #F4F6FA;
  --ws-surface: #EBEEF4;
  --ws-surface-elevated: #FFFFFF;
  --ws-text-primary: #101422;
  --ws-text-secondary: #4C5468;
  --ws-text-tertiary: #78819A;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--ws-background);
  color: var(--ws-text-primary);
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ws-accent);
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font: inherit;
  color: inherit;
  background: var(--ws-surface);
  border: 1px solid var(--ws-text-tertiary);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ws-accent);
  box-shadow: 0 0 0 2px rgba(78, 205, 198, 0.2);
}

/* ── App Layout ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ws-surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Wordmark: the mark carries the colour, the name stays flat. The old gradient
   text is gone — it fought the content and died on any non-dark ground. */
.app-header .logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ws-text-primary);
}

.app-header .logo svg {
  flex: none;
}

.brand-tld {
  font-weight: 500;
  color: var(--ws-text-tertiary);
}

/* Subview header titles (group name, shared book name). These used to borrow
   .logo and cancel its gradient inline; .logo is a flex lockup now, so they
   get their own rule. */
.app-header .header-title {
  flex: 1;
  min-width: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ws-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header .header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.main-content {
  flex: 1;
  padding: 1rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.subview-header-copy {
  min-width: 0;
}

.subview-header-kicker {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ws-text-tertiary);
}

.subview-header-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ws-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Cards ── */
.card {
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, rgba(78, 205, 198, 0.06), transparent);
  pointer-events: none;
}

.card + .card {
  margin-top: 0.75rem;
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-text-secondary);
}

.section-header::before {
  content: '';
  width: 3px;
  height: 1em;
  background: var(--ws-gradient-brand);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--ws-gradient-accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--ws-surface-elevated);
  color: var(--ws-text-primary);
  border: 1px solid var(--ws-text-tertiary);
}

.btn-ghost {
  color: var(--ws-text-secondary);
  padding: 0.5rem;
}

.btn-ghost:hover {
  color: var(--ws-text-primary);
}

/* ── Header actions: members chip, invite pill, profile avatar ── */
#archive-group-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.header-chip {
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(141, 150, 180, 0.35);
  color: var(--ws-text-secondary);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: none;
}

.header-chip:hover {
  color: var(--ws-text-primary);
  border-color: rgba(141, 150, 180, 0.6);
}

.header-chip-invite {
  color: var(--ws-sky);
  border-color: rgba(94, 169, 240, 0.45);
}

.header-chip-invite:hover {
  color: var(--ws-sky);
  border-color: var(--ws-sky);
}

.header-avatar {
  width: 1.875rem;
  height: 1.875rem;
  padding: 0;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow: hidden;
  flex-shrink: 0;
}

.header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 50%;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Auth Screen ── */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  padding: 2rem 1rem;
  text-align: center;
}

.auth-screen .logo-mark {
  margin-bottom: 0.875rem;
}

.auth-screen .logo-large {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--ws-text-primary);
  margin-bottom: 0.25rem;
}

.auth-screen .tagline {
  color: var(--ws-text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.auth-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ws-text-tertiary);
  font-size: 0.8125rem;
  margin: 0.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ws-text-tertiary);
  opacity: 0.3;
}

.auth-toggle {
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.auth-toggle a {
  font-weight: 600;
}

/* ── View containers ── */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* ── Group List ── */
.group-list {
  list-style: none;
}

.group-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  cursor: pointer;
  transition: background 0.15s;
}

.group-item:hover {
  background: var(--ws-surface-elevated);
}

.group-item + .group-item {
  margin-top: 0.5rem;
}

.group-item .group-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--ws-gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
}

.group-item .group-info {
  flex: 1;
  min-width: 0;
}

.group-item .group-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.group-item .group-meta {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
}

.group-item .group-arrow {
  color: var(--ws-text-tertiary);
  font-size: 1.25rem;
}

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ws-text-secondary);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.0625rem;
  color: var(--ws-text-primary);
  margin-bottom: 0.375rem;
}

.empty-state p {
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

/* ── Recording List ── */
.recording-list {
  list-style: none;
}

.recording-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 10px;
  transition: background 0.15s;
}

.recording-item:hover {
  background: var(--ws-surface-elevated);
}

.recording-item + .recording-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.recording-item .play-btn {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.recording-item .play-btn.playing {
  background: var(--ws-sky);
}

.recording-item .rec-info {
  flex: 1;
  min-width: 0;
}

.recording-item .rec-title {
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recording-item .rec-meta {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.recording-item .rec-duration {
  color: var(--ws-text-tertiary);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Persistent Player Bar ── */
.player-bar {
  position: fixed;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  background: var(--ws-surface-elevated);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0;
  z-index: 200;
  display: none;
  transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1), height 0.4s cubic-bezier(0.33, 1, 0.68, 1), border-radius 0.4s;
  height: 104px;
  overflow: hidden;
}

.player-bar.visible {
  display: block;
}

body:has(.player-bar.visible) .main-content,
body:has(.player-bar.visible) .repertoire-main,
body:has(.player-bar.visible) .tune-detail-main {
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.player-bar.expanded {
  bottom: 0;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  border-radius: 0;
  border-top: none;
}

.player-bar .player-content {
  max-width: 600px;
  margin: 0 auto;
  display: block;
  min-height: 104px;
  padding: 0.55rem 1rem 0.8rem;
  pointer-events: none;
}

.player-bar.expanded .player-content {
  display: none;
}

.player-bar .player-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  pointer-events: auto;
}

.player-main-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  z-index: 2;
}

.player-bar.queue-mode .player-main-row {
  gap: 0.55rem;
}

.player-bar .player-title {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-bar .player-artist {
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
}

.player-bar .player-play-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-play-icon {
  display: block;
  flex-shrink: 0;
}

.player-play-btn .player-play-icon {
  transform: translateX(0.5px);
}

.player-mini-track-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  color: var(--ws-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-mini-track-btn:hover {
  color: var(--ws-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.player-mini-track-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.player-expand-btn {
  width: 2.25rem;
  height: 2.25rem;
  color: var(--ws-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-expand-btn:hover {
  color: var(--ws-text-primary);
}

.player-close-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ws-text-secondary);
  font-size: 1.35rem;
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-bar .seek-bar {
  width: 100%;
  margin-top: 0.45rem;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  pointer-events: auto;
}

.player-bar .player-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--ws-text-tertiary);
  font-variant-numeric: tabular-nums;
  margin-top: 0.2rem;
}

.player-bar.queue-mode #player-collapsed-content .player-artist {
  color: var(--ws-sky);
  font-weight: 600;
}

@media (max-width: 767px) {
  .player-bar {
    bottom: 0;
    height: 88px;
  }

  .player-bar.expanded {
    bottom: 0;
  }

  .player-bar .player-content {
    min-height: 88px;
    padding-top: 0.45rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  }

  .player-main-row {
    gap: 0.65rem;
    min-height: 44px;
  }

  .player-bar.queue-mode .player-main-row {
    gap: 0.42rem;
  }

  .player-bar .player-play-btn {
    width: 2.3rem;
    height: 2.3rem;
  }

  .player-mini-track-btn {
    width: 1.85rem;
    height: 1.85rem;
  }

  .player-expand-btn,
  .player-close-btn {
    width: 2.1rem;
    height: 2.1rem;
  }

  #player-collapsed-content .seek-bar,
  #player-collapsed-content .player-times {
    display: none;
  }

  .player-bar .player-content-expanded {
    padding: 0.85rem 1rem calc(env(safe-area-inset-bottom) + 1.35rem);
  }

  .player-bar .expanded-player-header {
    margin-bottom: 0.85rem;
  }

  .player-bar .player-title.large {
    font-size: 1.05rem;
  }

  .player-bar .player-waveform {
    min-height: 0;
    height: clamp(150px, 26vh, 220px);
    margin: 0;
  }

  .player-bar .expanded-controls {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    padding-bottom: 0;
  }

  .player-bar .player-times.large {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0 0.1rem;
  }

  .player-bar .control-row {
    justify-content: space-between;
    gap: 0.9rem;
  }

  .player-bar .skip-btn {
    width: 3rem;
    height: 3rem;
  }

  .player-bar .player-play-btn.large {
    width: 4.25rem;
    height: 4.25rem;
  }
}

/* ── Expanded Player Content ── */
.player-content-expanded {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 1rem 1.5rem 2.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.player-bar.expanded .player-content-expanded {
  display: flex;
}

.expanded-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  text-align: center;
}

.expanded-player-info {
  flex: 1;
  padding: 0 0.5rem;
}

.expanded-player-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 4;
}

.player-crop-btn {
  min-width: 3.5rem;
  height: 2.25rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--ws-gold);
  font-weight: 700;
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.18);
  position: relative;
  z-index: 4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-crop-btn[disabled] {
  opacity: 0.45;
}

.player-title.large {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: normal;
}

.player-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 130px;
  margin: 0;
  position: relative;
  cursor: pointer;
  /* touch-action:none is what lets the pointer handlers own the gesture on a
     phone — without it the browser cancels the pointer stream to scroll. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Long-press targets: suppress iOS text-selection callout (Copy/Search with Google)
   so the custom tune context menu can appear cleanly. Applied to the element and
   every descendant — iOS selects text on inner nodes even if the parent says no. */
.no-long-press-select,
.no-long-press-select *,
.context-menu,
.context-menu * {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.player-waveform.scrubbing {
  cursor: ew-resize;
}

.player-waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
}

.expanded-controls {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    padding-bottom: 0;
  }

  .player-bar .player-times.large {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0 0.1rem;
  }

  .player-bar .control-row {
    justify-content: space-between;
    gap: 0.9rem;
  }

  .player-bar .skip-btn {
    width: 3rem;
    height: 3rem;
  }

  .player-bar .player-play-btn.large {
    width: 4.25rem;
    height: 4.25rem;
  }
}

/* ── Expanded Player Content ── */
.player-content-expanded {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 1rem 1.5rem 2.5rem;
  max-width: 600px;
  margin: 0 auto;
}

.player-bar.expanded .player-content-expanded {
  display: flex;
}

.expanded-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  text-align: center;
}

.expanded-player-info {
  flex: 1;
  padding: 0 0.5rem;
}

.expanded-player-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 4;
}

.player-crop-btn {
  min-width: 3.5rem;
  height: 2.25rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--ws-gold);
  font-weight: 700;
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.18);
  position: relative;
  z-index: 4;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}

.player-crop-btn[disabled] {
  opacity: 0.45;
}

.player-title.large {
  font-size: 1.25rem;
  font-weight: 700;
  white-space: normal;
}

.player-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 130px;
  margin: 0;
  position: relative;
  cursor: pointer;
  /* touch-action:none is what lets the pointer handlers own the gesture on a
     phone — without it the browser cancels the pointer stream to scroll. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Long-press targets: suppress iOS text-selection callout (Copy/Search with Google)
   so the custom tune context menu can appear cleanly. Applied to the element and
   every descendant — iOS selects text on inner nodes even if the parent says no. */
.no-long-press-select,
.no-long-press-select *,
.context-menu,
.context-menu * {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

.player-waveform.scrubbing {
  cursor: ew-resize;
}

.player-waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
}

.expanded-controls {
  width: 100%;
}

.player-times.large {
  display: flex;
  justify-content: space-between;
  font-size: 0.9375rem;
  margin-bottom: 2rem;
  font-variant-numeric: tabular-nums;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
}

.skip-btn {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  color: var(--ws-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.skip-btn:hover {
  color: var(--ws-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.skip-btn.hidden {
  display: none;
}

.skip-label {
  position: absolute;
  bottom: 0.52rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.player-play-btn.large {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.5rem;
}

.player-play-btn.large .player-play-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.btn.large {
  padding: 1rem;
}

/* ── Recording Waveform ── */
.recording-wave {
  flex: 1;
  height: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}


/* Seek slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--ws-text-tertiary);
  outline: none;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ws-accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ws-accent);
  cursor: pointer;
  border: none;
}

/* ── Record Button & Recording UI ── */
.record-section.compact {
  padding: 0.75rem 0;
}

/* ── Archive storage meter ── */
.storage-usage-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  margin: 0.125rem 0 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: linear-gradient(110deg, rgba(94, 169, 240, 0.08), rgba(78, 205, 198, 0.05));
}
.storage-usage-gauge { position: relative; flex: 0 0 2.75rem; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; }
.storage-usage-gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.storage-usage-track, .storage-usage-ring { fill: none; stroke-width: 4; }
.storage-usage-track { stroke: rgba(141, 150, 180, 0.22); }
.storage-usage-ring { stroke: var(--ws-sky); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset 0.35s ease, stroke 0.2s ease; }
.storage-usage-gauge span { position: relative; font-size: 0.625rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.storage-usage-copy { min-width: 0; flex: 1; }
.storage-usage-title { font-size: 0.75rem; font-weight: 700; }
.storage-usage-detail { font-size: 0.6875rem; color: var(--ws-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.storage-usage-remaining { font-size: 0.6875rem; font-weight: 700; color: var(--ws-sky); white-space: nowrap; }
@media (max-width: 360px) { .storage-usage-card { padding: 0.5rem 0.625rem; } .storage-usage-remaining { display: none; } }

.record-row-inline {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.record-row-centered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.record-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.record-row-info .record-timer {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ws-sky);
}

.upload-drop-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1.75rem;
  border: 1.5px dashed var(--ws-text-tertiary);
  border-radius: 10px;
  color: var(--ws-text-tertiary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.upload-drop-box:hover {
  border-color: var(--ws-accent);
  color: var(--ws-accent);
  background: rgba(78, 205, 198, 0.04);
}

.upload-drop-box.drag-over {
  border-color: var(--ws-sky);
  color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.06);
  border-style: solid;
}

.drop-zone-inline {
  font-size: 0.8125rem;
  color: var(--ws-text-tertiary);
  cursor: pointer;
  transition: color 0.15s;
}

.drop-zone-inline:hover {
  color: var(--ws-accent);
}

.drop-zone-inline span {
  border-bottom: 1px dashed var(--ws-text-tertiary);
}

.drop-zone-inline:hover span {
  border-bottom-color: var(--ws-accent);
}

/* Keep old container for backwards compat but hide */
.record-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.record-btn {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--ws-crimson);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 3px solid rgba(255, 255, 255, 0.15);
  transition: transform 0.15s, background 0.15s;
}

.record-btn:active {
  transform: scale(0.93);
}

.record-btn.recording {
  background: var(--ws-sky);
  animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(94, 169, 240, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(94, 169, 240, 0); }
}

.record-timer {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ws-sky);
}

.record-label {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
}

/* ── Preview (post-recording) ── */
.preview-section {
  display: none;
  text-align: center;
  padding: 1rem 0;
}

.preview-section.active {
  display: block;
}

.preview-player {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  padding: 0.875rem;
  margin-bottom: 1rem;
}

.preview-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ── Upload Form ── */
.upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
  margin-bottom: 0.25rem;
}

.upload-progress {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--ws-surface);
  overflow: hidden;
  margin-top: 0.5rem;
}

.upload-progress .bar {
  height: 100%;
  background: var(--ws-gradient-accent);
  border-radius: 2px;
  transition: width 0.2s;
  width: 0%;
}

/* ── Members List ── */
.member-list {
  list-style: none;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
}

.member-item + .member-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.member-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ws-deep-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  flex-shrink: 0;
}

.member-details {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 600;
  font-size: 0.9375rem;
}

.member-instrument {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
}

.member-role {
  margin-left: auto;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-gold);
  font-weight: 600;
}

.member-remove-btn {
  margin-left: auto;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  background: rgba(240, 97, 107, 0.14);
  color: #ff8d98;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.member-remove-btn:hover {
  background: rgba(240, 97, 107, 0.22);
  color: #ffb2ba;
}

.member-remove-btn:disabled {
  opacity: 0.55;
}

/* ── Invite Code Display ── */
.invite-code-display {
  background: var(--ws-surface-elevated);
  border-radius: var(--ws-radius);
  padding: 1.25rem;
  text-align: center;
}

.invite-code-display .code {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--ws-gold);
  font-family: 'SF Mono', 'Fira Code', monospace;
  margin: 0.5rem 0;
}

.invite-code-display .hint {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
}

/* ── View Toggle ── */
.view-toggle-bar {
  display: flex;
  background: var(--ws-surface);
  border-radius: 10px;
  padding: 3px;
  margin: 0.75rem 0;
}

.view-toggle {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
  text-align: center;
  transition: all 0.2s;
}

.view-toggle.active {
  background: var(--ws-surface-elevated);
  color: var(--ws-text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ── Archive Views ── */
.archive-view {
  display: none;
}

.archive-view.active {
  display: block;
}

/* ── Add Tune Row (By Tune view) ── */
.tune-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.tune-add-row input {
  flex: 1;
  min-width: 0;
}

.tune-add-row .btn {
  flex-shrink: 0;
  padding: 0.5rem 0.875rem;
  font-size: 1.125rem;
  line-height: 1;
  font-weight: 700;
}

/* ── Reference playlist card ── */
.playlist-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  background:
    radial-gradient(120% 130% at 0% 0%, rgba(139, 107, 232, 0.5), transparent 58%),
    radial-gradient(110% 120% at 100% 15%, rgba(78, 205, 198, 0.28), transparent 60%),
    var(--ws-surface);
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 0.875rem;
  overflow: hidden;
}

.playlist-card.playing {
  border-color: rgba(255, 183, 77, 0.4);
}

.playlist-art {
  width: 4.125rem;
  height: 4.125rem;
  border-radius: 12px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #F0616B, #4ECDC6 42%, #FFB74D 70%, #8B6BE8);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.playlist-art-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.16rem;
  padding-bottom: 0.8rem;
}

.playlist-art-glyph i {
  width: 0.22rem;
  border-radius: 2px;
  background: rgba(8, 11, 24, 0.65);
  display: block;
}

.playlist-art-glyph i:nth-child(1) { height: 1rem; }
.playlist-art-glyph i:nth-child(2) { height: 1.75rem; }
.playlist-art-glyph i:nth-child(3) { height: 1.3rem; }
.playlist-art-glyph i:nth-child(4) { height: 2.1rem; }
.playlist-art-glyph i:nth-child(5) { height: 1.2rem; }

.playlist-copy {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: block;
  -webkit-tap-highlight-color: transparent;
}

.playlist-kicker {
  display: block;
  font-size: 0.65625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ws-gold);
  font-weight: 600;
}

.playlist-title {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 0.0625rem;
}

.playlist-meta {
  display: block;
  font-size: 0.78125rem;
  color: var(--ws-text-secondary);
  margin-top: 0.1875rem;
  /* One line: wrapping here shoves the play button off the card's centre. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-nowline {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--ws-gold);
  margin-top: 0.3125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-eq,
.queue-eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 0.75rem;
  flex-shrink: 0;
}

.playlist-eq i,
.queue-eq i {
  width: 2.5px;
  border-radius: 1px;
  background: var(--ws-gold);
  display: block;
  height: 0.3rem;
}

.playlist-card.playing .playlist-eq i,
.player-queue-row.current .queue-eq i {
  animation: ws-eq 0.9s ease-in-out infinite;
}

.playlist-eq i:nth-child(2),
.queue-eq i:nth-child(2) { animation-delay: 0.15s; }
.playlist-eq i:nth-child(3),
.queue-eq i:nth-child(3) { animation-delay: 0.3s; }

@keyframes ws-eq {
  0%, 100% { height: 0.25rem; }
  50% { height: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .playlist-eq i,
  .queue-eq i { animation: none !important; height: 0.45rem; }
}

.playlist-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.playlist-shuffle {
  width: 2.125rem;
  height: 2.125rem;
  border-radius: 50%;
  border: 1px solid var(--ws-border, #242C48);
  background: none;
  color: var(--ws-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.playlist-shuffle[aria-pressed="true"] {
  border-color: var(--ws-sky);
  color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.1);
}

.playlist-play {
  width: 2.875rem;
  height: 2.875rem;
  border-radius: 50%;
  border: none;
  background: var(--ws-gradient-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(78, 205, 198, 0.4);
  -webkit-tap-highlight-color: transparent;
}

.playlist-play:active {
  transform: scale(0.96);
}

.playlist-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  opacity: 0;
}

.playlist-card.playing .playlist-progress {
  opacity: 1;
}

.playlist-progress i {
  display: block;
  height: 2px;
  width: 0;
  background: var(--ws-gradient-accent);
}

@media (max-width: 420px) {
  .playlist-card { gap: 0.6875rem; padding: 0.875rem; }
  .playlist-art { width: 3.25rem; height: 3.25rem; }
  .playlist-title { font-size: 1rem; }
  .playlist-play { width: 2.5rem; height: 2.5rem; }
  .playlist-shuffle { width: 1.875rem; height: 1.875rem; }
}

/* ── Queue indicator in expanded player ── */
.player-queue-indicator {
  font-size: 0.75rem;
  color: var(--ws-sky);
  margin-top: 0.1875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── Prev / Next track buttons ── */
.track-btn {
  padding: 0 0.5rem;
  color: var(--ws-text-primary);
}

.track-btn.hidden {
  display: none;
}

.track-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Status Select in Tune Card ── */
.tune-card-status-select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.14rem 0.15rem;
  font-size: 0.6875rem;
  font-weight: 700;
  cursor: pointer;
  width: auto;
  max-width: 100%;
  flex-shrink: 0;
  text-align: center;
  text-align-last: center;
  background-image: none;
}

.tune-card-status-select.status-on-deck {
  background-color: rgba(141, 150, 180, 0.12);
  border-color: rgba(141, 150, 180, 0.2);
  color: #c5cae3;
}

.tune-card-status-select.status-exploring {
  background-color: rgba(224, 71, 135, 0.12);
  border-color: rgba(224, 71, 135, 0.22);
  color: #ff98bc;
}

.tune-card-status-select.status-rehearsing {
  background-color: rgba(78, 205, 198, 0.12);
  border-color: rgba(78, 205, 198, 0.22);
  color: #ffb08f;
}

.tune-card-status-select.status-locked-in {
  background-color: rgba(94, 169, 240, 0.12);
  border-color: rgba(94, 169, 240, 0.24);
  color: #91ece7;
}

/* ── Tune Card (By Tune view) ── */
.tune-card {
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  margin-bottom: 0.5rem;
  overflow: hidden;
  transition: background 0.15s;
}

.tune-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  user-select: none;
}

.tune-card-header:active {
  background: var(--ws-surface-elevated);
}

.tune-card-info {
  flex: 1;
  min-width: 0;
}

.tune-card-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.tune-card-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.9375rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tune-card-status-slot {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  margin-left: auto;
  flex-shrink: 0;
}

.tune-card-status-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}


.tune-card-meta {
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.tune-card-count {
  background: var(--ws-surface-elevated);
  color: var(--ws-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  flex-shrink: 0;
  align-self: center;
}

.tune-card-chevron {
  color: var(--ws-text-tertiary);
  font-size: 0.875rem;
  line-height: 1;
  transition: transform 0.2s;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.18rem;
}

.tune-card.expanded .tune-card-chevron {
  transform: rotate(90deg);
}

.tune-card-recordings {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tune-card.expanded .tune-card-recordings {
  max-height: 2000px;
}

.tune-card-recordings .recording-item {
  padding-left: 1.25rem;
}

.tune-card-recordings .recording-item:last-child {
  margin-bottom: 0.5rem;
}

/* ── Timeline (date groups) ── */
.timeline-date-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-text-tertiary);
  padding: 1rem 0 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.timeline-date-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

/* ── Recording Row (shared between views) ── */
.recording-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.5rem;
  border-radius: 10px;
  transition: background 0.15s;
}

.recording-item:hover {
  background: var(--ws-surface-elevated);
}

.recording-item .play-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--ws-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.recording-item .play-btn.playing {
  background: var(--ws-sky);
}

.recording-item .rec-info {
  flex: 1;
  min-width: 0;
}

.recording-item .rec-title {
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recording-item .rec-meta {
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.recording-item .rec-duration {
  color: var(--ws-text-tertiary);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.recording-item .rec-actions {
  display: flex;
  gap: 0.125rem;
  flex-shrink: 0;
}

.rec-action-btn {
  color: var(--ws-text-tertiary);
  padding: 0.375rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.rec-action-btn:hover {
  color: var(--ws-text-primary);
  background: var(--ws-surface);
}

.rec-action-btn.rec-reference.active {
  color: var(--ws-gold);
}

.rec-title-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.rec-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.rec-inline-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rec-inline-pill.reference {
  background: rgba(255, 183, 77, 0.14);
  color: var(--ws-gold);
}

/* Mobile: take rows are too cramped for the title plus badges. The gold star
   already signals the reference take, and "Trimmed" isn't worth the space. */
@media (max-width: 767px) {
  .rec-inline-pill.reference,
  .rec-inline-pill.trimmed {
    display: none;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-pill.compact {
  padding: 0.14rem 0.45rem;
  font-size: 0.6875rem;
}

.status-pill strong {
  font-size: 0.8125rem;
}

.status-on-deck {
  background: rgba(141, 150, 180, 0.12);
  border-color: rgba(141, 150, 180, 0.2);
  color: #c5cae3;
}

.status-exploring {
  background: rgba(224, 71, 135, 0.12);
  border-color: rgba(224, 71, 135, 0.22);
  color: #ff98bc;
}

.status-rehearsing {
  background: rgba(78, 205, 198, 0.12);
  border-color: rgba(78, 205, 198, 0.22);
  color: #ffb08f;
}

.status-locked-in {
  background: rgba(94, 169, 240, 0.12);
  border-color: rgba(94, 169, 240, 0.24);
  color: #91ece7;
}

.tune-card-note {
  color: var(--ws-gold);
}

/* ── Repertoire Views ── */
.repertoire-main,
.tune-detail-main {
  padding-top: 1rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

.repertoire-add-card {
  margin-bottom: 0.875rem;
}

.repertoire-add-row {
  display: flex;
  gap: 0.625rem;
  align-items: center;
}

.repertoire-add-row .btn {
  flex-shrink: 0;
}

.repertoire-status-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.repertoire-status-summary .status-pill {
  justify-content: space-between;
  width: 100%;
}

.filter-chip {
  cursor: pointer;
  transition: transform 0.12s, opacity 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.filter-chip:hover {
  transform: translateY(-1px);
}

.filter-chip.active {
  box-shadow: 0 0 0 1px currentColor, 0 10px 24px rgba(0, 0, 0, 0.18);
}

.filter-chip.inactive {
  opacity: 0.55;
}

.repertoire-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--ws-surface);
  border-radius: 12px;
}

.filter-pill-copy {
  font-size: 0.875rem;
  color: var(--ws-text-secondary);
}

.filter-pill-copy strong {
  color: var(--ws-text-primary);
}

.filter-reset-btn {
  flex-shrink: 0;
}

.repertoire-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.repertoire-status-section {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.repertoire-status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.repertoire-status-description {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  max-width: 28rem;
}

.repertoire-status-count {
  min-width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: var(--ws-surface);
  color: var(--ws-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
}

.repertoire-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filtered-empty-state {
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  padding: 1rem;
  text-align: center;
}

.filtered-empty-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--ws-text-primary);
}

.filtered-empty-copy {
  margin-top: 0.25rem;
  margin-bottom: 0.85rem;
  font-size: 0.875rem;
  color: var(--ws-text-secondary);
}

.repertoire-tune-card {
  background: var(--ws-surface);
  border-radius: var(--ws-radius);
  padding: 0.85rem 0.9rem;
}

.repertoire-tune-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.repertoire-tune-main {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.repertoire-tune-title {
  font-size: 0.975rem;
  font-weight: 700;
  color: var(--ws-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repertoire-tune-subtitle {
  margin-top: 0.15rem;
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.repertoire-tune-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.repertoire-status-select {
  width: auto;
  min-width: 8.25rem;
  background: var(--ws-surface-elevated);
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.08);
  padding: 0.5rem 2rem 0.5rem 0.8rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.repertoire-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--ws-text-secondary);
  padding: 0.45rem 0.2rem 0.45rem 0.35rem;
  font-weight: 700;
}

.repertoire-open-chevron {
  font-size: 1rem;
  color: var(--ws-text-tertiary);
}

/* ── Tune Detail ── */
.tune-detail-hero {
  margin-bottom: 0.875rem;
}

.tune-detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.tune-detail-name {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
}

.tune-detail-meta {
  margin-top: 0.3rem;
  font-size: 0.875rem;
  color: var(--ws-text-secondary);
}

.tune-detail-action-row {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.status-button-grid {
  display: grid;
  gap: 0.6rem;
}

.status-toggle-btn {
  text-align: left;
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
  background: var(--ws-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.15s, transform 0.1s, background 0.15s;
}

.status-toggle-btn.active {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
}

.status-toggle-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 0.18rem;
}

.status-toggle-copy {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ws-text-secondary);
}

.reference-take-card {
  background: var(--ws-surface-elevated);
  border-radius: 12px;
  padding: 0.95rem;
}

.reference-take-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ws-gold);
  font-weight: 800;
}

.reference-take-title {
  margin-top: 0.35rem;
  font-size: 1rem;
  font-weight: 700;
}

.reference-take-meta {
  margin-top: 0.2rem;
  color: var(--ws-text-secondary);
  font-size: 0.8125rem;
}

.reference-take-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.reference-empty-state {
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
  line-height: 1.45;
  padding: 0.1rem 0;
}

/* ── Drag over state for archive ── */
.main-content.drag-over {
  outline: 2px dashed var(--ws-sky);
  outline-offset: -2px;
  border-radius: var(--ws-radius);
}

/* ── Modal / Dialog ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: var(--ws-surface);
  border-radius: var(--ws-radius) var(--ws-radius) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 80dvh;
  overflow-y: auto;
  padding: 1.25rem;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.trim-modal {
  background:
    radial-gradient(circle at top, rgba(255, 183, 77, 0.12), transparent 52%),
    var(--ws-background);
  max-width: 680px;
  max-height: 100dvh;
  min-height: 100dvh;
  border-radius: 0;
  padding: 1rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.trim-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.trim-modal-title-wrap {
  min-width: 0;
  text-align: center;
  flex: 1;
}

.trim-modal-kicker {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ws-text-tertiary);
}

.trim-modal-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--ws-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trim-modal-header-btn {
  min-width: 4.5rem;
  min-height: 2.5rem;
  color: var(--ws-text-secondary);
}

.trim-modal-header-btn-primary {
  color: var(--ws-gold);
  font-weight: 700;
}

.trim-modal-copy {
  font-size: 0.875rem;
  color: var(--ws-text-secondary);
  text-align: center;
}

.trim-waveform-shell {
  flex: 1;
  display: flex;
  align-items: center;
}

.trim-waveform {
  position: relative;
  width: 100%;
  height: clamp(220px, 40vh, 360px);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(8, 11, 24, 0.82)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  touch-action: none;
}

.trim-waveform-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.trim-transport-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
}

.trim-play-btn {
  width: 3.25rem;
  height: 3.25rem;
}

.trim-reset-btn {
  min-width: 5rem;
}

.trim-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.trim-stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.8rem 0.7rem;
  text-align: center;
}

.trim-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  margin-bottom: 0.25rem;
}

.trim-stat-value {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.trim-status-copy {
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  text-align: center;
}

/* ── Upgrade button on storage card ── */
.storage-upgrade-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid rgba(255, 183, 77, 0.55);
  color: var(--ws-gold);
  background: none;
  flex-shrink: 0;
}

.storage-upgrade-btn:hover {
  border-color: var(--ws-gold);
}

.storage-upgrade-btn.quiet {
  border-color: rgba(94, 169, 240, 0.4);
  color: var(--ws-sky);
}

.storage-upgrade-btn.quiet:hover {
  border-color: var(--ws-sky);
}

.storage-upgrade-btn.full {
  background: var(--ws-gold);
  border-color: var(--ws-gold);
  color: #3d2a05;
}

.storage-pro-badge {
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ws-gold);
  border: 1px solid rgba(255, 183, 77, 0.55);
}

/* ── Low space warning ── */
.low-space-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin: 0.625rem 0 0;
  padding: 0.5rem 0.875rem;
  border-radius: 8px;
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.25);
  color: var(--ws-gold);
  font-size: 0.8125rem;
}

.low-space-link {
  background: none;
  border: none;
  color: var(--ws-gold);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* ── Recording quality toggle ── */
.quality-toggle {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 0.625rem;
}

.quality-option {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.875rem;
  border-radius: 999px;
  border: 1px solid rgba(141, 150, 180, 0.3);
  background: none;
  color: var(--ws-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.quality-option.active {
  color: var(--ws-sky);
  border-color: rgba(94, 169, 240, 0.5);
}

.quality-option.locked {
  opacity: 0.75;
}

.pro-tag {
  font-size: 0.625rem;
  font-weight: 800;
  color: var(--ws-gold);
  letter-spacing: 0.04em;
}

/* ── Upgrade modal ── */
.upgrade-modal {
  max-width: 24rem;
  position: relative;
}

.upgrade-close {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  font-size: 1.25rem;
  line-height: 1;
}

.upgrade-hero {
  text-align: center;
  margin: 0.25rem 0 1.25rem;
}

.upgrade-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ws-text-primary);
}

.upgrade-title span {
  background: linear-gradient(to right, var(--ws-accent), var(--ws-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.upgrade-context {
  margin-top: 0.25rem;
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
}

.upgrade-space-visual {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.125rem;
}

.upgrade-space-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.upgrade-space-label {
  width: 2.25rem;
  color: var(--ws-text-secondary);
}

.upgrade-space-label.pro { color: var(--ws-gold); }

.upgrade-space-bar {
  flex: 1;
  height: 0.5rem;
  border-radius: 999px;
  background: rgba(141, 150, 180, 0.15);
  overflow: hidden;
}

.upgrade-space-fill {
  height: 100%;
  border-radius: 999px;
}

.upgrade-space-fill.free {
  width: 10%;
  background: var(--ws-text-secondary);
}

.upgrade-space-fill.pro {
  width: 100%;
  background: linear-gradient(to right, var(--ws-accent), var(--ws-gold));
}

.upgrade-space-amount {
  width: 3rem;
  text-align: right;
  color: var(--ws-text-secondary);
  font-variant-numeric: tabular-nums;
}

.upgrade-space-amount.pro { color: var(--ws-gold); }

.upgrade-perks {
  list-style: none;
  margin: 0 0 1.125rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upgrade-perks li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.upgrade-perk-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(255, 183, 77, 0.12);
  color: var(--ws-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.upgrade-perks strong {
  display: block;
  font-size: 0.875rem;
  color: var(--ws-text-primary);
}

.upgrade-perks li div span {
  display: block;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  margin-top: 0.125rem;
}

.upgrade-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  justify-content: center;
  margin-bottom: 0.875rem;
  flex-wrap: wrap;
}

.upgrade-price {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ws-text-primary);
}

.upgrade-price span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
}

.upgrade-price-note {
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
}

.upgrade-cta {
  width: 100%;
  background: linear-gradient(to right, var(--ws-accent), var(--ws-gold));
  color: #2a1a02;
  font-weight: 800;
  border: none;
}

.upgrade-fine-print {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  white-space: nowrap;
}

.group-pending-pro,
.group-pro-label {
  color: var(--ws-gold);
  font-weight: 700;
}

/* ── Rescue modal ── */
.rescue-message {
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
  margin: 0 0 0.75rem;
}

.rescue-reassure {
  font-size: 0.8125rem;
  color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.08);
  border: 1px solid rgba(94, 169, 240, 0.25);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.rescue-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Band book ── */
.book-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.book-header-hint {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  min-width: 0;
}

.book-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 169, 240, 0.45);
  color: var(--ws-sky);
  font-size: 0.8125rem;
  font-weight: 700;
  background: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.book-share-btn:hover { border-color: var(--ws-sky); }

.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.book-item {
  background: var(--ws-surface);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.75rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
}

.book-item-main { flex: 1; min-width: 0; }

.book-item-name {
  font-weight: 700;
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3125rem;
  margin-top: 0.3125rem;
}

.book-chip {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  color: var(--ws-text-secondary);
  border: 1px solid rgba(141, 150, 180, 0.3);
  white-space: nowrap;
}

.book-chip.key { color: var(--ws-gold); border-color: rgba(255, 183, 77, 0.35); }
.book-chip.part { color: var(--ws-sky); border-color: rgba(94, 169, 240, 0.35); }
.book-chip.ref { color: var(--ws-accent); border-color: rgba(78, 205, 198, 0.35); }
.book-chip.empty { border-style: dashed; }

/* Book-modal placeholders should read as hints, not saved values */
.book-field input::placeholder,
.book-notes::placeholder,
.book-chart-name-field input::placeholder {
  color: rgba(141, 150, 180, 0.45);
  font-style: italic;
  font-weight: 400;
}

.book-item-arrow { color: var(--ws-text-tertiary); font-size: 1.125rem; flex-shrink: 0; }

/* Book tune sheet */
.book-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.book-field span {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-text-secondary);
  margin-bottom: 0.25rem;
}

.book-field input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(141, 150, 180, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ws-text-primary);
  font-size: 0.875rem;
}

.book-meta-chips { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }

.book-section { margin-bottom: 1.125rem; }

.book-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ws-text-secondary);
  margin-bottom: 0.375rem;
}

.book-notes {
  width: 100%;
  padding: 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(141, 150, 180, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ws-text-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  resize: vertical;
}

.book-notes-view {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ws-text-primary);
  white-space: pre-wrap;
  margin: 0;
}

.book-charts-list {
  list-style: none;
  margin: 0 0 0.625rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.book-chart-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.book-chart-part {
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--ws-sky);
  border: 1px solid rgba(94, 169, 240, 0.4);
  border-radius: 6px;
  padding: 0.1875rem 0.375rem;
  flex-shrink: 0;
}

.book-chart-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ws-text-primary);
}

.book-chart-delete {
  background: none;
  border: none;
  color: var(--ws-text-tertiary);
  font-size: 1rem;
  padding: 0.25rem 0.375rem;
  cursor: pointer;
  flex-shrink: 0;
}

.book-chart-delete:hover { color: var(--ws-crimson); }

.book-chart-rename {
  background: none;
  border: none;
  color: var(--ws-text-tertiary);
  font-size: 0.875rem;
  padding: 0.25rem 0.375rem;
  cursor: pointer;
  flex-shrink: 0;
}

.book-chart-rename:hover { color: var(--ws-sky); }

.book-chart-name-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.book-chart-name-field span {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ws-text-tertiary);
  flex-shrink: 0;
}

.book-chart-name-field input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(141, 150, 180, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ws-text-primary);
  font-size: 0.8125rem;
}

.book-chart-add-btn { font-size: 0.8125rem; padding: 0.5rem 1rem; cursor: pointer; }

.book-part-picker {
  margin-top: 0.5rem;
  padding: 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(94, 169, 240, 0.3);
  background: rgba(94, 169, 240, 0.05);
}

.book-part-picker > span {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ws-sky);
  margin-bottom: 0.5rem;
}

.book-part-options { display: flex; flex-wrap: wrap; gap: 0.375rem; }

.book-part-options button {
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 169, 240, 0.4);
  background: none;
  color: var(--ws-sky);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
}

.book-part-options button:hover { background: rgba(94, 169, 240, 0.12); }

.book-reference-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(78, 205, 198, 0.3);
  background: rgba(78, 205, 198, 0.05);
  cursor: pointer;
  color: var(--ws-text-primary);
}

.book-ref-play-icon { color: var(--ws-accent); font-size: 0.875rem; flex-shrink: 0; display: inline-flex; align-items: center; }

.book-ref-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-ref-duration { font-size: 0.75rem; color: var(--ws-text-secondary); flex-shrink: 0; }

/* Chart viewer */
.chart-viewer-overlay { align-items: stretch; }

.chart-viewer {
  background: var(--ws-bg);
  width: 100%;
  display: flex;
  flex-direction: column;
}

.chart-viewer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  padding-top: max(0.625rem, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--ws-surface);
}

.chart-viewer-header span {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-viewer-link { color: var(--ws-sky); font-size: 0.8125rem; font-weight: 700; text-decoration: none; flex-shrink: 0; }

.chart-viewer-body { flex: 1; overflow: auto; background: #fff; }

.chart-viewer-body img { width: 100%; height: auto; display: block; }

.chart-viewer-body iframe { width: 100%; height: 100%; border: none; }

/* Share modal */
.book-share-link-row { display: flex; gap: 0.5rem; }

.book-share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 0.625rem;
  border-radius: 8px;
  border: 1px solid rgba(141, 150, 180, 0.25);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ws-text-secondary);
  font-size: 0.75rem;
}

.book-share-durations {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.book-share-durations .btn { flex: 1; }

.book-share-expiry {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
}

.book-share-note {
  margin-top: 0.875rem;
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
}

/* Guest book view */
.guest-book-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ws-gold);
  border: 1px solid rgba(255, 183, 77, 0.5);
  border-radius: 999px;
  padding: 0.25rem 0.625rem;
}

.guest-book-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  margin: 1.5rem 0 1rem;
}

.guest-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(94, 169, 240, 0.35);
  border-radius: 12px;
  background: rgba(94, 169, 240, 0.06);
}

.guest-cta-text {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  line-height: 1.4;
  flex: 1;
  min-width: 12rem;
}

.guest-cta-text strong { color: var(--ws-text-primary); display: block; }

.guest-cta-btn {
  flex-shrink: 0;
  font-size: 0.8125rem;
  padding: 0.5rem 0.875rem;
  text-decoration: none;
  text-align: center;
}

@media (max-width: 480px) {
  .guest-cta { justify-content: center; text-align: center; }
  .guest-cta-btn { flex-basis: 100%; }
}

/* ── Mobile compaction: header, storage card, upgrade modal ── */
@media (max-width: 480px) {
  .app-header { padding: 0.625rem 0.75rem; }
  .app-header .header-actions { gap: 0.375rem; }
  .header-chip { padding: 0.25rem 0.5rem; font-size: 0.75rem; gap: 0.25rem; }
  .header-chip svg { width: 15px; height: 15px; }
  .header-avatar { width: 1.75rem; height: 1.75rem; font-size: 0.625rem; }
  #archive-group-name { font-size: 0.9375rem !important; }

  .storage-usage-card { gap: 0.5rem; }
  .storage-usage-detail { font-size: 0.75rem; }
  .storage-upgrade-btn { padding: 0.3125rem 0.625rem; font-size: 0.75rem; }
  .storage-usage-copy { flex-shrink: 1; }

  .quality-option { font-size: 0.6875rem; padding: 0.25rem 0.75rem; }

  .upgrade-modal { padding: 1rem; }
  .upgrade-hero { margin: 0.125rem 0 1rem; }
  .upgrade-title { font-size: 1.25rem; }
  .upgrade-context { font-size: 0.8125rem; }
  .upgrade-space-visual { gap: 0.5rem; margin-bottom: 1rem; }
  .upgrade-perks { gap: 0.625rem; margin-bottom: 1rem; }
  .upgrade-perk-icon { width: 1.5rem; height: 1.5rem; font-size: 0.75rem; }
  .upgrade-perks strong { font-size: 0.8125rem; }
  .upgrade-perks li div span { font-size: 0.6875rem; margin-top: 0; }
  .upgrade-price { font-size: 1.5rem; }
  .upgrade-price-row { margin-bottom: 0.625rem; gap: 0.5rem; }
  .upgrade-fine-print { font-size: 0.75rem; }
}

/* ── Spinner / Loading ── */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--ws-text-tertiary);
  border-top-color: var(--ws-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.archive-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 2.5rem 1rem;
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
}

.archive-loading-spinner {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--ws-text-tertiary);
  border-top-color: var(--ws-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--ws-text-secondary);
  font-size: 0.875rem;
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--ws-surface-elevated);
  color: var(--ws-text-primary);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
  animation: toast-in 0.25s ease-out;
}

.toast.error {
  border-left: 3px solid var(--ws-crimson);
}

.toast.success {
  border-left: 3px solid var(--ws-sky);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Inline Title Input (on preview card) ── */
.inline-title-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ws-text-tertiary);
  border-radius: 0;
  padding: 0.125rem 0;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--ws-text-primary);
  width: 100%;
}

.inline-title-input:focus {
  outline: none;
  border-bottom-color: var(--ws-accent);
  box-shadow: none;
}

.inline-title-input::placeholder {
  color: var(--ws-text-tertiary);
  font-weight: 400;
}

/* ── Preview Form Actions ── */
.preview-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.trim-summary-note {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.18);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
}

/* ── Repertoire List ── */
.repertoire-list {
  list-style: none;
}

.repertoire-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.repertoire-item .tune-name {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
}

.repertoire-item .tune-name-edit {
  flex: 1;
  font-size: 0.9375rem;
  background: var(--ws-surface-elevated);
  border: 1px solid var(--ws-accent);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  color: var(--ws-text-primary);
}

.repertoire-item .tune-actions {
  display: flex;
  gap: 0.25rem;
}

.repertoire-item .tune-actions button {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--ws-text-secondary);
}

.repertoire-item .tune-actions button:hover {
  color: var(--ws-text-primary);
  background: var(--ws-surface-elevated);
}

/* ── Drop Zone ── */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--ws-text-tertiary);
  border-radius: var(--ws-radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  width: 100%;
  max-width: 280px;
  color: var(--ws-text-secondary);
}

.drop-zone:hover {
  border-color: var(--ws-accent);
  background: rgba(78, 205, 198, 0.04);
}

.drop-zone.drag-over {
  border-color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.08);
  border-style: solid;
}

.drop-zone-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.drop-zone-hint {
  font-size: 0.6875rem;
  color: var(--ws-text-tertiary);
}

/* ── Upload Divider ── */
.upload-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ws-text-tertiary);
  font-size: 0.8125rem;
  margin: 0.75rem 0;
  width: 60%;
}

.upload-divider::before,
.upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ws-text-tertiary);
  opacity: 0.3;
}

/* ── Group Icon Picker ── */
.group-icon-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
}

.group-icon-preview {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--ws-surface-elevated);
  border: 2px dashed var(--ws-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  overflow: hidden;
  transition: border-color 0.15s;
}

.group-icon-picker:hover .group-icon-preview {
  border-color: var(--ws-accent);
}

.group-icon-preview.has-image {
  border-style: solid;
  border-color: var(--ws-accent);
}

.group-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-icon-picker-hint {
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  font-weight: 500;
}

.group-icon-picker:hover .group-icon-picker-hint {
  color: var(--ws-accent);
}

.archive-header-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  background: var(--ws-gradient-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-right: 0.375rem;
  overflow: hidden;
}

.archive-header-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* ── Members Modal Icon Section ── */
.members-icon-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.members-icon-preview {
  width: 5rem;
  height: 5rem;
  border-radius: 16px;
  background: var(--ws-gradient-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}

.members-icon-preview.has-image {
  border-color: var(--ws-accent);
}

.members-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.members-icon-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ws-accent);
  cursor: pointer;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  transition: background 0.15s;
}

.members-icon-edit-btn:hover {
  background: rgba(78, 205, 198, 0.08);
}

.group-item .group-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* ── Utility ── */
.text-secondary { color: var(--ws-text-secondary); }
.text-tertiary { color: var(--ws-text-tertiary); }
.text-accent { color: var(--ws-accent); }
.text-teal { color: var(--ws-sky); }
.text-gold { color: var(--ws-gold); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-row { display: flex; gap: 0.75rem; }
.hidden { display: none !important; }

/* ── Responsive: larger screens ── */
@media (min-width: 768px) {
  .main-content {
    padding: 1.5rem;
  }

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

  .modal-overlay {
    align-items: center;
  }

  .modal {
    border-radius: var(--ws-radius);
    max-width: 440px;
  }

  .trim-modal {
    border-radius: 24px 24px 0 0;
    min-height: min(900px, 92dvh);
    max-height: 92dvh;
  }
}

@media (max-width: 520px) {
  .preview-form-actions,
  .repertoire-add-row,
  .repertoire-tune-row,
  .reference-take-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .repertoire-tune-controls {
    width: 100%;
    justify-content: space-between;
  }

  .repertoire-status-select,
  .repertoire-open-btn,
  .repertoire-add-row .btn {
    width: 100%;
  }

  .repertoire-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-reset-btn {
    width: 100%;
  }

  .repertoire-open-btn {
    justify-content: center;
    background: var(--ws-surface-elevated);
    border-radius: 10px;
  }

  .tune-detail-title-row {
    flex-direction: column;
  }

  .trim-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Tune context menu ── */
.context-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: transparent;
}

.context-menu {
  position: absolute;
  min-width: 240px;
  max-width: 320px;
  background: var(--ws-surface-raised, #1d2033);
  color: var(--ws-text, #f4f4f8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: context-menu-in 120ms ease-out;
}

@keyframes context-menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.context-menu-header {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 8px 10px 4px;
  /* Header text lives in a ::before pseudo-element so iOS cannot
     select it during the long-press gesture. */
  pointer-events: none;
}

.context-menu-header::before {
  content: attr(data-title);
  display: block;
  text-transform: uppercase;
  color: rgba(244, 244, 248, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-menu-item {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: inherit;
  transition: background 120ms ease;
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  background: rgba(255, 255, 255, 0.07);
}

.context-menu-item:active {
  background: rgba(255, 255, 255, 0.12);
}

.context-menu-danger {
  color: var(--ws-crimson, #F0616B);
}

.context-menu-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(244, 244, 248, 0.7);
}

.context-menu-check {
  color: var(--ws-accent, #4ECDC6);
  font-weight: 600;
}

.context-menu-chevron {
  display: inline-block;
  margin-right: 4px;
  opacity: 0.7;
}

.context-menu-back {
  font-size: 0.85rem;
  color: rgba(244, 244, 248, 0.7);
}

.context-menu-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 2px;
}

/* ════════════════════════════════════════════
   Home — greeting, sections
   ════════════════════════════════════════════ */

.home-greeting {
  margin: 0.25rem 0 1rem;
}

.home-greeting-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-greeting-date {
  font-size: 0.8125rem;
  color: var(--ws-text-tertiary);
  margin-top: 0.125rem;
}

/* ── Home sections ── */

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}

.home-card-title {
  margin-bottom: 0;
}

.home-section {
  margin-bottom: 1.25rem;
}

/* ── Studios ── */

.studio-list {
  list-style: none;
}

.studio-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--ws-surface);
  border: 1px solid rgba(139, 107, 232, 0.5);
  border-radius: var(--ws-radius);
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.studio-item:hover {
  border-color: rgba(139, 107, 232, 0.9);
}

.studio-avatar {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 50%;
  background: rgba(139, 107, 232, 0.25);
  color: #C9A5E8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  flex-shrink: 0;
}

.studio-info {
  flex: 1;
  min-width: 0;
}

.studio-name {
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.studio-meta {
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-meta.has-new {
  color: var(--ws-gold);
}

.studio-new-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ws-accent);
  flex-shrink: 0;
}

.studio-empty {
  font-size: 0.8125rem;
  color: var(--ws-text-tertiary);
  background: var(--ws-surface);
  border: 1px dashed rgba(139, 107, 232, 0.45);
  border-radius: var(--ws-radius);
  padding: 0.875rem 1rem;
}

.studio-create-note {
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  margin-top: 0.625rem;
  text-align: center;
}

/* ── Studio comments in expanded player ── */

/* The transport and the take metadata own the player column; the thread lives in
   its own surface (sheet on phones, rail on wide screens) so nothing above it can
   squeeze it flat. flex-shrink:0 keeps that promise inside either surface. */
.player-comments {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* overflow-y makes this a scroll container, whose automatic minimum size is 0 —
   as a flex child it would collapse to nothing and swallow every comment.
   A floor on min-height keeps at least one comment on screen. */
.comment-list {
  list-style: none;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 2.75rem;
  -webkit-overflow-scrolling: touch;
}

/* Nothing posted yet: give the floor back to the empty-state line. */
.comment-list:empty {
  min-height: 0;
  flex: 0 0 auto;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.45rem 0;
}

.comment-time {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ws-gold);
  background: rgba(255, 183, 77, 0.12);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 0.1rem;
}

.comment-time:hover {
  background: rgba(255, 183, 77, 0.25);
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-author {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ws-text-secondary);
  margin-right: 0.4rem;
}

.comment-text {
  display: inline;
  font-size: 0.875rem;
  color: var(--ws-text-primary);
  word-break: break-word;
}

.comment-delete {
  flex-shrink: 0;
  color: var(--ws-text-tertiary);
  font-size: 1rem;
  padding: 0 0.25rem;
  line-height: 1.2;
}

.comment-empty {
  font-size: 0.8125rem;
  color: var(--ws-text-tertiary);
  padding: 0.25rem 0 0.5rem;
  flex-shrink: 0;
}

.comment-compose {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.comment-compose input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

.comment-time-chip {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  background: var(--ws-surface-elevated);
  color: var(--ws-text-tertiary);
  border: 1px solid transparent;
  text-decoration: line-through;
}

.comment-time-chip.active {
  background: rgba(255, 183, 77, 0.12);
  border-color: rgba(255, 183, 77, 0.5);
  color: var(--ws-gold);
  text-decoration: none;
}

.comment-send {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem;
}

/* ── The player column and the docked comments bar ── */

/* Everything that used to be the expanded player now lives in the stage, so the
   dock can sit under it and stay put while the stage scrolls. */
.player-stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.player-bar.expanded .player-stage {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.comment-dock {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  flex: 0 0 auto;
  margin-top: 0.875rem;
  padding: 0.6rem 0.7rem;
  border-radius: 13px;
  background: var(--ws-surface-elevated);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 -6px 20px rgba(0, 0, 0, 0.28);
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.comment-dock:hover {
  background: #241F44;
}

.comment-dock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ws-sky);
}

.comment-dock-stamp {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ws-gold);
  background: rgba(255, 183, 77, 0.13);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}

.comment-dock-latest {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--ws-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* No comments yet: the row reads as the invitation to write one. */
.comment-dock.empty .comment-dock-latest {
  color: var(--ws-text-tertiary);
}

.comment-dock.empty .comment-dock-badge {
  color: var(--ws-text-secondary);
}

.comment-dock-latest b {
  font-weight: 600;
  color: var(--ws-text-secondary);
  margin-right: 0.3rem;
}

.comment-dock-caret {
  flex-shrink: 0;
  color: var(--ws-text-secondary);
}

/* ── Comments sheet (phones) ── */

.comments-scrim {
  position: fixed;
  inset: 0;
  z-index: 205;
  background: rgba(5, 4, 14, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.comments-scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.player-comments-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 206;
  max-height: min(72dvh, 34rem);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 1rem calc(env(safe-area-inset-bottom) + 0.85rem);
  background: var(--ws-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(101%);
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1), visibility 0.28s;
}

.player-comments-sheet.open {
  transform: none;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .player-comments-sheet,
  .comments-scrim {
    transition: none;
  }
}

.comments-sheet-grabber {
  width: 2.25rem;
  height: 0.25rem;
  border-radius: 2px;
  background: var(--ws-text-tertiary);
  align-self: center;
  flex-shrink: 0;
}

.comments-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.comments-sheet-title {
  font-size: 1rem;
  font-weight: 700;
}

.comments-sheet-count {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ws-sky);
  margin-left: 0.2rem;
}

.comments-sheet-close {
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 0.35rem;
  flex-shrink: 0;
}

/* ── Comments rail (wide screens) ──
   Same node as the sheet: it stops being an overlay and becomes the second
   column of the expanded player, so a comment is visible without scrolling. */
@media (min-width: 60rem) and (min-height: 34rem) {
  .player-bar.expanded .player-content-expanded {
    max-width: 1064px;
    flex-direction: row;
    align-items: stretch;
    gap: 1.75rem;
    overflow: hidden;
  }

  .player-bar.expanded .player-stage {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 600px;
    margin: 0 auto;
  }

  .comment-dock,
  .comments-scrim,
  .comments-sheet-grabber,
  .comments-sheet-close {
    display: none;
  }

  .player-comments-sheet {
    position: static;
    z-index: auto;
    flex: 0 0 21.5rem;
    max-height: none;
    transform: none;
    visibility: visible;
    background: none;
    border-radius: 0;
    box-shadow: none;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    padding: 0.25rem 0 0 1.75rem;
  }
}

/* ── Waveform comment pins ── */

.waveform-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.waveform-pin {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ws-gold);
  border: 2px solid var(--ws-background);
  pointer-events: auto;
  cursor: pointer;
  padding: 0;
}

.waveform-pin:hover {
  transform: translateX(-50%) scale(1.25);
}

/* The stage does the scrolling now (see .player-stage), so the shell itself never
   scrolls — that keeps the docked comments bar pinned above the safe area. */
.player-bar.expanded .player-content-expanded {
  overflow: hidden;
}

/* ── iOS input-zoom guard ──
   iOS zooms the whole page when a focused input's font is under 16px, and
   the zoom sticks after blur, cutting off the right edge. Keep every text
   entry at 16px on phones so that never happens. */
@media (max-width: 767px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input:not([type]),
  textarea,
  select {
    font-size: 16px;
  }
}

/* ══════════════════════════════════════════════
   Tune capture — add-tune sheet, tune picker,
   tune-first save form
   ══════════════════════════════════════════════ */

/* ── "Add tune" button (By Tune + Repertoire) ── */
.add-tune-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  background: var(--ws-surface);
  border: 1px dashed #34305e;
  border-radius: 12px;
  color: var(--ws-text-primary);
  padding: 0.8125rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 0.75rem;
  -webkit-tap-highlight-color: transparent;
}

.add-tune-btn:active {
  background: var(--ws-surface-elevated);
}

.add-tune-plus {
  width: 1.3125rem;
  height: 1.3125rem;
  border-radius: 50%;
  background: var(--ws-gradient-accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  line-height: 1;
  flex-shrink: 0;
}

.repertoire-add-btn {
  margin-bottom: 1rem;
}

[data-theme="light"] .add-tune-btn {
  border-color: #cfd4dd;
}

/* ── Add-tune sheet ── */
.modal-subhead {
  font-size: 0.8125rem;
  color: var(--ws-text-secondary);
  margin-top: 0.125rem;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 1.125rem;
}

.tune-dupe-note {
  background: rgba(255, 183, 77, 0.09);
  border: 1px solid rgba(255, 183, 77, 0.35);
  border-radius: 10px;
  padding: 0.625rem 0.6875rem;
  font-size: 0.8125rem;
  color: var(--ws-gold);
  line-height: 1.5;
  margin: -0.375rem 0 0.875rem;
}

.tune-dupe-note b {
  color: #ffd79a;
  font-weight: 600;
}

.tune-dupe-use {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.25rem;
  font: inherit;
  font-weight: 700;
  color: #ffd79a;
  text-decoration: underline;
  cursor: pointer;
}

.tune-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4375rem;
}

.tune-status-grid button {
  background: var(--ws-surface-elevated);
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 9px;
  color: var(--ws-text-secondary);
  padding: 0.5625rem 0.625rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.tune-status-grid button.selected {
  border-color: var(--ws-gold);
  color: var(--ws-gold);
  background: rgba(255, 183, 77, 0.1);
}

.tune-status-help {
  font-size: 0.71875rem;
  color: var(--ws-text-tertiary);
  margin-top: 0.5rem;
  line-height: 1.45;
  min-height: 2.0625rem;
}

/* ── Reusable tune picker ── */
.tune-picker-chips {
  text-align: left;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4375rem;
}

.tune-picker-chip {
  background: var(--ws-surface-elevated);
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 20px;
  padding: 0.5rem 0.8125rem;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--ws-text-primary);
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tune-picker-chip .chip-hint {
  color: var(--ws-text-tertiary);
  font-size: 0.6875rem;
  margin-left: 0.3125rem;
}

.tune-picker-chip.selected {
  border-color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.12);
  color: var(--ws-sky);
  font-weight: 600;
}

.tune-picker-chip.selected .chip-hint {
  color: var(--ws-sky);
}

.tune-picker-chip.new-tune {
  border-style: dashed;
  border-color: #3b3768;
  color: var(--ws-text-secondary);
}

.tune-picker-combo {
  margin-top: 0.625rem;
  position: relative;
}

.tune-picker-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ws-surface-elevated);
  border: 1px solid #3a3663;
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  cursor: text;
}

.tune-picker-field.open {
  border-color: var(--ws-sky);
  border-radius: 10px 10px 0 0;
}

.tune-picker-field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  color: var(--ws-text-primary);
  font: inherit;
  font-size: 0.84375rem;
}

/* This rule sits after the iOS input-zoom guard above and has the same
   specificity, so it would otherwise win and drop the field back under 16px. */
@media (max-width: 767px) {
  .tune-picker-field input {
    font-size: 16px;
  }
}

.tune-picker-field input:focus {
  outline: none;
  box-shadow: none;
}

.tune-picker-field .picker-icon {
  color: var(--ws-text-tertiary);
  flex-shrink: 0;
}

.tune-picker-caret {
  background: none;
  border: none;
  padding: 0;
  color: var(--ws-text-tertiary);
  display: flex;
  cursor: pointer;
  flex-shrink: 0;
}

.tune-picker-field.open .tune-picker-caret svg {
  transform: rotate(180deg);
}

.tune-picker-list {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 40;
  border: 1px solid var(--ws-sky);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--ws-surface-elevated);
  overflow-y: auto;
  max-height: 12.5rem;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.tune-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  padding: 0.5625rem 0.75rem;
  font-size: 0.84375rem;
  border-top: 1px solid #241f45;
  cursor: pointer;
}

.tune-picker-option:first-child {
  border-top: none;
}

.tune-picker-option:hover,
.tune-picker-option.active {
  background: rgba(94, 169, 240, 0.09);
}

.tune-picker-option .opt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tune-picker-option .opt-meta {
  color: var(--ws-text-tertiary);
  font-size: 0.71875rem;
  flex-shrink: 0;
}

.tune-picker-option.add-new {
  color: var(--ws-sky);
  font-weight: 600;
}

.tune-picker-option.empty {
  color: var(--ws-text-tertiary);
  cursor: default;
}

.tune-picker-count {
  font-size: 0.6875rem;
  color: var(--ws-text-tertiary);
  text-align: center;
  padding-top: 0.3125rem;
}

[data-theme="light"] .tune-picker-list,
[data-theme="light"] .tune-picker-field {
  background: var(--ws-surface-elevated);
}

[data-theme="light"] .tune-picker-option {
  border-top-color: #e2e5ea;
}

/* ── Tune-first save form ── */
.preview-player-copy {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.preview-eyebrow {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ws-text-primary);
}

.tune-assign-head {
  margin-bottom: 0.6875rem;
}

.tune-assign-q {
  font-size: 0.96875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.125rem;
}

.tune-assign-sub {
  font-size: 0.78125rem;
  color: var(--ws-text-secondary);
}

.take-name-line {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  margin-top: 0.875rem;
  padding-top: 0.8125rem;
  border-top: 1px solid var(--ws-surface-elevated);
}

.take-name-copy {
  min-width: 0;
  flex: 1;
}

.take-name-label {
  font-size: 0.71875rem;
  color: var(--ws-text-tertiary);
}

.take-name-value {
  font-size: 0.84375rem;
  color: var(--ws-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.take-name-value.placeholder {
  color: var(--ws-text-tertiary);
}

.take-name-edit {
  background: none;
  border: none;
  border-bottom: 1px solid var(--ws-surface-elevated);
  padding: 0 0 0.0625rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.preview-park {
  text-align: center;
  margin-top: 0.6875rem;
}

.preview-park-link {
  background: none;
  border: none;
  border-bottom: 1px solid var(--ws-surface-elevated);
  padding: 0 0 0.0625rem;
  font: inherit;
  font-size: 0.78125rem;
  color: var(--ws-text-secondary);
  cursor: pointer;
}

.preview-park-link:hover {
  color: var(--ws-text-primary);
}

/* ── Loose-take linking + equal-height tune rows ── */
.rec-link-tune {
  background: rgba(255, 183, 77, 0.16);
  color: var(--ws-gold);
  border: none;
  border-radius: 8px;
  padding: 0.4375rem 0.6875rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tune-card-header {
  min-height: 4rem;
}

.tune-card-meta:empty {
  display: none;
}

.tune-card-meta .tune-card-no-takes {
  color: var(--ws-text-tertiary);
  font-style: italic;
}

.toast-action {
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.625rem;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* ══════════════════════════════════════════════
   Player — mini bar, now playing, queue, tabs
   ══════════════════════════════════════════════ */

/* ── Mini bar ── */
.mini-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.07);
}

.mini-progress i {
  display: block;
  height: 2px;
  width: 0;
  background: var(--ws-gradient-accent);
}

.player-bar.expanded .mini-progress {
  display: none;
}

.mini-open {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mini-art {
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 9px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #F0616B, #4ECDC6 45%, #FFB74D 72%, #8B6BE8);
}

.mini-open .player-info {
  display: block;
  min-width: 0;
  flex: 1;
}

.mini-open .player-title,
.mini-open .player-artist {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Now playing ── */
.player-artwork {
  margin: 0.875rem auto 0;
  width: 8.25rem;
  height: 8.25rem;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #F0616B, #4ECDC6 42%, #FFB74D 70%, #8B6BE8);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.player-artwork-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.25rem;
  padding-bottom: 1.7rem;
}

.player-artwork-glyph i {
  width: 0.3125rem;
  border-radius: 3px;
  background: rgba(8, 11, 24, 0.6);
  display: block;
}

.player-artwork-glyph i:nth-child(1) { height: 2.1rem; }
.player-artwork-glyph i:nth-child(2) { height: 3.6rem; }
.player-artwork-glyph i:nth-child(3) { height: 2.6rem; }
.player-artwork-glyph i:nth-child(4) { height: 4.3rem; }
.player-artwork-glyph i:nth-child(5) { height: 2.3rem; }
.player-artwork-glyph i:nth-child(6) { height: 3.1rem; }

.expanded-player-info {
  text-align: center;
  margin-top: 0.8125rem;
}

.player-queue-indicator {
  flex: 1;
  text-align: center;
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ws-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-reference-chip {
  display: inline-block;
  margin-top: 0.5625rem;
  font-size: 0.6875rem;
  color: var(--ws-gold);
  background: rgba(255, 183, 77, 0.12);
  border-radius: 20px;
  padding: 0.1875rem 0.6875rem;
}

.transport-shuffle {
  position: relative;
  color: var(--ws-text-secondary);
}

.transport-shuffle[aria-pressed="true"] {
  color: var(--ws-sky);
}

/* No pill to tint in the transport row, so "on" reads as teal + a dot. */
.transport-shuffle[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0.15rem;
  width: 0.25rem;
  height: 0.25rem;
  margin-left: -0.125rem;
  border-radius: 50%;
  background: currentColor;
}

/* ── Up next / Comments tabs ── */
.player-tabs {
  display: flex;
  gap: 0.375rem;
  margin-top: 1rem;
  padding-top: 0.8125rem;
  border-top: 1px solid var(--ws-border, #242C48);
}

.player-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 9px;
  padding: 0.5rem;
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 600;
  color: var(--ws-text-tertiary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-tab.active {
  color: var(--ws-text-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Comments moved to their own surface, so "Up next" is on its own here: size it
   to its label instead of stretching a lone tab across the player. */
.player-tabs .player-tab:only-child {
  flex: 0 0 auto;
  padding: 0.5rem 0.9rem;
}

.player-tab-count {
  font-size: 0.65625rem;
  color: var(--ws-sky);
  margin-left: 0.25rem;
}

.player-queue-panel {
  margin-top: 0.375rem;
  max-height: 15rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.player-queue-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.player-queue-row {
  display: flex;
  align-items: center;
  gap: 0.6875rem;
  padding: 0.5625rem 0.5rem;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-queue-row.current {
  background: rgba(255, 183, 77, 0.07);
}

.player-queue-row.played {
  opacity: 0.55;
}

.queue-index {
  width: 1.125rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.queue-info {
  flex: 1;
  min-width: 0;
}

.queue-name {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-queue-row.current .queue-name {
  color: var(--ws-gold);
}

.queue-sub {
  font-size: 0.71875rem;
  color: var(--ws-text-tertiary);
  margin-top: 0.0625rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-duration {
  font-size: 0.75rem;
  color: var(--ws-text-tertiary);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── @mentions ── */
.comment-compose {
  position: relative;
}

.mention-picker {
  position: absolute;
  left: 2.75rem;
  right: 2.75rem;
  bottom: calc(100% + 0.375rem);
  z-index: 60;
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--ws-surface-elevated);
  border: 1px solid var(--ws-sky);
  border-radius: 11px;
  overflow: hidden;
  max-height: 11rem;
  overflow-y: auto;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}

.mention-picker-head {
  font-size: 0.625rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ws-text-tertiary);
  padding: 0.4375rem 0.6875rem;
  background: rgba(255, 255, 255, 0.03);
}

.mention-option {
  display: flex;
  align-items: center;
  gap: 0.5625rem;
  padding: 0.5rem 0.6875rem;
  font-size: 0.8125rem;
  cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.mention-option.active,
.mention-option:hover {
  background: rgba(94, 169, 240, 0.09);
}

.mention-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65625rem;
  font-weight: 700;
  color: #080B18;
  background: var(--ws-gold);
}

.mention-role {
  margin-left: auto;
  font-size: 0.65625rem;
  color: var(--ws-text-tertiary);
}

.comment-mention {
  color: var(--ws-sky);
  font-weight: 600;
}

.comment-mention.self {
  background: rgba(94, 169, 240, 0.16);
  border-radius: 5px;
  padding: 0 0.25rem;
}

.comment-item.mentions-me {
  background: rgba(224, 71, 135, 0.07);
  border-radius: 9px;
}

.comment-item.mentions-me .comment-time {
  background: rgba(224, 71, 135, 0.16);
  color: var(--ws-magenta);
}

.waveform-pin.mentions-me {
  background: var(--ws-magenta);
}

/* ── Notifications ── */
.header-bell {
  position: relative;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ws-text-primary);
  flex-shrink: 0;
}

.header-bell-count {
  position: absolute;
  top: -1px;
  right: -2px;
  min-width: 0.9375rem;
  height: 0.9375rem;
  border-radius: 20px;
  background: var(--ws-magenta);
  color: #fff;
  font-size: 0.59375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  border: 2px solid var(--ws-surface);
}

.notif-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notif-mark-read {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.71875rem;
  color: var(--ws-text-secondary);
  cursor: pointer;
}

.notif-filter {
  display: flex;
  gap: 0.375rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--ws-border, #242C48);
}

.notif-filter-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 0.71875rem;
  font-weight: 600;
  color: var(--ws-text-tertiary);
  padding: 0.3125rem 0.6875rem;
  border-radius: 20px;
  cursor: pointer;
}

.notif-filter-btn.active {
  background: var(--ws-surface-elevated);
  color: var(--ws-text-primary);
}

.notif-list {
  max-height: 26rem;
  overflow-y: auto;
  margin: 0 -0.25rem;
}

.notif-day {
  font-size: 0.625rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ws-text-tertiary);
  padding: 0.75rem 0.5rem 0.3125rem;
}

.notif-row {
  display: flex;
  gap: 0.625rem;
  padding: 0.625rem 0.5rem 0.625rem 0.75rem;
  align-items: flex-start;
  position: relative;
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.notif-row.unread {
  background: rgba(94, 169, 240, 0.045);
}

.notif-row.unread::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 1.05rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ws-sky);
}

.notif-row.mention {
  background: rgba(94, 169, 240, 0.09);
}

.notif-icon {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 9px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-icon.comment { background: rgba(94, 169, 240, 0.14); color: var(--ws-sky); }
.notif-icon.take { background: rgba(78, 205, 198, 0.14); color: var(--ws-accent); }
.notif-icon.status { background: rgba(255, 183, 77, 0.14); color: var(--ws-gold); }
.notif-icon.mention { background: rgba(224, 71, 135, 0.16); color: var(--ws-magenta); }

.notif-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.notif-text {
  display: block;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.notif-text b { font-weight: 600; }

.notif-meta {
  display: block;
  font-size: 0.6875rem;
  color: var(--ws-text-tertiary);
  margin-top: 0.125rem;
}

.notif-quote {
  display: block;
  font-size: 0.75rem;
  color: var(--ws-text-secondary);
  background: var(--ws-surface-elevated);
  border-radius: 8px;
  padding: 0.375rem 0.5625rem;
  margin-top: 0.375rem;
  line-height: 1.45;
}

.notif-empty {
  text-align: center;
  padding: 1.75rem 0.875rem;
  color: var(--ws-text-tertiary);
  font-size: 0.78125rem;
}

/* ══════════════════════════════════════════════
   Playback — ruler, scrub bubble, loop, utility
   ══════════════════════════════════════════════ */

.player-wave-stack {
  width: 100%;
  margin: 1.1rem 0 0.5rem;
}

.player-wave-ruler {
  position: relative;
  height: 0.9375rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.125rem;
}

.player-wave-ruler span {
  position: absolute;
  top: 0;
  font-size: 0.59375rem;
  color: var(--ws-text-tertiary);
  font-variant-numeric: tabular-nums;
  transform: translateX(-50%);
  white-space: nowrap;
}

.player-wave-ruler span.edge-start { transform: none; }
.player-wave-ruler span.edge-end { transform: translateX(-100%); }

.player-wave-ruler i {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 4px;
  background: rgba(255, 255, 255, 0.14);
}

.player-scrub-bubble {
  position: absolute;
  top: -0.35rem;
  z-index: 5;
  transform: translateX(-50%);
  background: var(--ws-text-primary);
  color: #080B18;
  font-size: 0.65625rem;
  font-weight: 700;
  padding: 0.125rem 0.4375rem;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.player-loop-region {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  background: rgba(94, 169, 240, 0.1);
  border-left: 1.5px solid var(--ws-sky);
  border-right: 1.5px solid var(--ws-sky);
  pointer-events: none;
}

.player-loop-handle {
  position: absolute;
  top: 0;
  width: 1.125rem;
  height: 1.125rem;
  background: var(--ws-sky);
  color: #080B18;
  font-size: 0.625rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

/* Grip marks: these edges are draggable, not decoration. */
.player-loop-handle::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  width: 0.125rem;
  height: 0.375rem;
  border-radius: 1px;
  background: var(--ws-sky);
}

.player-loop-a { left: -0.5625rem; }
.player-loop-b { right: -0.5625rem; }

.player-waveform.setting-loop {
  cursor: crosshair;
}

.player-waveform.loop-edge {
  cursor: ew-resize;
}

.player-time-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-bottom: 1px dashed var(--ws-border, #242C48);
  font-variant-numeric: tabular-nums;
}

.player-times.large span,
.player-times.large button {
  font-variant-numeric: tabular-nums;
}

.player-utility {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--ws-border, #242C48);
}

.player-utility-pill {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--ws-surface-elevated);
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 20px;
  padding: 0.375rem 0.75rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ws-text-secondary);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.player-utility-pill[aria-pressed="true"] {
  border-color: var(--ws-sky);
  color: var(--ws-sky);
  background: rgba(94, 169, 240, 0.1);
}

.player-utility-pill.rate-active {
  border-color: rgba(255, 183, 77, 0.4);
  color: var(--ws-gold);
  background: rgba(255, 183, 77, 0.08);
}

.player-utility-value {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.player-take-meta {
  display: flex;
  gap: 0.4375rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.player-take-meta span {
  font-size: 0.65625rem;
  color: var(--ws-text-tertiary);
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 20px;
  padding: 0.1875rem 0.5625rem;
}

.player-take-meta span b {
  color: var(--ws-text-secondary);
  font-weight: 600;
}

.player-take-meta span.clipped {
  color: var(--ws-magenta);
  border-color: rgba(224, 71, 135, 0.4);
}

.player-take-meta button {
  background: none;
  border: 1px solid var(--ws-border, #242C48);
  border-radius: 20px;
  padding: 0.1875rem 0.5625rem;
  font: inherit;
  font-size: 0.65625rem;
  color: var(--ws-text-tertiary);
  cursor: pointer;
}

.player-take-meta button[aria-pressed="true"] {
  color: var(--ws-sky);
  border-color: rgba(94, 169, 240, 0.4);
}

/* The bell makes four items in the archive header. On narrow screens the
   Invite chip drops its label so the group name keeps its room. */
@media (max-width: 560px) {
  .header-chip-invite span {
    display: none;
  }

  .header-chip-invite {
    padding-left: 0.55rem;
    padding-right: 0.55rem;
  }

  .header-actions {
    gap: 0.35rem;
  }
}

@media (max-width: 420px) {
  /* Give the "Playing from" breadcrumb room on a phone. */
  .player-bar .player-crop-btn {
    padding: 0.3rem 0.45rem;
  }

  .player-queue-indicator {
    font-size: 0.625rem;
    letter-spacing: 0.06em;
  }

  .player-take-meta span,
  .player-take-meta button {
    font-size: 0.625rem;
    padding: 0.1875rem 0.5rem;
  }
}
