/* ---------- Fonts (self-hosted Inter, SIL OFL 1.1 — see fonts/OFL.txt) ---------- */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  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-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  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;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-raised: #0e1118;
  --surface: #141823;
  --surface-2: #1b202d;
  --surface-3: #252b3a;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --text: #f3f5f9;
  --text-2: #c4cbd7;
  --muted: #8b95a6;
  --accent: #ff4f5e;
  --accent-2: #ff9a5b;
  --accent-soft: rgba(255, 79, 94, 0.14);
  --accent-line: rgba(255, 79, 94, 0.45);
  --gold: #ffc94d;
  --green: #3ddc97;
  --link: #8ec1ff;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.6);
  --font: "Inter Variable", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --page-pad: clamp(16px, 4vw, 40px);
  --max: 1360px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 12% -12%, rgba(255, 79, 94, 0.13), transparent 62%),
    radial-gradient(900px 520px at 100% -8%, rgba(142, 193, 255, 0.09), transparent 58%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Shared controls ---------- */
.text-btn {
  white-space: nowrap;
  border: 0;
  background: none;
  padding: 6px 4px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 6px;
}

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

.round-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}

.round-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.pill:hover {
  border-color: var(--line-2);
  color: var(--text);
}

.pill svg {
  width: 16px;
  height: 16px;
}

.pill[aria-pressed="true"],
.pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #ffdfe2;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.pill[aria-pressed="true"] .pill-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.2);
}

.pill-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  line-height: 20px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #ff6b57);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 79, 94, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff606d, #ff7b62);
}

.btn-icon {
  width: 42px;
  padding: 0;
}

.btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #ffdfe2;
}

.btn[aria-pressed="true"] svg.fillable {
  fill: currentColor;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 11, 16, 0.78);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px var(--page-pad);
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 6px 18px rgba(255, 79, 94, 0.35);
}

.brand-name,
.footer-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-name span,
.footer-name span {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.private-tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-left: -8px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 201, 77, 0.45);
  background: rgba(255, 201, 77, 0.12);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.phone-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  margin-left: -10px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
}

.phone-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.phone-btn svg {
  width: 16px;
  height: 16px;
}

.phone-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

.phone-dialog::backdrop {
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.phone-inner {
  position: relative;
  padding: 26px 28px 24px;
}

.phone-inner h2 {
  margin: 0 48px 6px 0;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.phone-inner > p {
  margin: 0;
  color: var(--text-2);
}

.phone-close {
  position: absolute;
  top: 0;
  right: 0;
}

.phone-codes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
  margin: 22px 0 18px;
}

.phone-code {
  flex: 1 1 240px;
  max-width: 300px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.phone-code img {
  width: 200px;
  height: 200px;
  border-radius: 14px;
  background: #fff;
}

.phone-code figcaption {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  color: var(--muted);
}

.phone-code strong {
  color: var(--text);
  font-size: 14.5px;
}

.phone-code code {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

body:has(.phone-dialog[open]) {
  overflow: hidden;
}

.search {
  position: relative;
  flex: 1;
  min-width: 0; /* shrink to fit narrow phones (360px and less) */
  max-width: 620px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 44px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--surface-2);
}

.search-icon {
  margin-left: 16px;
  color: var(--muted);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 12px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
}

.search input::placeholder {
  color: var(--muted);
}

.search-hint {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font: 600 12px var(--font);
}

.search:focus-within .search-hint {
  display: none;
}

.search-submit {
  height: 34px;
  margin-right: 5px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  font-weight: 700;
}

.search-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.list-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.list-btn:hover {
  background: var(--surface-2);
}

.list-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.list-btn[aria-pressed="true"] svg {
  fill: currentColor;
}

.list-btn .count {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
}

.list-btn .count.has-items {
  background: var(--accent);
  color: #fff;
}

/* ---------- Page ---------- */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--page-pad) 40px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px rgba(61, 220, 151, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(61, 220, 151, 0);
  }
}

/* ---------- Just landed rail ---------- */
.landed {
  margin-bottom: 34px;
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 158px;
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding: 6px 2px 14px;
  margin: -6px -2px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}

.rail .card-item {
  scroll-snap-align: start;
}

