/* self-hosted Public Sans (OFL, see fonts/OFL.txt): one variable file per script, 300 to 700 */
@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/public-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/public-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #14181c;
  --panel: #1b222a;
  --raised: #2c3440;
  --line: #2c3440;
  --rule: #456;
  --text: #9ab;
  --strong: #fff;
  --muted: #678;
  --green: #00e054;
  --orange: #ff8000;
  --blue: #40bcf4;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg) linear-gradient(#212b36, var(--bg) 480px) no-repeat;
  color: var(--text);
  font: 400 14px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}

main { flex: 1; width: 100%; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */

.top { background: rgba(20, 24, 28, 0.9); border-bottom: 1px solid var(--line); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 72px;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }

.dots { display: flex; }

.dots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-left: -4px;
}

.dots i:first-child { margin-left: 0; background: var(--orange); }
.dots i:nth-child(2) { background: var(--green); }
.dots i:nth-child(3) { background: var(--blue); }

.wordmark {
  margin: 0;
  color: var(--strong);
  font: 700 28px/1 var(--sans);
  letter-spacing: -0.03em;
}

.sources {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.sources::-webkit-scrollbar { display: none; }

/* Sign in lives top-right, like Letterboxd's header */

.account {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
  padding-left: 16px;
  margin-left: 8px;
  border-left: 1px solid var(--line);
}

.who {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account .link-btn { padding: 12px 8px; }

/* signed in: a small avatar instead of the email (hover shows it); the text only stays
   for "View only" */
.who:not(.is-denied) { display: none; }

.avatar:not([hidden]) {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  margin-right: 4px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--raised);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  color: var(--strong);
  font: 700 13px/1 var(--sans);
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account .link-btn:hover { color: var(--green); }

.chip {
  appearance: none;
  flex: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
  padding: 20px 8px 18px;
  cursor: pointer;
}

.chip:hover { color: var(--strong); }

.chip[aria-pressed="true"] {
  color: var(--strong);
  border-bottom-color: var(--green);
}

.chip .n {
  margin-left: 5px;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Section heading, the way Letterboxd does it: small tracked label over a rule */

.heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.lead-block { display: grid; gap: 8px; min-width: 0; }

.lb-link {
  color: var(--muted);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.lb-link:hover { color: var(--green); }

.lead {
  margin: 0;
  color: var(--strong);
  font: 300 28px/1.15 var(--sans);
  letter-spacing: -0.01em;
}

.list-meta { margin: 0; color: var(--muted); font-size: 13px; }

.progress { width: min(320px, 100%); height: 4px; background: var(--raised); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); }

.heading .btn-primary { padding: 16px 36px; font-size: 14px; letter-spacing: 0.09em; }

.count {
  margin: 0;
  color: var(--text);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

/* Filter bar: flat labels with thin rules, like Letterboxd's list page */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  border-bottom: 1px solid var(--line);
}

.filters,
.view-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }

/* Dropdowns: the open card covers its label, slate like Letterboxd's */

.dd { display: flex; align-items: center; gap: 6px; }

.dd-prefix {
  color: var(--muted);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dd-box { position: relative; }

.dd-trigger,
.dd-head {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 12px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.dd-trigger svg,
.dd-head svg {
  width: 10px;
  height: 10px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dd-trigger:hover { color: var(--strong); }
.dd-trigger.is-set { color: var(--green); }
.dd-box.is-open .dd-trigger { visibility: hidden; }

.dd-menu {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  min-width: 100%;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding-bottom: 6px;
  border-radius: 3px;
  background: #89a;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  scrollbar-width: thin;
  scrollbar-color: #567 transparent;
}

.dd-menu.is-right { left: auto; right: 0; }

.dd-head { position: sticky; top: 0; z-index: 1; background: #89a; color: var(--strong); }

.dd-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  border: 0;
  background: none;
  color: #2c3a49;
  font: 400 14px/1.2 var(--sans);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.dd-item:hover,
.dd-item:focus-visible,
.dd-item[aria-selected="true"] { color: var(--strong); outline: 0; }

.dd-rule { margin: 6px 0; border: 0; border-top: 1px solid rgba(20, 24, 28, 0.25); }

.filters .link-btn { padding: 12px 6px; font-size: 11px; }

.view-toggle { display: flex; margin-left: 8px; }

.view-toggle button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
}

.view-toggle button:hover { color: var(--strong); }
.view-toggle button[aria-pressed="true"] { color: var(--strong); background: var(--raised); }

.view-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.note { margin: 12px 0 0; color: var(--orange); font-size: 13px; }

.msg { margin: 32px 0; }

/* Posters */

.grid.is-large { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

@media (min-width: 720px) {
  .grid.is-large { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
  .grid.is-small { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}

.grid {
  list-style: none;
  margin: 0;
  padding: 16px 0 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.tile { display: block; text-decoration: none; position: relative; border-radius: 3px; }

.tile-foot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 22px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tile-foot.is-editable { cursor: pointer; }
.tile-foot.is-editable:hover { color: var(--strong); }

/* the day is a button; its calendar floats on <body> */
button.tile-foot {
  align-self: flex-end;
  margin-left: auto;
  padding: 0 6px;
  border: 0;
  border-radius: 3px;
  background: none;
  font-family: inherit;
}

button.tile-foot:hover { background: var(--raised); }

.datepicker {
  position: fixed;
  z-index: 50;
  width: 268px;
  padding: 12px;
  border-radius: 4px;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font: 400 13px/1 var(--sans);
}

.dp-head { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

.dp-nav {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--text);
  font: 400 22px/1 var(--sans);
  cursor: pointer;
}

.dp-nav:hover:not(:disabled) { background: var(--raised); color: var(--strong); }
.dp-nav:disabled { opacity: 0.3; cursor: default; }

/* the month picker is the filter-bar dropdown, in sentence case and boxed */
.dp-month { flex: 1; min-width: 0; }
.dp-month .dd,
.dp-month .dd-box { width: 100%; }

.dp-month .dd-trigger,
.dp-month .dd-head {
  justify-content: center;
  height: 30px;
  padding: 0 8px;
  border-radius: 3px;
  font: 600 13px/1 var(--sans);
  letter-spacing: 0;
  text-transform: none;
}

.dp-month .dd-trigger { border: 1px solid var(--line); background: var(--bg); color: var(--strong); }
.dp-month .dd-trigger:hover { border-color: var(--rule); }
.dp-month .dd-menu { max-height: 260px; }
.dp-month .dd-item { padding-block: 6px; font-size: 13px; text-align: center; }

.dp-weekdays,
.dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.dp-weekdays { margin: 10px 0 6px; color: var(--muted); font-size: 11px; font-weight: 600; text-align: center; }

.dp-day {
  height: 31px;
  border: 0;
  border-radius: 3px;
  background: var(--raised);
  color: var(--strong);
  font: 500 13px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.dp-day:hover:not(:disabled) { background: var(--rule); }
.dp-day.is-outside { background: none; color: var(--muted); }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--blue); }
.dp-day.is-selected { background: var(--green); color: var(--bg); font-weight: 700; }
.dp-day:disabled { background: none; color: var(--muted); opacity: 0.35; cursor: default; }

.is-list li.has-foot { display: flex; align-items: center; }
.is-list li.has-foot .tile { flex: 1; min-width: 0; padding-right: 0; }
.is-list .tile-foot { flex: none; margin: 0 76px 0 8px; }

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px transparent;
  pointer-events: none;
}

.tile:hover::after { box-shadow: inset 0 0 0 2px var(--blue); }

.grid li { position: relative; }

.caption {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 28px 8px 8px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(transparent, rgba(20, 24, 28, 0.92) 55%);
  color: var(--text);
  font: 400 11px/1.25 var(--sans);
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}

.caption strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--strong);
  font: 600 13px/1.2 var(--sans);
}

@media (hover: hover) {
  .tile:hover .caption { opacity: 1; }
}
.tile:focus-visible .caption { opacity: 1; }

/* Quick actions: one pill per poster, watched first, skip second */

.acts {
  position: absolute;
  z-index: 1;
  top: 6px;
  right: 6px;
  display: flex;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(14, 17, 20, 0.88);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
  opacity: 0.92;
  transition: opacity 0.12s;
}

.grid li:hover .acts,
.acts:focus-within { opacity: 1; }

.skip,
.mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 30px;
  padding: 0;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

.skip + .mark,
.mark + .skip { border-left: 1px solid rgba(255, 255, 255, 0.12); }

.skip svg,
.mark svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark:hover,
.mark:focus-visible { color: var(--bg); background: var(--green); }
.skip:hover,
.skip:focus-visible { color: var(--bg); background: var(--orange); }
.skip[aria-pressed="true"] { color: var(--orange); }
.mark[aria-pressed="true"] { color: var(--green); }
.skip[aria-pressed="true"]:hover,
.mark[aria-pressed="true"]:hover { color: var(--bg); }

.grid.is-small .acts { opacity: 0; }
.grid.is-small li:hover .acts,
.grid.is-small .acts:focus-within { opacity: 1; }

@media (hover: none) { .grid.is-small .acts { opacity: 0.92; } }

/* List view: one row per film */

.grid.is-list { display: block; padding-top: 0; }

.grid.is-list li { border-bottom: 1px solid var(--line); }

.is-list .tile { display: flex; align-items: center; gap: 14px; padding: 10px 84px 10px 0; border-radius: 0; }
.is-list .tile::after { display: none; }
.is-list .tile:hover .row-title { color: var(--blue); }
.is-list .poster { flex: none; width: 44px; }
.is-list .row-text { display: grid; gap: 2px; min-width: 0; }
.is-list .row-title { color: var(--strong); font: 600 15px/1.25 var(--sans); }
.is-list .row-meta { color: var(--muted); font-size: 12px; }

.is-list .acts { top: 50%; right: 8px; margin-top: -15px; opacity: 1; background: var(--raised); box-shadow: none; }

.badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  padding: 3px 8px;
  color: #14181c;
  background: var(--orange);
  border-radius: 2px;
  font: 700 10px/1.2 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

.is-list .badge { top: 50%; left: auto; right: 92px; transform: translateY(-50%); }
.grid.is-small li:hover .badge { opacity: 0; }

.is-skipped .poster { opacity: 0.3; filter: grayscale(1); }

/* the title and year sit under the image: they show while it loads, or if it never does */
.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 8px;
  border-radius: 3px;
  background: var(--raised);
  overflow: hidden;
}

.poster img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}

.poster.is-loading img { opacity: 0; }

/* list rows are too small for the title; the row already shows it */
.is-list .poster > span { display: none; }

.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

.poster-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--strong);
  font: 600 13px/1.2 var(--sans);
}

.poster-year { color: var(--text); font-size: 11px; }

/* Empty grid and the undo bar */

.empty {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 40px 0 56px;
}

.empty p { margin: 0; max-width: 46ch; color: var(--text); font-size: 15px; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  padding: 4px 4px 4px 16px;
  border-radius: 4px;
  background: var(--raised);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color: var(--strong);
  font-size: 14px;
}

.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast .link-btn { flex: none; color: var(--green); }
.toast .link-btn:hover { color: var(--strong); }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 3px;
  padding: 10px 16px;
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary { background: var(--green); color: #14181c; }
.btn-primary:hover { background: #2ee86f; }
.btn-primary:disabled { background: var(--raised); color: var(--muted); cursor: not-allowed; }

.btn-quiet { background: var(--raised); color: var(--strong); }
.btn-quiet:hover { background: #3a4552; }

.credit { padding-block: 0 24px; }
.credit p { margin: 0; color: var(--muted); font-size: 12px; }
.credit a { text-decoration: underline; text-underline-offset: 2px; }
.credit a:hover { color: var(--text); }

/* Picker */

.stage {
  width: min(100%, 880px);
  max-width: 100%;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.stage::backdrop { background: rgba(20, 24, 28, 0.88); }

/* desktop: the old CLOSE text link in a bar above the reel or card */
.stage-close {
  display: block;
  margin: 4px 8px 0 auto;
  padding: 12px 8px;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
  cursor: pointer;
}

.stage-close:hover { color: var(--strong); }
.stage-close svg { display: none; }

.link-btn {
  border: 0;
  background: none;
  color: var(--text);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
  padding: 12px 8px;
  cursor: pointer;
}

.link-btn:hover { color: var(--strong); }

.reel { --reel-cell: 110px; }
.reel-label { display: none; }

@media (min-width: 720px) {
  .reel { --reel-cell: 150px; }
}

.reel-window { position: relative; overflow: hidden; padding-block: 16px; }

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  height: 14px;
  margin-left: -1px;
  background: var(--green);
  z-index: 1;
}

.reel-window::before { top: 0; }
.reel-window::after { bottom: 0; }

.reel-strip { position: relative; display: flex; gap: 8px; width: max-content; }
.reel-strip .poster { flex: none; width: var(--reel-cell); }

/* desktop: poster on the left, titles, text and actions stacked on the right */
.result {
  display: grid;
  grid-template-columns: minmax(0, 200px) 1fr;
  grid-template-rows: auto auto 1fr;
  align-items: start;
  gap: 0 28px;
  padding: 120px 28px 32px;
}

.result-head { display: contents; }
.result-poster { grid-column: 1; grid-row: 1 / span 3; }
.result-titles,
.result-body,
.result-actions { grid-column: 2; min-width: 0; }

.result { position: relative; }

.result > * { position: relative; }

.result-backdrop {
  position: absolute !important;
  inset: 0 0 auto;
  height: 210px;
  background: center 25% / cover no-repeat;
  opacity: 0.8;
  -webkit-mask-image: linear-gradient(#000 35%, transparent);
  mask-image: linear-gradient(#000 35%, transparent);
  pointer-events: none;
}

.result-poster .poster { width: 100%; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 8px 24px rgba(0, 0, 0, 0.6); }

/* the title starts below the banner, so text always sits on the solid background */
.result-titles { padding-top: 92px; }

.chip-pill {
  display: inline-block;
  margin: 0 6px 0 0;
  padding: 4px 10px;
  color: var(--strong);
  background: var(--raised);
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

.result-providers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.result-providers strong { margin-right: 4px; }
.result-providers .chip-pill { margin: 0; }

.eyebrow {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.result h2 {
  margin: 0;
  color: var(--strong);
  font: 700 30px/1.15 var(--sans);
  letter-spacing: -0.01em;
}

.year {
  margin-left: 0.35em;
  color: var(--text);
  font: 400 15px/1 var(--sans);
  letter-spacing: 0;
  vertical-align: baseline;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 10px 0 0;
  color: var(--text);
  font-size: 13px;
}

.result-providers {
  margin: 10px 0 0;
  font-size: 13px;
}

.result-providers strong { color: var(--strong); font-weight: 600; }
.result-providers a { text-decoration: underline; text-underline-offset: 2px; }
.result-providers a:hover { color: var(--strong); }

.result-overview {
  max-width: 60ch;
  margin: 16px 0 0;
  color: #bcc7d2;
  font: 400 15px/1.6 var(--sans);
}

.result-overview.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.more { margin-top: 4px; font-size: 13px; }

.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }

/* icons are for the phone layout; desktop keeps text buttons */
.result-actions svg,
.dock svg { display: none; }

.dock { display: flex; align-items: center; }
.dock-count { display: none; }

/* Touch screens: 44px tap targets */

@media (pointer: coarse) {
  .view-toggle button { width: 44px; height: 44px; }
  .dd-trigger,
  .dd-head { padding-block: 16px; }
  .dd-item { padding-block: 12px; }
  .skip,
  .mark { width: 40px; height: 38px; }
  .is-list .acts { margin-top: -19px; }
  .is-list .tile { padding-right: 100px; }
  .is-list .badge { right: 108px; }
  .is-list .tile-foot { margin-right: 92px; }
  button.tile-foot { height: 32px; }
  .dp-day { height: 38px; }
}

/* Phones */

@media (max-width: 560px) {
  .bar { flex-wrap: wrap; min-height: 0; padding-top: 8px; }
  .account { order: 2; margin-left: auto; padding-left: 0; border-left: 0; }
  .who { max-width: 120px; }
  .sources {
    order: 3;
    width: calc(100% + 16px);
    margin: 0 -8px;
    padding-right: 28px;
    /* fade the right edge so a cut-off tab reads as "scroll for more" */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  }
  .chip { padding: 12px 8px 12px; }

  .heading { margin-top: 20px; }

  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Pick bar: docked to the bottom edge like an app's tab bar, with the pool size beside it */
  .dock {
    position: fixed;
    z-index: 10;
    left: 0;
    right: 0;
    bottom: 0;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(20, 24, 28, 0.82);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    backdrop-filter: blur(16px) saturate(1.5);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .dock-count { display: block; margin: 0; min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
  .dock-count strong { color: var(--strong); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }

  .dock svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .heading .dock .btn-primary { flex: none; gap: 10px; height: 50px; padding: 0 24px; border-radius: 4px; }

  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }

  /* The card: a full-screen sheet that scrolls, a round X that stays put, and the
     actions pinned to the bottom where a thumb reaches them */
  .stage {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .stage::backdrop { background: var(--bg); }

  .stage-close {
    position: sticky;
    z-index: 5;
    top: max(12px, env(safe-area-inset-top));
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: max(12px, env(safe-area-inset-top)) 12px -56px auto;
    padding: 0;
    border-radius: 50%;
    background: rgba(14, 17, 20, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
    color: var(--strong);
  }

  .stage-close svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  .stage-close .label,
  .icon-btn .label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Reel: centred on the screen, big posters, the edges fading out */
  .reel {
    --reel-cell: 46vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    min-height: 100%;
    padding: 72px 0 48px;
  }

  .reel-label {
    display: block;
    margin: 0;
    color: var(--muted);
    font: 600 11px/1 var(--sans);
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
  }

  .reel-window {
    padding-block: 22px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
  }

  .reel-window::before,
  .reel-window::after { height: 16px; width: 3px; margin-left: -1.5px; border-radius: 2px; }

  .reel-strip { gap: 12px; }
  .reel-strip .poster { border-radius: 6px; transition: opacity 0.35s, transform 0.35s, box-shadow 0.35s; }
  .reel-strip.is-landed .poster { opacity: 0.2; }

  .reel-strip.is-landed .poster.is-winner {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--green), 0 14px 44px rgba(0, 224, 84, 0.22);
  }

  /* Card layout: backdrop on top, poster beside the title, text, then the action bar */
  .result { display: flex; flex-direction: column; align-items: stretch; min-height: 100%; padding: 0; }
  /* the head takes all the spare height and the backdrop fills it, so a short card reads
     as a full-bleed hero with the details resting just above the action bar, not a
     block of text with a gap under it */
  .result-head {
    position: relative;
    flex: 1 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    min-height: 330px;
    padding: 150px 16px 0;
  }

  .result-backdrop {
    inset: 0;
    height: auto;
    opacity: 0.9;
    -webkit-mask-image: linear-gradient(#000 45%, rgba(0, 0, 0, 0.35) 78%, transparent);
    mask-image: linear-gradient(#000 45%, rgba(0, 0, 0, 0.35) 78%, transparent);
  }

  .result-poster,
  .result-titles { position: relative; }
  .result-poster { flex: none; width: 112px; }
  .result-titles { flex: 1; min-width: 0; padding-top: 0; }
  .result .eyebrow { margin-bottom: 8px; padding-bottom: 6px; }
  .result h2 { font-size: 24px; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }
  .result .year { font-size: 14px; }
  .result-meta { gap: 2px 12px; margin-top: 8px; }

  .result-body { padding: 4px 16px 24px; }

  .result .result-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-wrap: nowrap;
    margin-top: auto;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(20, 24, 28, 0.86);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    backdrop-filter: blur(16px) saturate(1.5);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .result-actions svg {
    display: block;
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .result-actions .btn-primary { flex: 1; gap: 10px; height: 50px; font-size: 13px; }
  .result-actions .icon-btn { position: relative; flex: none; width: 50px; height: 50px; padding: 0; }
  .icon-btn.is-done { color: var(--green); }
}

@media (prefers-reduced-motion: no-preference) {
  .result:not([hidden]) { animation: settle 0.18s ease-out; }
}

@keyframes settle {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Provider logos */

.plogo { width: 20px; height: 20px; border-radius: 4px; object-fit: cover; vertical-align: middle; }
.chip-pill:has(.plogo) { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; }
.plogos { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; vertical-align: middle; }
