/* === Spider-Man History — Styles === */

:root {
  --red: #c8102e;
  --red-dark: #8a0a1e;
  --blue: #1a3a8a;
  --blue-dark: #0f2455;
  --ink: #161a22;
  --ink-soft: #444c5c;
  --paper: #f5f1e8;
  --paper-2: #fffdf6;
  --line: #d8d2c4;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.18);
  --radius: 10px;
  --halftone:
    radial-gradient(circle, rgba(200,16,46,0.05) 1px, transparent 1.2px) 0 0 / 8px 8px,
    radial-gradient(circle, rgba(26,58,138,0.04) 1px, transparent 1.2px) 4px 4px / 8px 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(rgba(200,16,46,0.04) 1px, transparent 1.4px),
    radial-gradient(rgba(26,58,138,0.035) 1px, transparent 1.4px);
  background-size: 12px 12px, 12px 12px;
  background-position: 0 0, 6px 6px;
  line-height: 1.55;
}

a { color: var(--blue); }
a:hover { color: var(--red); }

/* === Header === */
.site-header {
  position: relative;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,212,0,0.18), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(200,16,46,0.32), transparent 50%),
    linear-gradient(135deg, var(--blue-dark) 0%, #281e58 35%, var(--red-dark) 75%, #4a0810 100%);
  color: white;
  padding: 14px 24px 0;
  border-bottom: 5px solid var(--ink);
  box-shadow: var(--shadow-lg);
  /* overflow: hidden was clipping the corner SVG webs — but it also broke
     position:sticky on the .tabs descendant. The web SVGs have negative
     top/bottom offsets only and don't visibly extend past the viewport, so
     clipping isn't needed. */
}
/* Compact-by-default header — every main function (search, tabs, toolbar) is
   visible above the fold. The original "movie-poster" hero is still here but
   tucked into a click-to-expand banner so it doesn't push tabs off-screen. */
body:not(.hero-expanded) .hero-art,
body:not(.hero-expanded) .site-header .lede,
body:not(.hero-expanded) .kicker,
body:not(.hero-expanded) .stat-row {
  display: none;
}
body:not(.hero-expanded) .hero {
  padding: 8px 0 14px;
  grid-template-columns: 1fr;
}
body:not(.hero-expanded) .comic-title .t-a,
body:not(.hero-expanded) .comic-title .t-c {
  display: none;
}
body:not(.hero-expanded) .comic-title .t-b {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 0;
  letter-spacing: 1.5px;
}
body:not(.hero-expanded) .comic-title .t-b::after {
  content: ' COMICS';
  font-size: 0.6em;
  opacity: 0.55;
  letter-spacing: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
/* iOS Safari fix: any element with backdrop-filter on a sticky/fixed
   ancestor can intercept touches in confusing ways. Belt-and-suspenders
   touch-action default for all interactive elements. */
button, a, [role="button"], .tab {
  touch-action: manipulation;
}

/* Tab bar sticks to the top of the viewport on scroll so the main nav is
   always one click away — no scrolling back up. Lives OUTSIDE .site-header
   so its sticky containing block is the body, not the header (otherwise it
   would scroll away with the header). */
.tabs {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(180deg, rgba(20,16,50,0.96) 0%, rgba(50,15,30,0.96) 100%);
  /* backdrop-filter removed for now — iOS Safari has bugs where sticky
     elements with backdrop-filter steal touch events from content below. */
  border-bottom: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  padding: 0 24px;
}
.tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0;
}
/* Header toggle row — "Expand banner" / settings — sits in line with the
   header toolbar so we don't introduce a whole new visual element. */
.hero-toggle-btn {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-toggle-btn:hover { background: rgba(255,255,255,0.16); }
body.hero-expanded .hero-toggle-btn .open-label { display: none; }
body:not(.hero-expanded) .hero-toggle-btn .close-label { display: none; }
/* Halftone dot overlay over the gradient */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(0,0,0,0.18) 1px, transparent 1.5px),
    radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1.5px);
  background-size: 14px 14px, 14px 14px;
  background-position: 0 0, 7px 7px;
  pointer-events: none;
  z-index: 0;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Spider web SVG corner decorations */
.web-decor {
  position: absolute;
  width: 360px;
  height: 360px;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
}
.web-top-right    { top: -40px;     right: -40px; }
.web-bottom-left  { bottom: -40px;  left: -40px; }
@media (max-width: 720px) {
  .web-decor { width: 220px; height: 220px; }
  .web-top-right { top: -30px; right: -30px; }
  .web-bottom-left { bottom: -30px; left: -30px; }
}

/* Hero layout */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 36px;
  align-items: center;
  padding: 30px 0 40px;
}
@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 16px 0 28px;
  }
}

.kicker {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 4px;
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0 0 12px;
  padding-left: 14px;
  position: relative;
}
.kicker::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  background: #ffd400;
  border-radius: 50%;
  box-shadow: 0 0 8px #ffd400;
}

/* Big stacked comic title */
.comic-title {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', 'Helvetica Neue', sans-serif;
  font-weight: 400;
  margin: 0;
  line-height: 0.95;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.comic-title .t-line {
  display: block;
}
.comic-title .t-a {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  color: white;
  opacity: 0.88;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  margin-bottom: 4px;
  font-weight: 400;
}
.comic-title .t-b {
  font-size: clamp(3.5rem, 9vw, 7rem);
  margin: 4px 0;
  font-weight: 900;
}
.comic-title .t-c {
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  margin-top: 4px;
  font-weight: 400;
}
.spidey {
  color: #ffd400;
  text-shadow:
    -3px 0 0 var(--red-dark),
    3px 0 0 var(--red-dark),
    0 -3px 0 var(--red-dark),
    0 3px 0 var(--red-dark),
    -3px -3px 0 var(--red-dark),
    3px -3px 0 var(--red-dark),
    -3px 3px 0 var(--red-dark),
    3px 3px 0 var(--red-dark),
    6px 6px 0 rgba(0,0,0,0.45),
    9px 9px 14px rgba(0,0,0,0.3);
}

.site-header .lede {
  margin: 16px 0 18px;
  max-width: 60ch;
  font-size: 1.1rem;
  line-height: 1.55;
  opacity: 0.95;
}
.site-header .lede em {
  background: rgba(255,212,0,0.18);
  font-style: italic;
  padding: 0 4px;
  border-radius: 2px;
}

/* Stat strip — like a comic captions box */
.stat-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 4px;
  padding: 0;
}
.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.32);
  border: 2px solid rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  backdrop-filter: blur(3px);
}
.stat strong {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: #ffd400;
  letter-spacing: 0;
  line-height: 1;
}

/* Hero art panel */
.hero-art {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
.hero-art-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  border: 5px solid var(--ink);
  box-shadow:
    0 30px 60px rgba(0,0,0,0.5),
    0 0 0 3px rgba(255,212,0,0.6),
    0 0 0 8px rgba(0,0,0,0.4);
  transform: rotate(-2deg);
  background: var(--ink);
}
.hero-art-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.hero-art-frame::after {
  /* Subtle halftone dot overlay on the cover for a vintage-print feel */
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0,0,0,0.12) 1px, transparent 1.5px);
  background-size: 4px 4px;
  pointer-events: none;
  mix-blend-mode: multiply;
}
@media (max-width: 880px) {
  .hero-art-frame { max-width: 280px; transform: rotate(-1.5deg); }
}

/* === Search bar === */
.search-bar {
  position: relative;
  margin-bottom: 16px;
  max-width: 720px;
  z-index: 50;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  color: rgba(255,255,255,0.6);
  font-size: 1.3rem;
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 12px 44px 12px 42px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.18);
  color: white;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
#search-input::placeholder { color: rgba(255,255,255,0.55); }
#search-input:focus {
  border-color: #ffd400;
  background: rgba(0,0,0,0.32);
  box-shadow: 0 0 0 4px rgba(255,212,0,0.18);
}
.search-clear {
  position: absolute;
  right: 10px;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.7);
  font-size: 1.4rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.search-clear:hover { background: rgba(255,255,255,0.15); color: white; }

