/* =========================================================================
   Pink Player popup. One row component, one toast, one keyboard model for
   the player and search. Accent color comes from the album art (popup.js).
   ========================================================================= */

:root {
  --accent: #ff2d55;
  --accent-soft: rgba(255, 45, 85, 0.16);
  --accent-strong: rgba(255, 45, 85, 0.95);

  --bg: #0a0a0c;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-hi: rgba(255, 255, 255, 0.12);
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-hi: rgba(255, 255, 255, 0.20);

  --text: #f3f3f5;
  --text-dim: rgba(243, 243, 245, 0.62);
  --text-faint: rgba(243, 243, 245, 0.42);

  --menu-bg: rgba(28, 28, 32, 0.96);
  --toast-bg: #f3f3f5;
  --toast-fg: #0a0a0c;
  --toast-line: rgba(10, 10, 12, 0.25);
  --error: #ff8a8a;
  --tint-end: rgba(0, 0, 0, 0.4);

  /* Accent as text or a small glyph: mixed toward the text color so an accent
     taken from dark album art still reads on the glass. */
  --accent-text: color-mix(in srgb, var(--accent) 62%, var(--text));

  --radius: 10px;
  --popup-radius: 16px;
  --popup-height: 466px;

  --shadow-art: 0 8px 22px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f8;
    --surface: rgba(0, 0, 0, 0.04);
    --surface-hi: rgba(0, 0, 0, 0.08);
    --stroke: rgba(0, 0, 0, 0.08);
    --stroke-hi: rgba(0, 0, 0, 0.15);
    --text: #1c1c1e;
    --text-dim: rgba(28, 28, 30, 0.62);
    --text-faint: rgba(28, 28, 30, 0.42);
    --menu-bg: rgba(255, 255, 255, 0.97);
    --toast-bg: #1c1c1e;
    --toast-fg: #f6f6f8;
    --toast-line: rgba(246, 246, 248, 0.3);
    --error: #c62828;
    --tint-end: rgba(255, 255, 255, 0.35);
    --shadow-art: 0 8px 22px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.10);
  }
}

* { box-sizing: border-box; }

html {
  background: transparent;
  border-radius: var(--popup-radius);
  overflow: hidden;
}

html, body {
  margin: 0;
  padding: 0;
  width: 360px;
  height: var(--popup-height);
  font: 500 13px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Malgun Gothic", "Helvetica Neue", sans-serif;
  letter-spacing: -0.01em;
  color: var(--text);
  background: transparent;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; letter-spacing: inherit; color: inherit; }

/* Chrome's blue focus ring is replaced by a subtle accent one. */
button:focus, input:focus, [tabindex]:focus { outline: none; }
button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
/* The body takes focus when the popup opens; it never shows a ring. */
body[tabindex]:focus-visible { outline: none; }

body {
  position: relative;
  background: var(--bg);
  border-radius: inherit;
  clip-path: inset(0 round var(--popup-radius));
  isolation: isolate;
}

html.chromium-shell,
body.chromium-shell {
  background: var(--bg);
  border-radius: 0;
}
body.chromium-shell { clip-path: none; }

html.floating,
body.floating {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  clip-path: none;
}

svg { display: block; }

/* =========================================================================
   Ambient backdrop
   ========================================================================= */
.ambient {
  position: fixed;
  inset: -60px;
  z-index: 0;
  background-image: var(--art-url);
  background-size: cover;
  background-position: center;
  filter: blur(56px) saturate(160%);
  opacity: 0;
  transition: opacity 500ms var(--ease);
  pointer-events: none;
}
.ambient-tint {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, transparent 0%, var(--tint-end) 100%);
  opacity: 0;
  transition: opacity 500ms var(--ease);
  pointer-events: none;
}
.has-art .ambient { opacity: 0.45; }
.has-art .ambient-tint { opacity: 1; }

/* =========================================================================
   State machine
   ========================================================================= */
.player, .empty, .loading { display: none; position: relative; z-index: 1; }
.state-playing .player,
.state-paused  .player    { display: flex; }
.state-empty   .empty     { display: flex; }
.state-loading .loading   { display: flex; }

/* =========================================================================
   Player
   ========================================================================= */
.player {
  flex-direction: column;
  height: 100%;
  padding: 14px 14px 12px;
}

