/* ===========================
   Base Styles
   =========================== */
:root {
  --accent: #5cc9ff;           /* sky blue */
  --accent-light: #a6e1ff;     /* light glow */
  --bg-dark: #060b14;          /* deep cool navy */
  --bg-light: #f6faff;         /* gentle cloud white */
  --text-dark: #eaf7ff;        /* soft white-blue for dark mode */
  --text-light: #0a1c2b;       /* ink blue for light mode */
}

body {
  background: var(--bg-dark);
  color: var(--text-dark);
  font-family: "Georgia", serif;
  line-height: 1.5;
  margin: 0;
  transition: background 0.4s, color 0.4s;
}

/* Light Mode */
body.light {
  background: var(--bg-light);
  color: var(--text-light);
}

/* ===========================
   Navbar
   =========================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  padding: 0.8rem 1.5rem;
  background: rgba(0, 0, 0, 0.95);
  border-bottom: 1px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 1000;
}

body.light .navbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #007755;
}

/* Brand Title */
.navbar .brand {
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
  font-family: "Orbitron", sans-serif;
  text-shadow: 0 0 10px var(--accent);
}


/* ===========================
   Navbar Controls
   =========================== */
.navbar-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ? MENU + THEME BUTTON BASE STYLES */
.menu-toggle,
#themeToggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.6rem; /* Slightly larger for mobile visibility */
  cursor: pointer;
  transition: transform 0.2s, color 0.3s;
  font-family: "Arial Unicode MS", "Segoe UI Symbol", "Courier New", monospace; /* ? Ensures ? is supported */
  line-height: 1;
}

/* ? HOVER EFFECTS */
.menu-toggle:hover,
#themeToggle:hover {
  transform: scale(1.1);
  color: #fff;
}

/* ? Guarantee the ? icon appears even if device font fails */
.menu-toggle::before {
  content: "☰";
  font-family: "Arial Unicode MS", "Segoe UI Symbol", "Courier New", monospace;
}

/* ? MOBILE ONLY: ensure it's visible & centered properly */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    position: relative;
    z-index: 999;
  }
}

/* ===========================
   Navigation Links
   =========================== */
.nav {
  display: none;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.98);
  position: absolute;
  width: 100%;
  left: 0;
  top: 60px;
  padding: 1rem;
  border-top: 1px solid var(--accent);
}

.nav.open {
  display: flex;
  animation: dropdown 0.3s ease forwards;
}

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

.nav a {
  color: #ccc;
  text-decoration: none;
  padding: 0.6rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  position: relative;
  transition: color 0.3s, text-shadow 0.3s;
}

/* ✨ Glowing Underline Animation */
.nav a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 0%;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease, left 0.3s ease;
  box-shadow: 0 0 8px var(--accent);
}

.nav a:hover::after {
  width: 100%;
  left: 0;
}

.nav a:hover,
.nav a.active {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-light);
}

/* ===========================
   Reading Section
   =========================== */
.container {
  max-width: 800px;
  margin: auto;
  padding: 2rem 1rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.reading-section {
  font-size: 1.1rem;
  color: #fff;
  white-space: pre-line;
}

.reading-section p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

/* Emphasis & Style */
.reading-section strong {
  color: #fff;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

.reading-section em {
  color: #b0b0b0;
  font-style: italic;
}

/* ===========================
   Light Mode Text Adjustments
   =========================== */
body.light .reading-section {
  color: #111;
}

body.light .reading-section strong {
  color: #000;
  text-shadow: none;
}

body.light .reading-section em {
  color: #444;
}

/* ===========================
   Chapters & Categories
   =========================== */
.category {
  margin-bottom: 1.5rem;
}

.category h2 {
  color: var(--accent);
  cursor: pointer;
  font-size: 1.3rem;
  margin: 0;
  padding: 0.5rem 0;
  text-shadow: 0 0 8px var(--accent);
  transition: color 0.3s;
}

.category h2:hover {
  color: #fff;
}

.chapter-list {
  list-style: none;
  padding-left: 1rem;
  margin-top: 0.5rem;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.chapter-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.1rem;
}

.chapter-list a:hover {
  text-shadow: 0 0 8px var(--accent);
}

/* ===========================
   Chapter Navigation
   =========================== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  font-size: 1rem;
}

.chapter-nav a {
  color: var(--accent);
  text-decoration: none;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 5px;
  transition: 0.2s;
}

.chapter-nav a:hover {
  background: var(--accent);
  color: #000;
}

/* ===========================
   Character Cards
   =========================== */
.characters-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  padding: 1rem;
}

.character-card {
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 255, 153, 0.3);
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.character-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 20px rgba(0, 255, 153, 0.6);
}

.character-card img {
  width: 100%;
  height: auto;
  border-bottom: 1px solid var(--accent);
}

.character-card .info {
  padding: 1rem;
}

.character-card h3 {
  color: var(--accent);
  margin-bottom: 0.4rem;
  text-shadow: 0 0 6px var(--accent);
}

.character-card p {
  color: #ddd;
  line-height: 1.4;
  font-size: 0.95rem;
  margin: 0;
}

