/* ==========================================================================
   WatchRadar design system
   Design read: consumer media-discovery app - part public landing/teaser,
   part member dashboard (rankings, planner, watchlist). Cinematic dark
   theme, one locked accent color (teal-green - doubles as the "radar
   sweep" brand motif AND the savings/money color, so it always means
   something rather than being decorative), real poster imagery, restrained
   motivated motion. Dials: variance 6, motion 5, density 5.
   ========================================================================== */

:root {
  /* Neutrals - off-black/off-white, never pure #000/#fff */
  --bg: #0b0d12;
  --bg-panel: #12151c;
  --bg-card: #171b24;
  --bg-card-hover: #1c212c;
  --border: #262b38;
  --border-soft: #1c212c;
  --text: #edeff3;
  --text-dim: #98a0b3;
  --text-faint: #656d80;

  /* The ONE accent - teal-green. Used for CTAs, links, focus, active
     states, rank badges, AND savings figures. Never introduce a second
     accent hue. */
  --accent: #22d3a6;
  --accent-strong: #17b98f;
  --accent-wash: rgba(34, 211, 166, 0.12);
  --accent-text-on: #04120d;

  --danger: #ef5b5b;
  --danger-wash: rgba(239, 91, 91, 0.12);

  /* Shape consistency lock */
  --radius-card: 14px;
  --radius-input: 10px;
  --radius-pill: 999px;

  /* Motion - custom eased curves, not the weak CSS defaults */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 140ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand, .btn {
  font-family: var(--font-display);
}

a { color: var(--accent); }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 13, 18, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 64px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-blip {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-user {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-right: 4px;
}

.region-select {
  appearance: none;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 28px 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2398a0b3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color var(--dur-base) var(--ease-out);
}
.region-select:hover, .region-select:focus { border-color: var(--accent); outline: none; }

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text-on);
}
.btn-primary:hover { background: var(--accent-strong); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-faint); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 10px 14px;
}
.btn-ghost:hover { color: var(--text); }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  padding: 6px 12px;
  font-size: 0.78rem;
}
.btn-danger-ghost:hover { background: var(--danger-wash); }

.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { transform: translateY(-1px); }
}

/* ---------- layout ---------- */

.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 80px;
  min-height: 60vh;
}

.site-footer {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.75rem;
  padding: 30px 20px 50px;
}

/* ---------- hero (logged-out) ---------- */

.hero {
  padding: 56px 0 40px;
  max-width: 640px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.hero .save-word { color: var(--accent); }

.hero p {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 26px;
  max-width: 46ch;
}

.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- section headers ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 44px 0 18px;
}

