:root {
  --bg: #141110;
  --surface: #201a17;
  --surface-2: #2a2320;
  --text: #ede7df;
  --muted: #a39a91;
  --accent: #e8a13d;
  --accent-dim: #8a6224;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
}

body { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.tabs { display: flex; gap: 6px; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; padding: 8px 12px; border-radius: 999px;
}
.tab.active { background: var(--surface-2); color: var(--text); }

/* ---------- layout ---------- */
.view { padding: 8px 16px 24px; max-width: 720px; margin: 0 auto; }
.section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin: 18px 0 10px;
}
.empty { color: var(--muted); padding: 24px 0; line-height: 1.5; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.grid-item { text-align: left; border: 0; background: none; color: inherit; font: inherit; }
.grid-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--radius); background: var(--surface);
}
.grid-item .g-title {
  font-size: 12px; font-weight: 600; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.resume-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.resume-row::-webkit-scrollbar { display: none; }
.resume-card {
  flex: 0 0 220px; display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 0; color: inherit; font: inherit;
  border-radius: var(--radius); padding: 10px; text-align: left;
}
.resume-card img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.resume-card .r-title {
  font-size: 13px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.resume-card .r-left { font-size: 11px; color: var(--accent); font-family: var(--mono); margin-top: 2px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 12px 0; border: 0; background: none; color: inherit; font: inherit;
  text-align: left; border-bottom: 1px solid var(--surface-2);
}
.row img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface); }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title {
  font-weight: 600; font-size: 15px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row .r-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.row .r-sub .done { color: var(--accent); }
.row-progress {
  height: 3px; border-radius: 2px; background: var(--surface-2);
  margin-top: 7px; overflow: hidden;
}
.row-progress > div { height: 100%; background: var(--accent); }

.podcast-header { display: flex; gap: 16px; align-items: center; margin: 8px 0 4px; }
.podcast-header img { width: 88px; height: 88px; border-radius: var(--radius); object-fit: cover; }
.podcast-header h2 { font-size: 19px; letter-spacing: -0.3px; }
.podcast-header .ph-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.podcast-header .unsub { margin-top: 8px; }

/* ---------- buttons ---------- */
.solid-btn {
  background: var(--accent); color: #1a1206; border: 0; font: inherit;
  font-weight: 700; padding: 10px 18px; border-radius: 999px;
}
.ghost-btn {
  background: none; border: 0; color: var(--accent); font: inherit;
  font-weight: 600; padding: 10px 0; display: block;
}
.pill-btn {
  background: var(--surface-2); color: var(--text); border: 0; font: inherit;
  font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px;
}
.pill-btn.on { background: var(--accent); color: #1a1206; }

.search-bar { display: flex; gap: 8px; margin: 8px 0 16px; }
.search-bar input {
  flex: 1; background: var(--surface); border: 1px solid var(--surface-2);
  color: var(--text); font: inherit; padding: 11px 14px; border-radius: 12px;
}
.search-bar input:focus { outline: 2px solid var(--accent-dim); }

/* ---------- mini player ---------- */
.mini-player {
  position: fixed; left: 10px; right: 10px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 16px;
  padding: 10px 12px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  overflow: hidden; z-index: 10;
}
.mini-art { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; }
.mini-meta { flex: 1; min-width: 0; }
.mini-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-show { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); width: 0%; }

.play-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--accent); color: #1a1206; font-size: 18px;
  display: grid; place-items: center; flex-shrink: 0;
}
.play-btn.big { width: 76px; height: 76px; font-size: 28px; }
.skip-btn {
  background: none; border: 0; color: var(--text); font: inherit;
  font-weight: 700; font-size: 16px; padding: 14px;
}

/* ---------- now playing sheet ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  padding: calc(14px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto;
}
.sheet .ghost-btn { align-self: flex-start; }
.np-art {
  width: min(78vw, 340px); aspect-ratio: 1; object-fit: cover;
  border-radius: 20px; margin: 14px 0 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  background: var(--surface);
}
.np-title { font-size: 18px; font-weight: 700; text-align: center; line-height: 1.35; letter-spacing: -0.2px; }
.np-show { color: var(--muted); font-size: 14px; margin-top: 6px; text-align: center; }

/* Signature: oversized amber scrubber, thumb-friendly */
.scrubber-wrap { width: 100%; max-width: 420px; margin: 26px 0 6px; }
.scrubber { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; }
.scrubber::-webkit-slider-runnable-track {
  height: 14px; border-radius: 7px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 0%), var(--surface-2) var(--fill, 0%));
}
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -6px;
  border-radius: 50%; background: var(--text); border: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.scrubber::-moz-range-track { height: 14px; border-radius: 7px; background: var(--surface-2); }
.scrubber::-moz-range-progress { height: 14px; border-radius: 7px; background: var(--accent); }
.scrubber::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--text); border: 0; }
.times { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); }

.np-controls { display: flex; align-items: center; gap: 26px; margin: 18px 0 8px; }
.np-extras { display: flex; gap: 12px; margin-top: 14px; }

button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise .22s ease-out; }
  @keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}