/* Light Mode Cards */
body.light .character-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #007755;
  box-shadow: 0 0 10px rgba(0, 150, 100, 0.3);
}

body.light .character-card h3 {
  color: #007755;
}

body.light .character-card p {
  color: #333;
}

/* ===========================
   Footer
   =========================== */
.footer {
  text-align: center;
  padding: 1rem;
  border-top: 1px solid var(--accent);
  background: rgba(0, 0, 0, 0.9);
  color: #aaa;
}

body.light .footer {
  background: rgba(255, 255, 255, 0.9);
  color: #333;
}

/* ===========================
   Mobile Navbar
   =========================== */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
  }


  .navbar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .menu-toggle {
    display: block;
  }

  .nav {
    display: none;
    flex-direction: column;
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    border-top: 1px solid var(--accent);
    padding: 1rem 0;
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
  }

  .nav.open {
    display: flex;
    animation: dropdown 0.3s ease forwards;
  }

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

#scrollTopBtn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.85);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
  box-shadow: 0 0 12px var(--accent);
  transition: all 0.3s ease;
  z-index: 999;
}

#scrollTopBtn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 20px var(--accent);
  transform: scale(1.1);
}

#scrollTopBtn.show {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* ===========================
   Desktop Layout
   =========================== */
@media (min-width: 769px) {
  .nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    justify-content: center;
    background: transparent;
    width: auto;
    border: none;
    padding: 0;
    flex: 1;
    gap: 2rem;
  }

  .nav a {
    margin: 0;
    padding: 0.4rem 0;
    font-size: 1.15rem;
  }

  .menu-toggle {
    display: none;
  }

  .navbar-controls {
    margin-left: auto;
  }

  #themeToggle {
    border: 1px solid var(--accent);
    border-radius: 50%;
    padding: 0.4rem 0.6rem;
    font-size: 1.2rem;
    transition: all 0.3s ease;
  }

  #themeToggle:hover {
    background: var(--accent);
    color: #000;
    box-shadow: 0 0 10px var(--accent-light);
  }
}

/* Sticky chapter indicator */
.chapter-indicator {
  position: sticky;
  top: 60px; /* sits just below your navbar */
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  padding: 0.5rem;
  margin: 0;
  text-align: center;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 500;
  text-shadow: 0 0 8px var(--accent);
  border-bottom: 1px solid rgba(0, 255, 153, 0.2);
  z-index: 10;
  transition: opacity 0.4s ease; /* 🔹 smooth fade animation */
}

/* Light mode readability */
body.light .chapter-indicator {
  background: rgba(255, 255, 255, 0.9);
  color: #007755;
  text-shadow: none;
}

.chapter-indicator.dim {
  opacity: 0.4; /* 🔹 dim when scrolling */
}
/* ===========================
   Character Profile Grid
   =========================== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.profile-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  background: rgba(6, 11, 20, 0.92);
  border: 1px solid rgba(92, 201, 255, 0.65);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 12px 26px -18px rgba(92, 201, 255, 0.8);
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.profile-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 32px -18px rgba(92, 201, 255, 0.95);
  border-color: var(--accent);
}

.profile-card::before {
  content: attr(data-status);
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

body.light .profile-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 119, 85, 0.35);
  box-shadow: 0 12px 26px -18px rgba(0, 119, 85, 0.5);
}

body.light .profile-card:hover {
  border-color: #007755;
  box-shadow: 0 20px 32px -18px rgba(0, 119, 85, 0.7);
}

body.light .profile-card::before {
  background: rgba(0, 119, 85, 0.1);
  color: #007755;
}

.profile-card__thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(92, 201, 255, 0.4);
  background: rgba(8, 16, 28, 0.9);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.profile-card__thumb:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.profile-card__thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card__thumb::after {
  content: "+";
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.75rem;
  padding: 0.25rem;
  border-radius: 6px;
  background: rgba(6, 11, 20, 0.85);
  color: var(--accent);
  box-shadow: 0 0 6px rgba(92, 201, 255, 0.8);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-card__thumb:hover::after,
.profile-card__thumb:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.profile-card__thumb[aria-disabled="true"],
.profile-card__thumb[aria-disabled="true"]:hover {
  cursor: default;
  border-color: rgba(92, 201, 255, 0.25);
  transform: none;
}

.profile-card__thumb[aria-disabled="true"]::after {
  display: none;
}

.profile-card__thumb.is-placeholder {
  background: linear-gradient(135deg, rgba(92, 201, 255, 0.2), rgba(92, 201, 255, 0.05));
  color: rgba(92, 201, 255, 0.9);
  font-size: 1.6rem;
  font-weight: 600;
}

.profile-card__thumb.is-placeholder span {
  line-height: 1;
}

body.light .profile-card__thumb {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 119, 85, 0.3);
}

body.light .profile-card__thumb:hover {
  border-color: #007755;
}

body.light .profile-card__thumb::after {
  background: rgba(255, 255, 255, 0.95);
  color: #007755;
  box-shadow: 0 0 6px rgba(0, 119, 85, 0.5);
}

.profile-card__body {
  display: grid;
  gap: 0.6rem;
}

.profile-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.profile-card__name {
  font-size: 1.2rem;
  margin: 0;
  color: var(--text-dark);
}

body.light .profile-card__name {
  color: var(--text-light);
}

.profile-card__meta {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(230, 245, 255, 0.85);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

body.light .profile-card__meta {
  color: rgba(10, 28, 43, 0.65);
}

.profile-card__summary {
  margin: 0;
  color: #dcecff;
  font-size: 0.95rem;
}

body.light .profile-card__summary {
  color: rgba(10, 28, 43, 0.8);
}

.profile-card__details {
  display: grid;
  gap: 0.4rem;
}

.profile-card__detail {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.85);
}

.profile-card__detail dt {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(92, 201, 255, 0.9);
}

.profile-card__detail dd {
  margin: 0;
}

body.light .profile-card__detail {
  color: rgba(10, 28, 43, 0.75);
}

body.light .profile-card__detail dt {
  color: #007755;
}

.profile-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-card__tags li {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.15);
  color: var(--accent);
}

body.light .profile-card__tags li {
  background: rgba(0, 119, 85, 0.12);
  color: #007755;
}

.profile-card__update {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.7);
  border-top: 1px dashed rgba(92, 201, 255, 0.2);
  padding-top: 0.5rem;
}

body.light .profile-card__update {
  color: rgba(10, 28, 43, 0.55);
  border-top-color: rgba(0, 119, 85, 0.2);
}

@media (max-width: 540px) {
  .profile-card {
    grid-template-columns: 60px 1fr;
    padding: 1rem;
  }

  .profile-card__thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
  }

  .profile-card__detail {
    grid-template-columns: 1fr;
  }
}

/* Character Profile Modal */
.profile-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 15, 0.78);
  backdrop-filter: blur(6px);
  z-index: 2000;
  padding: 1.5rem;
}

