/*
 * Theme tokens. Dark is the default; [data-theme="light"] (set in each page's
 * <head> from the toggle or the OS preference) swaps the palette. --gold and
 * --gold-soft are fills and stay put; --gold-text is gold used as text, darker
 * in light mode so it stays readable on a pale background.
 */
:root {
  color-scheme: dark;
  --bg: #090c0a;
  --bg-soft: #0e1210;
  --panel: #121714;
  --panel-2: #19201c;
  --line: #25302a;
  --line-soft: #1d2520;
  --line-strong: #35433a;
  --text: #eef3ee;
  --muted: #8f9c94;
  --muted-2: #6a776f;
  --gold: #1faa5a;
  --gold-soft: #3cc77c;
  --gold-deep: #168a47;
  --gold-text: #46d489;
  --on-gold: #04170c;
  --green: #4ade80;
  --red: #f87171;
  --red-text: #fca5a5;
  --radius: 16px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --glow-1: rgba(31, 170, 90, 0.10);
  --glow-2: rgba(40, 110, 90, 0.07);
  --topbar-bg: rgba(9, 12, 10, 0.82);
  --toolbar-fade: rgba(9, 12, 10, 0.72);
  --btn-hover: #222b25;
  --poster-a: #222b25;
  --poster-b: #121714;
  --fallback-a: #232d27;
  --fallback-b: #131915;
  --fallback-text: rgba(243, 241, 234, 0.28);
  --stripe: rgba(255, 255, 255, 0.018);
  --scrim: rgba(6, 6, 10, 0.7);
  --dialog-shadow: #000;
  --knob: #8b8a98;
  --star-empty: #34403a;
  --toast-bg: #19201c;
  --hover-tint: rgba(255, 255, 255, 0.03);
  --glass: rgba(9, 12, 10, 0.72);
  --hero-art-opacity: 0.42;

  --tier-s-a: #7a2b2b; --tier-s-b: #471919; --tier-s-fg: #ffd9d9;
  --tier-a-a: #7a4a1e; --tier-a-b: #472912; --tier-a-fg: #ffe1bd;
  --tier-b-a: #6b5c1c; --tier-b-b: #3d330f; --tier-b-fg: #f4e7a8;
  --tier-c-a: #2c5a38; --tier-c-b: #17351f; --tier-c-fg: #c6f0d3;
  --tier-d-a: #254a66; --tier-d-b: #142d3d; --tier-d-fg: #c4e3f7;
  --tier-f-a: #3d3550; --tier-f-b: #221d2e; --tier-f-fg: #d8cfeb;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f5f1;
  --bg-soft: #e9eee8;
  --panel: #ffffff;
  --panel-2: #eef2ec;
  --line: #d2dacf;
  --line-soft: #e0e7de;
  --line-strong: #b6c1b3;
  --text: #171b18;
  --muted: #4f5a53;
  --muted-2: #75807a;
  --gold-text: #0e7a3d;
  --green: #16a34a;
  --red: #dc2626;
  --red-text: #b91c1c;
  --shadow: 0 18px 40px -22px rgba(60, 45, 20, 0.35);

  --glow-1: rgba(31, 170, 90, 0.14);
  --glow-2: rgba(40, 110, 90, 0.07);
  --topbar-bg: rgba(242, 245, 241, 0.86);
  --toolbar-fade: rgba(242, 245, 241, 0.72);
  --btn-hover: #e4eae2;
  --poster-a: #e6e1d7;
  --poster-b: #f2efe9;
  --fallback-a: #e3ded3;
  --fallback-b: #f1eee7;
  --fallback-text: rgba(27, 26, 23, 0.3);
  --stripe: rgba(0, 0, 0, 0.025);
  --scrim: rgba(40, 34, 24, 0.4);
  --dialog-shadow: rgba(40, 30, 10, 0.4);
  --knob: #a29d92;
  --star-empty: #dad5ca;
  --toast-bg: #ffffff;
  --hover-tint: rgba(0, 0, 0, 0.035);
  --glass: rgba(255, 255, 255, 0.82);
  --hero-art-opacity: 0.3;

  --tier-s-a: #f6c9c6; --tier-s-b: #eeb0ab; --tier-s-fg: #6b1612;
  --tier-a-a: #f8d8b5; --tier-a-b: #f0c391; --tier-a-fg: #6a3a0a;
  --tier-b-a: #f3e7a9; --tier-b-b: #e9d97f; --tier-b-fg: #5a4a06;
  --tier-c-a: #cbead3; --tier-c-b: #ade0bb; --tier-c-fg: #17482a;
  --tier-d-a: #c9e1f2; --tier-d-b: #a9cfea; --tier-d-fg: #123d5c;
  --tier-f-a: #ddd5ec; --tier-f-b: #c9bee0; --tier-f-fg: #3b2e5a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 92% 0%, var(--glow-2), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }

button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 44px);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--gold-soft), var(--gold-deep));
  color: var(--on-gold);
  font-size: 13px;
  padding-left: 2px;
}

