:root {
  color-scheme: dark;
  --bg: #17171a;
  --surface: #232328;
  --field: #2d2c32;
  --border: #39383e;
  --text: #f5f1ed;
  --muted: #a9a4a5;
  --accent: #d9a08b;
  --accent-text: #241a18;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.site-header {
  max-width: 1240px;
  margin: auto;
  padding: 30px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -1.2px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  grid-area: 1 / 1;
}

/* Dark is the default until the saved theme is applied */
.brand-logo-light {
  display: none;
}

.brand-logo-dark {
  display: block;
}

:root[data-theme="light"] .brand-logo-light {
  display: block;
}

:root[data-theme="light"] .brand-logo-dark {
  display: none;
}

.brand-dot, .hero h1 span { color: var(--accent); }

.theme-toggle {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .2s ease, background .2s ease;
}

.hero {
  max-width: 950px;
  margin: 95px auto 100px;
  padding: 0 24px;
  text-align: center;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 2.8px;
}

.hero h1 {
  margin: 24px 0;
  font-size: clamp(52px, 7.5vw, 94px);
  font-weight: 780;
  letter-spacing: -0.065em;
  line-height: 1.06;
}

.hero > p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.compare-panel {
  margin: 54px auto 0;
  padding: 28px;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  text-align: left;
  box-shadow: 0 28px 75px rgba(0,0,0,.13);
}

.field-group label {
  display: block;
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.field-group input {
  display: block;
  width: 100%;
  padding: 19px 20px;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.field-group input::placeholder { color: var(--muted); }
.field-group input:disabled { opacity: 1; cursor: default; }

.versus {
  text-align: center;
  padding: 13px;
  color: var(--accent);
  font-size: 25px;
}

.compare-button {
  margin-top: 24px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 19px 24px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 750;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.helper-text {
  margin-top: 23px;
  font-size: 13px !important;
}

.feature-strip {
  max-width: 1160px;
  margin: 0 auto 90px;
  padding: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 35px;
  border-top: 1px solid var(--border);
}

.feature-strip > div { display: flex; flex-direction: column; gap: 8px; }
.feature-number { color: var(--accent); font-size: 12px; font-weight: 750; }
.feature-strip strong { font-size: 17px; }
.feature-strip p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

footer {
  border-top: 1px solid var(--border);
  padding: 30px 36px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f8f5f2;
    --surface: #fffcf9;
    --field: #f1ebe7;
    --border: #e4dcd7;
    --text: #28252a;
    --muted: #756d70;
    --accent: #975d4b;
    --accent-text: #ffffff;
  }
}

@media (max-width: 650px) {
  .site-header { padding: 22px; }
  .hero { margin: 32px auto 75px; }
  .hero h1 { font-size: clamp(48px, 12vw, 70px); }
  .hero > p { font-size: 15px; }
  .compare-panel { padding: 18px; margin-top: 35px; border-radius: 18px; }
  .feature-strip { grid-template-columns: 1fr; padding: 24px; }
  footer { flex-direction: column; padding: 24px; }
}

/* Production autocomplete */

.field-group {
  position: relative;
}

.field-group input:not(:disabled):focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 340px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
}

.search-results[hidden] {
  display: none;
}

.search-option {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.search-option:last-child {
  border-bottom: none;
}

.search-option:hover,
.search-option.active {
  background: var(--field);
}

.search-poster {
  flex: 0 0 42px;
  width: 42px;
  height: 62px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--field);
  color: var(--muted);
}

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

.search-option-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.search-option-details strong {
  font-size: 14px;
  font-weight: 650;
}

.search-option-details span {
  color: var(--muted);
  font-size: 12px;
}

.search-message {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 651px) {
  .hero {
    margin-top: 32px;
  }

  .compare-panel {
    margin-top: 38px;
  }
}

/* Shared actor results */

.comparison-results {
  max-width: 1160px;
  margin: 0 auto 80px;
  padding: 0 24px;
  scroll-margin-top: 32px;
}

.comparison-results[hidden],
.comparison-status[hidden],
#comparison-content[hidden] {
  display: none;
}

