/* ══════════════════════════════════════════════════
   PODSHELF  —  dark PocketCasts-inspired theme
   ══════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────── */
:root {
  --bg:         #111118;
  --surf:       #1c1c26;
  --surf2:      #252530;
  --surf3:      #2e2e3e;
  --border:     #2a2a38;
  --text:       #f0f0f5;
  --text2:      #9090a8;
  --text3:      #55556a;
  --accent:     #f43f5e;
  --accent-dim: rgba(244,63,94,.25);
  --accent-bg:  rgba(244,63,94,.08);
  --teal:       #2dd4bf;
  --teal-dim:   rgba(45,212,191,.25);
  --green:      #22c55e;
  --radius:     12px;
  --radius-sm:  8px;
  --nav-h:      62px;
  --mini-h:     64px;
  --bar-h:      76px;
  --side-w:     210px;
  --safe-b:     env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

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

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

img { display: block; object-fit: cover; background: var(--surf3); }

a { color: inherit; text-decoration: none; }

input[type="search"]::-webkit-search-cancel-button { display: none; }

/* ── Login screen ────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-card {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; align-items: center;
  gap: 0;
}

.login-logo  { font-size: 56px; margin-bottom: 12px; }
.login-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.login-sub   { font-size: 14px; color: var(--text2); text-align: center; margin-bottom: 28px; }

.login-fields {
  width: 100%; display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 14px;
}

.login-fields input {
  width: 100%; padding: 14px 16px;
  background: var(--surf2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 16px; outline: none;
  transition: border-color .15s;
}

.login-fields input:focus { border-color: var(--accent); }

.login-remember {
  display: flex; align-items: center; gap: 8px;
  align-self: flex-start;
  font-size: 14px; color: var(--text2);
  cursor: pointer; margin-bottom: 16px;
}

.login-remember input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer;
}

.login-error {
  width: 100%; min-height: 20px;
  font-size: 13px; color: var(--accent);
  text-align: center; margin-bottom: 8px;
}

#login-btn {
  width: 100%; padding: 15px;
  font-size: 16px; font-weight: 700;
}

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

/* ── Loading screen ──────────────────────────────── */
#loading {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px;
  background: var(--bg);
  font-size: 14px; color: var(--text2);
}

#loading .emoji { font-size: 48px; }

/* ── Error screen ────────────────────────────────── */
#error-screen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 32px;
  background: var(--bg); text-align: center;
}

#error-screen .emoji { font-size: 48px; }
#error-screen h2     { font-size: 20px; }
#err-msg             { font-size: 13px; color: var(--text2); word-break: break-all; }

.hidden { display: none !important; }

/* ── Shell — MOBILE default ──────────────────────── */
#shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

#sidebar    { display: none; }
#player-bar { display: none; }

#view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── Shell — DESKTOP ─────────────────────────────── */
@media (min-width: 768px) {
  #shell {
    display: grid;
    grid-template-columns: var(--side-w) 1fr;
    grid-template-rows: 1fr var(--bar-h);
    height: 100dvh;
  }

  #sidebar {
    display: flex; flex-direction: column;
    grid-column: 1; grid-row: 1 / 3;
    background: var(--surf);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding-bottom: 16px;
  }

  #view {
    grid-column: 2; grid-row: 1;
  }

  #player-bar {
    display: flex;
    grid-column: 2; grid-row: 2;
  }

  #mini-player { display: none !important; }
  #bottom-nav  { display: none !important; }
}

/* ── Sidebar (desktop) ───────────────────────────── */
.sidebar-logo {
  padding: 20px 20px 8px;
  font-size: 20px; font-weight: 800;
  letter-spacing: -.5px;
  color: var(--accent);
}

.sidebar-nav { padding: 8px 0; flex: 1; }

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  font-size: 14px; font-weight: 500;
  color: var(--text2);
  border-radius: 0;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.sidebar-link:hover { background: var(--surf2); color: var(--text); }

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-bg);
  border-right: 3px solid var(--accent);
}

/* ── Player bar (desktop) ────────────────────────── */
#player-bar {
  align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--surf);
  border-top: 1px solid var(--border);
  height: var(--bar-h);
}

.bar-art {
  width: 48px; height: 48px;
  border-radius: 6px; flex-shrink: 0;
  cursor: pointer;
}

.bar-meta {
  flex-shrink: 0; min-width: 0; max-width: 180px;
}

.bar-show  { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-seek { flex: 1; min-width: 0; }

.bar-seek .seek-times {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text3); margin-top: 4px;
}

#bar-seek-wrap {
  position: relative; height: 4px;
  background: var(--surf3); border-radius: 2px;
  cursor: pointer;
}

#bar-prog-fill {
  position: absolute; left: 0; top: 0;
  height: 100%; background: var(--accent);
  border-radius: 2px; pointer-events: none;
  transition: width .5s linear;
}

