:root {
  --bg: #000; --bg2: #141414; --card: #1c1c1c; --line: #2a2a2a;
  --text: #f2f2f2; --dim: #a3a3a3; --red: #d6312b; --red2: #b0231e;
  --green: #46d369; --amber: #e5a00d;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* sign-in */
.screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 8px; }
.signin-logo { width: min(420px, 80vw); }
.screen h1 { margin: 0; letter-spacing: 6px; font-weight: 800; color: var(--red); }
.screen p { color: var(--dim); max-width: 360px; }
.msg { color: var(--amber) !important; min-height: 1.4em; }

/* buttons */
.btn { border: 0; border-radius: 4px; padding: 10px 18px; font-weight: 600; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red2); }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; }
.btn[disabled] { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--dim); text-decoration: underline; padding: 0; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px 4vw; background: linear-gradient(#000, rgba(0,0,0,.85)); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 3px; color: var(--red); }
.brand img { width: 28px; height: 28px; border-radius: 4px; }
nav { display: flex; gap: 16px; }
nav a { color: var(--dim); font-weight: 600; }
nav a.active { color: var(--text); }
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 460px; }
#search { width: 100%; padding: 9px 12px; border-radius: 4px; border: 1px solid var(--line);
  background: #0d0d0d; color: var(--text); font-size: 15px; }
