:root {
  --accent: #2976f3;
  --accent-ink: #ffffff;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #14171c;
  --muted: #5d6573;
  --border: #dde2ea;
  --focus: color-mix(in srgb, var(--accent) 35%, transparent);
  --rt: #fa320a;
  --imdb: #f5c518;
  --rotten: #3fa142;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 8%);
  --gutter: 16px;

  /* Motion tokens: strong custom curves (built-in CSS easings are too weak). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --press: 160ms;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5b97f7;
    --accent-ink: #0b1220;
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #20242d;
    --text: #e9ecf1;
    --muted: #9aa3b2;
    --border: #2a2f3a;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; /* every control below has its own :active */
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }
img { display: block; max-width: 100%; }

/* Controls: no double-tap delay, no long-press text selection or callout. Content stays selectable. */
button, select, a.score, a.chip, .watch__link, .result, .brand {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(var(--gutter), env(safe-area-inset-right)) 12px max(var(--gutter), env(safe-area-inset-left));
  padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

/* The brand never gives up space; the country pill shrinks (ellipsis) to fit beside it. */
.topbar__lead {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

/* iOS-style back: top-leading, chevron in the accent color, like a navigation bar. */
.back {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 36px; height: 36px;
  margin-left: -4px; /* optical: the chevron, not the circle, lines up with the gutter */
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: transform var(--press) var(--ease-out), opacity 180ms var(--ease-out), border-color 150ms ease;

  @starting-style {
    opacity: 0;
    transform: translateX(-4px);
  }
}

.back[hidden] { display: none; }
.back::before { content: ""; position: absolute; inset: -5px; } /* 46px tap target around a 36px circle */
.back svg { width: 22px; height: 22px; fill: currentColor; }
.back:active { transform: scale(0.92); }

.brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

/* Phones: with Back showing, the bar keeps the logo and drops the wordmark, so nothing collides. */
@media (max-width: 479px) {
  .topbar:has(.back:not([hidden])) .brand__name { display: none; }
}

.brand__mark {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: url("/icon.svg") center / 100% no-repeat;
}

.country {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 96px; /* flag + a few letters: still recognizably the country picker */
  max-width: 52vw;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.country__flag {
  flex-shrink: 0;
  width: 20px; height: 15px;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border); /* keeps white-edged flags (JP, PL) from melting into the pill */
}

.country select {
  width: 100%;
  min-width: 0;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px; /* under 16px, iOS Safari zooms the page on focus */
  text-overflow: ellipsis;
}

.country select:focus { outline: none; }
.country:focus-within { box-shadow: 0 0 0 3px var(--focus); }

/* Layout */
.wrap {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 20px max(var(--gutter), env(safe-area-inset-right)) 32px max(var(--gutter), env(safe-area-inset-left));
}

/* Search */
.search { position: relative; }

.search__box { position: relative; }

.search__icon {
  position: absolute;
  left: 16px; top: 50%;
  width: 20px; height: 20px;
  transform: translateY(-50%);
  fill: var(--muted);
  pointer-events: none;
}

#q {
  width: 100%;
  padding: 15px 48px 15px 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  box-shadow: var(--shadow);
  -webkit-appearance: none;
  appearance: none;
}

#q::placeholder { color: var(--muted); }
#q:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus), var(--shadow); }
#q::-webkit-search-cancel-button { display: none; }

.spinner {
  position: absolute;
  right: 16px; top: 50%;
  width: 20px; height: 20px;
  margin-top: -10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 150ms ease;
}

/* A fast spinner reads as a fast app. */
.is-loading .spinner { opacity: 1; animation: spin 600ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* The results list opens as you type (keyboard, many times a day): no animation, on purpose. */
.results {
  list-style: none;
  margin: 8px 0 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain; /* don't drag the page when the list hits its end */
}

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform var(--press) var(--ease-out);
}

.result[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.result:active { background: var(--surface-2); transform: scale(0.98); }

.thumb {
  flex-shrink: 0;
  width: 40px; height: 60px;
  border-radius: 6px;
  background: var(--surface-2);
  object-fit: cover;
}

.result__text { min-width: 0; }

/* Titles identify the item: wrap to two lines, full text in the title tooltip. */
.result__title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.result__meta { margin-top: 2px; color: var(--muted); font-size: 14px; }

.tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.status { min-height: 1.5em; margin: 10px 4px 0; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.is-error { color: #d93025; }

.intro { margin-top: 16px; }
.intro__hint { margin: 0 4px; color: var(--muted); font-size: 15px; }

/* Home filters: type toggle, then genre chips (a swipeable row on phones, wrapped on wider screens) */
.filters { display: grid; gap: 12px; margin-top: 16px; }

.segmented {
  display: inline-flex;
  justify-self: start;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.segmented button {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform var(--press) var(--ease-out);
}

.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.segmented button:active { transform: scale(0.96); }

.genres {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 2px var(--gutter) 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  list-style: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}

.genres::-webkit-scrollbar { display: none; }
.genres > li { flex: none; }

.genre {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--press) var(--ease-out), border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.genre:active { transform: scale(0.96); }

.genre[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent);
}

/* The picked genre shows an ×: tapping it again clears it. */
.genre[aria-pressed="true"]::after { content: "✕"; font-size: 10px; font-weight: 700; }

/* Genre grid: same cards as the rails, wrapped */
.browse { margin-top: 28px; }
.browse__title { margin: 0 4px 12px; font-size: 17px; line-height: 1.3; letter-spacing: -0.01em; }
.browse .empty { margin: 0 4px; }

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

.grid > li { min-width: 0; }

.more {
  display: block;
  margin: 24px auto 0;
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--press) var(--ease-out), border-color 150ms ease, opacity 150ms ease;
}

.more:active { transform: scale(0.97); }
.more[aria-disabled="true"] { opacity: .5; cursor: progress; }

/* Home rails: native horizontal scroll with snap; arrow buttons only for mouse users */
.rails:empty { display: none; }
/* Country change: the old rails stay up, dimmed, until the new ones land. */
.rails[aria-busy="true"] .rail:not([aria-hidden]) { opacity: .5; }
.rail { margin-top: 28px; --card-w: 128px; transition: opacity 150ms ease; }

.rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 8px;
}

.rail__title { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: -0.01em; }

.rail__nav { display: flex; flex: none; gap: 6px; }
.rail__nav[hidden] { display: none; }

.rail__btn {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--press) var(--ease-out), border-color 150ms ease, opacity 150ms ease;
}

.rail__btn svg { width: 18px; height: 18px; fill: currentColor; }
.rail__btn:disabled { opacity: .35; cursor: default; }
.rail__btn:not(:disabled):active { transform: scale(0.92); }

/* Touch users swipe; the arrows are for mouse and keyboard. */
@media (hover: none) {
  .rail__nav { display: none; }
}

/* The track bleeds into the gutter so cards slide out to the screen edge on phones. */
.rail__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--card-w);
  gap: 12px;
  margin: 0 calc(-1 * var(--gutter));
  padding: 6px var(--gutter) 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain; /* no browser back-swipe at the ends */
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  list-style: none;
  /* Soft edges where cards slide out of view */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent);
}

