:root {
  color-scheme: dark;
  --text: #f1efe9;
  --secondary: #b8b5ad;
  --line: #363631;
  --background: #11110f;
  --surface: #191917;
  --surface-hover: #20201d;
  --input-line: #686861;
  --muted: #96938c;
  --body-text: #d3d0c8;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.site-header {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.header-inner {
  width: min(1120px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -0.015em;
  text-decoration: none;
}
.sign-out {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--secondary);
  font-size: 13px;
  cursor: pointer;
}
.sign-out:hover { color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 20px; }
.credits-link { color: var(--secondary); font-size: 13px; text-decoration: none; }
.credits-link:hover { color: var(--text); }

.page {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 56px 0 80px;
}
.tabs {
  display: flex;
  gap: 30px;
  margin-bottom: 24px;
}
.tabs a {
  position: relative;
  padding: 7px 0 10px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 520;
  text-decoration: none;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); font-weight: 650; }
.tabs a.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  content: "";
}

.catalog-panel,
.detail-panel,
.login-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
}
.page-heading {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.page-heading h1 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0;
  font-size: 22px;
  font-weight: 680;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.page-heading h1 span {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 450;
  letter-spacing: 0;
}
.heading-title { display: flex; align-items: baseline; gap: 18px; }
.compare-link,
.comparison-toolbar a { color: var(--secondary); font-size: 12.5px; text-decoration: none; }
.compare-link:hover,
.comparison-toolbar a:hover { color: var(--text); }
.search input {
  width: 230px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--input-line);
  border-radius: 7px;
  outline: none;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: #77776e; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }

.media-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 16px;
  gap: 18px;
  align-items: center;
  min-height: 88px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background .12s ease;
}
.media-item:last-child { border-bottom: 0; border-radius: 0 0 11px 11px; }
.media-item:hover { background: var(--surface-hover); }
.item-artwork-slot {
  width: 48px;
  height: 64px;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-hover);
}
.item-artwork {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: var(--surface-hover);
  object-fit: cover;
}
.missing-artwork-label {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 4px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
}
.item-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.item-title strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-title small {
  color: var(--secondary);
  font-size: 12.5px;
  font-style: normal;
}
.item-title .item-meta {
  margin-top: 2px;
  overflow: hidden;
  color: var(--secondary);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chevron {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  text-align: right;
}
.empty { margin: 0; padding: 26px 24px; color: var(--secondary); font-size: 13px; }

.comparison-page { max-width: 860px; }
.comparison-toolbar { display: flex; align-items: flex-start; flex-direction: column; gap: 7px; margin: 0 2px 20px; }
.comparison-toolbar h1 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.comparison-toolbar p { margin: 7px 0 0; color: var(--secondary); font-size: 13px; }
.comparison-toolbar a { order: -1; padding-top: 0; }
.comparison-form { text-align: center; }
.comparison-pair { display: grid; grid-template-columns: 1fr 40px 1fr; align-items: stretch; }
.comparison-option { min-height: 220px; display: grid; grid-template-rows: 58px 1fr auto; padding: 22px; border: 1px solid #686861; border-radius: 12px; background: #1d1d1a; cursor: pointer; transition: border-color .12s ease, background .12s ease, transform .12s ease; }
.comparison-option:hover { border-color: #77776d; background: #23231f; transform: translateY(-1px); }
.comparison-option:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.comparison-heading { display: grid; align-content: center; }
.comparison-option .comparison-title { display: block; font-size: 19px; font-weight: 680; letter-spacing: -.025em; line-height: 1.2; }
.comparison-option small { display: block; margin-top: 8px; color: var(--secondary); font-size: 12.5px; }
.comparison-provenance { display: block; padding-top: 15px; border-top: 1px solid #41413b; text-align: left; }
.comparison-provenance .provenance-label { display: block; margin-bottom: 10px; color: var(--secondary); font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1; text-transform: uppercase; }
.provenance-row { display: block; }
.provenance-row + .provenance-row { margin-top: 10px; }
.comparison-provenance strong { display: block; color: var(--text); font-size: 12.5px; font-weight: 650; }
.comparison-provenance .provenance-row small { margin-top: 4px; color: #cbc8c0; font-size: 12.5px; line-height: 1.45; text-wrap: pretty; word-break: keep-all; }
.comparison-action { align-self: end; width: 100%; margin-top: 18px; padding: 9px 12px; border-radius: 7px; background: var(--text); color: #171715; font-size: 12px; font-weight: 720; letter-spacing: .01em; text-align: center; }
.versus { align-self: center; justify-self: center; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--background); color: var(--secondary); font-size: 10px; }
.tie-option { min-height: 38px; margin: 10px auto 0; padding: 0 15px; border: 1px solid var(--input-line); border-radius: 7px; background: var(--surface); color: var(--body-text); font-size: 12.5px; cursor: pointer; }
.tie-option:hover { color: var(--text); }
.ranking-panel { margin-top: 38px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ranking-panel-empty { display: grid; grid-template-columns: auto 1fr; align-items: center; margin-top: 32px; padding: 18px 22px; }
.ranking-panel.ranking-panel-empty > header { display: block; padding: 0; border: 0; }
.ranking-panel.ranking-panel-empty > header > span { display: none; }
.ranking-panel-empty .ranking-list .empty { padding: 0 0 0 18px; }
.ranking-panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; padding: 19px 22px; border-bottom: 1px solid var(--line); }
.ranking-panel h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.ranking-panel header span { color: var(--secondary); font-size: 12px; }
.ranking-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 60px 116px; align-items: center; gap: 12px; min-height: 62px; padding: 9px 22px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.ranking-row:last-child { border-bottom: 0; }
.ranking-row:hover { background: var(--surface-hover); }
.rank { color: var(--secondary); font-size: 12px; font-weight: 550; }
.rank-title { min-width: 0; overflow: hidden; font-size: 13.5px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.rank-title small { display: block; margin-top: 2px; overflow: hidden; color: var(--secondary); font-size: 11.5px; font-weight: 400; text-overflow: ellipsis; }
.rank-score { color: var(--secondary); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.certainty { text-align: right; }
.certainty strong { display: block; font-size: 11.5px; font-weight: 620; }
.certainty small { display: block; margin-top: 2px; color: var(--secondary); font-size: 11px; }
.mobile-score, .mobile-spacer { display: none; }
.empty-state { padding: 55px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--secondary); font-size: 13px; text-align: center; }

.detail-page { max-width: 760px; }
.back {
  display: inline-block;
  margin: 0 0 18px 2px;
  color: var(--secondary);
  font-size: 13px;
  text-decoration: none;
}
.back:hover { color: var(--text); }
.detail-panel { padding: 32px 40px 34px; }
.enriched-detail {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.detail-artwork { margin: 0; }
.detail-artwork img {
  display: block;
  width: 180px;
  max-height: 270px;
  border-radius: 8px;
  background: var(--surface-hover);
  object-fit: cover;
}
.detail-artwork figcaption { margin-top: 9px; color: var(--secondary); font-size: 11px; line-height: 1.4; }
.detail-artwork a { color: inherit; }
.detail-content { min-width: 0; }
.credits-page { max-width: 660px; }
.credits-panel h1 { margin: 0 0 28px; font-size: 26px; letter-spacing: -.04em; }
.credits-panel section + section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.credits-panel h2 { margin: 0 0 7px; font-size: 17px; }
.credits-panel p { margin: 7px 0; color: var(--body-text); font-size: 13px; line-height: 1.55; }
.credits-panel a { color: var(--secondary); font-size: 12.5px; }
.tmdb-logo { display: block; width: 74px; height: auto; margin-bottom: 14px; }
.detail-header { padding-bottom: 14px; }
.detail-header h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 28px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.08;
}
.detail-header h2 { margin: 10px 0 0; color: var(--secondary); font-size: 16px; font-weight: 420; }
.summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 4px 0;
}
.summary > div { display: block; padding: 0; border: 0; }
.summary dt,
.summary dd { margin: 0; font-size: 13px; line-height: 1.5; }
.summary dt { margin-bottom: 3px; color: var(--secondary); }
.summary-about dd { max-width: 66ch; line-height: 1.65; }
.evidence-section { margin-top: 24px; }
.evidence-section > h2 { margin: 0 0 14px; font-size: 16px; font-weight: 680; letter-spacing: -0.015em; }
.evidence-item { padding: 0; }
.evidence-title { display: block; }
.evidence-title strong { font-size: 13px; font-weight: 650; }
.evidence-title .evidence-confidence { color: var(--secondary); font-size: 11.5px; font-weight: 450; text-transform: lowercase; white-space: nowrap; }
.evidence-item p { margin: 8px 0; color: var(--body-text); font-size: 13px; line-height: 1.55; }
.source-ref {
  display: block;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.5;
}

.login-page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 48px 24px;
}
.login-panel { width: min(400px, 100%); padding: 38px; }
.login-panel h1 { margin: 0 0 26px; font-size: 25px; font-weight: 680; letter-spacing: -0.035em; }
.login-form { display: grid; gap: 17px; }
.login-form label { display: grid; gap: 7px; color: var(--body-text); font-size: 12.5px; font-weight: 550; }
.login-form input {
  width: 100%;
  height: 41px;
  padding: 0 11px;
  border: 1px solid var(--input-line);
  border-radius: 7px;
  outline: none;
  background: var(--surface);
}
.login-form input:focus { border-color: var(--text); box-shadow: none; }
.login-form button {
  height: 41px;
  margin-top: 2px;
  border: 0;
  border-radius: 7px;
  background: var(--text);
  color: #171715;
  font-weight: 620;
  cursor: pointer;
}
.login-form button:hover { background: #d9d6ce; }
.errorlist { margin: 0; padding: 10px 11px; border-radius: 7px; background: #3b1d21; color: #ffaaa9; font-size: 12px; list-style: none; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 701px) {
  .comparison-page { min-height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: center; }
}

@media (max-width: 700px) {
  .header-inner,
  .page { width: min(100% - 28px, 1120px); }
  .page { padding-top: 25px; }
  .tabs { gap: 24px; margin-bottom: 18px; overflow-x: auto; }
  .tabs a { flex: 0 0 auto; }
  .page-heading { min-height: 0; align-items: stretch; flex-direction: column; gap: 16px; padding: 20px; }
  .heading-title { justify-content: space-between; }
  .search input { width: 100%; }
  .media-item { grid-template-columns: 42px minmax(0, 1fr) 16px; gap: 14px; min-height: 92px; padding: 16px 18px; }
  .item-artwork-slot { width: 42px; height: 56px; }
  .item-title strong {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.25;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .item-meta { white-space: nowrap; }
  .media-item time,
  .source-count { display: none; }
  .detail-page { padding-top: 25px; }
  .detail-panel { padding: 30px 24px 34px; }
  .enriched-detail { display: block; }
  .detail-artwork { margin-bottom: 24px; }
  .detail-artwork img { width: 110px; max-height: 165px; }
  .summary > div { grid-template-columns: 100px 1fr; gap: 16px; }
  .login-panel { padding: 30px 26px; }
  .comparison-toolbar h1 { font-size: 21px; }
  .comparison-toolbar p { display: block; }
  .comparison-pair { grid-template-columns: 1fr; gap: 8px; }
  .comparison-option { min-height: 220px; padding: 18px; }
  .versus { height: 28px; }
  .ranking-panel { margin-top: 28px; }
  .ranking-panel-empty { display: block; padding: 18px 20px; }
  .ranking-panel-empty .ranking-list .empty { padding: 8px 0 0; }
  .ranking-panel > header { display: block; }
  .ranking-panel header span { display: block; margin-top: 5px; }
  .ranking-row { grid-template-columns: 24px minmax(0, 1fr); gap: 3px 12px; padding: 11px 16px; }
  .rank-score { display: none; }
  .certainty { grid-column: 2; text-align: left; }
  .certainty strong { display: inline; }
  .certainty small { display: inline; font-size: 11.5px; line-height: 1.4; }
  .mobile-score, .mobile-spacer { display: inline; }
}
