/* ============================================================
   Search result detail modal (media card v3)
   Stella v4 tokens via --sh-* / --srm-*. Geometry: the "Card layout" block
   at the end (960x600 desktop card, full-width phone sheet).
   ============================================================ */

/* Reserve the scrollbar track at all times so locking scroll for the modal
   cannot reflow the page under a morph that already measured its rects. */
:root {
  scrollbar-gutter: stable;
}

body.srm-modal-open {
  overflow: hidden;
}

.srm-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 24px);
  padding-top: max(clamp(10px, 2.5vw, 24px), env(safe-area-inset-top, 0px));
  padding-bottom: max(clamp(10px, 2.5vw, 24px), env(safe-area-inset-bottom, 0px));
}

.srm-modal[hidden] {
  display: none !important;
}

/* No backdrop-filter: Chrome on macOS composites a blur over the grayscale
   (filtered) hero posters with shifting colour and flicker while layers
   change. A slightly darker plain scrim reads the same and is stable. */
.srm-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--sh-header-deep, #260613) 58%, transparent);
  opacity: 1;
  /* Never transition / animate opacity here: Chrome on macOS shifts page
     colours while a full-screen translucent layer fades by opacity. JS fades
     it by background-color instead (fadeScrim in search-result-modal.js). */
}

html[data-theme="dark"] .srm-backdrop {
  background: rgba(0, 0, 0, 0.74);
}

