:root {
  --bg: #0b0d12;
  --bg-elevated: #14171f;
  --bg-card: #181c26;
  --border: #262b38;
  --text: #eef0f4;
  --text-dim: #9aa2b1;
  --accent: #37e6c4;
  --accent-strong: #1fb894;
  --accent-soft: rgba(55, 230, 196, 0.12);
  --danger: #ff6b7a;
  --radius: 14px;
  --max-width: 1200px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Nothing on the site relies on horizontal scroll — this is a backstop
     against the off-canvas mobile nav drawer (and anything similar)
     silently widening the scrollable page and reading as cropped content. */
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(55, 230, 196, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(168, 85, 247, 0.08), transparent 55%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(11, 13, 18, 0.85);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo .mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #06110d;
  font-weight: 900;
}

nav.main-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

nav.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 600;
  transition: color .15s, background .15s;
}

nav.main-nav a:hover,
nav.main-nav a.active {
  color: var(--text);
  background: var(--bg-elevated);
}

.search-box {
  position: relative;
  min-width: 220px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.search-box input:focus { border-color: var(--accent); }

.search-box::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  pointer-events: none;
}

/* Mobile nav: hidden on desktop, where .nav-panel is just an inline flex
   child (via `display: contents`) so nav links + search sit in the header
   exactly as before. Below the breakpoint it becomes a fixed slide-in
   drawer, toggled by the hamburger button, so the nav no longer eats the
   whole screen by wrapping across several lines. */
.nav-toggle {
  display: none;
  position: relative;
  /* Stays above .nav-backdrop (25) so it's still clickable/visible — as
     the animated X — once the panel is open, not hidden under the dim. */
  z-index: 31;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}

/* The open drawer has its own dedicated close (X) button, so the hamburger
   just hides instead of also morphing into a second X. */
.nav-toggle[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
}

.nav-panel { display: contents; }

.nav-panel-close { display: none; }

.nav-backdrop { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }

  .nav-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
  }

  .nav-panel-close:hover { border-color: var(--accent); color: var(--accent); }

  .nav-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(300px, 80vw);
    background: var(--bg-elevated);
    border-left: 1px solid var(--border);
    padding: 88px 20px 24px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s ease;
    z-index: 30;
  }

  .nav-panel.open { transform: translateX(0); }

  nav.main-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    /* Search sits above the nav links in the drawer (below the close
       button, which keeps its own DOM-order top position). */
    order: 1;
  }

  nav.main-nav a { padding: 12px 14px; }

  .search-box { min-width: 0; }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
    z-index: 25;
  }

  .nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
}

body.nav-lock { overflow: hidden; }

/* Hero banner */
.hero-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 3525 / 1175;
  background-image: url('/images/Header.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
}

.hero-banner-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 1060px;
  padding: 0 24px;
  text-align: center;
  color: #fff;
}