.profile-modal.is-open {
  display: flex;
}

.profile-modal__content {
  position: relative;
  background: rgba(6, 11, 20, 0.95);
  padding: 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(92, 201, 255, 0.6);
  box-shadow: 0 24px 48px -24px rgba(92, 201, 255, 0.9);
  max-width: min(520px, 90vw);
  width: 100%;
}

body.light .profile-modal__content {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 119, 85, 0.35);
  box-shadow: 0 24px 48px -24px rgba(0, 119, 85, 0.7);
}

.profile-modal__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(92, 201, 255, 0.4);
  object-fit: contain;
}

.profile-modal__caption {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: rgba(210, 225, 240, 0.85);
  text-align: center;
}

body.light .profile-modal__caption {
  color: rgba(10, 28, 43, 0.7);
}

.profile-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(6, 11, 20, 0.85);
  border: 1px solid rgba(92, 201, 255, 0.6);
  color: var(--accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

body.light .profile-modal__close {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 119, 85, 0.3);
  color: #007755;
}

.profile-modal__close:hover,
.profile-modal__close:focus-visible {
  transform: scale(1.05);
  border-color: var(--accent);
}

body.modal-open {
  overflow: hidden;
}

/* Character Profile Note */
.profile-note {
  margin-top: 3rem;
  padding: 1.25rem;
  border: 1px dashed rgba(92, 201, 255, 0.35);
  border-radius: 12px;
  background: rgba(6, 11, 20, 0.55);
  color: rgba(210, 225, 240, 0.85);
  font-size: 0.9rem;
}

body.light .profile-note {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 119, 85, 0.35);
  color: rgba(10, 28, 43, 0.7);
}

.profile-note h2 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

body.light .profile-note h2 {
  color: #007755;
}

.profile-note p {
  margin: 0;
  line-height: 1.5;
}

.profile-note code {
  font-size: 0.85rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  background: rgba(92, 201, 255, 0.12);
  color: var(--accent);
  word-break: break-word;
}

body.light .profile-note code {
  background: rgba(0, 119, 85, 0.12);
  color: #007755;
}
/* ===========================
   Character Profile Sections
   =========================== */
.profile-section {
  margin-top: 2.5rem;
}

.profile-section:first-of-type {
  margin-top: 1rem;
}

.profile-section__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.profile-section__title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

body.light .profile-section__title {
  color: #007755;
}

.profile-section__description {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(210, 225, 240, 0.82);
}

body.light .profile-section__description {
  color: rgba(10, 28, 43, 0.65);
}

.profile-section__empty {
  margin: 0;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  border: 1px dashed rgba(92, 201, 255, 0.4);
  background: rgba(6, 11, 20, 0.4);
  color: rgba(210, 225, 240, 0.75);
  font-size: 0.9rem;
}

body.light .profile-section__empty {
  border-color: rgba(0, 119, 85, 0.35);
  background: rgba(255, 255, 255, 0.8);
  color: rgba(10, 28, 43, 0.6);
}