.brand-name {
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.brand-name b { color: var(--text); font-weight: 700; }

.topbar-actions { display: flex; gap: 9px; align-items: center; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: progress; }

.btn-primary {
  background: linear-gradient(170deg, var(--gold-soft), var(--gold));
  border-color: var(--gold-deep);
  color: var(--on-gold);
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(170deg, #5fe09a, var(--gold-soft)); border-color: var(--gold); }

.btn-ghost { background: transparent; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- hero ---------- */

main { max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 44px) 40px; }

.hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: clamp(28px, 5vw, 56px) 0 32px;
  border-bottom: 1px solid var(--line-soft);
}

.ring-wrap { position: relative; width: clamp(124px, 15vw, 168px); aspect-ratio: 1; }

.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 8; }
.ring-value {
  fill: none;
  stroke: url(#none);
  stroke: var(--gold);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.ring-label strong { display: block; font-size: clamp(26px, 3.4vw, 36px); font-weight: 700; letter-spacing: -0.03em; }
.ring-label span { font-size: 12px; color: var(--muted); }

.eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-text);
  font-weight: 600;
}

.hero h1 { font-size: clamp(24px, 3.3vw, 38px); line-height: 1.12; max-width: 22ch; }
.hero-sub { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.section-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 26px;
}

.section-bar { min-width: 0; }
.section-bar-top { display: flex; justify-content: space-between; gap: 4px; font-size: 11px; }
.section-bar-name {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-bar-count { color: var(--muted-2); font-variant-numeric: tabular-nums; flex: none; }
.section-bar-count b { color: var(--text); font-weight: 600; }

.bar {
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin-top: 7px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-soft));
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar.is-complete > i { background: linear-gradient(90deg, #35b26a, var(--green)); }

/* ---------- toolbar ---------- */

.toolbar {
  position: sticky;
  top: 59px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  background: linear-gradient(var(--bg) 72%, var(--toolbar-fade));
  backdrop-filter: blur(10px);
}

.search-wrap { position: relative; flex: 1 1 250px; max-width: 380px; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 16px;
  pointer-events: none;
}
.search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 9px 34px 9px 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  outline: none;
  transition: border-color 0.15s ease;
}
#search:focus { border-color: var(--gold); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }

.chip {
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-pressed="true"] {
  background: rgba(31, 170, 90, 0.12);
  border-color: rgba(31, 170, 90, 0.5);
  color: var(--gold-text);
}
.chip span { color: var(--muted-2); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] span { color: var(--gold-text); }

/* ---------- sections ---------- */

.sections { display: flex; flex-direction: column; gap: 38px; }

.section-block { scroll-margin-top: 130px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line-soft);
}

.section-head h2 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.section-meta { margin: 3px 0 0; font-size: 12px; color: var(--muted-2); }

.section-head .bar { width: 140px; margin: 0 0 4px; flex: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 16px 14px;
}

/* ---------- cards ---------- */

.card {
  position: relative;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  overflow: hidden;
}
.card:hover, .card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  outline: none;
}
.card.is-watched { border-color: rgba(31, 170, 90, 0.35); }
.poster-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.badge-watched {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(10, 10, 14, 0.82);
  border: 1px solid rgba(31, 170, 90, 0.45);
  color: var(--gold-soft);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

.rating-chip {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(10, 10, 14, 0.82);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--gold-soft);
  font-variant-numeric: tabular-nums;
}