/* Shared icon-button reset */
.btn-icon, .btn-play, .btn-mini, .btn-toggle, .btn-like, .btn-primary, .btn-secondary,
.tab, .tab-search, .mini-play, .mini-main, .artist-link, .row-main, .row-act, .chip,
.scope-btn, .chip-clear, .top-big, .search-clear, .search-cancel, .sleep-item,
.sheet-close, .text-link, .toast-undo, .list-link {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition:
    transform 120ms var(--spring),
    background-color 160ms var(--ease),
    color 160ms var(--ease),
    opacity 160ms var(--ease),
    box-shadow 200ms var(--ease);
}

/* ---- Transport (folds away while searching) ---------------------------- */
.transport {
  flex-shrink: 0;
  overflow: hidden;
  max-height: 194px;
  opacity: 1;
  transition: max-height 320ms var(--spring), opacity 200ms var(--ease);
}
.transport-inner {
  display: flex;
  flex-direction: column;
  padding-bottom: 12px;
}

.head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  min-width: 0;
}

.art-wrap {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: var(--shadow-art);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
  transition: transform 160ms var(--spring);
}
.art-wrap:active { transform: scale(0.97); }
.art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 350ms var(--ease);
}
.has-art .art { opacity: 1; }
.art-fallback,
.art-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.art-fallback { color: var(--text-faint); }
.art-fallback svg { width: 22px; height: 22px; fill: currentColor; }
.has-art .art-fallback { display: none; }
.art-hover {
  background: rgba(0, 0, 0, 0.38);
  color: #fff;
  opacity: 0;
  transition: opacity 160ms var(--ease);
}
.art-hover svg { width: 18px; height: 18px; fill: currentColor; }
.art-wrap:hover .art-hover,
.art-wrap:focus-visible .art-hover { opacity: 1; }

.meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

/* Title marquee: clips overflow; the child slides only when it overflows. */
.title-wrap {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}
.title {
  display: inline-block;
  white-space: nowrap;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--text);
}
.title-wrap.is-marquee .title { animation: marquee 14s linear infinite; }
.title-wrap:not(.is-marquee) .title {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes marquee {
  0%, 8%   { transform: translateX(0); }
  45%, 55% { transform: translateX(calc(-100% + var(--mq-w, 0px))); }
  92%, 100%{ transform: translateX(0); }
}

.artist-link {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text-dim);
  text-align: left;
}
.artist-link .artist {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.artist-link svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  fill: currentColor;
  opacity: 0.7;
}
.artist-link:hover { color: var(--text); }
.artist-link:hover .artist { text-decoration: underline; }
.artist-link:disabled { cursor: default; color: var(--text-dim); }
.artist-link:disabled svg { display: none; }
.artist-link:disabled .artist { text-decoration: none; }

.btn-like {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.btn-like svg { width: 19px; height: 19px; fill: currentColor; }
.btn-like:hover { color: var(--text); background: var(--surface); }
.btn-like:active { transform: scale(0.9); }
.btn-like .ico-heart-filled { display: none; }
.btn-like.is-active { color: var(--accent-text); }
.btn-like.is-active .ico-heart-outline { display: none; }
.btn-like.is-active .ico-heart-filled { display: block; }

/* ---- Scrubber with inline times ---------------------------------------- */
.scrubber {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 16px;
  margin-top: 12px;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  cursor: pointer;
  -webkit-user-select: none; /* Safari 18 ignores the unprefixed one */
  user-select: none;
}
.scrubber .time-pos,
.scrubber .time-dur { width: 30px; flex-shrink: 0; }
.scrubber .time-dur { text-align: right; }
.scrubber-track {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-hi);
}
/* A taller hit area than the 4px bar. */
.scrubber-track::before {
  content: "";
  position: absolute;
  inset: -6px 0;
}
.scrubber-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 100ms linear;
}
.scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  transition: width 180ms var(--spring), height 180ms var(--spring);
  pointer-events: none;
}
.scrubber:hover .scrubber-thumb,
.scrubber.dragging .scrubber-thumb { width: 11px; height: 11px; }
.scrubber.dragging .scrubber-fill { transition: none; }
.scrubber:focus-visible { outline: none; }
.scrubber:focus-visible .scrubber-track { box-shadow: 0 0 0 2px var(--accent-soft); }