.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--paper-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
  color: var(--ink);
}
.search-empty {
  padding: 18px 18px;
  color: var(--ink-soft);
  font-style: italic;
}
.search-group + .search-group { border-top: 1px solid var(--line); }
.search-group-label {
  background: var(--paper);
  padding: 6px 14px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.search-result {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.search-result:last-child { border-bottom: 0; }
.search-result:hover,
.search-result:focus {
  background: rgba(26,58,138,0.08);
  outline: none;
}
.search-result .result-chip {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 3px;
}
.search-result .result-chip.chip-title { background: rgba(26,58,138,0.15); color: var(--blue-dark); }
.search-result .result-chip.chip-event { background: rgba(200,16,46,0.13); color: var(--red-dark); }
.search-result .result-chip.chip-issue { background: rgba(255,212,0,0.25); color: #6e5500; }
.search-result .result-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.search-result .result-label { font-weight: 600; }
.search-result .result-sub { font-size: 0.82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tabs — comic-button styling */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 0;
  padding-bottom: 0;
}
.tab {
  appearance: none;
  background: rgba(0,0,0,0.32);
  border: 3px solid var(--ink);
  border-bottom: 0;
  color: white;
  padding: 10px 18px;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: background 0.15s, transform 0.08s, color 0.15s;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.06);
  position: relative;
}
.tab:hover {
  background: rgba(255,212,0,0.2);
  color: #ffd400;
  transform: translateY(-1px);
}
.tab.is-active {
  background: var(--paper);
  color: var(--red-dark);
  transform: translateY(2px);
  box-shadow: 0 -3px 0 var(--red), inset 0 2px 0 rgba(255,255,255,0.4);
}
.tab.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 5px;
  background: var(--paper);
}

/* === Main === */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-header h2 {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 2.6rem;
  line-height: 1;
  margin: 0 0 8px;
  color: var(--ink);
  display: inline-block;
  padding: 4px 0;
  position: relative;
  text-shadow:
    1px 1px 0 var(--paper),
    2px 2px 0 var(--red),
    4px 4px 0 rgba(0,0,0,0.15);
}
.panel-header h2::after {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--red) 0%, var(--blue) 50%, transparent 100%);
  margin-top: 6px;
  border-radius: 2px;
}
.muted { color: var(--ink-soft); margin: 0 0 18px; }
.small { font-size: 0.85rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 0 0 24px;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.filters label {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}
.filters label::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: white;
  flex-shrink: 0;
}
.filters label[data-kind="title"]::before    { background: var(--blue); }
.filters label[data-kind="event"]::before    { background: var(--red); }
.filters label[data-kind="key"]::before      { background: #ffd400; }
.filters label[data-kind="milestone"]::before { background: white; }
.filters label[data-kind="title"]    { background: rgba(26,58,138,0.10);  border-color: rgba(26,58,138,0.35); }
.filters label[data-kind="event"]    { background: rgba(200,16,46,0.10);  border-color: rgba(200,16,46,0.35); }
.filters label[data-kind="key"]      { background: rgba(255,212,0,0.18);  border-color: rgba(214,169,0,0.45); }
.filters label[data-kind="milestone"]{ background: rgba(255,255,255,0.6); border-color: rgba(0,0,0,0.18); }
.filters label:hover { filter: brightness(0.97); }
.filters input[type="checkbox"] { accent-color: var(--ink); }

/* === Timeline === */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 80px;
  width: 4px;
  background: repeating-linear-gradient(
    to bottom,
    var(--red) 0 8px,
    var(--blue) 8px 16px
  );
  border-radius: 2px;
}
.timeline-item {
  position: relative;
  padding: 10px 0 14px 110px;
  cursor: pointer;
}
.timeline-item .year {
  position: absolute;
  left: 0;
  top: 12px;
  width: 64px;
  text-align: right;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: 1px;
}
.timeline-item .dot {
  position: absolute;
  left: 73px;
  top: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: white;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--paper);
}
.timeline-item[data-kind="event"] .dot { background: var(--red); }
.timeline-item[data-kind="title"] .dot { background: var(--blue); }
.timeline-item[data-kind="key"] .dot { background: #ffd400; }
.timeline-item[data-kind="milestone"] .dot { background: white; }

.timeline-item .card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.15s;
}
.timeline-item[data-kind="event"] .card { border-left-color: var(--red); }
.timeline-item[data-kind="key"] .card { border-left-color: #d6a900; }
.timeline-item[data-kind="milestone"] .card { border-left-color: var(--ink-soft); background: white; }

.timeline-item:hover .card {
  transform: translateX(3px);
  box-shadow: var(--shadow-lg);
}
.timeline-item .card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--ink);
}
.timeline-item .card .meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.timeline-item .card p { margin: 6px 0 0; font-size: 0.94rem; }
.timeline-item.is-hidden { display: none; }

/* Ownership / read badges on key-issue timeline cards — connects the
   curated story milestones to the user's actual library state. */
.tl-badge {
  display: inline-block;
  margin-left: 2px;
  font-size: 0.95rem;
  vertical-align: -1px;
  text-transform: none;
  letter-spacing: 0;
}
.tl-badge-owned { color: #2e7d32; }
.tl-badge-read { color: #2e7d32; font-weight: bold; }

/* === Titles tab === */
.titles-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
@media (max-width: 720px) {
  .titles-layout { grid-template-columns: 1fr; }
}
.titles-list {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  max-height: 70vh;
  overflow-y: auto;
  position: sticky;
  top: 16px;
}
.titles-list button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  border-left: 3px solid transparent;
}
.titles-list button:hover { background: rgba(0,0,0,0.05); }
.titles-list button.is-active {
  background: var(--blue);
  color: white;
  border-left-color: var(--red);
}
.titles-list button .sub {
  display: block;
  font-size: 0.78rem;
  opacity: 0.7;
  margin-top: 2px;
}

.title-detail {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.title-detail h3 {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--red-dark);
  margin: 0 0 4px;
}
.title-detail .tagline {
  color: var(--blue);
  font-weight: 600;
  margin: 0 0 6px;
}
.title-detail .years {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 14px;
}
.title-detail h4 {
  margin: 22px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--line);
  padding-bottom: 4px;
}
.title-detail .volume-list,
.title-detail .key-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.title-detail .volume-list li,
.title-detail .key-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.title-detail .volume-list li:last-child,
.title-detail .key-list li:last-child { border-bottom: 0; }
.title-detail .key-list .ref {
  font-weight: 700;
  color: var(--blue);
}
.title-detail .key-list .yr {
  display: inline-block;
  background: #ffd400;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
}

/* === Events grid === */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.event-card {
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 4px 4px 0 var(--red), 8px 8px 18px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  border-top: 6px solid var(--red);
}
.event-card.marvel-wide {
  border-top-color: var(--blue);
  box-shadow: 4px 4px 0 var(--blue), 8px 8px 18px rgba(0,0,0,0.18);
}
.event-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--red), 12px 12px 24px rgba(0,0,0,0.22);
}
.event-card.marvel-wide:hover { box-shadow: 6px 6px 0 var(--blue), 12px 12px 24px rgba(0,0,0,0.22); }
.event-card h3 {
  margin: 0 0 4px;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 1.2rem;
  color: var(--ink);
}
.event-card .yr {
  display: inline-block;
  background: var(--ink);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
}
.event-card p { margin: 4px 0 0; font-size: 0.92rem; }

