:root {
  /* Identité de marque SOVNGE — fixe, jamais réécrite par un thème utilisateur (voir applyTheme() dans app.js). */
  --sovnge-prune: #634B66;
  --sovnge-lavender: #D4C5E2;
  --sovnge-blue: #628395;
  --sovnge-gold: #F3DE8A;
  --sovnge-raspberry: #ED254E;
  color-scheme: light;
  --bg: #F0EBE3;
  --surface: #F7F3EB;
  --surface-strong: #ffffff;
  --ink: #251F27;
  --ink-soft: #3E3541;
  --line: #DACCE8;
  --accent: #634B66;
  --accent-dark: #4a2f4d;
  --accent-soft: #ecdff5;
  --cta-text: #F3DE8A;
  --gold: #F3DE8A;
  --rose: #ED254E;
  --sky: #628395;
  --shadow: 0 18px 48px rgba(37, 31, 39, 0.1);
  --radius: 8px;
  --poster-w: 100%;
  --poster-h: auto;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% -10%, rgba(98, 131, 149, 0.22), transparent 24rem),
    radial-gradient(circle at 88% 12%, rgba(99, 75, 102, 0.09), transparent 20rem),
    linear-gradient(180deg, #ffffff 0, var(--bg) 20rem),
    var(--bg);
  color: var(--ink);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 18% -10%, rgba(148, 163, 184, 0.12), transparent 24rem),
    radial-gradient(circle at 88% 12%, rgba(244, 114, 182, 0.08), transparent 20rem),
    linear-gradient(180deg, #0f172a 0, var(--bg) 22rem),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

code {
  border-radius: 4px;
  background: rgba(34, 33, 31, 0.08);
  padding: 0.05rem 0.24rem;
  font-size: 0.92em;
}

.loading-screen {
  display: grid;
  min-height: 100vh;
  align-content: center;
  justify-items: center;
  gap: 1rem;
  background: var(--bg);
  color: var(--ink-soft);
}

.loading-badge {
  width: 72px;
  height: 72px;
  animation: loading-pulse 1.8s ease-in-out infinite;
}

.loading-badge svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

@keyframes loading-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.07); opacity: 0.82; }
}

.loading-name {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.loading-caption {
  display: flex;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.loading-dots span {
  opacity: 0;
  animation: loading-dot-fade 1.4s infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-dot-fade {
  0%, 80%, 100% { opacity: 0; }
  40% { opacity: 1; }
}

.loading-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 3rem 1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.loading-inline-ring {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
  border: 3px solid rgba(237, 37, 78, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.content {
  position: relative;
}

.page-loader {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  min-height: 20rem;
  background: rgba(240, 235, 227, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-radius: var(--radius);
}

html[data-theme="dark"] .page-loader {
  background: rgba(2, 6, 23, 0.75);
}

.page-loader-ring {
  width: 4.2rem;
  height: 4.2rem;
  border: 5px solid rgba(237, 37, 78, 0.18);
  border-top-color: var(--accent);
  border-right-color: var(--sky);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.page-loader span {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 0.9fr);
}

.auth-visual {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: end;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 4rem);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.58)),
    url("https://images.unsplash.com/photo-1615986201152-7686a4867f30?auto=format&fit=crop&w=1600&q=80")
      center/cover;
  color: #fff;
}

.auth-visual::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(15, 23, 42, 0.78), transparent 56%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.36), transparent 45%);
}

.auth-copy {
  position: relative;
  min-width: 0;
  max-width: 44rem;
}

.brand-mark {
  display: block;
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.auth-features {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  max-width: 44rem;
  min-width: 0;
  margin-top: 2.2rem;
}

.auth-feature {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(2px);
}

.auth-feature svg {
  width: 1.6rem;
  height: 1.6rem;
  color: #fff;
}

.auth-feature strong {
  font-size: 0.92rem;
  color: #fff;
}

.auth-feature span {
  font-size: 0.8rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
}

.auth-beta-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.6rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(237, 37, 78, 0.16);
  border: 1px solid rgba(237, 37, 78, 0.5);
  color: var(--sovnge-raspberry);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.auth-beta-notice {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(237, 37, 78, 0.08);
  border: 1px solid rgba(237, 37, 78, 0.28);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.5;
}

.auth-free-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.6rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  background: rgba(243, 222, 138, 0.18);
  border: 1px solid rgba(243, 222, 138, 0.5);
  color: var(--sovnge-gold);
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft, rgba(0, 0, 0, 0.12));
}

.btn-sovnge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  cursor: not-allowed;
  opacity: 0.65;
}

.auth-sovnge-hint {
  margin: 0.5rem 0 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
  text-align: center;
}

.auth-method-tabs {
  margin: 1rem 0 0.4rem;
}

.auth-passphrase-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
}

.auth-passphrase-box code {
  font-size: 1rem;
  font-weight: 800;
  word-break: break-all;
  color: var(--accent-dark);
}

.auth-copy h1,
.section-heading h1,
.page-title h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 38rem;
  margin: 1.2rem 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.08rem;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-box {
  width: min(100%, 28rem);
}

.auth-box h2,
.settings-block h3,
.stat-card strong,
.rail-heading h2 {
  margin: 0;
}

