/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg:      #0a0815;
  --bg1:     #0f0d1a;
  --surface: #15121f;
  --surface2:#1a1729;
  --surface3:#201d2f;
  --border:  rgba(150, 100, 200, 0.1);
  --border2: rgba(150, 100, 200, 0.2);

  --accent:  #9966dd;
  --accent2: #6b96d9;
  --accent3: #d97ba3;

  --text:    #e8ddf5;
  --text2:   #b5a3d0;
  --text3:   #6b5a8a;

  --canon:   #66b3ff;
  --filler:  #d97ba3;
  --mixed:   #9966dd;

  --r:       0.6rem;
  --nav-h:   56px;
  --toolbar-h: 48px; /* Approximate height for the toolbar */

  --font-display: 'Fira Code', 'JetBrains Mono', monospace;
  --font-body:    'Fira Code', 'JetBrains Mono', monospace;
  --font-mono:    'Fira Code', 'JetBrains Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Soft ambient gradient with subtle noise and blur bloom */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 70% at 20% 10%,   rgba(153,102,221,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 70% at 80% 90%,   rgba(107,150,217,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 70% 60% at 50% 50%,   rgba(217,123,163,0.04) 0%, transparent 60%);
  filter: blur(80px);
}

body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: 
    url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="100" height="100" fill="rgba(150,100,200,0.01)" filter="url(%23noise)"/></svg>');
  opacity: 0.08;
}

.page { position: relative; z-index: 1; }
.hidden { display: none !important; }

/* ── Nav ────────────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  background: rgba(10,8,21,0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  font-style: italic;
  color: var(--text);
  text-decoration: none;
  display: flex; align-items: center; gap: 0.8rem;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.nav-logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.nav-bc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text3);
  display: flex; align-items: center; gap: 0.4rem;
  min-width: 0;
  /* Right-side item: must stay right of the centered 400px search box.
     Search right edge = 50vw + 200px. Nav right padding = 2rem.
     So available width = 100vw - 2rem - (50vw + 200px) = 50vw - 200px - 2rem */
  max-width: calc(50vw - 200px - 4rem);
  overflow: hidden;
}

.nav-search {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 400px;
}
.nav-search .search-wrap { width: 100%; }
.nav-search .search-inner { border-radius: 0.6rem; }
#nav-search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 0.85rem;
  padding: 0.6rem 0; caret-color: var(--accent);
}
#nav-search-results {
  position: absolute; top: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  width: 640px;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 0.6rem;
  overflow-y: auto; max-height: 400px; z-index: 600;
  display: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
}
#nav-search-results.open { display: block; }
.nav-bc .crumb { color: var(--text2); cursor: pointer; transition: color 0.2s; white-space: nowrap; flex-shrink: 0; }
.nav-bc .crumb:hover { color: var(--accent); }
.nav-bc span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ── Home ───────────────────────────────────────────────────── */
#home-page {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 5rem 1.5rem 3rem; text-align: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem; color: var(--accent);
  letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: 1.5rem;
  opacity: 0; animation: fadeUp 0.36s ease forwards 0.04s;
}

.home-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  font-weight: 700; font-style: normal;  
  line-height: 1.08; margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
  opacity: 0; animation: fadeUp 0.36s ease forwards 0.10s;
  color: var(--text);
}

.grad {
  background: linear-gradient(135deg, var(--accent) 0%, #b388ff 40%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.home-sub {
  font-size: 0.98rem; color: var(--text2); max-width: 500px;
  line-height: 1.75; margin-bottom: 3rem;
  opacity: 0; animation: fadeUp 0.36s ease forwards 0.16s;
  font-weight: 400;
}

/* ── Search ─────────────────────────────────────────────────── */
.search-container {
  position: relative;
  width: 100%; max-width: 640px;
  z-index: 500;
  opacity: 0; animation: fadeUp 0.36s ease forwards 0.22s;
}

.search-wrap { position: relative; }

/* Soft glow ring on focus — not neon, just cool */
.search-glow {
  position: absolute; inset: -1px; border-radius: 1rem;
  background: linear-gradient(135deg, rgba(153,102,221,0.5), rgba(107,150,217,0.4));
  opacity: 0; transition: opacity 0.35s ease; z-index: 0;
}
.search-wrap:focus-within .search-glow { opacity: 0.4; }

.search-inner {
  position: relative; z-index: 1;
  display: flex; align-items: center;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 0.9rem; overflow: hidden;
  transition: border-color 0.3s;
}
.search-wrap:focus-within .search-inner { border-color: rgba(153,102,221,0.35); }

.s-icon { padding: 0 0.9rem 0 1.2rem; color: var(--text3); font-size: 1.05rem; display: flex; align-items: center; line-height: 1; }

#search-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-body); font-size: 0.98rem;
  padding: 1rem 0; caret-color: var(--accent);
}
#search-input::placeholder { color: var(--text3); }
.s-kbd {
  padding: 0 1.2rem; font-family: var(--font-mono);
  font-size: 0.62rem; color: var(--text3);
}

/* Search results */
#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border2); border-radius: 0.9rem;
  overflow-y: auto; max-height: 600px; z-index: 600;
  display: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(153,102,221,0.05);
}
#search-results.open { display: block; animation: fadeDown 0.2s ease; }
@keyframes fadeDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }

.r-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.75rem 1.15rem; cursor: pointer;
  border-bottom: 1px solid var(--border); transition: background 0.15s;
  justify-content: flex-start;
}
.r-item:last-child { border-bottom: none; }
.r-item:hover { background: var(--surface2); }