.bar-ctl {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}

/* ── Bottom nav (mobile) ─────────────────────────── */
#bottom-nav {
  display: flex;
  background: var(--surf);
  border-top: 1px solid var(--border);
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  flex-shrink: 0;
}

.nav-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; font-size: 10px; font-weight: 500;
  color: var(--text3); cursor: pointer;
  transition: color .15s;
}

.nav-tab span { font-size: 10px; }
.nav-tab > :first-child { font-size: 22px; }
.nav-tab.active { color: var(--accent); }

/* ── Mini player (mobile) ────────────────────────── */
#mini-player {
  display: flex;
  align-items: center; gap: 10px;
  padding: 0 12px;
  height: var(--mini-h);
  background: var(--surf);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.mini-art {
  width: 42px; height: 42px;
  border-radius: 6px; flex-shrink: 0;
}

.mini-info { flex: 1; min-width: 0; }
.mini-show { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mini-ctl { display: flex; align-items: center; gap: 4px; }

.mini-prog {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 2px; background: var(--surf3);
}

#mini-prog-fill {
  height: 100%; background: var(--accent);
  transition: width .5s linear;
}

/* ── Full player overlay ─────────────────────────── */
#full-player {
  position: fixed; inset: 0; z-index: 300;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.32,.72,0,1);
  overflow: hidden;
}

#full-player.open { transform: translateY(0); }

#player-bg {
  position: absolute; inset: -60px;
  background-size: cover; background-position: center;
  filter: blur(60px) saturate(2.5) brightness(.25);
  opacity: 0;
  transition: opacity .5s;
  pointer-events: none;
}

.player-bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.4) 0%, rgba(0,0,0,.6) 100%);
  pointer-events: none;
}

.player-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100%; padding: 0 24px;
  padding-top: max(env(safe-area-inset-top), 20px);
  padding-bottom: max(env(safe-area-inset-bottom), 24px);
  overflow-y: auto;
}

.player-topbar {
  display: flex; align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .08em; color: rgba(255,255,255,.7);
}

.player-art-wrap {
  display: flex; justify-content: center;
  margin: 0 0 28px;
}

.player-art {
  width: min(300px, 70vw);
  height: min(300px, 70vw);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}

.player-meta { text-align: center; margin-bottom: 24px; }

#full-show {
  font-size: 13px; color: rgba(255,255,255,.6);
  margin-bottom: 6px;
}

#full-title {
  font-size: 20px; font-weight: 700;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.player-seek { margin-bottom: 8px; }

#seek-wrap {
  position: relative; height: 5px;
  background: rgba(255,255,255,.2);
  border-radius: 3px; cursor: pointer;
  margin-bottom: 8px;
}

#seek-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: #fff; border-radius: 3px;
  pointer-events: none;
  transition: width .5s linear;
}

.seek-times {
  display: flex; justify-content: space-between;
  font-size: 12px; color: rgba(255,255,255,.5);
}

.player-ctl {
  display: flex; align-items: center;
  justify-content: center; gap: 28px;
  margin: 16px 0 24px;
}

.skip-btn {
  background: rgba(255,255,255,.12);
  border-radius: 50%; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
  transition: background .15s;
}

.skip-btn:active { background: rgba(255,255,255,.22); }

.pp-btn {
  background: #fff;
  border-radius: 50%; width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  color: var(--bg);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: transform .1s;
}

.pp-btn:active { transform: scale(.95); }

.player-extras {
  display: flex; gap: 8px;
  justify-content: space-around;
  flex-wrap: wrap;
}

.ex-btn {
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
  padding: 10px 14px;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  font-size: 11px; color: rgba(255,255,255,.8);
  font-weight: 600; flex: 1;
  transition: background .15s;
  min-width: 60px;
}

.ex-btn:active { background: rgba(255,255,255,.18); }
.ex-btn .speed-label { font-size: 14px; font-weight: 700; }

/* ── Page header ─────────────────────────────────── */
.ph { padding: 16px 20px 8px; }

.ph-row {
  display: flex; align-items: flex-start;
  justify-content: space-between;
}

.ph-title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.ph-sub   { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* ── View animation ──────────────────────────────── */
#view.fade { animation: fadeIn .2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Sections ────────────────────────────────────── */
.sec { padding: 0 0 24px; }

.sec-hd {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px;
}

.sec-title { font-size: 17px; font-weight: 700; }

.sec-link {
  font-size: 13px; color: var(--accent);
  background: none; border: none;
  cursor: pointer; font-weight: 600;
}

.sec-label-row {
  padding: 4px 20px 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--text3);
}

/* ── Horizontal scroll strip ─────────────────────── */
.h-scroll {
  display: flex; gap: 12px;
  overflow-x: auto; overflow-y: visible;
  padding: 0 20px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.h-scroll::-webkit-scrollbar { display: none; }

/* ── Podcast grid ────────────────────────────────── */
.pod-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px; padding: 0 20px 24px;
}