.section-head h2 {
  font-size: 1.3rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.section-head .hint {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- segmented control ---------- */

.segmented {
  display: inline-flex;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.seg-btn.active { background: var(--bg-card); color: var(--text); }
.seg-btn:not(.active):hover { color: var(--text); }

.panel-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

/* ---------- card grid (rankings) ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.title-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  animation: card-in var(--dur-slow) var(--ease-out) forwards;
  animation-delay: var(--stagger, 0ms);
}

@keyframes card-in {
  to { opacity: 1; transform: translateY(0); }
}

.title-card .rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  background: rgba(11, 13, 18, 0.82);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent-wash);
}

.title-card .poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-panel);
  display: block;
}
.title-card .poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.72rem;
  text-align: center;
  padding: 10px;
}

.title-card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.title-card .title { font-size: 0.87rem; font-weight: 600; line-height: 1.28; }
.title-card .meta { font-size: 0.76rem; color: var(--text-dim); display: flex; justify-content: space-between; }
.title-card .meta .rating { color: var(--accent); font-weight: 600; }

.providers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.provider-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.66rem;
  color: var(--text-dim);
}
.provider-chip img { width: 13px; height: 13px; border-radius: 3px; }
.provider-chip.none { color: var(--text-faint); font-style: italic; }

.watch-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.75);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
/* Visual circle stays small to fit the card corner, but the tappable
   area expands to ~42px so it meets the 44px touch-target guideline
   without the icon looking oversized. */
.watch-btn::after {
  content: '';
  position: absolute;
  inset: -7px;
}
.watch-btn:hover { color: var(--accent); border-color: var(--accent-wash); }
.watch-btn:active { transform: scale(0.9); }
.watch-btn.added { color: var(--accent); border-color: var(--accent); }

/* Every card carries data-href and opens the title detail page on click -
   the cursor and hover lift are the only visual cue needed since the whole
   card (minus the watch-btn circle) is the tap target. */
.title-card[data-href] { cursor: pointer; transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out); }
.title-card[data-href]:hover { border-color: var(--border); background: var(--bg-card-hover); }
.title-card[data-href]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* skeleton loading state - matches the final card shape, not a spinner */
.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.skeleton-card .poster {
  aspect-ratio: 2 / 3;
  background: linear-gradient(100deg, var(--bg-card) 30%, var(--bg-card-hover) 50%, var(--bg-card) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-card .line {
  height: 10px;
  margin: 12px;
  border-radius: 5px;
  background: var(--bg-card-hover);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- locked teaser (logged-out gate) ---------- */

.locked-panel {
  position: relative;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  padding: 46px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(34, 211, 166, 0.08), transparent 60%),
    var(--bg-panel);
}

.locked-panel h3 {
  font-size: 1.2rem;
  margin: 0 0 8px;
}
.locked-panel p {
  color: var(--text-dim);
  max-width: 46ch;
  margin: 0 auto 20px;
  line-height: 1.5;
}

.locked-ghost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  opacity: 0.35;
  filter: blur(1px);
  margin-bottom: 26px;
  pointer-events: none;
}
.locked-ghost-grid div {
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  background: var(--bg-card-hover);
}

/* ---------- savings hero (member planner) ---------- */

.savings-hero {
  border-radius: var(--radius-card);
  border: 1px solid var(--accent-wash);
  background: linear-gradient(160deg, rgba(34, 211, 166, 0.10), var(--bg-panel) 60%);
  padding: 28px 26px;
  margin-bottom: 28px;
}

.savings-hero .eyebrow {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0 0 6px;
}

.savings-hero .amount {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0 0 12px;
}

.savings-hero .detail {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  max-width: 60ch;
}
.savings-hero .detail strong { color: var(--text); }

/* ---------- planner service cards ---------- */

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

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 16px 18px;
}
.service-card .service-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 8px;
}
.service-card h4 { margin: 0; font-size: 0.95rem; }
.service-card .price { color: var(--text-dim); font-size: 0.8rem; }

.service-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.service-tag.activate { background: var(--accent-wash); color: var(--accent); }
.service-tag.pause { background: var(--danger-wash); color: var(--danger); }
.service-tag.optional { background: var(--bg-panel); color: var(--text-faint); border: 1px solid var(--border-soft); }

.service-titles { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.service-titles li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
}
.service-titles li:first-child { border-top: none; padding-top: 0; }
.service-titles .t-meta { color: var(--text-faint); font-size: 0.7rem; white-space: nowrap; }
.service-empty { color: var(--text-faint); font-size: 0.8rem; font-style: italic; }

.month-picker-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 600;
}
.month-picker-label input[type="month"] {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-input);
  font-size: 0.84rem;
}

/* ---------- browse: predictive search ---------- */

.browse-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  max-width: 480px;
}

.search-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-input);
  font-size: 0.9rem;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.search-input::-webkit-search-cancel-button { cursor: pointer; }

.search-clear-btn {
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  max-height: 380px;
  overflow-y: auto;
  z-index: 15;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.search-dropdown.show { display: block; }

.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.search-dropdown-item:hover { background: var(--bg-card-hover); }
.search-dropdown-item img {
  width: 30px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-card);
}
.search-dropdown-thumb-placeholder {
  width: 30px;
  height: 45px;
  border-radius: 4px;
  background: var(--bg-card);
  flex-shrink: 0;
}
.search-dropdown-title { font-size: 0.86rem; color: var(--text); }
.search-dropdown-year { color: var(--text-faint); font-weight: 400; }
.search-dropdown-empty, .search-dropdown-more {
  padding: 10px 12px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ---------- browse: genre pills + pagination ---------- */

.genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.genre-pill {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 15px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out);
}
.genre-pill:hover { color: var(--text); border-color: var(--text-faint); }
.genre-pill.active { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 28px;
}
.pagination-current { color: var(--text-dim); font-size: 0.84rem; }

/* ---------- info panel (collapsible instructions) ---------- */

.info-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  margin-bottom: 22px;
}
.info-panel summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  list-style: none;
}
.info-panel summary::-webkit-details-marker { display: none; }
.info-panel summary::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  transition: transform var(--dur-base) var(--ease-out);
}
.info-panel[open] summary::before { transform: rotate(90deg); }
.info-panel ol {
  margin: 14px 0 10px;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 0.86rem;
  line-height: 1.6;
}
.info-panel ol li { margin-bottom: 4px; }
.info-panel ol strong { color: var(--text); }
.info-panel p {
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 10px 0 0;
}

/* ---------- watchlist ---------- */

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
}
.empty-state p { margin: 0 0 16px; }

/* ---------- auth forms ---------- */

.auth-shell {
  max-width: 400px;
  margin: 50px auto 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 32px 28px;
}
.auth-shell h2 { margin: 0 0 6px; font-size: 1.35rem; }
.auth-shell .sub { color: var(--text-dim); font-size: 0.86rem; margin: 0 0 24px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.field input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-input);
  font-size: 0.92rem;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.field .field-error { color: var(--danger); font-size: 0.78rem; }
