:root {
  color-scheme: dark;
  --bg: #0e0d12;
  --panel: #17151d;
  --panel-2: #1f1c27;
  --line: #2c2836;
  --line-hover: #3a3450;
  --text: #ece9f2;
  --muted: #9b95ab;
  --accent: #ffb020;
  --accent-ink: #ffb020;   /* accent used as coloured text (day headers etc.) */
  --accent-2: #ff5c5c;
  --ok: #4ad07a;
  --warn: #ffb020;
  --topbar: rgba(14, 13, 18, .85);
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
}

/* Follow the OS setting automatically. Light gets its own tuned palette so
   amber-on-white stays legible (darker --accent-ink) rather than washed out. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f5f4f8;
    --panel: #ffffff;
    --panel-2: #efedf4;
    --line: #e3e0ea;
    --line-hover: #d3cddd;
    --text: #1b1922;
    --muted: #6c6678;
    --accent: #f0a500;
    --accent-ink: #9a6100;
    --accent-2: #e5484d;
    --ok: #2fa661;
    --warn: #b5730a;
    --topbar: rgba(245, 244, 248, .85);
    --shadow: 0 6px 24px rgba(20, 16, 40, .12);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-weight: 800;
  letter-spacing: .14em;
  font-size: 18px;
}
.brand .dot { color: var(--accent-2); }
.status { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ---------- buttons ---------- */
.btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--muted); }

/* ---------- layout (My Programme | Programme | Movie details) ---------- */
.layout {
  display: grid;
  /* equal side columns keep the central Programme column exactly centred */
  grid-template-columns: 320px minmax(0, 1fr) 320px;
  gap: 20px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px;
  align-items: start;
}
.plan, .detail-card {
  position: sticky;
  top: 81px;
  align-self: start;
  max-height: calc(100vh - 101px);
  overflow-y: auto;
}

/* ---------- filters ---------- */
.filters {
  position: sticky;
  top: 61px;
  z-index: 10;
  background: var(--bg);
  padding-bottom: 12px;
  margin-bottom: 4px;
}
.search {
  width: 100%;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}
.search:focus { outline: none; border-color: var(--accent); }
.filter-group { display: flex; align-items: baseline; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.filter-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); min-width: 52px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all .12s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #241a00;
  font-weight: 600;
}

