/* Reel Queue — Liquid Glass edition
   iOS 26-style translucent glass on warm paper.
   Frosted layers, specular highlights, springy motion. */

:root {
  --paper: #FAF6EF;
  --ink: #211D17;
  --muted: #6F665B;
  --faint: #A89D8C;
  --coral: #E4573D;
  --coral-deep: #C2432A;
  --coral-soft: #FBE9E1;
  --moss: #3F7A4E;
  --moss-deep: #2F5C3B;
  --moss-soft: #E9F1E9;
  --amber: #B97F1F;
  --amber-soft: #F7EEDC;

  /* Liquid glass tokens — tuned for mobile perf */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-edge: rgba(33, 29, 23, 0.08);
  --glass-blur: blur(14px) saturate(160%);
  --glass-blur-sm: blur(10px) saturate(150%);
  --glass-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 8px 24px rgba(33, 29, 23, 0.08),
    0 2px 6px rgba(33, 29, 23, 0.05);
  --glass-shadow-lg:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 16px 40px rgba(33, 29, 23, 0.12),
    0 4px 12px rgba(33, 29, 23, 0.06);

  --radius: 20px;
  --radius-sm: 14px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;

  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --spring-bounce: cubic-bezier(0.34, 1.4, 0.4, 1);
}

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

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

body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 64px;
  -webkit-font-smoothing: antialiased;
  /* Golden-hour ambience: layered warm blooms on paper */
  background:
    radial-gradient(1200px 600px at 85% -5%, rgba(228, 87, 61, 0.08), transparent 60%),
    radial-gradient(900px 500px at 10% 10%, rgba(185, 127, 31, 0.07), transparent 60%),
    radial-gradient(1000px 700px at 50% 110%, rgba(63, 122, 78, 0.06), transparent 60%),
    var(--paper);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Floating aurora orbs — static on mobile (perf), gentle drift on desktop */
.orb {
  position: fixed; border-radius: 50%;
  filter: blur(60px);
  pointer-events: none; z-index: 0;
  opacity: 0.45;
}
.orb-1 {
  width: 300px; height: 300px; top: -80px; right: -60px;
  background: radial-gradient(circle, rgba(228, 87, 61, 0.25), transparent 70%);
}
.orb-2 {
  width: 260px; height: 260px; top: 35%; left: -80px;
  background: radial-gradient(circle, rgba(185, 127, 31, 0.2), transparent 70%);
}
.orb-3 {
  width: 240px; height: 240px; bottom: -50px; right: 10%;
  background: radial-gradient(circle, rgba(63, 122, 78, 0.16), transparent 70%);
}
@media (min-width: 760px) and (prefers-reduced-motion: no-preference) {
  .orb { animation: orbDrift 22s ease-in-out infinite alternate; }
  .orb-2 { animation-delay: -7s; animation-duration: 26s; }
  .orb-3 { animation-delay: -14s; animation-duration: 30s; }
}
@keyframes orbDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-36px, 28px) scale(1.12); }
  100% { transform: translate(28px, -24px) scale(0.94); }
}

