:root {
  --bg: #14181c;
  --bg2: #1c2228;
  --bg3: #2c3440;
  --text: #f4f8fc;
  --muted: #b8cadb;
  --accent: #00e054;
  --accent-dim: #00b343;
  --border: #384250;
  --star: #ffcc00;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --z-overlay-base: 400;
  --z-overlay-step: 40;
}

* { box-sizing: border-box; }
html {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
}
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #5dff8a; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(20, 24, 28, 0.95);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-size: 1.1rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.nav a {
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav a:hover, .nav a.active { color: var(--text); }

main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Tab-Leiste unten: nur am Handy, siehe Media-Query weiter unten.
   Sie schwebt als zentrierte Pille ueber dem Inhalt. Der Abstand nach unten
   richtet sich nach der Safe Area, faellt aber nie unter 0.85rem — damit sitzt
   sie auf Geraeten mit und ohne Home-Balken gleich sauber. */
:root {
  --tabbar-bottom: max(0.85rem, var(--safe-bottom));
  --tabbar-height: 4.2rem;
}

.tabbar { display: none; }

.lists-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.5rem;
}

#view-profile .lists-hub {
  margin-bottom: 0.35rem;
}

.lists-hub-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.lists-hub-tile:hover {
  border-color: var(--accent);
  background: var(--bg3);
  color: var(--text);
}

.lists-hub-label {
  font-weight: 600;
  font-size: 1rem;
}

.lists-hub-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-stats {
  margin: 0.25rem 0 0;
}

.search-tabs.profile-stat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 0.55rem;
}

.search-tabs.profile-stat-tabs-sub {
  margin-bottom: 0.85rem;
}

a.tab {
  display: inline-block;
  text-decoration: none;
  color: var(--muted);
}

a.tab:hover,
a.tab.active {
  color: var(--text);
}

.profile-stat-panel .stat-block:first-child {
  margin-top: 0;
}

.profile-drilldown {
  margin-top: 0.75rem;
}

.profile-drill-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
}

.profile-drill-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.profile-drilldown .filter-bar {
  margin: 0;
  padding: 0;
  border: 0;
}

.profile-drill-more {
  margin: 1.25rem 0 0;
  text-align: center;
}

.profile-drilldown .lb-back-btn {
  margin-bottom: 0.65rem;
}

.stat-life {
  margin: 1.1rem 0 0.35rem;
}

.stat-life-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stat-life-title {
  margin: 0.2rem 0 0.15rem;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-life-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-heroes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 0.7rem;
}

@media (min-width: 900px) {
  .stat-hero-value { font-size: 2.45rem; }
  .stat-life-title { font-size: 2.2rem; }
}

