/* Stackarr — media-library request UI.
   Dark by default; [data-theme="light"] flips tokens. Accent injected as --accent. */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* the HTML hidden attr must win over display rules */
:root {
  --bg: #0b1120; --bg2: #111c34; --bg3: #1e293b; --bg4: #334155;
  --text: #f1f5fb; --subtle: #aab6c9; --line: #2a374f;
  --radius: 12px; --shadow: 0 10px 30px rgba(0,0,0,.45);
  --accent2: #f0b27a;
}
body[data-theme="light"] {
  --bg: #eef2f7; --bg2: #ffffff; --bg3: #f1f5f9; --bg4: #e2e8f0;
  --text: #0f172a; --subtle: #475569; --line: #d8dee8;
  --shadow: 0 8px 24px rgba(15,23,42,.12);
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 15.5px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
}
body:not([data-theme="light"]) {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(217,140,63,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(94,234,212,.06), transparent 60%),
    var(--bg);
}
a { color: inherit; }

/* ---------- subtle navigation animations ---------- */
@media (prefers-reduced-motion: no-preference) {
  main { animation: pageIn .32s ease both; }
  @keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  .section { animation: sectionIn .4s ease both; }
  .section:nth-child(2) { animation-delay: .04s; } .section:nth-child(3) { animation-delay: .08s; }
  .section:nth-child(4) { animation-delay: .12s; } .section:nth-child(5) { animation-delay: .16s; }
  @keyframes sectionIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  .media-card { animation: cardIn .35s ease both; }
  @keyframes cardIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
  .navlink, .btn, .corner-badge, .media-overlay { transition: all .18s ease; }
}

/* ---------- sidebar ---------- */
.sidebar {
  width: 232px; flex-shrink: 0; padding: 16px 12px; display: flex; flex-direction: column; gap: 3px;
  background: linear-gradient(180deg, var(--bg2), var(--bg)); border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 10px 12px 18px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.navlink {
  position: relative; display: flex; align-items: center; gap: 13px; padding: 12px 13px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; background: none; border: none;
  cursor: pointer; width: 100%; transition: background .15s, color .15s;
}
.navlink:not(.active) { color: var(--subtle); }
.navlink svg { width: 21px; height: 21px; fill: currentColor; flex-shrink: 0; }
.navlink:hover { color: var(--text); background: var(--bg3); }
.navlink.active { color: #fff; background: linear-gradient(90deg, rgba(217,140,63,.22), rgba(217,140,63,.04)); }
body[data-theme="light"] .navlink.active { color: var(--text); }
.navlink.active::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 3px; background: var(--accent); }
.version-tag { font-size: 10.5px; color: var(--subtle); padding: 8px 13px 4px; opacity: .7; }
.nav-collapse { margin-left: auto; background: none; border: none; color: var(--subtle); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.nav-collapse:hover { color: var(--text); background: var(--bg3); }
body.nav-collapsed .sidebar { width: 66px; }
body.nav-collapsed .navlink span, body.nav-collapsed .brand span, body.nav-collapsed .version-tag, body.nav-collapsed .nav-collapse { display: none; }
body.nav-collapsed .navlink { justify-content: center; }
body.nav-collapsed .brand { justify-content: center; padding: 10px 0 18px; }
/* genre chips + author links */
.genre-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 24px; }
.genre-chip { background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 7px 15px; font-size: 14px; text-decoration: none; color: var(--text); transition: background .15s; }
.genre-chip:hover { background: var(--accent); color: #1a0f02; border-color: var(--accent); }
.author-link { color: var(--accent); text-decoration: none; }
.author-link:hover { text-decoration: underline; }
/* genre cards: same size as book cards, black bg, clean centered text */
.genre-card .genre-poster { background: #0a0a0a; display: grid; place-items: center; padding: 16px; }
.genre-card-label { color: #fff; font-weight: 700; font-size: 17px; text-align: center; line-height: 1.3; letter-spacing: .01em; }
.genre-card:hover .genre-poster { box-shadow: inset 0 0 0 2px var(--accent); }
.logout-form { margin-top: auto; }

/* ---------- shell + top bar ---------- */
.shell { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 14px;
  padding: 12px clamp(14px,3vw,36px); background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px; transition: border-color .15s; }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 19px; height: 19px; fill: var(--subtle); }
.search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 15px; }
.search { position: relative; }
.search-suggest { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; display: none; }
.search-suggest.open { display: block; }
.ss-item { display: flex; align-items: center; gap: 11px; padding: 9px 13px; cursor: pointer; text-decoration: none; color: var(--text); }
.ss-item:hover, .ss-item.active { background: var(--bg3); }
.ss-item img { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; background: var(--bg3); flex: none; }
.ss-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-sub { font-size: 12px; color: var(--subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.icon-btn { background: var(--bg3); border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px;
  border-radius: 999px; cursor: pointer; font-size: 16px; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { fill: currentColor; }

main { padding: 18px clamp(14px,3vw,40px) 96px; max-width: 2400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 18px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-title .subtle { font-size: 13px; font-weight: 400; margin-left: 10px; }
.subtle { color: var(--subtle); }

/* ---------- sliders / sections ---------- */
.section { margin-bottom: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.section-head h3 { font-size: 17px; font-weight: 700; }
.section-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--text); }
.section-link .chev { color: var(--subtle); font-size: 22px; line-height: 1; transition: transform .15s, color .15s; }
.section-link:hover .chev { transform: translateX(3px); color: var(--accent); }
.section-link:hover h3 { color: var(--accent); }
.media-card { backface-visibility: hidden; }   /* keep posters crisp through hover transform */
.slider-wrap { position: relative; }
.slider { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(180px, 13vw, 260px); gap: 18px; overflow-x: auto;
  padding: 4px 2px 12px; scroll-snap-type: x proximity; scroll-behavior: smooth;
  scrollbar-width: none; -ms-overflow-style: none; }
.slider::-webkit-scrollbar { display: none; }            /* hide scrollbar, keep scroll */
.slider > * { scroll-snap-align: start; }
.slider-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25); cursor: pointer; z-index: 6; display: grid; place-items: center;
  font-size: 30px; line-height: 1; color: #fff; opacity: 0; transition: opacity .18s, background .15s;
  background: rgba(15,23,42,.82); backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.slider-arrow.right { right: 6px; } .slider-arrow.left { left: 6px; }
.slider-wrap:hover .slider-arrow { opacity: 1; }
.slider-arrow:hover { background: var(--accent); color: #1a0f02; border-color: var(--accent); }
@media (hover: none) { .slider-arrow { display: none; } }
@media (hover: none) { .slider-arrow { display: none; } }   /* touch devices just swipe */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 13vw, 260px), 1fr)); }

/* ---------- media card (the hover overlay is the centerpiece) ---------- */
.media-card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg2);
  box-shadow: 0 6px 18px rgba(0,0,0,.45); transition: transform .18s ease, box-shadow .18s ease;
  text-decoration: none; color: inherit; display: block; }