.quick-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(10, 10, 14, 0.6);
  color: transparent;
  font-size: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.card:hover .quick-toggle, .card:focus-within .quick-toggle, .quick-toggle.is-on { opacity: 1; }
.quick-toggle.is-on { background: var(--gold); border-color: var(--gold); color: #04170c; font-weight: 700; }
.quick-toggle:hover { background: var(--gold-soft); color: #04170c; }

.card-body { padding: 9px 10px 11px; }
.card-title {
  font-size: 12.8px;
  font-weight: 600;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.64em;
}
.card-sub {
  margin: 5px 0 0;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-tag {
  margin: 6px 0 0;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  border-top: 1px solid var(--line-soft);
  padding-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty { color: var(--muted-2); padding: 40px 0; text-align: center; }

/* ---------- footer ---------- */

.footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 44px) 48px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
}
.footer p { margin: 0 0 4px; }

/* ---------- dialogs ---------- */

dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 40px 90px -30px var(--dialog-shadow);
}
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(7px); }

.detail {
  width: min(940px, calc(100% - 28px));
  max-height: min(90vh, 780px);
  overflow: auto;
}
.detail[open] { animation: pop 0.18s ease-out; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.detail-grid { display: grid; grid-template-columns: 268px minmax(0, 1fr); }

.detail-poster { position: relative; background: var(--bg-soft); aspect-ratio: 2 / 3; }
.detail-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-poster .poster-fallback span { font-size: 40px; }

.detail-info { padding: 24px 26px 22px; min-width: 0; }

.detail-eyebrow {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-text);
  font-weight: 600;
}
.detail-info h2 { font-size: clamp(20px, 2.6vw, 27px); line-height: 1.15; }
.detail-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.detail-info .title-override { margin: 12px 0 0; max-width: 28rem; }
.detail-info .title-override + .muted-inline { margin: 6px 0 0; }

.facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 14px;
  margin: 16px 0 18px;
  font-size: 12.5px;
}
.facts dt { color: var(--muted-2); white-space: nowrap; }
.facts dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

.watch-panel {
  border: 1px solid var(--line-soft);
  background: var(--bg-soft);
  border-radius: 13px;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.switch { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px;
  height: 23px;
  border-radius: 99px;
  background: var(--line);
  border: 1px solid var(--line-strong);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
  flex: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--knob);
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch input:checked + .track { background: rgba(31, 170, 90, 0.24); border-color: rgba(31, 170, 90, 0.6); }
.switch input:checked + .track::after { transform: translateX(17px); background: var(--gold); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold-soft); outline-offset: 2px; }
.switch span.switch-label { font-size: 13px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); }
.field input[type="date"], .field input[type="text"], .field textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  outline: none;
  resize: vertical;
}
.field input[type="date"]:focus, .field input[type="text"]:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { min-height: 62px; font-size: 13px; }
.field.wide { grid-column: 1 / -1; }
.field input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; }

.check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; align-self: end; }
.check input { accent-color: var(--gold); width: 15px; height: 15px; }

