/* Shared chrome for landing, track, and player pages. */

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

html {
  background: #0a0a0a;
  color-scheme: dark;
}

:root {
  --aux-primary: #FE8788;
  --aux-primary-fg: #0a0a0a;
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #222;
  --text: #f2f2f2;
  --muted: #888;
  --accent: #1DB954;
}

@font-face {
  font-family: "tabler-icons";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@3.46.0/dist/fonts/tabler-icons.woff2?v3.46.0") format("woff2");
}
.ti.ti-brand-soundcloud { font-family: "tabler-icons" !important; }
.ti-brand-soundcloud:before { content: "\ed6e"; }

.aux-wordmark {
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* ── Command bar ─────────────────────────────────────────── */

.cmd-bar,
.cmd-bar-go {
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  box-sizing: border-box;
  margin: 0;
  border-radius: 10px;
}

.cmd-bar {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid #404040;
  padding: 0 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.cmd-bar:focus-within {
  border-color: #555;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--aux-primary) 12%, transparent);
}
.cmd-bar-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1;
  padding: 0 4px;
  margin: 0;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.cmd-bar-input::placeholder { color: #667; }
.cmd-bar-input:-webkit-autofill,
.cmd-bar-input:-webkit-autofill:hover,
.cmd-bar-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--surface) inset;
  transition: background-color 99999s ease-out;
}
.cmd-bar-go {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--aux-primary) 88%, #000);
  background: var(--aux-primary);
  color: var(--aux-primary-fg);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 0 20px;
  transition: filter 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.cmd-bar-go:hover { filter: brightness(1.06); }
.cmd-bar-go:focus-visible {
  outline: 2px solid var(--aux-primary);
  outline-offset: 2px;
}

.cmd-bar-paste {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 32px;
  height: 32px;
  margin: 0 -4px 0 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #888;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.cmd-bar-paste .ti { font-size: 18px; line-height: 1; }
.cmd-bar-paste:hover,
.cmd-bar-paste:active,
.cmd-bar-paste:focus-visible { color: #f2f2f2; z-index: 60; }
.cmd-bar-paste[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: auto;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 8px;
  border-radius: 8px;
  background: #1c1c1c;
  border: 1px solid #333;
  color: #ccc;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 60;
}
.cmd-bar-paste:hover[data-tip]::after,
.cmd-bar-paste:focus-visible[data-tip]::after { opacity: 1; }
.top-bar .cmd-bar-paste[data-tip]::after {
  top: calc(100% + 8px);
  bottom: auto;
}
@media not ((hover: hover) and (pointer: fine)) {
  .cmd-bar-paste[data-tip]::after { display: none !important; }
}
@media (max-width: 699px) {
  .cmd-bar-input { font-size: 16px; }
  .cmd-bar-paste,
  .cmd-bar-go { touch-action: manipulation; }
}

/* ── Recents ─────────────────────────────────────────────── */

.recent-open-link {
  color: var(--aux-primary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
}
.recent-open-link:hover { color: #ffb4b5; text-decoration: underline; text-underline-offset: 3px; }
.recent-open-link-corner {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  right: max(22px, env(safe-area-inset-right));
  z-index: 50;
}
.recent-open-link-underbar {
  display: block;
  box-sizing: border-box;
  padding: 8px 0 0;
  text-align: right;
  justify-self: end;
}
@media (min-width: 700px) {
  .top-bar .recent-open-link-underbar {
    position: absolute;
    top: calc(18px + 40px + 16px);
    right: 18px;
    padding: 0;
    z-index: 31;
  }
}
.recent-open-link[hidden] { display: none !important; }
.recent[hidden] { display: none !important; }
.recent {
  position: fixed;
  inset: 0;
  z-index: 80;
}
.recent-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.recent.is-open .recent-overlay { opacity: 1; }
.recent-drawer {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: #111;
  color: #f2f2f2;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.recent.is-open .recent-list { animation: none; }
@media (max-width: 699px) {
  .recent.is-open .recent-list {
    animation: recentListIn 0.35s ease both;
  }
}
@keyframes recentListIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .recent-overlay,
  .recent-drawer { transition: none; }
  .recent.is-open .recent-list { animation: none; }
}
.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 16px 18px 12px;
  flex-shrink: 0;
}
.recent-title {
  display: flex;
  align-items: center;
  height: 32px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.recent-head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
}
.recent-clear,
.recent-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: none;
  background: none;
  color: #888;
  font: inherit;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.recent-clear {
  font-size: 0.8rem;
  padding: 0 8px;
}
.recent-close {
  width: 32px;
  font-size: 1.35rem;
  color: #ccc;
  transform: translateY(-3px);
}
.recent-clear:hover,
.recent-close:hover { color: #f2f2f2; }
@media (max-width: 699px) {
  .recent-head {
    flex-wrap: nowrap;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px 8px;
  }
  .recent-title,
  .recent-head-actions,
  .recent-clear,
  .recent-close {
    height: 44px;
    margin: 0;
  }
  .recent-title {
    min-width: 0;
    flex: 1;
  }
  .recent-clear,
  .recent-close {
    -webkit-appearance: none;
    appearance: none;
    vertical-align: middle;
  }
  .recent-close {
    transform: none;
    font-size: 1.5rem;
    padding-bottom: 2px;
  }
}
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 4px 4px 8px;
  border-radius: 10px;
}
.recent-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
  padding: 4px 0;
  color: inherit;
  text-decoration: none;
}
.recent-item:hover { background: #1c1c1c; }
.recent-copy {
  flex-shrink: 0;
  display: grid;
  align-items: center;
  justify-items: stretch;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: none;
  border-radius: 8px;
  background: #252525;
  color: #ccc;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.recent-copy-idle,
.recent-copy-done {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.recent-copy .ti { font-size: 15px; line-height: 1; }
.recent-copy-done { visibility: hidden; }
.recent-copy.is-copied .recent-copy-idle { visibility: hidden; }
.recent-copy.is-copied .recent-copy-done { visibility: visible; }
.recent-copy:hover { color: #f2f2f2; background: #2e2e2e; }
.recent-copy.is-copied { color: var(--aux-primary); }
.recent-art {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a1a;
  flex-shrink: 0;
}
.recent-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recent-song,
.recent-artist {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-song { font-size: 0.95rem; font-weight: 600; }
.recent-artist { font-size: 0.8rem; color: #667; }
@media (max-width: 699px) {
  .recent-drawer {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(75dvh, 560px);
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
  }
  .recent.is-open .recent-drawer { transform: translateY(0); }
}
@media (min-width: 700px) {
  .recent-drawer {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100%);
    border-left: 1px solid #2a2a2a;
    transform: translateX(100%);
  }
  .recent.is-open .recent-drawer { transform: translateX(0); }
}

/* ── Footer credit ───────────────────────────────────────── */

.built-by {
  flex-shrink: 0;
  z-index: 20;
  display: block;
  text-align: center;
  padding: 0 18px calc(.55rem + env(safe-area-inset-bottom));
  font-size: 0.82rem;
  letter-spacing: -0.02em;
  color: #667;
  text-decoration: none;
}
.built-by .built-by-name,
.built-by .built-by-coffee {
  color: var(--aux-primary);
  font-weight: 700;
  text-decoration: none;
}
.built-by .built-by-name:hover,
.built-by .built-by-coffee:hover { color: #ffb4b5; }
.aux-sep {
  color: #444;
  font-size: 1.45em;
  font-weight: 700;
  line-height: 1;
  vertical-align: -0.08em;
  margin: 0 0.3rem;
}
@media (min-width: 700px) {
  .built-by {
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    padding: 0;
    text-align: right;
    white-space: nowrap;
    font-size: 0.82rem;
  }
}

/* ── Landing ─────────────────────────────────────────────── */

.page-landing {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #f2f2f2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem 18px;
  gap: 2rem;
}

.landing-hero {
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tagline {
  color: #667;
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 34rem;
  margin-inline: auto;
}
.tagline-br { display: none; }

.paste-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

@media (min-width: 700px) {
  .landing-hero { gap: 12px; }
  .tagline { max-width: none; white-space: nowrap; }
  .tagline-br { display: inline; }
}

.paste-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.error-msg { font-size: 0.82rem; color: #e05; display: none; text-align: center; }

.preview-links {
  margin-top: 3.5rem;
  text-align: center;
  color: #667;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.preview-links-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f2f2f2;
}
.preview-links-row { font-size: 0.85rem; }
.preview-links a {
  color: var(--aux-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--aux-primary) 45%, #444);
  font-weight: 400;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.preview-links a:hover {
  color: #ffb4b5;
  text-decoration-color: var(--aux-primary);
}

/* ── Track page ──────────────────────────────────────────── */

.page-track {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.top-bar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 80px;
  padding: 18px 18px 16px;
  width: 100%;
  position: relative;
  z-index: 30;
}
.top-bar-brand { grid-column: 1; grid-row: 1; }
.top-bar-search { grid-column: 2; grid-row: 1; }
@media (max-width: 699px) {
  .top-bar {
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    row-gap: 22px;
    padding: 14px 18px 16px;
  }
  .top-bar-brand { grid-column: 1; grid-row: 1; }
  .top-bar .recent-open-link-underbar {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    align-self: center;
  }
  .top-bar-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.top-bar-brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 40px;
  color: var(--text);
  text-decoration: none;
  transform: translateY(-2px);
}

.top-bar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.page-track .track-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 1.25rem 2rem;
  width: 100%;
}

.page-track .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.page-track .art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background: #222;
  transition: transform 0.3s ease;
}
.page-track .art.playing { transform: scale(1.02); }
.page-track .art-wide { aspect-ratio: 16/9; }

.yt-embed-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.yt-embed {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.platform-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.page-track .meta { display: flex; flex-direction: column; gap: 4px; }

.song-title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.explicit-badge {
  display: inline-block;
  background: var(--muted);
  color: var(--bg);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
  position: relative; top: -2px;
}

.page-track .artist { font-size: 0.95rem; color: var(--muted); font-weight: 500; margin-top: 2px; }
.page-track .album  { font-size: 0.85rem; color: #555; }

.page-track .player { display: flex; flex-direction: column; gap: 0; margin: -10px 10px; }

.wave-wrap {
  flex: 1;
  width: 100%;
  height: 64px;
  opacity: 0.85;
  transition: opacity 0.2s, filter 0.2s;
  cursor: pointer;
  border-radius: 10px;
}
.wave-wrap.playing { opacity: 1; }
.wave-wrap:hover { filter: brightness(1.05); }
.page-track canvas { width: 100%; height: 100%; display: block; }

.controls-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 0.55rem;
}

.page-track .play-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: opacity 0.15s, transform 0.1s;
}
.page-track[data-platform="spotify"] .play-btn,
[data-platform="spotify"] .page-track .play-btn { color: #000; }
.page-track .play-btn:hover  { opacity: 0.88; }
.page-track .play-btn:active { transform: scale(0.93); }
.page-track .play-btn .ti { font-size: 18px; margin-left: 1px; }
.page-track .play-btn.playing .ti { margin-left: 0; }
.page-track .play-btn.loading .ti { opacity: 0; margin-left: 0; }
.page-track .play-btn.loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: play-spin 0.85s linear infinite;
}
@keyframes play-spin { to { transform: rotate(360deg); } }
.open-btn-icon { display: flex; align-items: center; }
.open-btn-icon .ti { font-size: 20px; }
.copy-link-btn .ti { font-size: 14px; }
.page-track .no-preview .ti { font-size: 18px; }

.page-track .no-preview {
  font-size: 0.8rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.sc-widget-wrap {
  width: 100%;
  height: 166px;
  min-height: 166px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #111;
}
.sc-widget {
  display: block;
  width: 100%;
  height: 166px;
  border: 0;
}

.open-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 600; font-size: 0.9rem;
  text-decoration: none; border-radius: 500px;
  padding: 14px 24px;
  transition: color 0.15s, border-color 0.15s, transform 0.1s;
}
.open-btn:hover { color: var(--text); border-color: var(--accent); transform: scale(1.02); }

.slow-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 0.15rem;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--aux-primary) 10%, #141414);
  border: 1px solid color-mix(in srgb, var(--aux-primary) 28%, #333);
  color: #c8c8c8;
  font-size: 0.78rem;
  line-height: 1.4;
}
.slow-note[hidden] { display: none; }
.slow-note .ti { font-size: 16px; color: var(--aux-primary); margin-top: 1px; flex-shrink: 0; }
.slow-note p { flex: 1; min-width: 0; }
.slow-note a {
  color: var(--aux-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.slow-note a:hover { color: #ffb4b5; }
.slow-note-x {
  flex-shrink: 0;
  width: 18px; height: 22px;
  margin: 0 0 0 -4px;
  border: none; background: transparent;
  color: #888; cursor: pointer;
  font-size: 1.05rem; line-height: 1;
  padding: 0;
  border-radius: 6px;
}
.slow-note-x:hover { color: #f2f2f2; }

.copy-link-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--aux-primary);
  color: var(--aux-primary-fg);
  border: 1px solid color-mix(in srgb, var(--aux-primary) 88%, #000);
  font-weight: 700; font-size: 0.9rem;
  border-radius: 500px;
  padding: 10px 24px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  width: 100%;
  margin-top: .9rem;
}
.copy-link-btn:hover { filter: brightness(1.06); transform: scale(1.02); }
.copy-link-btn:focus-visible {
  outline: 2px solid var(--aux-primary);
  outline-offset: 2px;
}

.page-track .footer {
  text-align: center; font-size: 0.72rem; color: #333;
}
.page-track .footer a {
  color: color-mix(in srgb, var(--aux-primary) 45%, #667);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page-track .footer a:hover { color: color-mix(in srgb, var(--aux-primary) 60%, #888); }

/* ── Unsupported ─────────────────────────────────────────── */

.page-unsupported {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: #0a0a0a;
  color: #f2f2f2;
  font-family: system-ui, -apple-system, sans-serif;
  padding: 24px;
}
.page-unsupported .card {
  width: 100%;
  max-width: 520px;
  border: 1px solid #222;
  border-radius: 14px;
  background: #141414;
  padding: 24px;
}
.page-unsupported h1 { margin: 0 0 8px; font-size: 1.2rem; }
.page-unsupported p { margin: 0 0 14px; color: #999; line-height: 1.45; }
.page-unsupported a {
  color: #fff;
  text-decoration: none;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 14px;
  display: inline-block;
  font-size: 0.9rem;
}
