/* Funlist — velvet screening-room palette; IMDb yellow is reserved for IMDb scores. */
:root {
  --bg: #1d1420;
  --bg-2: #261b29;
  --surface: #2e2231;
  --surface-2: #3a2c3d;
  --line: #4a394d;
  --text: #f4ebe7;
  --muted: #b6a3ad;
  --faint: #8a7682;
  --accent: #6fd3c1;          /* projector teal: primary actions, "seen" */
  --accent-ink: #0f2a26;
  --busy: #9db8ff;            /* in progress */
  --danger: #ff8f8f;
  --imdb: #f5c518;
  --imdb-ink: #1a1400;
  --star: #ffd08a;
  --shadow: 0 18px 50px -18px rgba(5, 0, 8, .7);
  --radius-poster: 10px;
  --radius-ui: 12px;
  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f1f3; --bg-2: #efe7eb; --surface: #ffffff; --surface-2: #f3ecef; --line: #e2d6dc;
    --text: #2a1c2d; --muted: #6d5a66; --faint: #9a8792;
    --accent: #137a6c; --accent-ink: #ffffff; --busy: #3b5fc0; --danger: #c43c3c;
    --star: #d48a12; --shadow: 0 18px 40px -20px rgba(60, 20, 50, .35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f6f1f3; --bg-2: #efe7eb; --surface: #ffffff; --surface-2: #f3ecef; --line: #e2d6dc;
  --text: #2a1c2d; --muted: #6d5a66; --faint: #9a8792;
  --accent: #137a6c; --accent-ink: #ffffff; --busy: #3b5fc0; --danger: #c43c3c;
  --star: #d48a12; --shadow: 0 18px 40px -20px rgba(60, 20, 50, .35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- wordmark ---------- */
.wordmark {
  font: 800 26px/1 var(--font-display);
  font-variation-settings: "opsz" 96;
  letter-spacing: -.035em; text-decoration: none; color: var(--text);
}
.wordmark--big { font-size: clamp(56px, 12vw, 96px); margin: 0 0 8px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; white-space: nowrap; background: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.07); }
.btn--ghost { border-color: var(--line); color: var(--text); }
.btn--ghost:hover { background: var(--surface); }
.btn--danger-ghost { color: var(--danger); padding: 0 8px; }
.btn--danger-ghost:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn--wide { width: 100%; height: 46px; font-size: 15px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: none; color: var(--muted);
}
.icon-btn:hover { background: var(--surface); color: var(--text); }

/* ---------- login ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--imdb) 7%, transparent), transparent 60%),
    var(--bg);
}
.login-form { width: min(380px, 100%); display: grid; gap: 14px; }
.login-sub { margin: 0 0 18px; color: var(--muted); font-size: 16px; max-width: 32ch; }

/* ---------- fields ---------- */
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0; }
.field input, .field textarea, .select select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
.field input:focus, .field textarea:focus, .select select:focus { border-color: var(--accent); background: var(--surface); }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1 1 0; }
.field-row > .field--grow { flex: 2.2 1 0; }
.form-error { margin: 0; color: var(--danger); font-size: 14px; font-weight: 500; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.topbar-inner {
  display: flex; align-items: center; gap: 14px; max-width: 1480px; margin: 0 auto;
  padding: 12px var(--gutter); padding-top: max(12px, env(safe-area-inset-top));
}
.search {
  flex: 1; max-width: 520px; margin-left: auto; position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 13px; color: var(--faint); width: 18px; height: 18px; pointer-events: none; }
.search input {
  width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-2); padding: 0 40px 0 40px; outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); }