.rail__track::-webkit-scrollbar { display: none; }
.rail__track > li { scroll-snap-align: start; min-width: 0; }

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.card__poster {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  background: var(--surface-2);
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
  transition: transform 200ms var(--ease-out), box-shadow 200ms ease;
}

.card__poster--empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 40px;
  font-weight: 700;
}

.card:active .card__poster { transform: scale(0.97); transition-duration: var(--press); }

.card__title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.card__meta { margin-top: -6px; color: var(--muted); font-size: 13px; }
.skeleton.card__poster { box-shadow: none; }

/* Detail */
.detail {
  scroll-margin-top: 80px;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Narrow phones: poster + title side by side, ratings full width underneath. */
.detail__head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-areas:
    "poster info"
    "ratings ratings";
  gap: 16px;
  align-items: start;
}

.detail__head > .poster { grid-area: poster; }
.detail__info { grid-area: info; min-width: 0; }
.detail__ratings { grid-area: ratings; min-width: 0; }

.poster {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  background: var(--surface-2);
  object-fit: cover;
}

.poster--empty {
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='1.5'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Cpath d='M3 9h18M8 4v5M16 4v5'/%3E%3C/svg%3E") center / 32% no-repeat;
}

.detail__title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere; /* only breaks a word when nothing else fits */
}

.detail__meta { margin: 4px 0 0; color: var(--muted); font-size: 15px; }

.score {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
  transition: transform var(--press) var(--ease-out), border-color 150ms ease;
}

a.score:active { transform: scale(0.97); }