/* ===========================
   Character Profile Grid
   =========================== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.profile-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  background: rgba(6, 11, 20, 0.92);
  border: 1px solid rgba(92, 201, 255, 0.65);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: 0 12px 26px -18px rgba(92, 201, 255, 0.8);
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.profile-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 32px -18px rgba(92, 201, 255, 0.95);
  border-color: var(--accent);
}

.profile-card::before {
  content: attr(data-status);
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.15);
  color: var(--accent);
  font-weight: 600;
}

body.light .profile-card {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 119, 85, 0.35);
  box-shadow: 0 12px 26px -18px rgba(0, 119, 85, 0.5);
}

body.light .profile-card:hover {
  border-color: #007755;
  box-shadow: 0 20px 32px -18px rgba(0, 119, 85, 0.7);
}

body.light .profile-card::before {
  background: rgba(0, 119, 85, 0.1);
  color: #007755;
}

.profile-card__thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(92, 201, 255, 0.4);
  background: rgba(8, 16, 28, 0.9);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.profile-card__thumb:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.profile-card__thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card__thumb::after {
  content: "⤢";
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 0.75rem;
  padding: 0.25rem;
  border-radius: 6px;
  background: rgba(6, 11, 20, 0.85);
  color: var(--accent);
  box-shadow: 0 0 6px rgba(92, 201, 255, 0.8);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.profile-card__thumb:hover::after,
.profile-card__thumb:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.profile-card__thumb[aria-disabled="true"],
.profile-card__thumb[aria-disabled="true"]:hover {
  cursor: default;
  border-color: rgba(92, 201, 255, 0.25);
  transform: none;
}

.profile-card__thumb[aria-disabled="true"]::after {
  display: none;
}

.profile-card__thumb.is-placeholder {
  background: linear-gradient(135deg, rgba(92, 201, 255, 0.2), rgba(92, 201, 255, 0.05));
  color: rgba(92, 201, 255, 0.9);
  font-size: 1.6rem;
  font-weight: 600;
}

.profile-card__thumb.is-placeholder span {
  line-height: 1;
}

body.light .profile-card__thumb {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 119, 85, 0.3);
}

body.light .profile-card__thumb:hover {
  border-color: #007755;
}

body.light .profile-card__thumb::after {
  background: rgba(255, 255, 255, 0.95);
  color: #007755;
  box-shadow: 0 0 6px rgba(0, 119, 85, 0.5);
}

.profile-card__body {
  display: grid;
  gap: 0.6rem;
}

.profile-card__header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.profile-card__name {
  font-size: 1.2rem;
  margin: 0;
  color: var(--text-dark);
}

body.light .profile-card__name {
  color: var(--text-light);
}

.profile-card__meta {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(230, 245, 255, 0.85);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

body.light .profile-card__meta {
  color: rgba(10, 28, 43, 0.65);
}

.profile-card__summary {
  margin: 0;
  color: #dcecff;
  font-size: 0.95rem;
}

body.light .profile-card__summary {
  color: rgba(10, 28, 43, 0.8);
}

.profile-card__details {
  display: grid;
  gap: 0.4rem;
}

.profile-card__detail {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.85);
}

.profile-card__detail dt {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(92, 201, 255, 0.9);
}

.profile-card__detail dd {
  margin: 0;
}

body.light .profile-card__detail {
  color: rgba(10, 28, 43, 0.75);
}

body.light .profile-card__detail dt {
  color: #007755;
}

.profile-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-card__tags li {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.15);
  color: var(--accent);
}

body.light .profile-card__tags li {
  background: rgba(0, 119, 85, 0.12);
  color: #007755;
}

.profile-card__update {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.7);
  border-top: 1px dashed rgba(92, 201, 255, 0.2);
  padding-top: 0.5rem;
}

body.light .profile-card__update {
  color: rgba(10, 28, 43, 0.55);
  border-top-color: rgba(0, 119, 85, 0.2);
}

@media (max-width: 540px) {
  .profile-card {
    grid-template-columns: 60px 1fr;
    padding: 1rem;
  }

  .profile-card__thumb {
    width: 60px;
    height: 60px;
    border-radius: 10px;
  }

  .profile-card__detail {
    grid-template-columns: 1fr;
  }
}

/* Character Profile Modal */
.profile-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 9, 15, 0.78);
  backdrop-filter: blur(6px);
  z-index: 2000;
  padding: 1.5rem;
}

.profile-modal.is-open {
  display: flex;
}

.profile-modal__content {
  position: relative;
  background: rgba(6, 11, 20, 0.95);
  padding: 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(92, 201, 255, 0.6);
  box-shadow: 0 24px 48px -24px rgba(92, 201, 255, 0.9);
  max-width: min(520px, 90vw);
  width: 100%;
}

body.light .profile-modal__content {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 119, 85, 0.35);
  box-shadow: 0 24px 48px -24px rgba(0, 119, 85, 0.7);
}

.profile-modal__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(92, 201, 255, 0.4);
  object-fit: contain;
}

.profile-modal__caption {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: rgba(210, 225, 240, 0.85);
  text-align: center;
}

body.light .profile-modal__caption {
  color: rgba(10, 28, 43, 0.7);
}

.profile-modal__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background: rgba(6, 11, 20, 0.85);
  border: 1px solid rgba(92, 201, 255, 0.6);
  color: var(--accent);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

body.light .profile-modal__close {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 119, 85, 0.3);
  color: #007755;
}

.profile-modal__close:hover,
.profile-modal__close:focus-visible {
  transform: scale(1.05);
  border-color: var(--accent);
}

body.modal-open {
  overflow: hidden;
}