.legend-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  margin-right: 8px;
  font-weight: 600;
}
.chip-spider { background: #fde0e6; color: var(--red-dark); border: 1px solid var(--red); }
.chip-marvel { background: #e1e8fb; color: var(--blue-dark); border: 1px solid var(--blue); }

/* === All-Issues expandable section in title detail === */
.issues-toggle {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.issues-toggle:hover { color: var(--red); }
.issues-toggle .caret {
  display: inline-block;
  width: 12px;
  font-size: 0.7rem;
  color: var(--red);
  transition: transform 0.12s;
}
.issues-toggle .muted {
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-weight: normal;
}
.all-issues[hidden] { display: none; }
.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.issue-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
}
.issue-card .issue-cover {
  width: 100%;
  height: 170px;
  /* contain (not cover) so the whole cover is visible — comic covers vary in aspect */
  object-fit: contain;
  background: linear-gradient(135deg, #1a2238 0%, #0c1224 100%);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.22);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.issue-card { cursor: pointer; }
.issue-card:hover img.issue-cover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

/* Issue detail modal */
.issue-modal {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: start;
}
.issue-modal-cover .cover {
  width: 200px;
  height: 300px;
  object-fit: contain;
  background: linear-gradient(135deg, #1a2238 0%, #0c1224 100%);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.issue-modal-cover img.cover { cursor: zoom-in; }
.issue-modal-body h3 {
  margin: 4px 0 8px;
  font-size: 1.3rem;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  color: var(--red-dark);
  text-transform: none;
}
.issue-modal-body .meta { margin: 0 0 6px; }
.issue-modal-body .meta a { color: var(--blue); }
.issue-synopsis {
  background: var(--paper);
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 12px 0 6px;
  max-height: 360px;
  overflow-y: auto;
}
.issue-synopsis p { margin: 0 0 8px; }
.issue-synopsis p:last-child { margin-bottom: 0; }
.synopsis-source {
  margin: 4px 0 0;
  font-style: italic;
}

@media (max-width: 600px) {
  .issue-modal { grid-template-columns: 1fr; }
  .issue-modal-cover .cover { width: 100%; max-width: 220px; height: 320px; margin: 0 auto; }
}
.issue-card .cover-placeholder.issue-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
}
.issue-card .issue-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 2px;
}
.issue-card .issue-num {
  font-weight: 700;
  color: var(--blue);
}
.issue-card .issue-date {
  color: var(--ink-soft);
  font-size: 0.72rem;
}
.issue-card .issue-title {
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* === People grid (Characters / Creators tabs) === */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.person-card {
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink), 8px 8px 16px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.person-card.char-hero    { box-shadow: 4px 4px 0 var(--red),  8px 8px 16px rgba(0,0,0,0.18); }
.person-card.char-villain { box-shadow: 4px 4px 0 var(--ink),  8px 8px 16px rgba(0,0,0,0.22); }
.person-card.char-ally    { box-shadow: 4px 4px 0 var(--blue), 8px 8px 16px rgba(0,0,0,0.18); }
.person-card.char-antihero{ box-shadow: 4px 4px 0 #6c4ab8,     8px 8px 16px rgba(0,0,0,0.18); }
.person-card.creator-writer        { box-shadow: 4px 4px 0 var(--blue), 8px 8px 16px rgba(0,0,0,0.18); }
.person-card.creator-artist        { box-shadow: 4px 4px 0 #d99a2b,     8px 8px 16px rgba(0,0,0,0.18); }
.person-card.creator-writer-artist { box-shadow: 4px 4px 0 var(--red),  8px 8px 16px rgba(0,0,0,0.18); }
.person-card:hover {
  transform: translate(-2px, -2px);
  filter: brightness(1.03);
}
.person-card.is-hidden { display: none; }
.person-card .cover-person {
  width: 100%;
  height: 260px;
  border-radius: 0;
  object-fit: cover;
  object-position: center top;
}
.person-card .cover.cover-placeholder.cover-person {
  height: 260px;
  border-radius: 0;
}
.person-card-body { padding: 14px 16px 16px; }
.person-card h3 {
  margin: 6px 0 2px;
  font-size: 1.1rem;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink);
}
.person-card .alias { color: var(--blue); font-size: 0.85rem; margin: 0 0 4px; font-style: italic; }
.person-card .debut { color: var(--ink-soft); font-size: 0.78rem; margin: 4px 0 0; }
.person-card .appearance-count {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--red-dark);
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}
.person-card .appearance-count strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.1rem;
  color: var(--red);
  letter-spacing: 1px;
}
.appearance-live {
  background: rgba(255,212,0,0.18);
  border-left: 3px solid #d6a900;
  padding: 6px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 8px !important;
}
.appearance-live strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  color: var(--red);
  font-size: 1.2rem;
  letter-spacing: 1px;
}
.person-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.person-chip.chip-hero    { background: rgba(200,16,46,0.12); color: var(--red-dark); border: 1px solid var(--red); }
.person-chip.chip-ally    { background: rgba(26,58,138,0.12); color: var(--blue-dark); border: 1px solid var(--blue); }
.person-chip.chip-villain { background: var(--ink); color: white; }
.person-chip.chip-antihero{ background: rgba(108,74,184,0.15); color: #3e2877; border: 1px solid #6c4ab8; }
.person-chip.chip-writer  { background: rgba(26,58,138,0.12); color: var(--blue-dark); border: 1px solid var(--blue); }
.person-chip.chip-artist  { background: rgba(217,154,43,0.18); color: #6e5500; border: 1px solid #d99a2b; }
.person-chip.chip-writer-artist { background: rgba(200,16,46,0.12); color: var(--red-dark); border: 1px solid var(--red); }

/* Filter pill colors for Characters / Creators tabs */
.filters label[data-kind="hero"]::before     { background: var(--red); }
.filters label[data-kind="ally"]::before     { background: var(--blue); }
.filters label[data-kind="antihero"]::before { background: #6c4ab8; }
.filters label[data-kind="villain"]::before  { background: var(--ink); }
.filters label[data-kind="writer"]::before   { background: var(--blue); }
.filters label[data-kind="artist"]::before   { background: #d99a2b; }
.filters label[data-kind="writer-artist"]::before { background: var(--red); }
.filters label[data-kind="hero"]     { background: rgba(200,16,46,0.10);  border-color: rgba(200,16,46,0.35); }
.filters label[data-kind="ally"]     { background: rgba(26,58,138,0.10);  border-color: rgba(26,58,138,0.35); }
.filters label[data-kind="antihero"] { background: rgba(108,74,184,0.10); border-color: rgba(108,74,184,0.45); }
.filters label[data-kind="villain"]  { background: rgba(0,0,0,0.07);      border-color: rgba(0,0,0,0.4); }
.filters label[data-kind="writer"]   { background: rgba(26,58,138,0.10);  border-color: rgba(26,58,138,0.35); }
.filters label[data-kind="artist"]   { background: rgba(217,154,43,0.15); border-color: rgba(214,150,12,0.5); }
.filters label[data-kind="writer-artist"] { background: rgba(200,16,46,0.10); border-color: rgba(200,16,46,0.35); }

/* Cross-link styling inside modals */
.cross-link {
  color: var(--blue);
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}
.cross-link:hover { color: var(--red); }

/* Notable runs list inside creator modal */
.run-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.run-list li {
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92rem;
}
.run-list li:last-child { border-bottom: 0; }
.run-list .muted { color: var(--ink-soft); }

/* Search-result chip colors for new types */
.search-result .result-chip.chip-character { background: rgba(108,74,184,0.18); color: #3e2877; }
.search-result .result-chip.chip-creator   { background: rgba(217,154,43,0.18); color: #6e5500; }

/* === Reading Orders === */
.reading-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.reading-card {
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 18px 18px 16px;
  box-shadow: 4px 4px 0 var(--red), 8px 8px 16px rgba(0,0,0,0.16);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  display: flex;
  flex-direction: column;
}
.reading-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--red), 12px 12px 22px rgba(0,0,0,0.22);
}
.reading-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.reading-icon { font-size: 2rem; line-height: 1; }
.reading-audience {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--ink);
  color: white;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.reading-card h3 {
  margin: 0 0 4px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: var(--red-dark);
}
.reading-tagline {
  margin: 0 0 8px;
  font-style: italic;
  color: var(--blue);
  font-size: 0.95rem;
}
.reading-length {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.reading-length strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 1px;
}
.reading-blurb {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
  flex: 1;
  margin: 0 0 12px;
}
.reading-open {
  background: var(--red);
  color: white;
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  cursor: pointer;
  align-self: flex-start;
  box-shadow: 0 3px 0 var(--red-dark);
}
.reading-open:hover { background: var(--red-dark); }

/* Reading-order detail view */
.reading-back {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-size: 0.95rem;
  margin-bottom: 14px;
  padding: 0;
}
.reading-back:hover { color: var(--red); text-decoration: underline; }
.reading-detail-head {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line);
}
.reading-icon-lg { font-size: 3.5rem; line-height: 1; }
.reading-detail-head h3 {
  margin: 0;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 2.2rem;
  letter-spacing: 2px;
  color: var(--red-dark);
}
.reading-intro {
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 18px;
  background: var(--paper);
  border-left: 4px solid var(--blue);
  padding: 14px 16px;
  border-radius: 4px;
}
.reading-order-detail h4 {
  font-family: 'Bangers', 'Impact', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 1.1rem;
  color: var(--red-dark);
  border-bottom: 2px solid var(--line);
  padding-bottom: 4px;
}
.reading-steps {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: read;
}
.reading-step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}
.reading-step:last-child { border-bottom: 0; }
.reading-step.is-owned .step-num { background: #2e7d32; box-shadow: 0 3px 0 #1b5e20; }
.reading-step.is-unowned .step-num { background: #b0bec5; box-shadow: 0 3px 0 #78909c; }
.step-headrow { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.step-badge { font-size: 0.78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; flex-shrink: 0; }
.badge-owned { background: #c8e6c9; color: #1b5e20; }
.badge-unowned { background: #eceff1; color: #607d8b; }
.step-read-btn {
  margin-top: 10px;
  background: var(--red);
  color: white;
  border: 0;
  padding: 12px 22px;     /* roomier hit target on touch */
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--red-dark);
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(200, 16, 46, 0.4);
  -webkit-appearance: none;
  appearance: none;
}
.step-read-btn:hover { background: var(--red-dark); }
.step-read-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--red-dark); }

/* Per-issue chip row — appears under multi-issue entries like "ASM #1-10" */
.step-issue-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.step-issue-count { font-style: italic; }
.step-issue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.step-issue-chip {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f5f5f5;
  color: #999;
  user-select: none;
}
.step-issue-chip.is-owned {
  background: #2e7d32;
  color: white;
  border-color: #1b5e20;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(46, 125, 50, 0.4);
  -webkit-appearance: none;
  appearance: none;
}
.step-issue-chip.is-owned:hover { background: #1b5e20; transform: translateY(-1px); }
.step-issue-chip.is-owned:active { background: #1b5e20; transform: scale(0.96); }
.step-issue-chip.is-unowned {
  background: #eceff1;
  color: #90a4ae;
  cursor: default;
  text-decoration: line-through;
}

/* Event progress — same vibe as reading-order progress but compact */
.event-progress {
  background: var(--paper, #f5f1e8);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 14px 0;
}
.event-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

/* Path progress */
.reading-progress {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
}
.reading-progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.path-start-btn {
  background: var(--blue);
  color: white;
  border: 0;
  padding: 8px 20px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--blue-dark);
}
.path-start-btn:hover { background: var(--blue-dark); }
.reading-progress-bar {
  height: 10px;
  background: #eceff1;
  border-radius: 999px;
  overflow: hidden;
}
.reading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #2e7d32);
  transition: width 0.3s ease;
}

/* Google Drive banner — distinct color from the local-folder banner so the
   two cloud-vs-disk options are visually separable. PRIMARY option for the
   family-mode use case: featured first via CSS order. */
.gdrive-banner {
  background: linear-gradient(135deg, #e3f2fd, #90caf9) !important;
  border-color: #1565c0 !important;
  order: 1;
  position: relative;
}
.gdrive-banner::before {
  content: 'RECOMMENDED';
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--red);
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* Public-URL cloud banner — green, but secondary in the family-mode flow */
.cloudurl-banner {
  background: linear-gradient(135deg, #e8f5e9, #a5d6a7) !important;
  border-color: #2e7d32 !important;
  order: 2;
}
/* Local folder — useful on desktop, hidden on mobile */
.fs-banner:not(.gdrive-banner):not(.cloudurl-banner) { order: 3; }
.prebuilt-banner { order: 4; }
/* Make the parent (tab-collection section) use flex so order: works. The
   panel-header, banners, and other elements form one logical column. */
#tab-collection { display: flex; flex-direction: column; }
/* Specific elements that should stay in their natural position get explicit
   order values so they don't accidentally move with the banners. */
#tab-collection > .panel-header { order: 0; }
#collection-status            { order: 5; }
.collection-toolbar           { order: 6; }
#coverage-banner              { order: 7; }
#collection-filters           { order: 8; }
#welcome-shell                { order: 9; }
#collection-grid              { order: 10; }
#drop-zone                    { order: 11; }
#drop-zone-details            { order: 11; }
#extras-panel, #missing-panel { order: 12; }

/* Collapsible "Or add files manually" disclosure — hidden by default. */
.drop-zone-details {
  margin: 12px 0;
}
.drop-zone-summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 6px 0;
  user-select: none;
  list-style: none;
  display: inline-block;
}
.drop-zone-summary::-webkit-details-marker { display: none; }
.drop-zone-summary:hover { color: var(--ink); }
.drop-zone-details[open] .drop-zone-summary {
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--ink);
}
.drop-zone-details[open] .drop-zone-summary::before { content: '− '; }
.drop-zone-details:not([open]) .drop-zone-summary::before { content: '+ '; }
.drop-zone-details:not([open]) .drop-zone-summary { content: '+ Or add files manually (one-off)'; }
/* Hide the "+" prefix in HTML, use ::before only */
.drop-zone-details .drop-zone-summary { padding-left: 0; }

/* Google Drive setup modal */
.gdrive-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
/* The [hidden] attribute defaults to display:none but the class above has
   higher specificity, so without this rule the modal is permanently visible
   on page load. Force-hide when the attribute is set. */
.gdrive-modal[hidden] { display: none !important; }
.gdrive-modal-card {
  background: white;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  padding: 24px 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.gdrive-modal-card h3 {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 1.4rem;
}
.gdrive-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: transparent;
  border: 0;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  width: 32px; height: 32px;
  border-radius: 50%;
}
.gdrive-modal-close:hover { background: #f0f0f0; color: var(--ink); }
.gdrive-setup-steps {
  padding-left: 24px;
  margin: 18px 0;
  font-size: 0.92rem;
  line-height: 1.55;
}
.gdrive-setup-steps li { margin-bottom: 12px; }
.gdrive-setup-steps code {
  background: #f4f4f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  word-break: break-all;
}
.gdrive-setup-steps a { color: var(--red); }
.gdrive-field {
  display: flex;
  flex-direction: column;
  margin: 8px 0;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 4px;
}
.gdrive-field input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.gdrive-field input:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}
.gdrive-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* Folder-connect banner (File System Access API) — sits above prebuilt-banner */
.fs-banner {
  background: linear-gradient(135deg, #e0f2f1, #80cbc4);
  border: 2px solid #00796b;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  box-shadow: 0 4px 0 #004d40;
}
.fs-banner.is-connected {
  background: linear-gradient(135deg, #c8e6c9, #66bb6a);
  border-color: #2e7d32;
  box-shadow: 0 4px 0 #1b5e20;
}
.fs-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.fs-banner-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 280px; }
.fs-banner-text strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: #00332e;
}
.fs-banner-text .muted { color: #00574b; font-size: 0.9rem; }
.fs-banner.is-connected .fs-banner-text strong { color: #1b3a1d; }
.fs-banner.is-connected .fs-banner-text .muted { color: #2c4f2c; }
.fs-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fs-cta {
  background: var(--red);
  color: white;
  border: 0;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--red-dark);
  white-space: nowrap;
}
.fs-cta:hover { background: var(--red-dark); }
.fs-cta:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--red-dark); }
.fs-link {
  color: #1b3a1d;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.fs-link:hover { color: #0d1f0d; }
.extras-issue { align-items: center; }
.extras-issue .step-read-btn { margin-top: 0; padding: 6px 14px; font-size: 0.85rem; }

/* Coverage banner — sits between the drop zone and owned-issue grid;
   always visible once the user has imported anything. */
.coverage-banner {
  background: linear-gradient(135deg, #ede7f6, #d1c4e9);
  border: 2px solid #5e35b1;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  box-shadow: 0 4px 0 #311b92;
}
.coverage-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.coverage-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 280px;
}
.coverage-banner-text strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: #1a0a4a;
}
.coverage-banner-text .muted { color: #4a3c80; font-size: 0.9rem; }
.coverage-cta {
  background: var(--red);
  color: white;
  border: 0;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--red-dark);
  white-space: nowrap;
}
.coverage-cta:hover { background: var(--red-dark); }
.coverage-cta:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--red-dark); }
.coverage-bar {
  height: 10px;
  background: rgba(255,255,255,0.5);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(94, 53, 177, 0.3);
}
.coverage-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7e57c2, #4527a0);
  transition: width 0.3s ease;
}

/* "What am I missing?" reconcile panel */
.missing-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 24px;
}
.missing-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.missing-head h3 {
  margin: 0;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: var(--red);
}
.missing-toolbar {
  display: flex;
  gap: 14px;
  margin: 14px 0 6px;
  flex-wrap: wrap;
  align-items: center;
}
.missing-toolbar input[type="search"] {
  flex: 1 1 240px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
}
.missing-opt {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.missing-export-btn {
  background: var(--blue);
  color: white;
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--blue-dark);
  white-space: nowrap;
}
.missing-export-btn:hover { background: var(--blue-dark); }
.missing-export-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--blue-dark); }
.missing-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.missing-group {
  background: var(--paper-strong, #fafafa);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 12px;
}
.missing-group summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  gap: 12px;
  flex-wrap: wrap;
}
.missing-group summary::-webkit-details-marker { display: none; }
.missing-group summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s;
  color: var(--ink-soft);
}
.missing-group[open] > summary::before { transform: rotate(90deg); }
.missing-title {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--ink);
}
.missing-stat {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.missing-issue-list {
  list-style: none;
  padding: 6px 0 12px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.missing-issue {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.missing-cover {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.missing-cover-blank {
  background: var(--paper);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--ink-soft);
  text-align: center;
}
.missing-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.85rem;
}
.missing-num { font-weight: 700; color: var(--ink); }
.missing-issue-title {
  font-size: 0.78rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.missing-date { font-size: 0.75rem; }

/* Variant covers strip — below the main cover in the issue modal */
.variant-strip {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.variant-strip-label {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.variant-strip-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}
.variant-thumb {
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  transition: border-color 0.15s, transform 0.15s;
}
.variant-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.variant-thumb:hover { border-color: var(--red); transform: translateY(-2px); }

/* Local-variant strip — copies of the issue from the user's connected folder.
   Visually distinct from CV variants (green-ish border, "your library" badge). */
.local-variant-strip { margin-top: 12px; }
.local-variant-strip .variant-strip-label { color: #1b5e20; }
.local-variant-thumb {
  border-color: #66bb6a;
  position: relative;
  background: #f1f8e9;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}
.local-variant-thumb:hover { border-color: #2e7d32; }
.local-thumb-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: #e8f5e9;
  min-height: 90px;
}
.local-thumb-label {
  font-size: 0.65rem;
  padding: 3px 4px;
  color: #1b3a1d;
  background: #c8e6c9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.local-thumb-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #2e7d32;
  color: white;
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 700;
}

/* One-file drop prompt (used by reading-order Read buttons when bytes aren't cached) */
.one-file-prompt strong { display: block; margin-bottom: 6px; }
.one-file-prompt code { background: var(--paper-strong); padding: 2px 6px; border-radius: 4px; }
.one-file-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  margin-top: 10px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.15s;
}
.one-file-drop.is-dragging,
.one-file-drop:hover { background: var(--paper); border-color: var(--red); color: var(--ink); }
.step-num {
  width: 40px;
  height: 40px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 1px;
  box-shadow: 0 3px 0 var(--red-dark);
}
.step-body { min-width: 0; }
.step-ref {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
  line-height: 1.3;
}
.step-title {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--blue);
  margin-bottom: 6px;
}
.step-body p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* === Eras === */
.era-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
  background: var(--paper-2);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 18px;
}
.era-tab {
  background: white;
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.era-tab .era-years {
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.5px;
}
.era-tab .era-name {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--ink);
}
.era-tab:hover {
  background: rgba(0,0,0,0.04);
  border-color: var(--era-color);
}
.era-tab.is-active {
  background: var(--era-color);
  border-color: var(--era-color);
}
.era-tab.is-active .era-years,
.era-tab.is-active .era-name { color: white; }

.era-banner {
  background: linear-gradient(135deg, var(--era-color) 0%, rgba(0,0,0,0.6) 130%);
  color: white;
  padding: 28px 24px;
  border-radius: var(--radius);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink), 10px 10px 20px rgba(0,0,0,0.2);
  margin-bottom: 22px;
  text-align: center;
}
.era-banner-year {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 4px;
  opacity: 0.85;
  margin-bottom: 6px;
}
.era-banner h3 {
  margin: 0;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 3rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.4), 4px 4px 0 rgba(0,0,0,0.18);
}
.era-banner .era-tagline {
  margin: 8px 0 0;
  font-style: italic;
  font-size: 1rem;
  opacity: 0.95;
}

.era-intro p {
  font-size: 1.02rem;
  line-height: 1.65;
  margin: 0 0 12px;
}

.era-content h4 {
  font-family: 'Bangers', 'Impact', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 1rem;
  color: var(--red-dark);
  border-bottom: 2px solid var(--line);
  padding-bottom: 4px;
  margin: 22px 0 10px;
}
.era-moments {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 6px;
}
.era-moments li {
  background: var(--paper);
  border-left: 3px solid var(--red);
  padding: 6px 10px;
  border-radius: 3px;
  font-size: 0.92rem;
}
.era-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.era-chip {
  background: rgba(26,58,138,0.10);
  color: var(--blue-dark);
  border: 2px solid rgba(26,58,138,0.35);
  padding: 5px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.1s, color 0.1s;
}
.era-chip:hover { background: var(--blue); color: white; }
.era-chip.era-event {
  background: rgba(200,16,46,0.10);
  color: var(--red-dark);
  border-color: rgba(200,16,46,0.35);
}
.era-chip.era-event:hover { background: var(--red); color: white; }
.era-chip.era-char {
  background: rgba(108,74,184,0.10);
  color: #3e2877;
  border-color: rgba(108,74,184,0.45);
}
.era-chip.era-char:hover { background: #6c4ab8; color: white; }

/* Search-result chip colors for new types */
.search-result .result-chip.chip-reading { background: rgba(217,154,43,0.18); color: #6e5500; }
.search-result .result-chip.chip-era     { background: rgba(108,74,184,0.18); color: #3e2877; }

/* === My Collection === */
.drop-zone {
  border: 3px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 38px 24px;
  text-align: center;
  margin-bottom: 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}
.drop-zone:hover { background: rgba(255,212,0,0.06); }
.drop-zone.is-dragging {
  background: rgba(255,212,0,0.16);
  border-color: var(--red);
  transform: scale(1.005);
}
.drop-zone-inner { max-width: 540px; margin: 0 auto; }
.drop-zone-icon { font-size: 3rem; margin-bottom: 6px; }

/* Show desktop heading on devices with a fine pointer (mouse); show the touch
   variant on coarse-pointer devices (iPad, phones) since drag-and-drop from
   the Files app doesn't actually work there. */
.dz-touch-heading, .dz-touch-sub { display: none; }
@media (pointer: coarse) {
  .dz-desktop-heading, .dz-desktop-sub { display: none; }
  .dz-touch-heading, .dz-touch-sub { display: block; }
  .drop-zone { padding: 28px 18px; }
  .pick-files-btn { padding: 14px 28px; font-size: 1.15rem; }
}
.drop-zone h3 {
  margin: 0 0 6px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  color: var(--red-dark);
}
.drop-zone code {
  background: var(--paper);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.92em;
}
.pick-row {
  display: inline-flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.pick-files-btn {
  background: var(--red);
  color: white;
  border: 0;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--red-dark);
}
.pick-folder-btn {
  background: var(--blue);
  box-shadow: 0 3px 0 var(--blue-dark);
}
.pick-folder-btn:hover { background: var(--blue-dark); }
.pick-files-btn:hover { background: var(--red-dark); }
.pick-files-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--red-dark); }
.pick-folder-btn:active { box-shadow: 0 2px 0 var(--blue-dark); }
.cache-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px auto 0;
  max-width: 540px;
  padding: 8px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.prebuilt-banner {
  background: linear-gradient(135deg, #fff8e1, #ffe082);
  border: 2px solid #f9a825;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 0 0 18px;
  box-shadow: 0 4px 0 #c17900;
}
.prebuilt-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.prebuilt-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 280px;
}
.prebuilt-banner-text strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.25rem;
  letter-spacing: 1px;
  color: #5d2c00;
}
.prebuilt-banner-text .muted { color: #6b4a00; font-size: 0.95rem; }
.prebuilt-load-btn {
  background: var(--red);
  color: white;
  border: 0;
  padding: 12px 28px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--red-dark);
  white-space: nowrap;
}
.prebuilt-load-btn:hover { background: var(--red-dark); }
.prebuilt-load-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 var(--red-dark); }
.cache-opt input { margin-top: 3px; flex-shrink: 0; }
.cache-opt span { line-height: 1.4; }