.r-badge {
  font-family: var(--font-mono); font-size: 0.58rem;
  padding: 0.18rem 0.4rem; border-radius: 0.25rem;
  text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}
.rb-series  { background: rgba(217,123,163,0.12); color: var(--accent3); box-shadow: 0 0 8px rgba(217,123,163,0.2); }
.rb-arc     { background: rgba(107,150,217,0.12); color: var(--accent2); box-shadow: 0 0 8px rgba(107,150,217,0.2); }
.rb-episode { background: rgba(102,179,255,0.12); color: var(--canon); box-shadow: 0 0 8px rgba(102,179,255,0.2); }
.rb-season  { background: rgba(153,102,221,0.12); color: #b388ff; box-shadow: 0 0 8px rgba(179,136,255,0.2); }
.rb-chapter { background: rgba(217,123,163,0.12); color: var(--accent3); box-shadow: 0 0 8px rgba(217,123,163,0.2); }
.rb-movie   { background: rgba(217,123,163,0.12); color: var(--filler); box-shadow: 0 0 8px rgba(217,123,163,0.2); }
.rb-ova     { background: rgba(153,102,221,0.12); color: var(--accent); box-shadow: 0 0 8px rgba(153,102,221,0.2); }

.r-main { font-size: 0.88rem; color: var(--text); font-weight: 500; flex: 1; text-align: left; }
.r-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--text3); white-space: nowrap; margin-left: auto; flex-shrink: 0; }
.r-hl { color: var(--accent); }
.r-ctx { font-size: 0.65rem; color: var(--text3); font-weight: 400; margin-left: 0.35rem; opacity: 0.75; font-family: var(--font-body); letter-spacing: normal; }
.no-res { padding: 1.5rem; text-align: center; color: var(--text3); font-size: 0.8rem; font-style: italic; }

/* ── Filters Panel ───────────────────────────────────────────── */
.filters-panel {
  max-width: 640px; width: 100%; margin: 1.5rem auto 0;
  display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center;
  padding: 0; z-index: 400;
}
.filter-group {
  display: flex; align-items: center; gap: 0.8rem;
}
.filter-label {
  font-family: var(--font-mono); font-size: 0.65rem;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em;
}
.filter-options {
  display: flex; gap: 0.4rem; flex-wrap: wrap;
}
.filter-btn {
  font-family: var(--font-mono); font-size: 0.62rem; padding: 0.22rem 0.6rem;
  border-radius: 99px; border: 1px solid var(--border); background: transparent;
  color: var(--text3); cursor: pointer; transition: all 0.15s;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.on { border-color: var(--accent); color: var(--accent); background: rgba(153,102,221,0.08); }

/* ── Series grid ─────────────────────────────────────────────── */
.series-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem; max-width: 980px; width: 100%; margin-top: 2.5rem;
  position: relative; z-index: 1;
  opacity: 0; animation: fadeUp 0.36s ease forwards 0.28s;
}

.series-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.2rem 1.35rem; cursor: pointer; position: relative; overflow: hidden;
  transition: border-color 0.3s, transform 0.1s ease, box-shadow 0.3s;
  transform-style: preserve-3d;
  perspective: 1000px;
  /* <a> reset — cards are now anchor elements for native middle-click */
  display: block; text-decoration: none; color: inherit;
}
.series-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--c1, var(--accent)) 0%, var(--c2, var(--accent2)) 100%);
  opacity: 0; transition: opacity 0.3s;
}
.series-card:hover { border-color: var(--border2); box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
.series-card:hover::before { opacity: 0.04; }
.cc { position: relative; z-index: 1; }

.cc { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100%; }
.ctag { font-family: var(--font-mono); font-size: 0.58rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 0.55rem; opacity: 0.8; display: none; }

/* Fixed-height title container: exactly 2 lines tall, vertically centers short titles */
.c-title-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 2.5rem;            /* 1rem font × 1.25 line-height × 2 lines */
  margin-bottom: 0.45rem;
  flex-shrink: 0;
}
.ctitle {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  /* Line-clamp at 2 lines with ellipsis */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  /* Allow breaking in the middle of words as requested */
  word-break: break-all;
}