.comparison-status {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.results-heading {
  margin-bottom: 32px;
}

.results-heading h2 {
  margin: 14px 0 8px;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.results-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.actor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.actor-card {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  transition: transform .2s ease, box-shadow .2s ease;
}

.actor-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, .10);
}

.actor-photo {
  height: 320px;
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.actor-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.actor-placeholder {
  color: var(--muted);
  font-size: 54px;
}

.actor-details {
  padding: 22px;
}

.actor-name {
  margin: 0 0 20px;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.actor-role-block {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.role-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.role-line {
  margin: 5px 0;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.results-disclaimer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.compare-button:not(:disabled) {
  cursor: pointer;
}

.compare-button:not(:disabled):hover {
  filter: brightness(1.07);
}

.compare-button:disabled {
  opacity: .65;
  cursor: not-allowed;
}

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

@media (max-width: 600px) {
  .actor-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .actor-photo {
    height: 340px;
  }

  .actor-details {
    padding: 20px;
  }

  .comparison-results {
    padding: 0 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .actor-card {
    transition: none;
  }
}

/* Refined compact actor grid */

@media (min-width: 901px) {
  .actor-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
  }

  .actor-photo {
    height: 340px;
  }

  .actor-details {
    padding: 18px;
  }

  .actor-name {
    font-size: 19px;
  }
}

/* Manual colour theme overrides */

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17171a;
  --surface: #232328;
  --field: #2d2c32;
  --border: #39383e;
  --text: #f5f1ed;
  --muted: #a9a4a5;
  --accent: #d9a08b;
  --accent-text: #241a18;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8f5f2;
  --surface: #fffcf9;
  --field: #f1ebe7;
  --border: #e4dcd7;
  --text: #28252a;
  --muted: #756d70;
  --accent: #975d4b;
  --accent-text: #ffffff;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

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

/* Stage 11 — Actor episode detail section */

.actor-episode-details[hidden] {
  display: none;
}

.actor-episode-details {
  margin-top: 48px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  scroll-margin-top: 28px;
}

.episode-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 28px;
}

.episode-detail-header h2 {
  margin: 12px 0 8px;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.04em;
}

.episode-detail-header p {
  margin: 0;
  color: var(--muted);
}

.episode-detail-close {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--field);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.episode-detail-close:hover {
  border-color: var(--accent);
}

.episode-detail-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.episode-production {
  min-width: 0;
}

.episode-production h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.episode-production-summary {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.episode-season {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.episode-season summary {
  padding: 15px 18px;
  cursor: pointer;
  font-weight: 600;
  background: var(--field);
}

.episode-season summary:hover {
  color: var(--accent);
}

.episode-season-list {
  padding: 8px 18px 16px;
}

.episode-entry {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
}

.episode-entry:last-child {
  border-bottom: none;
}

.episode-entry-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.episode-detail-message {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 700px) {
  .actor-episode-details {
    padding: 22px 18px;
    margin-top: 32px;
  }

  .episode-detail-content {
    grid-template-columns: 1fr;
  }
}

/* Interactive actor cards */

.actor-card[role="button"] {
  cursor: pointer;
}

.actor-card[role="button"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* Stage 11H — Actor appearance portrait */

.episode-actor-profile {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.episode-actor-photo {
  width: 112px;
  height: 168px;
  flex: 0 0 112px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--field);
  display: flex;
  align-items: center;
  justify-content: center;
}

.episode-actor-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.episode-actor-photo .actor-placeholder {
  font-size: 38px;
}

.episode-actor-info {
  min-width: 0;
}

@media (max-width: 600px) {
  .episode-actor-profile {
    gap: 14px;
    align-items: flex-start;
  }

  .episode-actor-photo {
    width: 80px;
    height: 120px;
    flex-basis: 80px;
  }

  .episode-actor-info h2 {
    font-size: 25px;
    overflow-wrap: anywhere;
  }
}