/* Import progress bar */
.import-progress {
  max-width: 540px;
  margin: 14px auto 0;
}
.import-progress-bar {
  height: 8px;
  background: var(--paper);
  border-radius: 999px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.import-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--blue));
  width: 0%;
  transition: width 0.15s;
}
.import-progress-text {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.95rem;
  text-align: center;
  margin-top: 6px;
  color: var(--ink-soft);
  letter-spacing: 1px;
}

.collection-status {
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border-left: 4px solid var(--blue);
  background: var(--paper-2);
}
.collection-status.status-success { border-left-color: #2c8e3f; background: rgba(44,142,63,0.08); }
.collection-status.status-warn { border-left-color: #d99a2b; background: rgba(217,154,43,0.1); }
.collection-status.status-error { border-left-color: #c62828; background: rgba(198,40,40,0.08); }
.collection-status.status-info { border-left-color: var(--blue); }
/* On mobile, float the status toast at the top of the viewport so users can
   see download progress / errors no matter where they're scrolled. */
@media (max-width: 720px) {
  .collection-status:not([hidden]) {
    position: fixed;
    top: 60px;        /* below the sticky tab bar */
    left: 12px;
    right: 12px;
    z-index: 200;
    margin-bottom: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    background: white;
  }
}
.status-details { margin-top: 8px; }
.status-details summary { cursor: pointer; color: var(--blue-dark); font-weight: 600; }
.status-details ul { margin: 8px 0 0; padding-left: 20px; font-size: 0.9rem; max-height: 200px; overflow-y: auto; }

.collection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.collection-stats {
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.collection-stats strong {
  font-family: 'Bangers', 'Impact', sans-serif;
  color: var(--red);
  font-size: 1.3rem;
  letter-spacing: 1px;
}
.ghost-btn {
  background: transparent;
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
}
.ghost-btn:hover { background: var(--ink); color: white; }

/* ---------- My Collection filter bar ---------- */
.coll-filters {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 12px 0 18px;
  box-shadow: var(--shadow);
}
.coll-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.coll-search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
}
.coll-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-size: 1.1rem;
  pointer-events: none;
}
.coll-search {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 0.98rem;
}
.coll-search:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
  border-color: var(--red);
}
.coll-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
}
.coll-search-clear:hover { background: #f0f0f0; color: var(--ink); }
.coll-select {
  height: 42px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
.coll-select:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}
.coll-status-pills {
  display: inline-flex;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.coll-pill {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.coll-pill:hover:not(.is-active) { background: #f0f0f0; }
.coll-pill.is-active {
  background: var(--red);
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.coll-filters-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  min-height: 1.2em;
}
.coll-result-count { font-variant-numeric: tabular-nums; }
.coll-clear-filters { padding: 6px 14px; font-size: 0.85rem; }
.coll-no-match {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  background: var(--paper-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* First-visit welcome card — replaces the empty collection grid with a
   clear "Connect Drive" path. Shown when a visitor opens the site for the
   first time and has no files yet. Lives outside the grid container so
   it gets full width regardless of grid column layout. */
.welcome-card {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 2px solid #1565c0;
  border-radius: var(--radius);
  padding: 48px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 640px;
  margin: 24px auto;
}
.welcome-icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 16px;
}
.welcome-card h3 {
  margin: 0 0 12px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 1px;
  color: var(--ink);
}
.welcome-card p {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 20px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}
.welcome-cta {
  background: var(--red);
  color: white;
  border: 0;
  padding: 14px 32px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--red-dark);
  transition: transform 0.1s, box-shadow 0.1s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(200,16,46,0.3);
  -webkit-appearance: none;
  appearance: none;
}
.welcome-cta:hover { transform: translateY(-1px); }
.welcome-cta:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--red-dark); }
.link-btn {
  background: transparent;
  border: 0;
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
}
.link-btn:hover { color: var(--red-dark, var(--red)); }
@media (max-width: 640px) {
  .coll-filters { padding: 12px; }
  .coll-status-pills { width: 100%; justify-content: stretch; }
  .coll-pill { flex: 1; padding: 8px 4px; }
  .coll-select { flex: 1 1 140px; }
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.owned-card {
  background: var(--paper-2);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow: 4px 4px 0 var(--blue), 8px 8px 16px rgba(0,0,0,0.18);
  overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s;
}
.owned-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--blue), 12px 12px 22px rgba(0,0,0,0.24);
}
.owned-cover {
  width: 100%;
  height: 240px;
  object-fit: cover;
  object-position: center top;
  background: var(--ink);
  display: block;
}
.owned-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, var(--ink) 0%, var(--blue-dark) 100%);
}
.owned-body { padding: 10px 12px; }
.owned-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.2;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.owned-num {
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.owned-file {
  color: var(--ink-soft);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}
.owned-read {
  width: 100%;
  background: var(--red);
  color: white;
  border: 0;
  padding: 10px 0;        /* roomier hit target for fingers */
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Bangers', 'Impact', sans-serif;
  letter-spacing: 1px;
  font-size: 0.9rem;
  /* iOS Safari workarounds:
     touch-action removes the 300ms tap delay so click fires instantly on tap.
     -webkit-tap-highlight-color gives visible feedback when the user taps.
     touch-action: manipulation also prevents the double-tap-to-zoom heuristic
     from cancelling the click. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(200, 16, 46, 0.4);
  -webkit-user-select: none;
  user-select: none;
  /* iOS may treat appearance: button as ignoring our font-family */
  -webkit-appearance: none;
  appearance: none;
}
.owned-read:hover { background: var(--red-dark); }
.owned-read:active { background: var(--red-dark); transform: scale(0.98); }

/* "Owned" indicator on the All-Issues grid */
.issue-card.is-owned {
  position: relative;
}
.issue-card.is-owned::before {
  content: '✓ In Collection';
  position: absolute;
  top: 4px;
  left: 4px;
  background: #2c8e3f;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 3px;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  text-transform: uppercase;
}

/* === Comic Reader === */
.reader {
  position: fixed;
  inset: 0;
  background: #0c0f1a;
  z-index: 300;
  display: flex;
  flex-direction: column;
  animation: fade 0.15s ease;
}
.reader[hidden] { display: none; }
.reader-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(0,0,0,0.55);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: white;
}
.reader-close {
  background: transparent;
  color: white;
  border: 0;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px;
  opacity: 0.85;
}
.reader-close:hover { opacity: 1; }
.reader-title {
  flex: 1;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 1px;
}
.reader-pagecount {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}
.reader-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 12px;
}
.reader-pages {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 100%;
  width: 100%;
  max-width: 100%;
}
/* Two-page spread mode — pages butt up against each other in the middle
   like a real comic book opened flat. */