/* ---------- results ---------- */
.day-group { margin-top: 22px; }
.day-header {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent-ink);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.screening {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color .12s;
}
.screening:hover { border-color: var(--line-hover); }
.sc-time { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-main { min-width: 0; }
.sc-titleline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.sc-title { font-weight: 600; font-size: 16px; }

/* Original-language title shown beside the main one */
.orig-title { font-style: italic; font-weight: 400; color: var(--muted); font-size: .9em; }

/* Singular projection (film shown only once) — tint to stand out, coloured to
   match the film's status (lighter shade of the tag) */
.screening.singular { background: var(--singular-bg); }
.screening.singular.st-interested { background: var(--sg-interested); }
.screening.singular.st-watched { background: var(--sg-watched); }
.screening.singular.st-uninterested { background: var(--sg-uninterested); }
/* Hidden (dismissed) individual screening — greyed out, and it sticks */
.screening.dismissed { opacity: .4; }
.screening.dismissed:hover { opacity: .62; }
.dismiss-btn.active { border-color: var(--accent); color: var(--accent-ink); }

/* In My Programme — the whole event turns green with white text */
.screening.in-plan { background: var(--plan-bg); border-color: var(--plan-bg); }
.screening.in-plan:hover { border-color: rgba(255, 255, 255, .4); }
.screening.in-plan .sc-time,
.screening.in-plan .sc-title { color: #fff; }
.screening.in-plan .sc-meta,
.screening.in-plan .orig-title { color: rgba(255, 255, 255, .85); }
.screening.in-plan .tag,
.screening.in-plan .lb-chip,
.screening.in-plan .more-count {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
}
.screening.in-plan .dismiss-btn { border-color: rgba(255, 255, 255, .35); color: rgba(255, 255, 255, .9); }
.screening.in-plan .add-btn.added { background: #fff; border-color: #fff; color: var(--plan-bg); }
/* "X more projections" badge next to the title when a film has several showings */
.more-count {
  font-size: 11px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
}

/* Movie title as a Letterboxd link */
a.lb { color: inherit; text-decoration: none; }
a.lb:hover { color: var(--accent-ink); }
a.lb:hover .lb-arrow { opacity: 1; }
.lb-arrow {
  display: inline-block;
  margin-left: 5px;
  font-size: .72em;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity .12s;
}
.sc-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  margin-right: 4px;
}
.sc-actions { display: flex; align-items: center; gap: 8px; }
.add-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 9px;
  font-size: 18px;
  cursor: pointer;
  transition: all .12s;
}
.add-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.add-btn.added { background: var(--accent); border-color: var(--accent); color: #241a00; }
.dismiss-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 9px;
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
}
.dismiss-btn:hover { border-color: var(--accent-2); color: var(--accent-2); }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* ---------- right sidebar (My Programme + movie detail) ---------- */
.sidebar {
  position: sticky;
  top: 81px;
  align-self: start;
  max-height: calc(100vh - 101px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.plan {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.plan-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.plan-head h2 { margin: 0; font-size: 16px; }
.count {
  background: var(--accent-2); color: #fff;
  border-radius: 999px; font-size: 12px; font-weight: 700;
  padding: 1px 8px; min-width: 22px; text-align: center;
}
.plan-list { margin: 12px 0; max-height: 60vh; overflow-y: auto; }
.plan-empty { color: var(--muted); font-size: 13px; padding: 20px 4px; }
.plan-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 8px;
  background: var(--panel-2);
}
.plan-item.conflict { border-color: var(--accent-2); }
.pi-titleline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.pi-title { font-weight: 600; font-size: 14px; }
.pi-titleline .orig-title { font-size: .82em; }
.pi-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pi-conflict-note { color: var(--accent-2); font-size: 11px; margin-top: 3px; }
.remove-btn {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; align-self: start;
}
.remove-btn:hover { color: var(--accent-2); }
.plan-actions { display: flex; gap: 8px; }
.plan-actions .btn { flex: 1; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .plan, .detail-card { position: static; max-height: none; overflow: visible; }
  .browse { order: -1; } /* programme first when stacked */
  .filters { position: static; }
}

/* ================= status colours ================= */
:root {
  --st-interested: #4ad07a;
  --st-watched: #5b8def;
  --st-uninterested: #ff6b6b;
  --singular-bg: #221a12;         /* singular + unmarked (warm) */
  --sg-interested: #15271b;       /* singular tints = lighter shade of the status */
  --sg-watched: #151d2b;
  --sg-uninterested: #2a1717;
  --plan-bg: #268a4c;             /* added to My Programme -> solid green box */
}
@media (prefers-color-scheme: light) {
  :root {
    --st-interested: #1f9d57;
    --st-watched: #3b6fd4;
    --st-uninterested: #e5484d;
    --singular-bg: #fbf2df;
    --sg-interested: #e6f7ec;
    --sg-watched: #e8eefb;
    --sg-uninterested: #fbe8e8;
    --plan-bg: #238a4b;
  }
}

/* screening box: clickable + status accent */
.screening { cursor: pointer; }
.screening.st-interested { box-shadow: inset 3px 0 0 var(--st-interested); }
.screening.st-watched { box-shadow: inset 3px 0 0 var(--st-watched); opacity: .62; }
.screening.st-uninterested { box-shadow: inset 3px 0 0 var(--st-uninterested); opacity: .5; }
.screening.st-watched:hover, .screening.st-uninterested:hover { opacity: .9; }

/* tags row + separate Letterboxd link */
.sc-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; }
.sc-tags .tag { margin-right: 0; }
.lb-chip {
  font-size: 11px; padding: 1px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; white-space: nowrap;
}
.lb-chip:hover { border-color: var(--accent); color: var(--accent-ink); }

/* status filter chips: coloured when active (= shown) */
.status-chip.active.st-interested { background: var(--st-interested); border-color: var(--st-interested); color: #06260f; }
.status-chip.active.st-watched { background: var(--st-watched); border-color: var(--st-watched); color: #fff; }
.status-chip.active.st-uninterested { background: var(--st-uninterested); border-color: var(--st-uninterested); color: #fff; }
.status-chip.active.st-none { background: var(--muted); border-color: var(--muted); color: var(--bg); }

/* ================= movie detail card (right column) ================= */
.detail-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.detail-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; cursor: pointer;
}
.detail-close:hover { border-color: var(--accent); }
.detail-body { padding: 16px; }
.d-head { display: block; margin-bottom: 14px; }
.d-poster { display: block; width: 172px; max-width: 62%; margin: 2px auto 16px; aspect-ratio: 2/3; border-radius: 8px; object-fit: cover; background: var(--panel-2); }
.d-poster-empty { display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--muted); border: 1px solid var(--line); }
.d-headinfo { min-width: 0; }
.d-title { margin: 0 0 2px; font-size: 20px; line-height: 1.2; }
.d-orig { font-style: italic; color: var(--muted); margin-bottom: 6px; }
.d-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.d-credit { font-size: 13px; margin-top: 3px; }
.d-credit span { color: var(--muted); margin-right: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.d-links { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.d-link { font-size: 12px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line); color: var(--text); text-decoration: none; }
.d-link:hover { border-color: var(--accent); color: var(--accent-ink); }
.d-status { display: flex; gap: 8px; margin: 2px 0 18px; }
.stbtn { flex: 1; padding: 9px 4px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font-size: 12px; cursor: pointer; transition: all .12s; }
.stbtn:hover { color: var(--text); border-color: var(--muted); }
.stbtn.st-interested.active { background: var(--st-interested); border-color: var(--st-interested); color: #06260f; }
.stbtn.st-watched.active { background: var(--st-watched); border-color: var(--st-watched); color: #fff; }
.stbtn.st-uninterested.active { background: var(--st-uninterested); border-color: var(--st-uninterested); color: #fff; }
.d-overview { line-height: 1.55; margin: 0 0 18px; }
.d-overview.muted { color: var(--muted); }
.d-shows-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-ink); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.d-show { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.d-add { background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 7px; padding: 4px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.d-add:hover { border-color: var(--accent); color: var(--accent-ink); }
.d-add.added { background: var(--accent); border-color: var(--accent); color: #241a00; }
.muted { color: var(--muted); }

/* ================= view tabs (Programme / Watchlist) ================= */
.viewtabs { display: flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tab {
  background: transparent; border: none; color: var(--muted);
  padding: 5px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: all .12s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #241a00; font-weight: 600; }

/* watchlist star highlight in the programme */
.wl-star { color: #ffc748; font-size: .9em; }
@media (prefers-color-scheme: light) { .wl-star { color: #d99400; } }
.screening.in-plan .wl-star { color: #fff; }

/* ================= watchlist view ================= */
.watchlist-view { margin-top: 4px; }
.wl-section {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent-ink); border-bottom: 1px solid var(--line);
  padding: 4px 0 8px; margin: 22px 0 10px;
}
.wl-empty { color: var(--muted); padding: 8px 2px 16px; font-size: 14px; }
.wl-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  margin-bottom: 6px; background: var(--panel); text-decoration: none; color: inherit;
}
.wl-item.wl-showing { cursor: pointer; box-shadow: inset 3px 0 0 var(--st-interested); }
.wl-item.wl-upcoming { box-shadow: inset 3px 0 0 var(--muted); }
.wl-upcoming .wl-when { color: var(--muted); }
.wl-item:hover { border-color: var(--line-hover); }
.wl-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.wl-name { font-weight: 600; font-size: 15px; }
.wl-year { color: var(--muted); font-size: 13px; }
.wl-lists { display: flex; flex-wrap: wrap; gap: 4px; }
.wl-list {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 5px; background: var(--panel-2);
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.wl-when { color: var(--accent-ink); font-size: 13px; white-space: nowrap; }

/* end time under the start time */
.sc-time { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.sc-end { font-size: 12px; font-weight: 500; color: var(--muted); }
.screening.in-plan .sc-end { color: rgba(255, 255, 255, .75); }

/* link to the screening on the cinema's own website */
.book-chip {
  font-size: 11px; padding: 1px 8px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; white-space: nowrap;
}
.book-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.screening.in-plan .book-chip { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; }

/* can't-pair-with-a-planned-movie note */
.clash-note { color: var(--accent-2); font-size: 12px; margin-top: 5px; font-weight: 500; }

/* date pills: one row unless expanded */
#dateFilters.collapsed { max-height: 30px; overflow: hidden; }
.date-toggle {
  background: transparent; border: none; color: var(--accent-ink);
  font-size: 12px; cursor: pointer; padding: 4px 2px; margin-left: 4px;
  white-space: nowrap;
}
.date-toggle:hover { text-decoration: underline; }

/* ================= repertory badges (Last chance / Rare / rating) ================= */
.rep-badge {
  display: inline-block;
  font-size: 10.5px; font-weight: 600; line-height: 1.5;
  padding: 0 7px; border-radius: 999px; margin-left: 6px;
  border: 1px solid transparent; white-space: nowrap; vertical-align: middle;
}
.rb-last { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
  background: color-mix(in srgb, var(--accent-2) 14%, transparent); }
.rb-rare { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 13%, transparent); }
.rb-rated { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 13%, transparent); }
.screening.in-plan .rep-badge { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.16); }

/* ================= banners (health warning / new-for-you) ================= */
.banner {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.banner-title { font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.banner-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.banner-x {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-size: 12px; padding: 2px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.banner-x:hover { border-color: var(--accent); color: var(--accent-ink); }

/* health warning */
.banner-warn { border-color: color-mix(in srgb, var(--accent-2) 55%, var(--line));
  background: color-mix(in srgb, var(--accent-2) 9%, transparent); }
.banner-warn .banner-title { color: var(--accent-2); }
.health-list { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text); }
.health-list li { margin: 3px 0; }

/* new for you */
.banner-new { border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.banner-new .banner-title { color: var(--accent-ink); }
.new-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.new-chip {
  font-size: 12px; padding: 4px 11px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-hover); color: var(--text);
}
.new-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