/* ---- Primary controls: shuffle / repeat flank a 44px play --------------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  margin-top: 10px;
  padding: 0 16px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.btn-icon svg { width: 24px; height: 24px; fill: currentColor; }
.btn-icon:hover { background: var(--surface); }
.btn-icon:active { transform: scale(0.92); }

.btn-play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-soft), inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}
.btn-play svg { width: 20px; height: 20px; fill: currentColor; }
.btn-play:hover { transform: scale(1.05); filter: brightness(1.07); }
.btn-play:active { transform: scale(0.94); }
.btn-play .ico-pause,
.mini-play .ico-pause { display: none; }
.state-playing .btn-play .ico-play,
.state-playing .mini-play .ico-play { display: none; }
.state-playing .btn-play .ico-pause,
.state-playing .mini-play .ico-pause { display: block; }

.btn-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.btn-toggle svg { width: 18px; height: 18px; fill: currentColor; }
.btn-toggle:hover { color: var(--text); background: var(--surface); }
.btn-toggle:active { transform: scale(0.9); }
.btn-toggle.is-active { color: var(--accent-text); }
.btn-toggle.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent-text);
  transform: translateX(-50%);
}
.repeat-one {
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  display: none;
}
.btn-repeat.is-repeat-one .repeat-one { display: block; }

/* ---- Utility row: volume, sleep, shortcuts, pop out --------------------- */
.utility {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  margin-top: 10px;
  padding: 0 2px;
}

.btn-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.btn-mini svg { width: 16px; height: 16px; fill: currentColor; }
.btn-mini:hover { color: var(--text); background: var(--surface); }
.btn-mini:active { transform: scale(0.9); }

#vol-btn .ico-vol-up, #vol-btn .ico-vol-mid, #vol-btn .ico-vol-mute { display: none; }
.vol-up   #vol-btn .ico-vol-up   { display: block; }
.vol-mid  #vol-btn .ico-vol-mid  { display: block; }
.vol-mute #vol-btn .ico-vol-mute { display: block; }

#vol-slider {
  --vol-pct: 100%;
  appearance: none;
  -webkit-appearance: none;
  flex: 1;
  min-width: 0;
  height: 3px;
  margin: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--text-dim) var(--vol-pct), var(--surface-hi) var(--vol-pct));
  outline: none;
  cursor: pointer;
}
#vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 150ms var(--spring);
}
#vol-slider:hover::-webkit-slider-thumb { transform: scale(1.2); }
#vol-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-soft); }

