/* Rewind — styles.css
   Theme follows the OS via prefers-color-scheme (no toggle). */

:root {
  color-scheme: light dark;

  --bg: #F4F5F6;
  --topbar: #E3E6EA;
  --topbar-border: #D0D5DB;
  --surface: #FFFFFF;
  --surface-2: #FAFBFC;
  --subtle: #F7F8F9;
  --border: #D5D9DE;
  --border-subtle: #EEF1F4;
  --input-bg: #FFFFFF;
  --input-border: #C3C9D0;
  --code-bg: #F4F5F6;
  --track: #D5D9DE;

  --text: #15181C;
  --text-2: #3B424B;
  --muted: #565D66;
  --placeholder: #7A818A;

  --accent: #1F5FD1;
  --accent-hover: #174AA6;
  --on-accent: #FFFFFF;
  --link: #1F5FD1;
  --link-hover: #174AA6;
  --accent-soft-bg: #E8EFFC;
  --accent-soft-fg: #1A4FB0;
  --accent-soft-border: #B9CCF3;
  --danger-soft-bg: #FDECEA;
  --danger-soft-fg: #B42318;
  --danger-soft-border: #F3C2BD;
  --success: #1E7A44;
  --star: #C2620A;
  --star-off: #9AA1AA;

  --mark-bg: #15181C;
  --mark-fg: #FFFFFF;
  --pill-bg: #FFFFFF;
  --nav-active-bg: #FFFFFF;
  --seg-bg: #E6E9ED;
  --seg-active-bg: #FFFFFF;
  --seg-active-shadow: 0 1px 2px rgba(21, 24, 28, .12);

  --radius: 6px;
  --radius-lg: 10px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1F27;
    --topbar: #141820;
    --topbar-border: #2C3340;
    --surface: #222833;
    --surface-2: #283040;
    --subtle: #283040;
    --border: #343C4A;
    --border-subtle: #2C3340;
    --input-bg: #1A1F27;
    --input-border: #454E5E;
    --code-bg: #1A1F27;
    --track: #343C4A;

    --text: #E6E9ED;
    --text-2: #C3CAD4;
    --muted: #A1AAB8;
    --placeholder: #7D8796;

    --accent: #6A9BFF;
    --accent-hover: #8DB3FF;
    --on-accent: #0B1220;
    --link: #7AA7FF;
    --link-hover: #A3C2FF;
    --accent-soft-bg: #253656;
    --accent-soft-fg: #A9C4FF;
    --accent-soft-border: #3A5486;
    --danger-soft-bg: #4A2328;
    --danger-soft-fg: #FFB4AB;
    --danger-soft-border: #7A3A40;
    --success: #4CC38A;
    --star: #F0A35E;
    --star-off: #6B7482;

    --mark-bg: #E6E9ED;
    --mark-fg: #1A1F27;
    --pill-bg: #2C3340;
    --nav-active-bg: #2C3340;
    --seg-bg: #141820;
    --seg-active-bg: #2C3340;
    --seg-active-shadow: none;
  }
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

h1, h2, p { margin: 0; }

a { color: var(--link); }
a:hover { color: var(--link-hover); }

button { font: inherit; color: inherit; }

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

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

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 10px var(--gutter);
  background: var(--topbar);
  border-bottom: 1px solid var(--topbar-border);
}

.brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}
.brand:hover { color: var(--text); }

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--mark-bg);
  color: var(--mark-fg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__pill {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--pill-bg);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.nav {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] {
  background: var(--nav-active-bg);
  color: var(--text);
  font-weight: 600;
}

.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--mark-bg);
  color: var(--mark-fg);
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Layout ---------- */

