/* Layout: a top marquee bar + one centred reading column (max 1180px); pages are stacked bands of cards.
   Look: cinema-lobby — cool slate paper, marquee amber accent, ticket-stub poster tiles. */
:root {
  --bg: #f2f3f6;
  --panel: #ffffff;
  --panel-2: #e8eaf0;
  --ink: #171a22;
  --ink-2: #4a5062;
  --muted: #7a8193;
  --line: #d9dce5;
  --accent: #c98a00;
  --accent-ink: #1b1300;
  --accent-soft: #fbefd0;
  --teal: #0f7b72;
  --danger: #c0392b;
  --seq-lo: #eef1f7;
  --seq-hi: #7a4b00;
  --seq-ink: #ffffff;
  --chart-line: #2f5fb3;
  --chart-bar: #8aa3cf;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --panel: #181b24; --panel-2: #222633; --ink: #eef0f6; --ink-2: #b9bfcf; --muted: #8a91a5;
    --line: #2c3142; --accent: #f2b733; --accent-ink: #1b1300; --accent-soft: #3a2e10; --teal: #3cc2b4; --danger: #ff6b5b;
    --seq-lo: #1f2330; --seq-hi: #f2b733; --seq-ink: #1b1300; --chart-line: #7fa8ff; --chart-bar: #3d5585; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --panel: #181b24; --panel-2: #222633; --ink: #eef0f6; --ink-2: #b9bfcf; --muted: #8a91a5;
  --line: #2c3142; --accent: #f2b733; --accent-ink: #1b1300; --accent-soft: #3a2e10; --teal: #3cc2b4; --danger: #ff6b5b;
  --seq-lo: #1f2330; --seq-hi: #f2b733; --seq-ink: #1b1300; --chart-line: #7fa8ff; --chart-bar: #3d5585; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.5 var(--body); }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.9rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* top bar */
/* the top bar is deliberately dark in both themes (marquee) */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: #11131a; color: #eef0f6; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: #11131a; }
.topbar .nav a.on { color: #f2b733; }
.topbar-in {
  max-width: 1180px; margin: 0 auto; display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.3rem; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(242,183,51,.25); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; font-weight: 600; font-size: .95rem; opacity: .82; }
.nav a:hover, .nav a.on { opacity: 1; background: rgba(255,255,255,.1); }
.who { display: flex; gap: 8px; align-items: center; font-size: .95rem; }
.who button, .who a { color: inherit; }

main { max-width: 1180px; margin: 0 auto; padding-block: 28px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 32px; }
main > * { min-width: 0; }

/* controls */
button, .btn {
  font: 600 .95rem var(--body); border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center;
}
button:hover, .btn:hover { border-color: var(--ink-2); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: transparent; border-color: transparent; }
button.link { background: none; border: none; padding: 0; color: var(--muted); text-decoration: underline; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--chart-line); outline-offset: 2px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 70px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.err { color: var(--danger); font-weight: 600; font-size: .92rem; }
.ok { color: var(--teal); font-weight: 600; font-size: .92rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--panel-2); color: var(--ink-2); text-decoration: none; }
a.chip:hover { background: var(--accent-soft); }
.pill { font: 700 .72rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* hero */
.hero { display: grid; gap: 14px; padding-block: 18px 6px; }
.hero h1 span { color: var(--accent); }
.searchbox { position: relative; max-width: 640px; }
.searchbox input { font-size: 1.1rem; padding: 14px 18px; border-radius: 14px; border-width: 2px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 16px 40px -18px rgba(0,0,0,.45); z-index: 10; overflow: hidden; }
.suggest a { display: flex; gap: 10px; align-items: center; padding: 9px 14px; text-decoration: none; }
.suggest a:hover, .suggest a.sel { background: var(--panel-2); }
.suggest .grp { padding: 6px 14px 2px; }
.stats-line { display: flex; gap: 22px; flex-wrap: wrap; color: var(--ink-2); font-size: .95rem; }
.stats-line b { font-family: var(--display); font-size: 1.25rem; color: var(--ink); font-variant-numeric: tabular-nums; }

/* poster tiles: ticket stubs (no images in the free data) */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.tile { text-decoration: none; display: grid; gap: 8px; align-content: start; }
.stub { aspect-ratio: 2 / 3; border-radius: 10px; position: relative; overflow: hidden; padding: 12px; display: flex; flex-direction: column;
  justify-content: space-between; color: #fff; max-width: 100%; }
.stub > span { position: relative; z-index: 1; }
.stub img.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.stub.has-img .st-title, .stub.has-img .st-type { visibility: hidden; }
.stub.has-img::before { content: ""; position: absolute; inset: auto 0 0 0; height: 30%; z-index: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent); }
.stub::after { content: ""; position: absolute; left: -9px; right: -9px; top: 62%; height: 18px;
  background: radial-gradient(circle at 9px 9px, var(--bg) 8px, transparent 8.5px) left / 100% 18px no-repeat,
              radial-gradient(circle at calc(100% - 9px) 9px, var(--bg) 8px, transparent 8.5px) right / 100% 18px no-repeat; z-index: 2; }
.stub .st-title { font-family: var(--display); font-weight: 800; font-size: 1.05rem; line-height: 1.15; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.stub .st-type { font: 700 .66rem var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .85; }
.stub .st-bottom { display: flex; justify-content: space-between; align-items: end; font-family: var(--mono); font-size: .78rem; }
.tile:hover .stub { transform: translateY(-2px); transition: transform .15s; }
.tile .t-name { font-weight: 700; line-height: 1.25; }
.tile .t-meta { font-size: .85rem; color: var(--muted); }
.star { color: var(--accent); }

/* title page */
.title-head { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.title-head > * { min-width: 0; }
@media (max-width: 680px) { .title-head { grid-template-columns: 1fr; } .title-head .stub { max-width: 200px; } }
.facts { display: flex; gap: 10px 18px; flex-wrap: wrap; color: var(--ink-2); margin: 10px 0 14px; }
.rating-big { display: flex; align-items: baseline; gap: 10px; }
.rating-big b { font-family: var(--display); font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; max-width: 320px; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: none; border-radius: 8px 8px 0 0; background: none; padding: 10px 14px; color: var(--muted); }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--accent); }
.credits { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.credit { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 8px; border-radius: 10px; }
.credit:hover { background: var(--panel-2); }
.avatar { position: relative; overflow: hidden; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: .9rem; }
.credit .c-role { font-size: .85rem; color: var(--muted); }

/* looks */
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.look { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; }
.look img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--panel-2); cursor: zoom-in; }
.look .l-body { padding: 12px; display: grid; gap: 6px; }
.look .l-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ts { font-family: var(--mono); font-size: .8rem; background: var(--ink); color: var(--bg); padding: 1px 7px; border-radius: 6px; }
.l-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.l-actions button { padding: 4px 10px; font-size: .85rem; }
.liked { background: var(--accent-soft); border-color: var(--accent); }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(5,6,10,.88); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 8px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; place-items: center; text-align: center; color: var(--muted); }
.drop img { max-height: 220px; border-radius: 8px; }