.sleep { position: relative; flex-shrink: 0; }
.sleep-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sleep-label { display: none; }
/* Active timer: a pill with the time left. */
.sleep-btn.is-active {
  width: auto;
  height: 24px;
  padding: 0 8px 0 6px;
  border-radius: 12px;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.sleep-btn.is-active svg { width: 13px; height: 13px; stroke-width: 1.8; }
.sleep-btn.is-active .sleep-label { display: inline; }
.sleep-btn.is-active:hover { background: var(--accent-soft); filter: brightness(1.1); }

/* Fixed, so the folding transport never clips it. popup.js places it. */
.sleep-menu {
  position: fixed;
  z-index: 10;
  width: 176px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border-radius: 10px;
  background: var(--menu-bg);
  outline: 0.5px solid var(--stroke-hi);
  outline-offset: -0.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  opacity: 0;
  transform: translateY(-4px) scale(0.97);
  transform-origin: top right;
  transition: opacity 160ms var(--ease), transform 160ms var(--spring), visibility 0s linear 160ms;
  pointer-events: none;
  visibility: hidden;
}
.sleep.is-open .sleep-menu {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  visibility: visible;
  transition: opacity 160ms var(--ease), transform 160ms var(--spring), visibility 0s;
}
.menu-heading {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.sleep-item {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.sleep-item svg { width: 14px; height: 14px; fill: currentColor; visibility: hidden; }
.sleep-item:hover, .sleep-item:focus-visible { background: var(--surface); outline: none; }
.sleep-item[aria-checked="true"] { color: var(--accent-text); background: var(--accent-soft); }
.sleep-item[aria-checked="true"] svg { visibility: visible; }
.sleep-off { color: var(--text-dim); font-weight: 400; }
.menu-divider { height: 0.5px; margin: 3px 6px; background: var(--stroke); }
.sleep-menu:not(.has-timer) .sleep-off-part { display: none; }

/* ---- Slim now-playing strip (search mode) ------------------------------- */
.mini {
  flex-shrink: 0;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 320ms var(--spring), opacity 200ms var(--ease);
}
.mini-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  margin-bottom: 12px;
}
.mini-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border-radius: 8px;
}
.mini-art {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.mini-art-img { width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.has-art .mini-art-img { opacity: 1; }
.mini-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mini-title, .mini-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-title { font-size: 12.5px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.mini-artist { font-size: 11px; color: var(--text-dim); }
.mini-play {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px var(--accent-soft), inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}
.mini-play svg { width: 14px; height: 14px; fill: currentColor; }
.mini-play:active { transform: scale(0.92); }

body.is-search .transport { max-height: 0; opacity: 0; pointer-events: none; }
body.is-search .mini { max-height: 48px; opacity: 1; }
body:not(.is-search) .mini { pointer-events: none; }

/* =========================================================================
   Notice (blocked playback / unreachable tab)
   ========================================================================= */
.notice {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  margin-bottom: 10px;
  padding: 9px 10px 9px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
}
.notice[hidden] { display: none; }
.notice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 180px;
}
.notice-title { font-size: 12px; font-weight: 600; color: var(--text); }
.notice-body { font-size: 11px; line-height: 1.35; color: var(--text-dim); }
.notice-action { flex-shrink: 0; height: 28px; padding: 0 12px; font-size: 11.5px; }

/* =========================================================================
   Panel: tabs or the search field, then one scrolling list
   ========================================================================= */
.panel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
}

.panel-tabs {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--stroke);
}
.tab {
  flex: 1;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active {
  color: var(--text);
  background: var(--surface-hi);
  box-shadow: inset 0 0 0 0.5px var(--stroke-hi);
}
.tab-lock { display: none; width: 10px; height: 10px; flex-shrink: 0; fill: currentColor; opacity: 0.8; }
.tab.is-locked .tab-lock { display: block; }
.tab-search {
  width: 30px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.tab-search svg { width: 15px; height: 15px; fill: currentColor; }
.tab-search:hover { color: var(--text); background: var(--surface); }

/* ---- Search field ------------------------------------------------------- */
.search-bar {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 4px;
  flex-shrink: 0;
  border-bottom: 0.5px solid var(--stroke);
}
body.is-search .panel-tabs { display: none; }
body.is-search .search-bar { display: flex; }

.search-field {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 5px 0 9px;
  border-radius: 14px;
  background: var(--surface);
  outline: 0.5px solid var(--stroke-hi);
  outline-offset: -0.5px;
}
.search-field:focus-within { outline: 1px solid var(--accent); }
.search-field > svg { width: 14px; height: 14px; flex-shrink: 0; fill: var(--text-dim); }
#search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 28px;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  caret-color: var(--accent);
}
#search-input::placeholder { color: var(--text-faint); opacity: 1; }
.search-clear {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hi);
  color: var(--text-dim);
}
.search-clear[hidden] { display: none; }
.search-clear svg { width: 11px; height: 11px; fill: currentColor; }
.search-clear:hover { color: var(--text); }
.search-cancel {
  height: 28px;
  padding: 0 7px;
  flex-shrink: 0;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.search-cancel:hover { color: var(--text); background: var(--surface); }

/* ---- Scope toggle + filter chips --------------------------------------- */
.chips-row {
  position: relative; /* chips measure their offsetLeft from here */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-bottom: 0.5px solid var(--stroke);
}
.chips-row::-webkit-scrollbar { display: none; }
.chips-row[hidden] { display: none; }
.scope {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  padding: 2px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
}
.scope-btn {
  height: 20px;
  padding: 0 8px;
  border-radius: 10px;
  white-space: nowrap;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.scope-btn:hover { color: var(--text); }
.scope-btn[aria-pressed="true"] { color: var(--text); background: var(--surface-hi); }
.chips-divider {
  display: block;
  width: 0.5px;
  height: 16px;
  flex-shrink: 0;
  background: var(--stroke-hi);
}
.chip-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
  color: var(--text-dim);
}
.chip-clear svg { width: 12px; height: 12px; fill: currentColor; }
.chip {
  flex-shrink: 0;
  height: 24px;
  padding: 0 10px;
  border-radius: 12px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--bg); background: var(--text); outline-color: var(--text); }
.chip-skel {
  display: block;
  flex-shrink: 0;
  height: 24px;
  border-radius: 12px;
  background: var(--surface-hi);
}

.search-progress {
  position: relative;
  height: 2px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--surface);
}
.search-progress[hidden] { display: none; }
.search-progress span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 38%;
  border-radius: 1px;
  background: var(--accent);
  animation: progress-slide 1.1s var(--ease) infinite;
}
@keyframes progress-slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(265%); }
}