.score__value {
  display: flex;
  flex-shrink: 0;
  align-items: baseline;
  justify-content: center;
  line-height: 64px;
  min-width: 72px; /* fits "100%" and "10.0/10" */
  height: 64px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.score__value small { font-size: 13px; font-weight: 700; opacity: .8; }

.score--rt_audience .score__value { background: var(--rt); color: #fff; }
.score--imdb .score__value { background: var(--imdb); color: #000; }
.score--none .score__value { background: var(--border); color: var(--muted); }

.score__label { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.score__source { font-weight: 700; }
.score__kind { color: var(--muted); font-size: 14px; }

.also {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  transition: transform var(--press) var(--ease-out), border-color 150ms ease;
}

a.chip:active { transform: scale(0.97); }

.chip::before {
  content: "";
  flex-shrink: 0;
  align-self: center;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.chip--fresh::before { background: var(--rt); }
.chip--rotten::before { background: var(--rotten); }
.chip--imdb::before { background: var(--imdb); }
.chip--rt_audience::before { background: var(--rt); }

.chip__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.chip__label { color: var(--muted); }

.overview {
  margin: 16px 0 0;
  color: var(--text);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.watch {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  transition: opacity 150ms ease;
}

/* Country change: state indication on the part being replaced, title stays put. */
.watch[aria-busy="true"] { opacity: .5; }

.watch__title { margin: 0 0 12px; font-size: 17px; line-height: 1.3; }

.group + .group { margin-top: 14px; }
.group__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.providers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.provider { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; text-align: center; }

.provider__logo {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border);
}

.provider__logo--empty {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

/* Long channel names ("Qello Concerts by Stingray Amazon Channel"): two lines, full name on hover. */
.provider__name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.empty { margin: 0; color: var(--muted); }

.watch__link {
  display: inline-block;
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--press) var(--ease-out);
}

.watch__link:active { transform: scale(0.97); }

.retry { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Detail entrance: bridges the skeleton -> content swap. Opacity-led, 4px, short stagger. */
.reveal {
  transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 40ms);
}

@starting-style {
  .reveal { opacity: 0; transform: translateY(4px); }
}

.detail[data-instant] .reveal { transition: none; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 8px; }
.sk-line { height: 18px; margin-bottom: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Hover only where hover is real; taps on touch screens would leave it stuck. */
@media (hover: hover) and (pointer: fine) {
  .result:hover { background: var(--surface-2); }
  a.score:hover, a.chip:hover { border-color: var(--accent); }
  .watch__link:hover, .retry:hover { text-decoration: underline; }
  .rail__btn:not(:disabled):hover, .back:hover { border-color: var(--accent); color: var(--accent); }
  .card:hover .card__poster { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
  .card:hover .card__title { color: var(--accent); }
  .genre:hover, .more:not([aria-disabled="true"]):hover { border-color: var(--accent); }
  .segmented button[aria-pressed="false"]:hover { color: var(--text); }
}

@media (min-width: 480px) {
  .detail__head {
    grid-template-columns: 140px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "poster info"
      "poster ratings";
    row-gap: 14px;
  }
  .detail__title { font-size: 24px; }
}

@media (min-width: 640px) {
  .wrap { padding-top: 32px; }
  .detail { padding: 24px; }
  .detail__head { grid-template-columns: 200px minmax(0, 1fr); column-gap: 24px; }
  .detail__title { font-size: 30px; }
  .country { max-width: 320px; }
  .rail { --card-w: 148px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  /* Room to show every genre at once: wrap instead of a sideways scroll a mouse can't easily do. */
  .genres { flex-wrap: wrap; margin: 0; padding: 2px 0; overflow: visible; -webkit-mask-image: none; mask-image: none; }
}

/* Reduced motion: fewer and gentler, not zero. Keep fades, drop movement. */
@media (prefers-reduced-motion: reduce) {
  .reveal { transition-property: opacity; transition-delay: 0ms; }
  @starting-style { .reveal { transform: none; } }
  .result, a.score, a.chip, .watch__link { transition: none; }
  .result:active, a.score:active, a.chip:active, .watch__link:active { transform: none; }
  .card__poster, .rail__btn, .back { transition-property: box-shadow, border-color, opacity; }
  .card:active .card__poster, .card:hover .card__poster, .rail__btn:not(:disabled):active, .back:active { transform: none; }
  .segmented button:active, .genre:active, .more:active { transform: none; }
  .back { @starting-style { transform: none; } }
  .is-loading .spinner { animation: pulse 1s ease-in-out infinite alternate; }
  .skeleton { animation: none; }
}

@keyframes pulse { from { opacity: 1; } to { opacity: .35; } }

/* Dev-only data toggle (break-ui). Plain chrome, not part of the design under test. */
.dev-toggle {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: #e5e7eb;
  font: 13px/1 system-ui, sans-serif;
  transform: translateX(-50%);
  box-shadow: 0 2px 10px rgb(0 0 0 / 20%);
}

.dev-toggle button {
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #374151;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.dev-toggle button[aria-pressed="true"] { background: #fff; color: #111827; font-weight: 600; }

/* Footer */
/* One quiet credits line; the required TMDB notice lives in the About popover. */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  padding: 16px max(var(--gutter), env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.footer a, .footer__about { color: var(--muted); text-decoration: none; }
.footer__tmdb img { height: 11px; width: auto; }

.footer__about {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.credits {
  inset: auto max(var(--gutter), env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left));
  max-width: 340px;
  margin: 0 auto;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.45;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);

  @starting-style {
    opacity: 0;
    transform: translateY(4px);
  }
}

.credits p { margin: 0; }
.credits p + p { margin-top: 6px; }

@media (hover: hover) and (pointer: fine) {
  .footer a:hover, .footer__about:hover { color: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  .credits { transition-property: opacity; }
  .credits { @starting-style { transform: none; } }
}