.stars {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  outline: none;
  width: max-content;
  padding: 2px 0;
  border-radius: 6px;
}
.stars:focus-visible { box-shadow: 0 0 0 2px rgba(31, 170, 90, 0.5); }
.stars-bg, .stars-fill {
  font-size: 21px;
  letter-spacing: 3px;
  line-height: 1;
  white-space: nowrap;
}
.stars-bg { color: var(--star-empty); }
.stars-fill {
  position: absolute;
  left: 0;
  top: 2px;
  overflow: hidden;
  color: var(--gold);
  width: var(--fill, 0%);
}
.stars-value { font-size: 11.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; margin-left: 2px; }

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.detail-links a, .detail-links button {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
}
.detail-links a:hover, .detail-links button:hover { color: var(--text); border-color: var(--line-strong); text-decoration: none; }

.detail-close { position: sticky; top: 0; display: flex; justify-content: flex-end; padding: 10px 10px 0; margin-bottom: -44px; z-index: 3; }
.detail-close .icon-btn { background: var(--glass); color: var(--text); backdrop-filter: blur(6px); }

/* ---------- export sheet ---------- */

.sheet { width: min(620px, calc(100% - 28px)); max-height: 90vh; }
.sheet[open] { animation: pop 0.18s ease-out; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 18px 20px 22px; overflow: auto; max-height: calc(90vh - 60px); }

.muted { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }

.notice {
  border-radius: 11px;
  border: 1px solid rgba(31, 170, 90, 0.28);
  background: rgba(31, 170, 90, 0.07);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--gold-text);
  margin-bottom: 14px;
}
.notice b { color: var(--text); }
.notice ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.notice li { margin-bottom: 2px; }
.notice.is-error { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); color: var(--red-text); }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  z-index: 90;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--toast-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(248, 113, 113, 0.4); color: var(--red-text); }
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; text-align: left; }
.toast-action {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--gold-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.toast-action:hover { border-color: var(--gold); }

/* ---------- responsive ---------- */

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .ring-wrap { width: 118px; }
  .toolbar { top: 55px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-poster { max-height: 230px; aspect-ratio: auto; }
  .detail-poster img { object-position: center 22%; }
  .detail-info { padding: 18px; }
  .watch-panel { grid-template-columns: 1fr; }
  .section-head .bar { width: 90px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px 11px; }
  .section-bars { gap: 8px 8px; }
  .section-bar-top { font-size: 10px; gap: 3px; }
}

@media (max-width: 520px) {
  .brand-name { display: none; }
  .topbar { padding: 11px 16px; flex-wrap: wrap; row-gap: 8px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .topbar-actions .btn { padding: 8px 11px; font-size: 12.5px; }
  .hero h1 { font-size: 23px; }
  .section-bars { gap: 6px 6px; }
  .section-bar-top { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- tabs ---------- */

[hidden] { display: none !important; }

.tabs {
  display: flex;
  gap: 4px;
  padding-top: 14px;
  border-bottom: 1px solid var(--line-soft);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 9px 14px 11px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: var(--gold-text); border-bottom-color: var(--gold); }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.view-head h2 { font-size: 19px; }
.view-head p { margin: 4px 0 0; color: var(--muted-2); font-size: 12.5px; }

/* ---------- tier list ---------- */

.tiers { display: flex; flex-direction: column; gap: 10px; }

.tier-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  min-height: 92px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tier-row.is-over { border-color: var(--gold); background: rgba(31, 170, 90, 0.06); }

.tier-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  text-align: center;
}
.tier-label b { font-size: 22px; line-height: 1; }
.tier-label span {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.tier-S { background: linear-gradient(160deg, var(--tier-s-a), var(--tier-s-b)); color: var(--tier-s-fg); }
.tier-A { background: linear-gradient(160deg, var(--tier-a-a), var(--tier-a-b)); color: var(--tier-a-fg); }
.tier-B { background: linear-gradient(160deg, var(--tier-b-a), var(--tier-b-b)); color: var(--tier-b-fg); }
.tier-C { background: linear-gradient(160deg, var(--tier-c-a), var(--tier-c-b)); color: var(--tier-c-fg); }
.tier-D { background: linear-gradient(160deg, var(--tier-d-a), var(--tier-d-b)); color: var(--tier-d-fg); }
.tier-F { background: linear-gradient(160deg, var(--tier-f-a), var(--tier-f-b)); color: var(--tier-f-fg); }

.tier-items {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  min-height: 70px;
}

/* Poster tiles, like a proper tier list; the title shows on hover. */
.tier-film {
  position: relative;
  width: 78px;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.can-edit .tier-film { cursor: grab; }
.tier-film:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); }
.tier-film.is-dragging { opacity: 0.4; cursor: grabbing; }
.tier-film:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tier-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
}
.tier-thumb .poster-fallback span { font-size: 15px; }

.tier-film-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 6px 5px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.tier-film:hover .tier-film-title,
.tier-film:focus-visible .tier-film-title,
.tier-film.no-poster .tier-film-title { opacity: 1; }
@media (hover: none) { .tier-film-title { opacity: 1; } }
.tier-hint { align-self: center; padding-left: 4px; font-size: 12px; color: var(--muted-2); }

/* ---------- calendar ---------- */

.cal-head { align-items: center; }
.cal-nav { display: flex; align-items: center; gap: 8px; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: center;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }

.cal-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 92px;
  padding: 6px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--panel);
}
.cal-day.is-blank { border-color: transparent; background: transparent; }
.cal-day.is-today { border-color: rgba(31, 170, 90, 0.55); box-shadow: inset 0 0 0 1px rgba(31, 170, 90, 0.18); }