.reader-pages.is-spread .reader-page-img {
  max-width: 50%;
  flex: 0 1 auto;
}
.reader-pages.is-spread .reader-page-img:first-child {
  margin-right: 1px;  /* slight gap so the two pages are clearly distinguishable */
}
.reader-page-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  user-select: none;
  -webkit-user-drag: none;
  touch-action: pinch-zoom;
}
.reader-toggle {
  background: rgba(255,255,255,0.08);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-left: 12px;
  white-space: nowrap;
  font-family: inherit;
}
.reader-toggle:hover { background: rgba(255,255,255,0.16); }
.reader-toggle.is-active { background: rgba(200,16,46,0.5); border-color: rgba(200,16,46,0.7); }

/* Auto-advance prompt — overlay banner near top of reader */
.auto-advance-prompt {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 320;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  animation: aa-slide 0.3s ease;
  font-size: 0.95rem;
}
@keyframes aa-slide {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
.auto-advance-prompt[hidden] { display: none; }
.auto-advance-prompt strong { font-weight: 700; }
.auto-advance-prompt .aa-next {
  background: white;
  color: #1b5e20;
  border: 0;
  padding: 6px 16px;
  border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 1px;
  cursor: pointer;
}
.auto-advance-prompt .aa-next:hover { background: #c8e6c9; }
.auto-advance-prompt .aa-close {
  background: transparent;
  color: white;
  border: 0;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
}
.auto-advance-prompt .aa-close:hover { opacity: 1; }

/* Bigger touch controls for iPad / coarse-pointer devices */
@media (pointer: coarse) {
  .reader-nav { width: 80px; height: 140px; font-size: 3.5rem; }
  .reader-toggle { padding: 8px 16px; font-size: 0.95rem; }
  .reader-thumb img { width: 80px; height: 120px; }
}
.reader-stage { touch-action: pan-y pinch-zoom; }
/* On narrow screens, force single-page even if the user toggled spread on:
   two pages side-by-side become too small to read below ~800px. */
@media (max-width: 800px) {
  .reader-pages.is-spread .reader-page-img { max-width: 50%; }
}
/* Bigger tap targets for touch devices */
@media (pointer: coarse) {
  .reader-nav { width: 68px; height: 120px; font-size: 3rem; opacity: 0.4; }
  .reader-nav:hover, .reader-nav:active { opacity: 0.9; background: rgba(200,16,46,0.7); }
  .reader-close { font-size: 2.4rem; padding: 0 14px; }
  .reader-thumbs { max-height: 130px; }
  .reader-thumb img { width: 72px; height: 108px; }
}
.reader-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: white;
  border: 0;
  font-size: 2.5rem;
  width: 56px;
  height: 100px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.reader-nav:hover { background: rgba(200,16,46,0.7); }
.reader-prev { left: 12px; }
.reader-next { right: 12px; }
.reader-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px;
  background: rgba(0,0,0,0.55);
  overflow-x: auto;
  max-height: 110px;
}
.reader-thumb {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.reader-thumb img {
  width: 60px;
  height: 90px;
  object-fit: cover;
  display: block;
}
.reader-thumb.is-current { border-color: var(--red); box-shadow: 0 0 0 2px var(--red); }

/* === Sources === */
.sources {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.sources ul { padding-left: 20px; }
.sources li { margin-bottom: 14px; }

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* === Modal === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade 0.15s ease;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--ink);
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 2rem;
  cursor: pointer;
  color: var(--ink-soft);
  line-height: 1;
}
.modal-close:hover { color: var(--red); }
.modal h3 {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--red-dark);
  margin: 0 0 8px;
  padding-right: 32px;
  font-size: 1.5rem;
}
.modal .meta { color: var(--ink-soft); margin: 0 0 12px; font-size: 0.9rem; }
.modal .tie-ins {
  background: var(--paper);
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 14px 0;
}
.modal .tie-ins strong { color: var(--blue-dark); }
.modal .related {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.modal .related span {
  background: var(--ink);
  color: white;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 12px;
}

/* === Cover images === */
.cover {
  display: block;
  background: linear-gradient(135deg, #2a3450 0%, #1a2238 100%);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.32), 0 0 0 1px rgba(255,255,255,0.06) inset;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
img.cover { cursor: zoom-in; }
img.cover:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 10px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(255,255,255,0.78);
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  padding: 10px;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--blue-dark) 100%);
}
.cover-placeholder::before {
  content: '🕷';
  display: block;
  font-size: 2rem;
  margin-bottom: 6px;
  opacity: 0.7;
}

