:root {
  color-scheme: dark;
  --bg: #101115;
  --sidebar: #131419;
  --panel: #181a20;
  --raised: #202229;
  --line: #292b34;
  --text: #f3f2f4;
  --muted: #a4a5af;
  --subtle: #83858f;
  --gold: #f6b859;
  --gold-hover: #ffc674;
  --ink: #1d150b;
  --side-width: 230px;
  font-family: 'Golos Text', system-ui, sans-serif;
  font-size: 100%;
  font-weight: 400;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button, a, input, select, textarea { transition: background-color .16s, color .16s, border-color .16s, opacity .16s; }
a { color: inherit; }
p, h1, h2, h3 { margin: 0; }
.shell { min-height: 100vh; }
.workspace { margin-left: var(--side-width); min-height: 100vh; display: flex; flex-direction: column; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  width: var(--side-width);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 81px;
  flex: 0 0 81px;
  padding: 0 23px;
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -.045em;
}
.brand img { flex: none; display: block; }
.brand-dot { color: var(--gold); }
.navigation { padding: 20px 13px; display: grid; gap: 4px; }
.nav-label { padding: 0 11px; color: var(--subtle); font-size: .75rem; font-weight: 700; letter-spacing: .092em; margin: 0 0 7px; }
.nav-label:not(:first-child) { margin-top: 24px; }
.nav-link {
  position: relative;
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border-radius: 7px;
  color: #b7b7c0;
  text-decoration: none;
  font-weight: 500;
  font-size: .89rem;
  white-space: nowrap;
}
.nav-link svg { flex: none; color: #92939e; }
.nav-link:hover { background: var(--raised); color: var(--text); }
.nav-link.active { background: #2b241c; color: var(--gold); }
.nav-link.active svg { color: var(--gold); }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 11px; bottom: 11px; width: 2px; border-radius: 2px; background: var(--gold); }
.nav-count { margin-left: auto; color: var(--subtle); font-size: .8rem; font-variant-numeric: tabular-nums; }
.nav-link.active .nav-count { color: var(--gold); }
.nav-divider { height: 1px; margin: 13px 8px 8px; background: var(--line); }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 81px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: var(--sidebar);
}
.search { width: min(388px, 100%); position: relative; display: flex; align-items: center; height: 43px; color: var(--muted); }
.search > span { position: absolute; left: 13px; display: grid; place-items: center; pointer-events: none; }
.search input {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #191b21;
  padding: 0 14px 0 41px;
  font-size: .88rem;
}
.search input::placeholder { color: #9a9ca7; }
.search input:focus { border-color: #8c6c40; outline-offset: 1px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.button, .icon-button {
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.1;
  color: var(--text);
  background: none;
  flex-shrink: 0;
}
.button { padding: 0 15px; min-height: 42px; }
.button svg, .icon-button svg { flex: none; }
.icon-button { padding: 0; width: 42px; height: 42px; }
.button-primary { background: var(--gold); color: var(--ink); }
.button-primary:hover { background: var(--gold-hover); }
.button-secondary { background: #23252d; border-color: #343640; }
.button-secondary:hover, .icon-button:hover { background: #30323d; }
.add-top { margin-left: auto; }
.add-top > span:first-child { display: flex; }
.account-initial { display: grid; width: 100%; height: 100%; place-items: center; border-radius: inherit; color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.auth-note:empty { display: none; }
.auth-note:not(:empty) { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.mobile-menu { display: none; }
.main { flex: 1; padding: 28px 34px 0; width: 100%; max-width: 1650px; margin: 0 auto; }

.hero {
  position: relative;
  isolation: isolate;
  min-height: 362px;
  overflow: hidden;
  display: flex;
  align-items: center;
  border: 1px solid #5a3a26;
  border-radius: 13px;
  background: #29190f;
}
.hero-art { position: absolute; inset: 0 0 0 auto; width: 84%; height: 100%; object-fit: cover; object-position: center 39%; z-index: -2; }
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #25160e 0%, #25160e 13%, #24160fe8 27%, #24160e80 45%, #21160c00 75%),
    linear-gradient(0deg, #170f0bad 0%, transparent 45%);
}
.hero-content { padding: 29px 38px; width: min(530px, 100%); }
.hero-kicker { display: flex; align-items: center; gap: 8px; color: #fac881; text-transform: uppercase; letter-spacing: .14em; font-size: .73rem; font-weight: 700; margin-bottom: 12px; }
.hero-kicker span { width: 16px; height: 2px; border-radius: 2px; background: var(--gold); }
.hero h1 { color: #fff7ed; font-size: clamp(2.55rem, 4.18vw, 4rem); font-weight: 800; line-height: .99; letter-spacing: -.061em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: #ead8c8; font-size: .88rem; font-weight: 500; margin-top: 15px; }
.hero-meta span { height: 3px; width: 3px; border-radius: 50%; background: #d1a883; }
.hero-description { color: #e0d2cb; font-size: .94rem; line-height: 1.53; max-width: 365px; margin-top: 11px; }
.hero-actions { display: flex; gap: 9px; margin-top: 20px; }
.hero-actions .button { min-height: 43px; padding: 0 15px; }
.hero-save { height: 43px; width: 43px; border-color: #ffffff35; background: #21150f66; }
.hero-save:hover { background: #6d4835; }

.catalog-section { margin-top: 33px; }
.catalog-section.standalone { margin-top: 5px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 17px; }
.section-heading h1, .section-heading h2 { font-size: clamp(1.8rem, 3vw, 2.32rem); font-weight: 750; letter-spacing: -.046em; line-height: 1.07; }
.section-heading p { color: var(--muted); font-size: .9rem; line-height: 1.45; padding-bottom: 2px; }
.standalone .section-heading { display: block; margin-bottom: 23px; }
.standalone .section-heading p { margin-top: 7px; }
.tabs { display: flex; margin-bottom: 18px; gap: 8px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 4px; margin-left: -2px; }
.tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #2b2d36;
  border-radius: 7px;
  color: #bcbec8;
  background: #191b21;
  font-size: .875rem;
  font-weight: 500;
}
.tab:hover { color: var(--text); border-color: #545762; }
.tab.active { background: #30251a; border-color: #684b2b; color: #ffcd83; }
.poster-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 26px 14px; }
.card { min-width: 0; }
.card-image { position: relative; aspect-ratio: 2 / 3; isolation: isolate; border-radius: 9px; }
.artwork { overflow: hidden; border: 1px solid #34343d; background: radial-gradient(ellipse at top right, #4d3d30, #20222b 64%); color: #a09280; display: grid; place-items: center; }
.artwork img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; transition: transform .28s ease; }
.artwork.wikidata-art img { object-fit: contain; padding: 16px; background: var(--panel); }
.card-image .artwork { position: absolute; inset: 0; border-radius: inherit; }
.card-image:hover .artwork img { transform: scale(1.035); }
.card-hit { position: absolute; inset: 0; border: 0; background: transparent; border-radius: inherit; }
.card-hit:focus-visible { outline-offset: 2px; }
.card-save { position: absolute; top: 8px; right: 8px; width: 31px; height: 31px; border-radius: 6px; border-color: #ffffff29; background: #101015b8; backdrop-filter: blur(8px); }
.card-save:hover { background: #22222b; }
.is-saved { color: var(--gold); }
.is-saved svg { fill: #f6b8594d; }
.rating { position: absolute; top: 9px; left: 8px; color: #ffcf87; background: #161216da; border: 1px solid #ffffff25; border-radius: 5px; padding: 3px 5px; display: flex; align-items: center; gap: 3px; font-size: .73rem; font-weight: 700; pointer-events: none; }
.rating svg { fill: #ffcf87; }
.card-title { background: none; color: var(--text); border: 0; text-align: left; padding: 0; margin-top: 9px; font-weight: 600; font-size: .93rem; line-height: 1.25; }
.card-title:hover { color: var(--gold); }
.card-meta, .card-state { margin-top: 4px; font-size: .82rem; line-height: 1.25; color: var(--muted); }
.card-state { color: #e6ae67; }
.card-progress { position: absolute; pointer-events: none; bottom: 0; left: 0; right: 0; height: 4px; background: #111119aa; border-radius: 0 0 9px 9px; overflow: hidden; }
.card-progress span { display: block; background: var(--gold); height: 100%; }
.catalog-hint, .results-note { color: var(--muted); font-size: .89rem; line-height: 1.4; margin: 19px 0 3px; }
.catalog-hint { display: flex; align-items: center; gap: 7px; }
.results-note { margin: 0 0 14px; }
.coverage-panel { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); padding: 13px 15px; }
.coverage-panel summary { cursor: pointer; font-weight: 700; }
.coverage-panel > p { color: var(--muted); font-size: .84rem; line-height: 1.4; margin: 7px 0 10px; }
.coverage-scroll { overflow-x: auto; }
.coverage-panel table { border-collapse: collapse; width: 100%; min-width: 530px; font-size: .84rem; }
.coverage-panel th, .coverage-panel td { border-top: 1px solid var(--line); padding: 7px 8px; text-align: left; }
.coverage-panel th { color: var(--text); font-weight: 600; }
.coverage-panel td { color: var(--muted); font-variant-numeric: tabular-nums; }
.coverage-footnote { color: var(--muted); font-size: .78rem; line-height: 1.4; margin: 8px 0 0; }
.item-coverage { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 10px 11px; }
.item-coverage h3 { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.item-coverage h3 span { color: var(--accent); font-variant-numeric: tabular-nums; }
.item-coverage p, .detail-extra { color: var(--muted); font-size: .82rem; line-height: 1.4; margin-top: 6px; }
.item-coverage p strong, .detail-extra strong { color: var(--text); }
.image-credit { color: var(--muted); font-size: .76rem; line-height: 1.4; margin-top: 8px; }
.image-credit a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.source-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.empty { display: grid; place-items: center; text-align: center; min-height: 245px; padding: 24px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 11px; color: var(--gold); background: #30251a; }
.empty h2 { margin-top: 9px; font-size: 1.28rem; }
.empty p { color: var(--muted); max-width: 460px; margin: 7px 0 15px; line-height: 1.45; }
.footer { margin: 32px 34px 0; border-top: 1px solid var(--line); padding: 16px 0 19px; display: flex; justify-content: space-between; color: var(--muted); font-size: .82rem; gap: 14px; }
.text-button { border: 0; background: none; color: var(--muted); padding: 0; }
.text-button:hover { color: var(--gold); }

.stat-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; border: 1px solid var(--line); background: var(--panel); padding: 15px; border-radius: 10px; margin-bottom: 16px; }
.stat-filters label, .detail-controls label, .form-content label { display: grid; gap: 6px; min-width: 0; }
.stat-filters label > span, .detail-controls label > span, .view-counter > span, .form-content label > span { font-size: .875rem; font-weight: 500; color: #c3c4cf; }
select, .form-content input:not([type=checkbox]), textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #363843;
  border-radius: 7px;
  padding: 8px 10px;
  background: #1b1d24;
  color: var(--text);
}
select {
  appearance: none;
  padding-right: 33px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23bbbbc5' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metric, .stat-panel { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.metric { min-height: 144px; display: grid; align-content: start; gap: 7px; font-size: .86rem; color: var(--muted); }
.metric strong { font-size: 1.85rem; color: var(--text); line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-icon { width: 35px; height: 35px; display: grid; place-items: center; color: var(--gold); background: #30251a; border-radius: 7px; }
.breakdowns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-panel h2 { display: flex; gap: 9px; align-items: center; font-size: 1.1rem; margin-bottom: 13px; }
.stat-panel h2 svg { color: var(--gold); }
.stat-panel p { color: var(--muted); font-size: .9rem; }
.stat-panel ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 11px; }
.stat-panel li > div:first-child { display: flex; justify-content: space-between; gap: 6px; font-size: .88rem; margin-bottom: 4px; color: #d5d5df; }
.bar { height: 5px; background: #292b33; border-radius: 3px; }
.bar span { display: block; background: var(--gold); height: 100%; border-radius: 3px; }

dialog {
  color: var(--text);
  border: 1px solid #3a3c46;
  border-radius: 13px;
  background: #191b22;
  padding: 0;
  max-height: min(86vh, 900px);
  max-width: calc(100% - 24px);
  box-shadow: 0 28px 75px #0009;
}
dialog::backdrop { background: #08090bc2; backdrop-filter: blur(3px); }
.close-dialog { position: absolute; top: 12px; right: 12px; z-index: 1; width: 34px; height: 34px; color: #ceced7; background: #262832; border-color: #393b46; }
.detail-dialog { width: 700px; }
.detail-content, .form-content { padding: 26px; }
.detail-heading { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 20px; align-items: start; }
.detail-poster { position: relative; aspect-ratio: 2/3; border-radius: 8px; }
.detail-overview { padding-right: 25px; }
.detail-type { font-size: .82rem; color: var(--gold); font-weight: 600; margin: 0 0 5px; }
.detail-overview h2, .form-content h2 { font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.14; letter-spacing: -.036em; }
.original, .detail-meta, .description { font-size: .9rem; color: var(--muted); line-height: 1.45; margin-top: 6px; }
.description { color: #dad9df; margin-top: 9px; }
.genres { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.genres span { border: 1px solid #383944; color: #ceced8; padding: 4px 7px; border-radius: 5px; font-size: .75rem; }
.source-link, .form-content a { display: inline-block; color: #ffd08a; margin-top: 8px; font-size: .85rem; }
.detail-controls { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 15px 0; margin-top: 20px; align-items: start; }
.view-counter { display: grid; gap: 6px; }
.stepper { display: inline-flex; align-items: center; justify-content: space-between; min-height: 42px; border-radius: 7px; border: 1px solid #363843; }
.stepper button { width: 40px; height: 39px; color: var(--gold); }
.stepper output { min-width: 35px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.episodes { margin-top: 17px; }
.episodes-heading, .season-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.episodes-heading h3 { font-size: 1.15rem; }
.episodes-heading .button { min-height: 36px; }
.episode-message { color: var(--muted); font-size: .9rem; margin: 10px 0; }
.season-info { margin: 11px 0 7px; color: var(--muted); font-size: .85rem; }
.season-info select { width: auto; min-width: 135px; min-height: 36px; }
.episode-list { margin: 0; padding: 0; list-style: none; }
.episode-list li + li { border-top: 1px solid var(--line); }
.episode-row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 7px 4px; font-size: .9rem; cursor: pointer; }
.episode-row:hover { background: #23252e; }
input[type=checkbox] { accent-color: var(--gold); width: 17px; height: 17px; cursor: pointer; }
.episode-index { color: var(--subtle); font-variant-numeric: tabular-nums; }
.episode-name { flex: 1; }
.episode-runtime { flex: none; color: var(--muted); }
.detail-footer { margin-top: 16px; }
.form-dialog { width: 530px; }
.form-content > p { font-size: .91rem; color: var(--muted); margin-top: 9px; line-height: 1.5; }
.form-content h2 { padding-right: 30px; }
.form-content form { display: grid; gap: 12px; margin-top: 17px; }
.form-content textarea { min-height: 78px; resize: vertical; }
.form-content input::placeholder, .form-content textarea::placeholder { color: #81838e; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-content .checkbox-label { display: flex; align-items: center; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.toast {
  position: fixed;
  bottom: 21px;
  right: 22px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 44px);
  padding: 11px 14px;
  background: #28272e;
  color: #f5f1ec;
  border: 1px solid #48434a;
  border-radius: 8px;
  font-size: .9rem;
  opacity: 0;
  transform: translateY(7px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast:empty { visibility: hidden; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast svg { color: var(--gold); flex: none; }

@media (max-width: 1180px) {
  :root { --side-width: 205px; }
  .topbar { padding-inline: 24px; }
  .main { padding-inline: 24px; }
  .footer { margin-inline: 24px; }
  .hero-content { padding-inline: 28px; }
  .poster-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .poster-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero { min-height: 328px; }
  .hero-art { width: 100%; object-position: 62% 46%; }
  .hero::before { background: linear-gradient(90deg, #25160ef5 0%, #25160ec9 31%, #24160e70 61%, #21160c00 100%), linear-gradient(0deg, #170f0b9c 0%, transparent 50%); }
  .section-heading { align-items: start; flex-direction: column; gap: 5px; }
  .stats .metrics, .stat-filters { grid-template-columns: repeat(2, 1fr); }
  .breakdowns { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .workspace { margin-left: 0; }
  .sidebar { width: min(260px, 75vw); transform: translateX(-100%); transition: transform .18s ease; }
  .menu-open .sidebar { transform: translateX(0); box-shadow: 0 0 0 100vmax #0008; }
  .mobile-menu { display: inline-flex; margin-left: -6px; width: 36px; color: var(--muted); }
  .topbar { min-height: 64px; padding-inline: 17px; gap: 8px; }
  .main { padding: 18px 17px 0; }
  .footer { margin-inline: 17px; }
  .add-top { padding-inline: 10px; min-height: 40px; font-size: .82rem; }
  .search { flex: 1; min-width: 0; height: 40px; }
  .search input { padding: 0 7px 0 32px; }
  .search > span { left: 8px; }
  .search > span svg { width: 17px; }
  .hero { min-height: 318px; }
  .hero-art { object-position: 61% 47%; }
  .hero-content { padding: 22px; }
  .catalog-section { margin-top: 26px; }
  .poster-grid { gap: 20px 10px; }
}
@media (max-width: 510px) {
  .hero-art { object-position: 58% 50%; }
  .hero-content { width: min(340px, 100%); }
  .hero-description { max-width: 246px; font-size: .86rem; }
  .hero h1 { font-size: 2.48rem; }
  .hero-meta { font-size: .82rem; }
  .poster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rating { top: 5px; left: 5px; }
  .card-save { top: 5px; right: 5px; width: 29px; height: 29px; }
  .card-title { font-size: .87rem; }
  .card-meta { font-size: .76rem; }
  .detail-content, .form-content { padding: 18px; }
  .detail-heading { grid-template-columns: 83px minmax(0, 1fr); gap: 11px; }
  .detail-overview { padding-right: 22px; }
  .detail-controls { grid-template-columns: minmax(0, 1fr) 136px; gap: 8px; }
  .view-counter > span { font-size: .8rem; }
  .form-grid { gap: 8px; }
}
@media (max-width: 370px) {
  .add-top { width: 38px; padding: 0; }
  .add-top span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* User-selected palette and appearance */
:root[data-palette="sky"] {
  --palette-base: #c9e3fb;
  --accent: #234bcb; --accent-hover: #193fae; --accent-ink: #fff;
  --selected-bg: #d7e8fa; --focus: #4977dc;
}
:root[data-palette="pistachio"] {
  --palette-base: #dce9ae;
  --accent: #a62355; --accent-hover: #861d46; --accent-ink: #fff;
  --selected-bg: #e5edcb; --focus: #ad4267;
}
:root[data-palette="sand"] {
  --palette-base: #eed5ae;
  --accent: #a92e28; --accent-hover: #8b2521; --accent-ink: #fff;
  --selected-bg: #f1e0c7; --focus: #bd554b;
}
:root[data-palette="lilac"] {
  --palette-base: #e4d4f5;
  --accent: #703d91; --accent-hover: #5c3177; --accent-ink: #fff;
  --selected-bg: #eadcf4; --focus: #8657a5;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: color-mix(in srgb, var(--palette-base) 38%, #f6f8fc);
  --sidebar: color-mix(in srgb, var(--palette-base) 54%, #fff);
  --panel: color-mix(in srgb, var(--palette-base) 24%, #fff);
  --raised: color-mix(in srgb, var(--palette-base) 58%, #fff);
  --line: color-mix(in srgb, var(--palette-base) 38%, #b8c3d2);
  --text: #20283a; --muted: #58657b; --subtle: #67758a; --ink: #fff;
  --gold: var(--accent); --gold-hover: var(--accent-hover);
  --palette-soft: color-mix(in srgb, var(--accent) 13%, var(--panel));
  --input-bg: color-mix(in srgb, var(--palette-base) 12%, #fff);
  --border-strong: color-mix(in srgb, var(--palette-base) 30%, #aebbd0);
  --artwork-glow: color-mix(in srgb, var(--palette-base) 70%, #68758b);
  --artwork-shadow: color-mix(in srgb, var(--palette-base) 25%, #485267);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: color-mix(in srgb, var(--palette-base) 12%, #121722);
  --sidebar: color-mix(in srgb, var(--palette-base) 17%, #151b27);
  --panel: color-mix(in srgb, var(--palette-base) 21%, #1b2331);
  --raised: color-mix(in srgb, var(--palette-base) 30%, #252f40);
  --line: color-mix(in srgb, var(--palette-base) 32%, #303b4d);
  --text: #edf2fb; --muted: #b2bfd3; --subtle: #98a6bb; --ink: #fff;
  --gold: var(--accent); --gold-hover: var(--accent-hover);
  --palette-soft: color-mix(in srgb, var(--accent) 21%, var(--panel));
  --input-bg: color-mix(in srgb, var(--palette-base) 16%, #1b2331);
  --border-strong: color-mix(in srgb, var(--palette-base) 29%, #39465a);
  --artwork-glow: color-mix(in srgb, var(--palette-base) 48%, #343c4e);
  --artwork-shadow: color-mix(in srgb, var(--palette-base) 12%, #171b26);
}
:root[data-theme="light"] body { background: var(--bg); color: var(--text); }
:root[data-theme="light"] .sidebar,
:root[data-theme="light"] .topbar { border-color: var(--line); }
:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .topbar { border-color: var(--line); }
.nav-link { color: var(--muted); }
.nav-link svg { color: var(--subtle); }
.nav-link.active { background: var(--selected-bg); color: var(--accent); }
.nav-link.active svg, .nav-link.active .nav-count { color: var(--accent); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--accent-hover); }
.search input, .stat-filters, .metric, .stat-panel, select,
.form-content input:not([type=checkbox]), textarea {
  background-color: var(--input-bg, #191b21);
  border-color: var(--border-strong, var(--line));
}
.search input, select, .form-content input:not([type=checkbox]), textarea { color: var(--text); }
.search input::placeholder, .form-content input::placeholder, textarea::placeholder { color: var(--subtle); }
.search input:focus { border-color: var(--focus, #8c6c40); }
.stat-filters, .metric, .stat-panel { background-color: var(--panel); }
.empty-icon, .metric-icon { background: var(--palette-soft, #30251a); color: var(--accent); }
.button-secondary { background: var(--raised); border-color: var(--line); color: var(--text); }
.stepper, .genres span, .season-info select { border-color: var(--line); }
.card-save.is-saved { color: var(--accent); }
.rating { color: var(--accent); }
.rating svg { fill: var(--accent); }
.tabs .tab.active { background: var(--selected-bg); border-color: var(--accent); color: var(--accent); }
.toast { color: var(--text); background: var(--panel); border-color: var(--line); }

:root[data-theme="light"] .hero-save,
:root[data-theme="light"] .card-save {
  color: #182033;
  background: rgba(255, 255, 255, .94);
  border-color: rgba(24, 32, 51, .18);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .2);
}
:root[data-theme="light"] .hero-save:hover,
:root[data-theme="light"] .card-save:hover {
  color: var(--accent);
  background: #fff;
  border-color: var(--accent);
}
:root[data-theme="light"] .hero-save.is-saved,
:root[data-theme="light"] .card-save.is-saved { color: var(--accent); }
:root[data-theme="light"] .rating {
  color: #111827;
  background: #fff;
  border-color: #111827;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
:root[data-theme="dark"] .rating {
  color: #fff;
  background: #111318;
  border-color: rgba(255, 255, 255, .78);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.rating svg { fill: currentColor; }
:root[data-theme="light"] .nav-link.active::before { background: var(--accent); }
:root[data-theme="dark"] .nav-link.active::before { background: var(--accent); }
.settings-page { max-width: 910px; }
.settings-page .section-heading { margin-bottom: 20px; }
.settings-group { margin-top: 21px; }
.settings-group-heading { margin-bottom: 9px; }
.settings-group-heading h2 { font-size: 1.16rem; letter-spacing: -.025em; }
.setting-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.palette-options { grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); }
.setting-choice {
  width: 100%; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); text-align: left;
}
.setting-choice:hover { border-color: var(--accent); background: var(--raised); }
.setting-choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.setting-choice-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.setting-choice-copy strong { font-size: .82rem; font-weight: 600; }
.setting-choice-copy small { font-size: .79rem; line-height: 1.35; color: var(--muted); }
.setting-swatch {
  position: relative; flex: none; width: 24px; height: 24px; border-radius: 6px;
  background: var(--swatch-base); border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
}
.setting-swatch::after {
  content: ''; position: absolute; width: 11px; height: 11px; right: -3px; bottom: -3px;
  border: 2px solid var(--panel); border-radius: 50%; background: var(--swatch-accent);
}
.setting-radio {
  display: grid; place-items: center; flex: none; width: 16px; height: 16px;
  border: 1px solid var(--subtle); border-radius: 50%;
}
.setting-choice.selected .setting-radio { border: 6px solid var(--accent); }
.appearance-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.appearance-options .setting-choice > svg { color: var(--accent); }
@media (max-width: 560px) {
  .setting-options { grid-template-columns: 1fr; }
  .palette-options { grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); }
  .appearance-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .appearance-options .setting-choice { flex-direction: column; justify-content: center; min-height: 86px; padding: 8px; }
  .appearance-options .setting-radio { display: none; }
}

/* Carry the selected palette across surfaces, controls, and supporting UI. */
.nav-link.active::before { background: var(--accent); }
.tab { color: var(--muted); background: var(--panel); border-color: var(--line); }
.tab:hover { color: var(--text); border-color: var(--accent); }
.stepper { background: var(--panel); border-color: var(--line); }
.stepper button { color: var(--accent); }
.genres span { color: var(--accent); background: var(--palette-soft); border-color: var(--line); }
.artwork {
  border-color: var(--line);
  color: var(--muted);
  background: radial-gradient(ellipse at top right, var(--artwork-glow), var(--artwork-shadow) 64%);
}
.card-state, .source-link, .form-content a, .detail-type { color: var(--accent); }
.description, .stat-filters label > span, .detail-controls label > span, .view-counter > span { color: var(--muted); }
.stat-panel li > div:first-child { color: var(--text); }
.bar { background: var(--raised); }
dialog { background: var(--panel); border-color: var(--line); }
.close-dialog { color: var(--text); background: var(--raised); border-color: var(--line); }
.episode-row:hover { background: var(--raised); }
.button-secondary:hover, .icon-button:hover { background: var(--raised); border-color: var(--accent); }
.card-title:hover, .text-button:hover, .stat-panel h2 svg, .toast svg { color: var(--accent); }
.toast { color: var(--text); background: var(--panel); border-color: var(--line); }
