:root {
  color-scheme: dark;
  --wall: #21101d;
  --wall-2: #3a1d33;
  --ink: #352032;
  --ink-soft: #5c4055;
  --paper: #ffeaf4;
  --paper-2: #ffd9ea;
  --paper-3: #ffc5df;
  --line: #7c3c65;
  --line-soft: #b96b91;
  --hot: #e43f86;
  --hot-2: #ff72a8;
  --cyan: #35b8c8;
  --blue: #5578d8;
  --green: #3e9b6c;
  --gold: #d7a63c;
  --danger: #c9364c;
  --dark-panel: #1a0f18;
  --dark-panel-2: #2a1726;
  --menu-ink: #fff4fa;
  --menu-muted: #efbad1;
  --shadow-block: 5px 5px 0 rgba(23, 6, 18, 0.45);
  --shadow-soft: 0 16px 42px rgba(13, 3, 11, 0.35);
  --radius: 0;
}

* {
  box-sizing: border-box;
}

html {
  background: #10080e;
}

body {
  position: relative;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  font-family: "Aller", "Avenir Next", "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  background: #10080e;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("assets/backgrounds/aliriverse-sunrise.webp") center / cover fixed no-repeat;
  filter: saturate(0.78) contrast(0.82) brightness(0.74);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 26% 72%, rgba(245, 186, 99, 0.18), transparent 32%),
    radial-gradient(circle at 78% 16%, rgba(53, 184, 200, 0.1), transparent 35%),
    linear-gradient(90deg, rgba(16, 5, 15, 0.93), rgba(24, 10, 22, 0.7) 47%, rgba(15, 6, 13, 0.92)),
    linear-gradient(180deg, rgba(11, 18, 35, 0.58), rgba(80, 29, 64, 0.38) 44%, rgba(16, 6, 14, 0.9));
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button,
.video-link,
.time-link {
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button {
  min-height: 34px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--paper-2);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 800;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover {
  border-color: var(--hot);
  background: #fff8fc;
  color: #4b123a;
}

button:active {
  transform: translate(1px, 1px);
}

button.active,
button.primary {
  border-color: #ffffff;
  background: var(--hot);
  color: #fff8fc;
}

.ghost {
  border-color: rgba(255, 234, 244, 0.45);
  background: transparent;
  color: var(--menu-ink);
}

.hidden {
  display: none !important;
}

a {
  color: inherit;
}

.shader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.72;
}

.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 16px 16px 18px;
  color: var(--menu-ink);
  border-right: 4px solid #f17faf;
  background:
    linear-gradient(90deg, rgba(255, 199, 102, 0.08), transparent 22px),
    linear-gradient(180deg, rgba(30, 12, 29, 0.94), rgba(14, 7, 15, 0.96));
  box-shadow: 8px 0 0 rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid rgba(255, 234, 244, 0.2);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border: 2px solid #fff1f8;
  border-radius: 0;
  object-fit: cover;
  background: #100810;
  box-shadow: 4px 4px 0 rgba(228, 63, 134, 0.36);
}

.brand h1 {
  margin: 0;
  color: #fff5fb;
  font-family: "Hot Mustard", "Riffic Free", "Trebuchet MS", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.05;
  text-shadow: 2px 2px 0 rgba(118, 24, 73, 0.8);
}

@keyframes crystalFacetShift {
  from {
    background-position: 0% 50%, 0 0, 0 0;
  }
  to {
    background-position: 200% 50%, 54px 0, -38px 0;
  }
}

body[data-view="crystals"] .entity-group-header h3,
body[data-view="crystals"] .entity-card h3,
body[data-view="crystals"] .tab-button.active[data-tab="crystals"] span,
body[data-view="crystals"] #viewTitle,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-header h3,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-info-panel h4,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-strip button.active span,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-header h3,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-info-panel h4,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-strip button.active span {
  display: inline-block;
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: crystalFacetShift 11s linear infinite;
}

body[data-view="crystals"] .tab-button.active {
  border-color: #9cefff;
  background: #22101f;
  color: #fff;
  box-shadow: 4px 4px 0 rgba(7, 3, 7, 0.45), inset 0 0 0 1px rgba(156, 239, 255, 0.55);
}

body[data-view="crystals"] .tab-button.active::before {
  color: #9cefff;
}

body[data-view="crystals"] .entity-card {
  background: rgba(234, 247, 255, 0.92);
  border-color: rgba(101, 205, 230, 0.88);
}