/* Timeline thumb */
.timeline-item .card.has-cover {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px;
  align-items: start;
}
.timeline-item .card .thumb {
  width: 90px;
  height: 135px;
  object-fit: cover;
  object-position: center top;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.28);
  cursor: zoom-in;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.timeline-item .card .thumb:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 18px rgba(0,0,0,0.36);
}

/* Title detail head */
.title-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 22px;
  align-items: start;
  margin-bottom: 18px;
}
.title-head .cover {
  width: 180px;
  height: 270px;
}
.title-head h3 { margin: 0 0 4px; font-size: 2rem; }
.title-head .tagline, .title-head .years { margin: 0 0 4px; }

/* Event card cover */
.event-card { padding: 0; overflow: hidden; }
.event-card .cover-event {
  width: 100%;
  height: 340px;
  border-radius: 0;
}
.event-card .cover.cover-placeholder.cover-event {
  height: 340px;
  font-size: 1.15rem;
  border-radius: 0;
}
.event-card img.cover-event { cursor: zoom-in; }
.event-card-body { padding: 16px 18px 18px; }
.event-card .yr { display: inline-block; }

/* Modal cover (when clicking timeline/title cards) */
.modal-head {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px;
}
.modal-head .cover {
  width: 140px;
  height: 210px;
}
.modal-head h3 { margin: 0 0 4px; padding-right: 0; font-size: 1.6rem; }
.modal-head .meta { margin: 0; }