/* ---------- Controls ---------- */
.controls {
  position: relative;
  z-index: 20;
  margin-bottom: 18px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.segmented label:hover span {
  color: var(--text);
}

.segmented input:checked + span {
  background: var(--text);
  color: var(--bg);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.sort-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.sort select,
.field select,
.field input {
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.sort select,
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 36px 0 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

.sort select:hover,
.field select:hover,
.field input:hover {
  border-color: var(--line-2);
}

/* Dropdowns (genres, services) */
.dd {
  position: relative;
}

.dd-toggle .caret {
  width: 16px;
  height: 16px;
  color: var(--muted);
  transition: transform 0.2s;
}

.dd.open .dd-toggle .caret {
  transform: rotate(180deg);
}

.dd-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: 260px;
  max-height: min(420px, 60vh);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.16s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.dd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.dd-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.dd-list {
  overflow-y: auto;
  padding: 6px;
}

.dd-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
}

.dd-option:hover {
  background: var(--surface-2);
}

.dd-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.dd-option .dd-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* More filters */
.more-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) minmax(200px, 1.6fr);
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: pop 0.16s var(--ease);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field select,
.field input {
  width: 100%;
  background-color: var(--surface-2);
}

.field input {
  padding: 0 14px;
  border-radius: 12px;
}

.field input::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

/* ---------- Results bar ---------- */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-height: 34px;
  margin-bottom: 18px;
}

.results-bar:focus {
  outline: none;
}

.results-count {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

.results-count strong {
  color: var(--text);
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

.chip svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.results-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 28px 18px;
}

.card-item {
  position: relative;
  min-width: 0;
}

.card {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  border-radius: var(--radius);
}

.card:focus-visible {
  outline: none;
}

.poster {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), var(--shadow);
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.poster img {
  position: relative; /* paints above the title fallback underneath */
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), filter 0.3s;
}

.poster::after {
  content: "";
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(to top, rgba(6, 8, 12, 0.85), transparent);
  pointer-events: none;
}

.card:hover .poster,
.card:focus-visible .poster {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 44px rgba(0, 0, 0, 0.6);
}

.card:hover .poster img {
  transform: scale(1.04);
}

.card:focus-visible .poster {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.poster-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.poster-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 46px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.poster-bottom {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(8, 10, 15, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge-rating {
  color: var(--gold);
}

/* Private copy: every rating names its source; TMDB's stands in where IMDb has none. */
.badge-rating.from-tmdb {
  color: var(--text-2);
}

.badge-src {
  margin-left: 1px;
  opacity: 0.78;
  font-size: 10px;
  font-weight: 600;
}

.star {
  fill: currentColor;
  stroke: none;
}

.badge-new {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.06em;
}

.badge-online .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.badge-soon {
  color: #b9d9ff;
}

.badge-seen {
  color: #d9ffe9;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 2px 0;
}

.card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s, transform 0.18s;
}

.card-item:hover .card-actions,
.card-item:focus-within .card-actions,
.card-actions:has([aria-pressed="true"]) {
  opacity: 1;
  transform: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 10, 15, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  transition: background 0.15s, transform 0.15s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: rgba(30, 34, 46, 0.92);
  transform: scale(1.06);
}

.icon-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: transparent;
}

.icon-btn[aria-pressed="true"] svg.fillable {
  fill: currentColor;
}

.card-item.is-seen .poster img {
  filter: grayscale(0.7) brightness(0.55);
}

.card-item.is-seen .card-title {
  color: var(--text-2);
}

.card-item.is-leaving {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.2s, transform 0.2s;
}

/* Skeletons */
.skeleton .poster,
.skeleton .sk-line {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  box-shadow: none;
}

.skeleton .poster::after {
  display: none;
}

.sk-line {
  height: 12px;
  margin-top: 12px;
  border-radius: 6px;
}

.sk-line.short {
  width: 55%;
  margin-top: 8px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.sentinel {
  height: 1px;
}

/* ---------- Empty / error states ---------- */
.state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 56px 16px;
  border-radius: var(--radius-xl);
  border: 1px dashed var(--line-2);
  color: var(--text-2);
  text-align: center;
}

.state h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.state p {
  margin: 0;
  max-width: 460px;
}

.state .btn {
  margin-top: 10px;
}

.state.error h3 {
  color: #ff9aa4;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  background: rgba(9, 11, 16, 0.6);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px var(--page-pad) 44px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr);
  gap: 24px 48px;
  color: var(--muted);
  font-size: 13px;
}

.footer p {
  margin: 0 0 8px;
}

.footer-name {
  margin-bottom: 10px !important;
  color: var(--text);
}

.footer-meta {
  opacity: 0.85;
}

.footer-credits p {
  max-width: 720px;
}

.footer a {
  color: var(--text-2);
}

.tmdb-link {
  display: inline-block;
  margin-bottom: 12px;
}

.tmdb-logo {
  height: 12px;
  width: auto;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 6, 10, 0.74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.18s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  position: relative;
  width: min(940px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-2);
  background: var(--bg-raised);
  box-shadow: var(--shadow-lg);
  animation: rise 0.24s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

/* Zero-height sticky bar: the close button stays visible while the modal scrolls. */
.modal-top {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 0;
  display: flex;
  justify-content: flex-end;
}

.modal-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  margin: 14px 14px 0 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 10, 15, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
}

.modal-close:hover {
  background: rgba(30, 34, 46, 0.95);
}

.m-hero {
  position: relative;
  height: clamp(200px, 36vw, 360px);
  background: linear-gradient(135deg, #1d2231, #2a1820);
}

.m-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg-raised) 2%, rgba(14, 17, 24, 0.55) 45%, rgba(14, 17, 24, 0.1) 80%),
    linear-gradient(to right, rgba(14, 17, 24, 0.5), transparent 60%);
}

