:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6760;
  --border: #e3e0da;
  --accent: #d9480f;
  --accent-text: #ffffff;
  --star: #f59f00;
  --star-off: #d4d0c8;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --surface: #1d1d1c;
    --text: #eceae6;
    --muted: #9c978f;
    --border: #2e2d2b;
    --accent: #ff6b2c;
    --accent-text: #121212;
    --shadow: none;
    --star-off: #4a4844;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
h1 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
nav { display: flex; gap: 4px; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.tab.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-text); font-size: 12px; text-align: center; }

.lede { color: var(--muted); max-width: 640px; margin: 20px 0 12px; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0 16px; }
input[type="search"], select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
}
input[type="search"] { flex: 1 1 260px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.card { background: var(--surface); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; flex-direction: column; }
.poster { aspect-ratio: 2 / 3; width: 100%; object-fit: cover; display: block; background: var(--border); }
.meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.sub { color: var(--muted); font-size: 12px; }
.stars { display: flex; gap: 1px; margin-top: auto; }
.stars button { background: none; border: 0; padding: 2px; font-size: 20px; line-height: 1; color: var(--star-off); }
.stars button.on { color: var(--star); }
.card.rated { outline: 2px solid var(--star); outline-offset: -2px; }
.predicted { font-weight: 600; color: var(--star); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; text-align: left; margin-top: auto; }

.ghost { background: none; border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 8px; }
#more { display: block; margin: 20px auto 40px; }
.primary { background: var(--accent); color: var(--accent-text); border: 0; padding: 10px 18px; border-radius: 8px; font-weight: 600; }
.primary:disabled { opacity: 0.45; cursor: default; }

.bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--border);
}

dialog { border: 0; border-radius: 12px; padding: 20px; width: min(900px, calc(100vw - 32px)); max-height: 85vh; background: var(--bg); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 0.5); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.dialog-head h2 { font-size: 17px; margin: 0; }

.ranked { list-style: none; padding: 0; margin: 0 0 40px; }
.ranked .card { position: relative; }
.rank {
  position: absolute; top: 8px; left: 8px; min-width: 28px; height: 28px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: rgb(0 0 0 / 0.72); color: #fff; font-weight: 700; font-size: 13px;
}

.bar.off { display: none; }
.prose { max-width: 720px; padding-bottom: 24px; }
.prose h2 { font-size: 24px; margin: 24px 0 8px; letter-spacing: -0.01em; }
.prose h3 { font-size: 16px; margin: 28px 0 6px; }
.prose p, .prose li { color: var(--text); }
.prose li { margin-bottom: 6px; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 600; color: var(--muted); font-size: 12px; }
.win-rmse td:nth-child(2), .win-rank td:nth-child(n+3) { color: var(--accent); }

.foot { color: var(--muted); font-size: 12px; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--border); margin-top: 24px; }
.foot p { margin: 0 0 8px; max-width: 760px; }
.credit { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.credit p { margin: 0; }
.tmdb-logo { height: 14px; width: auto; display: block; }
.cite { font-size: 11px; }

.import { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.import summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.import p { margin: 8px 0; max-width: 640px; }
.filters input[type="number"] { width: 118px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.because em { font-style: normal; color: var(--text); }

.title a { color: inherit; text-decoration: none; }
.title a:hover { color: var(--accent); text-decoration: underline; }

/* Field Documents theme: repertory theater program. Oxblood house, brass ink, ticket-stub cards. One look in both OS themes. */
:root, :root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #1a0f0d; --surface: #241512; --text: #f1e4c8; --muted: #b39b7c; --border: #4a2e24;
  --accent: #d39a4a; --accent-text: #1a0f0d; --star: #e6b35a; --star-off: #5a3c30; --shadow: none;
  --display: "Bodoni Moda", Didot, Georgia, serif; --stub: "Chivo Mono", ui-monospace, monospace;
}
body { font-family: "IBM Plex Sans", system-ui, sans-serif; }
.top { background: var(--bg); border-bottom: 3px double var(--accent); }
h1 { font-family: var(--display); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.tab { font-family: var(--stub); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; border-radius: 0; }
.tab.active { background: none; color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.pill { border-radius: 0; font-family: var(--stub); }
.lede { color: var(--muted); font-style: italic; }
.prose h2, .prose h3, .dialog-head h2 { font-family: var(--display); }
input[type="search"], select, .filters input[type="number"], .ghost, .primary { border-radius: 0; }
.ghost, .primary { font-family: var(--stub); text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
/* Ticket stub: dashed perforation between poster and details, notched corners. */
.card { border-radius: 0; border: 1px solid var(--border); }
.meta { border-top: 1px dashed var(--accent); }
.title { font-family: var(--display); font-weight: 700; font-size: 15px; }
.sub { font-family: var(--stub); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.card.rated { outline-color: var(--accent); }
.rank { border-radius: 0; background: var(--accent); color: var(--accent-text); font-family: var(--stub); }
.bar { background: var(--surface); border-top: 1px dashed var(--accent); }
.table-wrap { border-radius: 0; }
th { font-family: var(--stub); text-transform: uppercase; }
dialog { border-radius: 0; border: 1px solid var(--accent); }
.byline { font-family: var(--display); font-style: italic; font-size: 14px; color: var(--accent); }
@media (max-width: 480px) {
  h1 { font-size: 16px; letter-spacing: .04em; }
  .tab { padding: 8px 6px; font-size: 11px; letter-spacing: .02em; }
}