.cover-lg { background-position: center; }

/* === Publishing chart === */
.chart-wrap {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: visible;
}
.chart-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.chart {
  --label-w: 240px;
  --year-w: 30px;
  --row-h: 34px;
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  position: relative;
  min-width: max-content;
}
.chart-header {
  display: contents;
}
.chart-header .corner {
  background: var(--ink);
  color: white;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.78rem;
  padding: 12px 14px;
  border-right: 2px solid var(--ink);
  position: sticky;
  left: 0;
  z-index: 6;
  width: var(--label-w);
  box-shadow: 2px 0 6px rgba(0,0,0,0.18);
}
.chart-header .years-axis {
  display: flex;
  background: var(--ink);
  color: white;
  position: relative;
}
.chart-header .years-axis .year-tick {
  width: var(--year-w);
  flex-shrink: 0;
  font-size: 0.68rem;
  padding: 10px 0 6px;
  text-align: center;
  position: relative;
  color: rgba(255,255,255,0.55);
  border-right: 1px solid rgba(255,255,255,0.05);
}
.chart-header .years-axis .year-tick.major {
  color: white;
  font-weight: 700;
  font-size: 0.78rem;
  background: rgba(255,255,255,0.04);
}
.chart-header .years-axis .year-tick.decade {
  background: rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.18);
}
.chart-header .years-axis .year-tick.major::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  height: 5px;
  width: 1px;
  background: rgba(255,255,255,0.6);
}

.chart-row {
  display: contents;
}
.chart-row .row-label {
  padding: 0 14px;
  border-right: 2px solid var(--ink);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: var(--paper-2);
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  height: var(--row-h);
  cursor: pointer;
  position: sticky;
  left: 0;
  z-index: 5;
  width: var(--label-w);
  box-shadow: 2px 0 6px rgba(0,0,0,0.08);
}
.chart-row .row-label:hover { background: rgba(26,58,138,0.06); color: var(--blue); }
.chart-row .row-track {
  position: relative;
  height: var(--row-h);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  background-image:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) - 1px),
      rgba(0,0,0,0.04) calc(var(--year-w) - 1px),
      rgba(0,0,0,0.04) var(--year-w)
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) * 5 - 1px),
      rgba(0,0,0,0.10) calc(var(--year-w) * 5 - 1px),
      rgba(0,0,0,0.10) calc(var(--year-w) * 5)
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) * 10 - 1px),
      rgba(0,0,0,0.18) calc(var(--year-w) * 10 - 1px),
      rgba(0,0,0,0.18) calc(var(--year-w) * 10)
    );
}
.chart-row .bar {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0 6px;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  transition: filter 0.12s ease, transform 0.12s ease;
}
/* When a title has overlapping volumes, split into top/bottom lanes.
   Rows with multiple lanes are taller (set inline) so each lane has room to breathe. */
.chart-row .row-track[data-lanes="2"] .bar[data-lane="0"] { top: 5px;  bottom: calc(50% + 2px); border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }
.chart-row .row-track[data-lanes="2"] .bar[data-lane="1"] { top: calc(50% + 2px); bottom: 5px; border-top-left-radius: 2px; border-top-right-radius: 2px; }
.chart-row .row-track[data-lanes="3"] .bar[data-lane="0"] { top: 5px; bottom: calc(66.66% + 2px); border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }
.chart-row .row-track[data-lanes="3"] .bar[data-lane="1"] { top: calc(33.33% + 1px); bottom: calc(33.33% + 1px); border-radius: 2px; }
.chart-row .row-track[data-lanes="3"] .bar[data-lane="2"] { top: calc(66.66% + 2px); bottom: 5px; border-top-left-radius: 2px; border-top-right-radius: 2px; }