.cal-num { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.cal-day.has-films .cal-num { color: var(--gold-text); }

.cal-film {
  display: block;
  width: 100%;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: rgba(31, 170, 90, 0.12);
  color: var(--gold-text);
  font-size: 10.5px;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-film:hover { background: rgba(31, 170, 90, 0.22); }

@media (max-width: 720px) {
  .cal-day { min-height: 70px; }
  .cal-film { font-size: 9.5px; }
}

/* ---------- collections ---------- */

.collections { display: flex; flex-direction: column; gap: 26px; }
.collection-block { scroll-margin-top: 140px; }

.collection-new { display: flex; flex-wrap: wrap; gap: 8px; }
.collection-new input {
  flex: 1 1 240px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.collection-new input:focus { border-color: var(--gold); }

.collection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; flex: none; }

/* ---------- collection picker ---------- */

.picker-search {
  width: 100%;
  margin-bottom: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.picker-search:focus { border-color: var(--gold); }

.picker-list {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--bg-soft);
}

.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  cursor: pointer;
}
.picker-row:last-child { border-bottom: 0; }
.picker-row:hover { background: var(--hover-tint); }
.picker-row input { width: 15px; height: 15px; flex: none; accent-color: var(--gold); }

.picker-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-year { font-size: 11px; color: var(--muted-2); }
.picker-actions { margin: 12px 0 0; }

.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-text);
  font-size: 12px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.collections-box,
.id-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg-soft);
}

.box-title {
  margin: 0 0 9px;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.collection-toggles { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 9px; }

.collection-add { display: flex; flex-wrap: wrap; gap: 8px; }
.collection-add input {
  flex: 1 1 200px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-size: 12.5px;
}
.collection-add input:focus { border-color: var(--gold); }

.id-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.id-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.id-form input {
  width: 132px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.id-form input:focus { border-color: var(--gold); }

.field select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.field select:focus { border-color: var(--gold); }

.muted-inline { margin: 0; font-size: 12px; color: var(--muted-2); }

.cal-film { display: flex; align-items: center; gap: 5px; }

.cal-thumb {
  position: relative;
  flex: none;
  width: 22px;
  height: 33px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--panel-2);
}

.cal-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.multi-form { display: flex; flex-direction: column; gap: 10px; }
.multi-rows { display: flex; flex-direction: column; gap: 8px; }
.multi-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
}
.multi-row:first-child { border-top: 0; padding-top: 0; }
.multi-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.multi-row input[type="text"] {
  width: 132px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  font-size: 13px;
}
.multi-row .plex-field { flex: 1 1 220px; min-width: 0; }
.multi-row .plex-field input { width: 100%; }
.multi-row input:focus { border-color: var(--gold); }
.multi-row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.multi-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- sign-in / edit-only ---------- */