.cgenres {
  display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: center;
  height: 1.4rem;            /* Fixed height for tag row — keeps stats aligned */
  align-items: center;
  overflow: hidden;
  margin-bottom: 0.8rem;
  flex-shrink: 0;
}
.ctag-genre { font-family: var(--font-mono); font-size: 0.52rem; color: var(--accent2); line-height: 1; opacity: 0.75; padding: 0.15rem 0.4rem; background: rgba(107,150,217,0.08); border-radius: 0.25rem; }
.cstats { display: flex; gap: 1.4rem; margin: 0.8rem auto; justify-content: center; flex-shrink: 0; }
.csv { font-family: var(--font-mono); font-size: 1.05rem; }
.csv .u { font-size: 0.62rem; color: var(--text3); margin-left: 0.12rem; }
.csl { font-size: 0.62rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.15rem; }
.card-bottom { margin-top: auto; }
.cprog { margin-bottom: 0.6rem; height: 2px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.cprog-fill { height: 100%; border-radius: 99px; transition: width 1.1s cubic-bezier(0.34,1.3,0.64,1); width: 0; }
.crating { font-family: var(--font-mono); font-size: 0.75rem; color: var(--accent); text-align: center; font-weight: 500; }

/* ── Series page ─────────────────────────────────────────────── */
#series-page { padding: calc(var(--nav-h) + 2.5rem) 1.5rem 5rem; max-width: 1140px; margin: 0 auto; }

.sp-header { margin-bottom: 2rem; display: flex; align-items: flex-start; gap: 1.5rem; }
.sp-cover-container { width: 200px; height: 280px; flex-shrink: 0; }
.sp-cover { width: 100%; height: 100%; object-fit: cover; border-radius: var(--r); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.sp-header-content { flex: 1; display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.sp-sub { font-family: var(--font-mono); font-size: 0.65rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.18em; opacity: 0.85; }
.sp-title { 
  font-family: var(--font-display); 
  font-size: clamp(2rem, 4.5vw, 3.2rem); 
  font-weight: 700; 
  font-style: normal; 
  line-height: 1.1; 
  letter-spacing: -0.01em; 
  color: var(--text); 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: pointer;
}
.sp-title.expanded {
  white-space: normal;
  overflow: visible;
  transition: all 0.3s ease;
}
.sp-status-pills { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sp-tags { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.sp-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text2);
  max-width: 100%;
}
.desc-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  margin-left: 0.5rem;
  border-radius: 0.25rem;
  transition: background 0.2s;
}
.desc-toggle:hover {
  background: rgba(153,102,221,0.1);
}
.sp-tag { font-family: var(--font-mono); font-size: 0.6rem; padding: 0.22rem 0.55rem; border-radius: 99px; border: 1px solid var(--border); color: var(--text2); background: rgba(107,150,217,0.05); }
.sp-source-tag { border-color: var(--accent); color: var(--accent); background: rgba(153,102,221,0.1); font-weight: 500; }
.sp-status-tag { border-color: var(--canon); color: var(--canon); background: rgba(102,179,255,0.08); font-weight: 500; }

/* ── Series info panel (MAL data) ────────────────────────────── */
.info-panel {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin-bottom: 1.2rem;
}
/* Source strip spans all 4 columns as a subtle footer row */
.ip-source-strip {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.42rem 1.4rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg3) 60%, transparent);
  min-height: 0;
}
.ip-source-strip:empty { display: none; }
.info-stat {
  padding: 1.1rem 1.4rem;
  border-right: 1px solid var(--border);
}
.info-stat:last-child { border-right: none; }
.info-stat-val { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; margin-bottom: 0.2rem; }
.info-stat-val .star { color: var(--accent); font-size: 0.9rem; margin-right: 0.15rem; }
.info-stat-lbl { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); }
.ip-status-note { font-family: var(--font-mono); font-size: 0.52rem; color: var(--text3); text-transform: lowercase; opacity: 0.75; letter-spacing: 0.04em; display: block; margin-top: 0.15rem; }

/* ── Overview / adaptation bar ───────────────────────────────── */
.ov-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem 1.75rem; margin-bottom: 1.2rem; }
.ov-stats { display: flex; gap: 2.2rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.sv { font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; }
.sv .u { font-size: 0.85rem; color: var(--text3); font-weight: 400; margin-left: 0.15rem; }
.sl { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 0.15rem; }
.bar-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.63rem; color: var(--text3); margin-bottom: 0.45rem; }
.bar { height: 6px; background: var(--surface3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width 1.3s cubic-bezier(0.34,1.2,0.64,1); width: 0; }
.tip { font-family: var(--font-mono); font-size: 0.63rem; color: var(--text3); margin-top: 0.7rem; display: flex; gap: 0.45rem; align-items: center; }
.tip-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.bar-last-updated { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text3); opacity: 0.6; margin: -0.6rem 0 1rem; }

/* ── Section headers ─────────────────────────────────────────── */
.sec-hdr { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.1rem; margin-top: 2.5rem; }
.sec-lbl { font-family: var(--font-mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); opacity: 0.8; }
.sec-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; font-style: normal; }
.sec-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border2), transparent); }

/* ── Seasons chips ───────────────────────────────────────────── */
.seasons-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.season-chip {
  font-family: var(--font-mono); font-size: 0.68rem;
  padding: 0.35rem 0.85rem; border-radius: 99px;
  border: 1px solid var(--border); color: var(--text2);
  background: var(--surface); display: flex; align-items: center; gap: 0.45rem;
}
.season-chip .sdot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: 0.7; }
.season-chip a { color: var(--accent); text-decoration: none; font-size: 0.58rem; opacity: 0.6; transition: opacity 0.2s; }
.season-chip a:hover { opacity: 1; }

/* Film entries in the primary seasons row */
.season-chip-film .sdot { background: var(--accent3) !important; opacity: 0.8; }

/* Alternative / parallel canon entries — same shape, visually secondary */
.season-chip-alt {
  opacity: 0.65;
  border-style: dashed;
}
.season-chip-alt:hover { opacity: 1; }
.sdot-alt { background: var(--text3) !important; }
.chip-type-lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-right: 0.1rem;
}

/* Divider between primary and alt rows */
.seasons-alt-divider {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  align-self: center;
  padding: 0 0.2rem;
  opacity: 0.5;
}

/* ── Series page enter animation ────────────────────────────────── */
@keyframes seriesEnter {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#series-page.page-entering {
  animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger the main content blocks slightly */
#series-page.page-entering .sp-header        { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both; }
#series-page.page-entering .info-panel       { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both; }
#series-page.page-entering .ov-panel         { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both; }
#series-page.page-entering #seasons-section  { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
#series-page.page-entering #watch-guide-section { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
#series-page.page-entering .arcs-grid        { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.19s both; }
#series-page.page-entering .tabs             { animation: seriesEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both; }

/* ── Arc cards ───────────────────────────────────────────────── */
.arcs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.65rem; }