/* relations */
.rel { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rel:last-child { border-bottom: none; }
.rel > * { min-width: 0; }
.votes { display: grid; justify-items: center; gap: 2px; }
.votes button { padding: 2px 10px; font-size: .9rem; }
.votes b { font-family: var(--display); font-variant-numeric: tabular-nums; }
.votes button.on-up { background: var(--teal); border-color: var(--teal); color: #fff; }
.votes button.on-down { background: var(--danger); border-color: var(--danger); color: #fff; }
.kind { font: 700 .72rem var(--body); letter-spacing: .05em; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.agree { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; width: 90px; }
.agree i { display: block; height: 100%; background: var(--teal); }
.picker { position: relative; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--panel-2); }

/* charts */
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; }
.chart-wrap text { fill: var(--muted); font: 12px var(--body); }
.chart-wrap .axis { stroke: var(--line); }
.chart-wrap .grid-l { stroke: var(--line); stroke-dasharray: 2 4; }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px;
  font-size: .85rem; line-height: 1.35; max-width: 260px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
.legend-ramp { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend-ramp i { width: 160px; height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--seq-lo), var(--seq-hi)); border: 1px solid var(--line); }
.heat td { padding: 0; border: 2px solid var(--panel); text-align: center; font: 600 .78rem var(--mono); min-width: 40px; height: 32px; cursor: default; }
.heat th { padding: 4px 6px; font: 600 .75rem var(--mono); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.heat td.empty { background: transparent; }

/* pick & quiz */
.slot { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.slot .tile:first-child .stub { outline: 4px solid var(--accent); outline-offset: 3px; }
.quiz-card { display: grid; grid-template-columns: 180px 1fr; gap: 26px; align-items: start; }
.quiz-card > * { min-width: 0; }
@media (max-width: 600px) { .quiz-card { grid-template-columns: 1fr; } .quiz-card .stub { max-width: 160px; } }
input[type=range] { padding: 0; accent-color: var(--accent); }
.guess-val { font-family: var(--display); font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-dots { display: flex; gap: 6px; }
.score-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); }
.score-dots i.done { background: var(--accent); border-color: var(--accent); }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; }
.empty-state { text-align: center; padding: 30px; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.two-col > * { min-width: 0; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.auth-box { max-width: 420px; margin: 0 auto; width: 100%; display: grid; gap: 14px; }
footer.site { max-width: 1180px; margin: 0 auto; padding-block: 0 40px; color: var(--muted); font-size: .85rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skeleton { color: var(--muted); padding: 30px 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