@media (min-width: 768px) {
  .pod-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1100px) {
  .pod-grid { grid-template-columns: repeat(5, 1fr); }
}

.pod-card {
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: transform .15s;
}

.pod-card:active { transform: scale(.96); }

.pod-art {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.pod-art-ph {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--surf3);
  align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 6px;
}

.pod-name {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

.pod-cnt { font-size: 11px; color: var(--text3); }

/* ── Continue listening cards ─────────────────────── */
.cont-card {
  flex-shrink: 0;
  width: 280px;
  display: flex; align-items: center; gap: 10px;
  background: var(--surf);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: background .15s;
}

.cont-card:active { background: var(--surf2); }

.cont-art {
  width: 52px; height: 52px;
  border-radius: 6px; flex-shrink: 0;
}

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

.cont-pod {
  font-size: 11px; color: var(--text2);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

.cont-title {
  font-size: 13px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin: 2px 0 6px;
}

.cont-bar {
  height: 3px; background: var(--surf3);
  border-radius: 2px; overflow: hidden;
}

.cont-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.cont-left { font-size: 11px; color: var(--text2); margin-top: 4px; }

.cont-play {
  width: 36px; height: 36px;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Episode list ────────────────────────────────── */
.ep-list { padding: 0 0 24px; }

.ep-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.ep-row:active { background: var(--surf2); }
.ep-row.now-playing { background: var(--accent-bg); }

.ep-art {
  width: 44px; height: 44px;
  border-radius: 6px; flex-shrink: 0;
}

.ep-body { flex: 1; min-width: 0; cursor: pointer; }

.ep-show {
  font-size: 11px; color: var(--accent);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 2px;
}

.ep-title {
  font-size: 14px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
}

.ep-meta {
  display: flex; align-items: center;
  flex-wrap: wrap; gap: 4px;
  font-size: 12px; color: var(--text2);
}

.pct-lbl  { color: var(--accent); font-weight: 600; }

.done-badge {
  background: var(--green); color: #000;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
}

.new-badge {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
}

.ep-prog {
  height: 3px; background: var(--surf3);
  border-radius: 2px; overflow: hidden;
  margin-top: 6px;
}

.ep-prog-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px;
}

.ep-acts {
  display: flex; flex-direction: column;
  gap: 4px; flex-shrink: 0;
}

/* ── Queue rows ──────────────────────────────────── */
.q-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.q-art  {
  width: 44px; height: 44px;
  border-radius: 6px; flex-shrink: 0;
}

.q-info { flex: 1; min-width: 0; cursor: pointer; }
.q-pod  { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-dur  { font-size: 12px; color: var(--text3); margin-top: 2px; }

.now-wrap { padding: 12px 20px; }
.now-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--text3); margin-bottom: 8px; }

.q-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; padding: 48px 20px;
  text-align: center;
}

.q-empty-icon { font-size: 48px; }

/* ── Playlist cards ──────────────────────────────── */
.pl-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--surf2); border-radius: var(--radius);
  margin-bottom: 8px; cursor: pointer;
  transition: background .15s;
}

.pl-card:active { background: var(--surf3); }

.pl-icon { font-size: 24px; }
.pl-info { flex: 1; min-width: 0; }
.pl-name { font-size: 15px; font-weight: 600; }
.pl-cnt  { font-size: 12px; color: var(--text2); }

/* ── Podcast detail ──────────────────────────────── */
.det-hd { padding: 16px 20px 0; }

.det-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; color: var(--accent); font-weight: 600;
  cursor: pointer; margin-bottom: 16px;
  background: none; border: none;
}

.det-hero {
  display: flex; gap: 16px; margin-bottom: 16px;
}

.det-art {
  width: 100px; height: 100px;
  border-radius: 10px; flex-shrink: 0;
}

.det-meta { flex: 1; min-width: 0; }
.det-title  { font-size: 17px; font-weight: 800; line-height: 1.3; margin-bottom: 4px; }
.det-author { font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.det-count  { font-size: 12px; color: var(--text3); }

.det-speed-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 12px; color: var(--text2);
}

.det-speed-lbl { white-space: nowrap; }

.speed-chip {
  padding: 3px 10px;
  background: var(--surf3); border-radius: 20px;
  font-size: 12px; font-weight: 700; color: var(--teal);
  cursor: pointer;
  transition: background .15s;
}

.speed-chip:hover { background: var(--surf2); }

.det-desc {
  font-size: 13px; color: var(--text2); line-height: 1.6;
  max-height: 56px; overflow: hidden;
  transition: max-height .25s ease;
}

.det-desc.open { max-height: 800px; }