.page {
  width: 100%;
  margin: 0 auto;
  padding: 40px var(--gutter) 64px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.page--narrow { max-width: 420px; padding-top: 72px; gap: 24px; }
.page--form   { max-width: 560px; }
.page--setup  { max-width: 640px; }
.page--wide   { max-width: 1280px; padding-top: 24px; gap: 24px; }

.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
.page-head p  { font-size: 15px; line-height: 1.55; color: var(--muted); text-wrap: pretty; }

/* ---------- Setup progress ---------- */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.steps li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.steps li::before {
  content: "";
  height: 4px;
  border-radius: 2px;
  background: var(--track);
}
.steps li[aria-current="step"] { color: var(--accent); font-weight: 600; }
.steps li[aria-current="step"]::before { background: var(--accent); }
.steps li.is-done { color: var(--text); }
.steps li.is-done::before { background: var(--success); }
.steps__label { display: flex; align-items: center; gap: 6px; }
.steps li.is-done .steps__label svg { color: var(--success); }

/* ---------- Panels & forms ---------- */

.panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.panel__body { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.panel__body--inline { flex-direction: row; align-items: center; flex-wrap: wrap; }
.panel__body--inline .btn { margin-left: auto; }
.panel__foot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.panel__foot--inline { flex-direction: row; align-items: center; }
.panel__note {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.panel__title {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}

.search-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.search-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.search-card__poster {
  width: 92px;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  background: var(--track);
  object-fit: cover;
}
.search-card__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.search-card__body strong { font-size: 15px; line-height: 1.3; }
.search-card__body p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-card__body form { margin-top: auto; }
.panel > .panel__body + .panel__body { border-top: 1px solid var(--border-subtle); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 500; }
.field__hint { font-size: 13px; color: var(--muted); }

.input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* avoids iOS zoom on focus */
}
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea.input { height: auto; min-height: 140px; padding: 12px; line-height: 1.5; resize: vertical; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn--secondary { background: var(--surface); border-color: var(--input-border); color: var(--text); font-weight: 500; }
.btn--secondary:hover { color: var(--text); background: var(--subtle); }
.btn--ghost { background: transparent; color: var(--accent); padding: 0 12px; }
.btn--block { width: 100%; height: 48px; font-size: 15px; }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; }

.actions { display: flex; flex-wrap: wrap-reverse; gap: 12px; }
.actions > :first-child { flex: 1 1 160px; height: 48px; }
.actions > :last-child  { flex: 2 1 240px; height: 48px; font-size: 15px; }

/* ---------- Jellyfin setup ---------- */

.url-card { padding: 20px; gap: 12px; }
.url-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.url-card__head h2 { font-size: 15px; font-weight: 600; }
.url-card__meta { font-size: 12px; color: var(--muted); }
.url-card .btn { align-self: flex-start; }

.code-inline {
  display: block;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
}

.howto { margin: 0; padding: 0; list-style: none; counter-reset: howto; }
.howto li {
  counter-increment: howto;
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}
.howto li:first-child { border-top: 0; }
.howto li::before {
  content: counter(howto, decimal-leading-zero);
  flex: none;
  padding-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.howto__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.howto__body strong { font-weight: 600; }
.howto__body span { line-height: 1.5; color: var(--muted); }

.settings {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  font-size: 13px;
}
.settings dt { color: var(--muted); }
.settings dd { margin: 0; }

.code-block { overflow: hidden; }
.code-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.code-block__head h2 { font-size: 12px; font-weight: 500; color: var(--muted); }
.code-block pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-2);
}

/* ---------- History ---------- */

.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.history-head__left { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.history-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: var(--seg-bg);
}
.segmented a {
  min-height: 34px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
}
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="page"] {
  background: var(--seg-active-bg);
  color: var(--text);
  box-shadow: var(--seg-active-shadow);
}

.day { display: flex; flex-direction: column; gap: 12px; }
.day__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
}
.day__meta { font-size: 14px; font-weight: 400; color: var(--muted); }

.play-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 14px;
}

.play-card {
  height: 156px;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.play-card__poster {
  flex: none;
  width: 104px;
  height: 100%;
  object-fit: cover;
  background: var(--subtle);
}

.play-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 8px 14px;
}
.play-card__title {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}
.play-card__title:hover { color: var(--text); text-decoration: underline; }
.play-card__detail { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-card__detail a { color: inherit; text-decoration: none; }
.play-card__detail a:hover { color: var(--text); text-decoration: underline; }
.play-card__meta { font-size: 13px; color: var(--muted); }

.badge {
  align-self: flex-start;
  margin-top: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  font-size: 12px;
  font-weight: 500;
}

.play-card__actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.play-card__actions form { margin: 0; display: flex; }

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--subtle); color: var(--text); }

/* Stars (1–5) */
.stars { display: flex; align-items: center; margin-left: -2px; }
.stars button {
  width: 23px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--star-off);
  cursor: pointer;
}
.stars button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.stars button.is-on { color: var(--star); }
.stars button.is-on svg { fill: currentColor; }
.stars button:hover { color: var(--star); }

/* Thumbs (up/down) */
.thumbs { display: flex; gap: 6px; }
.thumbs button {
  width: 40px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.thumbs button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; }
.thumbs button[aria-pressed="true"] svg { fill: currentColor; }
.thumbs button[value="up"][aria-pressed="true"] {
  background: var(--accent-soft-bg); color: var(--accent-soft-fg); border-color: var(--accent-soft-border);
}
.thumbs button[value="down"][aria-pressed="true"] {
  background: var(--danger-soft-bg); color: var(--danger-soft-fg); border-color: var(--danger-soft-border);
}

/* Just-removed card (render in place of the card, with Undo) */
.play-card--removed {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: var(--subtle);
  text-align: center;
  color: var(--muted);
}
.play-card--removed strong { color: var(--text); font-weight: 600; }
.play-card--removed form { margin: 0; }

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--input-border);
  border-radius: var(--radius-lg);
}

.pagination { display: flex; justify-content: center; }

/* ---------- Title pages (movie / TV show) ---------- */

.page--title { max-width: 1080px; padding-top: 20px; gap: 32px; }

.back-link {
  align-self: flex-start;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
}
.back-link:hover { color: var(--text); }