.stat-hero {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.stat-hero-value {
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat-hero-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stat-hero-hint {
  color: var(--muted);
  font-size: 0.68rem;
  opacity: 0.8;
}

.stat-mix {
  margin: 0;
}

.stat-mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.stat-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  vertical-align: middle;
}

.stat-dot.film { background: var(--accent); }
.stat-dot.tv { background: #e08a2c; }

.stat-mix-track {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.stat-mix-film { background: var(--accent); }
.stat-mix-tv { background: #e08a2c; }

.stat-insights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stat-insight {
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: rgba(0, 224, 84, 0.1);
  border: 1px solid rgba(0, 224, 84, 0.22);
  color: var(--text);
  font-size: 0.76rem;
}

.stat-block {
  margin-top: 0.9rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat-block-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0;
  padding: 0.5rem 0.9rem;
  background: var(--bg3);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-block-title span {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.75rem;
}

.stat-block-body {
  padding: 0.85rem 0.9rem 1rem;
}

.stat-mosaic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.stat-mosaic .stat-block {
  margin-top: 0;
}

.stat-tile-wide {
  grid-column: 1 / -1;
}

.stat-block-body > .stat-block {
  margin-top: 0.75rem;
}

.stat-rating-wrap {
  position: relative;
  overflow: hidden;
}

.stat-avg-line {
  position: absolute;
  top: 0;
  width: 2px;
  height: 120px;
  margin-left: -1px;
  background: #00e054;
  pointer-events: none;
  z-index: 1;
}

.stat-stack-fill {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  height: 100%;
  justify-content: flex-start;
}

.stat-stack-fill .stat-mix-film,
.stat-stack-fill .stat-mix-tv {
  width: 100%;
  min-height: 0;
  border-radius: 3px 3px 0 0;
}

.stat-heat-legend {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-heat {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  grid-auto-columns: 11px;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.stat-share-chart .stat-col-fill {
  background: linear-gradient(180deg, #ffd089, #e08a2c);
}

.stat-show-progress {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.stat-show-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.65rem;
  align-items: center;
  cursor: pointer;
}

.stat-show-row img,
.stat-show-ph {
  width: 42px;
  height: 63px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
}

.stat-show-meta {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

.stat-show-meta strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-show-meta span {
  color: var(--muted);
  font-size: 0.75rem;
}

.stat-show-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--bg3);
  overflow: hidden;
}

.stat-show-bar span {
  display: block;
  height: 100%;
  background: #00e054;
}

.friend-blind-card .stat-wl-btn {
  margin-top: 0.35rem;
  width: 100%;
  font-size: 0.72rem;
  padding: 0.28rem 0.4rem;
}

.stat-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-ranks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-rank {
  position: relative;
  display: grid;
  grid-template-columns: 1.35rem 1fr auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  overflow: hidden;
}

.stat-rank-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, rgba(0, 224, 84, 0.22), rgba(0, 224, 84, 0.05));
  pointer-events: none;
}

.stat-rank-n,
.stat-rank-label,
.stat-rank-value {
  position: relative;
  z-index: 1;
}

.stat-rank-n {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.stat-rank-label {
  font-size: 0.88rem;
  font-weight: 600;
}

.stat-rank-value {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-rank-link {
  cursor: pointer;
}

.stat-rank-link:hover .stat-rank-label {
  color: var(--accent);
}

[data-drill] {
  cursor: pointer;
}

[data-drill]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stat-hero-link:hover .stat-hero-label,
.profile-stat-link:hover .profile-stat-label,
.friend-miss-label[data-drill]:hover,
.stat-tv-open[data-drill]:hover,
.stat-tv-open [data-drill]:hover,
.stat-block-title[data-drill]:hover,
.friend-vs[data-drill]:hover strong {
  color: var(--accent);
}

.friend-vs[data-drill]:hover {
  background: rgba(0, 224, 84, 0.08);
}

.stat-col[data-drill]:hover .stat-col-fill {
  filter: brightness(1.18);
}

.stat-stack-fill [data-drill]:hover {
  filter: brightness(1.18);
}

.stat-col-labels [data-drill]:hover {
  color: var(--accent);
}

.stat-tv-open {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-chart {
  width: 100%;
}

.stat-cols {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  overflow: hidden;
}

.stat-col {
  flex: 1;
  display: flex;
  align-items: flex-end;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}

.stat-col-fill {
  width: 100%;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(180deg, #48e39b, var(--accent));
}

.stat-col.empty .stat-col-fill {
  background: rgba(255, 255, 255, 0.1);
}

.stat-col.peak:not(.gold) .stat-col-fill {
  box-shadow: inset 0 0 0 1px rgba(0, 224, 84, 0.55);
}

.stat-col.gold .stat-col-fill {
  background: linear-gradient(180deg, #ffe066, var(--star));
  box-shadow: inset 0 0 0 1px rgba(255, 204, 0, 0.45);
}

.stat-col-labels {
  display: flex;
  gap: 4px;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-col-labels span {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.stat-time-split {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.stat-time-row {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.stat-time-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.7rem;
  font-size: 0.88rem;
}

.stat-time-meta strong {
  font-variant-numeric: tabular-nums;
}

.stat-time-meta span {
  color: var(--muted);
  font-size: 0.78rem;
}

.stat-time-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg3);
  overflow: hidden;
}

.stat-time-bar span {
  display: block;
  height: 100%;
}

.stat-time-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.stat-time-compare .stat-hero {
  padding: 0.55rem 0.65rem;
}

.stat-toplist-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  margin-bottom: 0.7rem;
}

.stat-toplist-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-toplist-controls select {
  min-width: 7.5rem;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
}

.stat-top-posters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.stat-top-poster {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg3);
  aspect-ratio: 2 / 3;
}

.stat-top-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stat-top-score {
  position: absolute;
  left: 0.3rem;
  bottom: 0.3rem;
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: #ffe066;
  font-size: 0.72rem;
  font-weight: 700;
}

.stat-toplist-all {
  margin-top: 0.65rem;
}

.stat-scatter {
  width: 100%;
  height: auto;
  display: block;
  background: var(--bg3);
  border-radius: 8px;
}

.stat-scatter-point {
  fill: var(--accent);
  fill-opacity: 0.55;
}

.stat-scatter-trend {
  stroke: #e08a2c;
  stroke-width: 2;
  fill: none;
}

/* Profile stats — mobile only. Desktop (≥701px) stays unchanged. */
@media (max-width: 700px) {
  .search-tabs.profile-stat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.4rem;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    padding-bottom: 0.2rem;
  }

  .search-tabs.profile-stat-tabs .tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .profile-stats {
    max-width: 100%;
    min-width: 0;
  }

  .profile-stat-panel,
  .profile-drilldown {
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  .stat-mosaic {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .stat-block {
    max-width: 100%;
  }

  .stat-block-body {
    padding: 0.75rem 0.75rem 0.9rem;
  }

  .stat-block-title {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.2rem 0.55rem;
    padding: 0.5rem 0.75rem;
  }

  .stat-block-title span {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stat-heroes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem 0.65rem;
  }

  .stat-hero {
    gap: 0.22rem;
  }

  .stat-hero-value {
    font-size: 1.45rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .stat-hero-label,
  .stat-hero-hint {
    overflow-wrap: anywhere;
    word-break: break-word;
    letter-spacing: 0.04em;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .profile-stat {
    min-width: 0;
    padding: 0.65rem 0.7rem;
  }

  .profile-stat-label {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stat-time-compare {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 0.55rem;
  }

  .stat-time-compare .stat-hero {
    padding: 0.45rem 0.35rem;
    min-width: 0;
  }

  .stat-time-meta {
    gap: 0.2rem 0.45rem;
  }

  .stat-rank {
    grid-template-columns: 1.2rem minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 0.4rem;
    row-gap: 0.15rem;
    padding: 0.45rem 0.55rem;
    align-items: start;
  }

  .stat-rank-n {
    grid-row: 1 / span 2;
    padding-top: 0.1rem;
  }

  .stat-rank-label {
    grid-column: 2;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stat-rank-value {
    grid-column: 2;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: left;
  }

  .stat-chart {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    max-width: 100%;
    padding-bottom: 0.15rem;
  }

  /* Dense axis (≥10 bars): fixed bar width + chart-only scroll */
  .stat-cols:has(> :nth-child(10)),
  .stat-col-labels:has(> :nth-child(10)) {
    min-width: calc(1.7rem * 12);
  }

  .stat-cols:has(> :nth-child(10)) .stat-col,
  .stat-col-labels:has(> :nth-child(10)) span {
    flex: 0 0 1.7rem;
    width: 1.7rem;
  }

  .stat-col-labels {
    font-size: 0.52rem;
    letter-spacing: 0;
    gap: 4px;
  }

  /* Rating chart keeps avg-line alignment — no forced min-width scroll */
  .stat-rating-wrap .stat-chart {
    overflow-x: hidden;
  }

  .stat-rating-wrap .stat-cols:has(> :nth-child(10)),
  .stat-rating-wrap .stat-col-labels:has(> :nth-child(10)) {
    min-width: 0;
    width: 100%;
  }

  .stat-rating-wrap .stat-cols:has(> :nth-child(10)) .stat-col,
  .stat-rating-wrap .stat-col-labels:has(> :nth-child(10)) span {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .stat-heat-legend {
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
  }

  .stat-insights {
    gap: 0.4rem;
  }

  .stat-insight {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stat-toplist-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .stat-toplist-controls label {
    width: 100%;
    min-width: 0;
  }

  .stat-toplist-controls select {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .stat-top-posters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .stat-show-meta strong {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
  }

  /* friend-vs: Override kommt weiter unten nach der Desktop-Regel */

  .profile-drill-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .profile-drill-title {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .profile-drilldown .filter-bar {
    width: 100%;
    min-width: 0;
  }

  .profile-drilldown .filter-bar label,
  .profile-drilldown .filter-bar select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
}

.log-date-source-hint {
  margin: 0.2rem 0 0.55rem;
  font-size: 0.78rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.stat-block .profile-stat {
  background: var(--bg3);
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  padding: 0.75rem 0.8rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.profile-stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.profile-stat-label {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-section.profile-shelf {
  margin-top: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.home-section.profile-shelf h2 {
  margin: 0;
  padding: 0.5rem 0.9rem;
  background: var(--bg3);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.home-section.profile-shelf h2 a {
  color: inherit;
}

.home-section.profile-shelf h2 a:hover {
  color: var(--text);
}

.home-section.profile-shelf .poster-row {
  padding: 0.85rem 0.9rem 1rem;
}

.profile-stat-panel .profile-shelf,
.profile-stats .profile-shelf {
  margin-top: 0.9rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.profile-shelf-title {
  margin: 0;
  padding: 0.5rem 0.9rem;
  background: var(--bg3);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.profile-stats .profile-shelf .poster-row {
  padding: 0.85rem 0.9rem 1rem;
}

.profile-stats .profile-shelf .poster-row:has(.profile-shelf-empty) {
  display: block;
  overflow: visible;
  padding: 0.85rem 0.9rem 1rem;
}

.profile-shelf-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.profile-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view { display: none; }
.view.active { display: block; }

h2 {
  margin: 0 0 1rem;
  font-weight: 600;
  font-size: 1.4rem;
}

.muted { color: var(--muted); }

.home-hero {
  position: relative;
  min-height: 320px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(0.45);
}

.home-hero-overlay {
  position: relative;
  z-index: 1;
  padding: 2rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(to top, rgba(20,24,28,0.95) 0%, rgba(20,24,28,0.2) 60%, transparent 100%);
  cursor: pointer;
}

.film-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.search-row { cursor: pointer; }
.search-row .btn { cursor: pointer; }

.home-hero h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.home-hero p {
  margin: 0 0 1rem;
  max-width: 600px;
  color: #e2eaf2;
  font-size: 0.95rem;
  line-height: 1.5;
}

.home-hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.stats-bar span {
  color: var(--muted);
}

.stats-bar strong {
  color: var(--accent);
  margin-right: 0.25rem;
}

.home-section {
  margin-bottom: 2rem;
}

.home-section h2 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.friend-activity {
  overscroll-behavior-x: contain;
}

.friend-activity-card {
  flex: 0 0 130px;
  width: 130px;
  max-width: 130px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  appearance: none;
  -webkit-appearance: none;
}

.friend-activity-poster-wrap {
  position: relative;
  display: block;
}

.friend-activity-poster-wrap img,
.friend-activity-poster-wrap .placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg3);
  display: block;
  border: 1px solid var(--border);
}

.friend-activity-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 1.15rem 0.35rem 0.32rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.88));
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.2;
  border-radius: 0 0 var(--radius) var(--radius);
}

.friend-activity-name span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-activity-initial {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 1.05rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 700;
}

.friend-activity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.35rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.friend-activity-rating {
  color: var(--accent);
  letter-spacing: 0.02em;
}

.friend-activity-code {
  flex-basis: 100%;
}

@media (max-width: 700px) {
  .poster-row.friend-activity .friend-activity-card {
    flex: 0 0 112px;
    width: 112px;
    max-width: 112px;
  }
}

.poster-row {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.poster-row::-webkit-scrollbar {
  height: 6px;
}

.poster-row::-webkit-scrollbar-thumb {
  background: var(--bg3);
  border-radius: 3px;
}

.poster-row .poster-card {
  flex: 0 0 130px;
  width: 130px;
  max-width: 130px;
  min-width: 0;
  scroll-snap-align: start;
}

.poster-row .poster-card img,
.poster-row .poster-card .placeholder {
  width: 100%;
}

.profile-hero {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-hero h1 {
  margin: 0;
  font-size: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr));
  gap: 0.75rem;
}

.poster-card {
  cursor: pointer;
  transition: transform 0.15s;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.poster-card:hover { transform: translateY(-3px); }

.poster-card img,
.poster-card .placeholder {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg3);
  display: block;
  border: 1px solid var(--border);
}

.poster-card .title {
  font-size: 0.78rem;
  line-height: 1.25;
  margin-top: 0.35rem;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
  height: calc(1.25em * 2);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.poster-card .meta {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poster-card-removable {
  position: relative;
}

.poster-card-remove {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.65rem;
  height: 1.65rem;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.poster-card-remove:hover,
.poster-card-remove:focus-visible {
  opacity: 1;
  background: rgba(180, 30, 30, 0.92);
}

.diary-list { display: flex; flex-direction: column; gap: 0; }

.diary-month {
  padding: 0.4rem 0.65rem;
  margin: 0.75rem -0.35rem 0.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.diary-month:first-child {
  margin-top: 0.15rem;
}

.diary-item {
  display: grid;
  grid-template-columns: 2.2rem 28px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  padding: 0.4rem 0;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  width: 100%;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 224, 84, 0.18);
}

.diary-item.diary-item-bulk {
  grid-template-columns: 1.3rem 2.2rem 28px minmax(0, 1fr);
}

.diary-day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.diary-day {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.diary-day.empty {
  color: var(--muted);
  font-size: 1.1rem;
}

.diary-month-inline {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
  text-align: center;
}

.diary-item img,
.diary-poster-fallback {
  width: 28px;
  height: 42px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg3);
}

.diary-poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.diary-body { min-width: 0; }

.diary-item h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.diary-year {
  font-size: 0.72rem;
  font-weight: 400;
}

.diary-stars {
  margin-top: 0.08rem;
  color: var(--star);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

.diary-review {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.diary-tag-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.diary-tag-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.diary-tag-pick {
  display: flex;
  align-items: center;
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg2);
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.diary-tag-pick input { display: none; }

.diary-tag-pick.active {
  background: var(--bg3);
  border-color: var(--text);
  color: var(--text);
}

.rating, .stars { color: var(--star); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.btn {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover { border-color: var(--accent); }

.btn-small {
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
}

.btn-primary {
  background: var(--accent);
  color: #041208;
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover { background: #5dff8a; }

.list-block {
  margin-bottom: 2rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.list-block h3 { margin: 0 0 0.75rem; }

#view-lists .list-overview-section {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 224, 84, 0.18);
}

#view-lists .person-section-head,
#view-lists .person-section-preview {
  pointer-events: none;
}

#view-lists .person-section-head {
  min-height: 44px;
}

#view-lists .person-section-preview {
  overflow-x: hidden;
}

#view-lists .lists-open-head { margin-bottom: 0.35rem; }

#view-lists .person-section-preview .poster-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: max-content;
  max-width: none;
  min-width: 0;
  overflow: visible;
  padding-bottom: 0.35rem;
}

#view-lists .person-section-preview .poster-card {
  flex: 0 0 56px;
  width: 56px;
  max-width: 56px;
  min-width: 56px;
}

#view-lists .person-section-preview .poster-card img,
#view-lists .person-section-preview .poster-card .placeholder {
  width: 56px;
  max-width: 56px;
}

#view-lists .person-section-preview .poster-card .title,
#view-lists .person-section-preview .poster-card .meta {
  display: none;
}

@media (min-width: 701px) {
  #view-lists .person-section-preview .poster-card {
    flex: 0 0 72px;
    width: 72px;
    max-width: 72px;
    min-width: 72px;
  }
  #view-lists .person-section-preview .poster-card img,
  #view-lists .person-section-preview .poster-card .placeholder {
    width: 72px;
    max-width: 72px;
  }
}

.search-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tab {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  border-color: var(--accent);
}

#search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 0;
  box-sizing: border-box;
}

.search-panel {
  margin-bottom: 1rem;
}

.search-results {
  display: block;
  margin-top: 0.5rem;
  max-height: min(420px, 60vh);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.search-results.hidden {
  display: none;
}

.search-results .search-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  flex-shrink: 0;
  min-height: 72px;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  color: inherit;
  box-sizing: border-box;
}

.search-results .search-row + .search-row {
  margin-top: 0.35rem;
}

.search-results .search-row:hover,
.search-results .search-row:focus-visible {
  background: var(--bg3);
  outline: none;
}

.search-results .search-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 72px;
  display: block;
}

.search-results .search-thumb img {
  width: 48px;
  height: 72px;
  max-width: 48px;
  max-height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
  display: block;
}

.search-results .search-thumb .placeholder {
  width: 48px;
  height: 72px;
  max-width: 48px;
  max-height: 72px;
  aspect-ratio: auto;
  font-size: 0.7rem;
}

.search-results .search-row-body,
.search-row-body {
  flex: 1;
  min-width: 0;
}

.search-results .search-row-body strong,
.search-row-body strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.search-results .search-row-actions {
  flex-shrink: 0;
  display: flex;
  gap: 0.35rem;
}

.search-results .search-thumb-person {
  width: 48px;
  height: 48px;
}

.search-results .search-thumb-person img.person-thumb,
.search-results .search-thumb-person .placeholder {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
}

.search-hint {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.search-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem;
}

.search-row img {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
}

.tv-detail {
  margin-top: 2rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.tv-detail.hidden { display: none; }

.tv-header {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tv-header img {
  width: 120px;
  border-radius: var(--radius);
  background: var(--bg3);
}

.progress-bar {
  height: 8px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0 1rem;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.season {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
}

.season summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.season summary::-webkit-details-marker { display: none; }

.episode-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(56, 66, 80, 0.5);
  font-size: 0.9rem;
}

.episode-row label { display: flex; align-items: center; gap: 0.5rem; }

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal.hidden { display: none; }

html.overlay-open,
body.overlay-open {
  overflow: hidden;
  overscroll-behavior: none;
}

#overlay-root {
  position: relative;
  z-index: var(--z-overlay-base);
  pointer-events: none;
}

.overlay {
  z-index: calc(var(--z-overlay-base) + (var(--overlay-depth, 1) - 1) * var(--z-overlay-step));
  overscroll-behavior: contain;
}

.overlay:not(.hidden) {
  pointer-events: auto;
}

.overlay.overlay-buried {
  pointer-events: none;
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 900px;
  width: 100%;
  box-shadow: var(--shadow);
  z-index: 1;
}

.modal-wide { max-width: 1000px; }

.cast-card { cursor: pointer; transition: transform 0.15s; }
.cast-card:hover { transform: translateY(-2px); }

.person-header {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.person-header img {
  width: 140px;
  border-radius: var(--radius);
  background: var(--bg3);
}

.person-films h3 { margin-bottom: 0.75rem; }

.watched-badge {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-small { max-width: 420px; }

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.film-detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
}

.film-detail-grid img {
  width: 100%;
  border-radius: var(--radius);
  background: var(--bg3);
}

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.cast-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg3);
}

.cast-card .name {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.cast-card .role {
  font-size: 0.68rem;
  color: var(--muted);
}

#log-form label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

#log-form input, #log-form select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.checkbox { display: flex !important; align-items: center; gap: 0.5rem; }
.checkbox input { width: auto; margin: 0; }

.log-people-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.log-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  margin-bottom: 0.75rem;
}

.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

.log-title { font-weight: 600; margin-bottom: 1rem; }

.placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--bg3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 0.5rem;
}

@media (max-width: 700px) {
  /* Trending-Karussell auf dem Handy aus: die Startseite beginnt direkt
     bei den Poster-Reihen. */
  .home-hero {
    display: none;
  }

  /* Navigation wandert komplett nach unten, der obere Balken entfaellt. */
  .topbar {
    display: none;
  }

  .tabbar {
    display: flex;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: var(--tabbar-bottom);
    z-index: 300;
    max-width: calc(100% - 1.5rem - var(--safe-left) - var(--safe-right));
    padding: 0.35rem 0.4rem;
    border-radius: 999px;
    /* Deutlich durchsichtig; der staerkere Weichzeichner haelt die Symbole
       trotzdem lesbar, egal was darunter durchlaeuft. */
    background: rgba(22, 27, 32, 0.48);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  }

  .tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.14rem;
    padding: 0.55rem 0.5rem 0.45rem;
    min-width: 62px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.6rem;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    /* Der Hintergrund ist stark durchsichtig, darum etwas Abdunklung
       hinter Symbol und Text, damit helle Poster sie nicht schlucken. */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .tabbar-item.active {
    color: var(--text);
    background: rgba(0, 224, 84, 0.16);
  }

  .tabbar-item.active .tabbar-icon {
    color: var(--accent);
  }

  .tabbar-icon svg {
    width: 24px;
    height: 24px;
    display: block;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  }

  /* viewport-fit=cover: Safe Area oben/unten/seitlich selbst halten.
     Unten: Tabbar-Höhe + Inset, damit die letzte Karte nicht unter der Pille endet. */
  main {
    padding-top: calc(1rem + var(--safe-top));
    padding-right: calc(1.5rem + var(--safe-right));
    padding-bottom: calc(var(--tabbar-height) + var(--tabbar-bottom) + 0.75rem);
    padding-left: calc(1.5rem + var(--safe-left));
  }

  .tv-sticky-bar {
    top: var(--safe-top);
  }

  .modal {
    padding-top: max(1rem, var(--safe-top));
    padding-right: max(1rem, var(--safe-right));
    padding-bottom: max(1rem, calc(var(--safe-bottom) + 0.75rem));
    padding-left: max(1rem, var(--safe-left));
  }

  .modal .form-actions {
    flex-wrap: wrap;
  }

  .modal-close {
    top: max(0.5rem, calc(var(--safe-top) * 0.15));
    right: max(0.75rem, var(--safe-right));
  }

  .tinder-match-overlay,
  .tv-track-overlay {
    padding-top: var(--safe-top);
    padding-right: var(--safe-right);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
  }

  .stat-life-title { font-size: 1.65rem; }
  .film-detail-grid, .tv-header {
    grid-template-columns: 1fr;
  }
  .nav {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .detail-view.active:not(#view-person-detail) {
    margin: -1rem -0.75rem;
  }
  .lb-page-inner {
    padding: 0 1rem 2rem;
  }
  .lb-sidebar-desktop {
    display: none !important;
  }
  .lb-mobile-ratings-wrap,
  .lb-mobile-log-wrap {
    display: block;
    width: 100%;
    order: 1;
  }
  .lb-mobile-log-wrap {
    order: 2;
    margin: 0 0 1.25rem;
  }
  .lb-title-desktop {
    display: none;
  }
  .lb-hero-head {
    margin: -1.75rem 0 0.75rem;
    position: relative;
    z-index: 2;
  }
  .lb-hero-poster {
    width: 76px;
    margin-top: 0.15rem;
  }
  .lb-backdrop-wrap {
    height: 200px;
  }
  .lb-backdrop {
    background-position: center center;
    background-size: cover;
  }
  .lb-backdrop-fade {
    background: linear-gradient(to bottom, transparent 0%, rgba(20, 24, 28, 0.35) 45%, var(--bg) 100%);
  }
  .lb-hero-text {
    flex: 1;
    min-width: 0;
    padding-top: 0.15rem;
  }
  .lb-layout {
    display: flex !important;
    flex-direction: column;
    gap: 0;
  }
  .lb-poster-desktop {
    display: none;
  }
  .lb-intro,
  .lb-main,
  .lb-sidebar,
  .lb-mobile-ratings-wrap,
  .lb-mobile-log-wrap {
    grid-column: unset !important;
    grid-row: unset !important;
    width: 100%;
  }
  .lb-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    order: 3;
  }
  .lb-sidebar {
    display: none;
  }
  .lb-intro {
    order: 0;
    margin-bottom: 0.75rem;
  }
  .lb-mobile-ratings-wrap {
    margin: 0 0 0.75rem;
  }
  .lb-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    margin: 0 -1rem;
    padding: 0 1rem 0.5rem;
    border-bottom: 1px solid var(--border);
  }
  .lb-tab {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-size: 0.82rem;
    background: transparent;
  }
  .lb-tab.active {
    background: rgba(255, 255, 255, 0.1);
  }
  .lb-tab-panel {
    padding-top: 0.5rem;
  }
  .lb-overview {
    font-size: 0.9rem;
    line-height: 1.55;
    margin-bottom: 0.75rem;
  }
  .lb-tagline {
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
  }
  .lb-ratings-box {
    margin-top: 0;
  }
  .lb-sidebar-card {
    padding: 0.85rem;
  }
  .lb-action-row {
    gap: 0.5rem;
  }
  .lb-action-btn {
    font-size: 0.78rem;
    padding: 0.55rem 0.65rem;
  }
  .lb-back-btn:not(.lb-back-floating) {
    display: none;
  }
  .tv-sticky-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg);
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  .heatmap-details summary { cursor: pointer; color: var(--accent); margin-bottom: 0.5rem; }
  .lb-mobile-dock {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Letterboxd-style detail pages ── */

.detail-view.active:not(#view-person-detail) {
  margin: -1.5rem;
  max-width: none;
  padding: 0;
}

.lb-back-floating {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 5;
  margin: 0;
  background: rgba(20, 24, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.lb-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 701px) {
  .lb-hero-head {
    display: none;
  }
  .lb-mobile-ratings-wrap,
  .lb-mobile-log-wrap,
  .lb-mobile-dock {
    display: none !important;
  }
}

.lb-hero-text h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.lb-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-hero-meta a {
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.lb-hero-runtime {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.lb-hero-poster {
  flex-shrink: 0;
  width: 108px;
}

.lb-hero-poster img,
.lb-hero-poster .placeholder {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
  aspect-ratio: 2/3;
  object-fit: cover;
}

.lb-mobile-ratings {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0;
}

.lb-ratings-tmdb-mobile {
  margin-top: 0;
}

.lb-ratings-body-mobile {
  align-items: flex-end;
}

.lb-mobile-ratings .lb-ratings-imdb {
  margin-top: 0;
}

.lb-mobile-ratings-head {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.lb-mobile-ratings-body {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.lb-mobile-rating-star {
  color: var(--accent);
  font-size: 0.72rem;
  line-height: 1;
  flex-shrink: 0;
}

.lb-mobile-rating-star-left {
  padding-bottom: 0.15rem;
}

.lb-mobile-rating-end {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  min-width: 2.5rem;
}

.lb-mobile-rating-avg {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.lb-mobile-rating-star-right {
  font-size: 0.55rem;
  margin-top: 0.15rem;
  letter-spacing: -0.05em;
}

.lb-histogram-mobile {
  flex: 1;
  height: 42px;
  gap: 1px;
}

.lb-histogram-mobile .lb-hist-bar {
  background: #3d4a56;
}

.lb-mobile-dock {
  position: static;
  padding: 0;
  margin: 0;
  background: none;
  pointer-events: auto;
}

.lb-mobile-dock > * {
  pointer-events: auto;
}

.lb-mobile-logged-stars {
  color: var(--star);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  flex: 1;
}

.lb-mobile-rating-trigger {
  flex: 1;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.lb-star-display {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}

.lb-star-display .lb-star-unit {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.lb-star-display .lb-star-unit .star-bg,
.lb-star-display .lb-star-unit .star-fill > span {
  font-size: 1.05rem;
  width: 18px;
  height: 18px;
}

.lb-mobile-rating-num {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  margin-left: 0.35rem;
}

.lb-mobile-rating-panel {
  margin-top: 0.65rem;
  padding: 0.85rem;
  background: #1a2330;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.lb-mobile-rating-panel.hidden {
  display: none;
}

.lb-tv-avg-rating {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.lb-action-row-mobile {
  margin-bottom: 0.75rem;
  padding-bottom: 0.85rem;
}

.lb-mobile-done {
  display: block;
  width: 100%;
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #243040;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.lb-mobile-rating-trigger .lb-mobile-log-icon {
  margin-right: 0.35rem;
}

.lb-mobile-logged-empty {
  flex: 1;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.lb-mobile-log-btn,
.lb-mobile-logged-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #1a2330;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.lb-mobile-log-btn.logged {
  opacity: 0.85;
}

.lb-mobile-log-icon {
  font-size: 1rem;
  opacity: 0.85;
}

.lb-mobile-logged-bar {
  justify-content: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
}

.lb-mobile-logged-bar .lb-mobile-logged-stars {
  text-align: left;
}

.lb-mobile-logged-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--bg3);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  flex-shrink: 0;
}

.lb-mobile-logged-text {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: #dce6ef;
}

.lb-mobile-more {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.lb-cast-list {
  display: flex;
  flex-direction: column;
}

.lb-cast-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  padding: 0.65rem 0;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.lb-cast-row:last-of-type {
  border-bottom: none;
}

.lb-cast-photo {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-cast-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lb-cast-photo-ph {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
}

.lb-cast-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.lb-cast-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}

.lb-cast-role {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.3;
}

.lb-cast-chevron {
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.lb-open-in {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.lb-open-in-head {
  margin-bottom: 0.65rem;
}

.lb-open-in-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.lb-open-in-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lb-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.lb-open-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lb-intro {
  margin-bottom: 0.5rem;
}

.lb-title-year {
  font-size: 1.2rem;
  font-family: inherit;
}

.lb-backdrop-wrap {
  position: relative;
  height: 340px;
  overflow: hidden;
  background: var(--bg2);
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  filter: brightness(0.35);
}

.lb-backdrop-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 30%, var(--bg) 100%);
}

.lb-page-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  position: relative;
}

.lb-title-block {
  text-align: center;
  margin: -2rem 0 1.5rem;
  position: relative;
  z-index: 2;
}

.lb-title-block h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.lb-title-block .lb-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

.lb-title-block .lb-meta a {
  color: #6eb4ff;
}

.lb-layout {
  display: grid;
  grid-template-columns: 200px 1fr 260px;
  grid-template-rows: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

.lb-poster-desktop {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.lb-intro {
  grid-column: 2;
  grid-row: 1;
  margin-bottom: 0;
}

.lb-main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
}

.lb-sidebar {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.lb-poster-desktop img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}

.lb-poster img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: block;
}

.lb-poster .placeholder {
  aspect-ratio: 2/3;
}

.lb-stats {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.lb-tagline {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.lb-overview {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #dce6ef;
  margin: 0 0 1.25rem;
}

.lb-tabs {
  display: flex;
  gap: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.lb-tab {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 0;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.lb-tab:hover {
  color: var(--text);
}

.lb-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.lb-tab-panel { display: none; }
.lb-tab-panel.active { display: block; }

.lb-cast-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lb-cast-pill {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.lb-cast-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lb-crew-list, .lb-details-list {
  font-size: 0.88rem;
  line-height: 1.8;
}

.lb-crew-list dt, .lb-details-list dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.75rem;
}

.lb-crew-list dd, .lb-details-list dd {
  margin: 0;
}

.lb-genre-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lb-genre-pill {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.lb-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lb-sidebar-card {
  background: #1a2330;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.lb-action-row {
  display: flex;
  justify-content: space-around;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.lb-sidebar-actions {
  display: flex;
  justify-content: space-around;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.lb-action-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.lb-action-btn .icon {
  font-size: 1.4rem;
}

.lb-action-btn:hover, .lb-action-btn.active {
  color: var(--accent);
}

.lb-action-btn.active .icon {
  filter: none;
}

.lb-rated-section {
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.lb-rated-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.lb-star-picker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.lb-star-unit {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  flex-shrink: 0;
}

.lb-star-unit .star-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  color: #3a4550;
  pointer-events: none;
}

.lb-star-unit .star-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.lb-star-unit .star-fill > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
}

.lb-star-unit.half .star-fill {
  width: 50%;
}

.lb-star-unit.full .star-fill {
  width: 100%;
}

.lb-picker-value {
  width: 100%;
  text-align: center;
  font-size: 0.85rem;
  color: var(--accent);
  margin-top: 0.35rem;
  font-weight: 600;
}

.lb-ratings-body-simple {
  justify-content: center;
}

.lb-ratings-imdb {
  margin-top: 0;
}

.lb-imdb-extras {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.lb-avg-rating .rating-scale {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

.lb-cast-more,
.lb-cast-less {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 3px;
  color: var(--accent);
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.lb-cast-more:hover,
.lb-cast-less:hover {
  border-color: var(--accent);
}

.lb-menu-links {
  display: flex;
  flex-direction: column;
}

.lb-menu-links button {
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: left;
  padding: 0.65rem 0;
  font-size: 0.82rem;
  cursor: pointer;
}

.lb-menu-links button:first-child {
  border-top: none;
}

.lb-menu-links button:hover:not(:disabled) {
  color: var(--text);
}

.lb-menu-links button:disabled {
  opacity: 0.4;
  cursor: default;
}

.lb-ratings-box {
  background: #1a2330;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.lb-ratings-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.lb-ratings-body {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.lb-histogram {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 48px;
  flex: 1;
}

.lb-hist-bar {
  flex: 1;
  background: #4a5560;
  border-radius: 1px 1px 0 0;
  min-height: 4px;
  transition: height 0.2s;
}

.lb-hist-bar.yours {
  background: var(--accent);
}

.lb-avg-rating {
  text-align: center;
  min-width: 52px;
}

.lb-avg-rating .big {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.lb-avg-rating .stars {
  font-size: 0.7rem;
  color: var(--accent);
  margin-top: 0.2rem;
}

.lb-progress-text {
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.lb-progress-bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.lb-progress-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.activity-modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 320px;
  overflow-y: auto;
}

.activity-log-row {
  padding: 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.88rem;
}

.activity-log-row:hover {
  border-color: var(--accent);
}

.list-pick-btn {
  display: block;
  width: 100%;
  margin-bottom: 0.5rem;
  text-align: left;
}

.lb-rating-row {
  text-align: center;
  margin-bottom: 1rem;
}

.lb-rating-row .stars {
  font-size: 1.5rem;
  color: var(--accent);
}

.lb-sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.lb-sidebar-links a, .lb-sidebar-links button {
  background: none;
  border: none;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  padding: 0;
  font-size: 0.82rem;
}

.lb-sidebar-links a:hover, .lb-sidebar-links button:hover {
  color: var(--text);
}

.lb-season-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
}

.tv-sticky-bar .lb-season-select {
  margin-bottom: 0;
}

.tv-sticky-bar .lb-season-select select,
.tv-sticky-bar #tv-jump-episodes {
  height: 2.125rem;
  box-sizing: border-box;
}

.tv-sticky-bar #tv-jump-episodes {
  align-self: center;
  display: inline-flex;
  align-items: center;
}

.lb-complete-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(76, 175, 80, 0.15);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.diary-group-actions {
  margin: 0.5rem 0 0.75rem;
}

.lb-season-select select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
}

.lb-episodes { margin-top: 1rem; }

.lb-episode {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(56, 66, 80, 0.4);
  font-size: 0.88rem;
}

.lb-episode label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.lb-footer-meta {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.lb-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  margin-bottom: 1rem;
  padding: 0;
}

.lb-back-btn:hover { color: var(--text); }

/* Person page */

.person-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.person-main-header {
  margin-bottom: 1.25rem;
}

.person-main-header .sub {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.person-main-header h1 {
  font-size: 2rem;
  margin: 0;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.filter-bar label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-bar select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.3rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
}

.poster-grid-dense {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.poster-grid-dense .poster-card img,
.poster-grid-dense .poster-card .placeholder {
  width: 100%;
}

.poster-grid-dense .poster-card .title,
.poster-grid-dense .poster-card .meta {
  display: none;
}

.poster-grid-dense .poster-card.watched::after {
  content: "✓";
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: var(--accent);
  color: #041208;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.poster-grid-dense .poster-card {
  position: relative;
}

.person-sidebar {
  position: sticky;
  top: 4rem;
}

.person-sidebar img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  background: var(--bg3);
}

.person-bio {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #dce6ef;
  margin-bottom: 1rem;
}

.person-bio .more-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-size: 0.82rem;
}

.person-progress-box {
  background: #1a2330;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

.person-progress-box .pct {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.person-progress-box .label {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.5rem 0;
}

.person-progress-box .bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.person-progress-box .bar span {
  display: block;
  height: 100%;
  background: #4a9eff;
}

/* Person page — Letterboxd-style overview */
html.person-detail-active,
body.person-detail-active {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100%;
}

#view-person-detail.detail-view.active {
  margin: 0 !important;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

body.person-detail-active .topbar {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  box-sizing: border-box;
}

body.person-detail-active .nav {
  max-width: 100%;
  box-sizing: border-box;
}

body.person-detail-active main {
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.person-page {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 0.75rem 0.65rem 2rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

.person-overview,
.person-full,
.person-credit-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.person-section-preview {
  margin: 0.5rem 0 0.75rem;
  padding-bottom: 0.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.person-page .person-section-preview .poster-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  width: max-content;
  max-width: none;
  min-width: 0;
  overflow: visible;
  scroll-snap-type: none;
  padding-bottom: 0.35rem;
}

.person-page .person-section-preview .poster-card {
  flex: 0 0 56px;
  width: 56px;
  max-width: 56px;
  min-width: 56px;
}

.person-page .person-section-preview .poster-card img,
.person-page .person-section-preview .poster-card .placeholder {
  width: 56px;
  max-width: 56px;
}

.person-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.person-hero-photo {
  flex-shrink: 0;
  width: 88px;
}

.person-hero-photo img,
.person-hero-photo .placeholder {
  width: 88px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg3);
}

.person-hero-body {
  flex: 1;
  min-width: 0;
}

.person-hero-body h1 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.person-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
}

.person-overview.hidden,
.person-full.hidden {
  display: none;
}

.person-page.person-full-active .person-hero,
.person-page.person-full-active #person-back {
  display: none;
}

.person-description {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.person-description-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.person-description-toggle:hover .person-description-title {
  color: var(--accent);
}

.person-description-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.person-description-chevron {
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.person-description:not(.is-collapsed) .person-description-chevron {
  transform: rotate(90deg);
}

.person-description.is-collapsed .person-description-text {
  --bio-line: 1.55em;
  max-height: calc(var(--bio-line) * 5);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--bio-line) * 3.5),
    rgba(0, 0, 0, 0.72) calc(var(--bio-line) * 4),
    rgba(0, 0, 0, 0.28) calc(var(--bio-line) * 4.5),
    transparent calc(var(--bio-line) * 5)
  );
  mask-image: linear-gradient(
    to bottom,
    #000 0%,
    #000 calc(var(--bio-line) * 3.5),
    rgba(0, 0, 0, 0.72) calc(var(--bio-line) * 4),
    rgba(0, 0, 0, 0.28) calc(var(--bio-line) * 4.5),
    transparent calc(var(--bio-line) * 5)
  );
}

.person-description:not(.is-collapsed) .person-description-text {
  max-height: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.person-description.is-short .person-description-toggle {
  cursor: default;
  pointer-events: none;
}

.person-description.is-short .person-description-chevron {
  display: none;
}

.person-description.is-collapsed .person-description-text {
  cursor: pointer;
}

.person-description-text {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  text-align: justify;
  hyphens: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.person-credit-section {
  margin-bottom: 0.25rem;
}

.person-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.person-section-head:hover {
  color: var(--accent);
}

.person-section-title {
  font-size: 0.92rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-section-pct {
  font-size: 0.82rem;
  color: var(--muted);
  flex-shrink: 0;
}

.person-section-empty {
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.person-full .filter-bar {
  max-width: 100%;
  box-sizing: border-box;
}

.person-full .poster-grid-dense {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0;
}

.person-full-title {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.person-full .person-progress-box {
  margin-top: 0;
  margin-bottom: 1rem;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "label pct"
    "bar bar";
  align-items: center;
  gap: 0.25rem 1rem;
}

.person-full .person-progress-box .label {
  grid-area: label;
  margin: 0;
}

.person-full .person-progress-box .pct {
  grid-area: pct;
  font-size: 1.25rem;
  text-align: right;
}

.person-full .person-progress-box .bar {
  grid-area: bar;
}

@media (min-width: 701px) {
  .person-hero-photo {
    width: 120px;
  }

  .person-hero-photo img,
  .person-hero-photo .placeholder {
    width: 120px;
  }

  .person-hero-body h1 {
    font-size: 1.75rem;
  }

  .person-page .person-section-preview .poster-card {
    flex: 0 0 72px;
    width: 72px;
    max-width: 72px;
    min-width: 72px;
  }

  .person-page .person-section-preview .poster-card img,
  .person-page .person-section-preview .poster-card .placeholder {
    width: 72px;
    max-width: 72px;
  }
}

@media (max-width: 700px) {
  .person-page {
    padding: 0.5rem 0.65rem 1.5rem;
  }

  .person-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .person-hero-body {
    width: 100%;
  }

  .person-hero-actions {
    justify-content: center;
  }

  .person-full .filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.5rem;
  }

  .person-full .filter-bar label {
    font-size: 0.62rem;
    min-width: 0;
  }

  .person-full .filter-bar select {
    min-width: 0;
    max-width: 100%;
  }

  .poster-grid-dense {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .poster-grid-dense { grid-template-columns: repeat(3, 1fr); }
  .lb-layout {
    grid-template-columns: 120px minmax(0, 1fr) 220px;
    gap: 1rem;
  }
  .lb-poster-desktop { grid-column: 1; grid-row: 1 / span 2; }
  .lb-intro { grid-column: 2; grid-row: 1; }
  .lb-main { grid-column: 2; grid-row: 2; min-width: 0; }
  .lb-sidebar { grid-column: 3; grid-row: 1 / span 2; }
}

@media (max-width: 700px) {
  .lb-layout {
    display: flex !important;
    flex-direction: column;
    gap: 0;
  }
  .poster-grid-dense { grid-template-columns: repeat(3, 1fr); }
}

/* Hero carousel */
.hero-label {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.hero-dots {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 0;
}

.hero-dot.active {
  background: var(--accent);
}

/* Diary activity */
.diary-filters { margin-bottom: 1rem; }

.activity-badge {
  display: inline-block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-bottom: 0.25rem;
}

.activity-badge.film {
  background: rgba(0, 224, 84, 0.15);
  color: var(--accent);
}

.activity-badge.tv {
  background: rgba(74, 158, 255, 0.15);
  color: #4a9eff;
}

.activity-row h3 { margin: 0.15rem 0; }

/* Episode cards (IMDb-style) */
.episode-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.episode-card:hover {
  background: rgba(255, 255, 255, 0.02);
}

.episode-card.watched {
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}

.episode-still img,
.episode-still .placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg3);
}

.episode-head {
  margin-bottom: 0.35rem;
}

.episode-title {
  margin-left: 0.5rem;
  font-weight: 600;
}

.episode-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.episode-overview {
  font-size: 0.85rem;
  color: #dce6ef;
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.episode-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.episode-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.log-tv-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.log-tv-episodes {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.75rem;
}

.log-tv-season {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0;
}

.log-tv-season:last-child {
  border-bottom: none;
}

.log-tv-season-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.log-tv-season-summary::-webkit-details-marker {
  display: none;
}

.log-tv-season-eps {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.35rem 0 0.5rem 1rem;
}

.log-tv-ep-item {
  align-items: flex-start;
  line-height: 1.35;
}

.modal-wide .log-tv-episodes {
  max-height: min(55vh, 520px);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

.btn-danger {
  background: #8b2635;
  border-color: #a83244;
  color: #fff;
}

.btn-danger:hover {
  background: #a83244;
}

.hidden { display: none !important; }

#log-form textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

@media (max-width: 700px) {
  .episode-card { grid-template-columns: 1fr; }
  .episode-still { max-width: 200px; }
  .ep-detail-layout { grid-template-columns: 1fr !important; }
}

.lb-rating-source {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 0.25rem;
}

.lb-your-rating {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.ep-detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

.ep-detail-still img,
.ep-detail-still .placeholder {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg3);
}

.ep-detail-show {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.25rem;
}

.ep-detail-main h2 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
}

.ep-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
  align-items: center;
}

.ep-detail-meta a {
  color: #f5c518;
  font-weight: 600;
  font-size: 0.78rem;
}

.ep-detail-meta .imdb-meta-link {
  text-decoration: none;
}

.ep-detail-meta .imdb-meta {
  color: #f5c518;
}

.ep-detail-crew {
  font-size: 0.88rem;
  margin: 0 0 0.5rem;
  color: #dce6ef;
}

.ep-detail-overview h3,
.ep-detail-cast h3,
.ep-detail-user h3 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
}

.ep-detail-overview p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #dce6ef;
  margin: 0;
}

.ep-detail-cast .lb-cast-pill .muted {
  font-size: 0.72rem;
}

.ep-detail-user {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.ep-detail-user-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
}

/* Meta rows (Letterboxd-style) */
.lb-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lb-meta-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 0.5rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px dotted var(--border);
}

.lb-meta-row-block {
  display: block;
}

.lb-meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}

.lb-meta-dots {
  border-bottom: 1px dotted var(--border);
  margin-top: 0.55rem;
  min-width: 1rem;
}

.lb-meta-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.lb-meta-row-block .lb-meta-label {
  display: block;
  margin-bottom: 0.35rem;
}

.lb-pill {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  color: var(--text);
  text-decoration: none;
}

a.lb-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lb-alt-titles {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.lb-genres-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

.lb-ext-link {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  margin-left: 0.35rem;
}

.lb-ext-link:hover {
  color: var(--text);
}

.rating-num {
  color: var(--accent);
  font-size: 0.78rem;
}

/* Streaming-Anbieter (JustWatch via TMDB), ganz unten auf der Detailseite */
.wp-section {
  margin-top: 1.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.wp-compare-label {
  margin: 0.65rem 0 0.25rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wp-compare-label:first-child {
  margin-top: 0;
}

.wp-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wp-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
  gap: 0.35rem 0.5rem;
  padding: 0.28rem 0.45rem;
  border-radius: 6px;
}

.wp-label {
  flex: 0 0 3.6rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wp-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.wp-logo-link {
  display: block;
  line-height: 0;
}

.wp-logo {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg3);
}

.wp-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  color: var(--muted);
}

.wp-justwatch {
  align-self: flex-start;
  margin-top: 0.15rem;
  font-size: 0.68rem;
  color: var(--muted);
  text-decoration: none;
}

.wp-justwatch:hover {
  color: var(--text);
}

.wp-empty {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Variante A: Ampel */
.wp-ampel .wp-group-flatrate {
  background: rgba(0, 224, 84, 0.16);
}
.wp-ampel .wp-group-flatrate .wp-label {
  color: var(--accent);
}
.wp-ampel .wp-group-rent {
  background: rgba(255, 152, 0, 0.18);
}
.wp-ampel .wp-group-rent .wp-label {
  color: #ffb14a;
}
.wp-ampel .wp-group-buy {
  background: rgba(220, 70, 70, 0.18);
}
.wp-ampel .wp-group-buy .wp-label {
  color: #ff8a80;
}

/* Variante B: Relevanz, ohne Ampel */
.wp-relevance .wp-group-flatrate {
  background: rgba(0, 224, 84, 0.1);
}
.wp-relevance .wp-group-flatrate .wp-label {
  color: var(--accent);
  font-weight: 600;
}
.wp-relevance .wp-group-flatrate .wp-logo {
  box-shadow: 0 0 0 1px rgba(0, 224, 84, 0.35);
}
.wp-relevance .wp-group-rent {
  background: transparent;
}
.wp-relevance .wp-group-buy {
  background: transparent;
}
.wp-relevance .wp-group-buy .wp-label {
  color: #6d7d8c;
}
.wp-relevance .wp-group-buy .wp-logo,
.wp-relevance .wp-group-buy .wp-logo-fallback {
  opacity: 0.42;
  filter: grayscale(0.55);
}

@media (max-width: 700px) {
  .wp-section {
    margin-top: 1.1rem;
    padding-bottom: 0.35rem;
  }
}

/* Episode heatmap */
.heatmap-details {
  margin: 0 0 1rem;
}
.heatmap-details summary {
  cursor: pointer;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.tv-episodes-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.tv-episodes-heading {
  font-size: 1rem;
  margin: 0 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lb-heatmap-box {
  background: #1a2330;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.lb-heatmap-box--main {
  margin-bottom: 1.5rem;
  width: 100%;
}

.lb-heatmap-box--main .lb-heatmap {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.lb-heatmap-box--main .hm-cell {
  min-width: 32px;
  min-height: 26px;
  font-size: 0.62rem;
}

.lb-heatmap-box h4 {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.lb-heatmap {
  display: grid;
  gap: 2px;
  font-size: 0.58rem;
  overflow-x: auto;
}

.hm-cell {
  min-width: 28px;
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  border: none;
  padding: 0;
  font-size: 0.58rem;
  font-weight: 600;
  color: #111;
}

.hm-cell.hm-header {
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.55rem;
}

.hm-dgreen { background: #1a6b2e; color: #e8ffe8; }
.hm-green { background: #3d9e4a; color: #fff; }
.hm-yellow { background: #c4b820; color: #111; }
.hm-orange { background: #d97a2b; color: #111; }
.hm-red { background: #c0392b; color: #fff; }
.hm-empty { background: var(--bg3); color: var(--muted); }

button.hm-cell {
  cursor: pointer;
}

button.hm-cell:hover {
  outline: 1px solid var(--accent);
}

.hm-watched {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.syncro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.syncro-table th,
.syncro-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.syncro-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.syncro-table .syncro-actor {
  display: inline-block;
}

.syncro-meta,
.syncro-source {
  margin-top: 0.85rem;
  font-size: 0.85rem;
}

.sprecher-layout .sprecher-avatar {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 1rem;
}

.sprecher-birthday {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.syncro-credit-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.syncro-credit-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: inherit;
}

.syncro-credit-card:hover {
  border-color: var(--accent);
  background: var(--bg3);
}

.syncro-credit-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.syncro-credit-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.syncro-credit-type {
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.68rem;
}

/* Profile switcher */
.profile-switcher {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.profile-pill {
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  cursor: pointer;
}

.profile-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0, 224, 84, 0.1);
}

.profile-settings {
  margin-top: 0.5rem;
}

.profile-settings h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.95rem;
}

.profile-settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.5rem 0 1rem;
}

.profile-settings-form input[type="url"],
.profile-settings-form input[type="file"],
.profile-settings-form input[type="password"],
.profile-settings-form input[type="text"],
.profile-settings-form select {
  max-width: 32rem;
}

.profile-settings-form.settings-locked {
  opacity: 0.5;
  pointer-events: none;
}

.form-error {
  color: #ff6b6b;
  font-size: 0.85rem;
}

#tinder-partner-field.hidden,
#tinder-partner.hidden {
  display: none;
}

.tinder-filter.is-locked {
  opacity: 0.55;
}

.guest-mode .btn-primary,
.guest-mode .lb-action-btn,
.guest-mode .episode-watched-input,
.guest-mode .guest-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.guest-mode #profile-settings-view .btn,
.guest-mode #profile-settings-view .btn-primary {
  opacity: 1;
  pointer-events: auto;
}

.guest-mode #profile-settings-view input,
.guest-mode #profile-settings-view select {
  pointer-events: auto;
}

.guest-mode #profile-settings-view .settings-locked,
.guest-mode #profile-settings-view .settings-locked .btn,
.guest-mode #profile-settings-view .settings-locked .btn-primary,
.guest-mode #profile-settings-view .settings-locked input,
.guest-mode #profile-settings-view .settings-locked select {
  opacity: 0.5;
  pointer-events: none;
}

.friends-manage-list {
  list-style: none;
  margin: 0.55rem 0 0.9rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.friends-manage-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg3);
  border-radius: 8px;
}

.friends-manage-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}

.friends-remove-btn {
  flex-shrink: 0;
}

.friend-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: rgba(0, 224, 84, 0.14);
  color: #00e054;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
}

.stat-block-title .friend-initial {
  width: 1.45rem;
  height: 1.45rem;
  font-size: 0.7rem;
}

.profile-settings .stat-block {
  margin-top: 1.15rem;
}

.profile-settings .stat-block-title {
  margin: 0;
  font-size: 0.72rem;
}

.profile-settings #friends-settings-card .profile-settings-form {
  margin-bottom: 0;
}

.friend-vs-grid {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}

.friend-vs {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.65rem;
  padding: 0.5rem 0.6rem;
  background: var(--bg3);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.friend-vs-label {
  flex: 0 0 auto;
  color: var(--muted);
}

.friend-vs-value,
.friend-vs strong {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.friend-vs-activity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.25rem 0.65rem;
  align-items: baseline;
}

.friend-vs-activity .friend-vs-label {
  grid-column: 1;
}

.friend-vs-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
  min-width: 0;
}

.friend-vs-pair strong {
  font-size: 0.98rem;
  color: var(--text);
}

.friend-vs-pair span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-miss-label {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.friend-miss-row {
  margin: 0;
}

@media (max-width: 700px) {
  /* Nach Desktop-Regeln: muss gewinnen (Cascade). */
  .friend-vs {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .friend-vs-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .friend-vs-value,
  .friend-vs > strong {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .friend-vs-activity {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .friend-vs-pair span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-overflow: unset;
  }

  .stat-life-title,
  .profile-stats > h2,
  #view-profile h2 {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stat-block {
    overflow: hidden;
  }

  .stat-tv-open {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .friend-blind-card .title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    white-space: normal;
  }
}

/* Top lists */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.top-list-row {
  display: grid;
  grid-template-columns: 2.5rem 40px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.top-list-row:hover { background: var(--bg2); }
.top-list-row img { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; }
.top-rank { color: var(--muted); font-weight: 700; text-align: right; }
.top-imdb { color: var(--star); font-weight: 600; }
.top-list-tabs { margin-top: 0.35rem; margin-bottom: 0.5rem; }
.top-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.top-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.top-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  line-height: 1.3;
}
.top-badge.watched {
  background: rgba(76, 175, 80, 0.2);
  color: #8fd694;
}
.top-badge.watchlist {
  background: rgba(100, 149, 237, 0.2);
  color: #9eb8f0;
}

/* Tinder — Bumble/Tinder-style swipe cards */
html.tinder-active,
body.tinder-active {
  overflow: hidden;
  height: 100%;
  overscroll-behavior: none;
}

body.tinder-active main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-tinder.active {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

#view-tinder.active h2,
#view-tinder.active .tinder-toolbar {
  flex-shrink: 0;
}

.tinder-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.45rem;
  margin: 0 0 0.55rem;
}

.tinder-filter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem 0.15rem 0.75rem;
}

.tinder-filter > span {
  flex: 0 0 auto;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tinder-toolbar select {
  flex: 1;
  min-width: 0;
  appearance: none;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  padding: 0.45rem 0;
  font-size: 16px;
  min-height: 2.4rem;
}

#view-tinder.active .tinder-card-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tinder-card-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 0;
  touch-action: none;
  width: 100%;
}

.tinder-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
}

.tinder-stage {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  flex: 1 1 auto;
  width: 100%;
  min-height: 300px;
  height: clamp(320px, 54vh, 540px);
  max-height: min(58vh, 540px);
}

.tinder-stage > .tinder-card {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.tinder-card-behind {
  pointer-events: none;
}

.tinder-card-depth-1 {
  transform: scale(0.97) translateY(6px);
  opacity: 0.88;
  z-index: 1;
}

.tinder-card-depth-2 {
  transform: scale(0.94) translateY(12px);
  opacity: 0.7;
  z-index: 0;
}

.tinder-card-top {
  z-index: 2;
}

.tinder-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform;
  touch-action: none;
}

.tinder-build {
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 400;
  vertical-align: middle;
}

.tinder-card.dragging { cursor: grabbing; transition: none; }
.tinder-card.swipe-left { transform: translateX(-120%) rotate(-18deg); opacity: 0; }
.tinder-card.swipe-right { transform: translateX(120%) rotate(18deg); opacity: 0; }

.tinder-card-bg {
  position: absolute;
  inset: 0;
  background: var(--bg3);
  pointer-events: none;
}

.tinder-card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tinder-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--bg3);
}

.tinder-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20,24,28,0.95) 0%, rgba(20,24,28,0.2) 45%, transparent 70%);
  pointer-events: none;
}

.tinder-partner-note {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  right: 0.85rem;
  z-index: 3;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(12, 18, 28, 0.88);
  border: 1px solid rgba(255, 183, 77, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.tinder-partner-note-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffb74d;
  margin-bottom: 0.35rem;
}

.tinder-partner-note-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #f3f7fb;
}

.tinder-comment-panel textarea {
  width: 100%;
  margin: 0.75rem 0 1rem;
  resize: vertical;
  min-height: 5.5rem;
  font-size: 16px;
  line-height: 1.4;
}

html.tinder-comment-open,
html.tinder-comment-open body {
  overflow: auto;
  height: auto;
  touch-action: manipulation;
}

.tinder-stamp {
  position: absolute;
  top: 2rem;
  padding: 0.35rem 0.75rem;
  border: 3px solid;
  border-radius: 8px;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.tinder-stamp-like {
  left: 1.25rem;
  color: #4dff9a;
  border-color: #4dff9a;
  transform: rotate(-12deg);
}

.tinder-stamp-nope {
  right: 1.25rem;
  color: #ff6b6b;
  border-color: #ff6b6b;
  transform: rotate(12deg);
}

.tinder-card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.25rem;
  z-index: 2;
  pointer-events: auto;
}

.tinder-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.tinder-card-info h3,
.tinder-title-link {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  line-height: 1.2;
  text-align: left;
}

.tinder-title-link {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  display: block;
  width: 100%;
  position: relative;
  z-index: 4;
  touch-action: manipulation;
}

.tinder-title-link:hover {
  color: var(--accent);
}

.tinder-rating-badge {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--star);
  margin-bottom: 0.35rem;
}

.tinder-year { color: var(--muted); font-size: 1rem; font-weight: 400; }
.tinder-overview { margin: 0; font-size: 0.88rem; color: #dce6ef; line-height: 1.45; }

.tinder-actions-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
  padding: 0.15rem 0 0.35rem;
  touch-action: manipulation;
}

.tinder-action-btn {
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg2);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
}

.tinder-action-btn.tinder-action-sm {
  width: 2.65rem;
  height: 2.65rem;
  font-size: 1rem;
}

.tinder-action-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.tinder-action-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.tinder-action-btn.tinder-dislike { color: #ff6b6b; font-size: 1.4rem; }
.tinder-action-btn.tinder-like { color: #ff6b9d; font-size: 1.5rem; }
.tinder-action-btn.tinder-undo { color: #f5c542; }
.tinder-action-btn.tinder-log { font-size: 1.25rem; font-weight: 600; }
.tinder-action-btn.tinder-recommend { font-size: 1rem; }

.tinder-match-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tinder-match-fade-in 0.35s ease;
}

.tinder-match-overlay.hidden { display: none; }

.tinder-match-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 18, 0.92);
}

.tinder-match-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  animation: tinder-match-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tinder-match-label {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 800;
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, #ff6b9d, #ffd166, #4dff9a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.02em;
}

.tinder-match-posters {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.tinder-match-poster-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 120px;
}

.tinder-match-poster-wrap img {
  width: 110px;
  height: 165px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.tinder-match-poster-wrap span {
  font-size: 0.8rem;
  color: var(--muted);
}

.tinder-match-heart {
  font-size: 2.5rem;
  color: #ff6b9d;
  animation: tinder-heart-pulse 1s ease infinite;
}

@keyframes tinder-match-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes tinder-match-pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes tinder-heart-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.lists-tabs { margin-bottom: 1rem; }

@media (max-width: 700px) {
  body.tinder-active main {
    padding: 0 max(0.75rem, var(--safe-right)) 0.35rem max(0.75rem, var(--safe-left));
    max-width: none;
  }

  #view-tinder.active {
    margin: 0;
    padding: 0;
  }

  #view-tinder.active h2 {
    display: none;
  }

  #view-tinder.active .tinder-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 0 0.4rem;
    padding: max(2.6rem, calc(var(--safe-top) + 0.75rem)) 0 0.45rem;
    background: var(--bg);
    gap: 0.4rem;
  }

  .tinder-card-wrap { max-width: none; }

  .tinder-stage {
    flex: 1;
    min-height: 260px;
    height: auto;
    max-height: none;
  }

  .tinder-stack { gap: 0.55rem; }
  .tinder-action-btn { width: 3.2rem; height: 3.2rem; }
  .tinder-action-btn.tinder-action-sm { width: 2.55rem; height: 2.55rem; }
}

/* TV episodes */
.tv-season-block {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  overflow: hidden;
}

.tv-season-block > summary.tv-season-header {
  margin: 0;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px solid transparent;
}

.tv-season-block[open] > summary.tv-season-header {
  border-bottom-color: var(--border);
}

.tv-season-block > summary.tv-season-header::-webkit-details-marker {
  display: none;
}

.tv-season-episodes {
  padding: 0.5rem 0.75rem 0.75rem;
}

.tv-season-header {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
}
.episode-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: var(--bg2);
  border-radius: var(--radius);
}
.episode-bulk-date-input {
  max-width: 11rem;
}
.episode-bulk-date-input:disabled {
  opacity: 0.45;
}
.tv-sticky-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Diary bulk */
.diary-bulk-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Person search */
.search-row-person img.person-thumb { border-radius: 50%; width: 48px; height: 48px; object-fit: cover; }

.ep-detail-ratings .lb-ratings-box { margin-top: 0.75rem; }

/* TV track fullscreen overlay */
.tv-track-overlay {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
}
.tv-track-overlay.hidden { display: none; }

body.tv-track-active { overflow: hidden; }

.tv-track-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tv-track-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
}
.tv-track-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tv-track-episodes {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}
.tv-track-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}
.tv-track-footer label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.tv-track-footer select,
.tv-track-footer input[type="date"] {
  min-width: 8rem;
}
.tv-track-people-wrap {
  width: 100%;
}
.tv-track-people-wrap .log-people {
  margin: 0;
  gap: 0.35rem;
}
.tv-track-tags-field {
  flex: 1 1 12rem;
  min-width: 10rem;
}
.tv-track-footer input[type="text"] {
  width: 100%;
  min-height: 2.05rem;
  padding: 0.32rem 0.5rem;
  font-size: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
}

@media (max-width: 700px) {
  .tv-track-overlay {
    position: fixed;
    inset: 0;
    border: none;
    border-radius: 0;
  }
}

@media (min-width: 701px) {
  .tv-track-overlay:not(.hidden) {
    position: fixed;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
    width: min(720px, calc(100vw - 2rem));
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  }
}

/* Diary episode groups */
.diary-group-hint {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
}
.diary-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
  max-height: 60vh;
  overflow-y: auto;
}
.diary-group-ep {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2.5rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.diary-group-ep:hover { background: var(--bg); }

.lb-backdrop-wrap.log-page-hero { height: 132px; }
.log-page-inner {
  max-width: 28rem;
  margin: -2.75rem auto 0;
  padding: 0 0.85rem 5.5rem;
}
.log-page-inner.log-page-split {
  max-width: 52rem;
  display: grid;
  grid-template-columns: minmax(0, 28rem) minmax(16rem, 1fr);
  gap: 0.85rem;
  align-items: start;
}
.log-comments {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.log-comments h2 {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.log-comment {
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.log-comment-meta {
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.75rem;
}
.log-comment-body {
  margin: 0;
  white-space: pre-wrap;
}
.log-comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.log-comment-form textarea {
  font-size: 16px;
  width: 100%;
}
@media (max-width: 700px) {
  .log-page-inner.log-page-split {
    grid-template-columns: 1fr;
    max-width: 28rem;
  }
}
.log-page-card {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  position: relative;
  z-index: 2;
}
.log-page-card-stack { flex-direction: column; }
.log-page-head {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  width: 100%;
}
.log-page-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}
.log-page-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: flex-end;
}
.log-page-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.log-page-field-full { width: 100%; }
.log-page-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
}
.log-page-form .checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
}
.log-page-form .checkbox input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  flex: 0 0 auto;
}
.log-page-form input[type="date"],
.log-page-form input[type="text"],
.log-page-form select,
.log-page-form textarea {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.32rem 0.5rem;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.2;
  min-height: 2.05rem;
  width: auto;
  max-width: 100%;
}
.log-page-form input[type="date"] {
  width: 10.4rem;
  padding-right: 0.4rem;
}
.log-page-form input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.15em;
}
.log-page-form input[type="date"]::-webkit-calendar-picker-indicator {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.7;
  padding: 0;
  margin: 0;
}
.log-page-form select {
  width: 5.1rem;
  padding-right: 1.45rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23b8cadb' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
  background-size: 10px 7px;
}
.log-page-form input[type="text"],
.log-page-form textarea {
  width: 100%;
}
.log-page-form textarea {
  min-height: 4rem;
  resize: vertical;
  line-height: 1.4;
}
.log-page-people-wrap { width: 100%; }
.log-page-form .log-people {
  margin: 0;
  gap: 0.35rem;
}
.log-person-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.18rem 0.5rem 0.18rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}
.log-person-chip input {
  width: 0.85rem;
  height: 0.85rem;
  margin: 0;
  accent-color: var(--accent);
}
.log-person-chip:has(input:checked) {
  border-color: var(--accent-dim);
  background: rgba(0, 224, 84, 0.08);
}
.log-page-status { margin: 0; font-size: 0.8rem; }
.log-page-poster {
  flex: 0 0 68px;
  width: 68px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.log-page-poster img,
.log-page-poster .placeholder {
  display: block;
  width: 68px;
  height: 102px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg3);
}
.log-page-body { flex: 1; min-width: 0; }
.log-page-kicker {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.log-page-body h1,
.log-page-card > h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  line-height: 1.25;
  margin: 0;
}
.log-page-year { font-size: 0.9rem; font-family: inherit; }
.log-page-stars {
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.log-page-unrated { margin: 0 0 0.5rem; }
.log-page-review {
  white-space: pre-wrap;
  line-height: 1.45;
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
}
.log-page-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}
.log-page-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.log-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.log-page-ep-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 100%;
  margin: 0.35rem 0 0.55rem;
}
.log-page-ep {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  width: 100%;
  min-height: 2.1rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-size: 0.88rem;
}
.log-page-ep:hover { background: var(--bg3); }

@media (max-width: 700px) {
  .lb-backdrop-wrap.log-page-hero { height: 96px; }
  .log-page-inner {
    margin-top: -2.1rem;
    padding: 0 0.7rem calc(5.5rem + var(--safe-bottom));
  }
  .log-page-card { padding: 0.65rem; }
  .log-page-poster,
  .log-page-poster img,
  .log-page-poster .placeholder {
    width: 60px;
    height: 90px;
  }
  .log-page-form input[type="date"] { width: 9.6rem; }
}

/* Stremio queue */
.stremio-queue-list { display: flex; flex-direction: column; gap: 0.75rem; }
.stremio-q-row { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.65rem 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.stremio-q-check { padding-top: 0.35rem; }
.stremio-q-poster { width: 48px; height: 72px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #222; }
.stremio-q-poster--empty { display: block; }
.stremio-q-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.stremio-q-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.35rem; }

/* Letterboxd sync settings */
#letterboxd-sync-card .lb-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
  color: var(--muted, #9a9a9a);
  font-size: 0.92rem;
}
#letterboxd-sync-card .stat-block-title {
  color: #00e054;
}

/* Stremio series queue */
.stremio-ep-details { margin: 0.35rem 0; }
.stremio-ep-details summary { cursor: pointer; color: var(--muted, #9a9a9a); font-size: 0.9rem; }
.stremio-ep-list { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.4rem; max-height: min(360px, 55vh); overflow: auto; padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px)); }
.stremio-ep-row { display: flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; color: var(--muted, #9a9a9a); }
.stremio-ep-repaired {
  color: var(--muted, #9a9a9a);
  font-style: italic;
  font-weight: 400;
  font-size: 0.82em;
}
.stremio-ep-unmappable {
  color: #c9a227;
  font-size: 0.82em;
}
.stremio-ep-row--unmappable { opacity: 0.72; }
.stremio-q-series .stremio-q-meta strong { color: #00e054; }
.stremio-ep-block { display: flex; flex-direction: column; gap: 0.2rem; }
.stremio-date-choice {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.15rem 0 0.25rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg2, #1b1b1b);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--muted, #9a9a9a);
}
.stremio-ep-block .stremio-date-choice {
  margin-left: 1.35rem;
  background: var(--bg3, #242424);
}
.stremio-date-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  color: var(--text, #eee);
}
.stremio-date-field input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg3, #242424);
  border: 1px solid var(--border, #2a2a2a);
  color: var(--text, #eee);
  border-radius: 6px;
  padding: 0.28rem 0.4rem;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.2;
  min-height: 2.15rem;
  width: 10.6rem;
  max-width: 100%;
}
.stremio-date-choice .stremio-date-field input[type="date"],
.stremio-ep-block .stremio-date-field input[type="date"] {
  background: var(--bg2, #1b1b1b);
}
.stremio-date-field input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  min-height: 1.15em;
}
.stremio-date-field input[type="date"]::-webkit-calendar-picker-indicator {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.75;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
.stremio-date-opt { display: flex; align-items: center; gap: 0.35rem; }
.stremio-date-opt input[type="radio"] { accent-color: #00e054; }
.stremio-date-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.2rem 0;
}
.stremio-series-date-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0;
  padding: 0.4rem 0.5rem;
  background: var(--bg2, #1b1b1b);
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
}
.stremio-series-date-note {
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 0.15rem 0 0.35rem;
}

#view-admin {
  padding-bottom: calc(1.5rem + var(--safe-bottom));
}

#view-admin .search-tabs {
  flex-wrap: wrap;
}

#admin-status {
  min-height: 1.2em;
  white-space: pre-wrap;
  word-break: break-word;
}

.admin-ok { color: var(--accent); }
.admin-warn { color: #e8c547; }
.admin-err { color: #ff6b6b; }

.admin-pill {
  display: inline-block;
  margin: 0 0.35rem 0.25rem 0;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg3);
  font-size: 0.75rem;
}

.admin-pill.admin-ok {
  border-color: rgba(0, 224, 84, 0.45);
  color: var(--accent);
}

.admin-pill.admin-warn {
  border-color: rgba(232, 197, 71, 0.5);
  color: #e8c547;
}

.admin-pill.admin-err {
  border-color: rgba(255, 107, 107, 0.5);
  color: #ff6b6b;
}

.admin-row {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
  overflow: hidden;
}

.admin-row-head {
  display: grid;
  grid-template-columns: minmax(6rem, 1.2fr) minmax(5rem, 0.8fr) auto minmax(7rem, 1fr);
  gap: 0.45rem 0.75rem;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--bg3);
  cursor: pointer;
  list-style: none;
}

.admin-row-head::-webkit-details-marker { display: none; }

.admin-name { font-weight: 600; }

.admin-row-body {
  padding: 0.75rem 0.9rem 1rem;
}

.admin-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.admin-pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0.25rem 0;
}

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.7rem;
  background: var(--bg3);
}

.admin-reopened td { color: #e8c547; }

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: end;
  margin: 0.5rem 0 0.85rem;
}

.admin-filters select,
.admin-inline-form select,
.admin-inline-form input {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.55rem;
}

.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.admin-actions { margin-top: 0.75rem; }

.admin-probe {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.admin-sub {
  margin: 1.1rem 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

@media (max-width: 700px) {
  .admin-row-head {
    grid-template-columns: 1fr 1fr;
  }
}