body[data-view="crystals"] .entity-card[data-entity-id="purple_crystal"] {
  background: rgba(241, 230, 255, 0.92);
  border-color: rgba(161, 100, 205, 0.9);
}

body[data-view="crystals"] .entity-card[data-entity-id="blue_crystal"] {
  background: rgba(224, 250, 255, 0.92);
  border-color: rgba(68, 197, 224, 0.9);
}

body[data-view="crystals"] .entity-group-header h3,
body[data-view="crystals"] .entity-card[data-entity-id="blue_crystal"] h3,
body[data-view="crystals"] .tab-button.active[data-tab="crystals"] span,
body[data-view="crystals"] #viewTitle,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-header h3,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-info-panel h4,
.gallery-panel[data-gallery-item-id="blue_crystal"] .gallery-strip button.active span {
  background-image:
    linear-gradient(90deg, #155f81 0%, #1fb9d7 18%, #f5fdff 33%, #4bdeff 43%, #0f6f9b 59%, #dffaff 72%, #155f81 100%),
    repeating-linear-gradient(58deg, rgba(255, 255, 255, 0.72) 0 8px, rgba(255, 255, 255, 0) 8px 19px),
    repeating-linear-gradient(128deg, rgba(17, 94, 130, 0.55) 0 9px, rgba(17, 94, 130, 0) 9px 24px);
  background-blend-mode: screen, screen, multiply;
  text-shadow:
    0 1px 0 rgba(245, 253, 255, 0.28),
    1px 0 0 rgba(38, 184, 203, 0.62),
    -1px 0 0 rgba(58, 118, 210, 0.34);
  filter: drop-shadow(0 0 4px rgba(38, 184, 203, 0.22));
}

body[data-view="crystals"] .entity-card[data-entity-id="purple_crystal"] h3,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-header h3,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-info-panel h4,
.gallery-panel[data-gallery-item-id="purple_crystal"] .gallery-strip button.active span {
  background-image:
    linear-gradient(90deg, #3d176f 0%, #8b41d5 18%, #f8edff 33%, #d77cff 43%, #5f218a 59%, #f3dcff 72%, #3d176f 100%),
    repeating-linear-gradient(58deg, rgba(255, 255, 255, 0.7) 0 8px, rgba(255, 255, 255, 0) 8px 19px),
    repeating-linear-gradient(128deg, rgba(79, 31, 116, 0.58) 0 9px, rgba(79, 31, 116, 0) 9px 24px);
  background-blend-mode: screen, screen, multiply;
  text-shadow:
    0 1px 0 rgba(248, 237, 255, 0.28),
    1px 0 0 rgba(170, 92, 255, 0.62),
    -1px 0 0 rgba(77, 210, 255, 0.26);
  filter: drop-shadow(0 0 4px rgba(159, 80, 230, 0.26));
}

.brand p {
  margin: 5px 0 0;
  color: var(--menu-muted);
  font-size: 12px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--menu-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  padding: 0 10px;
}

.sidebar input,
.sidebar select {
  border-color: rgba(255, 234, 244, 0.38);
  background: #2a1427;
  color: var(--menu-ink);
}

.sidebar input::placeholder {
  color: #ca89a7;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.quick-jumps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 4px 0 16px;
}

.quick-jumps button {
  min-height: 30px;
  padding: 0 5px;
  border-color: rgba(255, 234, 244, 0.28);
  background: #1c0d1a;
  color: #ffe1f0;
  font-size: 11px;
}

.quick-jumps button:hover {
  background: var(--hot);
  color: #fff;
}

.tab-list {
  display: grid;
  gap: 5px;
  margin: 16px 0;
}

.tab-button {
  position: relative;
  justify-content: flex-start;
  text-align: left;
  min-height: 38px;
  border-color: rgba(255, 234, 244, 0.28);
  background: transparent;
  color: var(--menu-ink);
  padding-left: 28px;
  font-weight: 900;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.tab-button::before {
  content: ">";
  position: absolute;
  left: 10px;
  color: var(--cyan);
  font-weight: 900;
  transition: transform 160ms ease, color 160ms ease;
}

.tab-button:hover {
  border-color: #ffeaf4;
  background: rgba(218, 55, 137, 0.42);
  color: #fff8fc;
}

.tab-button.active {
  border-color: #fff2f8;
  background: var(--hot);
  color: #fff;
  box-shadow: 4px 4px 0 rgba(7, 3, 7, 0.45);
}

.tab-button.active::before {
  transform: translateX(3px);
  color: #fff;
}

.tab-button.active:hover {
  background: var(--hot);
  color: #fff8fc;
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mini-stat {
  border: 2px solid rgba(255, 234, 244, 0.24);
  background: rgba(255, 234, 244, 0.06);
  padding: 9px;
}

.mini-stat span {
  display: block;
  color: var(--menu-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.mini-stat strong {
  display: block;
  margin-top: 2px;
  color: #fff8fc;
  font-size: 17px;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -22px -22px 18px;
  padding: 16px 22px;
  border-bottom: 3px solid rgba(255, 114, 168, 0.72);
  background:
    linear-gradient(90deg, rgba(25, 10, 24, 0.94), rgba(81, 42, 59, 0.74)),
    rgba(32, 14, 28, 0.9);
  box-shadow: 0 8px 0 rgba(13, 3, 11, 0.18);
  backdrop-filter: blur(8px);
}

.topbar h2 {
  margin: 3px 0 0;
  color: #fff4fa;
  font-family: "Hot Mustard", "Riffic Free", "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 0.95;
  text-shadow: 3px 3px 0 rgba(141, 30, 87, 0.72);
}

.eyebrow {
  margin: 0;
  color: var(--menu-muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.overview-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card,
.card,
.episode-card,
.extra-card,
.character-card,
.entity-card,
.location-card,
.meta-card,
.table-like,
.detail-panel,
.gallery-panel {
  border: 2px solid rgba(216, 145, 178, 0.82);
  border-radius: 0;
  background: rgba(255, 234, 244, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow-block);
  backdrop-filter: blur(5px);
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255, 217, 234, 0.9);
}

.stat-card span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-card strong {
  color: #8b1f56;
  font-size: 23px;
  line-height: 1;
}

.content {
  display: grid;
  gap: 18px;
}

.content > * {
  animation: contentIn 180ms ease-out both;
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.intro-grid,
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.three-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  padding: 15px;
}

h3,
h4,
p {
  overflow-wrap: anywhere;
}

h3,
h4 {
  margin: 0;
  color: #7d2357;
}

h3 {
  font-size: 21px;
  line-height: 1.1;
}

h4 {
  font-size: 16px;
}

p {
  margin: 0;
  line-height: 1.46;
}

.card p + p {
  margin-top: 10px;
}

.muted {
  color: var(--ink-soft);
}

.arc-section,
.part-section,
.track-section,
.extras-section,
.character-group,
.mechanic-group,
.entity-group {
  display: grid;
  gap: 14px;
}

.track-section {
  border: 2px solid rgba(255, 234, 244, 0.25);
  background: rgba(33, 16, 29, 0.62);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.part-section {
  border-left: 5px solid var(--cyan);
  padding-left: 12px;
}

.arc-section {
  border-top: 2px solid rgba(255, 234, 244, 0.16);
  padding-top: 12px;
}

.track-header,
.part-header,
.arc-header,
.character-group-header,
.mechanic-group-header,
.entity-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.track-header h3,
.part-header h3,
.arc-header h3,
.character-group-header h3,
.mechanic-group-header h3,
.entity-group-header h3 {
  color: #fff4fa;
}

.track-header p,
.part-header p,
.arc-header p {
  color: #f1c8db;
  margin-top: 4px;
}

.episode-grid,
.extra-grid,
.meta-grid,
.meta-board,
.mechanics-grid,
.planned-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.meta-grid,
.meta-board,
.mechanics-grid,
.planned-grid {
  grid-template-columns: minmax(0, 1fr);
}

.meta-intro,
.location-intro,
.mechanics-intro,
.planned-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border: 2px solid rgba(216, 145, 178, 0.82);
  background: rgba(26, 12, 23, 0.78);
  color: #ffeaf4;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.meta-intro h3,
.location-intro h3,
.mechanics-intro h3,
.planned-intro h3 {
  color: #fff4fa;
}

.meta-intro p,
.location-intro p,
.mechanics-intro p,
.planned-intro p {
  max-width: 760px;
  color: #f1c8db;
}

.episode-card,
.extra-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  align-content: start;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.episode-card:hover,
.extra-card:hover,
.character-card:hover,
.entity-card:hover,
.location-card:hover,
.mechanic-card:hover,
.meta-card:hover,
.planned-card:hover,
.result-line:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(38, 184, 203, 0.14), var(--shadow-block);
}

.episode-card.scroll-target-flash,
.extra-card.scroll-target-flash {
  animation: scrollTargetFlash 1400ms ease-out;
}

@keyframes scrollTargetFlash {
  0% {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(53, 184, 200, 0.35), var(--shadow-block);
  }
  100% {
    border-color: var(--hot);
    box-shadow: var(--shadow-block);
  }
}

.meta-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.planned-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.planned-notes {
  margin: 0;
  padding-left: 20px;
  color: #4b2d43;
}

.planned-notes li + li {
  margin-top: 6px;
}

.meta-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.compact-meta-card .tag-system {
  gap: 7px;
}

.meta-details {
  border-top: 1px solid #d891b2;
  padding-top: 8px;
}

.meta-details summary {
  color: #7d2357;
  cursor: pointer;
  font-weight: 900;
  transition: color 140ms ease;
}

.meta-details[open] > :not(summary) {
  animation: detailsIn 160ms ease-out both;
}

@keyframes detailsIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.meta-why {
  border-left: 4px solid var(--cyan);
  background: #fff6fb;
  padding: 8px 10px;
}

.ability-list {
  display: grid;
  gap: 7px;
}

.ability-item {
  display: grid;
  gap: 5px;
  border: 1px solid #e6a8c4;
  background: #fff9fc;
  padding: 8px 9px;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.ability-item:hover {
  border-color: var(--cyan);
  background: #ffffff;
}

.ability-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.ability-item-header strong {
  color: #7d2357;
  font-size: 14px;
}

.ability-item p {
  color: #3b2535;
  font-size: 13px;
}

.mechanic-card {
  position: relative;
  gap: 11px;
  overflow: hidden;
}

.mechanic-detail-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: #3b2535;
  font-size: 13px;
  line-height: 1.45;
}

.mechanic-warning {
  border-left: 4px solid var(--gold);
  background: #fff3c7;
  color: #5d4312;
  padding: 8px 10px;
  font-weight: 850;
}

.mechanic-card:has(.mechanic-warning) {
  box-shadow: 4px 4px 0 rgba(127, 39, 85, 0.2), 0 0 0 1px rgba(38, 184, 203, 0.16);
}

.lore-evidence-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.lore-evidence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  border: 1px solid #d891b2;
  background: #fff9fc;
  padding: 9px 10px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.lore-evidence-row:hover {
  border-color: var(--cyan);
  background: #ffffff;
}

.lore-evidence-row span {
  display: block;
  color: #7d2357;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.lore-evidence-row strong {
  color: #2f2130;
  font-size: 13px;
}

.lore-evidence-row p,
.lore-evidence-row blockquote,
.lore-evidence-row em {
  grid-column: 1 / -1;
}

.lore-evidence-row blockquote {
  margin: 0;
  border-left: 4px solid var(--cyan);
  background: #f2fcff;
  color: #244950;
  padding: 7px 9px;
  font-size: 13px;
  font-weight: 850;
}

.lore-evidence-row .discord-spoiler {
  display: inline-block;
  min-width: 4.5em;
  border-radius: 2px;
  background: #1f1d22;
  color: transparent;
  font-size: inherit;
  font-weight: inherit;
  text-shadow: none;
  text-transform: none;
  user-select: none;
  vertical-align: baseline;
}

.lore-evidence-row .discord-spoiler:hover,
.lore-evidence-row .discord-spoiler:focus {
  color: #fff;
  background: #4b4650;
}

.lore-evidence-row em {
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
}

.lore-image-details {
  grid-column: 1 / -1;
  border-top: 1px solid #f0bdd2;
  padding-top: 6px;
}

.lore-image-details summary {
  color: #7d2357;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.lore-image-details a {
  display: block;
  margin-top: 7px;
  border: 1px solid #d891b2;
  background: #180c17;
}

.lore-image-details img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
}

.lore-media-details {
  grid-column: 1 / -1;
  border-top: 1px solid #f0bdd2;
  padding-top: 6px;
}

.lore-media-details summary {
  color: #7d2357;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.lore-media-details video {
  display: block;
  width: 100%;
  max-height: 320px;
  margin-top: 7px;
  border: 1px solid #d891b2;
  background: #180c17;
}

.meta-code-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.meta-code-list code {
  display: inline-block;
  border: 1px solid #d891b2;
  background: #190d17;
  color: #fff4fa;
  padding: 2px 5px;
}

.episode-card header,
.extra-card header {
  grid-column: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.episode-card > p,
.episode-card > .list,
.episode-card > .tag-system,
.extra-card > p,
.extra-card > .tag-system,
.extra-card > .extra-chip-row {
  grid-column: 2;
}

.episode-thumb {
  grid-row: span 5;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid #7b2f60;
  object-fit: cover;
  background: #180c17;
}

.episode-number {
  display: inline-block;
  margin-bottom: 5px;
  color: var(--hot);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.42;
}

.extra-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.list li + li {
  margin-top: 4px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-system {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.tag-group {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}

.tag-group-label {
  color: #7d2357;
  font-size: 10px;
  font-weight: 900;
  line-height: 24px;
  text-transform: uppercase;
}

.tag-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  max-width: 100%;
  border: 1px solid #b95d8c;
  border-radius: 0;
  background: #fff7fb;
  color: #7b2b58;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  text-decoration: none;
  overflow-wrap: anywhere;
}

button.chip {
  min-height: 24px;
  padding: 2px 7px;
}

.chip.accent {
  border-color: var(--hot);
  background: #ffe1ee;
  color: #9f215f;
}

.chip.blue {
  border-color: #6686d6;
  background: #e7edff;
  color: #26478e;
}

.chip.green {
  border-color: #5fa978;
  background: #e3f6ea;
  color: #226442;
}

.chip.violet {
  border-color: #9a70c2;
  background: #f1e5ff;
  color: #62378e;
}

.chip.gold {
  border-color: #c89624;
  background: #fff1c7;
  color: #7a5712;
}

.link-button {
  display: inline;
  min-height: 0;
  border: 0;
  background: transparent;
  color: #8b1f56;
  padding: 0;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover {
  background: transparent;
  color: var(--hot);
}

.video-link,
.time-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--cyan);
  background: #e3fbff;
  color: #165f6b;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.video-link:hover,
.time-link:hover {
  border-color: var(--hot);
  background: #ffe0ee;
  color: #8b1f56;
}

.character-card,
.entity-card,
.location-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 11px;
}

.launch-card {
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.launch-card:hover,
.launch-card:focus-within {
  border-color: var(--hot);
  background: #fff0f7;
  transform: translateY(-1px);
}

.location-card.launch-card {
  min-height: 96px;
}

.location-list {
  display: grid;
  gap: 9px;
}

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 2px solid rgba(216, 145, 178, 0.82);
  background: rgba(255, 234, 244, 0.92);
  color: var(--ink);
  padding: 11px 12px;
  box-shadow: 3px 3px 0 rgba(23, 6, 18, 0.35);
}

.location-row h3 {
  font-size: 18px;
}

.location-row p {
  margin-top: 4px;
  color: var(--ink-soft);
}

.location-row-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.visual-image-button {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  border: 2px solid #7b2f60;
  background: #180c17;
  padding: 0;
  color: var(--paper);
  box-shadow: none;
}

.visual-image-button > span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border: 1px solid #fff3f8;
  background: rgba(38, 11, 31, 0.88);
  color: #fff3f8;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 900;
}

.index-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #180c17;
}

.image-placeholder {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 2px dashed #b96b91;
  background:
    linear-gradient(135deg, rgba(255, 114, 168, 0.14) 25%, transparent 25%) 0 0 / 16px 16px,
    #2a1726;
  color: #ffdbe9;
  text-align: center;
}

.image-placeholder span {
  display: inline-block;
  border: 1px solid rgba(255, 234, 244, 0.45);
  background: rgba(20, 8, 18, 0.8);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
}

.visual-evidence-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.visual-evidence-strip a,
.visual-evidence-strip div {
  position: relative;
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.visual-evidence-strip img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #8d3f6f;
  object-fit: cover;
  background: #170c16;
}

.visual-evidence-strip span {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  background: rgba(30, 8, 25, 0.86);
  color: #fff4fa;
  padding: 2px 4px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.05;
}

.visual-note {
  border-left: 4px solid var(--gold);
  background: #fff4cd;
  color: #5b4213;
  padding: 8px 9px;
  font-size: 13px;
}

.small-note {
  font-size: 12px;
}

.info-block {
  display: grid;
  gap: 6px;
  border-top: 1px solid #e6a8c4;
  padding-top: 8px;
}

.info-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.info-block h4 {
  color: #8b1f56;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-like {
  display: grid;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 110px minmax(180px, 0.9fr) minmax(220px, 1.4fr) minmax(180px, 0.8fr);
  gap: 10px;
  align-items: center;
  border-top: 1px solid #d891b2;
  padding: 9px 11px;
}

.table-row:first-child {
  border-top: 0;
}

.table-row.header {
  background: var(--paper-3);
  color: #792653;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.video-table .table-row {
  grid-template-columns: 120px minmax(240px, 1fr) minmax(220px, 1fr) 150px;
}

.row-thumb {
  display: block;
  width: 74px;
  aspect-ratio: 16 / 9;
  margin-bottom: 4px;
  border: 1px solid #7b2f60;
  object-fit: cover;
  background: #170c16;
}

.evidence-list {
  display: grid;
  gap: 7px;
}

.appearance-list {
  display: grid;
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 7px 10px 7px 7px;
  border: 1px solid #e6a8c4;
  background: #fff9fc;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.appearance-list::-webkit-scrollbar {
  width: 10px;
}

.appearance-list::-webkit-scrollbar-track {
  background: #ffe8f3;
}

.appearance-list::-webkit-scrollbar-thumb {
  background: #b95d8c;
  border: 2px solid #ffe8f3;
}

.appearance-list::-webkit-scrollbar-thumb:hover {
  background: #8b1f56;
}

.appearance-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) minmax(72px, auto);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border: 1px solid #c6789f;
  background: #fff5fa;
  color: var(--ink);
  padding: 7px;
  text-align: left;
  text-decoration: none;
  box-shadow: none;
}

.appearance-row:hover,
.appearance-row:focus-visible {
  border-color: var(--hot);
  background: #ffe8f3;
}

.appearance-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.appearance-row strong,
.appearance-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appearance-row em {
  color: var(--ink-soft);
  font-style: normal;
  font-weight: 500;
}

.appearance-row b {
  justify-self: end;
  min-width: 64px;
  border: 1px solid #d987ad;
  background: #fff;
  color: #8b1f56;
  font-size: 11px;
  line-height: 1.1;
  padding: 3px 5px;
  text-align: center;
  text-transform: uppercase;
}

.appearance-thumb {
  width: 86px;
  height: 48px;
  aspect-ratio: 16 / 9;
  border: 1px solid #7b2f60;
  object-fit: cover;
  background: #170c16;
}

.evidence-line,
.quote,
.result-line {
  border: 1px solid #c6789f;
  border-left: 5px solid var(--cyan);
  background: #fff5fa;
  color: var(--ink);
  padding: 8px 10px;
  line-height: 1.42;
}

.evidence-line b,
.quote b {
  color: #146876;
}

.search-results {
  display: grid;
  gap: 8px;
}

.search-summary {
  display: grid;
  gap: 12px;
}

.search-help {
  display: grid;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

.search-help b {
  color: #8b1f56;
}

.search-filter-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid #e6a8c4;
  padding-top: 10px;
}

.search-filter-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.search-filter-head b,
.suggested-search-filters b {
  display: block;
  color: #8b1f56;
  font-size: 11px;
  text-transform: uppercase;
}

.search-filter-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.search-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.search-filter-field {
  display: grid;
  gap: 4px;
}

.search-filter-field span {
  color: #8b1f56;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-filter-field input {
  width: 100%;
  min-width: 0;
  border: 2px solid #e6a8c4;
  background: #fff9fc;
  color: var(--ink);
  padding: 8px 9px;
  font: inherit;
  font-size: 13px;
}

.search-filter-field input:focus {
  outline: 3px solid rgba(38, 184, 203, 0.28);
  border-color: var(--cyan);
}

.source-filter-viewer {
  display: grid;
  gap: 6px;
}

.source-filter-viewer-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.source-filter-viewer-head b {
  color: #8b1f56;
  font-size: 11px;
  text-transform: uppercase;
}

.source-filter-viewer-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.source-filter-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  border: 2px solid #e6a8c4;
  background: #fff9fc;
  padding: 7px;
}

.source-filter-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 7px;
  align-items: baseline;
  width: 100%;
  border: 1px solid #ecc1d4;
  background: #fff;
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
  font: inherit;
  min-height: 58px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.source-filter-option strong {
  color: #8b1f56;
  font-size: 12px;
}

.source-filter-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.source-filter-option small {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 11px;
}

.source-filter-option:hover,
.source-filter-option:focus-visible,
.source-filter-option.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 2px rgba(38, 184, 203, 0.24);
}

.source-filter-option:hover,
.source-filter-option:focus-visible {
  transform: translateY(-1px);
}

.source-filter-option.quiet {
  opacity: 0.72;
}

.active-search-filters,
.suggested-search-filters .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggested-search-filters {
  display: grid;
  gap: 6px;
}

.search-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid #e6a8c4;
  padding-top: 10px;
}