.arc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; transition: border-color 0.25s; }
.arc-card:hover { border-color: var(--border2); }

/* Movie arc cards have a subtle warm tint */
.arc-card.arc-movie { border-color: rgba(153,102,221,0.18); }
.arc-card.arc-movie:hover { border-color: rgba(153,102,221,0.35); }

.arc-hdr { display: flex; align-items: center; justify-content: space-between; padding: 0.95rem 1.15rem; cursor: pointer; gap: 0.7rem; user-select: none; }
.arc-n { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text3); width: 1.8rem; flex-shrink: 0; }
.arc-info { flex: 1; }
.arc-name { font-family: var(--font-body); font-weight: 600; font-size: 0.92rem; margin-bottom: 0.25rem; }
.arc-range { font-family: var(--font-mono); font-size: 0.67rem; color: var(--text2); display: flex; gap: 1rem; flex-wrap: wrap; }
.arc-movie-badge { font-family: var(--font-mono); font-size: 0.58rem; padding: 0.15rem 0.4rem; border-radius: 0.25rem; background: rgba(153,102,221,0.12); color: var(--accent); letter-spacing: 0.05em; text-transform: uppercase; }

.arc-badge { font-family: var(--font-mono); font-size: 0.58rem; padding: 0.18rem 0.45rem; border-radius: 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; flex-shrink: 0; box-shadow: 0 0 8px rgba(102,179,255,0.3); }
.s-canon { background: rgba(102,179,255,0.12); color: var(--canon); border: 1px solid rgba(102,179,255,0.35); box-shadow: inset 0 0 12px rgba(102,179,255,0.1); }
.s-filler { background: rgba(217,123,163,0.12); color: var(--filler); border: 1px solid rgba(217,123,163,0.35); box-shadow: inset 0 0 12px rgba(217,123,163,0.1); }
.s-mixed { background: rgba(153,102,221,0.12); color: var(--mixed); border: 1px solid rgba(153,102,221,0.35); box-shadow: inset 0 0 12px rgba(153,102,221,0.1); }

.arc-chev { color: var(--text3); transition: transform 0.3s ease; flex-shrink: 0; font-size: 0.7rem; }
.arc-card.open .arc-chev { transform: rotate(180deg); }
.arc-body { display: none; border-top: 1px solid var(--border); padding: 0.7rem 1.15rem; }
.arc-card.open .arc-body { display: block; }
.arc-note { font-size: 0.8rem; color: var(--text2); margin-bottom: 0.6rem; line-height: 1.55; font-style: italic; }
.ep-list { display: flex; flex-direction: column; gap: 0.2rem; max-height: 220px; overflow-y: auto; }
.ep-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.32rem 0.45rem; border-radius: 0.4rem; font-size: 0.8rem; transition: background 0.15s; cursor: pointer; }
.ep-item:hover { background: var(--surface2); }
.ep-num { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text3); width: 2.5rem; flex-shrink: 0; }
.ep-title { flex: 1; color: var(--text2); }