.auth-box p {
  margin: 0.5rem 0 1.5rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.auth-form,
.settings-form {
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.input,
.select {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0.72rem 0.85rem;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.input:focus,
.select:focus,
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.66rem 0.9rem;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: var(--cta-text);
  font-weight: 900;
}

.btn.primary:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.btn.ghost:hover {
  border-color: var(--accent);
}

.btn.subtle {
  border-color: transparent;
  background: rgba(148, 163, 184, 0.22);
  color: var(--accent-dark);
}

.btn.danger {
  background: var(--rose);
}

.btn.danger:hover {
  background: #B91C3D;
}

.btn-lg {
  min-height: 3rem;
  padding: 0.8rem 1.35rem;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 26px rgba(185, 28, 61, 0.28);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
  padding: 0.35rem 0;
}

.hint,
.error,
.empty {
  color: var(--ink-soft);
  line-height: 1.55;
}

.error {
  color: var(--rose);
  font-weight: 700;
}

.notice {
  color: var(--accent);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: auto minmax(16rem, 1fr) auto;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid rgba(15, 23, 42, 0.09);
  background: rgba(255, 255, 255, 0.92);
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .topbar {
  border-bottom-color: var(--line);
  background: rgba(2, 6, 23, 0.9);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 12rem;
}

.brand-symbol {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 900;
}

.topbar-beta-badge {
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.58rem;
}

.brand-caption {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0.72rem 0.85rem;
  outline: none;
}

html[data-theme="dark"] .search-input {
  background: rgba(15, 23, 42, 0.9);
}

.user-menu {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 0.65rem;
}

.avatar {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.layout {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
  padding: clamp(1rem, 3vw, 2rem);
}

.sidebar {
  position: sticky;
  top: 5.4rem;
  align-self: start;
}

.settings-block,
.platform-card,
.stat-card,
.banner,
.panel {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.07);
}

html[data-theme="dark"] .settings-block,
html[data-theme="dark"] .platform-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .banner,
html[data-theme="dark"] .panel {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.82);
  box-shadow: var(--shadow);
}

/* La nav garde toujours les couleurs de marque SOVNGE (prune/lavande), quel que soit le thème choisi. */
.nav {
  border: 1px solid rgba(99, 75, 102, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(212, 197, 226, 0.4), rgba(255, 255, 255, 0.84));
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.07);
}

html[data-theme="dark"] .nav {
  border-color: rgba(212, 197, 226, 0.28);
  background: linear-gradient(160deg, rgba(99, 75, 102, 0.38), rgba(15, 23, 42, 0.82));
  box-shadow: var(--shadow);
}

.nav {
  display: grid;
  gap: 1.1rem;
  padding: 0.45rem;
}

.nav-group {
  display: grid;
  gap: 0.35rem;
}

.nav-group-title {
  margin: 0;
  padding: 0 0.78rem 0.15rem;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
  opacity: 0.65;
}

.nav button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  padding: 0.72rem 0.78rem;
  text-align: left;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav button:hover {
  background: rgba(237, 37, 78, 0.12);
  color: var(--sovnge-raspberry);
  transform: translateX(2px);
}

.nav button[aria-current="page"] {
  background: var(--sovnge-prune);
  color: #fff;
}

.nav button strong:empty {
  display: none;
}

.settings-block {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
  padding: 1rem;
}

.settings-block h3 {
  font-size: 0.96rem;
}

.source-card {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.2), transparent 54%),
    rgba(255, 255, 255, 0.9);
}

html[data-theme="dark"] .source-card {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.14), transparent 54%),
    rgba(15, 23, 42, 0.86);
}

.source-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.source-status strong,
.source-status p {
  display: block;
}

.source-status p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
}

.source-dot {
  width: 0.72rem;
  height: 0.72rem;
  margin-top: 0.25rem;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(199, 137, 46, 0.14);
}

.source-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(237, 37, 78, 0.18);
}

.settings-row {
  display: grid;
  gap: 0.7rem;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.api-state {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.34rem 0.58rem;
  background: rgba(237, 37, 78, 0.16);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.api-state.ready {
  background: rgba(148, 163, 184, 0.26);
  color: var(--accent-dark);
}

.content {
  display: grid;
  align-content: start;
  align-self: start;
  gap: 1.25rem;
  min-width: 0;
}

.page-title,
.section-heading,
.rail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.page-title p,
.section-heading p,
.rail-heading p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
}

.page-title h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.section-heading h1 {
  font-size: clamp(1.75rem, 3vw, 2.8rem);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.24), transparent 42%),
    rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .banner {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.13), transparent 42%),
    rgba(15, 23, 42, 0.9);
}

.banner strong {
  display: block;
  margin-bottom: 0.25rem;
}

.banner p {
  margin: 0;
  color: var(--ink-soft);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.stat-card {
  min-height: 6.4rem;
  padding: 1rem;
}

.stat-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-card small {
  display: block;
  margin-top: 0.5rem;
  color: var(--ink-soft);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1.1rem;
}

.series-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.series-card:hover {
  border-color: rgba(237, 37, 78, 0.36);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.16);
  transform: translateY(-2px);
}

.series-card,
.recommendation-card {
  cursor: pointer;
}

.series-card button,
.series-card a,
.recommendation-card button,
.recommendation-card a {
  cursor: pointer;
}

.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(148, 163, 184, 0.58)),
    var(--accent);
  color: #fff;
}

.poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #251F27;
}

.poster-fallback {
  display: grid;
  height: 100%;
  place-items: center;
  padding: 1rem;
  font-size: 2.4rem;
  font-weight: 900;
  text-align: center;
}

.poster-status {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.28rem 0.48rem;
}

.poster-status.secondary {
  background: rgba(237, 37, 78, 0.92);
}

.poster-status.watched {
  background: rgba(237, 37, 78, 0.95);
}

.poster-status.watchlist {
  background: rgba(148, 163, 184, 0.95);
  color: var(--ink);
}

.poster-status.watching {
  background: rgba(15, 23, 42, 0.94);
}

.poster-status.dropped {
  background: rgba(244, 114, 182, 0.94);
}

.series-body {
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 0.8rem;
  min-width: 0;
  padding: 0.95rem;
}