.search-breakdown b {
  display: block;
  margin-bottom: 6px;
  color: #8b1f56;
  font-size: 11px;
  text-transform: uppercase;
}

.result-line mark {
  background: #fff0a8;
  color: #4b3210;
  padding: 0 2px;
  animation: markPulse 1100ms ease-out both;
}

@keyframes markPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 203, 56, 0.7);
  }
  100% {
    box-shadow: 0 0 0 5px rgba(255, 203, 56, 0);
  }
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.result-text {
  overflow-wrap: anywhere;
}

.result-context {
  margin-top: 8px;
  border-top: 1px solid #ecc1d4;
  padding-top: 6px;
}

.result-context summary {
  color: #8b1f56;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.context-lines {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.context-line {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  color: var(--ink-soft);
  font-size: 12px;
}

.context-line span,
.context-line b,
.context-line strong {
  color: #8b1f56;
}

.context-line p {
  margin: 0;
  color: var(--ink);
}

.detail-panel {
  position: sticky;
  bottom: 0;
  z-index: 7;
  display: grid;
  gap: 13px;
  margin-top: 18px;
  max-height: 72vh;
  overflow: auto;
  padding: 14px;
  box-shadow: 0 -10px 0 rgba(13, 3, 11, 0.18), var(--shadow-block);
}

