:root {
  --bg: #0d0f14; --bg2: #141821; --panel: #1a1f2b; --line: #262c3a; --text: #eef1f6; --muted: #9aa3b5; --faint: #687089;
  --accent: #f5b942; --accent-ink: #1b1405; --good: #3ccf8e; --warn: #f5b942; --info: #5aa9ff; --bad: #ff6b6b;
  --radius: 12px; --shadow: 0 10px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f9; --bg2: #ffffff; --panel: #ffffff; --line: #e3e6ee; --text: #151924; --muted: #5b6375; --faint: #8a91a3;
    --accent: #d99413; --accent-ink: #ffffff; --shadow: 0 10px 30px rgba(20,25,40,.12);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: -.02em; font-size: 19px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand i { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #ff7a45); display: inline-block; }
.nav { display: flex; gap: 4px; }
.nav button { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.nav button.on, .nav button:hover { color: var(--text); background: var(--panel); }
.search { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); outline: none; }
.search input:focus { border-color: var(--accent); }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 50%; transform: translateY(-52%); color: var(--faint); font-size: 18px; }
.me { position: relative; }
.me > button { border: 1px solid var(--line); background: var(--bg2); border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.menu { position: absolute; right: 0; top: 40px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); min-width: 170px; padding: 6px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 7px; background: none; border: 0; text-decoration: none; }
.menu a:hover, .menu button:hover { background: var(--bg2); }
@media (max-width: 760px) { .bar { flex-wrap: wrap; padding: 10px 14px; } .search { order: 3; max-width: none; flex-basis: 100%; } .nav { overflow-x: auto; } }

main { padding: 0 22px 60px; }
@media (max-width: 760px) { main { padding: 0 14px 50px; } }