body:not(.can-edit) [data-edit-only] { display: none !important; }

.auth-area { display: flex; align-items: center; gap: 8px; }
.auth-area:empty { display: none; }
.auth-area form { margin: 0; }
.auth-user {
  display: flex;
  flex-direction: column;
  max-width: 14rem;
  font-size: 12.5px;
  line-height: 1.15;
  text-align: right;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-user small { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
#themeBtn svg { display: block; }

/* ---------- hero stills ---------- */

.hero { position: relative; isolation: isolate; }
.hero-art {
  position: absolute;
  inset: 0 calc(-1 * clamp(16px, 4vw, 44px));
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.hero-art-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 30%;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.hero-art-layer.is-shown { opacity: var(--hero-art-opacity); animation: drift 16s ease-out both; }
/* Fade the still into the page so the copy on the left stays readable. */
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 72%, transparent) 42%, transparent 78%),
    linear-gradient(0deg, var(--bg) 0%, transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, transparent 16%);
}
@keyframes drift {
  from { transform: scale(1.07); }
  to { transform: scale(1); }
}

.hero-caption {
  position: absolute;
  right: 0;
  bottom: 10px;
  max-width: 40%;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.hero-caption::before { content: "Still · "; }
.hero-caption:hover { color: var(--text); }

/* ---------- film sheet: banner, stills, read-only ---------- */

.detail-banner {
  position: relative;
  height: clamp(170px, 30vw, 300px);
  background: var(--art) center 28% / cover no-repeat;
}
.detail-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, var(--panel) 100%);
}
.banner-reset {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 1;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(10, 10, 14, 0.7);
  color: #f3f1ea;
  font-size: 11.5px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.detail-grid.has-banner { grid-template-columns: 228px minmax(0, 1fr); }
.detail-grid.has-banner .detail-poster {
  z-index: 1;
  align-self: start;
  margin: -150px 0 24px 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.75);
}
.detail-grid.has-banner .detail-info { padding-top: 16px; }

.stills { margin-top: 14px; }
.box-title span { margin-left: 4px; color: var(--muted); }
.stills-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}
.still {
  flex: none;
  width: 172px;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--panel-2);
  cursor: zoom-in;
  scroll-snap-align: start;
}
.still img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.still:hover img { transform: scale(1.06); }
.still:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.still.is-banner { border-color: var(--gold); }
.still.is-loading { cursor: default; animation: shimmer 1.1s ease-in-out infinite alternate; }
@keyframes shimmer {
  from { opacity: 0.45; }
  to { opacity: 0.95; }
}

.watch-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: var(--bg-soft);
}
.watch-summary-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tier-badge {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 800;
}
.tier-badge-name { font-size: 12.5px; color: var(--muted); }
.stars.is-static { cursor: default; }

/* ---------- stills lightbox (always dark: it's a screening room) ---------- */