.detail-panel.panel-pop {
  animation: panelPop 180ms ease-out both;
}

@keyframes panelPop {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.detail-header h3 {
  font-size: 24px;
}

.detail-header .meta-row {
  grid-column: 1 / -1;
}

.detail-close {
  min-width: 38px;
  min-height: 38px;
  border-color: #f17faf;
  background: #321329;
  color: #fff4fa;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.quote-list {
  display: grid;
  gap: 8px;
}

.video-panel {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 2px solid #d276a2;
  background: #fff5fa;
  padding: 9px;
}

.video-panel span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

.detail-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 2px solid #7b2f60;
  object-fit: cover;
  background: #170c16;
}

.empty {
  border: 2px dashed #c6789f;
  background: rgba(255, 234, 244, 0.08);
  color: #ffd8e9;
  padding: 22px;
  text-align: center;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 4, 14, 0.82);
  animation: backdropIn 160ms ease-out both;
}

.image-lightbox-backdrop {
  background: #050005;
}

.image-lightbox {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  padding: 18px;
  box-shadow: none;
  cursor: zoom-out;
}

.image-lightbox:hover,
.image-lightbox:active {
  background: transparent;
  transform: none;
}

.image-lightbox img {
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: 96vh;
  object-fit: contain;
  background: #10040e;
}