.series-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.series-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill {
  font-size: 0.66rem;
  padding: 0.1rem 0.45rem;
  border-radius: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-pill--watched   { background: rgba(34,197,94,0.12);  color: #16a34a; }
.status-pill--watching  { background: rgba(59,130,246,0.12); color: #2563eb; }
.status-pill--watchlist { background: rgba(245,158,11,0.12); color: #d97706; }
.status-pill--dropped   { background: rgba(239,68,68,0.12);  color: #dc2626; }
.status-pill--caught-up { background: rgba(148,163,184,0.16); color: #475569; }

html[data-theme="dark"] .status-pill--watched   { color: #4ade80; }
html[data-theme="dark"] .status-pill--watching  { color: #60a5fa; }
html[data-theme="dark"] .status-pill--watchlist { color: #fbbf24; }
html[data-theme="dark"] .status-pill--dropped   { color: #f87171; }
html[data-theme="dark"] .status-pill--caught-up { color: #94a3b8; }

.overview {
  display: -webkit-box;
  margin: 0.65rem 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.provider-pills,
.card-actions,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.provider-pills {
  margin-top: 0.7rem;
}

.cast-line {
  display: grid;
  gap: 0.22rem;
  margin-top: 0.72rem;
  border-left: 3px solid var(--sky);
  padding-left: 0.62rem;
}

.cast-line span {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cast-line strong {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
}

.trailer-link {
  justify-self: start;
  width: 100%;
  border-color: var(--gold);
  background: var(--gold);
  color: #251F27;
  font-weight: 900;
}

.trailer-link:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.detail-page {
  display: grid;
  gap: 1rem;
}

.detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.detail-poster {
  min-height: 26rem;
  background: #251F27;
}

.detail-poster img,
.detail-poster .poster-fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-main {
  display: grid;
  align-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
}

.detail-main h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.detail-kicker {
  margin-top: 0;
}

.original-title {
  margin: 0.55rem 0 0;
  color: var(--ink-soft);
  font-weight: 800;
}

.detail-overview {
  max-width: 70ch;
  margin: 1rem 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

.detail-providers {
  margin-top: 1rem;
}

.detail-actions {
  max-width: 32rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  gap: 1rem;
}

.trailer-frame {
  overflow: hidden;
  margin-top: 0.85rem;
  border-radius: var(--radius);
  background: #251F27;
  aspect-ratio: 16 / 9;
}

.trailer-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.detail-facts {
  display: grid;
  gap: 0.55rem;
  margin: 0.85rem 0 0;
}

.detail-facts div {
  display: grid;
  grid-template-columns: minmax(8rem, 0.48fr) minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
}

.detail-facts dt {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-facts dd {
  margin: 0;
  font-weight: 850;
}

.detail-next {
  margin-top: 0.85rem;
  font-weight: 850;
}

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.cast-card {
  display: grid;
  grid-template-columns: 3.7rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.72);
  padding: 0.55rem;
}

.cast-photo {
  display: grid;
  width: 3.7rem;
  height: 3.7rem;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
}

.cast-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cast-card strong,
.cast-card span {
  display: block;
}

.cast-card span {
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.danger-pill {
  background: rgba(244, 114, 182, 0.14);
  color: var(--rose);
}

.detail-skeleton {
  min-height: 34rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eee7dc;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 0.28rem 0.48rem;
}

html[data-theme="dark"] .pill {
  background: rgba(148, 163, 184, 0.14);
  color: var(--ink);
}

html[data-theme="dark"] .detail-hero,
html[data-theme="dark"] .cast-card {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.88);
}

.pill.accent {
  background: rgba(212, 197, 226, 0.55);
  color: var(--sovnge-prune);
}

html[data-theme="dark"] .pill.accent {
  background: rgba(212, 197, 226, 0.22);
  color: var(--sovnge-lavender);
}

.card-actions {
  align-items: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.status-btn {
  min-height: 2.25rem;
  padding: 0.52rem 0.62rem;
  white-space: nowrap;
}

.status-btn.active {
  color: #fff;
}

.status-btn.active.watched {
  background: var(--accent);
}

.status-btn.active.watchlist {
  background: var(--sky);
}

.status-btn.active.watching {
  background: var(--gold);
}

.status-btn.active.dropped {
  background: var(--rose);
}

.pagination {
  justify-content: center;
  padding: 0.5rem 0 1.5rem;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.8rem;
}

.platform-card {
  display: grid;
  min-height: 8.4rem;
  gap: 0.65rem;
  align-content: space-between;
  padding: 1rem;
}

.platform-card button {
  justify-self: start;
}

.platform-card strong {
  font-size: 1.05rem;
}

.provider-logo {
  width: 3rem;
  height: 3rem;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 6px 14px rgba(42, 36, 28, 0.12);
}

.bar-list,
.recent-list {
  display: grid;
  gap: 0.7rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) 2rem;
  gap: 0.75rem;
  align-items: center;
}

.bar-track {
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e0d5;
}

html[data-theme="dark"] .bar-track {
  background: rgba(148, 163, 184, 0.16);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.recent-item {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.7rem;
}

.recent-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.recent-thumb {
  width: 3rem;
  height: 4.4rem;
  overflow: hidden;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.panel {
  padding: 1rem;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 0.72fr);
  gap: 1rem;
}

.theme-form {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.mode-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.08), transparent 48%),
    rgba(240, 235, 227, 0.68);
  padding: 0.75rem;
}

.mode-toggle input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

.mode-toggle strong,
.mode-toggle small {
  display: block;
}

.mode-toggle small {
  margin-top: 0.12rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

html[data-theme="dark"] .mode-toggle,
html[data-theme="dark"] .color-field,
html[data-theme="dark"] .compact-series,
html[data-theme="dark"] .platform-group {
  border-color: var(--line);
  background: rgba(2, 6, 23, 0.34);
}

.color-field {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) 3.25rem 5.8rem;
  gap: 0.65rem;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.68);
  padding: 0.65rem;
}

.color-field span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
}

.color-field input[type="color"] {
  width: 3.25rem;
  height: 2.35rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 0;
}

.color-field code {
  justify-self: end;
}

.theme-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.4rem;
  background: transparent;
  transition: border-color 140ms ease;
}

.theme-swatch:hover { border-color: var(--line); }
.theme-swatch.selected,
.theme-swatch:has(input:checked) { border-color: var(--accent); }

.swatch-preview {
  width: 100%;
  aspect-ratio: 3/2;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid;
  display: flex;
  flex-direction: column;
}

.swatch-band {
  height: 35%;
}

.swatch-surface {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
}

.swatch-pill {
  height: 5px;
  width: 40%;
  border-radius: 99px;
}

.swatch-line {
  height: 4px;
  width: 80%;
  border-radius: 99px;
  opacity: 0.35;
}

.swatch-line-short {
  width: 55%;
}

.swatch-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.preference-section {
  display: grid;
  gap: 0.65rem;
}

.preference-section > strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.setting-toggle {
  background: rgba(240, 235, 227, 0.52);
}

.danger-panel {
  border-color: rgba(157, 49, 64, 0.22);
  background:
    linear-gradient(135deg, rgba(157, 49, 64, 0.08), transparent 42%),
    var(--surface);
}

.recommendation-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 0.82fr) minmax(0, 1.18fr);
  gap: 1rem;
  align-items: start;
}

.questionnaire {
  display: grid;
  gap: 1rem;
}

.question-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.choice-field {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.choice-field legend {
  margin-bottom: 0.55rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.7rem, 1fr));
  gap: 0.55rem;
}

.choice-card {
  position: relative;
  display: grid;
  min-height: 4.55rem;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.72);
  padding: 0.65rem 0.7rem 0.65rem 2.05rem;
  cursor: pointer;
}

.choice-card input {
  position: absolute;
  top: 0.75rem;
  left: 0.7rem;
  accent-color: var(--accent);
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card strong {
  line-height: 1.2;
}

.choice-card small {
  margin-top: 0.24rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.35;
}

.choice-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.recommendation-panel {
  min-width: 0;
}

.recommendation-heading {
  margin-bottom: 0.8rem;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
}

.recommendation-card {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.recommendation-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(244, 114, 182, 0.5)),
    var(--accent);
}

.recommendation-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #251F27;
}

.recommendation-body {
  display: grid;
  gap: 0.85rem;
  padding: 0.95rem;
}

.recommendation-body .btn {
  justify-self: start;
}

.recommendation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.recommendation-reason {
  margin: 0.72rem 0 0;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.45;
  padding-left: 0.65rem;
}

.recommendation-empty {
  display: grid;
  gap: 0.35rem;
}

.recommendation-empty p {
  margin: 0;
}

.recommendation-skeleton {
  min-height: 23rem;
}

html[data-theme="dark"] .choice-card,
html[data-theme="dark"] .recommendation-card {
  border-color: var(--line);
  background: rgba(15, 23, 42, 0.88);
}

html[data-theme="dark"] .choice-card:has(input:checked) {
  background: rgba(237, 37, 78, 0.16);
}

.library-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.library-board .panel:nth-child(5),
.library-board .panel:last-child {
  grid-column: 1 / -1;
}

.tracking-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.85rem;
}

.compact-series {
  position: relative;
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.72);
  padding: 0.55rem;
  cursor: pointer;
}

.fav-toggle {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s, transform 0.15s;
}

.fav-toggle:hover { transform: scale(1.12); }
.fav-toggle--active { color: var(--sovnge-raspberry); }

html[data-theme="dark"] .fav-toggle { background: rgba(15, 23, 42, 0.78); }

.az-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0.6rem 0;
  margin-bottom: 0.5rem;
}

.az-nav a {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  background: rgba(15, 23, 42, 0.05);
}

.az-nav a:hover { background: var(--accent); color: #fff; }
html[data-theme="dark"] .az-nav a { background: rgba(255, 255, 255, 0.08); }

.az-group { margin-bottom: 1.2rem; }
.az-group:last-child { margin-bottom: 0; }

.az-letter {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--accent);
  margin: 0 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.compact-poster {
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  color: #fff;
  font-weight: 900;
}

.compact-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #251F27;
}

.compact-body {
  display: grid;
  align-content: space-between;
  min-width: 0;
}

.next-line {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.35;
}

.platform-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.platform-group {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.76);
  padding: 0.8rem;
}

.platform-group-head {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.platform-group-head img,
.provider-dot {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 6px;
  flex: 0 0 auto;
}

.provider-dot {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--rose));
}