.who { color: var(--dim); font-size: 13px; margin-left: auto; white-space: nowrap; }
.qpill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: #1d1d1d; color: var(--dim); margin-right: 10px; }
.qpill.out { color: var(--amber); }
.btn-lg { padding: 13px 28px; font-size: 16px; margin-top: 8px; }
.btn-light { background: rgba(255,255,255,.85); color: #000; }
.btn-light:hover { background: #fff; }
.billboard { position: relative; height: min(62vh, 560px); background: #111 center 20%/cover no-repeat; display: flex; align-items: flex-end; margin-top: -58px; }
.billboard::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.35) 55%, transparent 80%), linear-gradient(transparent 55%, #000); }
.bb-inner { position: relative; padding: 0 4vw 6vh; max-width: 640px; }
.bb-inner h1 { margin: 0 0 6px; font-size: clamp(26px, 4.5vw, 52px); line-height: 1.05; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.bb-meta { color: #ccc; font-weight: 600; margin-bottom: 8px; }
.bb-inner p { color: #e6e6e6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 14px; }

/* search suggestions: poster + "Movie · 2007" so versions can't be confused */
.suggest { position: absolute; top: 42px; left: 0; right: 0; background: #111; border: 1px solid var(--line);
  border-radius: var(--radius); max-height: 70vh; overflow-y: auto; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.sg { display: flex; gap: 10px; padding: 8px; align-items: center; cursor: pointer; }
.sg:hover, .sg.sel { background: #222; }
.sg img, .sg .noimg { width: 40px; height: 60px; object-fit: cover; border-radius: 3px; background: #222; flex: none; }
.sg .t { font-weight: 600; }
.sg .k { color: var(--dim); font-size: 13px; }

/* rows */
main { padding: 0 0 60px; }
.row { margin: 18px 0 6px; }
.row h2 { font-size: 18px; margin: 0 4vw 8px; }
.scroller { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4vw 10px; scroll-snap-type: x proximity; }
.scroller::-webkit-scrollbar { height: 6px; } .scroller::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.card { flex: none; width: 138px; scroll-snap-align: start; cursor: pointer; position: relative; }
.card img, .card .noimg { width: 138px; height: 207px; object-fit: cover; border-radius: var(--radius); background: var(--card); display: block;
  transition: transform .15s; }
.card:hover img { transform: scale(1.04); }
.card .cap { font-size: 12px; color: var(--dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { position: absolute; top: 6px; left: 6px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  background: rgba(0,0,0,.75); }
.badge.available { color: var(--green); } .badge.requested { color: var(--amber); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.8); z-index: 50; display: flex; justify-content: center;
  align-items: flex-start; overflow-y: auto; padding: 4vh 2vw; }
.modal-card { position: relative; width: min(860px, 100%); background: var(--bg2); border-radius: 8px; overflow: hidden; }
.modal-close { position: absolute; right: 10px; top: 8px; z-index: 2; background: rgba(0,0,0,.6); color: #fff; border: 0;
  width: 36px; height: 36px; border-radius: 50%; font-size: 22px; }
.hero { position: relative; min-height: 220px; background: #111 center/cover no-repeat; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 30%, var(--bg2)); }
.detail { padding: 0 24px 24px; margin-top: -60px; position: relative; z-index: 1; }
.detail h1 { margin: 0 0 4px; font-size: 28px; }
.meta { color: var(--dim); font-size: 14px; display: flex; gap: 12px; flex-wrap: wrap; }
.scores { display: flex; gap: 14px; margin: 10px 0; flex-wrap: wrap; font-weight: 600; }
.scores span { background: #222; padding: 3px 8px; border-radius: 4px; font-size: 13px; }
.overview { color: #ddd; }
.cast { color: var(--dim); font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 6px; align-items: center; }
.state { font-weight: 700; }
.state.available { color: var(--green); } .state.requested { color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { border: 1px solid #444; background: #1b1b1b; color: var(--text); border-radius: 16px; padding: 5px 12px; font-size: 13px; }
.chip.on { background: var(--red); border-color: var(--red); }
.chip[disabled] { opacity: .5; cursor: default; }
.chip .s { color: var(--dim); font-size: 11px; margin-left: 4px; }
.allowance { color: var(--dim); font-size: 13px; }

/* my requests */
.reqs { padding: 0 4vw; }
.req { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.req img, .req .noimg { width: 46px; height: 69px; object-fit: cover; border-radius: 4px; background: var(--card); flex: none; }
.req .t { font-weight: 600; } .req .k { color: var(--dim); font-size: 13px; }
.pill { margin-left: auto; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; white-space: nowrap; background: #222; }
.pill.ready { color: var(--green); } .pill.wait { color: var(--amber); } .pill.bad { color: #f66; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #222; padding: 10px 16px;
  border-radius: 6px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.6); max-width: 90vw; }
.empty { color: var(--dim); padding: 30px 4vw; }

/* row headings that open Browse */
.row h2 a.more span { color: var(--red); opacity: 0; transition: opacity .15s; }
.row h2 a.more:hover span, .row h2 a.more:focus span { opacity: 1; }
.bb-meta .ok { color: var(--green); }
.pad-top { height: 10px; }

/* loading placeholders */
@keyframes pulse { 50% { opacity: .5; } }
.skel-bb { height: min(62vh, 560px); margin-top: -58px; background: #111; animation: pulse 1.4s infinite; }
.skel-h { width: 140px; height: 18px; margin: 0 4vw 10px; background: #1c1c1c; border-radius: 4px; }
.row .card .noimg { animation: pulse 1.4s infinite; }

/* browse */
.br-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 4vw 4px; }
.seg { display: inline-flex; background: #1b1b1b; border-radius: 20px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--dim); font-weight: 700; padding: 6px 14px; border-radius: 16px; }
.seg button.on { background: #fff; color: #000; }
.br-bar select { background: #1b1b1b; color: var(--text); border: 1px solid #333; border-radius: 16px; padding: 6px 10px; font: inherit; font-size: 13px; }
.br-count { color: var(--dim); font-size: 13px; margin-left: auto; }
.gchips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 4vw; scrollbar-width: none; }
.gchips::-webkit-scrollbar { display: none; }
.gchips .chip { flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 14px 8px; padding: 8px 4vw; }
.grid .card, .grid .card img, .grid .card .noimg { width: 100%; min-width: 0; }
.grid .card img, .grid .card .noimg { height: auto; aspect-ratio: 2 / 3; }

/* quotas */
.quotas { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 18px 4vw; }
.q { background: var(--bg2); border-radius: 8px; padding: 14px; }
.q.dim { opacity: .55; }
.qn { font-weight: 700; font-size: 16px; display: flex; flex-direction: column; }
.qn span { color: var(--dim); font-weight: 400; font-size: 12px; }
.qbar { height: 6px; background: #2a2a2a; border-radius: 3px; margin: 10px 0 6px; overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--green); }
.qbar i.full { background: var(--red); }
.qv { color: var(--dim); font-size: 13px; }
.qnote { color: var(--dim); font-size: 12px; padding: 0 4vw; }

@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 6px; }
  nav { gap: 12px; }
  .topbar { gap: 10px; }
  .search-wrap { order: 5; min-width: 100%; }
  .card, .card img, .card .noimg { width: 112px; } .card img, .card .noimg { height: 168px; }
  .detail { padding: 0 16px 20px; } .detail h1 { font-size: 22px; }
}