.field .field-help { color: var(--text-faint); font-size: 0.78rem; }

/* ---------- consent checkbox (signup) + preference toggle (watchlist) --- */

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-field span {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}
.checkbox-field-inline {
  margin-bottom: 0;
  align-items: center;
}
.checkbox-field-inline span {
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
}

.form-msg {
  border-radius: var(--radius-input);
  padding: 10px 12px;
  font-size: 0.84rem;
  margin-bottom: 16px;
}
.form-msg.error { background: var(--danger-wash); color: var(--danger); }
.form-msg.success { background: var(--accent-wash); color: var(--accent); }

.auth-shell .recaptcha-wrap { margin-bottom: 16px; }
.auth-shell .switch { margin-top: 18px; font-size: 0.84rem; color: var(--text-dim); text-align: center; }
.auth-shell .switch a { font-weight: 600; }
.auth-shell button[type="submit"] { width: 100%; padding: 11px 20px; }

/* ---------- toast ---------- */

.toast-region {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(239, 91, 91, 0.4); color: var(--danger); }

/* ---------- status text ---------- */

.status { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 14px; min-height: 1.2em; }
.status.error { color: var(--danger); }

.caveat {
  color: var(--text-faint);
  font-size: 0.78rem;
  line-height: 1.55;
  margin-top: 26px;
  border-top: 1px solid var(--border-soft);
  padding-top: 16px;
  max-width: 80ch;
}

/* ---------- title detail page ---------- */

.detail-back { margin-bottom: 14px; }
.detail-back a {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--dur-base) var(--ease-out);
}
.detail-back a:hover { color: var(--text); }

.detail-hero {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  overflow: hidden;
  margin-bottom: 32px;
}

.detail-backdrop {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  object-fit: cover;
  object-position: center top;
  /* fades into the card body below it rather than cutting off hard, so the
     poster/info row reads as one surface with the image, not two stacked
     blocks */
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.detail-hero-body {
  display: flex;
  gap: 24px;
  padding: 20px 24px 28px;
  margin-top: -64px;
}
.detail-hero:not(:has(.detail-backdrop)) .detail-hero-body { margin-top: 0; padding-top: 24px; }

.detail-poster {
  flex-shrink: 0;
  width: 160px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-card);
  background: var(--bg-panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  position: relative;
  z-index: 1;
}
.detail-poster.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
  padding: 14px;
  border: 1px solid var(--border-soft);
}

.detail-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding-top: 68px;
}
.detail-hero:not(:has(.detail-backdrop)) .detail-info { padding-top: 4px; }

.detail-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
}
.detail-tagline { color: var(--text-faint); font-style: italic; font-size: 0.92rem; margin-top: -4px; }

.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.86rem;
}
.detail-meta-row .rating { color: var(--accent); font-weight: 600; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pill {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 600;
}

.detail-overview { color: var(--text-dim); font-size: 0.92rem; line-height: 1.6; max-width: 70ch; }
.detail-crew { font-size: 0.86rem; color: var(--text-dim); }
.detail-crew strong { color: var(--text); }

.detail-actions { margin-top: 4px; }
/* Overrides the small absolute-positioned circle from the card grid's
   .watch-btn so the same click-handling logic can render as an inline
   pill button on the detail page instead. */
.watch-btn-wide.watch-btn {
  position: static;
  width: auto;
  height: auto;
  inset: auto;
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}
.watch-btn-wide.watch-btn::after { content: none; }

.detail-providers-empty { color: var(--text-faint); font-size: 0.84rem; font-style: italic; }
.detail-providers { margin-top: 2px; }

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.cast-card { display: flex; flex-direction: column; gap: 6px; }
.cast-photo {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  display: block;
}
.cast-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text-faint);
  font-size: 0.72rem;
  text-align: center;
  padding: 8px;
}
.cast-name { font-size: 0.82rem; font-weight: 600; line-height: 1.25; }
.cast-character { font-size: 0.76rem; color: var(--text-faint); line-height: 1.25; }

@media (max-width: 640px) {
  .detail-hero-body { flex-direction: column; margin-top: 0; padding: 16px; }
  .detail-backdrop { aspect-ratio: 16 / 9; mask-image: none; -webkit-mask-image: none; }
  .detail-poster { width: 120px; }
  .detail-info { padding-top: 0; }
  .detail-title { font-size: 1.4rem; }
}

/* ---------- reduced motion: keep opacity, drop movement ---------- */

@media (prefers-reduced-motion: reduce) {
  .title-card {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
  .btn, .watch-btn, .field input, .toast {
    transition-duration: 1ms !important;
  }
  .skeleton-card .poster { animation: none; }
}

@media (max-width: 640px) {
  .site-header-inner { padding: 0 14px; }
  .app-container { padding: 0 14px 60px; }
  .hero { padding: 36px 0 28px; }
}