/* ── Tables ──────────────────────────────────────────────────── */
.tabs { display: flex; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.tab-btn { padding: 0.65rem 1.15rem; font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; }
.tab-btn:hover { color: var(--text2); }
.tab-btn.on { color: var(--accent); border-bottom-color: var(--accent); }

.tsec { display: none; }
.tsec.on { display: block; }

.dtw { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }

.sticky-group {
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
  background: var(--surface);
  border-radius: var(--r) var(--r) 0 0;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  height: var(--toolbar-h);
}
.filters { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.fb { font-family: var(--font-mono); font-size: 0.62rem; padding: 0.22rem 0.6rem; border-radius: 99px; border: 1px solid var(--border); background: transparent; color: var(--text3); cursor: pointer; transition: all 0.15s; text-transform: uppercase; letter-spacing: 0.05em; }
.fb:hover { border-color: var(--accent); color: var(--accent); }
.fb.on { border-color: var(--accent); color: var(--accent); background: rgba(153,102,221,0.08); }
.tcount { font-family: var(--font-mono); font-size: 0.62rem; color: var(--text3); }
.tscroll { overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 0.8rem; table-layout: fixed; border-spacing: 0; }

/* Common styles for all table headers and data cells */
.dt th, .dt td {
  padding: 0.65rem 0.95rem;
  color: var(--text2);
  vertical-align: middle;
  font-weight: normal;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sticky header specific styles */
.dt thead th {
  position: sticky;
  top: calc(var(--nav-h) + var(--toolbar-h));
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
}

/* Column widths for Episode and Chapter tables (5 columns) */
.tsec:has(#ep-tbody) .dt th:nth-child(1), .tsec:has(#ep-tbody) .dt td:nth-child(1),
.tsec:has(#ch-tbody) .dt th:nth-child(1), .tsec:has(#ch-tbody) .dt td:nth-child(1) { width: 10%; }
.tsec:has(#ep-tbody) .dt th:nth-child(2), .tsec:has(#ep-tbody) .dt td:nth-child(2),
.tsec:has(#ch-tbody) .dt th:nth-child(2), .tsec:has(#ch-tbody) .dt td:nth-child(2) { width: 35%; }
.tsec:has(#ep-tbody) .dt th:nth-child(3), .tsec:has(#ep-tbody) .dt td:nth-child(3),
.tsec:has(#ch-tbody) .dt th:nth-child(3), .tsec:has(#ch-tbody) .dt td:nth-child(3) { width: 20%; }
.tsec:has(#ep-tbody) .dt th:nth-child(4), .tsec:has(#ep-tbody) .dt td:nth-child(4),
.tsec:has(#ch-tbody) .dt th:nth-child(4), .tsec:has(#ch-tbody) .dt td:nth-child(4) { width: 15%; }
.tsec:has(#ep-tbody) .dt th:nth-child(5), .tsec:has(#ep-tbody) .dt td:nth-child(5),
.tsec:has(#ch-tbody) .dt th:nth-child(5), .tsec:has(#ch-tbody) .dt td:nth-child(5) { width: 20%; }

/* Column widths for Season Map table (3 columns) */
.tsec:has(#sv-tbody) .dt th:nth-child(1), .tsec:has(#sv-tbody) .dt td:nth-child(1) { width: 33.33%; }
.tsec:has(#sv-tbody) .dt th:nth-child(2), .tsec:has(#sv-tbody) .dt td:nth-child(2) { width: 33.33%; }
.tsec:has(#sv-tbody) .dt th:nth-child(3), .tsec:has(#sv-tbody) .dt td:nth-child(3) { width: 33.34%; }

.dt tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
.dt tbody tr:last-child { border-bottom: none; }
.dt tbody tr:hover { background: rgba(255,255,255,0.015); }
.dt tbody tr.hl { background: rgba(153,102,221,0.07) !important; outline: 1px solid rgba(153,102,221,0.25); outline-offset: -1px; animation: hlRow 1.8s ease; }
@keyframes hlRow { 0%{ background: rgba(153,102,221,0.18); } 100%{ background: rgba(153,102,221,0.07); } }

/* Remove specific td-* classes as widths are handled by nth-child */
.td-n, .td-t, .td-a, .td-s, .td-c { 
  font-family: var(--font-mono); /* Keep font styles for td-* for specific styling as needed */
  font-size: 0.68rem;
  color: var(--text3);
  white-space: nowrap; 
  text-align: left;
}

/* Re-adjust specific font sizes/colors for clarity in data cells, if needed */
.td-t { color: var(--text); font-size: 0.8rem; }
.td-a { font-size: 0.75rem; color: var(--text3); }
.td-s { font-size: 0.75rem; }

/* ── Manga chapter title styles ──────────────────────────────── */
/* In the chapter table: "Chapter N" label + manga title on the same row */
.ch-num-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text3);
  font-family: var(--font-mono);
  line-height: 1.2;
  margin-bottom: 0.15rem;
}
.ch-manga-title {
  display: block;
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.3;
}
/* Inline manga title shown when a single chapter is covered in the episode table */
td.td-c .ch-manga-title,
.ep-card-ch .ch-manga-title {
  display: inline;
  font-size: 0.72rem;
  color: var(--text3);
  margin-left: 0.35rem;
  font-style: italic;
}
/* Badge showing chapter number beside a manga title in mobile cards */
.ch-num-badge {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: var(--border);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text3);
  vertical-align: middle;
  line-height: 1.6;
}

/* Status dots with glow */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; vertical-align: middle; margin-right: 0.4rem; box-shadow: 0 0 8px currentColor; }
.d-canon { background: var(--canon); color: var(--canon); }
.d-filler { background: var(--filler); color: var(--filler); }
.d-mixed { background: var(--mixed); color: var(--mixed); }
.yes  { color: var(--canon); font-family: var(--font-mono); font-size: 0.63rem; }
.nope { color: var(--text3); font-family: var(--font-mono); font-size: 0.63rem; }

/* ── Non-canon media (bottom section) ───────────────────────── */
.noncanon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.65rem; }
.nc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem 1.15rem; transition: border-color 0.2s; }
.nc-card:hover { border-color: var(--border2); }
.nc-type { font-family: var(--font-mono); font-size: 0.58rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 0.4rem; }
.nc-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 0.3rem; line-height: 1.35; }
.nc-meta { font-family: var(--font-mono); font-size: 0.63rem; color: var(--text3); }
.nc-score { font-family: var(--font-mono); font-size: 0.63rem; color: var(--accent); margin-top: 0.35rem; }
.nc-mal { display: inline-block; margin-top: 0.4rem; font-family: var(--font-mono); font-size: 0.58rem; color: var(--text3); text-decoration: none; transition: color 0.2s; }
.nc-mal:hover { color: var(--accent); }

.api-msg { padding: 1.2rem; color: var(--text3); font-family: var(--font-mono); font-size: 0.72rem; font-style: italic; }
.api-err { padding: 0.9rem 1.1rem; color: var(--filler); font-family: var(--font-mono); font-size: 0.7rem; background: rgba(184,112,112,0.05); border-radius: var(--r); border: 1px solid rgba(184,112,112,0.12); }

/* ── Back button ─────────────────────────────────────────────── */
.back-btn { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.68rem; color: var(--text3); cursor: pointer; padding: 0.35rem 0; margin-bottom: 1.5rem; transition: color 0.2s; border: none; background: none; text-transform: uppercase; letter-spacing: 0.1em; }
.back-btn:hover { color: var(--accent); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 99px; }


/* ── Mobile episode / chapter cards ─────────────────────────────── */
/* Hidden on desktop; shown on mobile via media query */
.card-list { display: none; }

.ep-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.ep-card:last-child { border-bottom: none; }
.ep-card:active { background: var(--surface2); }

.ep-card-num {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text3);
  min-width: 2.4rem;
  text-align: center;
  flex-shrink: 0;
  padding-top: 0.1rem;
  line-height: 1.4;
}

.ep-card-body { flex: 1; min-width: 0; }

.ep-card-title {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.32rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text3);
}

.ep-card-arc {
  color: var(--text3);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-card-status { display: flex; align-items: center; gap: 0.3rem; }

.ep-card-ch { color: var(--accent2); }

.ep-card-adapted   { color: var(--canon); }
.ep-card-unadapted { color: var(--text3); }

.card-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-style: italic;
}

/* Highlight on search jump */
.ep-card.hl {
  background: rgba(153,102,221,0.07) !important;
  outline: 1px solid rgba(153,102,221,0.25);
  outline-offset: -1px;
  animation: hlRow 1.8s ease;
}

/* ── Logo: full on desktop always, swap on mobile by page ────── */
.nav-logo-img    { display: block; }
.nav-favicon-img { display: none; width: 28px; height: 28px; object-fit: contain; }

/* ── Logo centering on home page ─────────────────────────────── */
/* When on-home, the search and breadcrumb are hidden — center the logo */
nav.on-home .nav-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Mobile back arrow: hidden on desktop ────────────────────── */
.nav-back-mobile {
  display: none;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  line-height: 1;
  transition: color 0.2s;
  flex-shrink: 0;
}
.nav-back-mobile:hover { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────────── */

/* Tablet / large mobile — 720px and below */

/* ── Season map mobile cards ─────────────────────────────────────── */
.sv-season-group { border-bottom: 1px solid var(--border); }
.sv-season-group:last-child { border-bottom: none; }

.sv-season-hdr {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding: 0.65rem 1rem 0.35rem;
  background: rgba(153,102,221,0.04);
  border-bottom: 1px solid var(--border);
}

.sv-season-eps { display: flex; flex-direction: column; }

.sv-ep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}
.sv-ep-row:last-child { border-bottom: none; }

.sv-ep-local   { color: var(--text2); }
.sv-ep-overall { color: var(--text3); font-size: 0.68rem; }

@media (max-width: 600px) {
  /* Swap table for cards on mobile */
  .sticky-group { display: none; }
  .dtw          { display: none; }
  .card-list    { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
}

@media (max-width: 720px) {
  nav { padding: 0 1rem; }

  /* Sort filters — hide label, single scrollable row of chips */
  .filter-label { display: none; }
  .filter-group { width: 100%; }
  .filter-options {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .filter-options::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; }
  .filters-panel {
    margin: 0.75rem auto 0;
    justify-content: flex-start;
    padding: 0;
  }
  .series-grid { margin-top: 1rem; }

  /* Search results — stretch to full screen width on mobile.
     The nav search bar stays 400px max but the dropdown punches out
     to the screen edges using negative margins. */
  #nav-search-results {
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    border-radius: 0 0 0.6rem 0.6rem;
    border-top: none;
    max-height: 60vh;
  }
  #search-results {
    left: 0; right: 0;
    border-radius: 0 0 0.6rem 0.6rem;
    max-height: 60vh;
  }

  .nav-logo { gap: 0.5rem; }
  .nav-logo-img { height: 26px; }
  .nav-bc { font-size: 0.65rem; gap: 0.3rem; }
  .nav-search { max-width: 260px; }

  #series-page { padding: calc(var(--nav-h) + 1.5rem) 1rem 4rem; }

  .sp-header { gap: 1rem; align-items: flex-start; }
  .sp-cover-container { width: 130px; height: auto; aspect-ratio: 2/3; flex-shrink: 0; }

  .sp-title {
    font-size: clamp(1.4rem, 5.5vw, 2.2rem);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .sp-status-pills { gap: 0.4rem; }
  .sp-tags { gap: 0.35rem; }

  .info-panel { grid-template-columns: 1fr 1fr; }
  .info-stat:nth-child(2) { border-right: none; }
  .info-stat:nth-child(3) { border-top: 1px solid var(--border); }
  .info-stat:nth-child(4) { border-top: 1px solid var(--border); }

  .arcs-grid { grid-template-columns: 1fr; }

  /* Tables: scroll horizontally — show all columns, never hide them */
  .dtw .tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dt { min-width: 520px; }

  .ov-stats { gap: 1.5rem; }
  .home-sub { font-size: 0.9rem; }
}

/* Small mobile — 480px and below */
@media (max-width: 480px) {
  nav.on-home .nav-logo-img    { display: block; }
  nav.on-home .nav-favicon-img { display: none; }

  nav:not(.on-home) .nav-logo-img    { display: none; }
  nav:not(.on-home) .nav-favicon-img { display: block; }
  nav:not(.on-home) .nav-bc          { display: none; }
  nav:not(.on-home) .nav-back-mobile { display: block; }

  .nav-search { max-width: 200px; }

  .sp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .sp-cover-container {
    width: 45%;
    height: auto;
    aspect-ratio: 2/3;
  }
  .sp-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    border-radius: var(--r);
  }

  .sp-title {
    font-size: clamp(1.6rem, 7vw, 2rem);
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .info-panel    { grid-template-columns: 1fr 1fr; }
  .info-stat     { padding: 0.8rem 0.9rem; }
  .info-stat-val { font-size: 1.3rem; }

  /* Tighter table font on small screens so more content fits before needing to scroll */
  .dt { font-size: 0.72rem; min-width: 480px; }
  .dt th, .dt td { padding: 0.55rem 0.65rem; }

  .ov-panel  { padding: 1.2rem; }
  .ov-stats  { gap: 1.2rem; }
  .sv        { font-size: 1.5rem; }

  .toolbar   { height: auto; padding: 0.65rem 1rem; gap: 0.5rem; }
  .filters   { gap: 0.3rem; }
  .arc-range { gap: 0.5rem; }

  .noncanon-grid { grid-template-columns: 1fr; }
}

/* ── Watch Guide ──────────────────────────────────────────────────── */
.wg-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 2.5rem;
}

.wg-connector {
  display: flex;
  justify-content: flex-start;
  padding-left: 1.15rem;
  height: 2rem;
}
.wg-connector-line {
  width: 2px;
  height: 100%;
  background: linear-gradient(180deg, var(--border), transparent);
}

.wg-step {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg2);
  position: relative;
  transition: border-color 0.2s;
}
.wg-step:hover { border-color: var(--border-hover, var(--accent2)); }

.wg-step.wg-manga  { border-left: 3px solid var(--accent3); }
.wg-step.wg-anime  { border-left: 3px solid var(--accent2); }
.wg-step.wg-movie  { border-left: 3px solid var(--accent); }
.wg-choice-step    { border-left: 3px solid #a78bfa; background: color-mix(in srgb, var(--bg2) 97%, #a78bfa 3%); }

.wg-step-num {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text2);
  font-family: 'Fira Code', monospace;
  margin-top: 0.1rem;
}

.wg-step-body { flex: 1; min-width: 0; }

.wg-step-hdr,
.wg-option-hdr {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.wg-step-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a78bfa;
  margin-bottom: 0.35rem;
}

.wg-step-title,
.wg-opt-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text1);
}

.wg-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.wg-anime  .wg-type-badge, .wg-option .wg-anime { background: color-mix(in srgb, var(--accent2) 15%, transparent); color: var(--accent2); border: 1px solid color-mix(in srgb, var(--accent2) 35%, transparent); }
.wg-movie  .wg-type-badge, .wg-option .wg-movie { background: color-mix(in srgb, var(--accent)  15%, transparent); color: var(--accent);  border: 1px solid color-mix(in srgb, var(--accent)  35%, transparent); }
.wg-manga  .wg-type-badge, .wg-option .wg-manga { background: color-mix(in srgb, var(--accent3) 15%, transparent); color: var(--accent3); border: 1px solid color-mix(in srgb, var(--accent3) 35%, transparent); }
.wg-choice-step .wg-type-badge { background: color-mix(in srgb, #a78bfa 15%, transparent); color: #a78bfa; border: 1px solid color-mix(in srgb, #a78bfa 35%, transparent); }

.wg-covers {
  font-size: 0.72rem;
  font-family: 'Fira Code', monospace;
  color: var(--text3);
  padding: 0.15rem 0.45rem;
  background: var(--bg3);
  border-radius: 4px;
  white-space: nowrap;
}

.wg-note {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.6;
  margin: 0.3rem 0 0.4rem;
}
.wg-choice-note {
  color: var(--text3);
  font-style: italic;
  margin-bottom: 0.8rem;
}

.wg-mal-link {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--accent2);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.wg-mal-link:hover { opacity: 1; }

.wg-start-ch {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: color-mix(in srgb, var(--accent3) 12%, var(--bg3));
  border: 1px solid color-mix(in srgb, var(--accent3) 30%, transparent);
  border-radius: var(--r);
  font-size: 0.78rem;
  color: var(--accent3);
}
.wg-start-ch strong { font-weight: 700; }

/* Choice step options */
.wg-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.wg-option {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--r) - 2px);
  background: var(--bg3);
}
.wg-or {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  padding: 0.4rem 0;
  position: relative;
}
.wg-or::before, .wg-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border);
}
.wg-or::before { left: 0; }
.wg-or::after  { right: 0; }

@media (max-width: 600px) {
  .wg-step { padding: 0.9rem 1rem; gap: 0.7rem; }
  .wg-step-num { width: 1.5rem; height: 1.5rem; font-size: 0.65rem; }
  .wg-step-title, .wg-opt-title { font-size: 0.85rem; }
  .wg-note { font-size: 0.75rem; }
}

/* ── Watch Guide — UX polish & collapsible body ─────────────────── */

/* Row uses same sec-hdr layout but the box is a flex child, not the row itself */
/* watch-guide-section wrapper: no extra bottom space */
#watch-guide-section { margin-bottom: 0; }

/* Arc section directly follows watch guide — same top margin as a normal sec-hdr
   but the wg-sec-hdr-row already consumed 2.5rem, so reduce arc's margin-top to match
   the visual gap between season chips and the watch guide header above it.
   Season chips have no margin-bottom, so gap there = 2.5rem (from wg-sec-hdr-row margin-top).
   We want the same gap below the watch guide header box. */
#watch-guide-section + .sec-hdr { margin-top: 2.5rem; }

.wg-sec-hdr-row {
  /* inherits display:flex, align-items:center, gap, margin-top from .sec-hdr */
  margin-bottom: 0;
}

/* The bordered clickable box — flex:1 so it fills the space after the number */
.wg-header-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.6rem 0.9rem;
  background: var(--bg2);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.2s, background 0.2s;
  min-width: 0;
}
.wg-header-box:hover {
  border-color: var(--border2);
  background: var(--bg3);
}
.wg-header-box.wg-hdr-open {
  border-color: color-mix(in srgb, var(--accent2) 40%, var(--border));
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.wg-header-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border2), transparent);
}