.gallery-panel {
  position: absolute;
  inset: 4vh 4vw;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  animation: modalIn 180ms ease-out both;
}

@keyframes backdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid #d891b2;
  padding-bottom: 10px;
}

.gallery-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.gallery-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: stretch;
}

.gallery-focus {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
  border: 2px solid #c6789f;
  background: #fff6fb;
  padding: 0;
  overflow: hidden;
}

.gallery-main-image {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff6fb;
  padding: 0;
  box-shadow: none;
  overflow: hidden;
}

.gallery-main-image:hover,
.gallery-main-image:focus-visible {
  background: #fff6fb;
  color: #fff3f8;
  border-color: transparent;
  transform: none;
}

.gallery-main-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(84vh - 180px);
  min-height: 360px;
  border: 2px solid #7b2f60;
  object-fit: cover;
  background: #fff6fb;
}

.gallery-main-image span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border: 1px solid #fff3f8;
  background: rgba(38, 11, 31, 0.88);
  color: #fff3f8;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 900;
}

.gallery-info-panel {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  background: #fff6fb;
  padding: 10px 10px 10px 0;
  color: var(--ink);
}

.gallery-info-panel h4 {
  font-size: 24px;
  color: #8b1f56;
}

.gallery-info-panel h3,
.gallery-info-panel h4,
.gallery-info-panel h5,
.gallery-info-panel p,
.gallery-info-panel li,
.gallery-info-panel .muted,
.gallery-info-panel .small-note,
.gallery-info-panel .card-kicker,
.gallery-info-panel .tag-group-label {
  color: var(--ink);
}