/* ---- The list ------------------------------------------------------------ */
.panel-body {
  position: relative;
  flex: 1;
  min-height: 0;
}

/* Native scrollbars stay hidden; the edge that has more content fades and a
   thin thumb appears while scrolling (popup.js). Wheel, trackpad and keys
   scroll as usual. */
.tab-view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms var(--ease);
  scrollbar-width: none;
}
.tab-view::-webkit-scrollbar { display: none; }
.tab-view.is-active { opacity: 1; pointer-events: auto; }
.tab-view.fade-top {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 100%);
}
.tab-view.fade-bottom {
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 26px), transparent 100%);
}
.tab-view.fade-top.fade-bottom {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22px, #000 calc(100% - 26px), transparent 100%);
}
.search-view.is-busy.is-active { opacity: 0.45; }

.scroll-thumb {
  position: absolute;
  right: 2px;
  top: 0;
  width: 3px;
  height: 0;
  border-radius: 2px;
  background: var(--stroke-hi);
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms var(--ease);
}
.scroll-thumb.is-hover { opacity: 0.55; }
.scroll-thumb.is-scrolling { opacity: 1; }

/* ---- Rows (queue, search, playlists) ------------------------------------ */
.row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  border-radius: 7px;
  transition: background-color 150ms var(--ease), opacity 150ms var(--ease);
}
.row:hover { background: var(--surface); }
.row.is-selected { background: var(--surface-hi); box-shadow: inset 0 0 0 0.5px var(--stroke-hi); }
.row.is-now { background: var(--accent-soft); }
.row.is-played { opacity: 0.5; }
.row.is-played:hover, .row.is-played.is-selected { opacity: 1; }
.row.is-removing { opacity: 0; pointer-events: none; }

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
  border-radius: 7px;
  text-align: left;
  color: var(--text);
}
.row-art {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
}
.row-art.is-round { border-radius: 50%; }
.row-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Now playing: three still bars over the art. */
.row-eq {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 8px;
  background: rgba(0, 0, 0, 0.42);
}
.row-eq span { display: block; width: 3px; border-radius: 1px; background: #fff; }
.row-eq span:nth-child(1) { height: 9px; }
.row-eq span:nth-child(2) { height: 15px; }
.row-eq span:nth-child(3) { height: 6px; }
.state-playing .row-eq span { animation: eq 900ms ease-in-out infinite alternate; transform-origin: bottom; }
.state-playing .row-eq span:nth-child(2) { animation-delay: -300ms; }
.state-playing .row-eq span:nth-child(3) { animation-delay: -600ms; }
@keyframes eq {
  from { transform: scaleY(0.45); }
  to   { transform: scaleY(1); }
}

.row-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.row-title {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.row.is-now .row-title { color: var(--accent-text); }
.row-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 10.5px;
  color: var(--text-dim);
}
.row-sub span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-e {
  display: block;
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 700;
  line-height: 11px;
  text-align: center;
  background: var(--text-dim);
  color: var(--bg);
}
.row-meta {
  flex-shrink: 0;
  min-width: 26px;
  padding-right: 4px;
  text-align: right;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.row-act, .row-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.row-act svg, .row-check svg { width: 16px; height: 16px; fill: currentColor; }
.row-act.is-small svg { width: 14px; height: 14px; }
.row-act:hover { background: var(--surface-hi); }
.row-act:active { transform: scale(0.9); }
/* Hover actions replace the duration; the check replaces the actions. */
.row .row-act { display: none; }
.row:hover .row-act,
.row.is-selected .row-act,
.row:focus-within .row-act { display: inline-flex; }
.row.can-remove:hover .row-meta,
.row.can-remove.is-selected .row-meta,
.row.can-remove:focus-within .row-meta { display: none; }
.row.is-checked .row-act { display: none; }
.row-check { display: none; }
.row.is-checked .row-check { display: inline-flex; }

/* Text rows: suggestions and recent searches */
.row-main.is-text {
  height: 30px;
  padding: 0 8px;
  gap: 10px;
  font-size: 12px;
  font-weight: 400;
}
.row-main.is-text > svg { width: 14px; height: 14px; flex-shrink: 0; fill: var(--text-faint); }
.row-main.is-text .row-q {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-q b { font-weight: 600; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
}
.list-link {
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-dim);
}
.list-link:hover { color: var(--text); background: var(--surface); }
.list-divider { height: 0.5px; margin: 5px 8px; background: var(--stroke); }

.queue-from {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 6px;
  font-size: 10.5px;
  color: var(--text-faint);
}
.queue-from b {
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
}

/* Top result */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 6px;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
  transition: background-color 150ms var(--ease);
}
.top:hover, .top.is-selected { background: var(--surface-hi); }
.top.is-selected { box-shadow: inset 0 0 0 0.5px var(--stroke-hi); }
.top .row-main { padding: 0; gap: 12px; }
.top .row-art {
  width: 52px;
  height: 52px;
  border-radius: 7px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.top .row-art.is-round { border-radius: 50%; }
.top .row-text { gap: 2px; }
.top-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.top .row-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.015em; }
.top.is-now .row-title { color: var(--accent-text); }
.top-big {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px var(--accent-soft), inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}
.top-big svg { width: 16px; height: 16px; fill: currentColor; }
.top-big:hover { transform: scale(1.05); }
.top-big:active { transform: scale(0.93); }

/* Loading placeholders */
.skel {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 6px;
}
.skel-art { display: block; width: 32px; height: 32px; border-radius: 5px; flex-shrink: 0; background: var(--surface-hi); }
.skel-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skel-lines span { display: block; height: 9px; border-radius: 3px; background: var(--surface-hi); }
.skel-lines span + span { height: 7px; background: var(--surface); }
.skel { animation: skel-pulse 1.2s ease-in-out infinite alternate; }
@keyframes skel-pulse { from { opacity: 1; } to { opacity: 0.55; } }

/* Empty, error and hint messages inside the list */
.list-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 30px 18px 16px;
}
.list-msg.is-compact { padding: 26px 16px 12px; gap: 12px; }
.msg-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
  color: var(--text-faint);
}
.msg-icon svg { width: 20px; height: 20px; fill: currentColor; }
.msg-title { font-size: 12.5px; color: var(--text-dim); }
.msg-body { max-width: 250px; font-size: 11px; line-height: 1.4; color: var(--text-faint); }

