/* Watchlist Aggregator — dark "media library" theme */
:root {
  --bg:     #0f1115;
  --bg2:    #171a21;
  --panel:  #1d212b;
  --card:   #1d212b;
  --line:   #2a2f3a;
  --text:   #e7e9ee;
  --muted:  #9aa3b2;
  --accent: #ff8335;
  --accent2:#4f9cf9;
  --star:   #ffc24b;
  --radius: 10px;
  --header-h: 150px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.brand span { color: var(--accent); }
.counts { color: var(--muted); font-size: 13px; }
.counts b { color: var(--text); }

/* Segmented control: TV Series / Movies — sits in the toolbar beside search */
.seg { display: inline-flex; flex: 0 0 auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn { background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; line-height: 1; padding: 8px 16px; border-radius: 6px; cursor: pointer; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #1a1206; }

/* ---- Toolbar ---- */
.toolbar {
  max-width: 1400px; margin: 0 auto; padding: 14px 20px 0;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px;
}
.search input { flex: 1; background: none; border: 0; color: var(--text); padding: 11px 0; font-size: 15px; outline: none; }
.search .ico { color: var(--muted); }
select, input[type="number"] {
  background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none;
}
.check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---- Layout ---- */
.layout { max-width: 1400px; margin: 0 auto; padding: 16px 20px 60px; display: grid; grid-template-columns: 248px 1fr; gap: 22px; }
.filters-toggle { display: none; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }

.sidebar { position: sticky; top: calc(var(--header-h) + 8px); align-self: start; height: calc(100vh - var(--header-h) - 24px); display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-group { padding: 13px 15px; flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.filter-group:has(.year-row) { border-bottom: 0; }
.filter-group h3 { margin: 0 0 9px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.filter-group.genres { flex: 1 1 auto; min-height: 96px; display: flex; flex-direction: column; }
.genre-list { display: flex; flex-direction: column; gap: 7px; overflow: auto; flex: 1; padding-right: 8px; scrollbar-gutter: stable; }
.genre-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.genre-list input { accent-color: var(--accent); }
.genre-list .facet-n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.year-row { display: flex; align-items: center; gap: 8px; }
.year-row input { width: 100%; -moz-appearance: textfield; appearance: textfield; }
.year-row input::-webkit-outer-spin-button, .year-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.year-row span { color: var(--muted); }
.btn-clear { display: block; width: auto; margin: 13px 15px 15px; padding: 10px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; cursor: pointer; flex: 0 0 auto; }
.btn-clear:hover:not(:disabled) { border-color: var(--accent); }
.btn-clear:disabled { opacity: .4; cursor: default; }
.sidebar select { width: 100%; margin-bottom: 4px; }

/* ---- Results meta + grid ---- */
.results-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: transform .12s ease, border-color .12s ease; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.poster { position: relative; aspect-ratio: 2 / 3; background: linear-gradient(135deg, #232838, #161a22); overflow: hidden; }
.poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.72); color: var(--star); font-weight: 700; font-size: 12px; padding: 3px 7px; border-radius: 6px; }
.badge.year { left: 8px; right: auto; color: #fff; }
.card-body { padding: 9px 10px 11px; }
.card-type { display: inline-block; margin-bottom: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.card-type.tv { color: var(--accent); border-color: var(--accent); }
.card-type.mv { color: var(--accent2); border-color: var(--accent2); }
.card-title { font-size: 14px; font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sub { margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Pagination ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 28px; }
.pager button { background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .pageinfo { color: var(--muted); font-size: 14px; }
.pager input { width: 70px; text-align: center; }

.state { padding: 60px 20px; text-align: center; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; z-index: 50; padding: 24px; overflow: auto; }
.overlay.open { display: flex; align-items: flex-start; justify-content: center; }
.modal { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; max-width: 860px; width: 100%; margin: auto; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-head { display: flex; gap: 20px; padding: 22px; }
.modal-poster { flex: 0 0 210px; display: flex; flex-direction: column; gap: 12px; }
.modal-poster .modal-acts { flex-direction: column; gap: 8px; margin: 0; }
.modal-poster .modal-acts .toggle-btn { width: 100%; }
.modal-poster .rate-row { flex-direction: column; align-items: center; text-align: center; gap: 8px; margin: 2px 0 0; }
.modal-poster img { width: 200px; height: auto; max-height: 380px; object-fit: contain; border-radius: 10px; display: block; }
.modal-poster .ph { width: 200px; aspect-ratio: 2/3; border-radius: 10px; background: linear-gradient(135deg, #232838, #161a22); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.modal-info { flex: 1; min-width: 0; }
.modal-info h2 { margin: 0 0 6px; font-size: 24px; }
.modal-info .tagline { color: var(--muted); margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0; font-size: 14px; }
.meta-grid dt { color: var(--muted); }
.meta-grid dd { margin: 0; }
.modal .desc { padding: 0; margin: 14px 0 0; color: #cfd4de; line-height: 1.6; }
.links { display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 18px 0 0; }
.links a { background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; color: var(--text); font-weight: 600; }
.links a.imdb { color: #f5c518; }
.links a.trailer { color: var(--accent); }
.modal-close { position: absolute; top: 18px; right: 22px; font-size: 26px; line-height: 1; color: #fff; background: rgba(0,0,0,.4); border: 0; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; z-index: 2; }
.trailer-embed { padding: 0 22px 22px; }
.trailer-embed iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 10px; }
.notice { margin: 0 22px 18px; padding: 10px 14px; background: rgba(255,131,53,.1); border: 1px solid rgba(255,131,53,.3); border-radius: 8px; color: var(--accent); font-size: 13px; }
@media (max-width: 620px) { .modal-head { flex-direction: column; } .modal-poster { flex: none; align-self: center; } .modal.has-pick .modal-info h2 { padding-right: 0; } }

/* ---- Library sub-bar (underline view tabs + random) ---- */
.subbar { max-width: 1400px; margin: 0 auto; padding: 8px 20px 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.views { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.view-tab {
  background: none; border: 0; font: inherit; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 8px 13px 9px; cursor: pointer; border-bottom: 2px solid transparent; border-radius: 4px 4px 0 0;
}
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.pill-count { opacity: .6; font-weight: 700; font-size: 12px; margin-left: 1px; }
.random-btn {
  margin-left: auto; background: var(--bg2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13px; padding: 8px 16px; border-radius: 8px; cursor: pointer;
}
.random-btn:hover { border-color: var(--accent); }

/* ---- Card action buttons (favorite / watched) ---- */
.acts { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; z-index: 2; }
.act {
  width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 30px; text-align: center;
  padding: 0; opacity: .55; transition: opacity .12s, transform .12s, background .12s, color .12s;
}
.card:hover .act { opacity: .9; }
.act:hover { transform: scale(1.12); opacity: 1; }
.act.fav.on { background: var(--star); color: #2a1d00; opacity: 1; }
.act.wat.on { background: #3ecf6b; color: #062511; opacity: 1; }
.badge.year { left: 8px; right: auto; top: auto; bottom: 8px; }

/* Library/modal toggle buttons */
.modal-acts { display: flex; gap: 10px; margin: 4px 0 12px; }
.toggle-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px;
}
.toggle-btn:hover { border-color: var(--accent2); }
.toggle-btn.fav.on { background: var(--star); color: #2a1d00; border-color: var(--star); }
.toggle-btn.wat.on { background: #3ecf6b; color: #062511; border-color: #3ecf6b; }
/* "Pick another" — re-roll a random pick; pinned to the popup's top-right, beside the close button */
.pick-another { position: absolute; top: 16px; right: 66px; z-index: 3; display: inline-flex; align-items: center; gap: 8px; background: var(--accent); border: 0; color: #1a1206; font: inherit; font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.pick-another:hover { filter: brightness(1.06); }
.pick-another svg { width: 16px; height: 16px; flex: 0 0 auto; }
.modal.has-pick .modal-info h2 { padding-right: 168px; }
.suggest-note { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 80; background: var(--panel); border: 1px solid var(--accent); color: var(--text); padding: 12px 20px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* ---- Header account menu (email ▾ → Settings / Share / Log out) ---- */
.account { position: relative; margin-left: auto; }
.account-trigger { display: inline-flex; align-items: center; gap: 7px; background: none; border: 1px solid transparent; color: var(--text); font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.account-trigger:hover, .account.open .account-trigger { background: var(--bg2); border-color: var(--line); }
.account-trigger .who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-trigger .caret { display: inline-flex; color: var(--muted); transition: transform .15s; }
.account.open .account-trigger .caret { transform: rotate(180deg); }
.account-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 196px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.45); display: none; z-index: 30; }
.account.open .account-menu { display: block; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; padding: 9px 12px; border-radius: 7px; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--bg2); text-decoration: none; }
.menu-item.active { color: var(--accent); }
.menu-item.logout { color: var(--muted); }
.menu-item.logout:hover { color: var(--text); }
.menu-sep { height: 1px; background: var(--line); margin: 6px; }

/* ---- Login / register pages ---- */
.auth-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.auth-card .brand { font-size: 22px; font-weight: 800; margin-bottom: 18px; }
.auth-card .brand span { color: var(--accent); }
.auth-card h1 { font-size: 20px; margin: 0 0 20px; }
.auth-card form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.auth-card form input { display: block; width: 100%; margin-top: 6px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 11px 12px; font-size: 15px; outline: none; }
.auth-card form input:focus { border-color: var(--accent2); }
.auth-submit { width: 100%; margin-top: 4px; background: var(--accent); border: 0; color: #1a1206; font-weight: 700; padding: 12px; border-radius: 8px; cursor: pointer; font-size: 15px; }
.auth-submit:hover { filter: brightness(1.05); }
.auth-submit:disabled { opacity: .6; cursor: default; }
.auth-err { background: rgba(255,77,77,.12); border: 1px solid rgba(255,77,77,.4); color: #ff9b9b; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.auth-alt { margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.auth-back { margin: 8px 0 0; font-size: 13px; }
.auth-card a.brand { display: inline-block; text-decoration: none; color: var(--text); }
.auth-note { background: rgba(79,156,249,.1); border: 1px solid rgba(79,156,249,.35); color: var(--text); padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; }
.auth-note a { font-weight: 700; }

/* ---- Trailer lightbox (opens above the detail popup) ---- */
.trailer-overlay { z-index: 90; }
.trailer-box { position: relative; width: min(960px, 94vw); margin: auto; }
.trailer-box iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; display: block; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.trailer-box .modal-close { top: -46px; right: 0; }

/* ---- Landing page ---- */
body.landing { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 30px; background: radial-gradient(1200px 600px at 50% -10%, #1b2130, var(--bg)); }
.landing-wrap { max-width: 780px; text-align: center; }
.landing-brand { font-size: 26px; font-weight: 800; margin-bottom: 26px; }
.landing-brand span { color: var(--accent); }
.landing-title { font-size: 44px; line-height: 1.12; margin: 0 0 16px; letter-spacing: -.5px; }
.landing-sub { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 28px; }
.landing-cta { display: flex; gap: 14px; justify-content: center; margin-bottom: 44px; flex-wrap: wrap; }
.btn-primary, .btn-ghost { padding: 13px 28px; border-radius: 10px; font-weight: 700; font-size: 15px; }
.btn-primary { background: var(--accent); color: #1a1206; }
.btn-primary:hover { text-decoration: none; filter: brightness(1.06); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { text-decoration: none; border-color: var(--accent2); }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: left; }
.feat { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.feat-ico { font-size: 22px; line-height: 1.2; }
.feat b { display: block; margin-bottom: 3px; }
.feat span { color: var(--muted); font-size: 13px; }
.landing-foot { color: var(--muted); font-size: 13px; margin-top: 30px; }
@media (max-width: 640px) { .landing-features { grid-template-columns: 1fr; } .landing-title { font-size: 32px; } }

/* ---- Stats / Share panels ---- */
.layout.full { grid-template-columns: 1fr; }
body.panel-view .sidebar, body.panel-view #random,
body.panel-view .search, body.panel-view #sort,
body.panel-view #hidewatched-label, body.panel-view .filters-toggle { display: none; }
.stats-wrap { max-width: 720px; }
.stats-summary { font-size: 16px; color: var(--text); margin-bottom: 18px; }
.stats-summary b { color: var(--accent); }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.stat-card h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-big { font-size: 30px; font-weight: 800; }
.stat-big span { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; margin: 14px 0 10px; }
.stat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ff9d57); border-radius: 999px; min-width: 2px; }
.stat-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.stat-row .fav { color: var(--star); }
@media (max-width: 640px) { .stats-grid { grid-template-columns: 1fr; } }

/* ---- Share List ---- */
.shareview .share-wrap { max-width: 640px; }
.share-block { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.share-block h3 { margin: 0 0 6px; font-size: 15px; }
.share-block .muted { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.share-link { display: flex; gap: 8px; }
.share-link input { flex: 1; min-width: 0; background: var(--bg2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.share-link button { background: var(--accent); border: 0; color: #1a1206; font-weight: 700; padding: 0 18px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.share-link button:hover { filter: brightness(1.05); }
.share-list { list-style: none; padding: 0; margin: 0; }
.share-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.share-list li:last-child { border-bottom: 0; }
.share-list .muted { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
/* shared list page (share.php) */
.share-section { font-size: 16px; margin: 8px 0 14px; display: flex; align-items: center; gap: 8px; }
.share-section span { color: var(--muted); font-size: 13px; font-weight: 500; }
.share-empty { color: var(--muted); padding: 4px 0 26px; }
.share-card { cursor: default; }
.share-card:hover { transform: none; border-color: var(--line); }

/* ---- Loading bar ---- */
#loadbar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100; overflow: hidden; opacity: 0; transition: opacity .15s; pointer-events: none; }
#loadbar.on { opacity: 1; }
#loadbar::before { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--accent), #ff9d57, transparent); animation: loadbar 1s linear infinite; }
@keyframes loadbar { 0% { left: -40%; } 100% { left: 100%; } }

/* ---- To Watch button + star ratings ---- */
.act.tow.on { background: var(--accent2); color: #06121f; opacity: 1; }
.toggle-btn.tow.on { background: var(--accent2); color: #06121f; border-color: var(--accent2); }
/* "Not interested" / dismiss (Suggested-card corner button + modal toggle) */
.suggest-dismiss { position: absolute; bottom: 8px; right: 8px; z-index: 2; }
.act.dis.on { background: #c2453f; color: #fff; opacity: 1; }
.toggle-btn.dis.on { background: #c2453f; color: #fff; border-color: #c2453f; }
.stars { display: inline-flex; gap: 2px; color: #555c6b; font-size: 16px; line-height: 1; }
.stars .star.on { color: var(--star); }
.stars.interactive .star { cursor: pointer; }
.stars.interactive .star:hover { color: var(--star); }
.stars.big { font-size: 30px; gap: 8px; }
.rate-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 6px 0 12px; font-size: 14px; }
.rate-overall { font-weight: 700; color: var(--star); }
.rate-tmdb { font-weight: 700; color: #5fd0c8; }
.rate-mine { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.badge.tmdb { color: #5fd0c8; }

/* ---- Rating prompt ---- */
.rate-overlay { z-index: 95; }
.rate-box { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; max-width: 360px; width: 100%; margin: auto; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.rate-box h3 { margin: 0 0 4px; font-size: 18px; }
.rate-box .muted { margin: 0 0 14px; }
.rate-box .rate-stars { justify-content: center; }
.rate-box .modal-close { top: 8px; right: 12px; background: none; }
.rate-actions { margin-top: 16px; }
.rate-actions a { color: var(--muted); }

/* ---- Settings ---- */
.settings-wrap { max-width: 760px; }
.settings-block { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.settings-block h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.select-all { font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; cursor: pointer; }
.select-all:hover { text-decoration: underline; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px 14px; max-height: 220px; overflow: auto; }
.check-grid label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check-grid input { accent-color: var(--accent); }

/* ---- Share "shared with" ---- */
.share-list.people li { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mini { background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; }
.mini:hover { border-color: var(--accent); }

/* ---- Infinite scroll + small spinner ---- */
.loadmore { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px; color: var(--muted); font-size: 14px; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; margin: 0; }

/* ---- Empty-state actions ---- */
.empty-lib { max-width: 460px; margin: 0 auto; line-height: 1.5; }
.empty-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.empty-actions button { background: var(--bg2); border: 1px solid var(--line); color: var(--text); padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.empty-actions button:hover { border-color: var(--accent); }

/* ---- Clickable genre chips ---- */
.chips .chip { cursor: pointer; }
.chips .chip:hover { border-color: var(--accent2); color: var(--accent2); }

/* ---- Cast chips (clickable -> filter by actor) ---- */
.cast-row { margin: 12px 0 4px; }
.cast-h { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.cast-chip { background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.cast-chip:hover { border-color: var(--accent2); color: var(--accent2); }
.active-actor { margin-left: 12px; font-size: 13px; color: var(--muted); }
.active-actor b { color: var(--text); font-weight: 600; }
.clear-actor { margin-left: 6px; color: var(--muted); text-decoration: none; font-weight: 700; }
.clear-actor:hover { color: var(--accent2); }

/* ---- TMDb attribution ---- */
.tmdb-attr { color: var(--muted); font-size: 11px; line-height: 1.4; margin: 14px 4px 0; }
.tmdb-attr a { color: var(--accent2); text-decoration: none; }
.tmdb-attr a:hover { text-decoration: underline; }
.sidebar .tmdb-attr { margin: 0; padding: 2px 15px 14px; }
.tmdb-foot { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.landing .tmdb-attr { text-align: center; max-width: 560px; margin: 18px auto 0; }

/* ---- Related section (4-column grid) ---- */
.related { margin: 4px 22px 22px; }
.related-title { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.related-card { cursor: pointer; }
.related-card .poster { position: relative; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #232838, #161a22); }
.related-card .poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.related-card .poster .ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px; color: var(--muted); font-size: 12px; }
.related-card .rc-title { font-size: 12px; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.related-card:hover .rc-title { color: var(--accent2); }
@media (max-width: 620px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* ================= Responsive (kept last so it overrides base rules) ===== */
@media (max-width: 880px) {
  .layout { grid-template-columns: 1fr; padding: 14px 14px 50px; }
  .sidebar { position: static; height: auto; max-height: none; overflow: visible; display: none; margin-bottom: 4px; }
  body.filters-open .sidebar { display: flex; }
  .filter-group.genres { flex: 0 0 auto; }
  .genre-list { max-height: 300px; }
  .filters-toggle { display: inline-flex; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
  .modal { margin: 0 auto; }
}
@media (max-width: 620px) {
  .counts { display: none; }
  .brand { font-size: 18px; }
  .account-trigger { font-size: 13px; gap: 6px; padding: 6px 8px; }
  .account-trigger .who { max-width: 140px; }
  .header-inner { gap: 8px 12px; padding: 10px 14px; }
  .toolbar, .subbar { padding: 8px 14px 0; gap: 8px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .card-title { font-size: 13px; }
  .random-btn { margin-left: 0; }
  .seg-btn { padding: 7px 13px; }
}