.gallery-info-panel .modal-profile-info {
  color: var(--ink);
}

.gallery-info-panel .appearance-row,
.gallery-info-panel .appearance-row:hover,
.gallery-info-panel .appearance-row:focus-visible {
  background: #fff5fa;
  color: var(--ink);
}

.gallery-info-panel .appearance-row {
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: start;
  min-height: 90px;
}

.gallery-info-panel .appearance-row em {
  color: var(--ink-soft);
}

.gallery-info-panel .appearance-row b {
  grid-column: 2;
  justify-self: start;
  color: #8b1f56;
}

.modal-profile-info,
.profile-only-panel {
  display: grid;
  gap: 10px;
}

.modal-profile-info {
  border-top: 2px solid #e6a8c4;
  margin-top: 2px;
  padding-top: 10px;
}

.profile-only-panel {
  min-height: 0;
  overflow: auto;
  border: 2px solid #c6789f;
  background: #fff6fb;
  padding: 12px;
  align-content: start;
}

.gallery-arrow {
  align-self: center;
  width: 46px;
  min-height: 72px;
  border-color: #f17faf;
  background: #35162d;
  color: #fff4fa;
  padding: 0;
  font-size: 42px;
  line-height: 1;
}

.gallery-arrow:disabled {
  cursor: default;
  opacity: 0.28;
}

