:root {
      color-scheme: light;
      --ink: #252525;
      --muted: #676762;
      --faint: #91918a;
      --paper: #f1eee7;
      --panel: #fbfaf7;
      --panel-2: #f3f0e9;
      --line: #d9d5cc;
      --red: #cf302b;
      --red-bright: #e43c35;
      --amber: #9a6b24;
      --sidebar: 430px;
    }

    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      overflow: hidden;
      background: var(--panel);
      color: var(--ink);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      font-size: 16px;
    }

    button, input { font: inherit; }
    button { color: inherit; }
    a { color: inherit; }

    .app {
      display: grid;
      grid-template-columns: var(--sidebar) minmax(0, 1fr);
      height: 100dvh;
      min-height: 520px;
    }

    .sidebar {
      position: relative;
      z-index: 500;
      display: flex;
      height: 100dvh;
      min-width: 0;
      min-height: 0;
      flex-direction: column;
      overflow: hidden;
      background:
        linear-gradient(rgba(55,49,39,.025) 1px, transparent 1px),
        var(--panel);
      background-size: 100% 34px;
      border-right: 1px solid var(--line);
      box-shadow: 14px 0 36px rgba(44,40,32,.09);
    }

    .masthead {
      padding: 22px 22px 18px;
      border-bottom: 1px solid var(--line);
    }

    .brand-row { display: flex; align-items: center; gap: 12px; }
    .brand-mark {
      display: block;
      width: 36px;
      height: 36px;
      flex: 0 0 36px;
      object-fit: contain;
    }

    .brand {
      margin: 0;
      font-family: Georgia, "Times New Roman", serif;
      font-size: 1.34rem;
      line-height: 1;
      letter-spacing: .02em;
      text-transform: uppercase;
    }
    .brand-sub {
      margin: 5px 0 0;
      color: var(--muted);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: .72rem;
      letter-spacing: .1em;
      text-transform: uppercase;
    }

    .stats {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 18px;
      color: var(--muted);
      font-size: .78rem;
    }
    .stats strong { color: var(--ink); font-weight: 650; }
    .stats .slash { color: var(--red); }

    .tools {
      padding: 16px 18px 15px;
      border-bottom: 1px solid var(--line);
      background: rgba(251,250,247,.96);
    }

    .search-wrap { position: relative; }
    .search-wrap svg {
      position: absolute;
      top: 50%;
      left: 13px;
      width: 17px;
      height: 17px;
      transform: translateY(-50%);
      color: var(--muted);
      pointer-events: none;
    }
    #search {
      width: 100%;
      height: 44px;
      padding: 0 40px;
      border: 1px solid #cbc7be;
      border-radius: 2px;
      outline: none;
      background: #fff;
      color: var(--ink);
      transition: border-color .16s, box-shadow .16s;
    }
    #search::placeholder { color: #96958f; }
    #search:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(224,53,47,.14); }
    #clear-search {
      position: absolute;
      top: 50%;
      right: 7px;
      display: none;
      width: 30px;
      height: 30px;
      padding: 0;
      transform: translateY(-50%);
      border: 0;
      border-radius: 50%;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
    }
    #clear-search:hover { color: var(--ink); background: #ece9e2; }

    .filters {
      display: flex;
      flex-wrap: wrap;
      gap: 7px;
      margin-top: 11px;
    }
    .filter {
      flex: 0 0 auto;
      min-height: 32px;
      padding: 6px 10px;
      border: 1px solid #d2cec5;
      border-radius: 999px;
      background: #f5f2ec;
      color: #66655f;
      font-size: .78rem;
      cursor: pointer;
      transition: .16s ease;
    }
    .filter:hover { border-color: #aaa69e; color: var(--ink); }
    .filter.active { border-color: var(--red); background: var(--red); color: #fff; }

    .list-shell {
      display: flex;
      min-height: 0;
      flex: 1 1 0;
      flex-direction: column;
      overflow: hidden;
    }

    .list-heading {
      flex: 0 0 auto;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      row-gap: 8px;
      align-items: center;
      justify-content: space-between;
      padding: 13px 20px 9px;
      color: var(--muted);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: .7rem;
      letter-spacing: .1em;
      text-transform: uppercase;
    }
    #result-count { color: var(--ink); }
    .list-sort { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
    .list-sort label { flex-shrink: 0; }
    .sort-select { min-width: 0; max-width: 100%; padding: 3px 4px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font: inherit; letter-spacing: .03em; cursor: pointer; }

    .results-wrap {
      position: relative;
      height: 0;
      min-height: 0;
      flex: 1 1 0;
      overflow: hidden;
    }

    .results {
      height: 100%;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-width: none;
    }
    .results::-webkit-scrollbar { display: none; }

    .scroll-track {
      position: absolute;
      z-index: 5;
      top: 8px;
      right: 5px;
      bottom: 8px;
      width: 10px;
      border: 1px solid #d8d4cb;
      border-radius: 999px;
      background: rgba(225,221,212,.74);
      opacity: 1;
      cursor: pointer;
      touch-action: none;
      transition: opacity .15s ease;
    }
    .scroll-thumb {
      position: absolute;
      top: 0;
      left: 1px;
      width: 6px;
      min-height: 52px;
      border-radius: 999px;
      background: #77746d;
      box-shadow: 0 1px 2px rgba(42,39,33,.18);
      cursor: grab;
    }
    .scroll-thumb:hover { background: #55534e; }
    .scroll-thumb.dragging { background: var(--red); cursor: grabbing; }

    .case-row {
      position: relative;
      display: grid;
      grid-template-columns: 60px minmax(0, 1fr) 18px;
      gap: 11px;
      align-items: center;
      width: 100%;
      padding: 13px 29px 13px 20px;
      border: 0;
      border-top: 1px solid rgba(62,57,48,.08);
      background: transparent;
      text-align: left;
      cursor: pointer;
      transition: background .15s ease;
    }
    .case-row:hover, .case-row:focus-visible { background: #f0ede6; outline: none; }
    .case-row.selected { background: #f8eae7; }
    .case-row.selected::before {
      content: "";
      position: absolute;
      inset: 0 auto 0 0;
      width: 3px;
      background: var(--red);
    }
    .file-no {
      display: grid;
      width: 60px;
      min-height: 46px;
      padding: 5px 2px;
      place-content: center;
      justify-items: center;
      gap: 3px;
      border: 1px solid #d2cec5;
      background: #f4f1ea;
      color: var(--amber);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: .82rem;
      line-height: 1.1;
    }
    .file-id-label {
      white-space: nowrap;
      color: var(--muted);
      font-size: .75rem;
      text-transform: uppercase;
    }
    .case-title {
      display: block;
      overflow: hidden;
      color: var(--ink);
      font-size: .9rem;
      font-weight: 620;
      line-height: 1.25;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .case-meta {
      display: flex;
      gap: 5px;
      margin-top: 5px;
      overflow: hidden;
      color: var(--muted);
      font-size: .75rem;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .case-place { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .case-year { flex-shrink: 0; }
    .case-arrow { color: #aaa69f; font-size: 1rem; }
    .case-row:hover .case-arrow, .case-row.selected .case-arrow { color: var(--red-bright); transform: translateX(2px); }

    .empty {
      display: none;
      margin: 24px 20px;
      padding: 20px;
      border: 1px dashed #c8c4bb;
      color: var(--muted);
      text-align: center;
      line-height: 1.5;
    }

    .data-note {
      padding: 11px 18px;
      border-top: 1px solid var(--line);
      color: #888781;
      font-size: .68rem;
      line-height: 1.45;
    }

    .publisher {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 4px 12px;
      margin-top: 9px;
      padding-top: 7px;
      border-top: 1px solid var(--line);
      color: var(--ink);
      font-size: .875rem;
    }
    .publisher a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
    .publisher a:hover { color: var(--red); }
    .publisher a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

    .map-stage { position: relative; min-width: 0; min-height: 0; background: #b5c8cb; }
    #map { position: absolute; inset: 0; z-index: 1; }
    /* Static printed-paper grain: no filters, animation or pointer interception. */
    #map::after {
      content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
      background-image: radial-gradient(rgba(98,78,44,.25) .45px, transparent .75px),
        radial-gradient(rgba(255,252,235,.55) .5px, transparent .85px);
      background-size: 5px 7px, 11px 13px;
      background-position: 0 0, 3px 4px;
      opacity: .18;
      box-shadow: inset 0 0 60px rgba(102,78,35,.18);
    }
    .maplibregl-popup.case-tooltip { z-index: 4; }

    .map-label {
      position: absolute;
      z-index: 400;
      top: 18px;
      left: 18px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border: 1px solid rgba(96,91,82,.16);
      background: #faf3e4;
      box-shadow: 0 8px 22px rgba(44,40,32,.12);
      color: #5f5e59;
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: .7rem;
      letter-spacing: .08em;
      text-transform: uppercase;
    }
    .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(224,53,47,.14); }

    .legend {
      position: absolute;
      z-index: 400;
      right: 16px;
      bottom: 22px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 10px;
      border: 1px solid rgba(96,91,82,.16);
      background: #faf3e4;
      color: #66655f;
      font-size: .7rem;
    }
    .legend-pin { width: 9px; height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--red); }

    .detail {
      flex: 0 0 auto;
      max-height: 0;
      overflow: hidden;
      border-bottom: 0 solid var(--line);
      background: #fff;
      opacity: 0;
      pointer-events: none;
      transform: translateY(-8px);
      transition: max-height .24s ease, opacity .18s ease, transform .18s ease, border-width .18s ease;
    }
    .detail.open { max-height: 360px; overflow-y: auto; border-bottom-width: 1px; opacity: 1; pointer-events: auto; transform: translateY(0); }
    .detail-bar { height: 4px; background: var(--red); }
    .detail-inner { padding: 18px 22px 20px; }
    .detail-top { display: block; }
    .detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
    .detail-placement { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); color: var(--muted); font-size: .875rem; cursor: pointer; }
    .detail-placement svg { width: 16px; height: 16px; flex-shrink: 0; }
    .detail-placement:hover { color: var(--ink); border-color: var(--amber); background: #f7efdf; }
    .detail-placement:disabled { opacity: .45; cursor: default; }
    .eyebrow {
      color: var(--red-bright);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: .68rem;
      letter-spacing: .12em;
      text-transform: uppercase;
    }
    .detail h2 {
      margin: 8px 0 6px;
      font-family: Georgia, "Times New Roman", serif;
      font-size: 1.7rem;
      line-height: 1.08;
      font-weight: 600;
    }
    .place { margin: 0; color: var(--muted); font-size: .9rem; }
    .close {
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      border: 1px solid #d5d1c8;
      border-radius: 50%;
      background: transparent;
      color: var(--muted);
      cursor: pointer;
    }
    .close:hover { border-color: #aaa69e; color: var(--ink); background: #f3f0e9; }
    .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0; }
    .tag { padding: 5px 7px; border: 1px solid #d8d4cb; color: #706f69; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
    .summary { margin: 0; color: #3f3f3b; font-size: .95rem; line-height: 1.58; }
    .location-note {
      margin: 16px 0 18px;
      padding: 10px 12px;
      border-left: 2px solid var(--amber);
      background: #f5f2ec;
      color: #66655f;
      font-size: .78rem;
      line-height: 1.45;
    }
    .location-note strong { display: block; margin-bottom: 3px; color: var(--amber); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
    .netflix-link {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      min-height: 40px;
      padding: 9px 13px;
      border-radius: 2px;
      background: var(--red);
      color: white;
      font-size: .86rem;
      font-weight: 700;
      text-decoration: none;
    }
    .netflix-link:hover { background: var(--red-bright); }

    .maplibregl-map { background: #b5c8cb; font-family: inherit; }
    .maplibregl-ctrl-group { border: 1px solid #c7baa2 !important; border-radius: 2px !important; background: #faf3e4 !important; box-shadow: 0 8px 26px rgba(24,28,31,.18) !important; }
    .maplibregl-ctrl-group button { border-bottom-color: #ddd1bb !important; }
    .maplibregl-ctrl-group button:hover { background-color: #ece0c9 !important; }
    .maplibregl-ctrl-icon { filter: none; opacity: .78; }
    .maplibregl-ctrl-attrib { background: rgba(250,243,228,.94) !important; color: #696251 !important; }
    .maplibregl-ctrl-attrib a { color: #4f493f !important; }
    .maplibregl-popup.case-tooltip { max-width: 260px !important; }
    .maplibregl-popup.case-tooltip .maplibregl-popup-content {
      padding: 7px 9px;
      border: 1px solid #c7baa2;
      border-radius: 2px;
      background: #faf3e4;
      box-shadow: 0 8px 22px rgba(25,29,32,.2);
      color: #202328;
      font-size: .76rem;
    }
    .maplibregl-popup.case-tooltip .maplibregl-popup-tip { border-top-color: #faf3e4; }
    .maplibregl-popup.case-hover { max-width: min(320px, calc(100vw - 36px)) !important; pointer-events: none; }
    .maplibregl-popup.case-hover .maplibregl-popup-content { padding: 12px 14px; line-height: 1.4; }
    .maplibregl-popup.case-hover * { pointer-events: none; }
    .pin-preview { display: block; min-width: 0; overflow-wrap: anywhere; }
    .pin-preview-heading { display: block; margin-bottom: 10px; color: var(--muted); font-size: .8125rem; }
    .pin-preview-group .pin-preview + .pin-preview { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
    .pin-preview-group .episode-badge { display: none; }
    .pin-preview-title { display: block; font-size: .9375rem; line-height: 1.35; }
    .pin-preview-meta { display: block; margin-top: 5px; color: var(--muted); font-size: .875rem; }
    .pin-preview-series { display: block; margin-bottom: 6px; color: var(--muted); font-size: .8125rem; }
    .pin-preview-overlap { display: block; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }



    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
    }

/* Episode details follow the original paper index and red pin palette. */
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button, select { touch-action: manipulation; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.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; }
.skip-link { position: fixed; z-index: 9999; top: 8px; left: 8px; padding: 10px 16px; background: var(--panel); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.masthead, .tools, .data-note { flex-shrink: 0; }
#clear-search { display: block; }
.empty { display: block; }
.view-select { max-width: 70%; border: 0; border-radius: 0; color: var(--muted); background: transparent; font: inherit; letter-spacing: inherit; text-transform: uppercase; cursor: pointer; }
.episode-badge { display: block; margin-top: 5px; color: var(--amber); font-size: .68rem; }
.episode-badge::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--red); vertical-align: 1px; }
.detail.open { flex: 0 1 auto; min-height: 0; max-height: min(48dvh, 440px); scrollbar-width: thin; scrollbar-color: #aaa69e transparent; }
.has-detail .list-shell { min-height: 100px; }
#detail-title { outline: none; }
.source-link { display: inline-block; margin-top: 10px; color: var(--muted); font-size: .74rem; line-height: 1.5; text-underline-offset: 3px; }
.source-link:hover { color: var(--red); }
.location-note .source-link { display: block; }
.episode-section { margin-top: 22px; border-top: 1px solid var(--line); }
.episode-heading { display: flex; justify-content: space-between; align-items: center; margin: 16px 0 12px; }
.episode-heading h3 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: 1.15rem; }
.episode-heading > span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; text-transform: uppercase; }
.season-select { width: 100%; height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 2px; background: var(--panel); color: var(--ink); font-size: .78rem; }
.text-button { padding: 8px 0; border: 0; background: transparent; color: var(--red); font-size: .76rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.show-locations { margin: 5px 0 8px; }
.season-group + .season-group { margin-top: 26px; }
.season-heading { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px; border-top: 2px solid var(--red); border-bottom: 1px solid var(--line); background: var(--panel-2); }
.season-heading h4 { margin: 0; color: var(--ink); font-size: .8rem; font-weight: 700; line-height: 1.4; letter-spacing: .04em; text-transform: uppercase; }
.season-heading > span { flex-shrink: 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; }
.season-heading + .episode-row { border-top: 0; }
.episode-row { scroll-margin-top: 52px; display: grid; grid-template-columns: 36px minmax(0,1fr) 12px; gap: 8px; align-items: start; width: 100%; padding: 12px 6px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.episode-row:hover, .episode-row.active { background: #f8eee9; }
.episode-no { padding-top: 2px; color: var(--amber); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; }
.episode-title { display: block; font-size: .82rem; font-weight: 600; line-height: 1.35; }
.episode-place { display: block; margin-top: 5px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
.episode-kind { display: block; margin-top: 5px; color: var(--amber); font-size: .65rem; }
.episode-expanded { padding: 0 13px 14px 50px; background: #f8eee9; }
.episode-expanded p { margin: 0; font-size: .78rem; line-height: 1.6; }
.episode-location { margin-top: 10px; color: var(--amber); font-size: .63rem; text-transform: uppercase; letter-spacing: .05em; }
.episode-expanded .source-link + .source-link { margin-left: 10px; }
.episode-controls { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
.episode-controls button { padding: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: .72rem; cursor: pointer; }
.episode-controls button:disabled { opacity: .4; cursor: default; }
.map-label { cursor: pointer; }
.map-label:hover { background: #fffdf7; }
.legend { gap: 18px; pointer-events: none; }
.legend > span { display: flex; align-items: center; gap: 6px; }
.legend-popularity { white-space: nowrap; }
.legend-popularity svg { flex: 0 0 32px; color: #947b54; }
.legend-pin {
  position: relative; display: inline-block; flex: 0 0 15px;
  width: 15px; height: 24px; border: 0; border-radius: 0; background: none;
}
.legend-pin::before {
  content: ''; position: absolute; top: 10px; left: 8px; width: 1px; height: 13px;
  background: #71695a; transform: rotate(-13deg); box-shadow: 1px 0 #fff6df;
}
.legend-pin::after {
  content: ''; position: absolute; top: 1px; left: 0; width: 12px; height: 12px;
  border: 1px solid #fff5dd; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ed8871, #bd3e30 58%, #75251f);
  box-shadow: 1px 2px 3px rgba(62,39,23,.25);
}
.legend-pin.episode-pin { flex-basis: 10px; width: 10px; height: 10px; }
.legend-pin.episode-pin::before { display: none; }
.legend-pin.episode-pin::after { inset: 0; width: 9px; height: 9px; }
.map-status { position: absolute; z-index: 400; top: 72px; left: 18px; max-width: min(320px, calc(100% - 36px)); padding: 12px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: .8rem; line-height: 1.5; }
.maplibregl-popup.case-choices { max-width: min(360px, calc(100vw - 36px)) !important; }
.maplibregl-popup.case-choices .maplibregl-popup-content { padding: 0; }
.case-choices .maplibregl-popup-close-button { top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; font-size: 20px; }
.location-choices { max-height: min(560px, var(--choices-max-height, 60dvh)); overflow-y: auto; overscroll-behavior: contain; }
.location-choices-heading { position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 42px 14px 16px; background: #faf3e4; }
.location-choices-heading strong { font-family: Georgia, 'Times New Roman', serif; font-size: 1.125rem; }
.location-choices-heading > span { flex-shrink: 0; color: var(--muted); font-size: .8125rem; }
.location-choice { display: grid; grid-template-columns: minmax(0, 1fr) 14px; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; font: inherit; line-height: 1.4; cursor: pointer; }
.location-choice:hover, .location-choice:focus-visible { background: #f1e5cf; }
.location-choice:focus-visible { outline: 2px solid var(--red); outline-offset: -3px; }
.location-choice-arrow { color: var(--amber); font-size: 1.4rem; transition: transform 120ms ease; }
.location-choice:hover .location-choice-arrow, .location-choice:focus-visible .location-choice-arrow { color: var(--red); transform: translateX(2px); }
.location-choice .episode-badge { display: none; }
.noscript { position: fixed; z-index: 9999; bottom: 0; left: 0; right: 0; padding: 20px; background: var(--panel); }

/* Netflix artwork and official browse synopses. */
.case-banner { margin: 16px 0 0; }
.case-banner-art { position: relative; isolation: isolate; background: var(--panel-2); }
.case-banner-background { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.case-banner-art.has-title-logo::after { content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.25), transparent 28%, transparent 42%, rgba(0,0,0,.76)); }
.case-banner-brand { position: absolute; top: 14px; left: 14px; z-index: 2; width: auto; max-width: 82px; height: 22px; object-fit: contain; object-position: left top; }
.case-banner-title { position: absolute; bottom: 18px; left: 9%; z-index: 2; width: 82%; height: 32%; object-fit: contain; object-position: center bottom; }
.case-banner img[hidden] { display: none; }
.case-banner figcaption { padding-top: 5px; color: var(--muted); font-size: .56rem; letter-spacing: .03em; text-align: right; }
.synopsis-credit { display: inline-block; margin-bottom: 6px; color: var(--red); font-size: .63rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; text-decoration: none; }
.synopsis-credit:hover { text-decoration: underline; text-underline-offset: 3px; }
.location-note summary, .episode-context summary { cursor: pointer; font-size: .74rem; font-weight: 600; }
.location-note summary > span, .episode-context summary > span { display: block; margin: 3px 0 0 14px; color: var(--muted); font-size: .63rem; font-weight: 400; }
.location-note-body { margin-top: 10px; }
.episode-context { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); }
summary:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.episode-coverage { margin: 0 0 14px; color: var(--muted); font-size: .875rem; line-height: 1.5; }


/* The open case belongs to its map pin; the index remains available alongside it. */
.maplibregl-popup.case-card-popup { z-index: 5; }
.case-card-popup .maplibregl-popup-tip { transform: translateX(var(--tip-shift, 0px)); }
.case-card-popup .maplibregl-popup-content {
  padding: 0; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; color: var(--ink);
  box-shadow: 0 14px 42px rgba(35, 31, 26, .2), 0 2px 6px rgba(35, 31, 26, .08);
}
.case-card-popup .detail.open {
  width: var(--popup-width, 368px); max-height: var(--popup-height, 620px);
  border: 0; border-radius: 3px; overflow: auto; overscroll-behavior: contain;
  opacity: 1; transform: none; transition: none; scrollbar-gutter: stable;
}
.case-card-popup .detail-bar { position: sticky; top: 0; z-index: 4; }
.case-card-popup .detail-inner { padding: 0 18px 18px; }
.case-card-popup .detail-top {
  position: sticky; top: 4px; z-index: 3; margin: 0 -18px; padding: 16px 18px 12px;
  background: #fff; border-bottom: 1px solid #eeeae3;
}
.case-card-popup .detail h2 { font-size: 1.5rem; line-height: 1.12; }
.case-card-popup .eyebrow { font-size: .6rem; }
.case-card-popup .place { font-size: .78rem; line-height: 1.45; }
.case-card-popup .close { width: 30px; height: 30px; }
.case-card-popup .case-banner { margin-top: 14px; }
.case-card-popup .detail-tags { gap: 5px; margin: 12px 0; }
.case-card-popup .tag { padding: 4px 6px; font-size: .61rem; }
.case-card-popup .summary { font-size: .82rem; line-height: 1.55; }
.case-card-popup .netflix-link { margin-top: 14px; min-height: 38px; font-size: .78rem; }
.case-card-popup .location-note { margin: 14px 0 0; padding: 8px 10px; }
.case-card-popup .episode-section { margin-top: 18px; }
.case-card-popup .season-heading { top: 0; position: relative; }
.case-card-popup .episode-row { scroll-margin-top: 150px; }
.case-card-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #fff; }
.case-card-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: #fff; }
.case-card-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: #fff; }

/* IMDb scores remain secondary to each case title and location. */
.case-rating { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; color: var(--ink); font-size: .78rem; line-height: 1.5; font-variant-numeric: tabular-nums; }
.rating-star { color: var(--amber); }
.rating-votes, .rating-scale { color: var(--muted); font-weight: 400; }
.rating-block { margin: 12px 0 16px; }
.imdb-rating { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; color: var(--ink); font-size: .875rem; line-height: 1.6; text-decoration: none; font-variant-numeric: tabular-nums; }
a.imdb-rating:hover strong { text-decoration: underline; text-underline-offset: 3px; }
a.imdb-rating:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.imdb-logo { display: inline-block; flex: 0 0 auto; width: 2.5rem; height: 1.25rem; object-fit: contain; }
.imdb-rating .imdb-logo { width: 3rem; height: 1.5rem; }
.imdb-rating strong { font-size: 1rem; }
.rating-scale { font-size: .8rem; }
.rating-date, .rating-note { margin: 4px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.imdb-credit { display: block; margin-top: 5px; }
.imdb-credit a { text-underline-offset: 2px; }
.episode-expanded .rating-block { margin: 0 0 12px; }

.pin-preview .case-rating, .episode-row .case-rating { font-size: .875rem; }

/* Story scope stays visible without implying address-level precision. */
.location-scope { display: block; margin-top: 5px; color: var(--amber); font-size: .875rem; }
.story-place-note { margin: 0 0 12px; font-size: .875rem; line-height: 1.5; color: var(--muted); }
.story-place-note a { color: inherit; text-underline-offset: 3px; }


/* Dock the same case card beside the map, preserving its controls and content. */
.sidebar.has-docked-detail .tools,
.sidebar.has-docked-detail .list-shell,
.sidebar.has-docked-detail .data-note { display: none; }
.sidebar.has-docked-detail .detail.open { flex: 1 1 0; width: 100%; max-height: none; border: 0; transform: none; transition: none; overflow: auto; overscroll-behavior: contain; }
.sidebar.has-docked-detail .detail-bar { position: sticky; top: 0; z-index: 4; }
.sidebar.has-docked-detail .detail-inner { padding: 0 20px 20px; }
.sidebar.has-docked-detail .detail-top { position: sticky; top: 4px; z-index: 3; margin: 0 -20px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.sidebar.has-docked-detail .season-heading { position: relative; }
.sidebar.has-docked-detail .episode-row { scroll-margin-top: 180px; }

/* Keep certainty visible alongside the place, including collapsed episodes. */
.pin-preview-precision, .episode-precision { display: block; margin-top: 4px; color: var(--amber); font-size: .72rem; line-height: 1.4; }
.accuracy-note { margin: 12px 0 4px; }
.accuracy-date { display: block; margin-top: 6px; color: var(--muted); font-size: .7rem; }

/* Personal viewing status sits alongside the catalogue, with no account needed. */
:root { --watched: #3e6652; }
.watch-filters { display: flex; flex: 0 0 auto; gap: 3px; margin: 0 20px 10px; padding: 3px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel-2); }
.watch-filter { flex: 1; min-width: 0; min-height: 32px; padding: 5px 8px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); font-size: .875rem; cursor: pointer; }
.watch-filter:hover { color: var(--ink); background: #fff8; }
.watch-filter.active { background: var(--ink); color: #fff; }
.case-list-item { position: relative; }
.case-list-item .case-row { grid-template-columns: 60px minmax(0, 1fr); padding-right: 68px; }
.watch-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--muted); font-size: .875rem; cursor: pointer; }
.watch-icon { flex: 0 0 18px; width: 18px; height: 18px; }
.watch-toggle[aria-pressed="false"] .watch-check { visibility: hidden; }
.watch-toggle[aria-pressed="true"] { color: var(--watched); background: #edf3ed; border-color: #99b4a3; }
.watch-toggle:hover { border-color: var(--watched); color: var(--watched); }
.watch-toggle-compact { position: absolute; right: 18px; top: 50%; width: 40px; height: 40px; padding: 9px; transform: translateY(-50%); border-color: transparent; background: transparent; }
.watch-toggle-compact[aria-pressed="true"] { border-color: transparent; }
.watch-toggle:focus-visible, .watch-filter:focus-visible { outline: 2px solid var(--watched); outline-offset: 2px; }
.watched-badge { display: flex; align-items: center; gap: 5px; margin-top: 6px; color: var(--watched); font-size: .875rem; font-weight: 550; }
.watched-badge .watch-icon { width: 14px; height: 14px; flex-basis: 14px; }
.detail-watch { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 12px 0; }
.detail-watch > span { color: var(--muted); font-size: .875rem; }
.watch-notice { position: fixed; z-index: 1000; bottom: 16px; left: 16px; width: min(360px, calc(100vw - 32px)); margin: 0; padding: 12px 16px; border: 1px solid var(--amber); background: var(--panel); color: var(--ink); font-size: .875rem; line-height: 1.45; }
.watch-notice[hidden] { display: none; }

/* Watched rows change color, never their dimensions. */
.case-list-item.is-watched .case-title { color: var(--watched); }
.case-list-item.is-watched .file-no { border-color: #afc1b5; }
.legend { flex-wrap: wrap; max-width: calc(100% - 32px); }
.legend-pin.watched-pin::after { background: radial-gradient(circle at 32% 28%, #91b89a, #3e7655 58%, #244b37); }
.legend-pin.mixed-pin::after { background: radial-gradient(circle at 32% 28%, #ffffff60, transparent 48%), linear-gradient(90deg, #bd3e30 0 46%, #fff5dd 46% 54%, #3e7655 54%); }

/* Episode controls occupy a fixed column; watched state changes color only. */
.watch-dash { visibility: hidden; }
.watch-toggle[aria-pressed="mixed"] .watch-check, .watched-badge.is-partial .watch-check { visibility: hidden; }
.watch-toggle[aria-pressed="mixed"] .watch-dash, .watched-badge.is-partial .watch-dash { visibility: visible; }
.watch-toggle[aria-pressed="mixed"] { color: var(--watched); }
.watch-progress { font-variant-numeric: tabular-nums; white-space: nowrap; }
.watch-count { display: inline-block; text-align: right; }
.episode-entry { position: relative; border-top: 1px solid var(--line); }
.season-heading + .episode-entry { border-top: 0; }
.episode-entry .episode-row { border-top: 0; padding-right: 52px; }
.episode-watch-toggle { top: 12px; right: 3px; transform: none; }
.episode-entry.is-watched .episode-title, .episode-entry.is-watched .episode-no { color: var(--watched); }


/* On phones, each working surface gets the screen. The shared map stays mounted. */
.mobile-navigation, .mobile-case-peek { display: none; }
@media (max-width: 900px), (max-height: 500px) and (pointer: coarse) {
  :root { --mobile-nav-height: calc(58px + env(safe-area-inset-bottom, 0px)); }
  html, body { width: 100%; overflow: hidden; }
  .app { position: relative; display: block; height: var(--mobile-height, 100dvh); min-height: 0; }
  .app .sidebar, .app .map-stage {
    position: absolute; inset: 0 0 var(--mobile-nav-height); width: 100%;
    height: auto; min-height: 0; border: 0; visibility: visible;
  }
  .app[data-mobile-view="browse"] .map-stage,
  .app[data-mobile-view="map"] .sidebar { visibility: hidden; pointer-events: none; }
  .sidebar { box-shadow: none; padding-top: env(safe-area-inset-top, 0px); }
  .masthead { padding: 17px 16px 14px; }
  .brand-row { gap: 12px; }
  .brand-mark { width: 31px; height: 31px; flex-basis: 31px; }
  .brand { font-size: 1.25rem; }
  .brand-sub { font-size: .6875rem; letter-spacing: .07em; }
  .stats, .footer-notes { display: none; }
  .data-note { display: block; padding: 2px 16px; }
  .publisher { margin: 0; padding: 0; border: 0; }
  .publisher a { display: inline-flex; align-items: center; min-height: 44px; }
  .tools { padding: 12px 16px 9px; }
  #search { height: 46px; font-size: 1rem; padding-right: 46px; }
  #clear-search { right: 1px; width: 44px; height: 44px; font-size: 1.3rem; }
  .filters { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin: 8px -16px 0; padding: 0 16px 3px; gap: 8px; }
  .filters::-webkit-scrollbar { display: none; }
  .filter { min-height: 44px; padding: 8px 13px; font-size: .875rem; }
  .list-heading { padding: 3px 16px 4px; row-gap: 0; font-size: .75rem; letter-spacing: .035em; }
  .view-select { min-height: 44px; max-width: 100%; padding: 0 20px 0 0; }
  #result-count { white-space: nowrap; font-size: .75rem; }
  .list-sort { gap: 10px; }
  .sort-select { min-height: 44px; font-size: .875rem; }
  .watch-filters { margin: 0 16px 10px; }
  .watch-filter { min-height: 44px; font-size: .875rem; }
  .results { scrollbar-width: thin; scrollbar-color: #c2bdb1 transparent; }
  .scroll-track { display: none; }
  .case-list-item .case-row { grid-template-columns: 46px minmax(0, 1fr); gap: 10px; padding: 16px 62px 16px 16px; }
  .file-no { width: 46px; min-height: 44px; font-size: .875rem; }
  .file-id-label { font-size: .625rem; }
  .case-title { white-space: normal; font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
  .case-meta { flex-wrap: wrap; white-space: normal; font-size: .875rem; line-height: 1.4; gap: 0 5px; }
  .case-place { overflow: visible; }
  .case-rating, .episode-badge { font-size: .875rem; }
  .watch-toggle { min-height: 44px; }
  .watch-toggle-compact { width: 44px; height: 44px; right: 8px; padding: 11px; }
  .watch-icon { width: 20px; height: 20px; flex-basis: 20px; }
  .empty { margin: 16px; padding: 16px; }
  .text-button { min-height: 44px; font-size: .875rem; }
  .has-docked-detail .masthead { padding: 12px 16px; }
  .has-docked-detail .brand-sub { display: none; }
  .sidebar.has-docked-detail .detail-inner { padding: 0 16px 24px; }
  .sidebar.has-docked-detail .detail-top { display: contents; }
  .detail-actions { position: sticky; top: 4px; z-index: 5; margin: 0 -16px 16px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
  .detail-placement, .close { min-height: 44px; }
  .close { width: 44px; height: 44px; font-size: 1.25rem; }
  .detail-placement { padding: 8px 12px; font-size: .875rem; }
  .eyebrow { font-size: .75rem; }
  .detail h2 { font-size: 1.75rem; line-height: 1.15; overflow-wrap: anywhere; }
  .place, .summary { font-size: 1rem; line-height: 1.5; }
  .detail .case-banner { max-width: 560px; margin: 16px auto 0; }
  .case-banner figcaption { font-size: .75rem; }
  .tag { font-size: .75rem; }
  .netflix-link { min-height: 48px; font-size: 1rem; margin-top: 16px; }
  .synopsis-credit { min-height: 36px; padding: 8px 0; font-size: .8125rem; }
  .location-note { font-size: .875rem; }
  .location-note summary, .episode-context summary { min-height: 44px; font-size: .875rem; }
  .location-note summary > span, .episode-context summary > span { font-size: .8125rem; }
  .source-link { min-height: 44px; padding: 10px 0; font-size: .875rem; }
  .episode-heading h3 { font-size: 1.4rem; }
  .episode-heading > span, .season-heading > span { font-size: .75rem; }
  .season-select { height: 46px; font-size: 1rem; padding: 0 10px; }
  .season-heading { padding: 13px 10px; gap: 8px; }
  .season-heading h4 { font-size: .875rem; letter-spacing: .02em; }
  .episode-entry .episode-row { grid-template-columns: 24px minmax(0,1fr) 10px; padding: 16px 51px 16px 2px; gap: 6px; scroll-margin-top: 72px; }
  .episode-no { font-size: .8125rem; }
  .episode-title { font-size: 1rem; overflow-wrap: anywhere; }
  .episode-place, .episode-precision, .episode-kind { font-size: .875rem; }
  .episode-watch-toggle { right: 0; top: 10px; }
  .episode-expanded { padding: 12px 12px 16px 32px; }
  .episode-expanded p { font-size: 1rem; }
  .episode-location { font-size: .8125rem; }
  .episode-controls button { min-height: 44px; font-size: .875rem; }
  .mobile-navigation { position: absolute; z-index: 600; inset: auto 0 0; display: flex; height: var(--mobile-nav-height); padding: 5px max(12px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); gap: 8px; border-top: 1px solid var(--line); background: var(--panel); }
  .mobile-navigation button { display: flex; flex: 1; align-items: center; justify-content: center; gap: 9px; min-width: 0; min-height: 44px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .9375rem; font-weight: 600; }
  .mobile-navigation button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
  .mobile-navigation svg { width: 21px; height: 21px; flex: 0 0 21px; }
  .map-label { top: calc(12px + env(safe-area-inset-top, 0px)); left: max(12px, env(safe-area-inset-left, 0px)); min-height: 44px; max-width: calc(100% - 84px); padding: 10px 12px; font-size: .75rem; letter-spacing: .04em; }
  .maplibregl-ctrl-top-right { top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); }
  .maplibregl-ctrl-group button { width: 44px; height: 44px; }
  .maplibregl-ctrl-attrib { font-size: 11px; }
  .map-status { top: calc(72px + env(safe-area-inset-top, 0px)); left: 12px; font-size: .875rem; }
  .legend { right: 12px; left: 12px; bottom: 36px; justify-content: center; gap: 8px 14px; max-width: none; padding: 8px; font-size: .75rem; }
  .mobile-has-selection .legend, .map-stage:has(.case-choices) .legend { display: none; }
  .mobile-case-peek { position: absolute; z-index: 400; display: flex; align-items: center; justify-content: space-between; gap: 12px; left: max(12px, env(safe-area-inset-left, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); bottom: 36px; padding: 14px; min-height: 66px; border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: 3px; background: var(--panel); box-shadow: 0 5px 24px #30281820; text-align: left; }
  .mobile-case-peek > span:first-child { min-width: 0; }
  .mobile-case-peek strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9375rem; line-height: 1.3; }
  #mobile-case-place { display: block; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: .8125rem; }
  .mobile-case-return { flex-shrink: 0; color: var(--red); font-size: .8125rem; }
  .maplibregl-popup.case-choices { left: 12px !important; right: 12px !important; bottom: 36px !important; top: auto !important; transform: none !important; max-width: none !important; }
  .case-choices .maplibregl-popup-tip { display: none; }
  .case-choices .maplibregl-popup-close-button { top: 3px; right: 3px; z-index: 2; width: 44px; height: 44px; }
  .location-choices { max-height: min(65dvh, calc(var(--mobile-height, 100dvh) - 170px)); }
  .location-choices-heading { padding-right: 52px; align-items: center; }
  .watch-notice { bottom: calc(var(--mobile-nav-height) + 12px); }
  .skip-link:focus { transform: none; }
  /* Short phones, landscape, and the on-screen keyboard need one scroll area;
     filters can then scroll away instead of consuming the results viewport. */
  .mobile-short .sidebar:not(.has-docked-detail) { overflow-y: auto; overscroll-behavior: contain; }
  .mobile-short .list-shell { flex: 0 0 auto; overflow: visible; }
  .mobile-short .results-wrap { flex: 0 0 auto; height: auto; overflow: visible; }
  .mobile-short .results { height: auto; overflow: visible; }
  .mobile-short .masthead { padding-top: 10px; padding-bottom: 10px; }
  .mobile-short .brand-sub { display: none; }
  .mobile-short .tools { padding-top: 8px; padding-bottom: 4px; }
  .sidebar.has-docked-detail { overflow: clip; }
  @media (orientation: landscape) and (max-height: 500px) {
    .mobile-case-peek { bottom: 30px; padding: 8px 12px; min-height: 56px; }
    .legend { left: 70px; right: 70px; bottom: 30px; }
  }
}

.episode-rating-unavailable { display: block; margin-top: 5px; color: var(--muted); font-size: .8125rem; }

.show-locations:disabled { color: var(--muted); border-bottom-color: transparent; cursor: default; }