/* hero */
.hero { position: relative; margin: 0 -22px 10px; min-height: 420px; display: flex; align-items: flex-end; overflow: hidden; }
.hero img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 2%, transparent 60%), linear-gradient(90deg, rgba(0,0,0,.75), transparent 65%); }
.hero .copy { position: relative; z-index: 1; padding: 0 22px 34px; max-width: 640px; color: #fff; }
.hero h1 { font-size: clamp(28px, 4vw, 44px); margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { color: #d7dbe5; margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) { .hero { margin: 0 -14px 10px; min-height: 300px; } }

/* rows of posters */
.row { margin-top: 26px; }
.row h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; }
.row h2 small { color: var(--faint); font-weight: 500; font-size: 13px; }
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { height: 6px; } .strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
@media (max-width: 520px) { .strip { grid-auto-columns: 118px; } .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); } }
.card { position: relative; scroll-snap-align: start; cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
.card .poster { aspect-ratio: 2 / 3; border-radius: 10px; overflow: hidden; background: var(--panel); position: relative; box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .18s ease, box-shadow .18s ease; }
.card:hover .poster, .card:focus-visible .poster { transform: translateY(-3px); box-shadow: var(--shadow); }
.card .poster img { width: 100%; height: 100%; object-fit: cover; }
.card .poster .noimg { position: absolute; inset: 0; display: grid; place-items: center; padding: 10px; text-align: center; color: var(--faint); font-weight: 600; }
.card .t { margin-top: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .y { font-size: 12px; color: var(--faint); }
.kindtag { position: absolute; top: 7px; left: 7px; font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; background: rgba(0,0,0,.6); color: #fff; text-transform: uppercase; }
.badge { position: absolute; top: 7px; right: 7px; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; color: #0b0d12; }
.badge.available { background: var(--good); } .badge.partial { background: #8fe3bd; }
.badge.requested { background: var(--warn); } .badge.downloading { background: var(--info); } .badge.wanted { background: #c9b8ff; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.chip { border: 1px solid var(--line); background: var(--bg2); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--bg2); padding: 9px 16px; border-radius: 10px; font-weight: 700; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.good { background: var(--good); color: #062014; border-color: var(--good); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.more { display: block; margin: 24px auto 0; }

/* title page (overlay) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(5,7,12,.72); backdrop-filter: blur(4px); overflow-y: auto; }
.sheet { max-width: 1060px; margin: 40px auto; background: var(--bg2); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
@media (max-width: 760px) { .sheet { margin: 0; border-radius: 0; min-height: 100%; } }
.sheet .close { position: absolute; top: 14px; right: 14px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 20px; }
.sheet .back { position: relative; height: 340px; }
.sheet .back img { width: 100%; height: 100%; object-fit: cover; }
.sheet .back::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg2), transparent 70%); }
.sheet .head { display: flex; gap: 24px; padding: 0 28px; margin-top: -150px; position: relative; z-index: 2; }
.sheet .head .pp { width: 190px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 2/3; background: var(--panel); }
.sheet .head .pp img { width: 100%; height: 100%; object-fit: cover; }
.sheet .head .info { padding-top: 92px; min-width: 0; }
.sheet h1 { margin: 0; font-size: clamp(24px, 3.4vw, 36px); letter-spacing: -.02em; }
.sheet .meta { color: var(--muted); margin: 6px 0 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.sheet .tagline { color: var(--muted); font-style: italic; margin: 0 0 10px; }
.sheet .body { padding: 22px 28px 30px; }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; background: var(--panel); border: 1px solid var(--line); }
.pill.available { color: var(--good); } .pill.requested, .pill.pending { color: var(--warn); } .pill.downloading { color: var(--info); } .pill.declined { color: var(--bad); }
@media (max-width: 760px) { .sheet .back { height: 220px; } .sheet .head { flex-direction: column; margin-top: -90px; padding: 0 16px; gap: 12px; } .sheet .head .pp { width: 120px; } .sheet .head .info { padding-top: 0; } .sheet .body { padding: 16px; } }
.seasons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin: 12px 0 4px; }
.season { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.season input { width: 18px; height: 18px; accent-color: var(--accent); }
.season small { display: block; color: var(--faint); }
.cast { display: grid; grid-auto-flow: column; grid-auto-columns: 92px; gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.cast div { font-size: 12px; } .cast img, .cast .ph { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: var(--panel); }
.cast b { display: block; margin-top: 6px; font-size: 12px; } .cast span { color: var(--faint); }
.trailer { aspect-ratio: 16/9; width: 100%; border: 0; border-radius: 12px; margin-top: 10px; }

/* lists, forms, panels (requests, admin) */
.page-title { font-size: 24px; margin: 26px 0 6px; letter-spacing: -.01em; }
.sub { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.list { display: grid; gap: 10px; }
.item { display: flex; gap: 14px; align-items: center; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.item img, .item .ph { width: 46px; aspect-ratio: 2/3; border-radius: 6px; object-fit: cover; background: var(--bg2); flex: none; }
.item .grow { flex: 1; min-width: 0; } .item .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .grow small { color: var(--faint); }
.empty { color: var(--faint); padding: 30px 0; text-align: center; }
label.f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
input.i, select.i, textarea.i { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); width: 100%; }
input.i:focus, select.i:focus { outline: none; border-color: var(--accent); }
.form { display: grid; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 10px 16px; border-radius: 10px; z-index: 99; font-weight: 600; }

/* sign in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.auth .panel { width: min(380px, 100%); padding: 26px; }
.auth h1 { margin: 0 0 4px; font-size: 22px; }
.skeleton { background: linear-gradient(90deg, var(--panel), var(--bg2), var(--panel)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* square art (albums, artists) and flat sheets (books, music) */
.card.sq .poster { aspect-ratio: 1 / 1; }
.sqstrip { grid-auto-columns: 160px; }
.card .poster .noimg { z-index: 0; }
.card .poster img { position: relative; z-index: 1; }
.card .poster .kindtag, .card .poster .badge { z-index: 2; }
.sheet .head.flat { margin-top: 0; padding-top: 28px; }
.sheet .head.flat .info { padding-top: 6px; }
.sheet .pp.sq { aspect-ratio: 1 / 1; width: 220px; }
.tracks { margin: 0; padding-left: 22px; display: grid; gap: 2px; }
.tracks li { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.tracks li span:first-child { margin-right: 10px; }
.tracks li { display: list-item; } .tracks li .sub { float: right; }
@media (max-width: 760px) { .sheet .head.flat { padding-top: 54px; } .sheet .pp.sq { width: 160px; } }

/* ---------- phones (and folding phones like the Duo, one screen ~540px) ---------- */
.nav svg { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .bar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "brand . me" "search search search"; gap: 8px 10px; padding: 10px 14px 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .bar .brand { grid-area: brand; font-size: 17px; }
  .bar .me { grid-area: me; }
  .bar .me > button { padding: 5px 10px; font-size: 13px; }
  .bar .search { grid-area: search; margin: 0; }
  .bar .search input { padding: 8px 12px 8px 34px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0;
    background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); overflow: visible; }
  .nav button { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; font-size: 10.5px; font-weight: 600; background: none !important; }
  .nav button.on { color: var(--accent); }
  .nav svg { display: block; }
  main { padding: 0 12px 30px; }
  .page-title { font-size: 21px; margin-top: 16px; }
  .hero { margin: 0 -12px 6px; min-height: 260px; }
  .hero .copy { padding: 0 14px 18px; }
  .hero p { -webkit-line-clamp: 2; font-size: 14px; }
  .row { margin-top: 18px; }
  .row h2 { font-size: 16px; margin-bottom: 8px; }
  .strip { grid-auto-columns: 112px; gap: 10px; margin-right: -12px; padding-right: 12px; }
  .sqstrip { grid-auto-columns: 128px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
  .card .t { font-size: 12px; } .card .y { font-size: 11px; }
  .badge { font-size: 9.5px; padding: 2px 6px; top: 5px; right: 5px; }
  .kindtag { font-size: 8.5px; top: 5px; left: 5px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 12px -12px; padding: 0 12px 4px; }
  .chip { white-space: nowrap; }
  .overlay { background: var(--bg2); }
  .sheet { margin: 0; border-radius: 0; min-height: 100%; box-shadow: none; }
  .sheet .close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .sheet .actions .btn { flex: 1 1 auto; justify-content: center; }
  .sheet h1 { font-size: 22px; }
  .seasons { grid-template-columns: 1fr 1fr; }
  .cast { grid-auto-columns: 76px; } .cast img, .cast .ph { width: 76px; height: 76px; }
  .item { flex-wrap: wrap; gap: 10px; } .item .grow { flex-basis: calc(100% - 60px); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); }
  .menu { right: 0; }
}
@media (max-width: 380px) { .nav button span { font-size: 9.5px; } .grid { grid-template-columns: repeat(3, 1fr); } }