/* Film grain for texture — desktop only (perf) */
@media (min-width: 760px) {
  body::after {
    content: "";
    position: fixed; inset: 0; z-index: 1;
    pointer-events: none; opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}
main, .topbar { position: relative; z-index: 2; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------- Floating glass header ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin: 12px 14px 0;
  padding: 10px 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  box-shadow: var(--glass-shadow);
  /* specular top light */
  background-image: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0) 40%);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wordmark svg { width: 32px; height: 32px; color: var(--coral); display: block; filter: drop-shadow(0 2px 6px rgba(228,87,61,0.35)); }
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: 0.1px; line-height: 1.1;
}
.brand-text p { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.goal-pill {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(247, 238, 220, 0.7);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  color: var(--amber);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 12px rgba(185,127,31,0.12);
  border-radius: 999px; padding: 7px 12px;
  font-size: 13px; font-weight: 700;
}
.goal-pill svg { width: 16px; height: 16px; }
.goal-pill .goal-label { font-weight: 500; font-size: 11px; opacity: 0.85; }
.goal-pill.is-full {
  background: rgba(63, 122, 78, 0.85);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

/* ---------- Layout ---------- */
main { max-width: 680px; margin: 0 auto; padding: 14px 14px 0; }

/* ---------- Glass composer ---------- */
.composer {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background-image: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0) 45%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 12px;
}
.composer-row { display: flex; gap: 8px; align-items: stretch; }
.input-wrap {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center;
}
.input-icon {
  position: absolute; left: 11px;
  width: 17px; height: 17px; color: var(--faint);
  pointer-events: none; flex-shrink: 0;
}
#urlInput {
  width: 100%;
  font: inherit; font-size: 14.5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 2px 8px rgba(33,29,23,0.05);
  border-radius: var(--radius-sm);
  padding: 11px 12px 11px 36px;
  outline: none;
  transition: border-color 0.2s var(--spring), box-shadow 0.2s var(--spring);
}
#urlInput::placeholder { color: var(--faint); }
#urlInput:focus {
  border-color: rgba(228, 87, 61, 0.55);
  box-shadow: 0 0 0 4px rgba(228, 87, 61, 0.12), 0 1px 0 rgba(255,255,255,0.5) inset;
  background: rgba(255, 255, 255, 0.75);
}
#urlInput[aria-invalid="true"] {
  border-color: rgba(194, 67, 42, 0.6);
  box-shadow: 0 0 0 4px rgba(228, 87, 61, 0.12);
}
.icon-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
  color: var(--muted); cursor: pointer;
  transition: transform 0.2s var(--spring), color 0.2s ease, box-shadow 0.2s ease;
}
.icon-btn:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--glass-shadow); }
.icon-btn:active { transform: scale(0.95); }
.icon-btn svg { width: 18px; height: 18px; }
.btn-primary {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(180deg, #EF6A4A, var(--coral-deep));
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 6px 16px rgba(228,87,61,0.35);
  border-radius: var(--radius-sm);
  padding: 0 18px; font: inherit; font-size: 14.5px; font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--spring), box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 8px 22px rgba(228,87,61,0.45); }