.gallery-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gallery-strip button {
  display: grid;
  grid-template-columns: 58px minmax(100px, 170px);
  gap: 7px;
  align-items: center;
  min-width: 190px;
  border: 1px solid #c6789f;
  background: #fff6fb;
  color: #7d2357;
  padding: 5px;
  box-shadow: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, background-color 140ms ease;
}

.gallery-strip button:hover,
.gallery-strip button:focus-visible {
  transform: translateY(-1px);
}

.gallery-strip button.active {
  border-color: var(--hot);
  background: #ffe0ee;
}

.gallery-strip img {
  width: 58px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #170c16;
}

.gallery-strip span {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
  text-align: left;
}

@media (max-width: 1320px) {
  .three-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .episode-grid,
  .extra-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 4px solid #f17faf;
  }

  .tab-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    position: relative;
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .topbar {
    margin: -14px -14px 14px;
    padding: 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .intro-grid,
  .two-column,
  .three-column,
  .overview-panel,
  .search-breakdown,
  .search-filter-grid,
  .episode-grid,
  .extra-grid,
  .mechanics-grid,
  .planned-grid,
  .meta-intro,
  .planned-intro,
  .mechanics-intro,
  .location-intro,
  .location-row {
    grid-template-columns: 1fr;
  }

  .meta-intro,
  .planned-intro,
  .mechanics-intro,
  .location-intro {
    display: grid;
  }

  .location-row-meta {
    justify-content: flex-start;
  }

  .search-filter-head {
    flex-direction: column;
  }

  .appearance-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .appearance-row b {
    grid-column: 2;
    justify-self: start;
  }

  .appearance-thumb {
    width: 72px;
    height: 41px;
  }

  .episode-card,
  .extra-card {
    grid-template-columns: 1fr;
  }

  .episode-card header,
  .episode-card > p,
  .episode-card > .list,
  .episode-card > .tag-system,
  .extra-card header,
  .extra-card > p,
  .extra-card > .tag-system,
  .extra-card > .extra-chip-row {
    grid-column: auto;
  }

  .episode-thumb {
    grid-row: auto;
  }

  .table-row,
  .video-table .table-row {
    grid-template-columns: 1fr;
  }

  .table-row.header {
    display: none;
  }

  .detail-header,
  .track-header,
  .part-header,
  .arc-header,
  .mechanic-group-header,
  .entity-group-header,
  .video-panel,
  .gallery-header {
    align-items: stretch;
    flex-direction: column;
  }

  .video-panel {
    grid-template-columns: 1fr;
  }

  .gallery-stage,
  .gallery-focus {
    grid-template-columns: 1fr;
  }

  .gallery-arrow {
    width: 100%;
    min-height: 44px;
  }

  .gallery-main-image img {
    min-height: 260px;
    max-height: 58vh;
  }

  .tag-group {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .tag-group-label {
    line-height: 1.1;
  }

  .context-line {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .context-line p {
    grid-column: 1 / -1;
  }
}

@media (max-width: 500px) {
  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .quick-jumps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
