/* Layout: a single column of sections, each a heading and a grid of chart cards, under a header bar with the upload button. */
:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #15171c;
  --ink-2: #4a4f59;
  --muted: #747a84;
  --line: #e1e3e8;
  --grid: #eceef1;
  --axis: #c4c8cf;
  --wash: rgba(21, 23, 28, 0.05);
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-soft: #e3edfa;
  --you: #2a78d6;
  --crowd: #a3a8b1;
  --hi: #2a78d6;
  --lo: #eb6834;
  --even: #c7cbd2;
  --bad: #c43c3c;
  --h0: #e6e8ec; --h1: #9ec5f4; --h2: #5598e7; --h3: #256abf; --h4: #104281;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
/* Dark: when the system prefers it and the visitor hasn't chosen Light, or when they've chosen Dark (see #theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1013;
    --panel: #17191c;
    --ink: #eef0f3;
    --ink-2: #c0c4cb;
    --muted: #8b9099;
    --line: #2a2c31;
    --grid: #222428;
    --axis: #3b3e44;
    --wash: rgba(255, 255, 255, 0.06);
    --accent: #6da7ec;
    --accent-ink: #0f1013;
    --accent-soft: #16263b;
    --you: #3987e5;
    --crowd: #6b7079;
    --hi: #3987e5;
    --lo: #d95926;
    --even: #464a51;
    --bad: #e66767;
    --h0: #232529; --h1: #184f95; --h2: #2a78d6; --h3: #6da7ec; --h4: #b7d3f6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1013;
  --panel: #17191c;
  --ink: #eef0f3;
  --ink-2: #c0c4cb;
  --muted: #8b9099;
  --line: #2a2c31;
  --grid: #222428;
  --axis: #3b3e44;
  --wash: rgba(255, 255, 255, 0.06);
  --accent: #6da7ec;
  --accent-ink: #0f1013;
  --accent-soft: #16263b;
  --you: #3987e5;
  --crowd: #6b7079;
  --hi: #3987e5;
  --lo: #d95926;
  --even: #464a51;
  --bad: #e66767;
  --h0: #232529; --h1: #184f95; --h2: #2a78d6; --h3: #6da7ec; --h4: #b7d3f6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); }
a { color: var(--accent); }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* ---------- header ---------- */
.top { background: var(--panel); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.top-in { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding-block: 18px; }
.brand h1 { margin: 0; font-weight: 800; font-stretch: 75%; font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1; letter-spacing: -0.01em; text-transform: uppercase; }
.source { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.status { margin-top: 2px; color: var(--ink-2); max-width: 40rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.theme button { display: inline-flex; align-items: center; padding: 7px 9px; color: var(--ink-2); }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 0.9rem; font-weight: 500; }
.btn:hover { background: var(--wash); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
/* Each site's upload button in a colour people already link with it: IMDb's gold, Letterboxd's green. Both carry
   dark text, which reads well on either colour and in both themes. */
.btn.btn-imdb { background: #f5c518; border-color: #e2b616; color: #121212; font-weight: 600; }
.btn.btn-lbx { background: #00e054; border-color: #00c94b; color: #0a2414; font-weight: 600; }
.btn.btn-imdb:hover, .btn.btn-lbx:hover { filter: brightness(0.95); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); padding: 6px; display: grid; }
.menu-k { margin: 4px 8px 6px; font-size: 0.78rem; color: var(--muted); }
.menu button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 0.88rem; }
.menu button:hover, .menu button:focus-visible { background: var(--wash); outline: none; }
.menu button:last-child { color: var(--bad); }
.data-card { border-top: 4px solid var(--line); }
.data-card.imdb { border-top-color: #f5c518; }
.data-card.letterboxd { border-top-color: #00e054; }
.data-facts { margin: 0; font-size: 0.9rem; color: var(--ink); overflow-wrap: anywhere; }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; }
input[type="file"]:focus-visible + .btn, .btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

#notice:not(:empty) { margin-top: 16px; }
.notice { padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 0.9rem; }
.notice.err { background: color-mix(in srgb, var(--bad) 15%, transparent); }

/* ---------- landing ---------- */
.landing { padding-block: clamp(32px, 7vw, 72px) 24px; display: grid; gap: clamp(28px, 5vw, 48px); }
.hero { display: grid; gap: 18px; max-width: 46rem; }
.hero h2 { margin: 0; font-weight: 800; font-stretch: 75%; font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1; text-transform: uppercase; letter-spacing: -0.01em; text-wrap: balance; }
.hero .lede { font-size: clamp(1rem, 2.2vw, 1.15rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.big { padding: 12px 20px; font-size: 1rem; }
.private { margin: 0; font-size: 0.88rem; color: var(--ink-2); padding-left: 12px; border-left: 3px solid var(--you); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; }

/* ---------- filters for the titles table ---------- */
.tf { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.tf > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 0.9rem; }
.tf > summary span { color: var(--accent); }
.tf-presets { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px; }
.preset { border: 1px dashed var(--axis); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: 0.82rem; cursor: pointer; color: var(--ink-2); }
.preset:hover { border-style: solid; border-color: var(--accent); color: var(--ink); }
.tf-grid { display: grid; gap: 10px; padding-bottom: 14px; }
.tf-row { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 12px; align-items: center; min-height: 32px; }
.tf-k { font-size: 0.84rem; color: var(--ink-2); }
.tf-v { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; min-width: 0; }
.tf-chips { display: contents; }
/* Pills: a short set of choices, all in view. Separate pills wrap cleanly on a narrow screen. */
.seg.pills { display: flex; flex-wrap: wrap; gap: 6px; border: 0; border-radius: 0; overflow: visible; background: none; }
.seg.pills button, .seg.pills button + button { border: 1px solid var(--line); border-radius: 99px; background: var(--panel); padding: 4px 12px; font-size: 0.82rem; white-space: nowrap; }
.seg.pills button:hover { border-color: var(--axis); }
.seg.pills button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 0.84rem; color: var(--ink-2); }

/* Picker: a button that opens a searchable, multi-select list. */
.picker { position: relative; }
.pick-btn { border: 1px dashed var(--axis); background: transparent; border-radius: 99px; padding: 4px 12px; font-size: 0.82rem; cursor: pointer; color: var(--ink-2); }
.pick-btn:hover, .pick-btn[aria-expanded="true"] { border-style: solid; border-color: var(--accent); color: var(--ink); }
.pick-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; width: 280px; max-width: calc(100vw - 48px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); padding: 8px; display: grid; gap: 6px; }
.pick-q { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 7px 10px; font-size: 0.86rem; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; }
.pick-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 0.86rem; cursor: pointer; }
.pick-list li.active { background: var(--wash); }
.pick-list li[aria-selected="true"] .tick::before { content: "✓"; color: var(--accent); font-weight: 700; }
.pick-list .pn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list .pc { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.pick-list .pick-none { display: block; color: var(--muted); cursor: default; }
.pick-more { margin: 0; padding: 0 8px 2px; font-size: 0.78rem; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 2px; border-radius: 99px; padding: 2px 3px 2px 10px; background: var(--accent-soft); font-size: 0.82rem; line-height: 1.5; }
.chip button { border: 0; background: transparent; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; color: var(--ink-2); font-size: 0.95rem; line-height: 1; padding: 0; }
.chip button:hover { background: var(--wash); color: var(--ink); }
.range { flex-wrap: nowrap; gap: 12px; max-width: 480px; }
.range-ui { position: relative; flex: 1; height: 24px; min-width: 120px; }
.range-track { position: absolute; left: 8px; right: 8px; top: 50%; height: 4px; margin-top: -2px; background: var(--grid); border-radius: 2px; }
.range-track i { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 2px; }
.range-ui input { position: absolute; inset: 0; width: 100%; height: 24px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.range-ui input::-webkit-slider-runnable-track { background: none; }
.range-ui input::-moz-range-track { background: none; }
.range-ui input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); cursor: pointer; }
.range-ui input::-moz-range-thumb { pointer-events: auto; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); cursor: pointer; }
.range-ui input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 2px; }
.range output { flex: none; min-width: 5.5rem; font-size: 0.84rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tf-active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tf-active:empty { display: none; }
.tf-sum { margin: 0; font-size: 0.88rem; color: var(--ink-2); }
.tf-sum b { color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .tf-row { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* ---------- filters ---------- */
.filters { position: sticky; top: 0; z-index: 5; display: flex; flex-direction: column; gap: 10px; padding-block: 0 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; font-size: 0.88rem; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.sel { display: inline-flex; gap: 8px; align-items: center; font-size: 0.88rem; color: var(--ink-2); }
.sel select { -webkit-appearance: none; appearance: none; border: 1px solid var(--line); background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238b9099' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 11px center / 12px; border-radius: 99px; padding: 5px 32px 5px 13px; font-size: 0.86rem; color: var(--ink); cursor: pointer; }
.sel select:hover { border-color: var(--axis); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
/* With only one site's files there's nothing to switch between: no empty row, and the tabs' own line is enough. */
.controls:not(:has(> :not([hidden]))) { display: none; }
.filters:not(:has(.controls > :not([hidden]))) { padding-bottom: 0; border-bottom: 0; }
/* Your data shows both sites' files whichever is picked, and Compare uses whichever matches the friend's file, so
   the switch between them has nothing to do on either. */
#report:is([data-on="data"], [data-on="compare"]) .controls { display: none; }
#report:is([data-on="data"], [data-on="compare"]) .filters { padding-bottom: 0; border-bottom: 0; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 12px 12px 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 0.92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.off { display: none !important; }
@media (max-width: 720px) { .filters { position: static; } .tabs a { padding-inline: 10px; font-size: 0.88rem; } }

/* ---------- overview ---------- */
.overview { padding-block: 28px 8px; display: grid; gap: 18px; }
.take { margin: 0; font-size: clamp(1.1rem, 2.4vw, 1.4rem); line-height: 1.4; max-width: 52rem; text-wrap: pretty; }
.take b { font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.tile .k { font-size: 0.8rem; color: var(--muted); }
.tile .v { font-size: 2rem; font-weight: 600; font-stretch: 87.5%; line-height: 1.15; }
.tile .s { font-size: 0.8rem; color: var(--ink-2); }

/* ---------- sections and cards ---------- */
.sec { padding-block: 36px 8px; display: grid; gap: 16px; scroll-margin-top: 64px; }
.sec-head h2 { margin: 0 0 6px; font-weight: 800; font-stretch: 75%; font-size: 1.9rem; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.005em; }
.lede { margin: 0; color: var(--ink-2); max-width: 52rem; text-wrap: pretty; }
.lede b { color: var(--ink); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; display: grid; gap: 10px; align-content: start; }
.card h3 { margin: 0; font-size: 1.02rem; font-weight: 600; }
.hint { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 20px; border-left: 3px solid var(--accent); }
.hint-text { display: grid; gap: 6px; }
.hint-actions { display: flex; align-items: center; gap: 6px; }
.hint-close { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.hint-close:hover { background: var(--wash); color: var(--ink); }
@media (max-width: 560px) { .hint { grid-template-columns: minmax(0, 1fr); } }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.note { margin: 0; font-size: 0.84rem; color: var(--muted); text-wrap: pretty; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.82rem; color: var(--ink-2); }
.legend > span { display: inline-flex; gap: 6px; align-items: center; }
.sw { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.sw.you, .sw.hi { background: var(--you); }
.sw.crowd { background: var(--crowd); }
.sw.lo { background: var(--lo); }
.sw.even { background: var(--even); }
.viz { min-width: 0; }
.muted-empty { color: var(--muted); font-size: 0.88rem; margin: 0; }

/* ---------- charts ---------- */
svg.chart { display: block; overflow: visible; }
.chart text { font: 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.lab { font-size: 13px; fill: var(--ink); }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ref { stroke: var(--axis); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .hitbox { fill: transparent; }
.chart .hit { outline: none; }
.chart .hit:hover .hitbox, .chart .hit:focus-visible .hitbox { fill: var(--wash); }
.chart .stem { stroke: var(--axis); stroke-width: 2; stroke-linecap: round; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .dot.you { fill: var(--you); }
.chart .dot.crowd { fill: var(--crowd); }
.chart .line { fill: none; stroke: var(--you); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* Your ratings on the Overview: soft bars under a smooth curve. */
.chart .curve-bar { fill: var(--you); opacity: 0.22; }
.chart .curve-area { fill: var(--you); opacity: 0.12; }
.chart .curve-line { fill: none; stroke: var(--you); stroke-width: 2.5; stroke-linejoin: round; }
.chart .pt { stroke: var(--panel); stroke-width: 1; }
.chart .pt.hi { fill: var(--hi); }
.chart .pt.lo { fill: var(--lo); }
.chart .pt.even { fill: var(--even); }
.chart .ring { fill: none; stroke: var(--ink); stroke-width: 2; pointer-events: none; }
.chart .cut { stroke: var(--panel); stroke-width: 2.5; fill: none; }

.tip { position: fixed; z-index: 50; pointer-events: none; max-width: 300px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16); padding: 7px 10px; font-size: 0.8rem; line-height: 1.45; }
.tip .tip-h { color: var(--ink-2); font-weight: 600; }
.tip div { display: flex; gap: 6px; align-items: center; }

/* ---------- lists ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.tl li:last-child { border-bottom: 0; }
.tl .t { min-width: 0; overflow-wrap: anywhere; }
.tl .t a { color: inherit; text-decoration-color: var(--axis); text-underline-offset: 2px; }
.tl .yr { color: var(--muted); font-size: 0.82rem; }
.tl .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 0.86rem; }
.tl .r b { color: var(--ink); font-weight: 600; }
.tl .m { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; }
/* Every film in a list has its poster beside it, spanning the title and the line under it. */
.tl.thumbs li { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px; align-items: center; }
.tl.thumbs .thumb { grid-row: span 2; align-self: start; }
.tl.thumbs .m { grid-column: 2 / -1; align-self: start; }
.thumb.sm { width: 24px; height: 36px; border-radius: 3px; }
.thumb.sm .spinner { width: 10px; height: 10px; }
.pair-film { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
svg .thumb-bg { fill: var(--grid); }
.posters { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 12px; }
.posters a { display: grid; gap: 2px; color: var(--ink); text-decoration: none; }
.posters img, .no-poster { width: 100%; height: auto; aspect-ratio: 2 / 3; border-radius: 6px; background: var(--grid); box-shadow: 0 0 0 1px var(--line); object-fit: cover; }
.no-poster { display: grid; place-items: center; padding: 8px; text-align: center; font-size: 0.78rem; color: var(--ink-2); }
.posters a:hover img, .posters a:hover .no-poster { box-shadow: 0 0 0 2px var(--accent); }
/* Films for you: five across (fewer on a phone), each with why it's there and an × to turn it down. */
.posters.picks { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 18px 14px; }
.posters.picks.busy { opacity: 0.6; transition: opacity 0.2s; }
.pick { position: relative; display: grid; align-content: start; gap: 4px; }
.pick .why { margin: 0; font-size: 0.76rem; line-height: 1.35; color: var(--ink-2); }
.pick .why i { font-style: normal; font-weight: 600; color: var(--ink); }
.pick-x { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: color-mix(in srgb, #000 62%, transparent); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; opacity: 0.85; }
.pick-x:hover, .pick-x:focus-visible { opacity: 1; background: #000; }
.picks-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.picks-foot .note { margin: 0; }
.btn .spinner { display: inline-block; vertical-align: -2px; margin-right: 6px; }

/* A spinner sits behind each poster until it arrives (app.js marks it .loaded). */
.poster-img { position: relative; display: block; border-radius: 6px; background: var(--grid); }
.poster-img img { position: relative; display: block; background: transparent; }
.poster-img > .spinner { position: absolute; top: 50%; left: 50%; margin: -9px 0 0 -9px; width: 18px; height: 18px; }
.poster-img.loaded > .spinner { display: none; }
.posters a:hover .poster-img img { box-shadow: 0 0 0 2px var(--accent); }
.posters .pt { margin-top: 4px; font-size: 0.8rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.posters .py { font-size: 0.75rem; color: var(--muted); }
.posters .py b { color: var(--ink); font-weight: 600; }
/* One row, five posters in view (at least 80px wide), scrolled with the buttons, a swipe or the trackpad. */
.carousel { position: relative; }
.posters.row { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: max(80px, calc((100% - 4 * 12px) / 5)); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 2px; }
.posters.row::-webkit-scrollbar { display: none; }
.posters.row li { scroll-snap-align: start; }
.car-btn { position: absolute; top: 34%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }
.car-btn.prev { left: -12px; }
.car-btn.next { right: -12px; }
.car-btn:disabled { opacity: 0; pointer-events: none; }
.car-btn:hover { border-color: var(--accent); }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.pair:last-child { border-bottom: 0; }
.pair .who { color: var(--muted); font-size: 0.82rem; }

#crowds { display: grid; gap: 16px; }
.say-sm { margin: 0; max-width: 52rem; text-wrap: pretty; }
.say-sm b { font-weight: 600; }
.card h4 { margin: 0 0 6px; font-size: 0.92rem; font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.facts dt { font-size: 0.8rem; color: var(--muted); }
.facts dd { margin: 0; font-size: 1.5rem; font-weight: 600; }

/* ---------- tables ---------- */
.card > * { min-width: 0; }
.tw { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.dt { border-collapse: collapse; width: 100%; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.dt th, .dt td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.dt th { position: sticky; top: 0; z-index: 1; background: var(--panel); font-weight: 600; padding: 0; }
.dt th button { width: 100%; border: 0; background: transparent; padding: 8px 10px; text-align: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.dt th[aria-sort="ascending"] button::after { content: " ↑"; color: var(--muted); }
.dt th[aria-sort="descending"] button::after { content: " ↓"; color: var(--muted); }
.dt .num { text-align: right; }
.dt td.wrapcell { min-width: 12rem; }
.dt .nowrap { white-space: nowrap; }
.dt td a { color: inherit; text-decoration-color: var(--axis); text-underline-offset: 2px; }
.dt tr:hover td { background: var(--wash); }
.dt .sub { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 640px) { .dt .opt { display: none; } }
.gapcell { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.gapbar { position: relative; width: 70px; height: 10px; flex: none; }
.gapbar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--axis); }
.gapbar i { position: absolute; top: 0; bottom: 0; }
.gapbar i.hi { left: 50%; background: var(--hi); border-radius: 0 3px 3px 0; }
.gapbar i.lo { right: 50%; background: var(--lo); border-radius: 3px 0 0 3px; }
#search, .search { width: 100%; max-width: 420px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 12px; }
.card-head .search { flex: 1 1 220px; max-width: 320px; padding: 6px 10px; }
.count { font-size: 0.82rem; color: var(--muted); margin: 0; }

/* ---------- Letterboxd ---------- */
.lb-body { display: grid; gap: 16px; }
.sub-head { padding-top: 20px; }
.sub-head h2 { font-size: 1.4rem; }
.note code { font-family: var(--mono); font-size: 0.85em; }
.scroll { overflow-x: auto; }
.yearchips { display: flex; flex-wrap: wrap; gap: 6px; }
.yearchips button { border: 1px solid var(--line); background: transparent; border-radius: 99px; padding: 3px 12px; font: 500 0.82rem var(--mono); cursor: pointer; color: var(--ink-2); }
.yearchips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chart .cell.c0, .heat-legend .c0 { fill: var(--h0); background: var(--h0); }
.chart .cell.c1, .heat-legend .c1 { fill: var(--h1); background: var(--h1); }
.chart .cell.c2, .heat-legend .c2 { fill: var(--h2); background: var(--h2); }
.chart .cell.c3, .heat-legend .c3 { fill: var(--h3); background: var(--h3); }
.chart .cell.c4, .heat-legend .c4 { fill: var(--h4); background: var(--h4); }
.chart .cell.future { opacity: 0.4; }
/* Release years shaded by your average: blue above it, orange below, grey about level. */
.chart .cell.hi3, .heat-legend .hi3 { fill: var(--hi); background: var(--hi); }
.chart .cell.hi2, .heat-legend .hi2 { fill: color-mix(in srgb, var(--hi) 50%, var(--h0)); background: color-mix(in srgb, var(--hi) 50%, var(--h0)); }
.chart .cell.mid, .heat-legend .mid { fill: var(--even); background: var(--even); }
.chart .cell.lo2, .heat-legend .lo2 { fill: color-mix(in srgb, var(--lo) 50%, var(--h0)); background: color-mix(in srgb, var(--lo) 50%, var(--h0)); }
.chart .cell.lo3, .heat-legend .lo3 { fill: var(--lo); background: var(--lo); }
.chart .cell.pick { cursor: pointer; }
/* A ranked list with bars, for counts (the watch log's genres, directors, decades and franchises). */
.barlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.barlist > li { display: grid; grid-template-columns: minmax(5rem, 11rem) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 0.86rem; }
.bl-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-bar { height: 10px; background: var(--grid); border-radius: 5px; overflow: hidden; }
.bl-bar i { display: block; height: 100%; background: var(--you); border-radius: 5px; }
.bl-v { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 0.82rem; white-space: nowrap; }
.yr-wrap { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 16px 40px; align-items: start; }
.yr-wrap .heat-legend { margin-top: 8px; }
.yr-side { display: grid; gap: 18px; align-content: start; max-width: 22rem; }
.yr-side h4 { margin: 0 0 6px; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); }
.yr-side ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.yr-side li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.88rem; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.yr-side li span { color: var(--ink-2); }
@media (max-width: 760px) { .yr-wrap { grid-template-columns: minmax(0, 1fr); } .yr-side { max-width: none; } }
.chart .cell:hover { stroke: var(--ink); stroke-width: 1.5; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 0.78rem; color: var(--muted); }
.heat-legend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.heat-legend span { margin-left: 6px; }
.facts dd small { display: block; font-size: 0.78rem; font-weight: 400; color: var(--ink-2); }

/* ---------- director card ---------- */
.linkish { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 2px; }
.linkish:hover { text-decoration-color: var(--accent); }
.modal { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); }
.modal::backdrop { background: rgba(10, 12, 16, 0.55); backdrop-filter: blur(2px); }
.modal-in { padding: 24px 28px 28px; display: grid; gap: 22px; max-height: calc(100vh - 50px); overflow: auto; }
@media (max-width: 560px) { .modal-in { padding: 18px 16px 22px; } }
.dd-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.dd-head-text { flex: 1; min-width: 0; }

/* Directors' photos from TMDB, round. */
.dir-photo { flex: none; display: inline-block; border-radius: 50%; overflow: hidden; background: var(--grid); vertical-align: middle; }
.dir-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dir-photo.small { width: 26px; height: 26px; margin-right: 8px; }
.dir-photo.large { width: 76px; height: 76px; }
.barlist.comp .bl-k { display: flex; align-items: center; }
.barlist .bl-k .dir-cell, .barlist .bl-k .pair-film { min-width: 0; }
.dir-cell { display: inline-flex; align-items: center; }
/* All titles: a poster beside each title, and each director on their own line with their photo. */
.title-cell { display: flex; align-items: center; gap: 10px; }
.title-cell .dd-poster { flex: none; }
.dir-list { display: grid; gap: 4px; }
.dir-list .linkish { text-align: left; }
.dd-eyebrow { margin: 0 0 4px; font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.dd-head h2 { margin: 0; font-weight: 800; font-stretch: 75%; font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1; text-transform: uppercase; text-wrap: balance; }
.dd-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 0.9rem; }
.dd-close { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 1rem; }
.dd-close:hover { background: var(--wash); }
.dd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin: 0; padding: 14px 0; border-block: 1px solid var(--line); }
.dd-stats dt { font-size: 0.78rem; color: var(--muted); }
.dd-stats dd { margin: 0; font-size: 1.6rem; font-weight: 600; font-stretch: 87.5%; }
.dd-sec { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; } /* a long carousel scrolls, not the card */
.dd-sec h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 12px; }
.pager span { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.pager .btn:disabled { opacity: 0.45; cursor: default; }
.pager .btn:disabled:hover { background: var(--panel); }
.dd-sec-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.sw.hollow { background: transparent; border: 2px solid var(--crowd); width: 10px; height: 10px; }
.chart .dot.hollow { fill: var(--panel); stroke: var(--crowd); stroke-width: 2; }
.dd-list { list-style: none; margin: 0; padding: 0; }
.dd-list li { display: grid; grid-template-columns: 1.8rem 34px minmax(0, 1.4fr) minmax(80px, 1fr) 8.2rem; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dd-poster { display: grid; place-items: center; width: 34px; height: 51px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.dd-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.dd-sec .posters.row { grid-auto-columns: max(64px, calc((100% - 5 * 10px) / 6)); gap: 10px; }
.dd-sec .posters .pt { font-size: 0.74rem; }
.dd-list li:last-child { border-bottom: 0; }
.dd-rank { font: 500 0.85rem var(--mono); color: var(--muted); text-align: right; }
.dd-title { min-width: 0; display: grid; overflow-wrap: anywhere; }
.dd-title a { color: var(--ink); text-decoration-color: var(--axis); text-underline-offset: 2px; font-weight: 500; }
.dd-meta { color: var(--muted); font-size: 0.8rem; }
.dd-track { position: relative; height: 14px; }
.dd-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--grid); }
.dd-stem { position: absolute; top: calc(50% - 1px); height: 2px; background: var(--axis); }
.dd-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; transform: translate(-50%, -50%); }
.dd-dot.you { background: var(--you); box-shadow: 0 0 0 2px var(--panel); }
.dd-dot.crowd { background: var(--panel); border: 2px solid var(--crowd); }
.dd-scores { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 0.9rem; text-align: right; }
.dd-scores b { font-size: 1.05rem; }
.dd-scores span { color: var(--muted); }
.dd-gap { display: inline-block; min-width: 3.2em; }
.dd-gap.hi { color: var(--you); }
.dd-gap.lo { color: var(--lo); }
@media (max-width: 520px) {
  .dd-list li { grid-template-columns: 1.4rem 34px minmax(0, 1fr) auto; }
  .dd-track { grid-column: 3 / -1; grid-row: 2; }
}
.dd-facts { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px; padding-top: 14px; border-top: 1px solid var(--line); }
.dd-facts div { display: grid; gap: 2px; font-size: 0.9rem; }
.dd-facts .k { font-size: 0.78rem; color: var(--muted); }
.dd-facts a { color: var(--ink); font-weight: 500; }

.dropzone { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 22%, transparent); backdrop-filter: blur(2px); }
.dropzone span { background: var(--panel); border: 2px dashed var(--accent); border-radius: 12px; padding: 24px 32px; font-size: 1.1rem; font-weight: 600; }
.foot { padding-block: 40px; color: var(--muted); font-size: 0.82rem; }
.foot p { margin: 6px 0 0; max-width: 46rem; }
.foot-h { margin: 0 0 8px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
.credit img { display: block; margin-bottom: 6px; height: 16px; width: auto; }

/* Director completion: a bar per director, with what's left folded underneath. */
.barlist.comp { gap: 4px; }
.barlist.comp > li { grid-template-columns: minmax(5rem, 13rem) minmax(0, 1fr) auto; row-gap: 2px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.barlist.comp > li:last-child { border-bottom: 0; }
.barlist.comp details, .barlist.comp .comp-done { grid-column: 1 / -1; }
.barlist.comp .bl-v { min-width: 4.5rem; text-align: right; }
.barlist.comp summary { cursor: pointer; width: max-content; font-size: 0.8rem; color: var(--ink-2); }
.barlist.comp details .tl { margin: 2px 0 6px; padding-left: 14px; }
/* The films left to see: smaller posters than elsewhere, about eight in view. */
.barlist.comp .posters.row { grid-auto-columns: max(64px, calc((100% - 7 * 10px) / 8)); gap: 10px; }
.barlist.comp .posters .pt { font-size: 0.74rem; }
.barlist.comp .posters .py { font-size: 0.7rem; }
.comp-sort { margin: 4px 0 8px; }

/* A small spinner beside a "still looking things up" line. */
.loading-note { display: flex; align-items: center; gap: 8px; }
.spinner { flex: none; width: 14px; height: 14px; border: 2px solid var(--grid); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* While the page starts up (see index.html): a spinner in place of the page. The page keeps its layout underneath,
   only unseen, so charts drawn meanwhile measure their real width. */
.boot { display: none; }
.booting .boot { display: flex; position: fixed; left: 0; right: 0; top: 40vh; justify-content: center; align-items: center; gap: 10px; color: var(--muted); font-size: 0.95rem; }
.booting .boot .spinner { width: 22px; height: 22px; border-width: 3px; }
.booting #main, .booting .foot, .booting .top .actions, .booting .top .source { visibility: hidden; }
.comp-done { font-size: 0.78rem; }
.card-head .data-actions .btn { padding: 5px 11px; font-size: 0.82rem; }
.data-actions .btn[data-dl] { border-color: var(--axis); }

/* Getting your files: numbered steps, each with a small drawing of where to click (not a screenshot of either site). */
.guide { display: grid; gap: 16px; }
.guide-site { border-top: 4px solid var(--line); }
.guide-site.imdb { border-top-color: #f5c518; }
.guide-site.letterboxd { border-top-color: #00e054; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 210px); gap: 10px 16px; align-items: start; padding-left: 34px; position: relative; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 0.8rem/24px var(--mono); text-align: center; }
.steps > li:not(:has(.shot)) { grid-template-columns: minmax(0, 1fr); }
.step-text { display: grid; gap: 4px; justify-items: start; font-size: 0.9rem; }
.step-text > span { color: var(--ink-2); font-size: 0.84rem; }
.step-text .btn { margin-top: 4px; }
.shot { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 8px; display: grid; gap: 6px; font-size: 0.72rem; color: var(--ink-2); min-width: 0; }
.shot-url { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); background: var(--wash); border-radius: 99px; padding: 2px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-bar, .shot-row { display: flex; align-items: center; gap: 6px; }
.shot-h { font-weight: 600; color: var(--ink); margin-right: auto; }
.shot-row > span:first-child { margin-right: auto; }
.shot-row.dim { opacity: 0.5; }
.shot-chip { border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
.shot-key { display: inline-grid; place-items: center; min-width: 22px; height: 20px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); }
.shot-key.wide { justify-self: start; padding: 0 10px; }
.shot-menu { justify-self: end; display: grid; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); overflow: hidden; min-width: 90px; }
.shot-menu span { padding: 3px 10px; }
.shot-tabs { display: flex; flex-wrap: wrap; gap: 4px 10px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.shot-tabs .hl { box-shadow: 0 2px 0 var(--accent); }
.shot-file { font-family: var(--mono); font-size: 0.66rem; border: 1px dashed var(--axis); border-radius: 6px; padding: 3px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shot-lines { display: grid; gap: 4px; }
.shot-lines i { display: block; height: 6px; border-radius: 3px; background: var(--grid); }
.shot-lines i:nth-child(2) { width: 80%; }
.shot-lines i:nth-child(3) { width: 60%; }
.shot .hl:not(.shot-tabs .hl) { outline: 2px solid var(--accent); outline-offset: 1px; background: var(--accent-soft); color: var(--ink); font-weight: 600; }
@media (max-width: 560px) {
  .steps > li { grid-template-columns: minmax(0, 1fr); }
  .shot { max-width: 260px; }
}

/* On an iPhone or iPad in Safari: how to install. */
.install-ios { margin-bottom: 16px; }

/* Back from the other site: ready for the file. */
.return { margin-bottom: 16px; border-left-color: var(--accent); }

/* Catching up from the Letterboxd feed, on the Letterboxd data card. */
.feed-form { display: grid; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.feed-form label { font-size: 0.88rem; font-weight: 600; }
.feed-row { display: flex; flex-wrap: wrap; gap: 8px; }
.feed-result { margin: 0; font-size: 0.88rem; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); }
.feed-result.err { background: color-mix(in srgb, var(--lo, #c0392b) 14%, transparent); }
.feed-row input { flex: 1 1 140px; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 0.9rem; }

/* Links styled as buttons (the export guide). */
a.btn { text-decoration: none; color: inherit; }