.hero-banner-text h2 {
  font-size: clamp(30px, 5.5vw, 60px);
  line-height: 1.15;
  margin: 0 0 16px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.hero-banner-text p {
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 600;
  line-height: 1.5;
  margin: 0 auto;
  max-width: 680px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.page-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 3525 / 550;
  background-image: url('/images/Quarter header.jpg');
  background-size: cover;
  background-position: top;
  background-repeat: no-repeat;
}

/* Mobile header: only the home page's hero-banner swaps to the
   portrait-cropped image below the phone breakpoint — the slim
   page-banner (just "Toon-List.com") stays on the thin desktop banner
   on every other page since it has no text worth the extra height. */
@media (max-width: 640px) {
  .hero-banner {
    aspect-ratio: 2244 / 3200;
    background-image: url('/images/Mobile Header.jpg');
  }

  /* The text block stays vertically centered, so widening the gap here
     pushes the heading up and the paragraph down symmetrically. */
  .hero-banner-text h2 { margin-bottom: 48px; }
}

.page-banner-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

/* Stoner comedy block */
.stoner-block {
  padding: 96px 24px;
  text-align: center;
}

.stoner-title {
  font-size: clamp(42px, 6.5vw, 68px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 40px;
}

.stoner-title em {
  font-style: italic;
}

.stoner-video {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  margin: 0 auto 40px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.stoner-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.stoner-text {
  max-width: 900px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.7;
}

/* Hero */
.hero {
  padding: 64px 24px 40px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(42px, 6.5vw, 68px);
  margin: 0 0 14px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero h1 span {
  background: linear-gradient(120deg, var(--accent), #a855f7);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  color: #fff;
  font-size: clamp(19px, 2vw, 24px);
  max-width: 800px;
  margin: 0 auto 28px;
}

.hero-search {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 15px 20px 15px 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

.hero-search input:focus { border-color: var(--accent); }

.hero-search::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
}

/* Category cards */
.category-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  padding: 8px 24px 48px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.category-card {
  display: block;
  color: inherit;
}

.category-card img {
  width: 100%;
  aspect-ratio: 6250 / 4830;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: transform .15s, outline-color .15s;
}

.category-card:hover img {
  transform: translateY(-4px);
  outline-color: var(--accent);
}

.category-card h3 {
  margin: 20px 0 10px;
  font-size: 22px;
  transition: color .15s;
}

.category-card:hover h3 {
  color: var(--accent);
}

.category-card p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 900px) {
  .category-cards { grid-template-columns: 1fr; }
}

/* Category page hero (e.g. Classics intro + subcategory cards) */
.category-hero {
  padding: 56px 24px 8px;
  text-align: center;
}

.category-hero h1 {
  font-size: clamp(42px, 6.5vw, 68px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.category-hero p {
  max-width: 900px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.7;
}

/* Category intro (heading + description + image), used above the filter grid on select category pages */
.category-intro {
  padding: 56px 24px 40px;
  text-align: center;
}

#cat-intro .category-intro:last-child {
  padding-bottom: 16px;
}

/* Single-block intros (Adult Swim Smalls, Explore the Underground, Films,
   3D — pages with no image below the title) get extra breathing room above
   the heading, since there's nothing but the header banner strip before it. */
#cat-intro > .category-intro:only-child {
  padding-top: 100px;
}

.category-intro h1,
.category-intro h2 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

.category-intro p {
  max-width: 700px;
  margin: 0 auto 32px;
  color: #fff;
  font-size: 17px;
  line-height: 1.7;
}

.category-intro-image {
  width: 100%;
  max-width: 860px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.category-intro-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* the source file has a thin poster-mat border baked in; zoom past it */
  transform: scale(1.08);
}

.subcat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  padding: 48px 24px 64px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.subcat-card {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.subcat-card-image {
  display: flex;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: transform .15s, outline-color .15s;
}

.subcat-card:hover .subcat-card-image {
  transform: translateY(-4px);
  outline-color: var(--accent);
}

.subcat-card-image span {
  flex: 1 1 0;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elevated);
}

.subcat-card h3 {
  margin: 20px 0 10px;
  font-size: 22px;
  transition: color .15s;
}

.subcat-card:hover h3 {
  color: var(--accent);
}

.subcat-card p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 900px) {
  .subcat-cards { grid-template-columns: 1fr; }
}

/* Per-subcategory browse sections (Classics page) */
.browse-section {
  padding-top: 32px;
  /* Offset the sticky header so scroll-to lands below it. */
  scroll-margin-top: 80px;
}

.browse-section h2 {
  text-align: center;
  font-size: clamp(20px, 2.2vw, 26px);
  margin: 0 0 24px;
  padding: 0 24px;
}

/* Section heading + filters */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 8px 24px 18px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-head h2 {
  font-size: 22px;
  margin: 0;
}

.result-count {
  color: var(--text-dim);
  font-size: 14px;
}

.filters:empty {
  display: none;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 24px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.chip:hover { color: var(--text); border-color: var(--accent); }

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
  padding: 0 24px 64px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s, border-color .15s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card .poster {
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  position: relative;
}

/* Widescreen card thumbnails, matching the airtable image ratio — scoped to
   the category pages whose source art is landscape rather than poster-shaped. */
.grid.wide-cards {
  grid-template-columns: repeat(3, 1fr);
}

.grid.wide-cards .card .poster {
  aspect-ratio: 16 / 9;
}

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

/* Phones: 2-across instead of desktop's 3, with tighter gap/padding and a
   smaller title to match the narrower cards. */
@media (max-width: 640px) {
  .grid,
  .grid.wide-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 12px 40px;
  }

  .card .body { padding: 8px 8px 10px; gap: 2px; }
  .card h4 { font-size: 11.5px; line-height: 1.25; }
  .card .meta { font-size: 9.5px; }
}

/* Related-shows rows (Same Canon / Similar Shows on the show page): mixed
   widescreen and poster cards share one row, each sized to a fixed height
   (width follows from its own aspect ratio) so they sit flush together in
   Airtable list order instead of being grouped into separate poster/wide
   grids. */
.related-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  padding: 0 24px 64px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.related-grid .card {
  flex: 0 0 auto;
  width: auto;
}

.related-grid .card .poster {
  /* Sized so exactly three widescreen (16:9) cards fit per row at the
     section's max width, keeping the layout visually balanced. */
  height: 200px;
  width: auto;
  aspect-ratio: 2 / 3;
}

.related-grid .card.wide .poster {
  aspect-ratio: 16 / 9;
}

.related-grid .card .body {
  width: 100%;
}

@media (max-width: 560px) {
  .related-grid .card .poster { height: 160px; }
}

.card .body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card h4 {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.3;
}

.card .meta {
  color: var(--text-dim);
  font-size: 12px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

/* Show detail */
.show-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
  padding: 40px 24px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Grid items default to a content-based minimum width, which lets long
   unbroken text (a title, synopsis word, button label) push a column wider
   than the container and crop the page on the right on narrow screens.
   Letting items shrink below that removes the blowout. */
.show-hero > * { min-width: 0; }

/* Widescreen categories get a wider left column so the 16:9 poster isn't
   squeezed into the same width as a 2:3 poster. */
.show-hero.wide {
  grid-template-columns: 420px 1fr;
}

@media (max-width: 720px) {
  .show-hero,
  .show-hero.wide { grid-template-columns: 1fr; }
}

.show-hero .poster {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  margin-top: 30px; /* drop below the crumb line so the poster top lines up with the title, not the breadcrumb */
}

.show-hero .poster.wide {
  aspect-ratio: 16/9;
}

.crumb {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 14px;
  display: block;
}

.crumb a:hover { color: var(--accent); }

.show-hero h1 {
  font-size: 34px;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badge-row .badge {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

.badge-row .badge.subtle {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-dim);
}

.synopsis {
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.65;
  max-width: 640px;
  margin-bottom: 22px;
}

.video-box {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-bottom: 24px;
}

.video-box iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  max-width: 560px;
  margin-bottom: 24px;
}

.meta-grid .label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.meta-grid .value { font-size: 14.5px; font-weight: 600; }

.meta-grid .value a { color: var(--accent); }
.meta-grid .value a:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(120deg, var(--accent), var(--accent-strong));
  color: #06110d;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14.5px;
  border: none;
  cursor: pointer;
}

.btn:hover { filter: brightness(1.05); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn.patreon {
  background: linear-gradient(120deg, #ff9d42, #f2760c);
  color: #2b1200;
}

.note-box {
  margin-top: 40px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

/* About block */
.about-block {
  padding: 96px 24px;
  text-align: center;
}

.about-image {
  width: 100%;
  max-width: 700px;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.about-title {
  font-size: clamp(42px, 6.5vw, 68px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 40px;
}

.about-text {
  max-width: 900px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.7;
}

/* About page */
.about-page {
  padding: 80px 24px 8px;
  text-align: center;
}

.about-page-title {
  font-size: clamp(48px, 7vw, 76px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 32px;
}

.about-page-text {
  max-width: 900px;
  margin: 0 auto;
  color: #fff;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.7;
}

.tree-viewer {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  height: calc(100vh - 80px);
  min-height: 520px;
  margin-top: 56px;
  overflow: hidden;
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.tree-viewer-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  overflow: hidden;
  position: relative;
  background: #fff;
}

.tree-viewer-canvas.grabbing { cursor: grabbing; }

.tree-viewer-canvas img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.tree-viewer-toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.tree-viewer-toolbar button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.85);
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s;
}

.tree-viewer-toolbar button:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
}

.tree-viewer-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: var(--text-dim);
  font-size: 13px;
  background: rgba(11, 13, 18, 0.85);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  pointer-events: none;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.footer-image-wrap {
  position: relative;
}

.footer-image {
  display: block;
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  aspect-ratio: 3525 / 1175;
  object-fit: cover;
}

.footer-cta {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 1000px;
  padding: 0 24px;
  text-align: center;
  color: #fff;
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 700;
  line-height: 1.35;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
}

.footer-tag {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  padding: 0 24px;
  text-align: center;
  color: #fff;
  font-size: 11.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

@media (max-width: 640px) {
  .footer-image { aspect-ratio: 962 / 1278; }
}

.footer-legal {
  text-align: center;
  padding: 14px 24px 30px;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-legal a { color: var(--text-dim); }
.footer-legal a:hover { color: var(--accent); }
.footer-legal span { margin: 0 8px; }

/* ---- Accounts (Supabase) ---- */

.account-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
}

.account-email {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-btn { padding: 9px 16px; font-size: 13px; }

.account-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-icon { flex-shrink: 0; }

.account-link:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 900px) {
  .account-box { margin: 16px 0 0; flex-direction: column; align-items: stretch; }
  .account-email { max-width: none; }
  .account-link { max-width: none; text-align: center; }
}

/* Watch toggle — compact circular button next to the title, below the
   poster (was previously overlaid on the image itself). */
.card .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card .title-row h4 {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-toggle {
  position: static;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}

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

.watch-toggle.is-watched {
  background: var(--accent);
  border-color: var(--accent);
  color: #06110d;
}

/* Watch toggle — full-size button on the show detail page */
.watch-toggle.large {
  position: static;
  width: auto;
  height: auto;
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 22px;
  font-weight: 800;
  font-size: 15px;
}

.watch-toggle.large:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.watch-toggle.large.is-watched {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Favorite toggle — pink heart button on the show detail page, next to
   Mark as Watched. */
.favorite-toggle.large {
  position: static;
  width: auto;
  height: auto;
  border-radius: 999px;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 22px;
  font-weight: 800;
  font-size: 15px;
}

.favorite-toggle.large:hover { border-color: #ff5c8a; }

.favorite-toggle.large.is-favorited {
  background: #ff5c8a22;
  border-color: #ff5c8a;
  color: #ff5c8a;
}

/* ---- Account page ---- */

.account-page { max-width: 960px; margin: 0 auto; padding: 32px 20px 60px; }

.account-header { margin-bottom: 20px; }
.account-header h1 { font-size: 28px; margin: 0 0 4px; }
.account-meta { color: var(--text-dim); font-size: 14px; }

.account-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.username-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.username-row .username-label { color: var(--text-dim); font-size: 13px; font-weight: 700; }
.username-row .username-value { font-weight: 700; }
.username-row .btn.chip { margin-left: auto; }

.username-edit-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.username-edit-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  min-width: 0;
  flex: 1 1 200px;
}

.email-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.email-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(238, 240, 244, 0.08);
  color: var(--text-dim);
}

.email-badge.confirmed { background: var(--accent-soft); color: var(--accent); }

.account-note { margin-top: 10px; font-size: 13px; color: var(--text-dim); }

.account-signed-out {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.account-signed-out .btn { margin-top: 16px; }

.account-page .section-head { margin-top: 36px; }

/* Auth modal */
.auth-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 9, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}

.auth-backdrop.open { opacity: 1; pointer-events: auto; }

.auth-modal {
  position: relative;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

#auth-form label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
}

#auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

#auth-form input:focus { border-color: var(--accent); }

.auth-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }
.auth-note { color: var(--accent); font-size: 13px; margin-bottom: 12px; }

.auth-submit { width: 100%; justify-content: center; border: none; }

/* Legal pages (Privacy Policy / Terms of Service) */
.legal-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 24px 100px;
}

.legal-page h1 {
  font-size: clamp(32px, 5vw, 44px);
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.legal-updated { color: var(--text-dim); font-size: 13px; margin-bottom: 40px; }

.legal-page h2 { font-size: 20px; margin: 36px 0 12px; }

.legal-page p, .legal-page li {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.7;
}

.legal-page ul { padding-left: 20px; margin: 0 0 16px; }
.legal-page a { color: var(--accent); }
.legal-page a:hover { text-decoration: underline; }

.legal-note {
  margin-top: 48px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-dim);
}