/* ---- Pro lock (Playlists tab) ------------------------------------------- */
.pro-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 12px 12px 10px;
}
.pro-lock [hidden] { display: none; }
.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.pro-badge svg { width: 9px; height: 9px; fill: currentColor; }
.pro-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.pro-text { margin: 0; max-width: 270px; font-size: 11.5px; line-height: 1.45; color: var(--text-dim); }
.pro-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.pro-actions .btn-primary, .pro-actions .btn-secondary,
.pro-key .btn-primary { height: 30px; border-radius: 15px; }
.pro-actions .btn-primary { padding: 0 15px; }
.pro-actions .btn-secondary { padding: 0 13px; }
.pro-fine { margin: 0; max-width: 296px; font-size: 10.5px; line-height: 1.45; color: var(--text-dim); }
.pro-fine b { font-weight: 600; color: var(--text); }
.pro-key { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 304px; }
.pro-key-input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 12px;
  border: 0;
  margin: 0;
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  outline: 0.5px solid var(--stroke-hi);
  outline-offset: -0.5px;
  font: 11.5px ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
.pro-key-input::placeholder { color: var(--text-faint); opacity: 1; }
.pro-key-input:focus { outline: 1px solid var(--accent); }
.pro-key.is-error .pro-key-input { outline: 1px solid var(--error); }
.pro-key .btn-primary { padding: 0 13px; flex-shrink: 0; }
.pro-key .btn-primary:disabled { opacity: 0.6; cursor: default; }
.pro-hint { margin: 0; max-width: 296px; font-size: 10.5px; line-height: 1.45; color: var(--text-dim); }
.pro-hint.is-error { color: var(--error); }
.text-link {
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 500;
  text-decoration: underline;
  color: var(--text-dim);
}
.text-link:hover { color: var(--text); }