.btn-primary:active { transform: scale(0.96); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-primary svg { width: 16px; height: 16px; }
.composer-msg {
  font-size: 12.5px; margin-top: 8px; min-height: 0;
  color: var(--muted);
}
.composer-msg.is-error { color: var(--coral-deep); font-weight: 500; }
.composer-msg.is-ok { color: var(--moss-deep); font-weight: 500; }

/* ---------- Glass summary ---------- */
.summary {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  background-image: linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0) 50%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 14px 18px; margin-top: 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.stats-row {
  display: flex; align-items: center; gap: 14px;
}
.stat { display: flex; align-items: baseline; gap: 7px; }
.stat-num {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; line-height: 1;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-sep { width: 1px; align-self: stretch; background: linear-gradient(180deg, transparent, rgba(33,29,23,0.12), transparent); }
.goal-row {
  display: flex; align-items: center; gap: 10px;
}
.goal-row-label { font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.goal-row-count { font-size: 12px; font-weight: 700; color: var(--amber); white-space: nowrap; font-variant-numeric: tabular-nums; }
.goal-meter {
  flex: 1; min-width: 0;
  height: 10px;
  background: rgba(33, 29, 23, 0.08);
  box-shadow: 0 1px 2px rgba(33,29,23,0.08) inset;
  border-radius: 999px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
}
.goal-meter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #D89A2B, var(--amber));
  border-radius: 999px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset;
  transition: width 0.6s var(--spring);
}
.goal-meter-fill.is-full { background: linear-gradient(90deg, #4C8A5B, var(--moss)); }

/* ---------- Glass toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px;
}
.tabs {
  position: relative;
  display: flex; gap: 2px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 14px rgba(33,29,23,0.06);
  border-radius: 999px; padding: 4px;
}
.tab {
  position: relative; z-index: 1;
  border: none; background: none;
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted);
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  transition: color 0.25s var(--spring), transform 0.2s var(--spring);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
/* sliding liquid indicator */
.tabs::before {
  content: "";
  position: absolute; top: 4px; bottom: 4px; left: 4px;
  width: var(--tab-ind-w, 76px);
  transform: translateX(var(--tab-ind-x, 0px));
  background: linear-gradient(180deg, #3A342C, var(--ink));
  border: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 4px 12px rgba(33,29,23,0.3);
  border-radius: 999px;
  transition: transform 0.45s var(--spring-bounce), width 0.45s var(--spring);
}
.tab:active { transform: scale(0.96); }

.search-wrap {
  position: relative; flex: 1; min-width: 0; max-width: 220px;
  margin-left: auto;
  display: flex; align-items: center;
}
.search-wrap svg {
  position: absolute; left: 11px;
  width: 15px; height: 15px; color: var(--faint); pointer-events: none;
}
#searchInput {
  width: 100%;
  font: inherit; font-size: 13.5px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  color: var(--ink);
  border: 1px solid var(--glass-border);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
  border-radius: 999px;
  padding: 9px 12px 9px 34px; outline: none;
  transition: box-shadow 0.25s var(--spring), background 0.25s ease;
}
#searchInput::placeholder { color: var(--faint); }
#searchInput:focus {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(228, 87, 61, 0.12), 0 1px 0 rgba(255,255,255,0.6) inset;
}

/* ---------- Glass queue cards ---------- */
.queue { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.qitem {
  position: relative;
  /* perf: solid-ish glass, no per-card backdrop blur (50+ cards = jank) */
  background: linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  /* skip off-screen cards from layout/paint until near viewport */
  content-visibility: auto;
  contain-intrinsic-size: auto 110px;
  transition: transform 0.3s var(--spring), box-shadow 0.3s var(--spring), opacity 0.3s ease, border-color 0.3s ease;
}
/* shine sweep on hover */
.qitem::before {
  content: "";
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.35) 50%, transparent 60%);
  transform: translateX(-120%);
  pointer-events: none;
}
.qitem:hover::before {
  animation: shineSweep 0.9s var(--spring);
}
@keyframes shineSweep {
  to { transform: translateX(120%); }
}
/* staggered entrance */
.qitem.enter {
  animation: cardEnter 0.55s var(--spring-bounce) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.qitem:hover {
  transform: translateY(-2px);
  box-shadow: var(--glass-shadow-lg);
  border-color: rgba(255,255,255,0.85);
}
.qitem:active { transform: translateY(0) scale(0.995); }
.qitem.is-done { opacity: 0.68; }
.qitem.is-done:hover { opacity: 0.85; }
.qitem.is-new { animation: liquidIn 0.55s var(--spring-bounce); }
.qitem.is-leaving { opacity: 0; transform: translateX(40px) scale(0.97); }

@keyframes liquidIn {
  0% { opacity: 0; transform: translateY(-14px) scale(0.97); }
  60% { opacity: 1; transform: translateY(3px) scale(1.005); }
  100% { opacity: 1; transform: none; }
}

.qitem-head {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; font: inherit; text-align: left;
  padding: 13px 14px; cursor: pointer; color: var(--ink);
}
.thumb {
  flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(251,233,225,0.9), rgba(251,233,225,0.55));
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 10px rgba(228,87,61,0.12);
  color: var(--coral-deep);
}
.thumb svg { width: 21px; height: 21px; }
.thumb.has-cover { padding: 0; overflow: hidden; }
.thumb.has-cover img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.thumb.is-yt { background: linear-gradient(180deg, rgba(251,228,228,0.9), rgba(251,228,228,0.55)); color: #B3261E; }
.thumb.is-ig { background: linear-gradient(180deg, rgba(249,227,236,0.9), rgba(249,227,236,0.55)); color: #C13572; }
.thumb.is-done { background: linear-gradient(180deg, rgba(233,241,233,0.9), rgba(233,241,233,0.55)); color: var(--moss-deep); }

.qitem-meta { flex: 1; min-width: 0; }
.qitem-title {
  font-size: 14.5px; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.qitem-sub {
  font-size: 12px; color: var(--muted); margin-top: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.platform-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--coral-deep);
  background: rgba(251, 233, 225, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.6);
  padding: 2px 8px; border-radius: 999px;
}
.platform-tag.is-yt { color: #B3261E; background: rgba(251,228,228,0.65); }
.platform-tag.is-ig { color: #C13572; background: rgba(249,227,236,0.65); }
.custom-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  color: var(--moss-deep);
  background: rgba(233, 241, 233, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.6);
  padding: 2px 8px; border-radius: 999px;
}
.qitem-chev {
  flex-shrink: 0; color: var(--faint);
  transition: transform 0.35s var(--spring);
  display: inline-flex;
}
.qitem-chev svg { width: 18px; height: 18px; }
.qitem-head[aria-expanded="true"] .qitem-chev { transform: rotate(180deg); }

.done-check {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: var(--glass-blur-sm);
  -webkit-backdrop-filter: var(--glass-blur-sm);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
  color: var(--moss-deep); border-radius: 999px;
  font: inherit; font-size: 12.5px; font-weight: 700;
  padding: 8px 13px; cursor: pointer;
  transition: transform 0.2s var(--spring), background 0.25s ease, box-shadow 0.25s ease;
}
.done-check svg { width: 15px; height: 15px; }
.done-check:hover { background: rgba(233, 241, 233, 0.75); transform: translateY(-1px); box-shadow: var(--glass-shadow); }
.done-check:active { transform: scale(0.94); }
.done-check.is-done {
  background: linear-gradient(180deg, rgba(76,138,91,0.9), rgba(63,122,78,0.9));
  border-color: rgba(255,255,255,0.4);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.qitem-body {
  border-top: 1px solid rgba(255,255,255,0.6);
  background: rgba(255, 255, 255, 0.28);
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.audio-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
.audio-row svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--coral); }
.audio-row .audio-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.5); border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
  border-radius: 8px;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 10px; cursor: pointer;
  transition: transform 0.2s var(--spring), color 0.2s ease;
}
.mini-btn:hover { color: var(--ink); transform: translateY(-1px); }
.mini-btn:active { transform: scale(0.94); }
.mini-btn svg { width: 13px; height: 13px; }

.caption-box {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
  max-height: 132px; overflow-y: auto;
  color: var(--ink);
}
.qitem-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: var(--radius-sm);
  padding: 10px 15px;
  font: inherit; font-size: 13.5px; font-weight: 700;
  cursor: pointer; text-decoration: none; border: 1px solid transparent;
  transition: transform 0.18s var(--spring), box-shadow 0.25s ease, filter 0.2s ease;
}
.btn:active { transform: scale(0.96); }
.btn svg { width: 16px; height: 16px; }
.btn-download {
  background: linear-gradient(180deg, #3A342C, #161310);
  color: #FAF6EF;
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 16px rgba(33,29,23,0.3);
}
.btn-download:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn-copy {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink); border-color: rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 3px 10px rgba(33,29,23,0.08);
}
.btn-copy:hover { transform: translateY(-1px); box-shadow: var(--glass-shadow); }
.btn-song {
  background: linear-gradient(180deg, rgba(251,233,225,0.85), rgba(248,220,208,0.7));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--coral-deep);
  border-color: rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 3px 10px rgba(228,87,61,0.12);
}
.btn-song:hover { transform: translateY(-1px); }
.btn-done {
  background: linear-gradient(180deg, #4C8A5B, var(--moss-deep));
  color: #fff;
  border-color: rgba(255,255,255,0.35);
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 6px 16px rgba(63,122,78,0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.btn-done:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-undo {
  background: rgba(255,255,255,0.4); color: var(--muted);
  border-color: rgba(255,255,255,0.7); font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
}
.btn-undo:hover { color: var(--ink); transform: translateY(-1px); }
.btn-danger {
  background: rgba(255,255,255,0.4); color: var(--coral-deep);
  border-color: rgba(255,255,255,0.7); font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
}
.btn-danger:hover { border-color: rgba(228,87,61,0.5); background: rgba(251,233,225,0.6); }
.btn-danger.is-confirming {
  background: linear-gradient(180deg, #D6543A, var(--coral-deep));
  border-color: rgba(255,255,255,0.35); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.35) inset, 0 6px 16px rgba(228,87,61,0.35);
}
.btn-secondary {
  display: inline-flex; align-items: center;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
  border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; font-weight: 600;
  padding: 10px 17px; cursor: pointer;
  transition: transform 0.2s var(--spring), box-shadow 0.25s ease;
}
.btn-secondary:hover { transform: translateY(-1px); box-shadow: var(--glass-shadow); }
.btn-secondary:active { transform: scale(0.96); }

/* ---------- States ---------- */
.state-block {
  text-align: center; padding: 56px 24px;
  color: var(--muted);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.state-icon { width: 46px; height: 46px; color: var(--faint); margin-bottom: 12px; }
.state-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 600; color: var(--ink); margin-bottom: 6px;
}
.state-sub { font-size: 13.5px; max-width: 320px; margin: 0 auto 16px; }
.spinner {
  width: 36px; height: 36px; margin: 0 auto 14px;
  border: 3px solid rgba(33,29,23,0.1); border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ---------- Confetti canvas ---------- */
#confetti {
  position: fixed; inset: 0; z-index: 60;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* ---------- Celebration & micro-animations ---------- */
/* stat number pop when it changes */
.stat-num.tick { animation: numPop 0.45s var(--spring-bounce); }
@keyframes numPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
/* goal pill celebration */
.goal-pill.celebrate { animation: pillGlow 1.2s var(--spring); }
@keyframes pillGlow {
  0%, 100% { box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 12px rgba(185,127,31,0.12); }
  30% { box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 0 28px rgba(63,122,78,0.55); transform: scale(1.08); }
  60% { transform: scale(0.97); }
}
/* done button satisfying pop */
.done-check.popping, .btn-done.popping { animation: btnPop 0.4s var(--spring-bounce); }
@keyframes btnPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
/* goal meter shimmer while filling */
.goal-meter-fill::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  animation: meterShimmer 2.4s ease-in-out infinite;
}
.goal-meter { position: relative; }
@keyframes meterShimmer {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}
/* header gentle lift on scroll */
.topbar.scrolled {
  box-shadow: var(--glass-shadow-lg);
  transform: translateY(1px);
}
/* composer focus glow pulse */
.composer:focus-within {
  animation: composerGlow 0.5s var(--spring);
  border-color: rgba(228, 87, 61, 0.4);
}
@keyframes composerGlow {
  0% { box-shadow: var(--glass-shadow); }
  50% { box-shadow: var(--glass-shadow-lg), 0 0 0 4px rgba(228,87,61,0.1); }
  100% { box-shadow: var(--glass-shadow); }
}
/* thumbnail subtle zoom on card hover */
.qitem:hover .thumb.has-cover img { transform: scale(1.06); }
.thumb.has-cover img { transition: transform 0.5s var(--spring); }

/* ---------- Footer / toast ---------- */
.foot { margin-top: 30px; text-align: center; }
.foot p { font-size: 12px; color: var(--faint); }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px) scale(0.95);
  background: rgba(33, 29, 23, 0.82);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 12px 32px rgba(33, 29, 23, 0.35);
  color: #FAF6EF;
  padding: 12px 20px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  z-index: 50; white-space: nowrap; max-width: calc(100vw - 32px);
  overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--spring), transform 0.3s var(--spring-bounce);
}
.toast:not(.hidden) { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .topbar { margin: 10px 10px 0; border-radius: 20px; }
  main { padding: 12px 10px 0; }
  .brand-text p { display: none; }
  .brand-text h1 { font-size: 18px; }
  .toolbar { flex-wrap: wrap; }
  .search-wrap { max-width: none; flex-basis: 100%; order: 3; }
  .btn-primary { padding: 0 14px; }
  .btn-primary span { display: none; }
  .btn-primary svg { width: 18px; height: 18px; }
  .summary { gap: 10px; padding: 12px 14px; }
  .stats-row { gap: 10px; }
  .stat-num { font-size: 22px; }
  .qitem-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
}

@media (min-width: 760px) {
  main { padding-top: 20px; }
  .topbar { margin: 14px auto 0; max-width: 680px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .spinner { animation: spin 1.2s linear infinite; }
  .tabs::before { transition: none; }
  .orb { display: none; }
  .qitem::before, .goal-meter-fill::after { display: none; }
}

@media (max-width: 759px) {
  /* mobile perf: no shine sweep, shorter entrances */
  .qitem::before { display: none; }
  .qitem.enter { animation-duration: 0.35s; }
  .goal-meter-fill::after { display: none; }
}

/* ---------- Backdrop-filter fallback ---------- */
@supports not (backdrop-filter: blur(1px)) {
  .topbar, .composer, .summary, .qitem, .state-block { background: rgba(255, 255, 255, 0.92); }
  .tabs, .icon-btn, #urlInput, #searchInput { background: rgba(255, 255, 255, 0.9); }
}