.m-body {
  position: relative;
  padding: 0 32px 32px;
  margin-top: -120px;
}

.m-head {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 26px;
  align-items: end;
}

.m-poster {
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.m-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-kicker {
  margin: 0 0 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.m-title {
  margin: 0;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.m-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fact {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.fact svg {
  width: 14px;
  height: 14px;
}

.fact-rating {
  color: var(--gold);
}

.fact-rating small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.fact-imdb {
  border-color: rgba(255, 201, 77, 0.4);
  background: rgba(255, 201, 77, 0.1);
}

.fact-secondary {
  color: var(--text-2);
}

.m-credit {
  margin-top: 18px;
}

.fact-online {
  color: #c8f7e1;
  border-color: rgba(61, 220, 151, 0.35);
  background: rgba(61, 220, 151, 0.1);
}

.fact-online .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.fact-soon {
  color: #cfe4ff;
}

.m-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.m-overview {
  margin: 24px 0 0;
  max-width: 760px;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.7;
}

.m-section {
  margin-top: 26px;
}

.m-section h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.providers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.provider {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
}

.source-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.source-note a {
  color: var(--text-2);
}

.m-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}

.m-details div {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
}

.m-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.m-details dd {
  margin: 2px 0 0;
  font-size: 14.5px;
  font-weight: 650;
}

.m-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.m-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 600;
  text-decoration: none;
}

.m-links a:hover {
  color: var(--text);
}

.m-links svg {
  width: 15px;
  height: 15px;
}

.m-loading {
  display: grid;
  place-items: center;
  min-height: 320px;
}

body.modal-open {
  overflow: hidden;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 150;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ---------- Responsive ---------- */
@media (hover: none) {
  .card-actions {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 980px) {
  .more-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field-wide {
    grid-column: 1 / -1;
  }

  .sort {
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    height: 42px;
  }

  .search-hint {
    display: none;
  }

  .phone-btn {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .phone-btn-label {
    display: none;
  }

  .list-btn {
    margin-left: auto;
    height: 38px;
  }

  .page {
    padding-top: 20px;
  }

  .controls-row {
    gap: 8px;
  }

  .segmented {
    width: 100%;
  }

  /* One sideways-scrolling row of filter pills (their panels are fixed bottom sheets). */
  .filter-pills {
    flex-wrap: nowrap;
    width: calc(100% + 2 * var(--page-pad));
    margin: 0 calc(-1 * var(--page-pad));
    padding: 2px var(--page-pad);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .filter-pills > * {
    flex: none;
  }

  .section-head {
    align-items: flex-start;
  }

  .segmented label {
    flex: 1;
  }

  .segmented span {
    text-align: center;
    padding: 7px 6px;
  }

  .sort {
    flex: 1 1 100%;
  }

  .sort select {
    flex: 1;
  }

  /* Dropdowns become bottom sheets over a dimmed page (the controls bar stays above it) */
  body.dd-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 15;
    background: rgba(4, 6, 10, 0.6);
    animation: fade 0.18s ease;
  }

  .dd-panel {
    position: fixed;
    top: auto;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    max-height: 62vh;
    animation: sheet 0.22s var(--ease);
  }

  @keyframes sheet {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
  }

  .results-actions {
    margin-left: 0;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
    gap: 22px 14px;
  }

  .rail {
    grid-auto-columns: 136px;
    gap: 12px;
  }

  .section-head h2 {
    font-size: 19px;
  }

  .round-btn {
    display: none;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    place-items: stretch;
  }

  .modal {
    width: 100%;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border: 0;
  }

  .m-body {
    padding: 0 18px 28px;
    margin-top: -86px;
  }

  .m-head {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 16px;
  }

  .m-actions {
    margin-top: 20px;
  }

  .m-actions .btn {
    flex: 1 1 auto;
  }

  .m-actions .btn-icon {
    flex: 0 0 42px;
  }
}

/* A computer window this narrow has no room for it; the terminal shows the phone link too. */
@media (max-width: 480px) {
  .phone-btn {
    display: none;
  }
}

@media (max-width: 380px) {
  .list-btn-label {
    display: none;
  }

  .private-tag {
    padding: 0 7px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