/* "Click to expand" hint */
.wg-hint {
  font-size: 0.65rem;
  color: var(--text3);
  font-family: var(--font-mono);
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.wg-header-box:hover .wg-hint { opacity: 1; }
.wg-header-box.wg-hdr-open .wg-hint { display: none; }

/* Collapsible body — single consolidated block */
.wg-body {
  display: grid;
  grid-template-rows: 0fr;
  overflow: hidden;
  padding-left: 2.1rem;          /* aligns body under the header box */
  max-height: 0;                 /* belt-and-suspenders: force 0 height when collapsed */
  transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.wg-body > .wg-list {
  min-height: 0;
  overflow: hidden;
}
.wg-body.wg-open {
  grid-template-rows: 1fr;
  max-height: 2000px;            /* large enough for any content */
  border: 1px solid color-mix(in srgb, var(--accent2) 40%, var(--border));
  border-top: none;
  border-bottom-left-radius: var(--r);
  border-bottom-right-radius: var(--r);
  padding: 0 0.9rem;
}
.wg-body.wg-open > .wg-list {
  padding: 1rem 0 0.5rem;
}

/* Chevron accent when open */
.wg-header-box.wg-hdr-open .wg-chev { color: var(--accent2); }

.wg-chev {
  font-size: 0.85rem;
  color: var(--text3);
  flex-shrink: 0;
  transition: color 0.2s, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: auto;
  align-self: center;
}

/* Small summary badge next to title */
.wg-badge {
  font-size: 0.65rem;
  font-family: 'Fira Code', monospace;
  color: var(--text3);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
  margin-left: 0.6rem;
}

/* sec-line already flex:1 from base .sec-line rule; nothing extra needed */

/* ── Info panel — source strip ───────────────────────────────────── */
.ip-source-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
}
.ip-medium-badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.ip-medium-anime {
  background: color-mix(in srgb, var(--accent2) 13%, transparent);
  color: var(--accent2);
  border: 1px solid color-mix(in srgb, var(--accent2) 28%, transparent);
}
.ip-medium-manga {
  background: color-mix(in srgb, var(--accent3) 13%, transparent);
  color: var(--accent3);
  border: 1px solid color-mix(in srgb, var(--accent3) 28%, transparent);
}
.ip-mal-link {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--text3);
  text-decoration: none;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  transition: color 0.15s;
  opacity: 0.7;
}
.ip-mal-link:hover { color: var(--accent2); opacity: 1; }