.search kbd {
  position: absolute; right: 12px; font: 600 11px/1 var(--font-ui); color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 3px 6px;
}
.search input:focus + kbd, .search input:not(:placeholder-shown) + kbd { display: none; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 46px; min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  display: grid;
}
.menu-pop a, .menu-pop button {
  text-align: left; padding: 10px 12px; border-radius: 8px; border: 0; background: none;
  text-decoration: none; font-size: 14px;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-note { margin: 4px 12px 6px; font-size: 12px; color: var(--faint); }

/* ---------- shelves (big type tabs) ---------- */
.shelves {
  display: flex; gap: clamp(18px, 4vw, 44px); align-items: baseline; flex-wrap: wrap;
  max-width: 1480px; margin: 0 auto; padding: clamp(20px, 4vw, 40px) var(--gutter) 6px;
}
.shelf-tab {
  font: 700 clamp(34px, 6.4vw, 72px)/1 var(--font-display);
  font-variation-settings: "opsz" 96;
  letter-spacing: -.04em; text-decoration: none; color: var(--faint);
  transition: color .2s;
  position: relative; padding-bottom: 8px;
}
.shelf-tab:hover { color: var(--muted); }
.shelf-tab[aria-current="page"] { color: var(--text); }
.shelf-tab[aria-current="page"]::after {
  content: ""; position: absolute; left: 2px; right: 0; bottom: 0; height: 4px; border-radius: 4px;
  background: var(--accent);
}
.shelf-tab sup {
  font: 600 clamp(12px, 1.3vw, 15px)/1 var(--font-ui); letter-spacing: 0;
  vertical-align: top; margin-left: 4px; position: relative; top: .5em; color: var(--faint);
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  max-width: 1480px; margin: 0 auto; padding: 18px var(--gutter) 6px;
}
.toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.seg {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line); flex-wrap: wrap;
}
.seg button {
  border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--text); }
.seg button[aria-checked="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.seg button .n { font-weight: 500; color: var(--faint); font-size: 12.5px; }
.seg--icons button { padding: 0 9px; }
.seg--icons svg { width: 18px; height: 18px; }
.select select {
  height: 40px; border-radius: 999px; padding: 0 34px 0 14px; appearance: none; font-weight: 600; font-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23998894' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
.summary { max-width: 1480px; margin: 0 auto; padding: 6px var(--gutter) 0; color: var(--faint); font-size: 13.5px; min-height: 26px; }

/* ---------- grid of posters ---------- */
.grid {
  max-width: 1480px; margin: 0 auto; padding: 14px var(--gutter) 80px;
  display: grid; gap: 28px 20px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); } }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 20px 10px; } }