/* Flagship title row gets emphasized treatment */
.chart-row[data-flagship="true"] .row-label {
  background: linear-gradient(180deg, var(--red-dark) 0%, #6b0817 100%);
  color: white;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 1rem;
  border-bottom: 2px solid var(--red-dark);
  box-shadow: 2px 0 8px rgba(200,16,46,0.25);
}
.chart-row[data-flagship="true"] .row-label:hover {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%);
  color: white;
}
.chart-row[data-flagship="true"] .row-track {
  background-color: rgba(200,16,46,0.04);
  border-bottom: 2px solid rgba(200,16,46,0.3);
}
.chart-row[data-flagship="true"] .bar { font-size: 0.78rem; }
.chart-row .bar:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  z-index: 4;
}
.chart-row .bar.flagship      { background: linear-gradient(180deg, var(--red) 0%, var(--red-dark) 100%); }
.chart-row .bar.spider-family { background: linear-gradient(180deg, #6c4ab8 0%, #3e2877 100%); }
.chart-row .bar.anthology     { background: linear-gradient(180deg, #d99a2b 0%, #a96f0c 100%); }
.chart-row .bar.other         { background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%); }

/* Events row at top of chart */
.chart-row.events-row .row-label.events-label {
  background: linear-gradient(180deg, #2d3656 0%, #161b32 100%);
  color: white;
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-size: 0.95rem;
  border-bottom: 2px solid var(--ink);
  cursor: default;
  text-align: center;
  justify-content: center;
  box-shadow: 2px 0 8px rgba(0,0,0,0.18);
}
.chart-row.events-row .row-label.events-label:hover {
  background: linear-gradient(180deg, #2d3656 0%, #161b32 100%);
  color: white;
}
.chart-row.events-row .row-track.events-track {
  background-image:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) - 1px),
      rgba(0,0,0,0.04) calc(var(--year-w) - 1px),
      rgba(0,0,0,0.04) var(--year-w)
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) * 5 - 1px),
      rgba(0,0,0,0.10) calc(var(--year-w) * 5 - 1px),
      rgba(0,0,0,0.10) calc(var(--year-w) * 5)
    ),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(var(--year-w) * 10 - 1px),
      rgba(0,0,0,0.18) calc(var(--year-w) * 10 - 1px),
      rgba(0,0,0,0.18) calc(var(--year-w) * 10)
    );
  border-bottom: 2px solid var(--red);
}
.event-marker {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 4px rgba(0,0,0,0.25);
  transition: transform 0.12s ease, filter 0.12s ease;
  display: flex;
  align-items: center;
  padding: 0 6px;
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}
.event-marker:hover {
  transform: translateY(-1px) scale(1.04);
  filter: brightness(1.15);
  z-index: 8;
}
.event-marker.event-spider { background: linear-gradient(180deg, #c8102e 0%, #8a0a1e 100%); }
.event-marker.event-marvel { background: linear-gradient(180deg, #1a3a8a 0%, #0f2455 100%); }

/* Lane stacking for the events row — many events overlap */
.row-track.events-track[data-lanes="2"] .event-marker[data-lane="0"] { top: 5px;  bottom: calc(50% + 2px); }
.row-track.events-track[data-lanes="2"] .event-marker[data-lane="1"] { top: calc(50% + 2px); bottom: 5px; }
.row-track.events-track[data-lanes="3"] .event-marker[data-lane="0"] { top: 5px; bottom: calc(66.66% + 2px); }
.row-track.events-track[data-lanes="3"] .event-marker[data-lane="1"] { top: calc(33.33% + 1px); bottom: calc(33.33% + 1px); }
.row-track.events-track[data-lanes="3"] .event-marker[data-lane="2"] { top: calc(66.66% + 2px); bottom: 5px; }
.row-track.events-track[data-lanes="4"] .event-marker[data-lane="0"] { top: 4px; bottom: calc(75% + 2px); }
.row-track.events-track[data-lanes="4"] .event-marker[data-lane="1"] { top: calc(25% + 1px); bottom: calc(50% + 2px); }
.row-track.events-track[data-lanes="4"] .event-marker[data-lane="2"] { top: calc(50% + 2px); bottom: calc(25% + 1px); }
.row-track.events-track[data-lanes="4"] .event-marker[data-lane="3"] { top: calc(75% + 2px); bottom: 4px; }

/* Event impact ticks overlaid on title rows */
.event-tick {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 4px;
  border-radius: 1px;
  opacity: 0.6;
  pointer-events: auto;
  cursor: pointer;
  z-index: 3;
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.event-tick:hover { opacity: 1; transform: scaleX(1.6); }
.event-tick.event-spider { background: var(--red); }
.event-tick.event-marvel { background: var(--blue); }

.chart-decade-band {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
  border-left: 1px dashed rgba(0,0,0,0.18);
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--paper-2) 0%, var(--paper) 100%);
  border-bottom: 2px solid var(--ink);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
  font-size: 0.82rem;
  position: sticky;
  left: 0;
  z-index: 7;
}
.chart-legend .legend-label {
  font-family: 'Bangers', 'Impact', 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--red-dark);
  margin-right: 4px;
}
.chart-legend .swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chart-legend .swatch::before {
  content: '';
  width: 18px;
  height: 12px;
  border-radius: 3px;
}
.chart-legend .swatch.flagship::before     { background: var(--red); }
.chart-legend .swatch.spider-family::before { background: #6c4ab8; }
.chart-legend .swatch.anthology::before    { background: #d99a2b; }
.chart-legend .swatch.other::before        { background: var(--blue); }
.chart-legend .swatch.event-spider::before { background: var(--red); border: 1px solid var(--red-dark); }
.chart-legend .swatch.event-marvel::before { background: var(--blue); border: 1px solid var(--blue-dark); }

@media (max-width: 720px) {
  .chart { --label-w: 160px; --year-w: 10px; }
}

/* Lightbox — fullscreen cover zoom */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 22, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 200;
  cursor: zoom-out;
  animation: fade 0.15s ease;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.7);
}
.lightbox .lb-close {
  position: absolute;
  top: 18px;
  right: 24px;
  background: transparent;
  color: white;
  border: 0;
  font-size: 2.4rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}
.lightbox .lb-close:hover { opacity: 1; }
.lightbox .lb-caption {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
  padding: 0 24px;
}

@media (max-width: 720px) {
  .event-card .cover-event { height: 280px; }
  .event-card .cover.cover-placeholder.cover-event { height: 280px; }
  .title-head { grid-template-columns: 140px 1fr; gap: 16px; }
  .title-head .cover { width: 140px; height: 210px; }
}
@media (max-width: 480px) {
  .title-head { grid-template-columns: 110px 1fr; gap: 12px; }
  .title-head .cover { width: 110px; height: 165px; }
  .title-head h3 { font-size: 1.5rem; }
  .modal-head { grid-template-columns: 100px 1fr; }
  .modal-head .cover { width: 100px; height: 150px; }
  .timeline-item .card.has-cover { grid-template-columns: 70px 1fr; }
  .timeline-item .card .thumb { width: 70px; height: 105px; }
}

/* =========== New features (continue-reading, chrono, runs, kid mode) =========== */

/* Header toolbar — Kid Mode toggle */
.header-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 0;
}
.kid-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  color: white;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.kid-mode-toggle input { margin: 0; }

/* Kid Mode — hide power-user UI when active */
body.kid-mode .tab[data-tab="chart"],
body.kid-mode .tab[data-tab="creators"],
body.kid-mode .tab[data-tab="runs"],
body.kid-mode .tab[data-tab="chrono"],
body.kid-mode .tab[data-tab="sources"],
body.kid-mode #fs-banner,
body.kid-mode #prebuilt-banner,
body.kid-mode #coverage-banner,
body.kid-mode #missing-panel,
body.kid-mode #extras-panel,
body.kid-mode #show-missing-btn,
body.kid-mode #missing-export-csv,
body.kid-mode #missing-print,
body.kid-mode .reading-progress,
body.kid-mode .step-issue-chip.is-unowned,
body.kid-mode .step-badge.badge-unowned,
body.kid-mode .reading-step.is-unowned {
  display: none !important;
}
body.kid-mode .stat-row .stat:nth-child(1),
body.kid-mode .stat-row .stat:nth-child(2) {
  display: none;
}

/* Continue Reading section */
.continue-reading {
  padding: 24px 32px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.continue-reading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.continue-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s;
}
.continue-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.continue-cover { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.continue-cover-placeholder {
  width: 100%; aspect-ratio: 2/3;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); font-size: 2rem;
}
.continue-body { padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.continue-title { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.continue-num { font-size: 0.78rem; color: var(--ink-soft); }
.continue-meta { font-size: 0.75rem; color: var(--ink-soft); font-style: italic; }
.continue-resume {
  background: var(--red); color: white; border: 0;
  padding: 6px 12px; border-radius: 999px;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 0.85rem; letter-spacing: 1px;
  cursor: pointer; margin-top: 4px;
}
.continue-resume:hover { background: var(--red-dark); }

/* Chronological view */
.chrono-filters {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  margin-top: 12px;
}
.chrono-filters label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.chrono-list { display: flex; flex-direction: column; gap: 4px; }
.chrono-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.chrono-row.is-owned { background: #f1f8e9; border-color: #c5e1a5; cursor: pointer; transition: transform 0.1s, box-shadow 0.15s, background 0.15s; }
.chrono-row.is-owned:hover { background: #e8f5e9; box-shadow: 0 2px 8px rgba(46,125,50,0.18); transform: translateX(2px); }
.chrono-row.is-owned:focus-visible { outline: 2px solid #2e7d32; outline-offset: 2px; }
.chrono-row.is-unowned { cursor: pointer; }
.chrono-row.is-unowned:hover { background: #fafafa; }
.chrono-row.is-read { opacity: 0.78; }
.chrono-row.is-read .chrono-cover { filter: grayscale(20%); }
.chrono-read-badge {
  display: inline-block;
  background: #2e7d32;
  color: white;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 4px;
  font-weight: 700;
  vertical-align: middle;
}
.chrono-info-btn {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-style: italic;
  font-family: 'Georgia', serif;
  cursor: pointer;
}
.chrono-info-btn:hover { background: var(--paper); color: var(--ink); }
.chrono-cover { width: 48px; height: 72px; object-fit: cover; border-radius: 3px; }
.chrono-cover-placeholder {
  width: 48px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border-radius: 3px;
}
.chrono-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chrono-date { font-size: 0.75rem; color: var(--ink-soft); }
.chrono-title { font-weight: 600; color: var(--ink); font-size: 0.92rem; }
.chrono-issue-name { font-size: 0.82rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chrono-read-btn {
  background: var(--red); color: white; border: 0;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer;
}
.chrono-read-btn:hover { background: var(--red-dark); }
.chrono-unowned-tag { color: var(--ink-soft); font-size: 1.2rem; padding-right: 6px; }
.chrono-truncated { text-align: center; padding: 12px; }

/* Chronological pagination — duplicated at top + bottom of the page so the
   user doesn't have to scroll back up to advance. */
.chrono-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 8px;
  flex-wrap: wrap;
}
.chrono-page-nav {
  background: white;
  color: var(--red);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
}
.chrono-page-nav:hover:not(:disabled) {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.chrono-page-nav:disabled { opacity: 0.4; cursor: not-allowed; }
.chrono-page-numbers { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.chrono-page-btn {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.chrono-page-btn:hover { background: #f0f0f0; }
.chrono-page-btn.is-current {
  background: var(--red);
  color: white;
  border-color: var(--red);
  font-weight: 700;
}
.chrono-page-gap { color: var(--ink-soft); padding: 0 4px; }
.chrono-page-info {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .chrono-page-info { flex-basis: 100%; text-align: center; margin-left: 0; }
}

/* Creator Runs */
.runs-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
.run-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.run-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.run-head h3 {
  margin: 0;
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 1px;
  color: var(--ink);
}
.run-years { font-size: 0.85rem; color: var(--ink-soft); }
.run-desc { margin: 4px 0 8px; font-size: 0.92rem; color: var(--ink); line-height: 1.4; }
.run-meta { font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 6px; }
.run-bar {
  height: 6px;
  background: #eceff1;
  border-radius: 999px;
  overflow: hidden;
}
.run-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #2e7d32);
}

/* Share toast */
.share-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e7d32;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: aa-slide 0.3s ease;
}