.det-desc-btn {
  font-size: 13px; color: var(--accent);
  font-weight: 600; padding: 4px 0 12px;
  background: none; border: none; cursor: pointer;
}

.det-btns {
  display: flex; gap: 10px; padding: 12px 0 16px;
}

/* ── Chips / filter ──────────────────────────────── */
.chips {
  display: flex; gap: 8px;
  padding: 0 20px 16px;
  overflow-x: auto; scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 6px 14px;
  background: var(--surf2); border-radius: 20px;
  font-size: 13px; font-weight: 600;
  color: var(--text2); cursor: pointer;
  transition: background .15s, color .15s;
}

.chip.on {
  background: var(--accent);
  color: #fff;
}

/* ── Discovery ───────────────────────────────────── */
.disc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

/* ── Search bar ──────────────────────────────────── */
.search-wrap {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 20px 12px;
  background: var(--surf2); border-radius: var(--radius-sm);
  padding: 0 14px;
}

.search-wrap input {
  flex: 1; background: none; border: none;
  color: var(--text); padding: 12px 0;
  outline: none; font-size: 15px;
}

.search-wrap input::placeholder { color: var(--text3); }
.search-wrap svg { color: var(--text3); flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────── */
.ib {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--surf2); border-radius: 50%;
  color: var(--text2); border: none; cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.ib:active { background: var(--surf3); }

.ib-sm  { width: 28px; height: 28px; }
.ib-accent { background: var(--accent-bg); color: var(--accent); }
.ib-accent:active { background: var(--accent-dim); }

.btn-primary {
  flex: 1; padding: 12px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 700; border: none; cursor: pointer;
  transition: opacity .15s;
}

.btn-primary:active { opacity: .85; }

.btn-ghost {
  flex: 1; padding: 12px; border-radius: var(--radius-sm);
  background: var(--surf2); color: var(--text);
  font-size: 14px; font-weight: 700; border: none; cursor: pointer;
  transition: background .15s;
}

.btn-ghost:active { background: var(--surf3); }

.btn-accent-sm {
  padding: 8px 14px; border-radius: 20px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; border: none; cursor: pointer;
  white-space: nowrap; transition: opacity .15s;
}

.btn-accent-sm:active { opacity: .85; }

/* ── Profile / Settings ──────────────────────────── */
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surf2); border-radius: var(--radius);
  padding: 16px;
}

.profile-avatar {
  width: 52px; height: 52px;
  background: var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff; flex-shrink: 0;
}

.settings-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .08em; color: var(--text3);
  padding: 0 20px 8px;
}

.settings-group {
  margin: 0 20px;
  background: var(--surf2); border-radius: var(--radius);
  overflow: hidden;
}

.s-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}

.s-item:last-child { border-bottom: none; }
.s-item:active     { background: var(--surf3); }

.s-ico { font-size: 18px; width: 24px; text-align: center; flex-shrink: 0; }
.s-lbl { flex: 1; font-size: 14px; }
.s-val { font-size: 13px; color: var(--text3); }

/* ── Bottom sheets / overlays ────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  display: flex; align-items: flex-end;
}

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

.sheet {
  width: 100%;
  background: var(--surf2);
  border-radius: 16px 16px 0 0;
  padding: 12px 20px max(24px, var(--safe-b)) 20px;
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.32,.72,0,1);
  max-height: 80dvh; overflow-y: auto;
}

.overlay.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 36px; height: 4px;
  background: var(--surf3); border-radius: 2px;
  margin: 0 auto 16px;
}

.sheet-title {
  font-size: 13px; font-weight: 700; color: var(--text2);
  margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.sheet-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity .1s;
}

.sheet-item:last-child { border-bottom: none; }
.sheet-item:active     { opacity: .7; }

.sheet-lbl { font-size: 16px; font-weight: 500; }

.sheet-selected { opacity: 1; }
.sheet-selected .sheet-lbl { color: var(--accent); }

/* ── Playlist picker input ───────────────────────── */
#pl-new-input {
  width: 100%; padding: 12px 14px;
  background: var(--surf3); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 15px; outline: none;
  margin-bottom: 10px;
}

#pl-new-input:focus { border-color: var(--accent); }

/* ── Loading / empty states ──────────────────────── */
.loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px;
  color: var(--text2); font-size: 14px;
}

.spin {
  width: 28px; height: 28px;
  border: 3px solid var(--surf3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 60px 24px;
  text-align: center; color: var(--text2);
  font-size: 15px;
}

.empty-icon { font-size: 48px; }
.empty-sub  { font-size: 13px; color: var(--text3); }

/* ── Toast ───────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--mini-h) + 12px + var(--safe-b));
  left: 50%; transform: translateX(-50%);
  z-index: 400;
  background: var(--surf);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  #toast {
    bottom: calc(var(--bar-h) + 16px);
  }
}