.card { display: grid; gap: 9px; align-content: start; text-align: left; border: 0; background: none; padding: 0; color: inherit; }
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--radius-poster); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .25s cubic-bezier(.2,.7,.2,1), box-shadow .25s;
}
.card:hover .poster { transform: translateY(-4px); }
.card:focus-visible { outline: none; }
.card:focus-visible .poster { outline: 3px solid var(--accent); outline-offset: 3px; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card[data-status="todo"] .poster img { filter: saturate(.92); }

/* Placeholder cover: the title set as type on a tinted ground. */
.ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px; color: #fff;
  background: linear-gradient(160deg, hsl(var(--h) 45% 38%), hsl(calc(var(--h) + 40) 50% 20%));
}
.ph b { font: 700 clamp(15px, 1.6vw, 20px)/1.05 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.ph small { font-size: 11.5px; opacity: .8; }

.badge-imdb {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px;
  background: var(--imdb); color: var(--imdb-ink); border-radius: 6px; padding: 3px 6px 3px 5px;
  font: 800 13px/1 var(--font-ui); box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.badge-imdb i { font: 900 8.5px/1 var(--font-ui); font-style: normal; letter-spacing: .02em; background: var(--imdb-ink); color: var(--imdb); padding: 2px 3px; border-radius: 3px; }
.status-dot {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.status-dot svg { width: 15px; height: 15px; stroke-width: 2.6; }
.status-dot--done { background: var(--accent); color: var(--accent-ink); }
.status-dot--busy { background: var(--busy); color: #10183a; }
.card-title {
  font-weight: 650; font-size: 14.5px; line-height: 1.25; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { font-size: 12.5px; color: var(--faint); margin-top: -5px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-meta .stars { font-size: 11px; }

/* ---------- list view ---------- */
.list { max-width: 1480px; margin: 0 auto; padding: 8px var(--gutter) 80px; display: grid; }
.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 90px 70px 110px 90px; gap: 16px; align-items: center;
  padding: 9px 10px; border-radius: 10px; border: 0; background: none; text-align: left; color: inherit;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
}
.row:hover { background: var(--bg-2); }
.row .thumb { width: 44px; aspect-ratio: 2/3; border-radius: 5px; overflow: hidden; position: relative; background: var(--surface); }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb .ph { padding: 4px; }
.row .thumb .ph b, .row .thumb .ph small { display: none; }
.row-title b { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title span { font-size: 13px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.row .muted { color: var(--muted); font-size: 14px; }
.imdb-inline { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.imdb-inline i { font: 900 8.5px/1 var(--font-ui); font-style: normal; background: var(--imdb); color: var(--imdb-ink); padding: 3px 4px; border-radius: 3px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); }
.pill--done { color: var(--accent); } .pill--done::before { background: var(--accent); border-color: var(--accent); }
.pill--busy { color: var(--busy); } .pill--busy::before { background: var(--busy); border-color: var(--busy); }
@media (max-width: 760px) {
  .row { grid-template-columns: 40px minmax(0, 1fr) 60px; gap: 12px; }
  .row .hide-sm { display: none; }
}

/* ---------- empty state ---------- */
.empty { grid-column: 1 / -1; padding: 60px 0; max-width: 46ch; }
.empty h3 { font: 700 26px/1.15 var(--font-display); letter-spacing: -.02em; margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---------- stars ---------- */
.stars { display: inline-flex; gap: 1px; color: var(--star); letter-spacing: 1px; }
.stars--input { gap: 4px; }
.stars--input button {
  border: 0; background: none; padding: 2px; color: var(--line); font-size: 26px; line-height: 1;
  transition: transform .12s, color .12s;
}
.stars--input button.on { color: var(--star); }
.stars--input button:hover { transform: scale(1.15); }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(8, 2, 10, .55); opacity: 0; transition: opacity .25s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--bg-2); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  overflow-y: auto; overscroll-behavior: contain; outline: none;
}
.drawer[aria-hidden="false"] { pointer-events: auto; }
.drawer[aria-hidden="false"] .drawer-scrim { opacity: 1; }
.drawer[aria-hidden="false"] .drawer-panel { transform: none; }
.drawer-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(6px); }

.d-hero { position: relative; padding: 28px 28px 0; display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: end; overflow: hidden; }
.d-hero-bg {
  position: absolute; inset: 0 0 30% 0; background-size: cover; background-position: center 25%;
  filter: blur(40px) saturate(1.4); opacity: .45; transform: scale(1.3);
  mask-image: linear-gradient(#000 30%, transparent);
  -webkit-mask-image: linear-gradient(#000 30%, transparent);
}
.d-cover { position: relative; aspect-ratio: 2/3; border-radius: var(--radius-poster); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.d-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.d-head { position: relative; padding-bottom: 4px; min-width: 0; }
.d-type { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.d-title { font: 750 clamp(26px, 4.2vw, 34px)/1.04 var(--font-display); letter-spacing: -.03em; margin: 0 0 8px; overflow-wrap: anywhere; }
.d-creator { margin: 0; color: var(--muted); font-size: 14px; }
.d-section { padding: 22px 28px 0; }
.d-section:last-child { padding-bottom: 32px; }
.d-label { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }

.imdb-score {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-ui);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none;
}
a.imdb-score:hover { border-color: var(--imdb); }
.imdb-logo { background: var(--imdb); color: var(--imdb-ink); font: 900 15px/1 var(--font-ui); padding: 6px 7px; border-radius: 5px; letter-spacing: -.02em; }
.imdb-num { font: 750 30px/1 var(--font-display); letter-spacing: -.02em; }
.imdb-num small { font: 500 14px var(--font-ui); color: var(--faint); letter-spacing: 0; }
.imdb-votes { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--faint); line-height: 1.35; }

.season-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.season-picker button {
  min-width: 42px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: none; font-weight: 600; font-size: 13.5px; color: var(--muted);
}
.season-picker button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.season-picker button.add { border-style: dashed; color: var(--faint); }
.d-notes {
  width: 100%; min-height: 96px; resize: vertical; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-ui); padding: 12px 14px; line-height: 1.5; outline: none;
}
.d-notes:focus { border-color: var(--accent); }
.d-link { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.d-link:hover { text-decoration: underline; }
.d-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.d-foot { font-size: 12.5px; color: var(--faint); }

@media (max-width: 640px) {
  .drawer-panel { top: auto; height: 92dvh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; transform: translateY(100%); }
  .d-hero { grid-template-columns: 112px 1fr; padding: 24px 20px 0; gap: 16px; }
  .d-section { padding: 20px 20px 0; }
}

/* ---------- editor dialog ---------- */
.editor {
  width: min(720px, calc(100% - 24px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: 20px; background: var(--bg-2); color: var(--text);
  box-shadow: var(--shadow);
}
.editor::backdrop { background: rgba(8, 2, 10, .6); backdrop-filter: blur(3px); }
.editor[open] { animation: pop .22s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.editor-form { display: grid; gap: 18px; padding: 22px 24px 20px; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin: -4px -8px -6px 0; }
.editor-head h2 { margin: 0; font: 750 26px/1.1 var(--font-display); letter-spacing: -.03em; }
.seg--kind { justify-self: start; }

.lookup { display: grid; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.lookup-box { position: relative; }
.lookup .field input { background: var(--bg-2); }
.lookup-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.lookup-results li button {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 7px 8px; border: 0; border-radius: 10px; background: none; text-align: left;
}
.lookup-results li button:hover, .lookup-results li button:focus-visible, .lookup-results li button.picked { background: var(--surface-2); outline: none; }
.lookup-results li button.picked { box-shadow: inset 0 0 0 2px var(--accent); }
.lookup-results .lr-thumb { width: 40px; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; background: var(--bg-2); }
.lookup-results img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lookup-results b { display: block; font-weight: 650; line-height: 1.25; }
.lookup-results small { color: var(--faint); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lookup-hint { margin: 0; font-size: 13px; color: var(--faint); }
.lookup-hint:empty { display: none; }
.spinner {
  position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.edit-grid { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: start; }
.edit-cover { aspect-ratio: 2/3; border-radius: var(--radius-poster); overflow: hidden; position: relative; background: var(--surface); box-shadow: var(--shadow); }
.edit-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-fields { display: grid; gap: 14px; min-width: 0; }
.advanced summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.advanced[open] summary { margin-bottom: 12px; }
.editor-foot { display: flex; gap: 10px; align-items: center; padding-top: 4px; }
.spacer { flex: 1; }
@media (max-width: 560px) {
  .editor { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .editor-form { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); }
  .edit-grid { grid-template-columns: 84px 1fr; gap: 14px; }
  .field-row { flex-wrap: wrap; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow); transition: transform .25s, opacity .25s;
  display: flex; gap: 14px; align-items: center; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast button { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0; filter: brightness(.8); }

/* "Pick one for me": the chosen card lifts out of the wall. */
.card.picked .poster { animation: picked 1.4s cubic-bezier(.2,.8,.2,1); }
@keyframes picked {
  0% { transform: scale(1); box-shadow: var(--shadow); }
  30% { transform: scale(1.08) rotate(-1.5deg); box-shadow: 0 0 0 4px var(--accent), var(--shadow); }
  100% { transform: scale(1); box-shadow: var(--shadow); }
}

/* ---------- responsive top bar ---------- */
@media (max-width: 680px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search kbd { display: none; }
  #add-btn { margin-left: auto; }
  #add-btn span { display: none; }
  #add-btn { width: 40px; padding: 0; }
  #surprise-btn span { display: none; }
  #surprise-btn { width: 40px; padding: 0; }
  .toolbar { gap: 10px; }
  .seg button { padding: 0 11px; font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.field > .seg { justify-self: start; }
@media (max-width: 520px) {
  .shelves { flex-wrap: nowrap; gap: 14px; overflow-x: auto; scrollbar-width: none; padding-top: 18px; }
  .shelf-tab { font-size: min(8.2vw, 40px); }
  .shelf-tab sup { font-size: 11px; margin-left: 2px; }
  .shelf-tab[aria-current="page"]::after { height: 3px; }
}