/* ---- Lyrics ---------------------------------------------------------------- */
.lyrics-view {
  padding: 34px 8px 60px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 80%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 22%, #000 80%, transparent 100%);
}
.lyrics-empty {
  display: none;
  text-align: center;
  padding: 36px 16px;
  color: var(--text-faint);
  font-size: 11.5px;
}
.lyrics-view.no-lyrics { -webkit-mask-image: none; mask-image: none; padding-top: 6px; }
.lyrics-view.no-lyrics .lyrics-empty { display: block; }
.lyrics-view.no-lyrics .lyrics-lines,
.lyrics-view.no-lyrics .lyrics-source { display: none; }
.lyrics-lines { display: flex; flex-direction: column; gap: 4px; }
.l-line {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text-faint);
  text-align: center;
  padding: 3px 6px;
  border-radius: 5px;
  transition: color 300ms var(--ease), transform 300ms var(--spring);
  cursor: pointer;
}
.l-line:hover { color: var(--text-dim); }
.l-line.is-active { color: var(--text); font-weight: 600; transform: scale(1.02); }
.l-line.is-past { color: var(--text-faint); }
.lyrics-source {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
  font-size: 10px;
  color: var(--text-faint);
}
.lyrics-source[hidden] { display: none; }
.lyrics-source .dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

/* ---- Keyboard hint bar (search) ------------------------------------------ */
.hint-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 24px;
  padding: 0 10px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  border-top: 0.5px solid var(--stroke);
  font-size: 10px;
  color: var(--text-faint);
}
.hint-bar[hidden] { display: none; }
.hint-bar b { font-weight: 600; color: var(--text-dim); }

/* =========================================================================
   Shortcuts sheet
   ========================================================================= */
.sheet-backdrop {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: default;
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgba(0, 0, 0, 0.38);
  animation: fade-in 160ms var(--ease);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  height: 318px;
  padding: 6px 16px 14px;
  display: flex;
  flex-direction: column;
  border-radius: 14px 14px var(--popup-radius) var(--popup-radius);
  background: var(--menu-bg);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
  outline: 0.5px solid var(--stroke-hi);
  outline-offset: -0.5px;
  animation: sheet-up 260ms var(--spring);
}
.sheet-backdrop[hidden], .sheet[hidden] { display: none; }
.sheet-grabber { display: block; width: 32px; height: 4px; margin: 0 auto 8px; border-radius: 2px; background: var(--stroke-hi); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.sheet-close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text-dim);
}
.sheet-close svg { width: 12px; height: 12px; fill: currentColor; }
.sheet-rows { display: flex; flex-direction: column; gap: 3px; }
.sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 21px;
  font-size: 11.5px;
  color: var(--text-dim);
}
.sheet-keys { display: flex; align-items: center; gap: 3px; }
.kbd {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--surface-hi);
  outline: 0.5px solid var(--stroke-hi);
  outline-offset: -0.5px;
  color: var(--text);
}
body.floating .sheet { border-radius: 14px 14px 0 0; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================================
   Toast
   ========================================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 320px;
  padding: 7px 8px 7px 10px;
  border-radius: 16px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  background: var(--toast-bg);
  color: var(--toast-fg);
  transform: translateX(-50%);
  animation: toast-in 220ms var(--spring);
}
.toast[hidden] { display: none; }
body.has-hint .toast { bottom: 38px; }
.toast > svg { width: 14px; height: 14px; flex-shrink: 0; fill: currentColor; }
.toast > svg.is-heart { fill: var(--accent); }
.toast > svg.is-moon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast-label { padding-right: 2px; flex-shrink: 0; }
.toast-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  opacity: 0.62;
  padding-right: 4px;
}
.toast-title:empty { display: none; }
.toast-undo {
  height: 22px;
  padding: 0 8px;
  margin-left: 2px;
  flex-shrink: 0;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
  color: var(--toast-fg);
  outline: 0.5px solid var(--toast-line);
  outline-offset: -0.5px;
}
.toast-undo:hover { background: rgba(127, 127, 127, 0.15); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* =========================================================================
   Empty + loading
   ========================================================================= */
.empty {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
  padding: 40px 32px;
  gap: 12px;
}
.empty-art {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.empty-msg { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.empty-hint { margin: 0; max-width: 250px; color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.empty-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}
.empty-actions [hidden] { display: none; }

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.btn-primary { padding: 0 16px; background: var(--text); color: var(--bg); }
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
  padding: 0 14px;
  background: var(--surface);
  color: var(--text-dim);
  outline: 0.5px solid var(--stroke);
  outline-offset: -0.5px;
}
.btn-secondary:hover { color: var(--text); background: var(--surface-hi); }
.btn-secondary:active { transform: scale(0.97); }

.loading {
  align-items: center;
  justify-content: center;
  height: 100%;
}
.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--surface-hi);
  border-top-color: var(--text);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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