.title-hero { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.title-hero__poster {
  flex: none;
  width: 200px;
  height: 300px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--subtle);
}
.title-hero__info { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.title-hero__heading { display: flex; flex-direction: column; gap: 6px; }
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.title-hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
.title-meta { color: var(--text-2); }
.title-meta a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.title-meta a:hover { color: var(--text); }
.overview { max-width: 620px; font-size: 15px; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }
.credit { color: var(--muted); }
.credit strong { color: var(--text); font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--subtle);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 13px;
}
.chip--soft { background: var(--accent-soft-bg); border-color: transparent; color: var(--accent-soft-fg); font-weight: 500; }

.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 4px; }
.rating-readout { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.hero-rating { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.hero-rating .stars button { width: 26px; height: 36px; }
.hero-rating .stars svg { width: 22px; height: 22px; }
.rating-readout__stars { display: flex; gap: 2px; color: var(--star-off); }
.rating-readout__stars svg { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.rating-readout__stars .is-on { color: var(--star); fill: currentColor; }
.rating-readout__thumb svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.rating-readout__thumb.is-up { color: var(--accent-soft-fg); }
.rating-readout__thumb.is-down { color: var(--danger-soft-fg); }

.progress { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.progress__head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.progress__head strong { font-weight: 600; }
.progress__head span { color: var(--muted); }
.progress__bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.progress__fill { height: 100%; border-radius: 3px; background: var(--success); }

.section { display: flex; flex-direction: column; gap: 12px; }
.section__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.section h2 { font-size: 18px; font-weight: 600; }

/* Movie: list of your watches */
.watch-list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.watch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 8px 10px 16px;
  border-top: 1px solid var(--border-subtle);
}
.watch-row:first-child { border-top: 0; }
.watch-row__when { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.watch-row__when strong { font-weight: 600; }
.watch-row__when span { font-size: 13px; color: var(--muted); }
.watch-row__actions { display: flex; align-items: center; gap: 8px; }
.watch-row__actions form { margin: 0; display: flex; }
.watch-row--removed { justify-content: space-between; padding: 12px 16px; background: var(--subtle); color: var(--muted); }
.watch-row--removed form { margin: 0; }

/* TV: episode cards reuse .play-card */
.play-card__status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.play-card__status.is-watched { color: var(--success); }
.play-card__still {
  flex: none;
  width: 104px;
  height: 100%;
  object-fit: cover;
  background: var(--subtle);
}
.play-card--unwatched .play-card__still { opacity: .45; filter: grayscale(1); }
.play-card__tools { display: flex; align-items: center; }
.play-card__tools form { margin: 0; display: flex; }

.btn--soft {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  background: var(--accent-soft-bg);
  border-color: var(--accent-soft-border);
  color: var(--accent-soft-fg);
}
.btn--soft:hover { color: var(--accent-soft-fg); filter: brightness(.97); }

/* Cast */
.cast-grid {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 10px;
}
.cast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.cast__photo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--subtle);
  border: 1px solid var(--border);
}
.review__text { white-space: pre-line; margin: 0; line-height: 1.6; }
.review__meta { margin: 0; font-size: 13px; color: var(--muted); }
.review__form-actions { display: flex; gap: 8px; align-items: center; }

.integration-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.integration {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.integration__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.integration__head strong { font-size: 15px; }
.integration .code-inline {
  display: block;
  padding: 10px 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
}
.integration__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.integration__actions form { display: inline-flex; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  border: 1px solid var(--accent-soft-border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.pill--muted { background: var(--subtle); color: var(--muted); border-color: var(--border); }

.cast__link { display: contents; color: inherit; text-decoration: none; }
.cast__link:hover .cast__name { text-decoration: underline; }
.cast__text { min-width: 0; display: flex; flex-direction: column; }
.cast__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast__role { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .page { padding-top: 28px; padding-bottom: 48px; gap: 22px; }
  .page--narrow { padding-top: 40px; }
  .page-head h1 { font-size: 24px; }
  .panel__body { padding: 20px 16px; }
  .panel__foot, .panel__note { padding-left: 16px; padding-right: 16px; }
  .url-card { padding: 16px; }
  .howto li { padding: 14px 16px; }
  .code-block pre { padding: 14px 16px; }
  .history-head .btn--primary { width: 100%; }
  .history-head__left { width: 100%; justify-content: space-between; }
}

@media (max-width: 400px) {
  .topbar { gap: 10px; }
  .brand span:last-child { display: none; } /* keep only the mark */
  .play-card { height: 144px; }
  .play-card__poster { width: 88px; }
  .play-card__body { padding-left: 12px; }
}

@media (max-width: 640px) {
  .page--title { padding-top: 12px; gap: 26px; }
  .title-hero { gap: 18px; }
  .title-hero__poster { width: 120px; height: 180px; }
  .title-hero__info { flex-basis: 100%; }
  .title-hero h1 { font-size: 28px; }
  .hero-actions .btn--primary { width: 100%; }
}

@media (max-width: 400px) {
  .play-card__still { width: 88px; }
}

/* Bigger tap targets on touch screens */
@media (pointer: coarse) {
  .stars button { width: 30px; height: 40px; }
  .btn--soft { min-height: 40px; }
  .icon-btn, .thumbs button { height: 40px; }
}