/* Dialog shell: flex column; fixed v3 geometry set with --srm-* below */
.srm-dialog {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
  background: var(--sh-card-fill, #fff);
  border: 0;
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--sh-on-surface, #333) 6%, transparent),
    0 28px 64px color-mix(in srgb, var(--sh-header-deep, #260613) 34%, transparent);
  color: var(--sh-on-surface, #333);
  font-family: var(--sh-font-ui, Inter, system-ui, sans-serif);
  opacity: 1;
  transform-origin: center;
}

/* Morph in flight: the real dialog holds its final geometry but stays
   unpainted, so the flying surface is the only thing on screen. */
.srm-modal.srm-morphing .srm-dialog {
  visibility: hidden;
  pointer-events: none;
}

/* The flight starts a few frames after the modal unhides (fonts.ready +
   rAF). Hold the backdrop clear until the morph animates it in from 0, or it
   paints fully dark for those frames and then snaps back: a visible flash. */
.srm-modal.srm-morphing .srm-backdrop {
  opacity: 0;
}

.srm-origin-hidden {
  visibility: hidden !important;
}

/* ── Shared element morph layer ─────────────────────────────── */

.srm-morph-layer {
  position: fixed;
  inset: 0;
  z-index: 215;
  pointer-events: none;
}

/* Must match .srm-backdrop exactly (same colour, no blur) so the close
   flight hands over without a step. */
.srm-morph-scrim {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--sh-header-deep, #260613) 58%, transparent);
}

html[data-theme="dark"] .srm-morph-scrim {
  background: rgba(0, 0, 0, 0.74);
}

.srm-morph-group {
  position: absolute;
  inset: 0;
}

/* Surface only: fill, edge and shadow. This is the one element that takes a
   per-axis scale, and it carries no artwork, so nothing can distort. */
.srm-morph-plate {
  position: absolute;
  margin: 0;
  transform-origin: 0 0;
  background: var(--sh-card-fill, #fffaf3);
  border: 0;
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--sh-on-surface, #333) 6%, transparent),
    0 24px 56px color-mix(in srgb, var(--sh-header-deep, #260613) 30%, transparent);
  will-change: transform;
}

html[data-theme="dark"] .srm-morph-plate {
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.25),
    0 24px 56px rgba(0, 0, 0, 0.55);
}

/* The window the faces are seen through. Clipping in viewport space is what
   lets the surface change shape while the posters inside only ever translate
   and scale by one factor on both axes. */
.srm-morph-clip {
  position: absolute;
  inset: 0;
  will-change: clip-path;
}

.srm-morph-face {
  position: absolute;
  overflow: hidden;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.srm-morph-face--dialog {
  color: var(--sh-on-surface, #333);
  font-family: var(--sh-font-ui, system-ui, sans-serif);
}

/* ── Shared elements ────────────────────────────────────────
   Above the faces: the one poster bitmap and the one title that
   travel between the two views. The faces blank these out on both
   sides, so nothing here is ever duplicated underneath. */

.srm-se-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Window onto the poster. Same trick as the surface clip: an inset
   animated in viewport space, so the crop changes shape while the
   bitmap inside only translates and scales by one factor. */
.srm-se-win {
  position: absolute;
  inset: 0;
  will-change: clip-path;
}

.srm-se-img {
  position: absolute;
  display: block;
  object-fit: contain;
  object-position: center;
  transform-origin: 50% 50%;
  will-change: transform, filter;
}

/* Carousel caption backing, travelling with the poster it belongs to. */
.srm-se-scrim {
  position: absolute;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Poster drop shadow: cannot live inside the clip window, so it flies
   as its own plate. Shadow, not artwork, so a per-axis scale is fine. */
.srm-se-shadow {
  position: absolute;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--sh-header-deep, #260613) 28%, transparent);
  transform-origin: 0 0;
  will-change: transform, opacity;
}

.srm-se-text {
  position: absolute;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform, opacity;
}

html[data-theme="dark"] .srm-dialog {
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.25),
    0 28px 64px rgba(0, 0, 0, 0.55);
}

/* ── Chrome: prev/next + close ──────────────────────────────── */

.srm-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 var(--srm-chrome-h, 48px);
  height: var(--srm-chrome-h, 48px);
  flex-shrink: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--srm-line, color-mix(in srgb, var(--sh-on-surface, #333) 10%, transparent));
  background: color-mix(in srgb, var(--sh-surface, #fcf3ea) 55%, var(--sh-card-fill, #fffaf3));
}

.srm-nav-group {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.srm-nav-group[hidden] {
  display: none !important;
}

.srm-nav {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--srm-muted, var(--sh-on-subtle, #93857a));
  font: inherit;
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.srm-nav:hover:not(:disabled) {
  background: var(--srm-sunken, var(--sh-secondary-hover, rgba(159, 53, 11, 0.08)));
  color: var(--sh-on-surface, #333);
}

.srm-nav:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.srm-pos {
  min-width: 42px;
  padding: 0 4px;
  font: 500 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.02em;
  color: var(--srm-faint, var(--sh-on-subtle, #93857a));
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.srm-pos[hidden] {
  display: none !important;
}

.srm-chrome-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
  /* Only the track control gives way when the bar runs out of room. */
  flex: 0 1 auto;
  min-width: 0;
}

.srm-chrome-end > button,
.srm-nav-group {
  flex-shrink: 0;
}

.srm-chrome-sep {
  width: 1px;
  height: 16px;
  margin: 0 5px;
  flex-shrink: 0;
  background: var(--srm-line, color-mix(in srgb, var(--sh-on-surface, #333) 10%, transparent));
}

.srm-chrome-sep[hidden] {
  display: none !important;
}

.srm-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sh-on-muted, #6b5f56);
  font: inherit;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.srm-close:hover {
  background: var(--sh-secondary-hover, rgba(159, 53, 11, 0.08));
  color: var(--sh-primary, #9f350b);
}

/* Debug info button in chrome (v3 preview square mark) */
.srm-debug-info {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--srm-muted, var(--sh-on-muted, #6b5f56));
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.srm-debug-info[hidden] {
  display: none !important;
}

.srm-debug-info[hidden] + .srm-chrome-sep {
  display: none !important;
}

.srm-debug-info svg {
  display: block;
  width: 14px;
  height: 14px;
}

.srm-debug-info:hover {
  background: var(--srm-sunken, var(--sh-secondary-hover, rgba(159, 53, 11, 0.08)));
  color: var(--sh-on-surface, #333);
}

.srm-debug-info[aria-expanded="true"] {
  background: var(--sh-on-surface, #333);
  color: var(--sh-card-fill, #fff);
}

.srm-debug-info.is-copied {
  color: var(--sh-primary, #9f350b);
}

.srm-nav:focus-visible,
.srm-close:focus-visible,
.srm-debug-info:focus-visible,
.srm-overview-more:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 2px;
}

/* Body-hosted debug popup + copy toast (viewport-clamped in JS) */
.srm-debug-pop {
  position: fixed;
  z-index: 1250;
  width: min(280px, calc(100vw - 16px));
  max-height: min(52vh, 320px);
  overflow: auto;
  padding: 8px 10px 9px;
  border-radius: 0;
  border: 1px solid color-mix(in srgb, var(--sh-on-surface, #333) 14%, transparent);
  background: color-mix(in srgb, var(--sh-surface, #fcf3ea) 94%, var(--sh-card-fill, #fffaf3));
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--sh-on-surface, #333) 6%, transparent),
    0 8px 22px color-mix(in srgb, var(--sh-on-surface, #333) 12%, transparent);
  color: var(--sh-on-subtle, #93857a);
  pointer-events: auto;
  user-select: text;
  scrollbar-width: thin;
}

html[data-theme="dark"] .srm-debug-pop {
  background: color-mix(in srgb, var(--sh-card-fill, #2a2420) 94%, #000);
  border-color: rgba(255, 255, 255, 0.12);
}

.srm-debug-pop-label {
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sh-on-muted, #6b5f56);
}

.srm-debug-pop-hint {
  margin: 0 0 6px;
  font-size: 10px;
  color: var(--sh-on-subtle, #93857a);
}

.srm-debug-dl {
  margin: 0;
  display: grid;
  gap: 3px 0;
}

.srm-debug-dl > div {
  display: grid;
  grid-template-columns: 5.8em minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
}

.srm-debug-dl dt {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sh-on-subtle, #93857a);
}

.srm-debug-dl dd {
  margin: 0;
  min-width: 0;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--sh-on-muted, #6b5f56);
  white-space: normal;
  overflow-wrap: anywhere;
  user-select: text;
}

.srm-debug-toast {
  position: fixed;
  z-index: 1260;
  padding: 6px 10px;
  border-radius: 0;
  border: 1px solid color-mix(in srgb, var(--sh-primary, #9f350b) 40%, transparent);
  background: color-mix(in srgb, var(--sh-surface, #fcf3ea) 96%, var(--sh-card-fill, #fffaf3));
  color: var(--sh-primary, #9f350b);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sh-on-surface, #333) 16%, transparent);
}

html[data-theme="dark"] .srm-debug-toast {
  background: color-mix(in srgb, var(--sh-card-fill, #2a2420) 96%, #000);
  border-color: color-mix(in srgb, var(--sh-primary, #e08a5c) 45%, transparent);
  color: color-mix(in srgb, var(--sh-primary, #e08a5c) 92%, #fff);
}

/* ── Modal semantic tokens (Stella v4 home scopes) ─────────── */

.srm-dialog {
  --srm-rail: color-mix(in srgb, var(--sh-surface, #f5f5f3) 70%, var(--sh-card-fill, #fff) 30%);
  --srm-sunken: color-mix(in srgb, var(--sh-on-surface, #282828) 6%, var(--sh-card-fill, #fff));
  --srm-primary: var(--sh-primary, #ec520b);
  --srm-on-primary: var(--sh-on-primary, #fff);
  --srm-accent-film: #ec520b;
  --srm-accent-tv: #008bff;
  --srm-accent-anime: #ff88ba;
  --srm-accent-manga: #ff88ba;
  --srm-accent-book: #4aac54;
  --srm-accent-game: #ffcb00;
  --srm-accent: var(--srm-accent-film);
  --srm-accent-wash: color-mix(in srgb, var(--srm-accent) 13%, transparent);
  --srm-line: color-mix(in srgb, var(--sh-on-surface, #282828) 17%, transparent);
  --srm-line-soft: color-mix(in srgb, var(--sh-on-surface, #282828) 9%, transparent);
  --srm-faint: var(--sh-on-subtle, #96948e);
  --srm-muted: var(--sh-on-muted, #6d6c69);
  --srm-people-role: var(--srm-faint);
  --srm-chrome-h: 48px;
  --srm-rail-w: 184px;
  --srm-src-w: 52px;
  --srm-src-h: 32px;
  --srm-card-w: 780px;
  --srm-card-h: 412px;
}

html[data-theme="dark"] .srm-dialog {
  --srm-rail: color-mix(in srgb, var(--sh-card-fill, #232322) 80%, #000);
  --srm-sunken: color-mix(in srgb, var(--sh-on-surface, #f2efe9) 8%, var(--sh-card-fill, #232322));
  --srm-line: rgba(255, 255, 255, 0.17);
  --srm-line-soft: rgba(255, 255, 255, 0.08);
}

.srm-dialog[data-domain="film"] { --srm-accent: var(--srm-accent-film); }
.srm-dialog[data-domain="tv"] { --srm-accent: var(--srm-accent-tv); }
.srm-dialog[data-domain="anime_manga"] { --srm-accent: var(--srm-accent-anime); }
.srm-dialog[data-domain="book"] { --srm-accent: var(--srm-accent-book); }
.srm-dialog[data-domain="game"] { --srm-accent: var(--srm-accent-game); }
.srm-dialog[data-kind="manga"] { --srm-accent: var(--srm-accent-manga); }

/* Fixed v3 shell: content contract capped by safe viewport */
.srm-dialog {
  width: min(var(--srm-card-w), calc(100vw - 2 * clamp(10px, 2.5vw, 24px)));
  height: min(var(--srm-card-h), calc(100dvh - 2 * clamp(10px, 2.5vw, 24px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  max-height: min(var(--srm-card-h), calc(100dvh - 2 * clamp(10px, 2.5vw, 24px) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  background: var(--sh-card-fill, #fff);
}

.srm-chrome {
  flex: 0 0 var(--srm-chrome-h);
  height: var(--srm-chrome-h);
}

/* ── Body owns scroll when viewport caps the shell ─────────── */

.srm-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--sh-on-surface) 18%, transparent) transparent;
}

.srm-layout {
  display: grid;
  grid-template-columns: var(--srm-rail-w) minmax(0, 1fr);
  min-height: 100%;
  height: 100%;
}

.srm-media {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--srm-rail);
  border-right: 1px solid var(--srm-line);
}

.srm-poster-box {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--srm-sunken);
}

/* Fills the box on every domain: crop over letterboxing, so no poster
   sits in an empty band. */
.srm-poster {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
  background: var(--srm-sunken);
  box-sizing: border-box;
  padding: 0;
  box-shadow: none;
}

.srm-poster--empty {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--srm-sunken);
  box-shadow: none;
}

.srm-poster-ph {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--srm-faint);
}

.srm-rating-host {
  display: flex;
  flex: 1 1 auto;
  min-block-size: 72px;
  min-height: 0;
}

.srm-rating-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 12px 14px 12px 16px;
  color: inherit;
  text-decoration: none;
  transition: background 0.15s ease;
}

.srm-rating-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--srm-accent);
}

a.srm-rating-tile:hover {
  background: var(--srm-accent-wash);
}

.srm-rating-tile.is-empty {
  pointer-events: none;
}

.srm-rating-tile.is-empty::before {
  background: var(--srm-line);
}

.srm-rating-filler {
  flex: 1 1 auto;
  width: 100%;
  min-height: 72px;
  visibility: hidden;
}

.srm-rating-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.srm-rating-value {
  font: 600 30px / 30px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--sh-on-surface, #282828);
}

.srm-rating-scale {
  font: 500 12px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--srm-faint);
}

.srm-rating-source {
  font: 600 12px / 15px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--srm-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.srm-rating-count {
  font-size: 10px;
  line-height: 13px;
  color: var(--srm-faint);
  font-variant-numeric: tabular-nums;
}

.srm-rating-chip {
  display: none;
}

.srm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 17px 20px 16px 22px;
}

.srm-meta {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex: 0 0 auto;
  min-block-size: 120px;
}

.srm-meta-text {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}

.srm-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0 0 5px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--srm-muted);
}

.srm-kicker::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--srm-accent);
}

.srm-kicker-sep {
  color: var(--srm-line);
  margin: 0;
  font-weight: 500;
}

.srm-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 0 0 auto;
  margin: 0;
  padding-bottom: 4px;
  font: 400 34px / 39px var(--sh-font-display, "Instrument Serif", Georgia, serif);
  letter-spacing: -0.005em;
  color: var(--sh-on-surface, #282828);
  text-align: left;
  text-wrap: balance;
}

.srm-title-series {
  color: var(--sh-on-muted, #6b5f56);
  font-family: var(--sh-font-body, Inter, sans-serif);
  font-size: 0.46em;
  font-weight: 500;
  letter-spacing: 0;
}

.srm-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: 0 0 auto;
  margin-top: 10px;
  max-height: 25px;
  overflow: hidden;
  min-block-size: 0;
}

/* ── Overflow rows: edge hints + drift window ────────────────
   One right-hand fade while there is more line to reach, both edges
   while the auto-scroll is driving, so the row reads as a window onto
   a longer line rather than a cut. */

.srm-title.is-scroll::-webkit-scrollbar,
.srm-genres::-webkit-scrollbar {
  display: none;
}

.srm-title.is-scroll.is-overflowing:not(.is-at-end):not(.is-auto-scrolling),
.srm-genres.is-overflowing:not(.is-at-end):not(.is-auto-scrolling) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.srm-title.is-scroll.is-auto-scrolling,
.srm-genres.is-auto-scrolling {
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 20px,
    #000 calc(100% - 20px),
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 20px,
    #000 calc(100% - 20px),
    transparent
  );
}

/* Only fade an edge that has line beyond it: parked at the start, the
   first letter of a title must stay solid. */
.srm-title.is-scroll.is-auto-scrolling.is-at-start,
.srm-genres.is-auto-scrolling.is-at-start {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
}

.srm-title.is-scroll.is-auto-scrolling.is-at-end,
.srm-genres.is-auto-scrolling.is-at-end {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20px);
  mask-image: linear-gradient(to right, transparent, #000 20px);
}

@media (prefers-reduced-motion: reduce) {
  .srm-title.is-scroll.is-auto-scrolling,
  .srm-genres.is-auto-scrolling {
    -webkit-mask-image: none;
    mask-image: none;
  }
}

.srm-chip {
  padding: 4px 8px;
  border: 1px solid var(--srm-line);
  font-size: 11px;
  line-height: 15px;
  font-weight: 500;
  color: var(--sh-on-surface, #282828);
  white-space: nowrap;
  border-radius: 0;
}

.srm-chip.is-more {
  border-style: dashed;
  color: var(--srm-muted);
}

.srm-facts {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex: 0 0 auto;
  margin: 9px 0 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 17px;
  white-space: nowrap;
  color: var(--sh-on-surface, #282828);
}

.srm-fact {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.srm-fact-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--srm-faint);
}

.srm-fact-value {
  overflow: hidden;
  text-overflow: ellipsis;
}

.srm-fact-sep {
  flex: 0 0 auto;
  color: var(--srm-line);
}

.srm-credits,
.srm-tags-bridge {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 17px;
  color: var(--srm-muted);
}

.srm-credits-label,
.srm-tags-bridge-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--srm-faint);
  margin-right: 6px;
}

.srm-sources {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  flex: 0 0 auto;
}

.srm-source-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--srm-line);
}

.srm-source-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: var(--srm-src-w);
  height: var(--srm-src-h);
  min-width: var(--srm-src-w);
  min-height: var(--srm-src-h);
  padding: 2px 4px 1px;
  color: var(--srm-muted);
  text-decoration: none;
  overflow: hidden;
  border-radius: 0;
  background: var(--srm-sunken);
  transition: background 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
}

.srm-source-btn + .srm-source-btn {
  border-top: 1px solid var(--srm-line);
}

.srm-source-btn:hover {
  background: color-mix(in srgb, var(--srm-sunken) 55%, var(--sh-on-surface, #282828) 8%);
  color: var(--sh-on-surface, #282828);
}

.srm-source-mark {
  font: 600 9px / 12px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.srm-source-ext {
  display: block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  opacity: 0.72;
}

.srm-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.srm-rule {
  flex: 0 0 auto;
  height: 1px;
  margin: 13px 0;
  border: 0;
  background: var(--srm-line-soft);
}

/* TV status row: Overall / Seasons tabs + next-air countdown (replaces .srm-rule). */
.srm-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 34px;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--srm-line-soft);
}

.srm-tabs {
  display: flex;
  align-items: stretch;
  gap: 14px;
  flex: 0 0 auto;
  min-width: 0;
}

.srm-tab {
  appearance: none;
  margin: 0;
  padding: 8px 0 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--srm-muted);
  font: 600 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  cursor: pointer;
  border-radius: 0;
}

.srm-tab.is-active {
  color: var(--sh-on-surface, #282828);
  border-bottom-color: var(--srm-accent);
}

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

.srm-countdown {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 20px;
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.srm-countdown.is-muted {
  color: var(--srm-muted);
}

.srm-countdown.is-empty {
  color: var(--srm-faint);
}

.srm-countdown-mark {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--srm-accent);
}

.srm-countdown-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.srm-read-host {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  margin-top: 8px;
}

.srm-pane {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.srm-pane[hidden] {
  display: none !important;
}

.srm-pane-overall {
  min-height: 0;
}

.srm-pane-overall .srm-overview-slot {
  flex: 1 1 0;
}

.srm-ep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  height: 28px;
  margin: 0 0 4px;
}

.srm-ep-season-label {
  display: flex;
  min-width: 0;
}

.srm-ep-season {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  height: 26px;
  min-width: 108px;
  max-width: 160px;
  padding: 0 22px 0 8px;
  border: 1px solid var(--srm-line);
  border-radius: 0;
  background-color: var(--sh-card-fill, #fff);
  background-image: linear-gradient(45deg, transparent 50%, var(--srm-muted) 50%),
    linear-gradient(135deg, var(--srm-muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 11px, calc(100% - 7px) 11px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-ep-season:focus-visible {
  outline: 2px solid var(--srm-accent);
  outline-offset: 1px;
}

.srm-ep-meta {
  margin: 0;
  color: var(--srm-faint);
  font: 500 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.srm-ep-list {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.srm-ep-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 64px 28px;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  height: 32px;
  padding: 0 2px;
  color: var(--srm-muted);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
}

.srm-ep-row.is-unaired {
  color: var(--sh-on-surface, #282828);
}

.srm-ep-row.is-unaired .srm-ep-loc {
  color: var(--srm-accent);
}

.srm-ep-row--boundary {
  border-top: 1px solid var(--srm-line);
}

.srm-ep-loc {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.srm-ep-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srm-ep-date,
.srm-ep-rating {
  text-align: right;
  white-space: nowrap;
  color: inherit;
}

.srm-ep-empty {
  margin: 12px 0 0;
  color: var(--srm-muted);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-ep-skel {
  height: 32px;
  margin: 0 0 1px;
  background: linear-gradient(
    90deg,
    var(--srm-sunken, #f3f3f3) 0%,
    transparent 50%,
    var(--srm-sunken, #f3f3f3) 100%
  );
  opacity: 0.65;
}

.srm-people-list {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 0 0 4px;
}

.srm-people-line {
  margin: 0 0 6px;
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-line-label {
  color: var(--srm-muted);
  font-weight: 500;
}

.srm-people-heading {
  margin: 10px 0 4px;
  color: var(--srm-muted);
  font: 600 10px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.srm-people-heading-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 10px 0 4px;
}

.srm-people-heading-row .srm-people-heading {
  margin: 0;
}

.srm-people-cast-count {
  color: var(--srm-faint);
  font: 500 10px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.srm-people-cast {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.srm-people-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  margin: 0;
  padding: 2px 0;
}

.srm-people-name {
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.srm-people-name--profile {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: max-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: inherit;
  vertical-align: baseline;
}

.srm-people-name--profile {
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--srm-muted) 55%, transparent);
  text-underline-offset: 2px;
}

.srm-people-name--profile:focus {
  outline: none;
}

.srm-people-name--profile:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 2px;
  border-radius: 2px;
}

@media (hover: none), (pointer: coarse) {
  .srm-people-name--profile {
    cursor: pointer;
    text-decoration: underline dotted;
    text-decoration-color: color-mix(in srgb, var(--srm-muted) 55%, transparent);
    text-underline-offset: 2px;
  }
}

/* Body-hosted People profile portrait popup (viewport-clamped in JS) */
.srm-people-profile-pop {
  --srm-sunken: color-mix(in srgb, var(--sh-on-surface, #282828) 6%, var(--sh-card-fill, #fff));
  --srm-muted: var(--sh-on-muted, #6d6c69);
  --srm-faint: var(--sh-on-subtle, #96948e);
  --srm-line: color-mix(in srgb, var(--sh-on-surface, #282828) 12%, transparent);
  --srm-pop-edge: color-mix(in srgb, var(--sh-on-surface, #282828) 10%, transparent);
  --srm-accent: var(--sh-primary, #ec520b);
  --srm-accent-wash: color-mix(in srgb, var(--srm-accent) 13%, transparent);
  --srm-pop-w: 116px;
  --srm-pop-h: 174px;
  --srm-pop-portrait-w: 116px;
  --srm-pop-portrait-h: 174px;
  --srm-pop-dur: 240ms;
  --srm-pop-ease: cubic-bezier(0.3, 0, 0, 1);
  --srm-pop-scale: 1;
  position: fixed;
  z-index: 1240;
  box-sizing: border-box;
  width: var(--srm-pop-w);
  height: var(--srm-pop-h);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  border: 1px solid var(--srm-pop-edge);
  background: var(--sh-surface, var(--sh-card-fill, #fff));
  /* Ink elevation (not purple glow); black-based so dark mode stays readable. */
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--sh-header-deep, #282828) 8%, transparent),
    0 10px 28px color-mix(in srgb, #000 16%, transparent),
    0 24px 48px color-mix(in srgb, #000 12%, transparent);
  color: var(--sh-on-surface, #282828);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px) scale(var(--srm-pop-scale));
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

html[data-theme="dark"] .srm-people-profile-pop {
  --srm-sunken: color-mix(in srgb, var(--sh-on-surface, #f2efe9) 8%, var(--sh-card-fill, #232322));
  --srm-line: color-mix(in srgb, var(--sh-on-surface, #f2efe9) 12%, transparent);
  --srm-pop-edge: color-mix(in srgb, var(--sh-on-surface, #f2efe9) 10%, transparent);
  background: var(--sh-card-fill, #232322);
  box-shadow:
    0 1px 0 color-mix(in srgb, #000 45%, transparent),
    0 14px 36px color-mix(in srgb, #000 48%, transparent),
    0 32px 64px color-mix(in srgb, #000 42%, transparent);
}

.srm-people-profile-pop[data-domain="film"] { --srm-accent: #ec520b; }
.srm-people-profile-pop[data-domain="tv"] { --srm-accent: #008bff; }
.srm-people-profile-pop[data-domain="anime_manga"] { --srm-accent: #ff88ba; }
.srm-people-profile-pop[data-domain="book"] { --srm-accent: #4aac54; }
.srm-people-profile-pop[data-domain="game"] { --srm-accent: #ffcb00; }
.srm-people-profile-pop[data-kind="manga"] { --srm-accent: #ff88ba; }

.srm-people-profile-pop.is-below {
  transform: translateY(-4px) scale(var(--srm-pop-scale));
}

.srm-people-profile-pop.is-visible {
  opacity: 1;
  transform: translateY(0) scale(var(--srm-pop-scale));
}

.srm-people-profile-pop.is-below.is-visible {
  transform: translateY(0) scale(var(--srm-pop-scale));
}

.srm-people-profile-pop.is-geom-animating {
  transition:
    opacity 120ms ease,
    transform var(--srm-pop-dur) var(--srm-pop-ease),
    left var(--srm-pop-dur) var(--srm-pop-ease),
    top var(--srm-pop-dur) var(--srm-pop-ease),
    width var(--srm-pop-dur) var(--srm-pop-ease),
    height var(--srm-pop-dur) var(--srm-pop-ease),
    box-shadow var(--srm-pop-dur) var(--srm-pop-ease);
}

/* Expanded footprint tracks media-card spirit (desktop ~780×412,
   phone ~390×480): constrained shell, Other work scrolls inside. */
.srm-people-profile-pop.is-expanded {
  --srm-pop-w: min(640px, calc(100vw - 24px));
  --srm-pop-h: min(520px, calc(100dvh - 24px));
  --srm-pop-portrait-w: 112px;
  --srm-pop-portrait-h: 168px;
  --srm-pop-scale: 1.02;
  pointer-events: auto;
  box-shadow:
    0 2px 0 color-mix(in srgb, var(--sh-header-deep, #282828) 10%, transparent),
    0 16px 36px color-mix(in srgb, #000 20%, transparent),
    0 36px 72px color-mix(in srgb, #000 22%, transparent);
}

html[data-theme="dark"] .srm-people-profile-pop.is-expanded {
  box-shadow:
    0 2px 0 color-mix(in srgb, #000 55%, transparent),
    0 20px 44px color-mix(in srgb, #000 58%, transparent),
    0 44px 88px color-mix(in srgb, #000 52%, transparent);
}

@media (max-width: 520px) {
  .srm-people-profile-pop.is-expanded {
    --srm-pop-w: min(366px, calc(100vw - 24px));
    --srm-pop-h: min(
      480px,
      calc(
        100dvh - 24px - env(safe-area-inset-top, 0px) -
          env(safe-area-inset-bottom, 0px)
      )
    );
    --srm-pop-portrait-w: 80px;
    --srm-pop-portrait-h: 120px;
  }
}

html.srm-force-phone .srm-people-profile-pop.is-expanded {
  --srm-pop-w: min(366px, calc(100vw - 24px));
  --srm-pop-h: min(
    480px,
    calc(
      100dvh - 24px - env(safe-area-inset-top, 0px) -
        env(safe-area-inset-bottom, 0px)
    )
  );
  --srm-pop-portrait-w: 80px;
  --srm-pop-portrait-h: 120px;
}

@media (prefers-reduced-motion: reduce) {
  .srm-people-profile-pop,
  .srm-people-profile-pop.is-below,
  .srm-people-profile-pop.is-visible,
  .srm-people-profile-pop.is-below.is-visible,
  .srm-people-profile-pop.is-geom-animating,
  .srm-people-profile-pop.is-expanded {
    transition: none;
    transform: none;
    --srm-pop-scale: 1;
  }

  .srm-people-profile-pop-details {
    transition: none !important;
  }
}

.srm-people-profile-pop-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.srm-people-profile-pop-header {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
}

.srm-people-profile-back {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  margin: 0;
  padding: 7px 46px 7px 14px;
  border: 0;
  background: transparent;
  color: var(--srm-muted);
  font: 600 12px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
  cursor: pointer;
}

.srm-people-profile-back:hover {
  color: var(--sh-on-surface, #282828);
}

.srm-people-profile-back:focus-visible,
.srm-popup-work-person:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 1px;
}

.srm-popup-work-shell {
  overflow: hidden;
}

.srm-popup-work-detail {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 18px;
  flex: 0 0 auto;
  min-height: 184px;
  padding: 8px 18px 16px 14px;
  border-bottom: 1px solid var(--srm-line);
}

.srm-popup-work-media {
  width: 140px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--srm-sunken);
}

.srm-popup-work-poster {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--srm-sunken);
}

.srm-popup-work-poster--empty {
  border-left: 4px solid var(--srm-accent);
  box-sizing: border-box;
}

.srm-popup-work-copy {
  min-width: 0;
  padding: 8px 26px 0 0;
}

.srm-popup-work-domain {
  margin: 0 0 5px;
  color: var(--srm-muted);
  font: 600 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.srm-popup-work-title {
  margin: 0;
  color: var(--sh-on-surface, #282828);
  font: 400 30px / 1.12 var(--sh-font-display, "Instrument Serif", Georgia, serif);
}

.srm-popup-work-overview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  margin: 12px 0 0;
  overflow: hidden;
  color: var(--sh-on-surface, #282828);
  font: 500 13px / 19px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-popup-work-people {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 12px 14px 14px;
}

.srm-popup-work-people h3 {
  margin: 0 0 8px;
  color: var(--srm-muted);
  font: 600 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.srm-popup-work-people-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.srm-popup-work-people-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid var(--srm-line);
  color: var(--srm-muted);
  font: 500 12px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-popup-work-people-row > span {
  color: var(--srm-faint);
}

.srm-popup-work-person {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sh-on-surface, #282828);
  font: inherit;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
}

.srm-popup-work-empty {
  margin: 6px 0;
  color: var(--srm-muted);
  font: 500 13px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

@media (max-width: 520px) {
  .srm-popup-work-detail {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    min-height: 132px;
    padding: 6px 12px 12px;
  }

  .srm-popup-work-media {
    width: 88px;
  }

  .srm-popup-work-copy {
    padding-top: 3px;
  }

  .srm-popup-work-title {
    font-size: 23px;
  }

  .srm-popup-work-overview {
    -webkit-line-clamp: 4;
    margin-top: 7px;
    font-size: 12px;
    line-height: 17px;
  }

  .srm-popup-work-people-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

.srm-people-profile-works {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--srm-line);
  padding: 12px 14px 14px;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-works {
  display: flex;
}

.srm-people-profile-works-heading {
  margin: 0 0 10px;
  color: var(--srm-muted);
  font: 600 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.srm-people-profile-works-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.srm-people-profile-works-empty,
.srm-people-profile-works-error {
  margin: 8px 0 0;
  color: var(--srm-muted);
  font: 500 13px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-profile-works-error p {
  margin: 0 0 8px;
}

.srm-people-profile-works-retry {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--srm-line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--sh-on-surface, #282828) 5%, transparent);
  color: var(--sh-on-surface, #282828);
  font: 600 12px / 1 var(--sh-font-ui, Inter, system-ui, sans-serif);
  cursor: pointer;
}

.srm-people-profile-works-retry:focus {
  outline: none;
}

.srm-people-profile-works-retry:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 1px;
}

.srm-people-work-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .srm-people-work-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .srm-people-work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

html.srm-force-phone .srm-people-work-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.srm-people-work-skel {
  aspect-ratio: 2 / 3;
  border-radius: 0;
  background: linear-gradient(
    110deg,
    var(--srm-sunken) 0%,
    color-mix(in srgb, var(--srm-sunken) 40%, var(--sh-surface, #fff)) 45%,
    var(--srm-sunken) 90%
  );
  background-size: 200% 100%;
  animation: srm-people-work-skel 1.1s ease-in-out infinite;
}

@keyframes srm-people-work-skel {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .srm-people-work-skel {
    animation: none;
  }
}

.srm-people-work-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--srm-sunken);
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.srm-people-work-card.is-unlinked {
  cursor: default;
}

.srm-people-work-card:focus {
  outline: none;
}

.srm-people-work-card:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 2px;
}

.srm-people-work-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  background: var(--srm-sunken);
  filter: grayscale(1) contrast(1.04);
  transition: filter 0.3s ease;
}

.srm-people-work-poster--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: none;
}

.srm-people-work-fallback-icon,
.srm-people-work-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.88);
  mask: var(--srm-work-mask) center / 82% no-repeat;
  -webkit-mask: var(--srm-work-mask) center / 82% no-repeat;
}

.srm-people-work-fallback-icon {
  width: 28px;
  height: 28px;
  background: var(--srm-faint);
}

.srm-people-work-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 34%,
    rgba(8, 8, 8, 0.38) 62%,
    rgba(8, 8, 8, 0.88) 100%
  );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.srm-people-work-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 9px 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.srm-people-work-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.srm-people-work-domain {
  font: 700 10px / 1.2 var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.srm-people-work-title {
  margin: 0;
  font: 700 12px / 1.25 var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.srm-people-work-role {
  margin: 0;
  font: 500 11px / 1.2 var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: rgba(255, 255, 255, 0.82);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Fine pointer: reveal scrim on hover/focus. Coarse: always visible. */
@media (hover: hover) and (pointer: fine) {
  .srm-people-work-card:hover .srm-people-work-poster,
  .srm-people-work-card:focus-visible .srm-people-work-poster {
    filter: grayscale(0) contrast(1);
  }

  .srm-people-work-card:hover .srm-people-work-scrim,
  .srm-people-work-card:hover .srm-people-work-body,
  .srm-people-work-card:focus-visible .srm-people-work-scrim,
  .srm-people-work-card:focus-visible .srm-people-work-body {
    opacity: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .srm-people-work-scrim,
  .srm-people-work-body {
    opacity: 1;
  }

  .srm-people-work-poster {
    filter: grayscale(0) contrast(1);
  }
}

/* JS-detected coarse / no-hover (matchMedia), same always-on captions. */
.srm-people-profile-pop.srm-people-captions-always .srm-people-work-scrim,
.srm-people-profile-pop.srm-people-captions-always .srm-people-work-body {
  opacity: 1;
}

.srm-people-profile-pop.srm-people-captions-always .srm-people-work-poster {
  filter: grayscale(0) contrast(1);
}

@media (prefers-reduced-motion: reduce) {
  .srm-people-work-poster,
  .srm-people-work-scrim,
  .srm-people-work-body {
    transition: none;
  }
}

/* Fine-pointer Expand / Minimize caption under the portrait column.
   Decorative only: name button + shrink control remain the a11y path.
   Anchored to the header (not the full shell) so Other work does not shift it. */
.srm-people-profile-hint {
  position: absolute;
  left: calc(var(--srm-pop-portrait-w) / 2);
  top: calc(var(--srm-pop-portrait-h) - 22px);
  bottom: auto;
  z-index: 3;
  box-sizing: border-box;
  margin: 0;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--srm-line) 70%, transparent);
  background: color-mix(in srgb, var(--sh-surface, var(--sh-card-fill, #fff)) 88%, transparent);
  color: var(--srm-muted);
  font: 500 10px / 12px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity 120ms ease;
}

html[data-theme="dark"] .srm-people-profile-hint {
  background: color-mix(in srgb, var(--sh-card-fill, #232322) 90%, transparent);
}

.srm-people-profile-hint-minimize {
  display: none;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-hint-expand {
  display: none;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-hint-minimize {
  display: inline;
}

@media (hover: hover) and (pointer: fine) {
  .srm-people-profile-pop.is-visible:not(.is-expanded) .srm-people-profile-hint {
    opacity: 1;
  }

  .srm-people-profile-pop.is-expanded:hover .srm-people-profile-hint {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .srm-people-profile-hint {
    transition: none;
  }
}

.srm-people-profile-pop-media,
.srm-people-profile-pop-empty {
  flex: 0 0 var(--srm-pop-portrait-w);
  width: var(--srm-pop-portrait-w);
  height: var(--srm-pop-portrait-h);
  max-height: 100%;
}

.srm-people-profile-pop-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--srm-sunken);
}

.srm-people-profile-pop-empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  padding: 12px 10px;
  background: var(--srm-sunken);
}

.srm-people-profile-pop-glyph {
  color: var(--srm-muted);
  font: 400 56px / 0.9 var(--sh-font-display, "Instrument Serif", Georgia, serif);
  user-select: none;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-pop-glyph {
  font-size: 64px;
}

.srm-people-profile-pop-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--srm-accent);
}

.srm-people-profile-pop-label {
  color: var(--srm-faint);
  font: 500 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  text-align: center;
}

.srm-people-profile-pop-details {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 16px 18px 16px 16px;
  opacity: 0;
  transition: opacity 160ms ease 40ms;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-pop-details {
  display: flex;
  opacity: 1;
}

.srm-people-profile-pop-shrink {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: color-mix(in srgb, var(--sh-on-surface, #282828) 6%, transparent);
  color: var(--srm-muted);
  font: 500 14px / 1 var(--sh-font-ui, Inter, system-ui, sans-serif);
  cursor: pointer;
}

.srm-people-profile-pop-shrink:hover {
  color: var(--sh-on-surface, #282828);
  background: color-mix(in srgb, var(--sh-on-surface, #282828) 10%, transparent);
}

.srm-people-profile-pop-shrink:focus {
  outline: none;
}

.srm-people-profile-pop-shrink:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 1px;
}

.srm-people-profile-pop.is-expanded {
  position: fixed;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-pop-shell {
  position: relative;
}

.srm-people-profile-pop.is-expanded .srm-people-profile-pop-details {
  justify-content: flex-start;
  padding-top: 20px;
}

.srm-people-profile-pop-name {
  margin: 0 28px 0 0;
  color: var(--sh-on-surface, #282828);
  font: 400 28px / 1.15 var(--sh-font-display, "Instrument Serif", Georgia, serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srm-people-profile-pop-category {
  margin: 0;
  color: var(--srm-muted);
  font: 600 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.srm-people-profile-pop-role {
  margin: 2px 0 0;
  color: var(--sh-on-surface, #282828);
  font: 500 13px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srm-people-profile-pop-k {
  color: var(--srm-faint);
  font-weight: 500;
}

.srm-people-profile-pop-context {
  margin: 4px 0 0;
  color: var(--srm-faint);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Wikidata facts under the name (GET /v1/person/{id}). */
.srm-people-profile-pop-facts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-top: 2px;
}

.srm-people-profile-pop-facts[hidden] {
  display: none;
}

.srm-people-profile-pop-desc {
  display: -webkit-box;
  margin: 0 0 4px;
  overflow: hidden;
  color: var(--sh-on-surface, #282828);
  font: 400 13px / 18px var(--sh-font-ui, Inter, system-ui, sans-serif);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.srm-people-profile-pop-fact {
  margin: 0;
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 17px var(--sh-font-ui, Inter, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srm-people-profile-pop-links {
  display: flex;
  gap: 12px;
  margin: 4px 0 0;
  font: 600 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-profile-pop-link {
  color: var(--srm-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.srm-people-profile-pop-link:hover {
  color: var(--sh-on-surface, #282828);
}

.srm-people-profile-pop-link:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 1px;
}

@media (max-width: 520px) {
  .srm-people-profile-pop-name {
    font-size: 22px;
  }

  .srm-people-profile-pop-details {
    padding: 12px 14px 12px 12px;
    gap: 4px;
  }
}

.srm-people-role {
  color: var(--srm-people-role);
  font: 500 11px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srm-people-orgs {
  margin: 0 0 6px;
  color: var(--srm-muted);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-attrib {
  margin: 10px 0 0;
  color: var(--srm-faint);
  font: 500 10px / 14px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-empty {
  margin: 12px 0 0;
  color: var(--srm-muted);
  font: 500 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-people-skel {
  height: 28px;
  margin: 0 0 4px;
  background: linear-gradient(
    90deg,
    var(--srm-sunken, #f3f3f3) 0%,
    transparent 50%,
    var(--srm-sunken, #f3f3f3) 100%
  );
  opacity: 0.65;
}

@media (prefers-reduced-motion: reduce) {
  .srm-people-skel,
  .srm-ep-skel {
    background: var(--srm-sunken, #f3f3f3);
  }
}

.srm-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;
}

.srm-overview-slot {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A long synopsis scrolls in place: no "Show more". */
.srm-overview-clip {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.srm-overview-clip:focus-visible {
  outline: 2px solid var(--sh-focus, #008bff);
  outline-offset: -2px;
}

/* The scroll hint: a fade on the bottom edge with a small arrow, there while
   more text waits below. It sticks to the bottom of the scrolling region (an
   absolutely placed one would scroll away with the text). */
.srm-overview-fade {
  display: none;
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  margin-top: -40px;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--sh-card-fill, #fff) 78%);
}

.srm-overview-fade::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 8px;
  height: 8px;
  margin-left: -5px;
  border-right: 2px solid var(--srm-faint);
  border-bottom: 2px solid var(--srm-faint);
  transform: rotate(45deg);
  opacity: 0.8;
}

.srm-overview-slot.is-clamped:not(.is-at-end) .srm-overview-fade {
  display: block;
}

.srm-overview {
  margin: 0;
  font-family: var(--sh-font-ui, Inter, system-ui, sans-serif);
  font-size: 13px;
  line-height: 20px;
  color: var(--sh-on-surface, #282828);
}

.srm-overview > :first-child {
  margin-top: 0;
}

.srm-overview > :last-child {
  margin-bottom: 0;
}

.srm-overview p,
.srm-overview ul,
.srm-overview ol,
.srm-overview blockquote,
.srm-overview pre,
.srm-overview h3,
.srm-overview h4,
.srm-overview h5,
.srm-overview h6 {
  margin: 0 0 12px;
}

.srm-overview h3 {
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}

.srm-overview h4 {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.srm-overview h5,
.srm-overview h6 {
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}

.srm-overview a {
  color: var(--srm-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.srm-overview ul,
.srm-overview ol {
  padding-left: 1.25em;
}

.srm-overview li + li {
  margin-top: 4px;
}

.srm-overview blockquote {
  padding: 0 0 0 10px;
  border-left: 3px solid var(--srm-accent);
  color: var(--srm-muted);
}

.srm-overview code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--srm-sunken);
  padding: 1px 4px;
}

.srm-overview pre {
  overflow-x: auto;
  white-space: pre;
  background: var(--srm-sunken);
  padding: 8px 10px;
}

.srm-overview pre code {
  background: transparent;
  padding: 0;
}

.srm-overview hr {
  border: 0;
  border-top: 1px solid var(--srm-line);
  margin: 12px 0;
}

.srm-overview--pending {
  color: var(--srm-faint);
  font-style: italic;
}

.srm-nav:focus-visible,
.srm-close:focus-visible,
.srm-debug-info:focus-visible,
.srm-source-btn:focus-visible,
.srm-rating-tile:focus-visible,
.srm-rating-chip:focus-visible,
.srm-overview-more:focus-visible,
.srm-overview a:focus-visible {
  outline: 2px solid var(--sh-focus, #008bff);
  outline-offset: 2px;
}

.sh-search-hit {
  cursor: pointer;
}

.sh-search-hit:focus-visible {
  outline: 2px solid var(--sh-focus, #008bff);
  outline-offset: -2px;
}

@media (pointer: coarse) {
  .srm-nav,
  .srm-close,
  .srm-debug-info,
  .srm-source-btn,
  .srm-tab {
    min-width: 44px;
    min-height: 44px;
    box-sizing: border-box;
  }

  .srm-close {
    width: 44px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .srm-backdrop,
  .srm-dialog,
  .srm-morph-plate,
  .srm-morph-clip,
  .srm-morph-face,
  .srm-se-win,
  .srm-se-img,
  .srm-se-text,
  .srm-rating-tile,
  .srm-source-btn {
    transition: none;
    animation: none;
  }
}

/* ── Game family: version toggle + DLC (markup and look from stella-family.css) ──
   The shell is fixed-height, so the block and the synopsis scroll as one
   column instead of the synopsis clamping inside what little is left. The
   inline padding with a matching negative margin leaves room for the
   toggle's focus rings, which the scroller would otherwise clip. */
.srm-family-scroll {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  margin: 0 -6px;
  padding: 2px 6px 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--sh-on-surface) 18%, transparent) transparent;
}

.srm-family {
  flex: 0 0 auto;
  min-width: 0;
  padding-bottom: 14px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--srm-line-soft);
}

.srm-dialog .srm-family-scroll .srm-overview-slot,
.srm-dialog .srm-family-scroll .srm-overview-clip {
  flex: 0 0 auto;
  overflow: visible;
}

.srm-dialog .srm-family-scroll .srm-overview-fade,
.srm-dialog .srm-family-scroll .srm-overview-more {
  display: none;
}

.srm-phone .srm-family {
  padding-bottom: 12px;
  margin-bottom: 10px;
}

@media (pointer: coarse) {
  .srm-family .sf-seg-btn {
    min-height: 44px;
  }
}

/* ── DLC tab: one card per DLC (cards from stella-family.css) ── */
.srm-tab-count {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Padding with a matching negative margin keeps card focus rings unclipped. */
.srm-dlc-list {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  margin: 0 -6px;
  padding: 2px 6px 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--sh-on-surface) 18%, transparent) transparent;
}

/* Way back from a DLC opened as its own entry. */
.srm-back {
  appearance: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 60%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--srm-muted, var(--sh-on-subtle, #93857a));
  font: 600 12px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.srm-back[hidden] {
  display: none !important;
}

.srm-back:hover {
  background: var(--srm-sunken, var(--sh-secondary-hover, rgba(159, 53, 11, 0.08)));
  color: var(--sh-on-surface, #333);
}

.srm-back:focus-visible {
  outline: 2px solid var(--sh-focus, #008bff);
  outline-offset: 2px;
}

@media (pointer: coarse) {
  .srm-back {
    height: 44px;
  }
}

/* ── Track control ("My Media") ──────────────────────────────
   Main control in the chrome, compact one on each catalog DLC card.
   State comes from the page (setTrackHost); signed out it is a link. */

.srm-track-slot {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  margin-right: 4px;
}

.srm-track-slot:empty {
  display: none;
}

.srm-track {
  appearance: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  height: 32px;
  padding: 0 14px 0 11px;
  border: 1.5px solid var(--hs4-action, var(--sh-on-surface, #282828));
  border-radius: 999px;
  background: var(--hs4-action, var(--sh-on-surface, #282828));
  color: var(--hs4-on-action, var(--sh-card-fill, #fff));
  font: 600 13px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.srm-track:hover {
  border-color: var(--hs4-action-hover, var(--sh-on-surface, #282828));
  background: var(--hs4-action-hover, var(--sh-on-surface, #282828));
  box-shadow: inset 0 0 0 1.5px var(--hs4-action-ring, transparent);
}

.srm-track-icon {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
}

.srm-track-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.srm-track--signin,
.srm-track--signin:hover {
  border-color: var(--hs4-field-edge, color-mix(in srgb, var(--sh-on-surface, #333) 45%, transparent));
  background: transparent;
  color: var(--sh-on-surface, #282828);
  box-shadow: none;
}

.srm-track--signin:hover {
  background: var(--srm-sunken, transparent);
}

/* On your shelf: green, the same in every type of title */
.srm-track.is-tracked,
.srm-track.is-tracked:hover {
  border-color: var(--hs4-selected-edge, #2e7d38);
  background: var(--hs4-selected-soft, #d9ecd9);
  color: var(--hs4-on-selected-soft, #25672e);
  font-weight: 700;
  box-shadow: none;
}

.srm-track.is-tracked:hover {
  border-color: var(--hs4-on-selected-soft, #25672e);
}

/* Dark: a filled green, the same weight as the orange Add button. The
   tinted fill with a bright green edge read as a neon outline. */
html[data-theme="dark"] .srm-track.is-tracked,
html[data-theme="dark"] .srm-track.is-tracked:hover {
  border-color: var(--hs4-selected, #2e7d38);
  background: var(--hs4-selected, #2e7d38);
  color: var(--hs4-on-selected, #fff);
}

html[data-theme="dark"] .srm-track.is-tracked:hover {
  border-color: var(--hs4-selected-hover, #25672e);
  background: var(--hs4-selected-hover, #25672e);
}

.srm-track.is-busy {
  opacity: 0.6;
  cursor: progress;
}

/* Same cue the Browse rows use for a change still waiting in the outbox. */
.srm-track.is-sync-pending,
.srm-track.is-sync-failed {
  outline: 1px dashed color-mix(in srgb, var(--sh-on-surface, #333) 28%, transparent);
  outline-offset: 2px;
}

.srm-track.is-sync-failed {
  outline-color: color-mix(in srgb, var(--hs4-yellow, #e0a800) 70%, var(--sh-on-surface, #333));
}

.srm-track:focus-visible {
  outline: 2px solid var(--sh-focus, #008bff);
  outline-offset: 2px;
}

.srm-track--compact {
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

@media (pointer: coarse) {
  .srm-track {
    height: 36px;
  }

  .srm-track--compact {
    height: 34px;
    padding: 0 14px 0 11px;
  }
}

/* ══ Card layout (2026-11-25, "card 4" on the component canvas) ══════
   A peach top bar and info panel wrap the white reading area. The panel
   holds the poster, the score and the facts on every tab; source links
   sit under the About tab. Frames are square; buttons, tabs and tags
   keep a small corner.

   Three parts: the look both sizes share, the desktop card (a 960 x 600
   window with the panel on the left), and the phone sheet (full width,
   panel on top, Add control in a bottom bar). JS toggles .srm-phone from
   isPhoneLayout(), so the harness force path and a real phone are the
   same rules. */

/* ── Shared look ─────────────────────────────────────────────── */

.srm-dialog {
  --srm-panel: var(--hs4-orange-tint, #fbe6da);
  --srm-panel-line: color-mix(in srgb, var(--sh-on-surface, #282828) 16%, transparent);
}

.srm-dialog .srm-chrome {
  padding: 0 10px 0 12px;
  border-bottom: 0;
  background: var(--srm-panel);
}

.srm-dialog .srm-nav,
.srm-dialog .srm-close {
  border-radius: 6px;
  color: var(--sh-on-surface, #282828);
}

/* On peach the fainter greys fall under 4.5:1 */
.srm-dialog .srm-pos {
  font-size: 13px;
  color: var(--hs4-muted-text, var(--srm-muted));
}

/* The facts live on the panel and the sources under About */
.srm-dialog .srm-facts,
.srm-dialog .srm-sources {
  display: none;
}

.srm-rail-facts {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.srm-rail-fact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 27px;
  border-top: 1px solid var(--srm-panel-line, rgba(40, 40, 40, 0.16));
  font: 500 13px / 1.2 var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-rail-fact dt {
  flex: 0 0 auto;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-rail-fact dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-weight: 600;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Age rating: label on the row, the content descriptors under it */
.srm-rail-fact--age {
  flex-wrap: wrap;
  row-gap: 2px;
  padding: 5px 0;
}

.srm-rail-fact dd.srm-rail-fact-note {
  flex: 1 0 100%;
  font-weight: 500;
  font-size: 12px;
  color: var(--hs4-muted-text, var(--srm-muted));
  text-align: left;
  white-space: normal;
}

/* The rating is a button: it opens every system's rating and the country picker */
.srm-age-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--srm-panel-line, rgba(40, 40, 40, 0.16));
  text-underline-offset: 3px;
}

.srm-age-toggle:hover {
  text-decoration-color: currentColor;
}

.srm-age-toggle:focus-visible,
.srm-age-country-select:focus-visible {
  outline: 2px solid var(--sh-focus, #9f350b);
  outline-offset: 2px;
}

.srm-age-chevron {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  transition: transform 0.15s ease;
}

.srm-rail-fact--age.is-open .srm-age-chevron {
  transform: rotate(180deg);
}

.srm-rail-fact dd.srm-age-panel {
  flex: 1 0 100%;
  margin-top: 6px;
  font-weight: 500;
  text-align: left;
  white-space: normal;
}

.srm-age-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 168px;
  margin: 10px 0 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}

/* Desktop: the rail is a fixed column; while the age list is open it scrolls */
.srm-dialog:not(.srm-phone) .srm-media:has(.srm-rail-fact--age.is-open) {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.srm-age-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  font-size: 12px;
  line-height: 1.3;
}

.srm-age-item-label {
  font-weight: 600;
}

.srm-age-item-age {
  color: var(--hs4-muted-text, var(--srm-muted));
  text-align: right;
}

.srm-age-item-note {
  grid-column: 1 / -1;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-age-country {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-age-country-select {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  padding: 3px 6px;
  border: 1px solid var(--srm-panel-line, rgba(40, 40, 40, 0.16));
  border-radius: 0;
  background: transparent;
  color: var(--sh-on-surface, #282828);
  font: 500 12px / 1.3 var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-age-country-select option {
  color: #282828;
  background: #fff;
}

.srm-age-country-note {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-dialog .srm-kicker {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--hs4-orange-text, var(--srm-muted));
}

/* Only the type name is orange; the year stays quiet */
.srm-dialog .srm-kicker > span:not(:first-child):not(.srm-kicker-sep) {
  font-weight: 600;
  letter-spacing: 0;
  color: var(--hs4-muted-text, var(--srm-muted));
}

/* Genre tags, light: a quiet grey wash with ink text. Tried and dropped:
   pale pink or white with berry text (weak), brand pink with ink text
   (hard to read at this size, though it measures 6.7:1). */
.srm-dialog .srm-chip {
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: color-mix(in srgb, var(--hs4-ink, #282828) 7%, transparent);
  color: var(--hs4-ink, #282828);
  font-size: 13px;
  font-weight: 600;
  line-height: 28px;
}

/* Dark keeps its plum tag with pink text */
html[data-theme="dark"] .srm-dialog .srm-chip {
  background: var(--hs4-pink-tint, #3d1f2d);
  color: var(--hs4-pink-text, #ff9cc6);
}

.srm-dialog .srm-chip.is-more,
html[data-theme="dark"] .srm-dialog .srm-chip.is-more {
  background: transparent;
  color: var(--hs4-muted-text, var(--srm-muted));
}

/* Tabs: a tinted track with the open tab filled */
.srm-dialog .srm-status-row {
  min-height: 48px;
  border-bottom: 0;
}

.srm-dialog .srm-tabs {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 6px;
  background: var(--hs4-orange-tint, #fbe6da);
}

.srm-dialog .srm-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 0;
  padding: 0 12px;
  border-bottom: 0;
  border-radius: 4px;
  color: var(--sh-on-surface, #282828);
  font: 600 14px / 1 var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-dialog .srm-tab.is-active {
  background: var(--hs4-action, #c4450a);
  box-shadow: inset 0 0 0 1.5px var(--hs4-action-ring, transparent);
  color: var(--hs4-on-action, #fff);
  font-weight: 700;
}

.srm-dialog .srm-tab:focus-visible {
  outline: 2px solid var(--hs4-focus, #0a6cd6);
  outline-offset: 2px;
}

.srm-dialog .srm-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  box-sizing: border-box;
  border-radius: 4px;
  background: var(--sh-on-surface, #282828);
  color: var(--sh-card-fill, #fff);
  font-size: 12px;
  font-weight: 700;
}

.srm-dialog .srm-tab.is-active .srm-tab-count {
  background: var(--hs4-on-action, #fff);
  color: var(--hs4-action, #c4450a);
}

.srm-dialog .srm-read-host {
  margin-top: 12px;
}

/* Small grey text: the fainter step is 3:1 on white, this one passes */
.srm-dialog {
  --srm-people-role: var(--hs4-muted-text, var(--srm-muted));
}

.srm-dialog .srm-ep-meta {
  color: var(--hs4-muted-text, var(--srm-muted));
}

/* Source links under the About tab (hidden while another tab is open) */
.srm-about-sources {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0 20px;
}

.srm-content:has(.srm-pane-overall[hidden]) .srm-about-sources {
  display: none;
}

.srm-about-sources-label {
  font: 700 13px / 1 var(--sh-font-ui, Inter, system-ui, sans-serif);
}

.srm-about-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.srm-about-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  box-sizing: border-box;
  border: 1.5px solid var(--hs4-field-edge, #8c8c8c);
  border-radius: 6px;
  color: var(--sh-on-surface, #282828);
  font: 600 13px / 1 var(--sh-font-ui, Inter, system-ui, sans-serif);
  text-decoration: none;
  white-space: nowrap;
}

.srm-about-source:hover {
  background: color-mix(in srgb, var(--sh-on-surface, #282828) 7%, transparent);
}

.srm-about-source:focus-visible {
  outline: 2px solid var(--hs4-focus, #0a6cd6);
  outline-offset: 2px;
}

.srm-about-source .srm-source-ext {
  width: 12px;
  height: 12px;
}

/* The track button follows the small-corner rule for controls */
.srm-track,
.srm-track--compact {
  border-radius: 6px;
}

/* Bottom bar: only the phone sheet shows it */
.srm-foot {
  display: none;
}

/* ── Desktop card ────────────────────────────────────────────── */

.srm-dialog:not(.srm-phone) {
  --srm-card-w: 960px;
  --srm-card-h: 600px;
  --srm-rail-w: 252px;
  --srm-chrome-h: 56px;
  border: 1px solid var(--sh-on-surface, #282828);
}

html[data-theme="dark"] .srm-dialog:not(.srm-phone) {
  border-color: color-mix(in srgb, var(--sh-on-surface, #f5f3ee) 32%, transparent);
}

.srm-dialog:not(.srm-phone) .srm-media {
  gap: 10px;
  padding: 0 16px 16px;
  background: var(--srm-panel);
  border-right: 0;
}

.srm-dialog:not(.srm-phone) .srm-rating-host {
  flex: 0 0 auto;
  min-block-size: 0;
}

.srm-dialog:not(.srm-phone) .srm-rating-filler {
  min-height: 0;
}

/* Score: value and scale on one line, then the source and its rating count */
.srm-dialog:not(.srm-phone) .srm-rating-tile {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-start;
  gap: 4px 8px;
  padding: 0;
}

.srm-dialog:not(.srm-phone) .srm-rating-tile::before {
  display: none;
}

.srm-dialog:not(.srm-phone) a.srm-rating-tile:hover {
  background: transparent;
}

.srm-dialog:not(.srm-phone) .srm-rating-score {
  flex: 0 0 100%;
  gap: 4px;
}

.srm-dialog:not(.srm-phone) .srm-rating-value {
  font-weight: 800;
}

.srm-dialog:not(.srm-phone) .srm-rating-scale {
  font: 500 14px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-dialog:not(.srm-phone) .srm-rating-source {
  font: 600 13px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--hs4-blue-text, var(--srm-primary));
}

.srm-dialog:not(.srm-phone) .srm-rating-count {
  font-size: 13px;
  line-height: 16px;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-dialog:not(.srm-phone) .srm-main {
  padding: 20px 24px 0;
}

.srm-dialog:not(.srm-phone) .srm-meta {
  min-block-size: 0;
}

.srm-dialog:not(.srm-phone) .srm-title {
  padding-bottom: 6px;
  font-size: 44px;
  line-height: 46px;
}

/* A fixed tab width, so two tabs look the same as three */
.srm-dialog:not(.srm-phone) .srm-status-row {
  margin-top: 12px;
}

.srm-dialog:not(.srm-phone) .srm-tabs {
  grid-auto-columns: 150px;
}

/* ── Phone sheet ─────────────────────────────────────────────
   Full width, anchored to the bottom edge, with a strip of the page left
   showing above it. Rows: top bar, peach panel (poster beside the title
   block, then the facts in two columns), tabs, the pane, and a bottom bar
   with the Add control.

   The panel keeps one height on every tab, so the tab row never moves
   under a finger. The pane takes what is left and scrolls inside, as on
   desktop. Phone browsers with their toolbars showing leave about 550 to
   670px, so the panel tightens by viewport height instead of by tab. */

.srm-modal.srm-modal--sheet {
  align-items: flex-end;
  padding: 0;
}

.srm-dialog.srm-phone {
  --srm-chrome-h: 56px;
  --srm-poster-w: 104px;
  --srm-pad: 16px;
  --srm-fact-h: 30px;
  --srm-sheet-gap: calc(
    env(safe-area-inset-top, 0px) + clamp(12px, (100dvh - 600px) * 0.25, 56px)
  );
  width: min(100%, 600px);
  height: calc(100dvh - var(--srm-sheet-gap));
  max-height: none;
}

.srm-phone .srm-chrome {
  padding: 0 6px;
}

.srm-phone .srm-nav,
.srm-phone .srm-close {
  width: 44px;
  height: 44px;
}

.srm-phone .srm-nav {
  font-size: 18px;
}

.srm-phone .srm-close {
  font-size: 22px;
}

.srm-phone .srm-layout {
  grid-template-columns: var(--srm-poster-w) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(160px, 1fr);
  grid-template-areas:
    "poster meta"
    "facts facts"
    "read read";
  column-gap: 14px;
  padding: 0 var(--srm-pad);
}

/* The peach behind the first two rows. Their boxes are grid items of the
   layout (the wrappers below are display: contents), so the panel is
   painted by a spanning item of its own. */
.srm-phone .srm-layout::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1 / 3;
  margin: 0 calc(-1 * var(--srm-pad));
  background: var(--srm-panel);
}

.srm-phone .srm-media,
.srm-phone .srm-main,
.srm-phone .srm-meta {
  display: contents;
}

.srm-phone .srm-poster-box {
  grid-area: poster;
  align-self: start;
  margin-bottom: 12px;
}

/* The score is a line in the title block instead */
.srm-phone .srm-rating-host {
  display: none;
}

.srm-phone .srm-rail-facts {
  grid-area: facts;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  margin-bottom: 14px;
}

.srm-phone .srm-rail-fact {
  min-width: 0;
  min-height: var(--srm-fact-h);
}

.srm-phone .srm-rail-fact:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.srm-phone .srm-rail-fact--age {
  grid-column: 1 / -1;
}

/* One or two facts get a full row each, so a long name is not cut */
.srm-phone .srm-rail-facts:not(:has(.srm-rail-fact:nth-child(3))) {
  grid-template-columns: minmax(0, 1fr);
}

.srm-phone .srm-meta-text {
  grid-area: meta;
  justify-content: flex-start;
  min-width: 0;
  padding-bottom: 12px;
}

.srm-phone .srm-kicker {
  margin-bottom: 6px;
  font-size: 12px;
}

/* Wraps to two lines when they fit; syncTitleFit adds .is-scroll only
   when even the wrapped form overflows. */
.srm-phone .srm-title {
  font-size: 30px;
  line-height: 32px;
  padding-bottom: 0;
  text-wrap: pretty;
}

/* Three lines or more: one drifting line instead. Must outrank the rule
   above, whose text-wrap would otherwise put wrapping back. */
.srm-phone .srm-title.is-scroll {
  display: block;
  -webkit-line-clamp: unset;
  -webkit-box-orient: unset;
  white-space: nowrap;
  text-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

/* One line that scrolls sideways, so the panel height does not depend on
   how many genres a title has */
.srm-phone .srm-genres {
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 8px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

/* A touch more wash than on white, so the tag holds on the peach */
.srm-phone .srm-chip {
  padding: 0 8px;
  background: color-mix(in srgb, var(--hs4-ink, #282828) 9%, transparent);
  line-height: 26px;
}

.srm-phone .srm-chip.is-more {
  background: transparent;
}

/* Dark: the plum tint is too close to the dark peach behind it */
html[data-theme="dark"] .srm-dialog.srm-phone .srm-chip:not(.is-more) {
  background: var(--sh-card-fill, #222);
}

.srm-phone .srm-rating-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  align-self: flex-start;
  flex: 0 0 auto;
  margin-top: 8px;
  color: inherit;
  text-decoration: none;
}

.srm-phone .srm-rating-chip-score {
  font: 800 24px / 26px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.srm-phone .srm-rating-chip-scale {
  margin-left: 4px;
  font: 500 13px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  letter-spacing: 0;
  color: var(--hs4-muted-text, var(--srm-muted));
}

.srm-phone .srm-rating-chip-source {
  font: 600 13px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--hs4-blue-text, var(--srm-primary));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.srm-phone .srm-rating-chip-count {
  font: 400 13px / 16px var(--sh-font-ui, Inter, system-ui, sans-serif);
  color: var(--hs4-muted-text, var(--srm-muted));
  font-variant-numeric: tabular-nums;
}

.srm-phone .srm-content {
  grid-area: read;
  padding-top: 12px;
}

/* The panel edge already separates the blocks on the phone */
.srm-phone .srm-rule {
  display: none;
}

/* Tabs span the sheet; the next-episode line drops under them */
.srm-phone .srm-status-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 0;
}

.srm-phone .srm-tabs {
  grid-auto-columns: minmax(0, 1fr);
}

.srm-phone .srm-tab {
  min-height: 44px;
  padding: 0 6px;
}

.srm-phone .srm-countdown {
  flex: 0 0 auto;
  justify-content: flex-start;
  font-size: 13px;
  line-height: 18px;
}

.srm-phone .srm-countdown.is-empty {
  display: none;
}

.srm-phone .srm-overview {
  font-size: 15px;
  line-height: 23px;
}

/* About reads top down: a short synopsis keeps its source links right
   under it instead of leaving them at the bottom of a tall sheet. A long
   one still takes all the room there is and clips, as on desktop. */
.srm-phone .srm-content:has(.srm-pane-overall:not([hidden])) .srm-read-host,
.srm-phone .srm-pane-overall,
.srm-phone .srm-overview-slot,
.srm-phone .srm-overview-clip,
.srm-phone .srm-family-scroll {
  flex: 0 1 auto;
}

.srm-phone .srm-people-cast {
  grid-template-columns: 1fr;
}

.srm-phone .srm-people-line {
  font-size: 14px;
  line-height: 20px;
}

.srm-phone .srm-people-role {
  font-size: 12px;
  line-height: 16px;
}

.srm-phone .srm-ep-header {
  height: 44px;
  margin-bottom: 2px;
}

.srm-phone .srm-ep-season {
  height: 36px;
  min-height: 36px;
  font-size: 13px;
}

@media (pointer: coarse) {
  .srm-phone .srm-ep-season {
    height: 44px;
    min-height: 44px;
  }
}

/* The date column fits a day with its year ("10 Sept 2018") */
.srm-phone .srm-ep-row {
  height: 40px;
  grid-template-columns: 50px minmax(0, 1fr) 80px 26px;
}

.srm-phone .srm-ep-title {
  font-size: 14px;
  color: var(--sh-on-surface, #282828);
}

.srm-phone .srm-ep-skel {
  height: 40px;
}

/* One row that scrolls sideways: a second row of links would take a
   quarter of the reading area on a short screen */
.srm-phone .srm-about-sources {
  gap: 8px;
  padding: 16px 0 12px;
}

.srm-phone .srm-about-source-list {
  flex-wrap: nowrap;
  margin: 0 calc(-1 * var(--srm-pad));
  padding: 2px var(--srm-pad);
  overflow-x: auto;
  scrollbar-width: none;
}

.srm-phone .srm-about-source-list::-webkit-scrollbar {
  display: none;
}

.srm-phone .srm-about-source {
  flex: 0 0 auto;
  min-height: 44px;
}

.srm-phone .srm-foot {
  display: flex;
  flex: 0 0 auto;
  padding: 10px var(--srm-pad) max(14px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--srm-line-soft);
  background: var(--sh-card-fill, #fff);
}

/* Nothing to add (no My Media on this page): no empty bar */
.srm-phone .srm-foot:has(.srm-track-slot:empty) {
  display: none;
}

.srm-phone .srm-foot .srm-track-slot {
  flex: 1 1 auto;
  margin: 0;
}

.srm-phone .srm-foot .srm-track {
  justify-content: center;
  width: 100%;
  height: 48px;
  font-size: 15px;
  line-height: 18px;
}

.srm-phone .srm-foot .srm-track-icon {
  width: 16px;
  height: 16px;
}

/* A phone browser with its toolbars showing */
@media (max-height: 759px) {
  .srm-dialog.srm-phone {
    --srm-chrome-h: 48px;
    --srm-poster-w: 92px;
    --srm-fact-h: 28px;
  }

  .srm-phone .srm-poster-box {
    margin-bottom: 10px;
  }

  .srm-phone .srm-meta-text {
    padding-bottom: 10px;
  }

  .srm-phone .srm-rail-facts {
    margin-bottom: 10px;
  }

  .srm-phone .srm-content {
    padding-top: 10px;
  }

  .srm-phone .srm-foot {
    padding-top: 8px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
}

/* A small phone: the facts give their two rows to the reading area */
@media (max-height: 599px) {
  .srm-dialog.srm-phone {
    --srm-poster-w: 84px;
  }

  .srm-phone .srm-rail-facts {
    display: none;
  }

  .srm-phone .srm-title {
    font-size: 26px;
    line-height: 28px;
  }
}