body[data-theme="light"] .media-card { box-shadow: 0 6px 18px rgba(15,23,42,.14); }
.media-card:hover { transform: translateY(-5px) scale(1.02); box-shadow: 0 18px 40px rgba(0,0,0,.6); }
body[data-theme="light"] .media-card:hover { box-shadow: 0 18px 38px rgba(15,23,42,.22); }
.media-poster { display: block; position: relative; aspect-ratio: 1; background: #000; }   /* block so aspect-ratio holds even when it's an <a> */
/* square covers fill the square box; only non-square covers get black bars (.letterbox, set by JS) */
.media-poster img { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.media-poster img.letterbox { object-fit: contain; }
/* status tags: translucent, blurred, soft border */
.corner-badge { position: absolute; top: 9px; right: 9px; z-index: 3; padding: 4px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #fff;
  background: rgba(217,140,63,.62); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.corner-badge.series { background: rgba(45,212,191,.55); }
.corner-badge.narrator { background: rgba(167,139,250,.55); }
.corner-badge.available { background: rgba(34,197,94,.55); }
.corner-badge.handed, .corner-badge.queued { background: rgba(245,158,11,.58); }
/* the semi-transparent hover overlay */
.media-overlay { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: flex-end;
  gap: 9px; padding: 14px; opacity: 0; transition: opacity .22s ease;
  background: linear-gradient(0deg, rgba(5,8,15,.97) 0%, rgba(5,8,15,.82) 34%, rgba(5,8,15,.30) 64%, rgba(5,8,15,0) 100%); }
.media-card:hover .media-overlay, .media-card:focus-within .media-overlay { opacity: 1; }
.ov-reason { color: #dfe6f1; font-size: 12px; line-height: 1.4; margin-bottom: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* clean action stack: prominent primary, compact secondary row */
.ov-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.ov-actions .btn { flex: 1 1 100%; padding: 9px 12px; font-size: 13px; border-radius: 8px; box-shadow: none; }
.ov-actions .btn.ghost { flex: 1 1 0; padding: 7px 10px; font-size: 12px;
  background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.24); backdrop-filter: blur(6px); }
.ov-actions .btn.ghost:hover { background: rgba(255,255,255,.30); }
.media-foot { padding: 10px 12px 12px; }
.media-title { font-weight: 700; font-size: 15px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-author { color: var(--subtle); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-stars { display: flex; gap: 2px; margin-top: 7px; }
.media-stars span { cursor: pointer; color: var(--bg4); font-size: 15px; line-height: 1; transition: color .1s; }
.media-stars span.on, .media-stars span:hover { color: var(--accent); }

/* ---------- buttons & badges ---------- */
.btn { background: linear-gradient(180deg, var(--accent), #c47a2f); border: none; color: #1a0f02; font-weight: 700;
  padding: 9px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; flex: 1; transition: filter .15s, transform .1s; box-shadow: 0 4px 12px rgba(217,140,63,.25); }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(.6) brightness(.8); cursor: default; box-shadow: none; }
.btn.ghost { background: rgba(148,163,184,.16); color: var(--text); box-shadow: none; backdrop-filter: blur(4px); }
.btn.small { flex: none; padding: 8px 14px; text-decoration: none; display: inline-block; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.badge-available { background: #22c55e22; color: #4ade80; } .badge-handed { background: #f59e0b22; color: #fbbf24; }
.badge-queued { background: #0ea5e922; color: #38bdf8; } .badge-failed { background: #ef444422; color: #f87171; }

/* ---------- requests list ---------- */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req-row { display: flex; align-items: center; gap: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 15px; }
.req-cover { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--bg3); }
.req-info { flex: 1; min-width: 0; }
.req-title { font-weight: 700; }
.req-author, .req-detail { color: var(--subtle); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-actions { display: flex; gap: 8px; }

/* ---------- insights ---------- */
.stat-row { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 28px; min-width: 130px; }
.stat-num { font-size: 30px; font-weight: 800; background: linear-gradient(90deg,var(--accent),var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--subtle); font-size: 13px; }
.bar-list { display: flex; flex-direction: column; gap: 9px; max-width: 640px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-name { width: 170px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 10px; background: var(--bg3); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); }
.bar-count { width: 30px; text-align: right; color: var(--subtle); font-size: 13px; }
/* Spotify-wrapped-style insights */
.insights-hero { background: linear-gradient(135deg, var(--accent) 0%, #b2581e 55%, #5b2d8a 100%); border-radius: 20px;
  padding: 38px 34px; margin-bottom: 18px; color: #fff; box-shadow: var(--shadow); }
.hero-num { font-size: clamp(48px, 7vw, 72px); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.hero-label { font-size: 16px; opacity: .92; margin-top: 10px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 12px; }
.tile { border-radius: 16px; padding: 22px; color: #fff; box-shadow: var(--shadow); }
.tile-num { font-size: 34px; font-weight: 800; line-height: 1; }
.tile-label { font-size: 13.5px; opacity: .92; margin-top: 6px; }
.t1 { background: linear-gradient(135deg, #1db954, #0a7d34); }
.t2 { background: linear-gradient(135deg, #e0a96d, #c2540a); }
.t3 { background: linear-gradient(135deg, #a78bfa, #6d28d9); }
.t4 { background: linear-gradient(135deg, #38bdf8, #0369a1); }
.top-list { display: flex; flex-direction: column; gap: 2px; max-width: 680px; }
.top-row { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: 12px; transition: background .12s; }
.top-row:hover { background: var(--bg2); }
.top-rank { font-size: 20px; font-weight: 800; color: var(--subtle); width: 30px; text-align: center; flex: none; }
.top-1 .top-rank { color: var(--accent); font-size: 28px; }
.top-1 .top-name { font-size: 20px; }
.top-main { flex: 1; min-width: 0; }
.top-name { font-weight: 700; font-size: 15px; }
.top-bar { height: 6px; background: var(--bg3); border-radius: 999px; margin-top: 7px; overflow: hidden; }
.top-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.top-count { color: var(--subtle); font-size: 13px; white-space: nowrap; flex: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.fact { display: flex; align-items: center; gap: 14px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.fact-icon { font-size: 30px; flex: none; }
.fact-big { font-size: 20px; font-weight: 800; }
.fact-sub { color: var(--subtle); font-size: 13px; margin-top: 2px; }

/* ---------- settings (nested sub-nav) ---------- */
.settings-wrap { display: flex; gap: 24px; align-items: flex-start; }
.settings-nav { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 78px; }
.settings-nav button { text-align: left; background: none; border: none; color: var(--subtle); font-weight: 600; font-size: 14px;
  padding: 10px 13px; border-radius: 9px; cursor: pointer; }
.settings-nav button:hover { background: var(--bg3); color: var(--text); }
.settings-nav button.active { background: var(--bg3); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.settings-body { flex: 1; min-width: 0; }
.settings-cat { display: none; }
.settings-cat.active { display: block; }
.sub-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.sub-tab { padding: 7px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); cursor: pointer; font-size: 13px; }
.sub-tab.active { background: var(--accent); color: #1a0f02; border-color: var(--accent); font-weight: 700; }
.sub-panel { display: none; } .sub-panel.active { display: block; }

.panel { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.panel h3 { margin-bottom: 12px; font-size: 16px; }
.panel .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.panel .row:last-child { border-bottom: none; }
.panel input:not(.switch), .panel select { background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px; font-size: 14px; min-width: 220px; transition: border-color .15s; }
.panel input:focus, .panel select:focus { border-color: var(--accent); outline: none; }
.panel select { appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
/* iOS-style semi-transparent toggle switch (replaces checkboxes) */
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; flex: none;
  background: rgba(148,163,184,.30); border: 1px solid var(--line); position: relative; cursor: pointer; transition: background .2s; min-width: 42px; }
.switch:checked { background: color-mix(in srgb, var(--accent) 65%, transparent); border-color: transparent; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .2s; }
.switch:checked::after { transform: translateX(18px); }
.muted { color: var(--subtle); font-size: 13px; margin: 8px 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 130px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.theme-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.theme-tab { padding: 7px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.theme-tab.active { background: var(--accent); color: #1a0f02; border-color: var(--accent); font-weight: 700; }
.email-preview { width: 100%; height: 470px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 6px; }
.conn-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.conn-result { font-size: 13px; color: var(--subtle); }
.conn-result.ok { color: #4ade80; } .conn-result.err { color: #f87171; }
.settings-body .panel input[data-setting] { min-width: 280px; }

/* ---------- bookshelf loader ---------- */
.shelf-loader { display: flex; flex-direction: column; align-items: center; padding: 72px 20px; }
.shelf-scene { position: relative; width: 250px; height: 120px; }
.shelf-books { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; align-items: flex-end; height: 84px; }
.sb { width: 19px; border-radius: 3px 3px 1px 1px; transform-origin: bottom center; animation: pull 3.6s ease-in-out infinite; box-shadow: inset -3px 0 0 rgba(0,0,0,.18); }
.sb1{height:64px;background:#d98c3f;animation-delay:0s}.sb2{height:74px;background:#e0a96d;animation-delay:.28s}
.sb3{height:58px;background:#5eead4;animation-delay:.56s}.sb4{height:78px;background:#f0b27a;animation-delay:.84s}
.sb5{height:62px;background:#c2540a;animation-delay:1.12s}.sb6{height:70px;background:#e0a96d;animation-delay:1.4s}
.sb7{height:66px;background:#d98c3f;animation-delay:1.68s}
.shelf-plank { position: absolute; bottom: 8px; left: 0; right: 0; height: 8px; border-radius: 4px; background: var(--bg4); box-shadow: 0 8px 16px rgba(0,0,0,.4); }
.shelf-hand { position: absolute; top: -4px; left: 50%; font-size: 28px; animation: reach 3.6s ease-in-out infinite; }
@keyframes pull { 0%,38%{transform:translateY(0) rotate(0);opacity:1} 54%{transform:translateY(-26px) rotate(-8deg);opacity:1}
  70%{transform:translateY(-64px) rotate(-90deg);opacity:0} 71%,84%{transform:translateY(0);opacity:0} 100%{transform:translateY(0);opacity:1} }
@keyframes reach { 0%,100%{transform:translateX(-66px) translateY(8px)} 50%{transform:translateX(42px) translateY(-4px)} }
.shelf-text { margin-top: 24px; font-size: 18px; font-weight: 700; }
.shelf-sub { font-size: 13px; margin-top: 4px; }

.empty { color: var(--subtle); text-align: center; padding: 60px 20px; max-width: 560px; margin: 0 auto; }
.empty a { color: var(--accent); }

/* book detail page */
.back-btn { margin-bottom: 18px; }
.book-detail { display: flex; gap: 34px; flex-wrap: wrap; }
.book-cover { position: relative; flex: none; width: min(320px, 78vw); }
.book-cover img { width: 100%; border-radius: 14px; box-shadow: var(--shadow); display: block; }
.book-cover .corner-badge { top: 12px; right: 12px; }
.book-info { flex: 1; min-width: 280px; }
.book-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.book-subtitle { color: var(--subtle); font-size: 16px; margin-top: 6px; }
.book-author { font-size: 16px; margin: 12px 0; }
.book-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.chip { background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.subtle-chip { color: var(--subtle); }
.book-summary { line-height: 1.6; margin: 16px 0; max-width: 72ch; }
.error-banner { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.4); color: #fca5a5;
  border-radius: 10px; padding: 12px 16px; margin: 14px 0; max-width: 72ch; font-size: 14px; line-height: 1.5; }
.error-banner strong { color: #f87171; }
.book-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.book-actions .btn { flex: none; padding: 11px 24px; }

#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg3);
  color: var(--text); padding: 12px 22px; border-radius: 999px; border: 1px solid var(--accent); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all .25s; font-size: 14px; z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; }
.login-card { background: var(--bg2); padding: 42px 38px; border-radius: 18px; width: min(370px,92vw); text-align: center; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-logo { width: 58px; margin-bottom: 10px; }
.login-card h1 { margin-bottom: 4px; background: linear-gradient(90deg,var(--accent),var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--subtle); font-size: 13.5px; margin-bottom: 22px; }
.login-card input { width: 100%; margin-bottom: 12px; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 15px; }
.login-card button { width: 100%; padding: 12px; border-radius: 9px; border: none; background: linear-gradient(180deg,var(--accent),#c47a2f); color: #1a0f02; font-weight: 700; font-size: 15px; cursor: pointer; }
.hint { color: var(--subtle); font-size: 12px; margin-top: 14px; }
.error { color: #f87171; margin-bottom: 12px; font-size: 14px; }
/* sign-in method tabs + sign-up disclosure */
.login-tabs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 16px; }
.login-tab { width: auto !important; flex: 0 0 auto; padding: 7px 13px !important; font-size: 13px !important;
  background: var(--bg3) !important; color: var(--subtle) !important; border: 1px solid var(--line) !important; }
.login-tab.on { background: linear-gradient(180deg,var(--accent),#c47a2f) !important; color: #1a0f02 !important; border-color: var(--accent) !important; }
.login-register { margin-top: 16px; text-align: left; border-top: 1px solid var(--line); padding-top: 12px; }
.login-register summary { cursor: pointer; color: var(--subtle); font-size: 13px; text-align: center; list-style: none; }
.login-register summary::-webkit-details-marker { display: none; }
.login-register[open] summary { margin-bottom: 12px; color: var(--text); }
/* admin user table + approval queue */
.user-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.user-table th { text-align: left; color: var(--subtle); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.user-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.user-table tr:last-child td { border-bottom: none; }
.req-row.pending { border-left: 3px solid var(--accent); }
.section.approvals .req-row { background: color-mix(in srgb, var(--accent) 7%, var(--bg2)); }
.badge-pending_approval { background: color-mix(in srgb, var(--accent) 22%, var(--bg3)); color: var(--accent2); }
.badge-denied { background: color-mix(in srgb, #f87171 18%, var(--bg3)); color: #fca5a5; }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  body { flex-direction: column; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: 100%; height: auto; flex-direction: row;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; gap: 0;
    scrollbar-width: none; scroll-snap-type: x proximity;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); z-index: 40;
    /* fade the right edge so it's obvious there's more to scroll to */
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent); }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand, .navlink span, .version-tag { display: none; }
  /* ~4.5 icons per screen-width; the rest scroll (edge fades to hint it) */
  .navlink { justify-content: center; flex: 0 0 auto; width: 21vw; max-width: 92px; min-width: 0;
    padding: 11px 0; border-radius: 12px; scroll-snap-align: start; }
  .logout-form { flex: 0 0 auto; width: 21vw; max-width: 92px; }
  .navlink svg { width: 23px; height: 23px; }
  .navlink:hover { padding-left: 0; }   /* cancel the desktop hover slide */
  .navlink.active::before { display: none; }
  .navlink.active { background: linear-gradient(180deg, rgba(217,140,63,.28), rgba(217,140,63,.10)); }
  .logout-form { margin: 0; flex: 0 0 auto; display: flex; }
  /* a subtle fade hint that the bar scrolls */
  .shell::after { content: ""; }
  .shell { width: 100%; }
  main { padding-bottom: 86px; }
  .slider { grid-auto-columns: 140px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .settings-wrap { flex-direction: column; }
  .settings-nav { width: 100%; flex-direction: row; overflow-x: auto; position: static; }
  /* on mobile, don't overlay the cover — show it fully; tap goes to the detail page where the actions live */
  .media-overlay { display: none; }
}

/* static demo ribbon */
.demo-ribbon{position:fixed;left:50%;bottom:18px;transform:translateX(-50%);z-index:9999;
  background:var(--accent);color:#1a1206;text-decoration:none;font-weight:600;font-size:.9rem;
  padding:9px 16px;border-radius:999px;box-shadow:0 6px 24px rgba(0,0,0,.45);white-space:nowrap}
.demo-ribbon b{text-decoration:underline}

/* History & ratings — scannable list: square cover · title/author · star rating.
   Unrated rows sit at the top; rating one sinks it to the bottom (muted/done). */
.rate-list { display: flex; flex-direction: column; gap: 10px; max-width: 880px; }
.rate-item {
  display: flex; align-items: center; gap: 16px; padding: 10px 14px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  transition: opacity .35s ease, transform .35s ease, background .2s;
}
.rate-item:hover { background: var(--bg3); }
.rate-item.rated { opacity: .62; }
.rate-item.rated:hover { opacity: 1; }
.rate-item.moving { opacity: 0; transform: translateY(10px); }   /* fade-out before re-sort */

.rate-cover { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 8px; overflow: hidden;
  background: #000; display: block; }
.rate-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rate-meta { flex: 1 1 auto; min-width: 0; }
/* wrap long titles/authors (up to 2 lines) instead of truncating with an ellipsis */
.rate-title { font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rate-author { color: var(--subtle); font-size: 13.5px; overflow-wrap: anywhere; }

.rate-stars { flex: 0 0 auto; display: flex; gap: 4px; }
.rate-stars .star { cursor: pointer; color: var(--bg4); font-size: 24px; line-height: 1; transition: color .12s, transform .12s; }
.rate-stars .star.on, .rate-stars .star.preview { color: var(--accent); }     /* rated, or hover-preview up to cursor */
.rate-stars .star.preview { transform: scale(1.12); }
.rate-stars.disabled .star { cursor: default; opacity: .45; }

.rate-remove { flex: 0 0 auto; background: none; border: 0; cursor: pointer; padding: 0 2px;
  font-size: 18px; line-height: 1; color: var(--subtle); opacity: 0; transition: opacity .15s, color .15s; }
.rate-item:hover .rate-remove, .rate-remove:focus-visible { opacity: .55; }
.rate-remove:hover { color: #ef4444; opacity: 1; }
@media (hover: none) { .rate-remove { opacity: .45; } }   /* always visible on touch */

/* Quick-rate onboarding card (home, shown when taste is thin) */
.onboard-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 22px; box-shadow: var(--shadow); }
.onboard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.onboard-head h3 { margin: 0 0 2px; }
.onboard-progress { display: flex; align-items: center; gap: 12px; color: var(--subtle); font-size: 13.5px; white-space: nowrap; }
.onboard-progress #onboard-count { color: var(--accent); font-weight: 700; }
.onboard-grid { display: grid; gap: 14px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
.onboard-item { display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center;
  transition: opacity .3s; }
.onboard-item.done { opacity: .5; }
.onboard-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; }
.onboard-title { font-size: 12px; line-height: 1.25; max-height: 2.5em; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.onboard-item .rate-stars { gap: 2px; }
.onboard-item .rate-stars .star { font-size: 16px; }

/* Taste tuning page */
.taste-wrap { display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.taste-wrap .panel h3 { margin-bottom: 4px; }
.tune-list { display: flex; flex-direction: column; margin-top: 10px; }
.tune-row { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.tune-row:last-child { border-bottom: 0; }
.tune-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tune-stars { flex: 0 0 auto; display: flex; gap: 1px; }
.tune-stars .star { font-size: 13px; color: var(--bg4); }
.tune-stars .star.on { color: var(--accent); }
.tune-undo { flex: 0 0 auto; background: none; border: 1px solid var(--line); color: var(--subtle);
  border-radius: 999px; padding: 3px 12px; font-size: 12.5px; cursor: pointer; transition: all .15s; }
.tune-undo:hover { border-color: var(--accent); color: var(--accent); }
.tune-empty { padding: 6px 2px; }

/* Up Next — series tracker */
.series-list { display: flex; flex-direction: column; gap: 14px; max-width: 920px; }
.series-card { display: flex; gap: 18px; align-items: center; justify-content: space-between;
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; }
.series-info { min-width: 0; flex: 1 1 auto; }
.series-name { font-weight: 700; font-size: 16px; }
.series-meta { color: var(--subtle); font-size: 13px; margin-top: 2px; }
.series-books { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.series-chip { font-size: 11.5px; color: var(--subtle); background: var(--bg3); border-radius: 999px;
  padding: 3px 10px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.series-next { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; width: 280px; max-width: 42%; }
.series-next-cover { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; background: #000; display: block; }
.series-next-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.series-next-info { min-width: 0; }
.series-next-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); font-weight: 700; }
.series-next-label.muted { color: var(--subtle); }
.series-next-title { font-size: 13.5px; font-weight: 600; margin: 1px 0 6px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.series-badge { display: inline-block; font-size: 11.5px; padding: 3px 10px; border-radius: 999px; }
.series-badge.available { background: rgba(94,234,212,.16); color: #5eead4; }
.series-badge.handed { background: rgba(217,140,63,.18); color: var(--accent); }
@media (max-width: 640px) {
  .series-card { flex-direction: column; align-items: stretch; gap: 12px; }
  .series-next { width: auto; max-width: none; }
  /* page header: title on its own line, actions wrap below cleanly */
  .page-head { align-items: flex-start; gap: 10px; }
  .page-head-actions { width: 100%; justify-content: space-between; }
  .page-title { font-size: 21px; }
  .page-title .subtle { display: block; margin-left: 0; margin-top: 2px; }
  /* requests: cover + info on top, badge + actions on a second wrapped row */
  .req-row { flex-wrap: wrap; row-gap: 10px; padding: 11px 13px; }
  .req-cover { width: 46px; height: 46px; }
  .req-info { flex: 1 1 60%; }
  .req-row .badge { order: 3; }
  .req-actions { order: 4; margin-left: auto; }
}

@media (max-width: 560px) {
  .rate-stars .star { font-size: 21px; gap: 2px; }
  .rate-item { gap: 12px; padding: 9px 11px; }
  .rate-cover { width: 46px; height: 46px; }
}

/* settings: stack the side-nav above the body and stop wide controls overflowing */
@media (max-width: 760px) {
  .settings-wrap { flex-direction: column; gap: 14px; }
  .settings-nav { width: 100%; flex-direction: row; flex-wrap: wrap; position: static; gap: 6px; }
  .settings-nav button { box-shadow: none !important; border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 13px; }
  .settings-nav button.active { box-shadow: none !important; border-color: var(--accent); }
  .panel { padding: 14px; }
  .panel .row { flex-wrap: wrap; }
  .panel input, .panel select { max-width: 100%; }
  .user-table { display: block; overflow-x: auto; }      /* scroll rather than overflow the viewport */
}

/* ---------- animation polish (all motion opt-out via reduced-motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* staggered entrance for list rows + cards */
  .rate-item, .tune-row, .series-card, .onboard-item { animation: riseIn .42s cubic-bezier(.22,.8,.25,1) both; }
  @keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(1) { animation-delay: 0s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(2) { animation-delay: .03s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(3) { animation-delay: .06s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(4) { animation-delay: .09s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(5) { animation-delay: .12s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(6) { animation-delay: .15s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(7) { animation-delay: .18s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(8) { animation-delay: .21s; }
  :is(.rate-list, .tune-list, .series-list, .onboard-grid) > :nth-child(n+9) { animation-delay: .24s; }

  /* onboarding card drops in */
  #onboard-card { animation: dropIn .45s cubic-bezier(.2,.8,.2,1) both; }
  @keyframes dropIn { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }

  /* hover lift on cards/rows */
  .series-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
  .series-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(0,0,0,.35); }
  body[data-theme="light"] .series-card:hover { box-shadow: 0 12px 26px rgba(15,23,42,.16); }
  .tune-row { transition: background .15s ease; border-radius: 8px; }
  .tune-row:hover { background: var(--bg3); }
  .onboard-cover { transition: transform .18s ease; }
  .onboard-item:hover .onboard-cover { transform: scale(1.04); }

  /* satisfying pop when a star is set (JS adds .pop on click) */
  .rate-stars .star.pop { animation: starPop .34s ease; }
  @keyframes starPop { 0% { transform: scale(1); } 38% { transform: scale(1.5); } 100% { transform: scale(1); } }

  /* nav + sidebar micro-transitions */
  .navlink { transition: background .18s ease, color .18s ease, padding-left .18s ease; }
  .navlink:hover { padding-left: 16px; }
  .tune-undo, .switch { transition: all .15s ease; }
}

/* ---- format-mode chrome (badges, chips, warnings) — only painted in
   multi-format installs; single-format installs never render these ---- */
:root { --audio: #d98c3f; --ebook: #5b8def; }
.format-chip { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 9px; border-radius: 999px; vertical-align: middle; margin-left: 8px;
  border: 1px solid var(--line); background: var(--bg3); color: var(--subtle); }
.format-chip.ebook { color: var(--ebook); border-color: color-mix(in srgb, var(--ebook) 45%, var(--line)); }
.format-chip.audiobook { color: var(--audio); border-color: color-mix(in srgb, var(--audio) 45%, var(--line)); }
.warn-note { font-size: 13px; color: var(--subtle); background: color-mix(in srgb, #e0a83a 12%, var(--bg2));
  border: 1px solid color-mix(in srgb, #e0a83a 35%, var(--line)); border-radius: 9px; padding: 9px 12px; margin: 8px 0; }

/* format icon (headphones / book / stacked) used in pills, badges, tags */
.fmt-ic { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.13em; display: inline-block; }

/* a small format badge (icon only) on a media card cover in 'both' mode.
   A fixed dark backdrop (even on light theme) so the coloured icon always
   pops against any cover art. */
.fmt-badge { position: absolute; top: 8px; left: 8px; z-index: 3; display: inline-flex;
  align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 7px; font-size: 14px;
  backdrop-filter: blur(6px); background: rgba(10, 15, 28, 0.66); }
.fmt-badge.audiobook { color: #f0b27a; box-shadow: inset 0 0 0 1.5px #f0b27a; }   /* lighter amber for contrast on dark backdrop */
.fmt-badge.ebook { color: #8ab4ff; box-shadow: inset 0 0 0 1.5px #8ab4ff; }
/* settings format chip — ensure readable amber on light theme */
body[data-theme="light"] .format-chip.audiobook { color: #b5701f; }

/* format filter pills — icon buttons (All / Audiobooks / eBooks), both mode */
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fmt-filter { display: inline-flex; gap: 4px; background: var(--bg3); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; }
.fmt-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 32px;
  font-size: 17px; border: none; border-radius: 999px; cursor: pointer; background: transparent;
  color: var(--subtle); transition: all .15s; }
.fmt-pill.active { background: var(--accent); color: #1a0f02; }
.fmt-pill:hover:not(.active) { color: var(--text); background: var(--bg4); }
.seg { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg .btn.on, .btn.small.ghost.on { background: var(--accent); color: #1a0f02; border-color: var(--accent); }
.req-fmt { color: var(--subtle); } .req-fmt .fmt-ic { width: .95em; height: .95em; }

/* ---- shared ratings & reviews (Phase 6) ---- */
.reviews { max-width: 820px; margin: 30px auto 10px; padding: 0 clamp(14px,3vw,24px); }
.reviews-head { display: flex; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.community-rating { font-size: 18px; font-weight: 700; color: var(--accent); }
.my-review { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.rate-stars.big .star { font-size: 28px; }
.review-input { width: 100%; margin: 10px 0; background: var(--bg3); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); padding: 10px 12px; font: inherit; resize: vertical; }
.review-input:focus { outline: none; border-color: var(--accent); }
.review-list { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.review-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; }
.review-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.review-text { margin: 0; color: var(--text); white-space: pre-wrap; }
.star.on, .review-stars .star.on, .ministar.on { color: var(--accent); }
.review-stars .star, .ministar { color: var(--line); font-size: 13px; }
.ministar { font-size: 11px; }

/* ============ v1.6 features: tags, shelves, goal, heatmap, vibes ============ */
/* mood + content-warning chips */
.mood-chip { background: color-mix(in srgb, var(--ebook) 14%, var(--bg3)); border-color: color-mix(in srgb, var(--ebook) 35%, var(--line)); text-transform: capitalize; }
.mood-chip:hover { border-color: var(--ebook); color: var(--text); }
.cw { margin: 6px 0; }
.cw summary { cursor: pointer; color: #e6a13a; font-size: 13px; }
.cw-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.cw-chip { background: color-mix(in srgb, #e0a83a 14%, var(--bg2)); border-color: color-mix(in srgb, #e0a83a 40%, var(--line)); color: #e6a13a; }

/* shelf bar on the book page */
.shelf-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.shelf-btn.on { background: var(--accent); color: #1a0f02; border-color: var(--accent); }
.feedback-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.feedback-row .btn.on { background: var(--bg4); color: var(--text); }

/* review votes + spoilers */
.vote-btn { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--subtle);
  font-size: 12px; padding: 2px 9px; cursor: pointer; }
.vote-btn.voted { color: var(--accent); border-color: var(--accent); }
.review-text.spoiler .spoiler-body { filter: blur(5px); user-select: none; }
.review-text.spoiler { cursor: pointer; position: relative; }
.spoiler-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--subtle); z-index: 2; }
.review-text:not(.spoiler) .spoiler-label { display: none; }
.spoiler-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--subtle); margin: 2px 0 10px; }

/* reading-goal ring (conic gradient) */
.goal-card { display: flex; gap: 20px; align-items: center; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; margin: 4px 0 18px; flex-wrap: wrap; }
.goal-card.mini { margin: 0; flex: 1 1 260px; }
/* reading-goal progress as a horizontal fill bar with the count overlaid */
.goal-bar { --pct: 0; position: relative; flex: 1 1 240px; min-width: 200px; height: 42px;
  border-radius: 11px; overflow: hidden; background: var(--bg4); }
.goal-bar-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--pct) * 1%); max-width: 100%;
  border-radius: 11px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s ease; }
.goal-bar-text { position: absolute; inset: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 15px; color: var(--text); text-shadow: 0 1px 1px rgba(0,0,0,.22); }
.goal-bar-num { font-size: 21px; font-weight: 800; line-height: 1; }
.goal-of { font-size: 14px; opacity: .8; position: relative; top: 1px; }
.goal-lbl { margin-left: auto; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.goal-set h3, .mood-card h3 { margin: 0 0 4px; }

/* format split bar (insights) */
.fmt-split-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg3); margin: 8px 0; }
.seg-audio { background: var(--audio); } .seg-ebook { background: var(--ebook); }
.fmt-split-legend { display: flex; gap: 20px; font-size: 14px; color: var(--subtle); }
.fmt-split-legend .fmt-ic { vertical-align: -0.13em; }

/* activity heatmap */
.heatmap-wrap { overflow-x: auto; padding-bottom: 6px; }
.heatmap { display: flex; gap: 3px; min-width: max-content; }
.hm-week { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--bg3); }
.hm-cell[data-lvl="1"] { background: color-mix(in srgb, var(--accent) 35%, var(--bg3)); }
.hm-cell[data-lvl="2"] { background: color-mix(in srgb, var(--accent) 60%, var(--bg3)); }
.hm-cell[data-lvl="3"] { background: color-mix(in srgb, var(--accent) 80%, var(--bg3)); }
.hm-cell[data-lvl="4"] { background: var(--accent); }
.hm-future { visibility: hidden; }
.hm-key { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 12px; }
.hm-key .hm-cell { width: 11px; height: 11px; }
.insights-twocol { display: flex; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.mood-card { flex: 1 1 260px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.mood-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* vibe picker */
.vibe-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.vibe-chip { background: var(--bg3); border: 1px solid var(--line); color: var(--text); border-radius: 999px;
  padding: 7px 15px; font-size: 14px; cursor: pointer; text-transform: capitalize; transition: all .15s; }
.vibe-chip.on { background: var(--accent); color: #1a0f02; border-color: var(--accent); }
.series-getall { margin-top: 10px; }
.follow-btn.on { background: var(--accent); color: #1a0f02; border-color: var(--accent); }

/* series completion progress bar (Up Next) */
.series-progress { height: 6px; border-radius: 999px; background: var(--bg3); overflow: hidden; margin: 7px 0; max-width: 320px; }
.series-progress > span { display: block; height: 100%; background: var(--accent); }

/* range input */
input[type=range] { accent-color: var(--accent); }

/* series: missing-books finder + actions */
.series-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.series-missing { margin-top: 10px; }
.missing-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.missing-item { display: flex; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: var(--text); font-size: 13.5px; background: var(--bg2); }
.missing-item:hover { border-color: var(--accent); }
.missing-seq { color: var(--accent); font-weight: 700; flex: none; }
/* cover placeholder fills its frame cleanly */
img.cover-ph { object-fit: contain !important; background: var(--bg3); padding: 0; }

/* book page declutter: quiet feedback pills + below-fold action bar */
.icon-pill { background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; width: 34px; height: 30px;
  cursor: pointer; font-size: 14px; color: var(--text); }
.icon-pill:hover { border-color: var(--accent); }
.icon-pill.on { background: var(--accent); }
.feedback-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.book-actions-bottom { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px auto 8px; max-width: 820px;
  padding: 16px clamp(14px,3vw,24px) 0; border-top: 1px solid var(--line); }
.community-inline { color: var(--subtle); }

/* both-mode compact grab pair (two half-width Add buttons side by side) */
.grab-pair { display: inline-flex; gap: 6px; }
.grab-pair .grab-half { flex: 1 1 0; padding-left: 14px; padding-right: 14px; white-space: nowrap; }
.grab-half .fmt-ic { margin-right: 2px; }
/* home dashboard */
.home-top { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.home-stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 22px;
  text-decoration: none; color: var(--text); display: flex; flex-direction: column; justify-content: center; min-width: 130px; }
.home-stat:hover { border-color: var(--accent); }
.home-stat-num { font-size: 30px; font-weight: 800; line-height: 1; }

/* history/taste subtabs + duplicate-format note */
.subtabs-row { margin: -6px 0 18px; }
.dup-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0; padding: 10px 14px;
  background: color-mix(in srgb, var(--ebook) 10%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--ebook) 30%, var(--line));
  border-radius: 10px; font-size: 14px; }

/* series book chips: colour finished / currently-reading distinctly */
.series-chip.chip-read { background: color-mix(in srgb, #22c55e 16%, var(--bg3)); border-color: color-mix(in srgb, #22c55e 45%, var(--line)); color: #6ee7a8; }
.series-chip.chip-reading { background: color-mix(in srgb, var(--accent) 18%, var(--bg3)); border-color: var(--accent); color: var(--accent2); }
/* light theme needs dark ink on the pale chip fills, not the dark-theme pastels */
body[data-theme="light"] .series-chip.chip-read { background: #dcfce7; border-color: #86efac; color: #15803d; }
body[data-theme="light"] .series-chip.chip-reading { background: #ffedd5; border-color: var(--accent); color: #b45309; }
.chip-legend { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 0; font-size: 12px; }
.chip-legend .series-chip { font-size: 11px; padding: 2px 8px; }