.lightbox {
  width: min(1280px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  border-color: #222;
  background: #050507;
  color: #f3f1ea;
  overflow: hidden;
}
.lightbox[open] { animation: pop 0.18s ease-out; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.86); }
.lightbox-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.lightbox-count { min-width: 0; font-size: 12.5px; color: #b9b6c2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lightbox .btn,
.lightbox .icon-btn { border-color: #34343f; color: #f3f1ea; }
.lightbox .btn:hover { background: #1c1c25; }
.lightbox .btn:disabled { cursor: default; }
.lightbox-stage { position: relative; display: grid; place-items: center; background: #000; }
.lightbox-stage img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 120px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 64px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
}
.lightbox-nav:first-child { left: 10px; }
.lightbox-nav:last-child { right: 10px; }
.lightbox-nav:hover { background: rgba(0, 0, 0, 0.75); }

/* ---------- calendar stills ---------- */

.cal-day { min-height: 104px; }
.cal-day.has-art {
  border-color: transparent;
  background:
    linear-gradient(180deg, rgba(8, 8, 12, 0.2), rgba(8, 8, 12, 0.85)),
    var(--art) center / cover no-repeat;
}
.cal-day.has-art.is-today { border-color: var(--gold); }
.cal-day.has-art .cal-num { color: #fff; font-weight: 700; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.cal-day.has-art .cal-film { background: rgba(10, 10, 14, 0.62); color: #c9f3dc; backdrop-filter: blur(3px); }
.cal-day.has-art .cal-film:hover { background: rgba(10, 10, 14, 0.85); }

@media (max-width: 820px) {
  .detail-grid.has-banner { grid-template-columns: 1fr; }
  .detail-grid.has-banner .detail-poster {
    width: 112px;
    max-height: none;
    aspect-ratio: 2 / 3;
    margin: -86px 0 0 18px;
  }
  .detail-grid.has-banner .detail-poster img { object-position: center; }
  .hero-caption { display: none; }
}

@media (max-width: 720px) {
  .cal-day { min-height: 76px; }
  .still { width: 140px; }
}

/* ======================================================================
 * X-Files tracker: canonical list, series accents, continue panel, spoilers
 * ====================================================================== */

.brand-mark { padding-left: 0; font-weight: 800; letter-spacing: -0.04em; }

/* ---------- hero: continue-watching panel + per-series bars ---------- */

.section-bars { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.section-bar .bar > i { background: var(--accent, var(--gold)); }
.section-bar .bar.is-complete > i { background: var(--accent, var(--gold)); box-shadow: 0 0 8px var(--accent, var(--gold)); }

.continue {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  backdrop-filter: blur(10px);
}
.continue-art {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
}
.continue-art:hover .art-img { transform: scale(1.03); }
.continue-art .art-img { transition: transform 0.3s ease; }
.continue-body { min-width: 0; padding: 4px 6px 4px 0; }
.continue-body .eyebrow { margin-bottom: 6px; }
.continue-body h2 { font-size: clamp(19px, 2.4vw, 27px); line-height: 1.15; letter-spacing: -0.01em; }
.continue-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.continue-meta .dot { color: var(--muted-2); }
.continue-actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* ---------- artwork ---------- */

.art-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.art-img.is-generic { filter: saturate(0.75) brightness(0.85); }
.art-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 8px, transparent 8px 16px),
    linear-gradient(155deg, color-mix(in srgb, var(--accent, var(--gold)) 24%, var(--fallback-a)), var(--fallback-b));
}
.art-fallback span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: color-mix(in srgb, var(--accent, var(--gold)) 55%, var(--text));
}
.detail-poster .art-fallback span { font-size: 28px; }

/* ---------- toolbar ---------- */

.toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 10px; }
.toolbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  outline: none;
}
.select:focus-visible { border-color: var(--gold); }
.select:disabled { opacity: 0.45; cursor: default; }
.btn[aria-pressed="true"] {
  border-color: rgba(31, 170, 90, 0.55);
  color: var(--gold-text);
  background: rgba(31, 170, 90, 0.1);
}

/* ---------- series badge + plex tag ---------- */