.platform-group-head strong,
.platform-group-head span {
  display: block;
}

.platform-group-head span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.platform-series-list {
  display: grid;
  gap: 0.45rem;
}

.platform-series-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.2rem;
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}

.platform-series-row span {
  font-weight: 850;
}

.platform-series-row small {
  color: var(--ink-soft);
  line-height: 1.35;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 1rem;
}

.hamburger {
  display: none;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  flex-shrink: 0;
  padding: 0;
}

.sidebar-close {
  display: none;
  width: 2.2rem;
  height: 2.2rem;
  align-items: center;
  justify-content: center;
  align-self: end;
  margin-left: auto;
  margin-bottom: 0.35rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  padding: 0;
}

.sidebar-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--ink);
}

.nav-backdrop {
  display: none;
}

.skeleton {
  min-height: var(--poster-h);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent),
    #e6ded2;
  background-size: 200% 100%;
  animation: pulse 1.2s infinite linear;
}

html[data-theme="dark"] .skeleton {
  background:
    linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.13), transparent),
    rgba(15, 23, 42, 0.9);
}

@keyframes pulse {
  to {
    background-position-x: -200%;
  }
}

/* ── Écrans ≤1280px : tiroir hamburger (tablettes, laptops 13") ───────────── */
@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0.85rem 1rem;
  }

  .topbar {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 0.75rem;
  }

  .api-state {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .brand-caption {
    display: none;
  }

  /* Sidebar : tiroir coulissant */
  .sidebar {
    position: fixed;
    z-index: 200;
    top: 0;
    left: 0;
    height: 100vh;
    width: min(22rem, 88vw);
    overflow-y: auto;
    background: var(--surface);
    box-shadow: 4px 0 40px rgba(15, 23, 42, 0.24);
    padding: 0.85rem;
    transform: translateX(-110%);
    transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.nav-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: flex;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
  }

  .nav-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.85rem;
  }

  .cast-grid {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }

  .recommendation-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  }

  .detail-hero {
    grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
  }

  .quick-stats {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .stat-card {
    min-height: 5.5rem;
  }
}

/* ── Tablettes et téléphones ≤1040px ──────────────────────────────────────── */
@media (max-width: 1040px) {
  .auth-shell,
  .two-col,
  .detail-grid,
  .recommendation-layout {
    grid-template-columns: 1fr;
  }

  .layout {
    padding: 0.75rem 1rem;
  }

  .auth-visual {
    min-height: 42vh;
  }

  .toolbar,
  .quick-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.75rem;
  }

  .cast-grid {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  }

  .recommendation-grid {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  }

  .skeleton-grid {
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  }

  .library-board {
    grid-template-columns: 1fr;
  }

  .settings-layout {
    grid-template-columns: 1fr;
  }

  .detail-hero {
    grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    grid-template-columns: auto auto 1fr auto;
    row-gap: 0.5rem;
  }

  .topbar .searchbar {
    grid-column: 1 / -1;
  }

  .brand {
    min-width: 0;
  }

  .user-menu {
    justify-content: end;
  }

  .toolbar,
  .quick-stats,
  .banner,
  .question-row,
  .filter-row {
    grid-template-columns: 1fr;
  }

  .series-card {
    --poster-w: 6.7rem;
    --poster-h: 10.05rem;
  }

  .overview {
    -webkit-line-clamp: 3;
  }

  .page-title,
  .section-heading,
  .rail-heading {
    align-items: start;
    flex-direction: column;
  }

  .page-actions {
    justify-content: start;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-poster {
    min-height: 24rem;
  }

  .detail-facts div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .auth-panel,
  .layout {
    padding: 0.65rem 0.75rem;
  }

  .brand-caption {
    display: none;
  }

  .poster {
    width: 100%;
    min-height: 16rem;
  }

  .poster img,
  .poster-fallback {
    min-height: 16rem;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .compact-series {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .color-field {
    grid-template-columns: 1fr 3.25rem;
  }

  .color-field code {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* ── Watchlists ────────────────────────────────────────────────────────────── */

.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.75rem;
}

.wl-card {
  cursor: pointer;
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.wl-card-mosaic {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: 1fr 1fr;
  height: 8.5rem;
  gap: 2px;
  background: rgba(15, 23, 42, 0.06);
}

.wl-mosaic-cell {
  overflow: hidden;
  background: rgba(15, 23, 42, 0.05);
}

.wl-mosaic-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.wl-mosaic-placeholder {
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.07) 0%, rgba(15, 23, 42, 0.13) 100%);
}

html[data-theme="dark"] .wl-card-mosaic {
  background: rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .wl-mosaic-cell {
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .wl-mosaic-placeholder {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.09) 100%);
}

.wl-card-body {
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.wl-card-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.wl-card-meta .pill {
  font-size: 0.66rem;
  padding: 0.18rem 0.38rem;
}

.wl-card:hover {
  border-color: rgba(237, 37, 78, 0.36);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.16);
  transform: translateY(-2px);
}

.wl-card-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.5rem;
}

.wl-card-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl-members {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.wl-member-avatar {
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.68rem;
  font-weight: 900;
}

.wl-member-names {
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.wl-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.45rem 0.2rem 0.2rem;
  font-size: 0.82rem;
}

.wl-remove-member {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.75rem;
  padding: 0;
  line-height: 1;
}

.wl-card-footer {
  display: flex;
  gap: 0.45rem;
}

.wl-card-counts,
.wl-item-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.wl-view-controls {
  display: grid;
  grid-template-columns: auto minmax(11rem, 0.75fr) minmax(15rem, 1fr) auto;
  gap: 0.75rem 1.25rem;
  align-items: end;
  margin-bottom: 1rem;
}

.wl-view-modes {
  margin-bottom: 0;
  border-bottom: none;
  align-self: end;
}

.wl-control-field {
  min-width: 0;
}

.wl-detail-board {
  display: grid;
  gap: 1.25rem;
}

.wl-status-section {
  display: grid;
  gap: 0.85rem;
}

.wl-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.wl-list-stack {
  display: grid;
  gap: 0.7rem;
}

.wl-list-item {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0.55rem;
}

.wl-list-poster,
.wl-table-poster {
  display: grid;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  place-items: center;
  border-radius: calc(var(--radius) - 2px);
  background: #251F27;
  color: #fff;
}

.wl-list-poster img,
.wl-table-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wl-list-poster .poster-fallback,
.wl-table-poster .poster-fallback {
  font-size: 0.95rem;
}

.wl-list-main {
  min-width: 0;
}

.wl-list-main h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.wl-list-actions,
.wl-table-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wl-list-actions .btn,
.wl-table-actions .btn {
  min-height: 2.2rem;
  padding: 0.48rem 0.62rem;
  font-size: 0.82rem;
}

.wl-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.wl-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
}

.wl-table th,
.wl-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem;
  text-align: left;
  vertical-align: middle;
}