/* ── Footer ──────────────────────────────────────────────────────── */
#site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--border);
  background: var(--bg1);
}

.ft-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
}

/* Top row: brand left | columns right */
.ft-top {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
  margin-bottom: 1.4rem;
}

/* Brand block — left side, vertically centered */
.ft-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  flex-shrink: 0;
  width: 140px;
  padding-top: 0.1rem;
}
.ft-brand-logo {
  height: 28px;
  width: auto;
  opacity: 0.9;
  display: block;
}
.ft-brand-tagline {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.4;
}
.ft-origin {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text3);
  margin-top: 0.1rem;
}

/* Divider between brand and columns */
.ft-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  flex-shrink: 0;
}

/* Columns — take remaining space */
.ft-cols {
  display: flex;
  gap: 2.5rem;
  flex: 1;
  flex-wrap: wrap;
}
.ft-col { text-align: left; }
.ft-col-heading {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.ft-col-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
}
.ft-col-links a {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  color: var(--text2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  transition: color 0.15s;
}
.ft-col-links a:hover { color: var(--text1); }
.ft-ext-icon {
  font-size: 0.5rem;
  opacity: 0.4;
  margin-left: 0.1rem;
}

/* Bottom bar */
.ft-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ft-disclaimer {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text3);
  line-height: 1.65;
  max-width: 100%;
}
.ft-copy {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text3);
  opacity: 0.5;
}