.series-badge {
  display: inline-block;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 45%, transparent);
  background: color-mix(in srgb, var(--accent, var(--gold)) 16%, transparent);
  color: color-mix(in srgb, var(--accent, var(--gold)) 55%, var(--text));
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tag-plex {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(94, 121, 255, 0.5);
  background: rgba(94, 121, 255, 0.12);
  color: color-mix(in srgb, #5e79ff 65%, var(--text));
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-plex.is-launch:hover { background: rgba(94, 121, 255, 0.24); }

/* ---------- canonical list rows ---------- */

.rows {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.row {
  position: relative;
  display: grid;
  grid-template-columns: 40px 76px 118px 64px minmax(0, 1fr) 88px auto 30px;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 52px;
}
.row:last-child { border-bottom: 0; }
.row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--gold));
  opacity: 0.7;
}
.row:hover, .row:focus-visible { background: var(--hover-tint); outline: none; }
.row:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.row > * { grid-row: 1; }
.row-order { grid-column: 1; }
.row-thumb { grid-column: 2; }
.row-meta { display: contents; }
.row-meta > * { grid-row: 1; }
.row-meta .series-badge { grid-column: 3; justify-self: start; }
.row-meta .row-code { grid-column: 4; }
.row-title { grid-column: 5; }
.row-meta .row-date { grid-column: 6; }
.row-flags { grid-column: 7; }
.row-check, .row-status { grid-column: 8; }

.row-order { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.row-thumb {
  position: relative;
  width: 76px;
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel-2);
}
.row-code { font-size: 12px; letter-spacing: 0.04em; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-title { min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-date { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.is-watched .row-title { color: var(--muted); }
.row-flags { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-flags .rating-chip { position: static; }
.row-check, .row-status {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: transparent;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.row-check { cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease; }
.row-check:hover { border-color: var(--gold); color: var(--gold); }
.row-check.is-on, .row-status.is-on { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.row-check.is-on:hover { background: var(--gold-soft); color: var(--on-gold); }

/* ---------- cards (grouped / grid layout) ---------- */

.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card-art { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--panel-2); }
.card-order {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(9, 12, 10, 0.78);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.card-art .tag-plex { position: absolute; right: 8px; top: 8px; }
.can-edit .card-art .tag-plex { right: 42px; }
.card-sub { display: flex; align-items: center; gap: 6px; }
.card-sub .series-badge { flex: none; max-width: 70%; }

/* ---------- detail dialog ---------- */

.synopsis p { margin: 0 0 10px; line-height: 1.55; }
.synopsis .box-title { margin-bottom: 6px; }
.synopsis .link-btn { margin-left: 8px; text-transform: none; letter-spacing: 0; }
.synopsis.is-hidden {
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--panel-2);
}
.synopsis.is-hidden .muted-inline { margin-bottom: 10px; }
.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.status-pill.is-on { border-color: rgba(31, 170, 90, 0.5); color: var(--gold-text); background: rgba(31, 170, 90, 0.1); }

/* ---------- tiers, calendar, collection picker ---------- */

.tier-thumb { aspect-ratio: 16 / 9; }
.tier-film { width: 138px; }
.tier-thumb .art-fallback span { font-size: 11px; }
.cal-thumb { width: 40px; height: 23px; border-radius: 3px; }
.picker-order { flex: none; width: 30px; color: var(--muted-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ---------- narrow screens ---------- */

@media (max-width: 900px) {
  .section-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .continue { grid-template-columns: 1fr; }
  .toolbar { position: static; }
  .toolbar-end { margin-left: 0; }

  .row {
    grid-template-columns: 34px 72px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    row-gap: 3px;
    padding-right: 10px;
  }
  .row > * { grid-row: auto; }
  .row-order { grid-column: 1; grid-row: 1 / span 2; }
  .row-thumb { grid-column: 2; grid-row: 1 / span 2; width: 72px; }
  .row-title { grid-column: 3; grid-row: 1; }
  .row-flags { grid-column: 4; grid-row: 1; }
  .row-meta {
    grid-column: 3 / span 2;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    min-width: 0;
  }
  .row-meta > * { grid-column: auto; grid-row: auto; }
  .row-check, .row-status { grid-column: 4; grid-row: 2; justify-self: end; }
}