/* Character Profile Note */
.profile-note {
  margin-top: 3rem;
  padding: 1.25rem;
  border: 1px dashed rgba(92, 201, 255, 0.35);
  border-radius: 12px;
  background: rgba(6, 11, 20, 0.55);
  color: rgba(210, 225, 240, 0.85);
  font-size: 0.9rem;
}

body.light .profile-note {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 119, 85, 0.35);
  color: rgba(10, 28, 43, 0.7);
}

.profile-note h2 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

body.light .profile-note h2 {
  color: #007755;
}

.profile-note p {
  margin: 0;
  line-height: 1.5;
}

.profile-note code {
  font-size: 0.85rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  background: rgba(92, 201, 255, 0.12);
  color: var(--accent);
  word-break: break-word;
}

body.light .profile-note code {
  background: rgba(0, 119, 85, 0.12);
  color: #007755;
}
/* ===========================
   Character Profile Enhancements
   =========================== */
.profile-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.16);
  color: rgba(230, 245, 255, 0.9);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-card__stat-label {
  opacity: 0.75;
}

.profile-card__stat-value {
  font-weight: 600;
}

body.light .profile-card__stat {
  background: rgba(0, 119, 85, 0.15);
  color: rgba(10, 28, 43, 0.75);
}

.profile-card__timeline {
  margin: 0.4rem 0 0.8rem;
  padding: 0.45rem 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(92, 201, 255, 0.08);
  border: 1px solid rgba(92, 201, 255, 0.18);
}

body.light .profile-card__timeline {
  background: rgba(0, 119, 85, 0.1);
  border-color: rgba(0, 119, 85, 0.18);
}

.profile-card__timeline-label {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(210, 225, 240, 0.85);
}

body.light .profile-card__timeline-label {
  color: rgba(10, 28, 43, 0.65);
}

.profile-card__timeline-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(92, 201, 255, 0.15);
  overflow: hidden;
}

body.light .profile-card__timeline-track {
  background: rgba(0, 119, 85, 0.18);
}

.profile-card__timeline-progress {
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(92, 201, 255, 0.65), rgba(92, 201, 255, 0.95));
  transition: width 0.3s ease;
}

body.light .profile-card__timeline-progress {
  background: linear-gradient(90deg, rgba(0, 119, 85, 0.6), rgba(0, 119, 85, 0.9));
}

.profile-card__timeline-milestone {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .profile-card__timeline-milestone {
  color: rgba(10, 28, 43, 0.6);
}

.profile-card__relations {
  display: grid;
  gap: 0.5rem;
  margin: 0.8rem 0 0;
}

.profile-card__relation-group {
  display: grid;
  gap: 0.35rem;
}

.profile-card__relation-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(92, 201, 255, 0.8);
}

body.light .profile-card__relation-label {
  color: #007755;
}

.profile-card__relation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.profile-card__relation-link {
  border: 1px solid rgba(92, 201, 255, 0.35);
  background: rgba(92, 201, 255, 0.12);
  color: rgba(230, 245, 255, 0.92);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.profile-card__relation-link:hover,
.profile-card__relation-link:focus-visible {
  border-color: var(--accent);
  background: rgba(92, 201, 255, 0.25);
}

body.light .profile-card__relation-link {
  border-color: rgba(0, 119, 85, 0.35);
  background: rgba(0, 119, 85, 0.12);
  color: rgba(10, 28, 43, 0.75);
}

body.light .profile-card__relation-link:hover,
body.light .profile-card__relation-link:focus-visible {
  border-color: #007755;
  background: rgba(0, 119, 85, 0.2);
}

.profile-card__moment {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.8rem;
  border-left: 3px solid rgba(92, 201, 255, 0.5);
  background: rgba(92, 201, 255, 0.07);
  border-radius: 8px;
  display: grid;
  gap: 0.45rem;
}

body.light .profile-card__moment {
  border-left-color: rgba(0, 119, 85, 0.6);
  background: rgba(0, 119, 85, 0.1);
}

.profile-card__moment-image {
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(92, 201, 255, 0.25);
}

.profile-card__moment-quote {
  margin: 0;
  font-style: italic;
  color: rgba(230, 245, 255, 0.88);
}

body.light .profile-card__moment-quote {
  color: rgba(10, 28, 43, 0.7);
}

.profile-card__moment-meta {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.7);
}

body.light .profile-card__moment-meta {
  color: rgba(10, 28, 43, 0.55);
}

.lore-term {
  position: relative;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  cursor: help;
  text-decoration: underline dotted;
}

body.light .lore-term {
  color: #007755;
}

.lore-term::after {
  content: attr(data-definition);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  min-width: 220px;
  max-width: 260px;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(4, 9, 15, 0.92);
  color: #dcecff;
  box-shadow: 0 12px 28px -12px rgba(92, 201, 255, 0.6);
  font-size: 0.78rem;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 10;
  white-space: normal;
}

body.light .lore-term::after {
  background: rgba(255, 255, 255, 0.95);
  color: rgba(10, 28, 43, 0.78);
  box-shadow: 0 12px 28px -12px rgba(0, 119, 85, 0.45);
}