/* ── Footer responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Stack brand above columns on mobile */
  .ft-top {
    flex-direction: column;
    gap: 1.3rem;
  }
  .ft-brand {
    width: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .ft-brand-tagline {
    display: none; /* keep it tight on mobile — logo is enough */
  }
  .ft-divider { display: none; }
  .ft-cols { gap: 1.5rem 2rem; }
  .ft-inner { padding: 1.6rem 1.1rem 1.2rem; }
}

/* ── Static pages (privacy, about, etc.) ────────────────────────── */
.static-page {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 3rem) 1.5rem 4rem;
}
.static-inner {
  max-width: 680px;
  margin: 0 auto;
}
.static-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.9rem;
}
.static-lead {
  font-size: 0.95rem;
  color: var(--text2);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  max-width: 520px;
}
.static-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.static-section {
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--border);
}
.static-section:last-of-type { border-bottom: none; }
.static-section h2 {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text1);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}
.static-section p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.75;
}
.static-section p + p { margin-top: 0.6rem; }
.static-section a {
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.static-section a:hover { border-bottom-color: var(--accent2); }
.static-updated {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text3);
  margin-top: 2rem;
}

@media (max-width: 600px) {
  .static-page { padding: calc(var(--nav-h) + 2rem) 1.1rem 3rem; }
  .static-lead { font-size: 0.88rem; }
  .static-section p { font-size: 0.8rem; }
}
.static-page {
  padding: calc(var(--nav-h) + 2.5rem) 1.5rem 5rem;
  max-width: 720px;
  margin: 0 auto;
}
.static-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 0.5rem;
}
.static-body p {
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.75;
}
.static-body a {
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.static-body a:hover { border-bottom-color: var(--accent2); }
.static-updated {
  font-family: var(--font-mono);
  font-size: 0.62rem !important;
  color: var(--text3) !important;
  margin-top: 0.5rem;
}