.wl-table th {
  color: var(--ink-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.wl-table tr:last-child td {
  border-bottom: 0;
}

.wl-table-title {
  display: grid;
  grid-template-columns: 2.65rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
}

.wl-table-poster {
  width: 2.65rem;
}

.wl-table small {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink-soft);
}

.wl-item-status {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-top: 0.55rem;
}

.wl-invite-panel {
  display: grid;
  gap: 0.65rem;
  max-width: 38rem;
  padding: 1rem;
}

.wl-invite-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.wl-invite-form .input {
  flex: 1;
  min-width: 0;
}

.wl-create-form {
  display: grid;
  gap: 0.55rem;
}

.wl-add-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  background: rgba(240, 235, 227, 0.72);
}

html[data-theme="dark"] .wl-add-panel {
  background: rgba(2, 6, 23, 0.34);
}

.wl-add-title {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.wl-add-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 720px) {
  .wl-view-controls {
    grid-template-columns: 1fr;
  }

  .wl-view-modes {
    width: 100%;
  }

  .wl-list-item {
    grid-template-columns: 3.4rem minmax(0, 1fr);
  }

  .wl-list-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .wl-list-actions .btn {
    flex: 1;
  }

  .wl-invite-form {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Cast cards cliquables ────────────────────────────────────────────────── */
.cast-card--link {
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.cast-card--link:hover {
  border-color: rgba(237, 37, 78, 0.4);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  transform: translateY(-2px);
}

.cast-card-body {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.cast-card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.cast-card-body span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-card-body small {
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 0.1rem;
}

/* Boutons noms d'acteurs dans la ligne de distribution */
.cast-name-btn {
  display: inline;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

.cast-name-btn:hover {
  color: var(--accent-dark);
  text-decoration-color: var(--accent-dark);
}

/* ── Vue personne / filmographie ─────────────────────────────────────────── */
.person-hero {
  display: grid;
  grid-template-columns: minmax(8rem, 10rem) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.person-photo {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(148, 163, 184, 0.58));
  color: #fff;
}

.person-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.person-photo .poster-fallback {
  height: 100%;
}

.person-bio-wrap {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.person-bio {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
}

.person-credit-count {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.person-credit-count strong {
  color: var(--ink);
  font-size: 1.15rem;
}

/* Timeline filmographie */
.filmography-timeline {
  display: grid;
  gap: 0;
}

.timeline-year-block {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 0 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.timeline-year-block:first-child {
  border-top: 0;
}

.timeline-year-label {
  padding-top: 0.55rem;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 900;
  text-align: right;
  line-height: 1;
}

.timeline-year-items {
  display: grid;
  gap: 0.55rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  transition:
    background 140ms ease,
    transform 140ms ease;
}

.timeline-item:hover {
  background: rgba(237, 37, 78, 0.08);
  transform: translateX(3px);
}

html[data-theme="dark"] .timeline-item:hover {
  background: rgba(237, 37, 78, 0.12);
}

.timeline-poster {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 5px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(148, 163, 184, 0.5));
  color: #fff;
  font-size: 0.6rem;
}

.timeline-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timeline-poster .poster-fallback {
  height: 100%;
  font-size: 0.75rem;
  padding: 0.3rem;
}

.timeline-info {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  padding-top: 0.1rem;
}

.timeline-title {
  font-size: 0.92rem;
  line-height: 1.25;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.timeline-character {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 1280px) {
  .person-hero {
    grid-template-columns: minmax(7rem, 9rem) minmax(0, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 720px) {
  .person-hero {
    grid-template-columns: 1fr;
  }

  .person-photo {
    max-width: 10rem;
  }

  .timeline-year-block {
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 0 0.65rem;
  }

  .person-bio {
    -webkit-line-clamp: 6;
  }
}

/* ── Episodes ─────────────────────────────────────────────────────────────── */

.ep-panel { margin-top: 0; }

.ep-seasons {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ep-season {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.ep-season--open { border-color: var(--accent); }

.ep-season-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  gap: 0.5rem;
  transition: background 0.15s;
}

.ep-season-header:hover { background: var(--accent-soft); }
.ep-season--open .ep-season-header { background: var(--accent-soft); color: var(--accent-dark); }
.ep-season-label { flex: 1; }
.ep-season-chevron { font-size: 0.6rem; color: var(--ink-soft); }

.ep-season-spin {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ep-spin 0.7s linear infinite;
}

@keyframes ep-spin { to { transform: rotate(360deg); } }

.ep-season-body {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

/* Episode rows */

.ep-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}

.ep-row:last-child { border-bottom: none; }
.ep-row--watched { opacity: 0.6; }
.ep-row--active { background: var(--accent-soft); }
.ep-row--unaired { opacity: 0.55; }

.ep-check {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--accent);
  display: grid;
  place-items: center;
  transition: border-color 0.15s, background 0.15s;
}

.ep-check:hover { border-color: var(--accent); }

.ep-check:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ep-check:disabled:hover { border-color: var(--line); }

.ep-unaired-tag {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--sovnge-raspberry);
  flex-shrink: 0;
}

.ep-check--done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--cta-text);
}

.ep-info {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}

.ep-num {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.ep-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-date,
.ep-runtime {
  font-size: 0.7rem;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.ep-msg-btn {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  font-size: 0.78rem;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.ep-msg-btn:hover { border-color: var(--accent); color: var(--accent); }
.ep-msg-btn--active { background: var(--accent); border-color: var(--accent); color: var(--cta-text); }
.ep-msg-count { font-weight: 700; }

.ep-rating { flex-shrink: 0; }

.ep-rating-select {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
}

.ep-rating-select--rated {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ep-community-rating {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: #d97706;
  white-space: nowrap;
}

html[data-theme="dark"] .ep-community-rating { color: #fbbf24; }

.user-rating-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.user-rating-label {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.user-rating-value {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
}

.user-rating-value--community {
  color: #d97706;
}

html[data-theme="dark"] .user-rating-value--community { color: #fbbf24; }

.user-rating-hint {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.user-rating-select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

/* ── Drawer ───────────────────────────────────────────────────────────────── */

.ep-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 300;
  cursor: pointer;
}

.ep-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--surface);
  z-index: 301;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.18);
  animation: ep-slide-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes ep-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.ep-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  gap: 0.75rem;
  flex-shrink: 0;
}

.ep-drawer-title {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.ep-drawer-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.ep-drawer-ep-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-drawer-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}

.ep-drawer-close:hover { background: var(--accent-soft); }

.ep-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

.ep-drawer-empty {
  font-size: 0.84rem;
  color: var(--ink-soft);
  text-align: center;
  margin: auto;
  padding: 2rem 0;
}

.ep-drawer-footer {
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
  flex-shrink: 0;
}

/* ── Comment bubbles ──────────────────────────────────────────────────────── */

.ep-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  max-width: 90%;
}

.ep-bubble-row--own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ep-bubble-avatar {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 900;
  color: #fff;
}

.ep-bubble-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ep-bubble-row--own .ep-bubble-col { align-items: flex-end; }

.ep-bubble-meta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0 0.25rem;
}

.ep-bubble-row--own .ep-bubble-meta { flex-direction: row-reverse; }

.ep-bubble-name {
  font-size: 0.72rem;
  font-weight: 700;
}

.ep-bubble-time {
  font-size: 0.65rem;
  color: var(--ink-soft);
}

.ep-bubble {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 0.5rem 0.75rem;
}

.ep-bubble--own {
  background: var(--accent);
  border-color: var(--accent);
  border-radius: 14px;
  border-bottom-right-radius: 4px;
  border-bottom-left-radius: 14px;
}

.ep-bubble-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

.ep-bubble--own .ep-bubble-text { color: var(--cta-text); }

.ep-bubble-img {
  display: block;
  max-width: 200px;
  max-height: 220px;
  border-radius: 8px;
  margin-top: 0.4rem;
  object-fit: cover;
}

/* ── Composer ─────────────────────────────────────────────────────────────── */

.ep-comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ep-composer {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  transition: border-color 0.15s;
}

.ep-composer:focus-within { border-color: var(--accent); }

.ep-composer-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.5;
}

.ep-composer-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ep-tool-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 0.9rem;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.ep-tool-btn:hover { background: var(--accent-soft); border-color: var(--accent); }

.ep-send-btn {
  margin-left: auto;
  font-size: 0.8rem;
  padding: 0.35rem 1rem;
}

.ep-gif-picker {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ep-gif-hint {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin: 0;
}

.ep-gif-input-row {
  display: flex;
  gap: 0.4rem;
}

.ep-gif-url {
  flex: 1;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  font-family: inherit;
}

.ep-gif-url:focus {
  outline: none;
  border-color: var(--accent);
}

.ep-gif-insert {
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

@media (max-width: 640px) {
  .ep-drawer {
    width: 100vw;
  }

  .ep-check {
    width: 2.1rem;
    height: 2.1rem;
  }

  .ep-msg-btn {
    min-height: 2.1rem;
    padding: 0.3rem 0.65rem;
  }

  .fav-toggle {
    width: 2.3rem;
    height: 2.3rem;
  }
}

/* ── Watchup view ───────────────────────────────────────────────────────────── */

/* Tabs */
.wu-tabs {
  display: flex;
  gap: 1.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  margin-bottom: 1.5rem;
}

html[data-theme="dark"] .wu-tabs {
  border-bottom-color: var(--line);
}

.wu-tab {
  padding: 0 0 0.65rem;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.wu-tab:hover {
  color: var(--ink);
}

.wu-tab--active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* Section header */
.wu-section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.65rem;
}

.wu-section-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.wu-section-rule {
  flex: 1;
  height: 1px;
  background: rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .wu-section-rule {
  background: var(--line);
}

/* Card list */
.wu-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Individual card */
.wu-card {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: 0.85rem;
  border: 1px solid rgba(15, 23, 42, 0.07);
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.wu-card:hover {
  box-shadow: 0 3px 14px rgba(15, 23, 42, 0.09);
  border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .wu-card {
  border-color: var(--line);
}

html[data-theme="dark"] .wu-card:hover {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Poster button */
.wu-poster {
  flex: 0 0 68px;
  width: 68px;
  height: 102px;
  border: none;
  padding: 0;
  background: var(--bg);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wu-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.wu-card:hover .wu-poster img {
  transform: scale(1.04);
}

.wu-init {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

/* Card body */
.wu-body {
  flex: 1;
  padding: 0.85rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.wu-series-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.wu-series {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.wu-network-chip {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(15, 23, 42, 0.07);
  border-radius: 0.3rem;
  padding: 0.12rem 0.42rem;
  white-space: nowrap;
}

html[data-theme="dark"] .wu-network-chip {
  background: rgba(255, 255, 255, 0.1);
}

.wu-ep {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.wu-title {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wu-foot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.wu-remaining {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* Tags */
.wu-tag {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
}

.wu-tag--premiere {
  background: rgba(139, 92, 246, 0.14);
  color: #7c3aed;
}

html[data-theme="dark"] .wu-tag--premiere {
  background: rgba(139, 92, 246, 0.22);
  color: #a78bfa;
}

.wu-tag--new {
  background: rgba(34, 197, 94, 0.14);
  color: #16a34a;
}

html[data-theme="dark"] .wu-tag--new {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.wu-tag--aired {
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink-soft);
}

html[data-theme="dark"] .wu-tag--aired {
  background: rgba(255, 255, 255, 0.09);
}

/* Check button */
.wu-check {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  margin-right: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.15);
  background: transparent;
  color: rgba(15, 23, 42, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}

html[data-theme="dark"] .wu-check {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.2);
}

.wu-check:not(:disabled):not(.wu-check--muted):hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  transform: scale(1.08);
}

.wu-check--done {
  border-color: var(--accent) !important;
  background: var(--accent) !important;
  color: var(--cta-text) !important;
}

.wu-check--muted,
.wu-check:disabled {
  opacity: 0.22;
  cursor: default;
}

/* Empty states */
.wu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--ink-soft);
}

.wu-empty svg {
  opacity: 0.3;
  margin-bottom: 0.25rem;
}

.wu-empty h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.wu-empty p {
  margin: 0;
  font-size: 0.87rem;
  line-height: 1.6;
  max-width: 28rem;
}

@media (max-width: 480px) {
  .wu-poster {
    flex-basis: 56px;
    width: 56px;
    height: 84px;
  }

  .wu-ep {
    font-size: 0.95rem;
  }

  .wu-check {
    margin-right: 0.6rem;
  }
}

/* ── Episode stat cards ─────────────────────────────────────────────────────── */

.ep-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.ep-stat-card {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 1.25rem 1.4rem 1rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] .ep-stat-card {
  border-color: var(--line);
}

.ep-stat-card__label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

.ep-stat-card__value {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.35rem;
}

.ep-stat-card__sub {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.3;
}

.ep-catchup {
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  border-radius: 0 0.5rem 0.5rem 0;
  font-size: 0.88rem;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

/* ── Weekly bar chart ───────────────────────────────────────────────────────── */

.stat-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 130px;
  margin-top: 1rem;
  padding-bottom: 0;
}

.stat-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}

.stat-chart-val {
  font-size: 0.58rem;
  color: var(--ink-soft);
  height: 14px;
  line-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stat-chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  width: 100%;
  padding: 0 1px;
}

.stat-chart-bar {
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  opacity: 0.3;
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease;
}

.stat-chart-col--current .stat-chart-bar {
  opacity: 1;
}

.stat-chart-label {
  font-size: 0.55rem;
  color: var(--ink-soft);
  height: 14px;
  line-height: 14px;
  white-space: nowrap;
}

.stat-chart-col--current .stat-chart-label {
  color: var(--accent);
  font-weight: 700;
}

/* ── Top genres / networks list ─────────────────────────────────────────────── */

.top-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.top-item__name {
  flex: 0 0 9rem;
  font-size: 0.82rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-item__bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

html[data-theme="dark"] .top-item__bar-wrap {
  background: rgba(255, 255, 255, 0.1);
}

.top-item__bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  min-width: 4px;
}

.top-item__count {
  flex: 0 0 2rem;
  text-align: right;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 700;
}

@media (max-width: 640px) {
  .ep-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-item__name {
    flex: 0 0 6rem;
  }
}

/* ── Import modal ────────────────────────────────────────────────────── */
.import-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 400;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.import-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 401;
  background: var(--surface);
  border-radius: 1rem;
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.import-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.import-modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}

.import-close {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.import-close:hover { background: rgba(15, 23, 42, 0.08); }
html[data-theme="dark"] .import-close:hover { background: rgba(255,255,255,0.1); }

.import-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.import-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* Source selection */
.import-hint {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.import-sources {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.import-source {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 0.75rem;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.import-source:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.import-source--active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.import-source-icon {
  width: 42px;
  height: 42px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75rem;
  flex: 0 0 42px;
}

.import-source-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.import-source strong {
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 700;
}

.import-source small {
  font-size: 0.76rem;
  color: var(--ink-soft);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-source-check {
  color: var(--accent);
  flex: 0 0 auto;
}

/* File drop zone */
.import-instructions {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

.import-instructions ol { margin: 0.4rem 0 0 1.15rem; padding: 0; }
.import-instructions li { margin-bottom: 0.4rem; }
.import-instructions strong { color: var(--ink); }

.import-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 2px dashed rgba(15, 23, 42, 0.2);
  border-radius: 0.85rem;
  padding: 2.25rem 1.5rem;
  cursor: pointer;
  text-align: center;
  color: var(--ink-soft);
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  font-size: 0.875rem;
}

html[data-theme="dark"] .import-drop { border-color: rgba(255,255,255,0.18); }

.import-drop:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.import-drop .link { color: var(--accent); }
.import-drop small { font-size: 0.72rem; opacity: 0.6; }

.import-type-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 0.65rem;
}

html[data-theme="dark"] .import-type-filter { background: rgba(255,255,255,0.06); }

.import-type-filter-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.import-type-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
}

.import-type-check input { accent-color: var(--accent); cursor: pointer; }

/* Preview */
.import-summary {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.2rem;
}

html[data-theme="dark"] .import-summary { background: rgba(255,255,255,0.06); }

.import-sum-total {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 0.55rem;
}

.import-sum-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.import-pill {
  font-size: 0.73rem;
  padding: 0.18rem 0.6rem;
  border-radius: 2rem;
  background: rgba(15, 23, 42, 0.08);
  color: var(--ink);
}

.import-pill strong { font-weight: 800; }
.import-pill--watched  { background: rgba(34,197,94,0.12);  color: #16a34a; }
.import-pill--watching { background: rgba(59,130,246,0.12); color: #2563eb; }
.import-pill--watchlist{ background: rgba(245,158,11,0.12); color: #d97706; }
.import-pill--dropped  { background: rgba(239,68,68,0.12);  color: #dc2626; }

html[data-theme="dark"] .import-pill--watched  { color: #4ade80; }
html[data-theme="dark"] .import-pill--watching { color: #60a5fa; }
html[data-theme="dark"] .import-pill--watchlist{ color: #fbbf24; }
html[data-theme="dark"] .import-pill--dropped  { color: #f87171; }

.import-preview-list { display: flex; flex-direction: column; }

.import-preview-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.82rem;
}

html[data-theme="dark"] .import-preview-item { border-bottom-color: var(--line); }

.import-preview-type {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  flex: 0 0 auto;
}

.import-preview-type--series  { background: rgba(59,130,246,0.12); color: #2563eb; }
.import-preview-type--movie   { background: rgba(245,158,11,0.12); color: #d97706; }
.import-preview-type--anime   { background: rgba(139,92,246,0.12); color: #7c3aed; }

html[data-theme="dark"] .import-preview-type--series { color: #60a5fa; }
html[data-theme="dark"] .import-preview-type--movie  { color: #fbbf24; }
html[data-theme="dark"] .import-preview-type--anime  { color: #a78bfa; }

.import-preview-title {
  flex: 1;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-preview-status {
  font-size: 0.66rem;
  font-weight: 700;
  flex: 0 0 auto;
  color: var(--ink-soft);
}

.import-preview-more {
  text-align: center;
  padding: 0.6rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* Progress */
.import-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--ink);
}

.import-progress p { margin: 0; font-weight: 700; }
.import-progress small { color: var(--ink-soft); font-size: 0.8rem; }

.import-progress-bar-wrap {
  width: 200px;
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}

.import-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.import-progress-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Results */
.import-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.75rem 0 0.5rem;
  text-align: center;
}

.import-result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.import-result-icon--ok   { background: rgba(34,197,94,0.12);  color: #16a34a; }
.import-result-icon--warn { background: rgba(245,158,11,0.12); color: #d97706; }

html[data-theme="dark"] .import-result-icon--ok   { color: #4ade80; }
html[data-theme="dark"] .import-result-icon--warn { color: #fbbf24; }

.import-result h3 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.import-result p  { margin: 0; color: var(--ink-soft); font-size: 0.875rem; }

.import-errors {
  margin-top: 0.6rem;
  font-size: 0.79rem;
  text-align: left;
  width: 100%;
  max-width: 380px;
}

.import-errors summary { cursor: pointer; color: var(--ink-soft); margin-bottom: 0.4rem; }

.import-errors ul {
  max-height: 110px;
  overflow-y: auto;
  margin: 0;
  padding: 0 0 0 1.2rem;
  color: #dc2626;
}

html[data-theme="dark"] .import-errors ul { color: #f87171; }

/* Settings import badges */
.import-app-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.import-app-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  background: rgba(15, 23, 42, 0.07);
  color: var(--ink-soft);
}

html[data-theme="dark"] .import-app-badge { background: rgba(255,255,255,0.1); }

/* ── Avatars (shared) ─────────────────────────────────────────────────────── */

.avatar-img {
  object-fit: cover;
  display: block;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  flex-shrink: 0;
}

.avatar-btn {
  display: inline-flex;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
}

.ep-bubble-name-btn {
  display: inline-flex;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.profile-avatar-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  font-size: 2rem;
}

.profile-avatar-md {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.1rem;
}

/* ── Public profile ───────────────────────────────────────────────────────── */

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.profile-bio {
  color: var(--ink-soft);
  font-size: 0.9rem;
  max-width: 40rem;
  margin: 0;
}

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.9rem;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.25rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.profile-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.profile-card strong {
  font-size: 0.86rem;
  color: var(--ink);
  text-align: center;
}

/* ── Settings: avatar upload ──────────────────────────────────────────────── */

.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-upload-btn {
  position: relative;
  overflow: hidden;
}

/* ── Chat ─────────────────────────────────────────────────────────────────── */

.chat-view {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 320px;
  max-height: 60vh;
}

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 0.9rem 1.1rem;
  flex-shrink: 0;
}

/* ── Calendar ─────────────────────────────────────────────────────────────── */

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.calendar-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.calendar-section {
  display: grid;
  gap: 0.9rem;
}

.calendar-skeleton {
  min-height: 4.5rem;
}

.calendar-month-list {
  display: grid;
  gap: 1.1rem;
}

.calendar-month h3 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.calendar-entry-list {
  display: grid;
  gap: 0.6rem;
}

.calendar-entry {
  display: grid;
  grid-template-columns: 2.9rem 3.4rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: rgba(240, 235, 227, 0.72);
  padding: 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.calendar-entry:hover {
  border-color: rgba(237, 37, 78, 0.36);
  transform: translateY(-1px);
}

html[data-theme="dark"] .calendar-entry {
  border-color: var(--line);
  background: rgba(2, 6, 23, 0.34);
}

.calendar-date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  padding: 0.35rem 0.15rem;
  border-radius: 0.6rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-align: center;
}

.calendar-date-badge span {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-date-badge strong {
  font-size: 1.15rem;
  font-weight: 900;
  line-height: 1.1;
}

.calendar-date-badge small {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar-poster {
  display: grid;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), var(--sky));
  color: #fff;
  font-weight: 900;
}

.calendar-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.calendar-poster .poster-fallback {
  font-size: 0.85rem;
  padding: 0.2rem;
}

.calendar-entry-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
  min-width: 0;
}

.calendar-entry-body h3 {
  margin: 0;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-entry-body p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 860px) {
  .calendar-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calendar-entry {
    grid-template-columns: 2.5rem 2.8rem minmax(0, 1fr);
  }
}

/* ── Confirm modal ────────────────────────────────────────────────────────── */

.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 500;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.confirm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 501;
  background: var(--surface);
  border-radius: 1rem;
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  width: min(420px, calc(100vw - 2rem));
  padding: 1.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.confirm-modal-icon {
  width: 3.2rem;
  height: 3.2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

html[data-theme="dark"] .confirm-modal-icon { color: #f87171; }

.confirm-modal h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--ink);
}

.confirm-modal p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.9rem;
  width: 100%;
}

.confirm-modal-actions .btn {
  flex: 1;
}

/* ── Backoffice ───────────────────────────────────────────────────────────── */

.admin-user-list,
.admin-mod-list {
  display: grid;
  gap: 0.7rem;
}

.admin-user-row {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0.75rem 0.9rem;
}

html[data-theme="dark"] .admin-user-row {
  border-color: var(--line);
  background: rgba(2, 6, 23, 0.34);
}

.admin-user-row--suspended {
  opacity: 0.65;
}

.admin-user-row--pending {
  border-color: rgba(217, 164, 6, 0.4);
}

.admin-user-identity,
.admin-content-identity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.admin-content-row {
  display: grid;
  gap: 0.55rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0.75rem 0.9rem;
}

html[data-theme="dark"] .admin-content-row {
  border-color: var(--line);
  background: rgba(2, 6, 23, 0.34);
}

.admin-content-poster {
  flex-shrink: 0;
  width: 2.6rem;
  height: 3.7rem;
  border-radius: 6px;
  object-fit: cover;
}

.admin-content-poster--empty {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
  font-size: 0.8rem;
}

.admin-user-names {
  display: grid;
  min-width: 0;
}

.admin-user-names strong {
  font-size: 0.92rem;
}

.admin-user-names span {
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-badges {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
  flex-shrink: 0;
}

.admin-pill-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #dc2626;
}

html[data-theme="dark"] .admin-pill-danger { color: #f87171; }

.admin-pill-warning {
  background: rgba(217, 164, 6, 0.16);
  color: #b45309;
}

html[data-theme="dark"] .admin-pill-warning { color: #fbbf24; }

.admin-user-meta {
  margin-top: 0;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.admin-user-actions .btn {
  min-height: 2.1rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}

.admin-mod-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: start;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 0.7rem 0.9rem;
}

html[data-theme="dark"] .admin-mod-row {
  border-color: var(--line);
  background: rgba(2, 6, 23, 0.34);
}

.admin-mod-main {
  min-width: 0;
}

.admin-mod-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.admin-mod-meta strong {
  color: var(--ink);
  font-size: 0.85rem;
}

.admin-mod-context {
  font-weight: 700;
  color: var(--accent);
}

.admin-mod-body {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  word-break: break-word;
}

.admin-mod-row .btn {
  min-height: 2.1rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}

.admin-word-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.admin-word-form .input {
  flex: 1;
  min-width: 0;
}

.admin-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.admin-word-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.4rem 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.07);
  font-size: 0.82rem;
  font-weight: 700;
}

html[data-theme="dark"] .admin-word-chip { background: rgba(255, 255, 255, 0.1); }

.admin-word-chip button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0.15rem 0.3rem;
  border-radius: 50%;
}

.admin-word-chip button:hover { color: #dc2626; }

@media (max-width: 640px) {
  .admin-mod-row {
    grid-template-columns: 1fr;
  }

  .admin-user-actions .btn {
    flex: 1;
  }
}

.admin-users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.admin-user-search {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 16rem;
}

.admin-user-search .input {
  flex: 1;
  min-width: 0;
}

.admin-users-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