.lore-term:hover::after,
.lore-term:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.lore-term:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body.light .lore-term:focus-visible {
  outline-color: #007755;
}

.profile-card.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(92, 201, 255, 0.75);
}

body.light .profile-card.is-highlighted {
  border-color: #007755;
  box-shadow: 0 0 20px rgba(0, 119, 85, 0.55);
}

@media (max-width: 540px) {
  .lore-term::after {
    max-width: 200px;
  }
}
/* ===========================
   Lore Index Layout
   =========================== */
.container.lore {
  max-width: 1080px;
}

.lore-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.lore-search {
  position: relative;
  display: flex;
  align-items: center;
}

.lore-search input[type="search"] {
  flex: 1;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(92, 201, 255, 0.25);
  background: rgba(6, 11, 20, 0.85);
  color: #eaf7ff;
  font-size: 1rem;
}

body.light .lore-search input[type="search"] {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 119, 85, 0.25);
  color: #0a1c2b;
}

.lore-search button {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  color: rgba(92, 201, 255, 0.6);
  font-size: 1.1rem;
  cursor: pointer;
}

body.light .lore-search button {
  color: rgba(0, 119, 85, 0.6);
}

.lore-layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(240px, 280px) 1fr;
}

@media (max-width: 920px) {
  .lore-layout {
    grid-template-columns: 1fr;
  }
  .lore-sidebar {
    position: static;
    order: 2;
  }
  .lore-results {
    order: 1;
  }
}

.lore-sidebar {
  position: sticky;
  top: 6rem;
  display: grid;
  gap: 1.5rem;
  align-self: start;
}

.lore-filter {
  background: rgba(6, 11, 20, 0.7);
  border: 1px solid rgba(92, 201, 255, 0.2);
  border-radius: 12px;
  padding: 1.1rem;
  display: grid;
  gap: 0.75rem;
}

body.light .lore-filter {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 119, 85, 0.2);
}

.lore-filter h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(210, 225, 240, 0.8);
}

body.light .lore-filter h2 {
  color: rgba(10, 28, 43, 0.7);
}

.lore-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lore-chips button {
  border: 1px solid rgba(92, 201, 255, 0.3);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(92, 201, 255, 0.15);
  color: rgba(210, 225, 240, 0.85);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.lore-chips button.is-active,
.lore-chips button:hover {
  border-color: var(--accent);
  background: rgba(92, 201, 255, 0.3);
}

body.light .lore-chips button {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(0, 119, 85, 0.12);
  color: rgba(10, 28, 43, 0.7);
}

body.light .lore-chips button.is-active,
body.light .lore-chips button:hover {
  border-color: #007755;
  background: rgba(0, 119, 85, 0.22);
}

.lore-timeline-control {
  display: grid;
  gap: 0.75rem;
}

.lore-timeline-control label {
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-timeline-control label {
  color: rgba(10, 28, 43, 0.6);
}

.lore-timeline-control input[type="range"] {
  width: 100%;
}

.lore-timeline-labels {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: rgba(210, 225, 240, 0.6);
}

.lore-timeline-labels span.is-active {
  color: var(--accent);
}

body.light .lore-timeline-labels span {
  color: rgba(10, 28, 43, 0.5);
}

body.light .lore-timeline-labels span.is-active {
  color: #007755;
}

.lore-legend {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-legend {
  color: rgba(10, 28, 43, 0.6);
}

.legend-icon {
  margin-right: 0.35rem;
}

.lore-sticky-note {
  background: rgba(92, 201, 255, 0.08);
  border-style: dashed;
}

body.light .lore-sticky-note {
  background: rgba(0, 119, 85, 0.08);
}

.lore-results-list {
  display: grid;
  gap: 1.5rem;
}

.lore-empty {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  background: rgba(92, 201, 255, 0.12);
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-empty {
  background: rgba(0, 119, 85, 0.12);
  color: rgba(10, 28, 43, 0.6);
}

/* ===========================
   Lore Cards
   =========================== */
.lore-card {
  background: rgba(6, 11, 20, 0.82);
  border: 1px solid rgba(92, 201, 255, 0.25);
  border-radius: 14px;
  padding: 1.4rem;
  display: grid;
  gap: 0.9rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

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

body.light .lore-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 119, 85, 0.25);
}

.lore-card__header {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.85rem;
}

.lore-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(92, 201, 255, 0.18);
  font-size: 1.6rem;
}

body.light .lore-card__icon {
  background: rgba(0, 119, 85, 0.16);
}

.lore-card__title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent);
}

body.light .lore-card__title {
  color: #007755;
}

.lore-card__summary {
  margin: 0.35rem 0 0;
  color: rgba(210, 225, 240, 0.82);
}

body.light .lore-card__summary {
  color: rgba(10, 28, 43, 0.7);
}

.lore-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.7);
}

body.light .lore-card__meta {
  color: rgba(10, 28, 43, 0.55);
}

.lore-card__meta li {
  background: rgba(92, 201, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

body.light .lore-card__meta li {
  background: rgba(0, 119, 85, 0.12);
}

.lore-card__tags {
  display: flex;
  gap: 0.35rem;
}

.lore-card__tags span {
  background: rgba(92, 201, 255, 0.2);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

body.light .lore-card__tags span {
  background: rgba(0, 119, 85, 0.18);
}

.lore-card__body {
  display: grid;
  gap: 0.75rem;
  border-left: 2px solid rgba(92, 201, 255, 0.25);
  padding-left: 1rem;
}

body.light .lore-card__body {
  border-left-color: rgba(0, 119, 85, 0.25);
}

.lore-card__body section {
  display: grid;
  gap: 0.25rem;
}

.lore-card__body h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(210, 225, 240, 0.78);
}

body.light .lore-card__body h3 {
  color: rgba(10, 28, 43, 0.6);
}

.lore-card__body p {
  margin: 0;
  color: rgba(210, 225, 240, 0.8);
}

body.light .lore-card__body p {
  color: rgba(10, 28, 43, 0.65);
}

.lore-card__toggle {
  justify-self: start;
  border: 1px solid rgba(92, 201, 255, 0.35);
  background: rgba(92, 201, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  cursor: pointer;
}

.lore-card__toggle:hover,
.lore-card__toggle:focus-visible {
  border-color: var(--accent);
}

body.light .lore-card__toggle {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(0, 119, 85, 0.12);
}

body.light .lore-card__toggle:hover,
body.light .lore-card__toggle:focus-visible {
  border-color: #007755;
}

.lore-card__related {
  display: grid;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-card__related {
  color: rgba(10, 28, 43, 0.55);
}

.lore-card__related-row {
  display: grid;
  gap: 0.35rem;
}

.lore-card__related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lore-card__related-links button {
  border: 1px solid rgba(92, 201, 255, 0.35);
  background: rgba(6, 11, 20, 0.6);
  color: rgba(230, 245, 255, 0.85);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.lore-card__related-links button:hover,
.lore-card__related-links button:focus-visible {
  border-color: var(--accent);
}

body.light .lore-card__related-links button {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(10, 28, 43, 0.65);
}

body.light .lore-card__related-links button:hover,
body.light .lore-card__related-links button:focus-visible {
  border-color: #007755;
}

.lore-card__todo {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 196, 64, 0.12);
  border: 1px dashed rgba(255, 196, 64, 0.4);
  color: rgba(255, 210, 110, 0.9);
  font-size: 0.8rem;
}

body.light .lore-card__todo {
  background: rgba(255, 214, 102, 0.15);
  border-color: rgba(255, 170, 40, 0.4);
  color: rgba(160, 110, 0, 0.8);
}

@media (max-width: 540px) {
  .lore-card__header {
    grid-template-columns: 40px 1fr;
  }
  .lore-card__icon {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
}

/* ===========================
   Accessibility helpers
   =========================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* ===========================
   Lore Index Layout
   =========================== */
.container.lore {
  max-width: 1080px;
}

.lore-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.lore-search {
  position: relative;
  display: flex;
  align-items: center;
}

.lore-search input[type="search"] {
  flex: 1;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(92, 201, 255, 0.25);
  background: rgba(6, 11, 20, 0.85);
  color: #eaf7ff;
  font-size: 1rem;
}

body.light .lore-search input[type="search"] {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 119, 85, 0.25);
  color: #0a1c2b;
}

.lore-search button {
  position: absolute;
  right: 0.65rem;
  background: none;
  border: none;
  color: rgba(92, 201, 255, 0.6);
  font-size: 1.1rem;
  cursor: pointer;
}

body.light .lore-search button {
  color: rgba(0, 119, 85, 0.6);
}

.lore-layout {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(240px, 280px) 1fr;
}

@media (max-width: 920px) {
  .lore-layout {
    grid-template-columns: 1fr;
  }
  .lore-sidebar {
    position: static;
    order: 2;
  }
  .lore-results {
    order: 1;
  }
}

.lore-sidebar {
  position: sticky;
  top: 6rem;
  display: grid;
  gap: 1.5rem;
  align-self: start;
}

.lore-filter {
  background: rgba(6, 11, 20, 0.7);
  border: 1px solid rgba(92, 201, 255, 0.2);
  border-radius: 12px;
  padding: 1.1rem;
  display: grid;
  gap: 0.75rem;
}

body.light .lore-filter {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 119, 85, 0.2);
}

.lore-filter h2 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(210, 225, 240, 0.8);
}

body.light .lore-filter h2 {
  color: rgba(10, 28, 43, 0.7);
}

.lore-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lore-chips button {
  border: 1px solid rgba(92, 201, 255, 0.3);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(92, 201, 255, 0.15);
  color: rgba(210, 225, 240, 0.85);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.lore-chips button.is-active,
.lore-chips button:hover {
  border-color: var(--accent);
  background: rgba(92, 201, 255, 0.3);
}

body.light .lore-chips button {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(0, 119, 85, 0.12);
  color: rgba(10, 28, 43, 0.7);
}

body.light .lore-chips button.is-active,
body.light .lore-chips button:hover {
  border-color: #007755;
  background: rgba(0, 119, 85, 0.22);
}

.lore-timeline-control {
  display: grid;
  gap: 0.75rem;
}

.lore-timeline-control label {
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-timeline-control label {
  color: rgba(10, 28, 43, 0.6);
}

.lore-timeline-control input[type="range"] {
  width: 100%;
}

.lore-timeline-labels {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: rgba(210, 225, 240, 0.6);
}

.lore-timeline-labels span.is-active {
  color: var(--accent);
}

body.light .lore-timeline-labels span {
  color: rgba(10, 28, 43, 0.5);
}

body.light .lore-timeline-labels span.is-active {
  color: #007755;
}

.lore-legend {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-legend {
  color: rgba(10, 28, 43, 0.6);
}

.legend-icon {
  margin-right: 0.35rem;
}

.lore-sticky-note {
  background: rgba(92, 201, 255, 0.08);
  border-style: dashed;
}

body.light .lore-sticky-note {
  background: rgba(0, 119, 85, 0.08);
}

.lore-results-list {
  display: grid;
  gap: 1.5rem;
}

.lore-empty {
  margin-top: 2rem;
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  background: rgba(92, 201, 255, 0.12);
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-empty {
  background: rgba(0, 119, 85, 0.12);
  color: rgba(10, 28, 43, 0.6);
}

/* ===========================
   Lore Cards
   =========================== */
.lore-card {
  background: rgba(6, 11, 20, 0.82);
  border: 1px solid rgba(92, 201, 255, 0.25);
  border-radius: 14px;
  padding: 1.4rem;
  display: grid;
  gap: 0.9rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

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

body.light .lore-card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(0, 119, 85, 0.25);
}

.lore-card__header {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.85rem;
}

.lore-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(92, 201, 255, 0.18);
  font-size: 1.6rem;
}

body.light .lore-card__icon {
  background: rgba(0, 119, 85, 0.16);
}

.lore-card__title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--accent);
}

body.light .lore-card__title {
  color: #007755;
}

.lore-card__summary {
  margin: 0.35rem 0 0;
  color: rgba(210, 225, 240, 0.82);
}

body.light .lore-card__summary {
  color: rgba(10, 28, 43, 0.7);
}

.lore-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.7);
}

body.light .lore-card__meta {
  color: rgba(10, 28, 43, 0.55);
}

.lore-card__meta li {
  background: rgba(92, 201, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

body.light .lore-card__meta li {
  background: rgba(0, 119, 85, 0.12);
}

.lore-card__tags {
  display: flex;
  gap: 0.35rem;
}

.lore-card__tags span {
  background: rgba(92, 201, 255, 0.2);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

body.light .lore-card__tags span {
  background: rgba(0, 119, 85, 0.18);
}

.lore-card__body {
  display: grid;
  gap: 0.75rem;
  border-left: 2px solid rgba(92, 201, 255, 0.25);
  padding-left: 1rem;
}

body.light .lore-card__body {
  border-left-color: rgba(0, 119, 85, 0.25);
}

.lore-card__body section {
  display: grid;
  gap: 0.25rem;
}

.lore-card__body h3 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(210, 225, 240, 0.78);
}

body.light .lore-card__body h3 {
  color: rgba(10, 28, 43, 0.6);
}

.lore-card__body p {
  margin: 0;
  color: rgba(210, 225, 240, 0.8);
}

body.light .lore-card__body p {
  color: rgba(10, 28, 43, 0.65);
}

.lore-card__toggle {
  justify-self: start;
  border: 1px solid rgba(92, 201, 255, 0.35);
  background: rgba(92, 201, 255, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  cursor: pointer;
}

.lore-card__toggle:hover,
.lore-card__toggle:focus-visible {
  border-color: var(--accent);
}

body.light .lore-card__toggle {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(0, 119, 85, 0.12);
}

body.light .lore-card__toggle:hover,
body.light .lore-card__toggle:focus-visible {
  border-color: #007755;
}

.lore-card__related {
  display: grid;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: rgba(210, 225, 240, 0.75);
}

body.light .lore-card__related {
  color: rgba(10, 28, 43, 0.55);
}

.lore-card__related-row {
  display: grid;
  gap: 0.35rem;
}

.lore-card__related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lore-card__related-links button {
  border: 1px solid rgba(92, 201, 255, 0.35);
  background: rgba(6, 11, 20, 0.6);
  color: rgba(230, 245, 255, 0.85);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.lore-card__related-links button:hover,
.lore-card__related-links button:focus-visible {
  border-color: var(--accent);
}

body.light .lore-card__related-links button {
  border-color: rgba(0, 119, 85, 0.3);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(10, 28, 43, 0.65);
}

body.light .lore-card__related-links button:hover,
body.light .lore-card__related-links button:focus-visible {
  border-color: #007755;
}

.lore-card__todo {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 196, 64, 0.12);
  border: 1px dashed rgba(255, 196, 64, 0.4);
  color: rgba(255, 210, 110, 0.9);
  font-size: 0.8rem;
}

body.light .lore-card__todo {
  background: rgba(255, 214, 102, 0.15);
  border-color: rgba(255, 170, 40, 0.4);
  color: rgba(160, 110, 0, 0.8);
}

@media (max-width: 540px) {
  .lore-card__header {
    grid-template-columns: 40px 1fr;
  }
  .lore-card__icon {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }
}

/* ===========================
   Accessibility helpers
   =========================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
