/* ═══════════════════════════════════════
   GRIMOIRE — TERRARIA MAGICAL STYLESHEET
   ═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Cinzel:wght@400;600;700&family=IM+Fell+English:ital@0;1&display=swap');

:root {
  --parchment: #f5e6c8;
  --parchment-dark: #e8d4a8;
  --parchment-deep: #d4b87a;
  --ink: #1a0f0a;
  --ink-light: #3d2314;
  --gold: #c9a84c;
  --gold-bright: #f0c040;
  --gold-dim: #7a6030;
  --crimson: #c01818;
  --crimson-bright: #ff2020;
  --teal-magic: #1a6b6b;
  --purple-magic: #4a1a6b;
  --blue-divine: #1a3a8b;
  --green-spirit: #1a6b3a;
  --stone-dark: #0d0a06;
  --stone-mid: #1a1408;
  --stone-light: #2a1e10;
  --ember: #ff6622;
  --ember-glow: rgba(255, 100, 20, 0.4);
  --magic-glow: rgba(150, 80, 255, 0.3);
  --divine-glow: rgba(255, 220, 80, 0.35);
  --shadow-deep: rgba(0,0,0,0.85);
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

body {
  background-color: #020d0f;
  color: var(--parchment);
  font-family: 'IM Fell English', 'Georgia', serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Forest background — fixed so it's always visible ── */
#forestBg {
  position: fixed;
  inset: 0;
  z-index: -10;
  background: url('forest.jpg') center center / cover no-repeat;
  background-color: #020d0f;
}

/* Subtle dark overlay for readability */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -9;
  background: rgba(2, 5, 8, 0.45);
}

/* ── PARTICLES ── */
.particles {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  animation: floatUp linear infinite;
  opacity: 0;
}
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(0) scale(0.5); }
  10%  { opacity: 1; }
  80%  { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-110vh) scale(1.2) rotate(360deg); }
}

/* ── PAGE TURN OVERLAY ── */
.page-turn-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse, #c9a84c44 0%, transparent 70%);
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}
.page-turn-overlay.flash { opacity: 1; }

/* ── HEADER ── */
.grimoire-header {
  position: relative;
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  background: linear-gradient(180deg, rgba(4,1,14,0.82) 0%, rgba(8,2,26,0.78) 40%, rgba(12,1,24,0.72) 100%);
  border-bottom: 2px solid rgba(140,60,200,0.4);
  z-index: 10;
  overflow: hidden;
}
.grimoire-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(80,10,120,0.30) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 50%, rgba(100,0,60,0.14) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 50%, rgba(0,60,100,0.12) 0%, transparent 40%);
  pointer-events: none;
}

.header-border-top,
.header-border-bottom {
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--gold-dim) 0px, var(--gold) 4px, var(--gold-dim) 8px,
    transparent 8px, transparent 16px
  );
}
.header-border-top { top: 0; }
.header-border-bottom { bottom: 0; }

/* ── TORCHES ── */
.torches {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.torch {
  position: absolute;
  top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.torch-left  { left: 40px; }
.torch-right { right: 40px; }

.torch-stick {
  width: 8px;
  height: 40px;
  background: linear-gradient(#6b4020, #3d2010);
  border-radius: 2px;
  margin-top: -4px;
}
.torch-fire {
  width: 18px;
  height: 28px;
  background: radial-gradient(ellipse at 50% 80%, #ff6600, #ffcc00 40%, #ff3300 70%, transparent);
  border-radius: 50% 50% 30% 30%;
  animation: flicker 0.15s infinite alternate;
  filter: blur(1px);
}
@keyframes flicker {
  0%   { transform: scaleX(1) scaleY(1) rotate(-2deg); opacity: 1; }
  25%  { transform: scaleX(0.9) scaleY(1.1) rotate(1deg); opacity: 0.9; }
  50%  { transform: scaleX(1.1) scaleY(0.95) rotate(-1deg); opacity: 1; }
  75%  { transform: scaleX(0.95) scaleY(1.05) rotate(2deg); opacity: 0.85; }
  100% { transform: scaleX(1.05) scaleY(1) rotate(-1deg); opacity: 1; }
}

.rune-row {
  font-size: 1rem;
  letter-spacing: 0.5rem;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
  text-shadow: 0 0 8px var(--gold);
  animation: runePulse 3s ease-in-out infinite;
}
@keyframes runePulse {
  0%, 100% { opacity: 0.6; text-shadow: 0 0 8px var(--gold); }
  50%       { opacity: 1;   text-shadow: 0 0 20px var(--gold-bright), 0 0 40px var(--gold); }
}

/* ── Tree of Life glyph in rune rows ── */
.rune-tree-of-life {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin: 0 0.35rem;
  color: var(--gold);
  filter:
    drop-shadow(0 0 6px rgba(200,160,40,0.9))
    drop-shadow(0 0 18px rgba(180,130,20,0.6));
  animation: treeGlow 3s ease-in-out infinite;
}
.rune-tree-of-life svg {
  width: 1.5em;
  height: 1.8em;
}
@keyframes treeGlow {
  0%, 100% {
    filter:
      drop-shadow(0 0 5px rgba(200,160,40,0.8))
      drop-shadow(0 0 14px rgba(180,130,20,0.5));
  }
  50% {
    filter:
      drop-shadow(0 0 10px rgba(240,200,60,1))
      drop-shadow(0 0 28px rgba(220,170,30,0.8))
      drop-shadow(0 0 50px rgba(180,120,10,0.4));
  }
}

.grimoire-title {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(2rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.22em;
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

/* ── ENCHIRIDION — magical title treatment ── */
.enchiridion-text {
  display: inline-block;
  background: linear-gradient(
    180deg,
    #fffbe8 0%,
    #f7d96a 18%,
    #f0c040 40%,
    #e8a820 62%,
    #f7d96a 80%,
    #fffbe8 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter:
    drop-shadow(0 0 12px rgba(255, 210, 60, 0.95))
    drop-shadow(0 0 35px rgba(220, 150, 20, 0.75))
    drop-shadow(0 0 80px rgba(180, 100, 10, 0.45))
    drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.85));
  animation: enchiridionGlow 4s ease-in-out infinite;
  background-size: 100% 200%;
  background-position: 0% 0%;
}
@keyframes enchiridionGlow {
  0%, 100% {
    filter:
      drop-shadow(0 0 10px rgba(255, 210, 60, 0.85))
      drop-shadow(0 0 30px rgba(220, 150, 20, 0.60))
      drop-shadow(0 0 70px rgba(180, 100, 10, 0.35))
      drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.85));
    background-position: 0% 0%;
  }
  50% {
    filter:
      drop-shadow(0 0 22px rgba(255, 230, 90, 1))
      drop-shadow(0 0 55px rgba(240, 180, 30, 0.90))
      drop-shadow(0 0 120px rgba(200, 120, 10, 0.55))
      drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.85));
    background-position: 0% 100%;
  }
}

.subtitle-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.scroll-decoration {
  color: var(--gold-dim);
  font-size: 1.2rem;
}
.subtitle-text {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.65rem, 1.8vw, 1rem);
  color: var(--parchment-dark);
  letter-spacing: 0.08em;
  font-style: italic;
}
.header-tagline {
  font-size: clamp(0.7rem, 1.5vw, 0.9rem);
  color: var(--gold-dim);
  letter-spacing: 0.12em;
  margin-top: 0.4rem;
}

/* ── INSTAGRAM LINK ── */
.header-instagram {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.65rem;
  color: rgba(200, 160, 255, 0.65);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}
.header-instagram:hover {
  color: rgba(230, 190, 255, 1);
  text-shadow: 0 0 12px rgba(180, 100, 255, 0.5);
}
.ig-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: inherit;
}
@media (max-width: 700px) {
  .header-instagram { font-size: 0.65rem; margin-top: 0.5rem; }
  .ig-icon { width: 13px; height: 13px; }
}

/* ── SEARCH BAR ── */
.search-bar-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, #04010edd 0%, #080218dd 100%);
  border-bottom: 1px solid rgba(140,60,200,0.35);
  padding: 0.75rem 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.6), 0 0 40px rgba(80,0,120,0.15);
}
.search-container {
  display: flex;
  align-items: center;
  max-width: 700px;
  margin: 0 auto 0.75rem;
  background: rgba(80,20,120,0.12);
  border: 1.5px solid rgba(140,80,200,0.40);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  gap: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-container:focus-within {
  border-color: rgba(180,100,255,0.65);
  box-shadow: 0 0 16px rgba(160,80,255,0.3);
}
.search-icon { font-size: 1.1rem; flex-shrink: 0; }
#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--parchment);
  font-family: 'IM Fell English', serif;
  font-size: 1rem;
  font-style: italic;
}
#searchInput::placeholder { color: var(--parchment-deep); opacity: 0.6; }
.search-clear {
  background: none;
  border: none;
  color: var(--gold-dim);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.25rem;
  transition: color 0.2s;
}
.search-clear:hover { color: var(--crimson-bright); }

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}
.filter-btn {
  background: rgba(80,20,120,0.15);
  border: 1px solid rgba(140,80,200,0.30);
  color: rgba(200,170,240,0.75);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  background: rgba(120,40,180,0.25);
  border-color: rgba(180,100,255,0.55);
  color: rgba(220,190,255,1);
}
.filter-btn.active {
  background: rgba(140,40,200,0.30);
  border-color: rgba(200,120,255,0.65);
  color: #e0c8ff;
  box-shadow: 0 0 12px rgba(160,80,255,0.25);
}

/* ── MAIN GRID ── */
.grimoire-main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ── CREATURE CARD ── */
/* ── CREATURE CARDS — Ancient book page style ── */
@keyframes iridBorder {
  0%   { border-color: rgba(140,60,200,0.55); box-shadow: 0 0 18px rgba(120,40,180,0.25), 0 4px 20px rgba(0,0,0,0.7), inset 0 0 30px rgba(60,0,80,0.12); }
  25%  { border-color: rgba(0,160,140,0.45);  box-shadow: 0 0 18px rgba(0,140,120,0.20), 0 4px 20px rgba(0,0,0,0.7), inset 0 0 30px rgba(0,40,30,0.10); }
  50%  { border-color: rgba(180,60,100,0.50); box-shadow: 0 0 18px rgba(160,40,80,0.22), 0 4px 20px rgba(0,0,0,0.7), inset 0 0 30px rgba(60,0,20,0.12); }
  75%  { border-color: rgba(60,100,200,0.45); box-shadow: 0 0 18px rgba(40,80,180,0.20), 0 4px 20px rgba(0,0,0,0.7), inset 0 0 30px rgba(0,10,50,0.10); }
  100% { border-color: rgba(140,60,200,0.55); box-shadow: 0 0 18px rgba(120,40,180,0.25), 0 4px 20px rgba(0,0,0,0.7), inset 0 0 30px rgba(60,0,80,0.12); }
}

.creature-card {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(100,50,160,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 0% 100%, rgba(0,80,60,0.12) 0%, transparent 45%),
    linear-gradient(170deg, rgba(18,8,30,0.97) 0%, rgba(10,4,20,0.98) 50%, rgba(14,6,18,0.97) 100%);
  border: 1px solid rgba(140,60,200,0.55);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  transition: transform 0.25s;
  overflow: hidden;
  animation: cardReveal 0.4s ease-out both, iridBorder 8s ease-in-out infinite;
}
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.creature-card:hover {
  transform: translateY(-3px) rotate(0.3deg);
  box-shadow:
    0 8px 28px rgba(0,0,0,0.65),
    inset 0 0 0 4px rgba(154,120,64,0.25),
    inset 0 0 0 5px rgba(240,220,160,0.1);
}

/* Category color accents */
.creature-card[data-category="angel"]     { --accent: #5577aa; }
.creature-card[data-category="demon"]     { --accent: #c01818; }
.creature-card[data-category="beast"]     { --accent: #3a6622; }
.creature-card[data-category="spirit"]    { --accent: #6644aa; }
.creature-card[data-category="undead"]    { --accent: #225555; }
.creature-card[data-category="elemental"] { --accent: #885511; }
.creature-card[data-category="divine"]    { --accent: #886600; }
.creature-card[data-category="entheogen"] { --accent: #226644; }

/* Inner border — woodcut frame */
.card-page-border {
  position: relative;
  margin: 8px;
  border: 1px solid rgba(140,80,200,0.25);
  padding: 0.9rem 0.9rem 0;
  min-height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
}
.card-page-border::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(100,60,160,0.12);
  pointer-events: none;
}

/* Illuminated illustration plate at top */
.card-illumination {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.7rem;
  border: 1px solid rgba(140,80,200,0.35);
  background: rgba(20,5,35,0.35);
  image-rendering: pixelated;
  overflow: hidden;
  flex-shrink: 0;
}
.card-illumination canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Chapter/category stamp */
.card-chapter-stamp {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent, #aa88cc);
  text-align: center;
  margin-bottom: 0.25rem;
  opacity: 0.9;
}

/* Tier ribbon */
.card-tier-ribbon {
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0.1rem 0;
  margin-bottom: 0.5rem;
  border-top: 1px solid rgba(140,80,200,0.20);
  border-bottom: 1px solid rgba(140,80,200,0.20);
  opacity: 0.9;
}
.card-tier-ribbon.tier-badge-1 { color: #88aaff; }
.card-tier-ribbon.tier-badge-2 { color: #cc88ff; }
.card-tier-ribbon.tier-badge-3 { color: #ff4444; }

.card-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.9rem, 2.2vw, 1.2rem);
  font-weight: 700;
  color: #e8d4a0;
  text-align: center;
  margin-bottom: 0.2rem;
  line-height: 1.2;
  text-shadow: 0 0 12px rgba(180,130,60,0.4);
}

.card-origin {
  font-family: 'IM Fell English', serif;
  font-size: 0.75rem;
  color: rgba(180,150,100,0.75);
  font-style: italic;
  text-align: center;
  margin-bottom: 0.4rem;
}

.card-rule {
  font-family: 'IM Fell English', serif;
  text-align: center;
  color: rgba(180,130,220,0.45);
  font-size: 0.75rem;
  margin-bottom: 0.4rem;
  letter-spacing: 0.1em;
}

.card-excerpt {
  font-family: 'IM Fell English', serif;
  font-size: 0.82rem;
  color: #c8b890;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 0.6rem;
  margin-top: 0.5rem;
  border-top: 1px solid rgba(140,80,200,0.22);
}
.card-read-more {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent, #aa88cc);
  opacity: 0.7;
  transition: opacity 0.2s;
}
.creature-card:hover .card-read-more { opacity: 1; }
.card-danger-ink {
  font-family: 'IM Fell English', serif;
  font-size: 0.7rem;
  font-style: italic;
  color: #ff6666;
  opacity: 0.85;
}

/* ── TIER SECTION BREAKS ── */
.tier-section-break {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  margin-top: 1rem;
}
.tier-break-ornament {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.4em;
  color: rgba(201,168,76,0.35);
  margin-bottom: 0.8rem;
}
.tier-break-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(0.9rem, 2vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}
.tier-break-sub {
  font-family: 'IM Fell English', serif;
  font-size: 0.8rem;
  font-style: italic;
  opacity: 0.7;
  max-width: 480px;
  margin: 0 auto 0.8rem;
  line-height: 1.5;
}
.tier-break-rule {
  height: 1px;
  max-width: 320px;
  margin: 0 auto;
}

/* Tier I break — silver-blue */
.tier-break-1 .tier-break-title { color: #8aabcc; }
.tier-break-1 .tier-break-sub   { color: #aac0d8; }
.tier-break-1 .tier-break-rule  { background: linear-gradient(90deg, transparent, #8aabcc44, transparent); }

/* Tier II break — purple */
.tier-break-2 .tier-break-title { color: #aa77cc; }
.tier-break-2 .tier-break-sub   { color: #bb99dd; }
.tier-break-2 .tier-break-rule  { background: linear-gradient(90deg, transparent, #aa77cc44, transparent); }

/* Tier III break — blood red, ominous */
.tier-break-3 {
  padding-top: 3rem;
  position: relative;
}
.tier-break-3::before {
  content: '';
  display: block;
  height: 2px;
  max-width: 600px;
  margin: 0 auto 2rem;
  background: linear-gradient(90deg, transparent, #c0181888, #c01818, #c0181888, transparent);
}
.tier-break-3 .tier-break-ornament { color: rgba(220,25,20,0.5); }
.tier-break-3 .tier-break-title {
  color: #cc3322;
  text-shadow: 0 0 20px rgba(180,20,10,0.4);
  animation: abyssGlow 3s ease-in-out infinite;
}
.tier-break-3 .tier-break-sub   { color: #cc6655; }
.tier-break-3 .tier-break-rule  { background: linear-gradient(90deg, transparent, #c0181866, transparent); }

/* ── NO RESULTS ── */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--parchment-deep);
  font-style: italic;
}
.no-results-icon { font-size: 3rem; margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(4px);
  animation: fadeInOverlay 0.25s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-book {
  position: relative;
  width: 100%;
  max-width: 780px;
  background:
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #f5e6c8 0%, #e8d4a8 30%, #dfc89a 60%, #d4b87a 100%);
  border: 3px solid var(--gold);
  border-radius: 4px;
  box-shadow:
    0 0 60px rgba(0,0,0,0.9),
    0 0 30px rgba(201,168,76,0.2),
    inset 0 0 80px rgba(180,140,60,0.1);
  color: var(--ink);
  animation: bookOpen 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
}
@keyframes bookOpen {
  from { opacity: 0; transform: scale(0.88) rotateX(6deg); }
  to   { opacity: 1; transform: scale(1) rotateX(0deg); }
}

/* Aged paper texture lines */
.modal-book::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 28px,
    rgba(180,140,60,0.08) 28px,
    rgba(180,140,60,0.08) 29px
  );
  pointer-events: none;
  border-radius: 2px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--ink);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
  z-index: 10;
}
.modal-close:hover {
  background: var(--crimson);
  border-color: var(--crimson-bright);
  color: var(--parchment);
}

.modal-header-row {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 2rem 2rem 1rem;
}

.modal-glyph {
  font-size: 4.5rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}

.modal-title-block { flex: 1; }

.modal-category-tag {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--crimson);
  border: 1px solid var(--crimson);
  padding: 0.1rem 0.5rem;
  margin-bottom: 0.4rem;
}

.modal-creature-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 0.3rem;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.3);
}

.modal-origin {
  font-size: 0.85rem;
  color: var(--ink-light);
  font-style: italic;
}

.modal-divider {
  text-align: center;
  color: var(--gold-dim);
  font-size: 0.9rem;
  letter-spacing: 0.5rem;
  padding: 0.25rem 0;
  border-top: 1px solid rgba(100,70,20,0.3);
  border-bottom: 1px solid rgba(100,70,20,0.3);
  margin: 0 2rem 0;
}

.modal-body {
  padding: 1.5rem 2rem 2rem;
}

.modal-section {
  margin-bottom: 1.4rem;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--crimson);
  border-bottom: 1px solid rgba(139,26,26,0.3);
  padding-bottom: 0.3rem;
  margin-bottom: 0.6rem;
}

.modal-section p,
.modal-section li {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--ink);
}

.power-list, .sightings-list {
  list-style: none;
  padding: 0;
}
.power-list li {
  padding: 0.2rem 0 0.2rem 1.4rem;
  position: relative;
}
.power-list li::before {
  content: '-';
  position: absolute;
  left: 0;
  color: var(--crimson);
  font-size: 0.7rem;
  top: 0.35rem;
}
.sightings-list li {
  padding: 0.3rem 0 0.3rem 1.4rem;
  position: relative;
  border-bottom: 1px dashed rgba(100,70,20,0.2);
  font-style: italic;
}
.sightings-list li::before {
  content: '👁';
  position: absolute;
  left: 0;
  font-size: 0.75rem;
  top: 0.35rem;
}
.sightings-list li:last-child { border-bottom: none; }

.modal-lore-footer {
  margin-top: 1.5rem;
  padding: 0.75rem 1rem;
  background: rgba(100,70,20,0.08);
  border: 1px solid rgba(100,70,20,0.2);
  border-left: 3px solid var(--gold-dim);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-light);
  line-height: 1.6;
}

/* ── FOOTER ── */
.grimoire-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem 1rem;
  border-top: 3px solid var(--gold-dim);
  background: linear-gradient(0deg, #0d0a06 0%, #1a1408 100%);
}
.footer-runes {
  font-size: 0.9rem;
  letter-spacing: 0.35rem;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
  opacity: 0.6;
}
.footer-text {
  font-size: 0.82rem;
  color: var(--parchment-deep);
  font-style: italic;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}
.footer-text.small {
  font-size: 0.7rem;
  color: var(--crimson);
  opacity: 0.6;
  letter-spacing: 0.05em;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--stone-dark); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .grimoire-header { padding: 2rem 1rem 1.5rem; }
  .torch { display: none; }
  .modal-header-row { flex-direction: column; gap: 0.75rem; }
  .modal-glyph { font-size: 3rem; }
  .modal-body, .modal-header-row { padding: 1rem; }
  .modal-divider { margin: 0 1rem; }
  .modal-book { margin: 0; }
  .entries-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   INTRO OVERLAY STYLES
═══════════════════════════════════════════ */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #02010d url('IMG_8781.jpeg') center center / cover no-repeat;
  overflow: hidden;
  cursor: pointer;
}

/* Dark veil over intro photo so canvas animations stay readable */
.intro-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(1, 0, 8, 0.30);
  z-index: 0;
  pointer-events: none;
}

.intro-overlay.intro-fade-out {
  animation: introFadeOut 1.2s ease-out forwards;
}
@keyframes introFadeOut {
  to { opacity: 0; transform: scale(1.04); }
}

#introCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ── HTML torches on intro edges ── */
.intro-torch {
  position: absolute;
  top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}
.intro-torch-left  { left: 32px; }
.intro-torch-right { right: 32px; }

.torch-fire-big {
  width: 28px;
  height: 44px;
  background: radial-gradient(ellipse at 50% 80%, #ff6600, #ffcc00 35%, #ff3300 65%, transparent);
  border-radius: 50% 50% 30% 30%;
  animation: flicker 0.12s infinite alternate;
  filter: blur(1px);
}
.torch-stick-big {
  width: 10px;
  height: 52px;
  background: linear-gradient(#7b4522, #3d2010);
  border-radius: 3px;
  margin-top: -6px;
}

/* ── Click prompt ── */
.intro-click-prompt {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.5s;
  text-align: center;
  padding: 2rem;
}

.prompt-book {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: #cc3322;
  margin-bottom: 1.5rem;
  animation: promptBob 2.5s ease-in-out infinite;
  text-shadow: 0 0 20px rgba(180,20,10,0.9), 0 0 40px rgba(180,20,10,0.4);
  letter-spacing: 0.3em;
}
@keyframes promptBob {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.7; }
  50%       { transform: translateY(-8px) scale(1.06); opacity: 1; }
}

.prompt-main {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  color: var(--gold-bright);
  letter-spacing: 0.2em;
  text-shadow: 0 0 30px var(--gold), 0 0 60px rgba(200,160,40,0.5);
  margin-bottom: 0.75rem;
  animation: mainPulse 3s ease-in-out infinite;
}
@keyframes mainPulse {
  0%, 100% { text-shadow: 0 0 20px var(--gold); }
  50%       { text-shadow: 0 0 40px var(--gold-bright), 0 0 80px rgba(200,160,40,0.5), 0 0 120px rgba(180,20,10,0.15); }
}

.prompt-sub {
  font-family: 'IM Fell English', serif;
  font-size: clamp(0.8rem, 2vw, 1.1rem);
  color: #cc9988;
  font-style: italic;
  opacity: 0.8;
  margin-bottom: 1.5rem;
}

.prompt-runes {
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  letter-spacing: 0.5rem;
  color: var(--gold-dim);
  opacity: 0.55;
  animation: runePulse 3s ease-in-out infinite;
}

/* ── Title area ── */
.hidden-intro {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(12px) !important;
}

.intro-title-area {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 3.5rem;
  z-index: 20;
  background: linear-gradient(0deg, rgba(2,1,13,0.96) 0%, rgba(2,1,13,0.7) 60%, transparent 100%);
  transition: opacity 0.5s, transform 0.5s;
}

.intro-rune-row {
  font-size: 0.9rem;
  letter-spacing: 0.5rem;
  color: var(--gold-dim);
  margin-bottom: 0.75rem;
  animation: runePulse 3s ease-in-out infinite;
}

.intro-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.8rem, 5.5vw, 4rem);
  font-weight: 900;
  color: var(--gold-bright);
  text-shadow:
    0 0 30px var(--gold),
    0 0 80px rgba(200,160,40,0.5),
    3px 3px 0 rgba(0,0,0,0.8);
  letter-spacing: 0.12em;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}
.intro-title::after {
  content: '|';
  animation: blink 0.7s step-end infinite;
  color: var(--gold);
  margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.intro-subtitle {
  font-family: 'IM Fell English', serif;
  font-size: clamp(0.7rem, 1.8vw, 0.95rem);
  color: #cc9977;
  font-style: italic;
  opacity: 0;
  margin-bottom: 2rem;
  transition: opacity 1.2s;
  text-align: center;
  line-height: 1.7;
  max-width: 440px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  white-space: pre-line;
}

.enter-btn {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.75rem, 1.8vw, 1rem);
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #f0d890;
  background: transparent;
  border: 1px solid rgba(180,130,40,0.6);
  border-top-color: rgba(200,160,60,0.8);
  padding: 0.85rem 2.8rem;
  cursor: pointer;
  transition: all 0.4s, opacity 0.6s, transform 0.6s;
  box-shadow:
    0 0 18px rgba(180,20,10,0.2),
    inset 0 0 20px rgba(0,0,0,0.4);
  text-transform: uppercase;
  position: relative;
}
.enter-btn::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(180,130,40,0.2);
  pointer-events: none;
}
.enter-btn:hover {
  color: #fff8d0;
  border-color: rgba(200,160,60,0.9);
  box-shadow: 0 0 30px rgba(200,140,20,0.35), 0 0 60px rgba(180,20,10,0.2);
  transform: translateY(-1px);
  background: rgba(180,130,30,0.08);
}
.enter-btn:not(.hidden-intro) {
  animation: btnReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes btnReveal {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════
   TIER SYSTEM
═══════════════════════════════════════════ */

.tier-legend-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
  background: rgba(20,5,40,0.65);
  border-bottom: 1px solid rgba(120,60,180,0.30);
}
.tier-legend-item {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}
.tier-legend-sep { color: rgba(180,130,220,0.5); opacity: 0.6; }

/* Tier badge on cards */
.card-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  margin-left: 0.4rem;
  vertical-align: middle;
  border: 1px solid currentColor;
}

/* Tier 1 — Surface Realm — silver/white */
.tier-1-badge, .tier-badge-1 {
  color: #c8d8f0;
  border-color: #8899bb;
  background: rgba(100,130,200,0.1);
}
/* Tier 2 — The Depths — purple/teal */
.tier-2-badge, .tier-badge-2 {
  color: #cc88ff;
  border-color: #8844bb;
  background: rgba(140,60,200,0.12);
}
/* Tier 3 — The Abyss — blood red */
.tier-3-badge, .tier-badge-3 {
  color: #ff6644;
  border-color: #cc3322;
  background: rgba(200,40,20,0.14);
  animation: abyssGlow 2.5s ease-in-out infinite;
}
@keyframes abyssGlow {
  0%,100% { box-shadow: none; }
  50%      { box-shadow: 0 0 8px rgba(200,40,20,0.5); }
}

/* Modal tier badge */
.modal-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.modal-tier-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  border: 1px solid currentColor;
}

/* ── Pixel sprite canvas on cards ── */
.card-sprite-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Modal sprite */
.modal-sprite-canvas-wrap {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border: 2px solid rgba(139,26,26,0.4);
  border-radius: 3px;
  background: rgba(20,10,5,0.5);
  overflow: hidden;
  image-rendering: pixelated;
}
.modal-sprite-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  width: 72px !important;
  height: 72px !important;
}

/* Tier-3 cards — bloodstained page edge */
.creature-card[data-tier="3"] {
  border-color: #7a2020;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.5),
    inset 0 0 0 4px rgba(220,25,20,0.12);
}
.creature-card[data-tier="3"]:hover {
  box-shadow:
    0 8px 28px rgba(0,0,0,0.65),
    inset 0 0 0 4px rgba(220,25,20,0.2);
}
.creature-card[data-tier="3"] .card-page-border {
  border-color: rgba(220,25,20,0.35);
}
.creature-card[data-tier="3"] .card-name {
  color: #ff8866;
  text-shadow: 0 0 14px rgba(220,60,30,0.5);
}

/* ══════════════════════════════════════════
   MUSHROOM / BIOLUMINESCENT AESTHETIC LAYER
═══════════════════════════════════════════ */

/* Fairy ambient glow — warm scattered light */
@keyframes fairyPulse {
  0%, 100% { opacity: 0.80; }
  50%       { opacity: 1.0; }
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  animation: fairyPulse 9s ease-in-out infinite;
  background:
    /* warm orange orbs — like the ones in the image */
    radial-gradient(ellipse at 18% 38%, rgba(255,160,40,0.22)  0%, transparent 12%),
    radial-gradient(ellipse at 72% 28%, rgba(255,180,60,0.18)  0%, transparent 10%),
    radial-gradient(ellipse at 48% 62%, rgba(255,200,80,0.15)  0%, transparent 10%),
    /* cyan/teal fairy glows */
    radial-gradient(ellipse at 28% 68%, rgba(60,220,255,0.20)  0%, transparent 12%),
    radial-gradient(ellipse at 80% 60%, rgba(40,200,240,0.18)  0%, transparent 11%),
    /* pink/magenta fairy glows */
    radial-gradient(ellipse at 12% 52%, rgba(255,80,200,0.16)  0%, transparent 10%),
    radial-gradient(ellipse at 88% 42%, rgba(220,60,180,0.14)  0%, transparent 10%),
    /* lime green ground glow */
    radial-gradient(ellipse at 40% 82%, rgba(80,255,120,0.18)  0%, transparent 14%),
    radial-gradient(ellipse at 65% 78%, rgba(60,240,100,0.16)  0%, transparent 12%);
}

/* Fairy lights canvas layer */
#fairyCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Entheogen category — greenish-aged page */
.creature-card[data-category="entheogen"] {
  --accent: #226644;
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #eae8d0 0%, #ddd8a8 30%, #d4ce90 60%, #ccc280 100%);
}

/* ══════════════════════════════════════════
   OLD BOOK MODAL LAYOUT
═══════════════════════════════════════════ */

/* Override the plain parchment with a more aged, textured look */
.modal-book {
  background:
    /* foxing spots */
    radial-gradient(circle at 12% 88%, rgba(140,100,40,0.12) 0%, transparent 8%),
    radial-gradient(circle at 88% 12%, rgba(140,100,40,0.10) 0%, transparent 6%),
    radial-gradient(circle at 55% 55%, rgba(140,100,40,0.06) 0%, transparent 12%),
    /* ruled lines */
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(160,120,50,0.09) 27px,
      rgba(160,120,50,0.09) 28px
    ),
    /* parchment base */
    linear-gradient(170deg, #f7ead4 0%, #eddcb0 35%, #e5cfa0 65%, #d8bf8a 100%);
  font-family: 'IM Fell English', 'Georgia', serif;
  border: none;
  border-left:  6px solid #7a5020;
  border-right: 6px solid #7a5020;
  border-top:   3px solid #a07030;
  border-bottom: 3px solid #a07030;
  box-shadow:
    0 0 0 1px #c8a050,
    0 0 80px rgba(0,0,0,0.95),
    inset 4px 0 20px rgba(120,80,20,0.15),
    inset -4px 0 20px rgba(120,80,20,0.15);
  max-width: 860px;
}

/* Folio header — running title */
/* ── CREATURE PHOTO ──────────────────────────── */
.book-creature-photo-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  background: #0a0604;
  border-bottom: 2px solid #3a2008;
}
.book-creature-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: sepia(55%) contrast(115%) brightness(72%) saturate(75%);
  display: block;
  transition: filter 0.4s ease;
}
.book-creature-photo-wrap:hover .book-creature-photo {
  filter: sepia(35%) contrast(110%) brightness(82%) saturate(90%);
}
.book-photo-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(5,3,1,0.7) 100%),
    linear-gradient(to bottom, rgba(5,3,1,0.5) 0%, transparent 25%, transparent 70%, rgba(5,3,1,0.9) 100%);
  pointer-events: none;
}
.book-photo-caption {
  position: absolute;
  bottom: 0.5rem;
  right: 1rem;
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.65rem;
  color: rgba(210,180,120,0.6);
  letter-spacing: 0.03em;
  pointer-events: none;
}

.book-folio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 2rem 0;
  border-bottom: 1px solid rgba(100,70,20,0.3);
  margin-bottom: 0.25rem;
}
.folio-left, .folio-right {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(80,50,15,0.55);
}
.folio-ornament {
  color: rgba(100,70,20,0.4);
  font-size: 1rem;
}

/* Title block */
.book-title-block {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1rem 2rem 0.75rem;
}
.book-title-centre { flex: 1; }

.modal-creature-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  color: #2a1508;
  line-height: 1.1;
  margin-bottom: 0.3rem;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.4);
}
.modal-origin {
  font-size: 0.82rem;
  color: #5a3818;
  font-style: italic;
  margin-bottom: 0.3rem;
}
.book-danger {
  font-size: 0.78rem;
  color: #c01818;
  letter-spacing: 0.05em;
}

/* Chapter rule */
.book-chapter-rule {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 2rem;
  margin: 0.25rem 0 0.75rem;
}
.rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #a07030, #c8a050, #a07030, transparent);
}
.rule-ornament { color: #a07030; font-size: 0.7rem; }

/* Two-column layout */
.book-columns {
  display: flex;
  gap: 0;
  padding: 0 0 1rem;
}
.book-main-col {
  flex: 1;
  padding: 0 1.5rem 1rem 2rem;
  border-right: 1px solid rgba(100,70,20,0.2);
  min-width: 0;
}
.book-margin-col {
  width: 160px;
  flex-shrink: 0;
  padding: 0.5rem 1.25rem 1rem 1rem;
  position: relative;
}

/* Section headings — Latin + English */
.book-section {
  margin-bottom: 1.2rem;
}
.book-section-head {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(100,70,20,0.25);
}
.section-latin {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c01818;
  font-style: normal;
}
.section-english {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #4a2810;
  margin-top: 0.05rem;
}

/* Book prose */
.book-prose {
  font-size: 0.9rem;
  line-height: 1.75;
  color: #1e1005;
  text-align: justify;
  hyphens: auto;
}

/* Drop cap on description */
.drop-cap::first-letter {
  font-family: 'Cinzel Decorative', serif;
  font-size: 3.2em;
  float: left;
  line-height: 0.75;
  margin: 0.06em 0.1em 0 0;
  color: #c01818;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}

/* Mystery prose — slightly different ink colour */
.mystery-prose { color: #2a1a08; font-style: italic; }

/* Ornament dividers */
.book-ornament-divider {
  text-align: center;
  color: rgba(100,70,20,0.45);
  font-size: 1rem;
  letter-spacing: 0.4rem;
  margin: 0.5rem 0;
}

/* Powers list */
.book-power-list {
  list-style: none;
  padding: 0;
}
.book-power-list li {
  font-size: 0.87rem;
  line-height: 1.6;
  color: #1e1005;
  padding: 0.15rem 0 0.15rem 1.4rem;
  position: relative;
  border-bottom: 1px dotted rgba(100,70,20,0.2);
}
.book-power-list li::before {
  content: '-';
  position: absolute;
  left: 0;
  color: #c01818;
  font-size: 0.6rem;
  top: 0.45rem;
}
.book-power-list li:last-child { border-bottom: none; }

/* Sightings list */
.book-sightings-list {
  list-style: none;
  padding: 0;
}
.book-sightings-list li {
  font-size: 0.85rem;
  line-height: 1.65;
  color: #2a1508;
  padding: 0.35rem 0 0.35rem 1.6rem;
  position: relative;
  font-style: italic;
  border-bottom: 1px dashed rgba(100,70,20,0.18);
}
.book-sightings-list li::before {
  content: '◈';
  position: absolute;
  left: 0;
  color: #c01818;
  font-size: 0.7rem;
  top: 0.45rem;
  font-style: normal;
}
.book-sightings-list li:last-child { border-bottom: none; }

/* Lore footer — the closing quote */
.book-lore-footer {
  margin-top: 1.2rem;
  padding: 0.75rem 1rem;
  background: rgba(100,70,20,0.07);
  border-left: 3px solid #a07030;
  border-top: 1px solid rgba(100,70,20,0.2);
  border-bottom: 1px solid rgba(100,70,20,0.2);
  font-size: 0.83rem;
  font-style: italic;
  color: #3a2010;
  line-height: 1.65;
}

/* ── MARGINALIA ── */
.marginalia-label {
  font-family: 'Cinzel', serif;
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(100,70,20,0.4);
  margin-bottom: 0.75rem;
  text-align: center;
  border-bottom: 1px solid rgba(100,70,20,0.2);
  padding-bottom: 0.3rem;
}
.marginalia-text {
  font-size: 0.72rem;
  line-height: 1.65;
  color: #5a3818;
  font-style: italic;
  font-family: 'IM Fell English', serif;
  /* Slightly rotated feel — authentic margin note look */
  transform: rotate(-0.4deg);
  transform-origin: top left;
  border-left: 1px solid rgba(100,70,20,0.2);
  padding-left: 0.5rem;
  margin-bottom: 1.2rem;
}
.marginalia-glyph {
  font-size: 2.5rem;
  text-align: center;
  margin: 0.75rem 0;
  opacity: 0.6;
  filter: sepia(0.6);
}
.marginalia-danger-note {
  font-size: 0.65rem;
  color: #c01818;
  font-style: italic;
  line-height: 1.5;
  font-family: 'IM Fell English', serif;
  padding: 0.4rem 0.4rem;
  border: 1px solid rgba(139,26,26,0.25);
  border-radius: 2px;
  background: rgba(139,26,26,0.04);
  margin-top: 0.5rem;
  display: none;
}
.marginalia-danger-note.visible { display: block; }

/* Page number */
.book-page-num {
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: rgba(100,70,20,0.4);
  padding: 0.4rem 0 0.6rem;
  border-top: 1px solid rgba(100,70,20,0.2);
  margin: 0 2rem;
}

/* Responsive: collapse marginalia on small screens */
@media (max-width: 680px) {
  .book-columns { flex-direction: column; }
  .book-margin-col {
    width: 100%;
    border-top: 1px dashed rgba(100,70,20,0.3);
    border-right: none;
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }
  .book-main-col { padding: 0 1rem 1rem; border-right: none; }
  .book-title-block { flex-direction: column; gap: 0.5rem; padding: 1rem 1rem 0.5rem; }
  .book-folio { padding: 0.4rem 1rem 0; }
  .book-chapter-rule { padding: 0 1rem; }
  .book-page-num { margin: 0 1rem; }
  .drop-cap::first-letter { font-size: 2.5em; }
}

/* Hide old modal elements we replaced */
.modal-header-row { display: none !important; }
.modal-divider    { display: none !important; }
.modal-body       { display: none !important; }

/* ═══════════════════════════════════════════════
   NORSE OVERHAUL — Photo, Chapter Nav, Design
   ═══════════════════════════════════════════════ */

/* ── Fix photo centering ── */
.book-creature-photo {
  object-position: center center;
  height: 100%;
}
.book-creature-photo-wrap {
  height: 360px;
}

/* ── Norse header border upgrade ── */
.header-border-top,
.header-border-bottom {
  height: 8px;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 6px,
      var(--gold-dim) 6px,
      var(--gold) 10px,
      var(--gold-dim) 14px,
      transparent 14px,
      transparent 20px
    );
}

/* Norse knotwork accent line under header title */
.subtitle-scroll::before,
.subtitle-scroll::after {
  content: ' ᚠ ᚢ ᚦ ᚨ ᚱ ᚲ ';
  color: var(--gold-dim);
  font-size: 0.7em;
  letter-spacing: 0.1em;
}

/* ── Grimoire header enhancement ── */
.grimoire-header {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0) 0px,
      rgba(0,0,0,0) 3px,
      rgba(100,60,10,0.04) 3px,
      rgba(100,60,10,0.04) 4px
    ),
    linear-gradient(180deg, #030201 0%, #0d0804 50%, #130a04 100%);
  border-bottom: 1px solid var(--gold-dim);
}

/* ── CHAPTER NAVIGATION SIDEBAR ── */
.chapter-nav {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    linear-gradient(180deg, #06020f 0%, #0c0420 50%, #06020f 100%);
  border: 1px solid rgba(140,60,200,0.40);
  border-left: none;
  border-radius: 0 6px 6px 0;
  padding: 0.75rem 0;
  width: 68px;
  box-shadow:
    2px 0 20px rgba(0,0,0,0.6),
    inset -1px 0 0 rgba(160,80,240,0.20),
    0 0 20px rgba(80,0,140,0.15);
}
.chapter-nav::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(120,60,200,0.5) 20%,
    rgba(180,100,255,0.8) 50%,
    rgba(120,60,200,0.5) 80%,
    transparent 100%
  );
}
.chapter-nav-title {
  font-family: 'Cinzel', serif;
  font-size: 0.42rem;
  letter-spacing: 0.2em;
  color: rgba(180,140,240,0.7);
  text-align: center;
  padding: 0 0.4rem 0.6rem;
  border-bottom: 1px solid rgba(140,60,200,0.25);
  width: 100%;
  margin-bottom: 0.5rem;
  line-height: 1.6;
}
.chapter-nav-title .chapter-nav-rune {
  display: block;
  font-size: 1rem;
  color: rgba(200,140,255,0.9);
  margin-bottom: 0.15rem;
}
.chapter-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chapter-nav-item {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.55rem 0.3rem;
  transition: background 0.2s;
  position: relative;
  gap: 0.1rem;
}
.chapter-nav-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.2s;
}
.chapter-nav-item.active::before { background: rgba(180,100,255,0.9); }
.chapter-nav-item:hover { background: rgba(140,60,200,0.12); }
.chapter-nav-item.active { background: rgba(140,60,200,0.18); }
.chapter-nav-numeral {
  font-family: 'Cinzel Decorative', serif;
  font-size: 0.85rem;
  color: rgba(180,120,255,0.85);
  line-height: 1;
}
.chapter-nav-item.active .chapter-nav-numeral { color: rgba(220,170,255,1); }
.chapter-nav-label {
  font-family: 'IM Fell English', serif;
  font-size: 0.48rem;
  color: rgba(180,140,240,0.55);
  text-align: center;
  line-height: 1.3;
  font-style: italic;
}
.chapter-nav-item.active .chapter-nav-label { color: rgba(210,170,255,0.9); }
.chapter-nav-count {
  font-family: 'Cinzel', serif;
  font-size: 0.42rem;
  color: rgba(180,130,240,0.4);
  letter-spacing: 0.05em;
}
.chapter-nav-forbidden .chapter-nav-numeral { color: #cc3322; }
.chapter-nav-forbidden.active .chapter-nav-numeral { color: #ff4433; }
.chapter-nav-forbidden .chapter-nav-label { color: rgba(180,50,30,0.6); }
.chapter-nav-forbidden.active .chapter-nav-label { color: rgba(220,80,50,0.9); }
.chapter-nav-forbidden::before { background: #882211 !important; }
.chapter-nav-bottom-rune {
  font-size: 1.2rem;
  color: rgba(160,100,220,0.6);
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(140,60,200,0.25);
  width: 100%;
  text-align: center;
  opacity: 0.6;
}

/* Push main content right to avoid sidebar overlap on desktop */
@media (min-width: 900px) {
  #mainSite .grimoire-header,
  #mainSite .tier-legend-bar,
  #mainSite .search-bar-wrapper {
    padding-left: 82px;
  }
  .grimoire-main { padding-left: calc(1.5rem + 72px); }
}
@media (max-width: 899px) {
  .chapter-nav { display: none; }
}

/* ── Norse tier-section-break redesign ── */
.tier-section-break {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  position: relative;
  margin-top: 1rem;
}
.tier-break-knotwork {
  width: 100%;
  height: 12px;
  margin-bottom: 1.2rem;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 8px,
      currentColor 8px,
      currentColor 10px,
      transparent 10px,
      transparent 18px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 4px,
      currentColor 4px,
      currentColor 5px
    );
  opacity: 0.2;
}
.tier-break-1 .tier-break-knotwork { color: #aabbdd; }
.tier-break-2 .tier-break-knotwork { color: #8866cc; }
.tier-break-3 .tier-break-knotwork { color: #993322; }

.tier-break-ornament {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.5em;
  margin-bottom: 0.8rem;
}
.tier-break-1 .tier-break-ornament { color: #8899bb; font-size: 0.75rem; }
.tier-break-2 .tier-break-ornament { color: #8855cc; font-size: 0.75rem; }
.tier-break-3 .tier-break-ornament { color: #993322; font-size: 0.75rem; }

.tier-break-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 0.4rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
}
.tier-break-1 .tier-break-title { color: #c8d8f0; }
.tier-break-2 .tier-break-title { color: #cc88ff; }
.tier-break-3 .tier-break-title {
  color: #ff4422;
  text-shadow: 0 0 30px rgba(200,30,10,0.5), 0 2px 12px rgba(0,0,0,0.8);
  animation: abyssGlow 3s ease-in-out infinite alternate;
}
.tier-break-sub {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.85rem;
  opacity: 0.75;
}
.tier-break-1 .tier-break-sub { color: #99aabb; }
.tier-break-2 .tier-break-sub { color: #aa88cc; }
.tier-break-3 .tier-break-sub { color: #cc6655; letter-spacing: 0.05em; }

.tier-break-rule {
  width: 60%;
  max-width: 400px;
  height: 1px;
  margin: 1rem auto 0;
}
.tier-break-1 .tier-break-rule { background: linear-gradient(90deg, transparent, #8899bb, transparent); }
.tier-break-2 .tier-break-rule { background: linear-gradient(90deg, transparent, #8844bb, transparent); }
.tier-break-3 .tier-break-rule { background: linear-gradient(90deg, transparent, #882211, transparent); }

/* ── Norse-style header decoration strip ── */
.grimoire-title {
  position: relative;
}
.grimoire-title::before,
.grimoire-title::after {
  content: ' ✦ ';
  color: var(--gold-dim);
  font-size: 0.5em;
  vertical-align: middle;
}

/* ── Better background texture — aged vellum ── */
/* body background handled by first rule */

/* ── Norse rune row in header — enhanced ── */
.rune-row {
  font-size: 1.1rem;
  letter-spacing: 0.5em;
  color: var(--gold-dim);
  opacity: 0.7;
  text-shadow: 0 0 8px rgba(200,168,76,0.3);
}

/* ── Animated rune glow on hover for filter buttons ── */
.filter-btn {
  position: relative;
  transition: all 0.2s ease;
}
.filter-btn::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.2s;
}
.filter-btn.active {
  box-shadow: 0 0 12px rgba(160,80,255,0.30), inset 0 0 8px rgba(140,60,220,0.15);
}

/* ── Footer psychedelic enhancement ── */
.grimoire-footer {
  border-top: 2px solid rgba(140,60,200,0.30);
  position: relative;
}
.grimoire-footer::before {
  content: 'ᚠ ᚢ ᚦ ᚨ ᚱ ᚲ ᚷ ᚹ ᚺ ᚾ ᛁ ᛃ ᛇ ᛈ ᛉ ᛊ ᛏ ᛒ ᛖ ᛗ ᛚ ᛜ ᛞ ᛟ';
  display: block;
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  color: rgba(160,100,220,0.7);
  opacity: 0.35;
  padding: 0.5rem;
  border-bottom: 1px solid rgba(120,60,180,0.15);
}

/* ── Psychedelic card hover refinement ── */
.creature-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.creature-card:hover {
  transform: translateY(-3px) rotate(0.3deg);
  box-shadow:
    0 12px 40px rgba(0,0,0,0.75),
    0 0 0 1px rgba(160,80,240,0.35),
    inset 0 0 20px rgba(120,40,200,0.06);
}

/* ── Search bar psychedelic border ── */
.search-container {
  border: 1.5px solid rgba(140,80,200,0.40) !important;
  background: rgba(60,10,100,0.15) !important;
}
.search-container::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(180,100,255,0.5), transparent);
}

/* ── Tier legend bar psychedelic style ── */
.tier-legend-bar {
  background:
    linear-gradient(90deg, rgba(10,0,20,0.85) 0%, rgba(20,5,40,0.92) 50%, rgba(10,0,20,0.85) 100%);
  border-top: 1px solid rgba(120,60,180,0.20);
  border-bottom: 1px solid rgba(120,60,180,0.30);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
}

/* ── Scroll-to-top behaviour fix for intro overlay ── */
.intro-overlay {
  isolation: isolate;
}

/* ── Modal book — Norse border ── */
.modal-book {
  border-top: 4px solid;
  border-image: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold), var(--gold-dim), transparent) 1;
}

/* ── Intro click prompt Norse styling ── */
.prompt-main {
  font-family: 'Cinzel Decorative', serif !important;
  font-size: 1.1rem !important;
  letter-spacing: 0.3em !important;
  color: rgba(200, 168, 76, 0.85) !important;
  text-shadow: 0 0 20px rgba(200,120,30,0.4) !important;
}
.prompt-runes {
  font-size: 0.9rem;
  letter-spacing: 0.4em;
  color: rgba(200, 168, 76, 0.35);
  margin-top: 0.5rem;
  animation: runeFlicker 4s ease-in-out infinite;
}
@keyframes runeFlicker {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 0.65; }
}
.prompt-sub {
  font-family: 'IM Fell English', serif !important;
  font-style: italic;
  font-size: 0.85rem !important;
  color: rgba(180, 150, 100, 0.6) !important;
  max-width: 340px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Enter button refined ── */
.enter-btn {
  font-family: 'Cinzel', serif !important;
  letter-spacing: 0.2em !important;
  font-size: 0.75rem !important;
  color: var(--gold) !important;
  background: transparent !important;
  border: 1px solid rgba(200,168,76,0.4) !important;
  padding: 0.7rem 2rem !important;
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 10px rgba(200,168,76,0.3);
  position: relative;
  overflow: hidden;
}
.enter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(200,168,76,0.05), transparent);
  pointer-events: none;
}
.enter-btn:hover {
  border-color: var(--gold) !important;
  box-shadow: 0 0 20px rgba(200,120,30,0.3) !important;
  color: var(--gold-bright) !important;
}

/* ── Intro title area ── */
.intro-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.5rem, 4vw, 2.8rem);
  color: var(--gold);
  letter-spacing: 0.15em;
  text-shadow: 0 0 30px rgba(200,120,30,0.5), 0 2px 8px rgba(0,0,0,0.8);
  margin-bottom: 0.5rem;
  min-height: 2.5em;
}
.intro-subtitle {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(200,160,100,0.75);
  white-space: pre-line;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}
.intro-rune-row {
  font-size: 0.9rem;
  letter-spacing: 0.4em;
  color: rgba(200,168,76,0.5);
  margin-bottom: 0.75rem;
}

/* ── Torch flames — Norse torch glow ── */
.torch-fire {
  box-shadow: 0 0 16px 6px rgba(255,120,20,0.5) !important;
}
.torch-fire-big {
  box-shadow: 0 0 30px 12px rgba(255,100,10,0.4) !important;
}

/* ══════════════════════════════════════════
   VISUAL OVERHAUL — More Atmosphere & Depth
═══════════════════════════════════════════ */

/* Richer body — aged book interior */
/* body background handled by first rule */

/* Header — dramatic candle-glow upgrade */
.grimoire-header {
  background:
    radial-gradient(ellipse at 50% 0%,   rgba(140,80,10,0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 60%,  rgba(120,40,5,0.15)  0%, transparent 35%),
    radial-gradient(ellipse at 90% 60%,  rgba(120,40,5,0.15)  0%, transparent 35%),
    linear-gradient(180deg, #080503 0%, #100805 45%, #14090400 100%) !important;
  padding: 3rem 1rem 2.5rem !important;
  border-bottom: none !important;
}
.header-border-bottom {
  height: 3px !important;
  background: linear-gradient(90deg,
    transparent,
    rgba(200,160,60,0.3) 15%,
    rgba(200,160,60,0.7) 30%,
    var(--gold) 50%,
    rgba(200,160,60,0.7) 70%,
    rgba(200,160,60,0.3) 85%,
    transparent) !important;
  bottom: -1px !important;
  box-shadow: 0 0 18px rgba(200,140,20,0.25);
}
.grimoire-title {
  text-shadow:
    0 0 40px rgba(200,140,20,0.4),
    0 0 80px rgba(200,100,10,0.2),
    2px 3px 0 rgba(0,0,0,0.9) !important;
}

/* Creature cards — worn parchment with candlelight edges */
.creature-card {
  /* psychedelic dark override — replaces old parchment */
  background:
    radial-gradient(ellipse at 50% 0%, rgba(100,50,160,0.20) 0%, transparent 55%),
    radial-gradient(ellipse at 0% 100%, rgba(0,80,60,0.12) 0%, transparent 45%),
    linear-gradient(170deg, rgba(18,8,30,0.97) 0%, rgba(10,4,20,0.98) 50%, rgba(14,6,18,0.97) 100%) !important;
}
.creature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120,60,200,0.10) 0%, transparent 50%),
    radial-gradient(circle at 0% 0%, rgba(0,120,100,0.06) 0%, transparent 30%),
    radial-gradient(circle at 100% 0%, rgba(100,0,60,0.06) 0%, transparent 30%);
  pointer-events: none;
  z-index: 0;
}
.creature-card:hover {
  transform: translateY(-5px) rotate(0.4deg) !important;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.75),
    0 2px 6px rgba(0,0,0,0.85),
    inset 0 0 0 5px rgba(140,60,200,0.18),
    0 0 0 1px rgba(160,80,220,0.25),
    0 0 35px rgba(120,40,180,0.20) !important;
}

/* Wider illumination panel with corner flourishes */
.card-illumination {
  width: 70px !important;
  height: 70px !important;
  border: 1px solid rgba(140,80,200,0.40) !important;
  background: radial-gradient(ellipse at center, rgba(40,10,70,0.25) 0%, rgba(15,3,30,0.45) 100%) !important;
  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.4),
    0 0 0 3px rgba(160,80,240,0.10) !important;
  position: relative !important;
}
.card-illumination::before,
.card-illumination::after {
  content: '*';
  position: absolute;
  font-size: 0.5rem;
  color: rgba(160,120,40,0.5);
  pointer-events: none;
}
.card-illumination::before { top: 2px; left: 2px; }
.card-illumination::after  { bottom: 2px; right: 2px; transform: rotate(45deg); }

/* Card name — stronger ink */
.card-name {
  font-size: clamp(0.95rem, 2.4vw, 1.25rem) !important;
  color: #e8d4a0 !important;
  text-shadow: 0 0 12px rgba(180,130,60,0.4) !important;
  letter-spacing: 0.04em !important;
}

/* Card excerpt — better readability */
.card-excerpt {
  font-size: 0.85rem !important;
  color: #c8b890 !important;
  line-height: 1.6 !important;
  -webkit-line-clamp: 4 !important;
}

/* Card footer — more defined */
.card-footer-bar {
  border-top: 1px solid rgba(140,80,200,0.28) !important;
  background: rgba(60,0,80,0.08);
  margin: 0.5rem -0.9rem 0 !important;
  padding: 0.5rem 0.9rem !important;
}
.card-read-more {
  font-size: 0.62rem !important;
  letter-spacing: 0.15em !important;
  color: var(--accent, #aa88cc) !important;
  opacity: 0.8 !important;
  text-transform: uppercase !important;
}
.creature-card:hover .card-read-more {
  opacity: 1 !important;
  text-shadow: 0 0 8px currentColor;
}

/* Section tab navigation */
.section-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  border-bottom: 2px solid rgba(140,60,200,0.35);
  margin: 0;
  background: linear-gradient(180deg, rgba(4,1,14,0.88) 0%, rgba(8,2,26,0.88) 100%);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 20px rgba(0,0,0,0.6), 0 0 30px rgba(60,0,100,0.15);
}
.section-tab {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.7rem, 1.8vw, 0.95rem);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(180,130,240,0.55);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 1rem 2.5rem;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.section-tab::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%; right: 50%;
  height: 3px;
  background: rgba(200,120,255,0.9);
  transition: left 0.3s, right 0.3s;
}
.section-tab:hover { color: rgba(200,160,255,0.85); }
.section-tab.active {
  color: rgba(220,185,255,1);
  text-shadow: 0 0 20px rgba(180,100,255,0.45);
}
.section-tab.active::after { left: 0; right: 0; }

/* Spell cards grid */
.spells-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.4rem;
  padding: 2rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Spell category section header */
.spell-category-break {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 0 0.5rem;
  position: relative;
}
.spell-category-break h3 {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(0.9rem, 2.5vw, 1.4rem);
  letter-spacing: 0.2em;
  margin-bottom: 0.3rem;
}
.spell-category-break p {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.85rem;
  opacity: 0.65;
}
.spell-cat-rule {
  width: 60%; max-width: 400px;
  height: 1px;
  margin: 0.8rem auto 0;
  opacity: 0.4;
}

/* Spell card */
.spell-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  animation: cardReveal 0.4s ease-out both;
  border-radius: 1px;
}
.spell-card:hover { transform: translateY(-4px) rotate(-0.3deg); }

.spell-card-inner {
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.1'/%3E%3C/svg%3E"),
    linear-gradient(165deg, #f0e2c5 0%, #e5d2a2 30%, #d8c48e 65%, #ccb47a 100%);
  border: 1px solid #8a6a30;
  padding: 1.1rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 4px 18px rgba(0,0,0,0.55),
    inset 0 0 0 4px rgba(154,120,64,0.1),
    inset 0 1px 0 rgba(255,240,180,0.25);
  position: relative;
  overflow: hidden;
}
.spell-card:hover .spell-card-inner {
  box-shadow:
    0 10px 35px rgba(0,0,0,0.65),
    inset 0 0 0 4px rgba(154,120,64,0.18),
    0 0 25px rgba(180,120,20,0.1);
}

/* Glyph at top of spell card */
.spell-glyph {
  font-size: 2rem;
  text-align: center;
  color: rgba(80,40,10,0.55);
  margin-bottom: 0.4rem;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.spell-card[data-restricted="true"] .spell-glyph { color: rgba(200,20,20,0.6); }

/* Spell card name */
.spell-card-name {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  font-weight: 700;
  color: #140c02;
  text-align: center;
  margin-bottom: 0.15rem;
  letter-spacing: 0.05em;
  line-height: 1.25;
}
.spell-card-tradition {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  color: #6a4010;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}
.spell-card-purpose {
  font-family: 'IM Fell English', serif;
  font-size: 0.8rem;
  font-style: italic;
  color: #2a1800;
  text-align: center;
  margin-bottom: 0.6rem;
  opacity: 0.85;
}
.spell-card-rule {
  text-align: center;
  color: rgba(100,70,30,0.45);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.15em;
}
.spell-card-desc {
  font-family: 'IM Fell English', serif;
  font-size: 0.8rem;
  color: #241400;
  line-height: 1.55;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.spell-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(100,70,30,0.3);
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6a4010;
}
.spell-card-open { opacity: 0.65; transition: opacity 0.2s; }
.spell-card:hover .spell-card-open { opacity: 1; }

/* Dark ritual card variant */
.spell-card[data-restricted="true"] .spell-card-inner {
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.1'/%3E%3C/svg%3E"),
    linear-gradient(165deg, #1e0c0c 0%, #160a0a 40%, #120808 100%);
  border-color: rgba(140,30,30,0.5);
  box-shadow:
    0 4px 18px rgba(80,0,0,0.4),
    inset 0 0 0 4px rgba(120,30,30,0.08),
    0 0 0 1px rgba(100,20,20,0.3);
}
.spell-card[data-restricted="true"] .spell-card-name { color: #cc4422; text-shadow: 0 0 10px rgba(160,40,20,0.3); }
.spell-card[data-restricted="true"] .spell-card-tradition,
.spell-card[data-restricted="true"] .spell-card-purpose { color: #884433; opacity: 0.9; }
.spell-card[data-restricted="true"] .spell-card-desc { color: #cc8866; }
.spell-card[data-restricted="true"] .spell-card-footer { color: #883322; border-color: rgba(120,30,30,0.35); }
.spell-card[data-restricted="true"] .spell-card-rule { color: rgba(140,50,30,0.4); }
.spell-locked-badge {
  background: rgba(120,20,20,0.8);
  color: #ffaa88;
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  padding: 0.15rem 0.5rem;
  border: 1px solid rgba(180,50,30,0.4);
}

/* Age gate modal */
.age-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,1,6,0.92);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
}
.age-gate-overlay.hidden { display: none; }
.age-gate-box {
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #1a0808 0%, #130606 50%, #0e0404 100%);
  border: 1px solid rgba(160,40,30,0.6);
  max-width: 520px;
  width: 90%;
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  box-shadow: 0 0 60px rgba(120,20,10,0.35), 0 20px 60px rgba(0,0,0,0.8);
}
.age-gate-box::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(140,30,20,0.25);
  pointer-events: none;
}
.age-gate-glyph {
  font-size: 2.5rem;
  color: rgba(180,50,30,0.7);
  display: block;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(180,50,30,0.4);
}
.age-gate-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: #cc3322;
  letter-spacing: 0.12em;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(220,25,20,0.4);
}
.age-gate-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: rgba(200,100,80,0.6);
  margin-bottom: 1.5rem;
}
.age-gate-text {
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  font-style: italic;
  color: #cc8866;
  line-height: 1.7;
  margin-bottom: 2rem;
  border-top: 1px solid rgba(140,30,20,0.3);
  border-bottom: 1px solid rgba(140,30,20,0.3);
  padding: 1rem 0;
}
.age-gate-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.age-gate-confirm {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: #ffaa88;
  background: rgba(120,20,20,0.6);
  border: 1px solid rgba(180,50,30,0.6);
  padding: 0.8rem 1.8rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}
.age-gate-confirm:hover {
  background: rgba(210,25,20,0.7);
  box-shadow: 0 0 20px rgba(220,25,20,0.3);
  color: #ffcc99;
}
.age-gate-deny {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: rgba(180,140,100,0.5);
  background: transparent;
  border: 1px solid rgba(180,140,100,0.2);
  padding: 0.8rem 1.4rem;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}
.age-gate-deny:hover { color: rgba(180,140,100,0.8); border-color: rgba(180,140,100,0.4); }

/* Spell detail modal */
.spell-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3,1,8,0.88);
  z-index: 7000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.spell-modal-overlay.hidden { display: none; }
.spell-modal-book {
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #f2e4c6 0%, #e8d5ab 30%, #ddc890 60%, #d2bc80 100%);
  max-width: 680px;
  width: 100%;
  border: 1px solid #8a6a30;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(200,160,60,0.1);
  position: relative;
}
.spell-modal-book.spell-modal-dark {
  background:
    url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.09'/%3E%3C/svg%3E"),
    linear-gradient(175deg, #1a0808 0%, #130606 50%, #0e0404 100%);
  border-color: rgba(160,40,30,0.5);
  color: #cc8866;
}
.spell-modal-header {
  padding: 1.5rem 2rem 1rem;
  border-bottom: 1px solid rgba(100,70,30,0.3);
  text-align: center;
  position: relative;
}
.spell-modal-dark .spell-modal-header { border-color: rgba(140,30,20,0.3); }
.spell-modal-glyph-big {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.5rem;
  color: rgba(80,40,10,0.5);
}
.spell-modal-dark .spell-modal-glyph-big { color: rgba(180,50,30,0.6); text-shadow: 0 0 20px rgba(180,50,30,0.3); }
.spell-modal-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  color: #1a0c02;
  letter-spacing: 0.1em;
  margin-bottom: 0.25rem;
}
.spell-modal-dark .spell-modal-title { color: #cc4422; text-shadow: 0 0 15px rgba(180,40,20,0.3); }
.spell-modal-meta {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: #6a4010;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.spell-modal-dark .spell-modal-meta { color: #883322; }
.spell-modal-close {
  position: absolute;
  top: 1rem; right: 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: #6a4010;
  background: transparent;
  border: 1px solid rgba(100,70,30,0.4);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}
.spell-modal-dark .spell-modal-close { color: #883322; border-color: rgba(140,40,20,0.4); }
.spell-modal-close:hover { background: rgba(100,70,30,0.1); }
.spell-modal-body { padding: 1.5rem 2rem; }
.spell-modal-section { margin-bottom: 1.4rem; }
.spell-modal-section-title {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6a4010;
  border-bottom: 1px solid rgba(100,70,30,0.25);
  padding-bottom: 0.25rem;
  margin-bottom: 0.6rem;
}
.spell-modal-dark .spell-modal-section-title { color: #883322; border-color: rgba(140,40,20,0.25); }
.spell-modal-prose {
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #1e1206;
}
.spell-modal-dark .spell-modal-prose { color: #cc8866; }
.spell-modal-incantation {
  font-family: 'IM Fell English', serif;
  font-size: 1rem;
  font-style: italic;
  color: #3a1e06;
  text-align: center;
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(100,70,30,0.3);
  background: rgba(0,0,0,0.05);
  line-height: 1.6;
  letter-spacing: 0.05em;
}
.spell-modal-dark .spell-modal-incantation {
  color: #cc6644;
  border-color: rgba(140,40,20,0.35);
  background: rgba(140,10,10,0.2);
  text-shadow: 0 0 8px rgba(180,50,30,0.2);
}
.spell-modal-ingredients { list-style: none; padding: 0; }
.spell-modal-ingredients li {
  font-family: 'IM Fell English', serif;
  font-size: 0.85rem;
  color: #2a1a06;
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.spell-modal-dark .spell-modal-ingredients li { color: #cc8866; }
.spell-modal-ingredients li::before { content: '-'; font-size: 0.5rem; color: rgba(160,120,40,0.6); }
.spell-modal-dark .spell-modal-ingredients li::before { content: '-'; color: rgba(180,50,30,0.6); }
.spell-modal-warning {
  background: rgba(140,10,10,0.3);
  border: 1px solid rgba(210,25,20,0.4);
  padding: 0.75rem 1rem;
  font-family: 'IM Fell English', serif;
  font-size: 0.82rem;
  font-style: italic;
  color: #cc6655;
  line-height: 1.6;
}

/* Step-by-step process list */
.spell-modal-process {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}
.spell-modal-process li {
  font-family: 'IM Fell English', serif;
  font-size: 0.87rem;
  color: #1e1206;
  line-height: 1.65;
  padding: 0.55rem 0 0.55rem 2.6rem;
  border-bottom: 1px solid rgba(100,70,30,0.12);
  position: relative;
  counter-increment: step-counter;
}
.spell-modal-process li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 1.6rem;
  height: 1.6rem;
  background: rgba(100,70,30,0.1);
  border: 1px solid rgba(100,70,30,0.3);
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  font-weight: 700;
  color: #6a4010;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spell-modal-process li:last-child { border-bottom: none; }
.spell-modal-dark .spell-modal-process li { color: #cc8866; border-color: rgba(140,40,20,0.15); }
.spell-modal-dark .spell-modal-process li::before {
  background: rgba(220,25,20,0.2);
  border-color: rgba(140,40,20,0.45);
  color: #cc5533;
}

.spell-modal-lore {
  font-family: 'IM Fell English', serif;
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(80,50,20,0.7);
  border-top: 1px solid rgba(100,70,30,0.2);
  padding-top: 0.8rem;
  margin-top: 0.5rem;
}
.spell-modal-dark .spell-modal-lore { color: rgba(180,100,60,0.6); border-color: rgba(140,40,20,0.2); }

/* Dark ritual warning banner */
.spell-dark-warning-banner {
  background: rgba(140,10,10,0.5);
  border-top: 1px solid rgba(210,25,20,0.5);
  border-bottom: 1px solid rgba(210,25,20,0.5);
  padding: 0.5rem 1rem;
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(220,80,60,0.8);
  text-align: center;
}

/* Spell section — darkness dots */
.darkness-meter {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 0.5rem;
}
.darkness-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(100,70,30,0.3);
  border: 1px solid rgba(100,70,30,0.4);
}
.darkness-dot.filled { background: #c01818; border-color: #c01818; box-shadow: 0 0 4px rgba(200,20,20,0.5); }
.spell-card[data-restricted="true"] .darkness-dot { border-color: rgba(160,40,20,0.4); }
.spell-card[data-restricted="true"] .darkness-dot.filled { background: #cc2222; box-shadow: 0 0 6px rgba(180,20,20,0.6); }

/* ── Potency meter (light rituals) ─────────────── */
.potency-meter {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 0.5rem;
}
.potency-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(180,140,30,0.2);
  border: 1px solid rgba(180,140,30,0.35);
}
.potency-dot.filled {
  background: #c8a020;
  border-color: #e0c040;
  box-shadow: 0 0 6px rgba(220,180,30,0.7);
}

/* ── Light ritual card ──────────────────────────── */
.spell-card-light-inner {
  background: linear-gradient(
    160deg,
    rgba(255,240,180,0.07) 0%,
    rgba(200,150,30,0.04) 50%,
    rgba(255,240,200,0.06) 100%
  ) !important;
  border-color: rgba(180,140,40,0.35) !important;
}
.spell-card-light-inner::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 0%, rgba(220,180,60,0.12) 0%, transparent 65%);
  pointer-events: none;
}
.spell-card:has(.spell-card-light-inner) {
  border-color: rgba(180,140,40,0.3) !important;
}
.spell-card:has(.spell-card-light-inner):hover {
  box-shadow: 0 8px 32px rgba(200,160,30,0.22), 0 0 0 1px rgba(200,160,40,0.3) !important;
  transform: translateY(-5px);
}
.spell-card-light-inner .spell-glyph {
  color: #d4a820;
  text-shadow: 0 0 18px rgba(220,180,30,0.6);
}
.spell-card-light-inner .spell-card-name { color: #c8960a; }
.spell-card-light-inner .spell-card-open {
  color: #c8960a;
  border-color: rgba(180,140,40,0.4);
}
.spell-card-light-inner .spell-card-open:hover { background: rgba(180,140,40,0.12); }

/* ── Light ritual category header ────────────────── */
.spell-category-break-light {
  border-top: 1px solid rgba(200,160,40,0.25);
  position: relative;
}
.spell-category-break-light::before {
  content: '— — —';
  display: block;
  text-align: center;
  color: rgba(200,160,40,0.5);
  font-size: 0.7rem;
  letter-spacing: 0.5em;
  margin-bottom: 0.5rem;
}

/* ── Light ritual modal ──────────────────────────── */
.spell-modal-light {
  background: linear-gradient(
    170deg,
    #fdf8e8 0%,
    #f5edcc 30%,
    #efe0b0 70%,
    #e8d490 100%
  ) !important;
  border-color: rgba(180,140,40,0.5) !important;
  box-shadow:
    0 0 0 1px rgba(180,140,40,0.25),
    0 0 40px rgba(200,160,30,0.15),
    0 30px 80px rgba(0,0,0,0.35) !important;
}
.spell-modal-light .spell-modal-glyph-big {
  color: #c8960a;
  text-shadow: 0 0 30px rgba(220,180,30,0.5);
}
.spell-modal-light .spell-modal-title { color: #7a5800; }
.spell-modal-light .spell-modal-meta  { color: rgba(100,70,10,0.65); }
.spell-modal-light .spell-modal-section-title {
  color: #8a6800;
  border-bottom-color: rgba(160,120,30,0.3);
}
.spell-modal-light .spell-modal-prose { color: #3a2a08; }
.spell-modal-light .spell-modal-incantation {
  background: rgba(200,160,30,0.08);
  border-color: rgba(180,140,40,0.35);
  color: #6a4c00;
}
.spell-modal-light .spell-modal-ingredients li { color: #4a3600; }
.spell-modal-light .spell-modal-ingredients li::before { color: #c8960a; }
.spell-modal-light .spell-modal-process li { color: #3a2a08; border-color: rgba(160,120,30,0.15); }
.spell-modal-light .spell-modal-process li::before {
  background: rgba(180,140,30,0.15);
  border-color: rgba(180,140,40,0.45);
  color: #9a7000;
}
.spell-modal-light .spell-modal-lore { color: rgba(80,55,10,0.65); border-color: rgba(160,120,30,0.2); }
.spell-modal-light .spell-modal-close {
  color: #8a6800;
  border-color: rgba(160,120,30,0.35);
}
.spell-modal-light .spell-modal-close:hover {
  background: rgba(180,140,40,0.12);
  color: #6a4c00;
}

/* Responsive spells grid */
@media (max-width: 680px) {
  .spells-grid { grid-template-columns: 1fr; padding: 1rem; }
  .spell-modal-body, .spell-modal-header { padding: 1rem; }
  .age-gate-buttons { flex-direction: column; }
  .section-tabs { gap: 0; }
  .section-tab { padding: 0.8rem 1rem; font-size: 0.65rem; }
}

/* ══════════════════════════════════════════
   MYSTERY & REDACTION — Tier II / Tier III
═══════════════════════════════════════════ */

/* Redacted text bars */
.redact-bar {
  display: inline;
  color: #5a3a3a;
  background: #2a1212;
  letter-spacing: 0.08em;
  font-family: monospace;
  font-size: 0.9em;
  border-radius: 2px;
  padding: 0 2px;
  user-select: none;
}
.redact-bar-heavy {
  color: #3a1a1a;
  background: #1a0808;
  filter: blur(0.4px);
}

/* Tier III card — sealed look */
.card-sealed {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(140,10,10,0.06) 0px,
      rgba(140,10,10,0.06) 1px,
      transparent 1px,
      transparent 8px
    ) !important;
  border-color: rgba(200,20,20,0.5) !important;
  box-shadow:
    0 0 18px rgba(190,0,0,0.3),
    inset 0 0 30px rgba(80,0,0,0.15) !important;
}
.card-sealed::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10,2,2,0.18);
  pointer-events: none;
  border-radius: inherit;
}

/* Sealed stamp on Tier III cards */
.card-seal-stamp {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: rgba(255, 50, 50, 0.85);
  border: 1px solid rgba(220, 30, 30, 0.5);
  padding: 0.18rem 0.7rem;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(255, 20, 20, 0.7);
  animation: abyssGlow 2s ease-in-out infinite;
}

/* Tier III card name — ominous */
.card-name-forbidden {
  color: #ff7755 !important;
  text-shadow: 0 0 14px rgba(255,80,40,0.6) !important;
  letter-spacing: 0.12em;
}

/* Cursed illumination panel for Tier III */
.card-illum-cursed {
  background: radial-gradient(ellipse at center, #1a0505 60%, #2a0808) !important;
  border-color: rgba(120,20,20,0.5) !important;
  box-shadow: inset 0 0 20px rgba(170,0,0,0.3) !important;
}

/* Redacted power list items */
.power-redacted {
  color: #3a1a1a !important;
  background: #180808;
  font-family: monospace;
  font-size: 0.85em;
  border-radius: 3px;
  padding: 2px 6px;
  list-style: none;
  user-select: none;
  filter: blur(0.3px);
}
.power-redacted::marker { display: none; }

/* Sealed accounts notice in modal */
.modal-sealed-accounts {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: rgba(180,60,60,0.7);
  border: 1px solid rgba(140,30,30,0.3);
  padding: 0.75rem 1rem;
  background: rgba(30,5,5,0.5);
  margin-top: 0.5rem;
  text-align: center;
  line-height: 1.7;
}

/* Tier III modal — dark wash */
.modal-book.modal-forbidden {
  background:
    radial-gradient(ellipse at 50% 0%, #1a0505 0%, #110a0a 60%, #0d0808 100%);
  border-color: rgba(200,20,20,0.5);
  color: #d4b8a0;
}
.modal-book.modal-forbidden .book-prose {
  color: #c8aa88;
}
.modal-book.modal-forbidden .mystery-prose {
  color: #b09070;
}
.modal-book.modal-forbidden .book-section-head .section-latin,
.modal-book.modal-forbidden .book-section-head .section-english {
  color: #cc8866;
}
.modal-book.modal-forbidden .book-ornament-divider {
  color: rgba(180,80,60,0.55);
}
.modal-book.modal-forbidden .book-power-list li {
  color: #c0a080;
  border-bottom-color: rgba(180,80,60,0.2);
}
.modal-book.modal-forbidden .book-power-list li::before {
  color: #cc4422;
}
.modal-book.modal-forbidden .book-sightings-list li {
  color: #b89878;
}
.modal-book.modal-forbidden .marginalia-text {
  color: #a08060;
}
.modal-book.modal-forbidden .book-folio {
  color: rgba(180,100,80,0.6);
  border-bottom-color: rgba(180,80,60,0.25);
}
.modal-book.modal-forbidden .modal-origin {
  color: rgba(180,130,100,0.75);
}
.modal-book.modal-forbidden .book-lore-footer {
  color: rgba(160,100,80,0.65);
}

/* Intro — deeper atmosphere (background set in main rule above) */

/* Intro title cursed glow — slow pulse, no jitter */
@keyframes introGlitch {
  0%, 100% {
    text-shadow: 0 0 40px rgba(180,100,255,0.5), 0 0 80px rgba(120,60,200,0.25);
    opacity: 1;
  }
  48% {
    text-shadow: 0 0 55px rgba(200,120,255,0.65), 0 0 100px rgba(140,60,220,0.35);
    opacity: 0.95;
  }
  50% {
    text-shadow: -1px 0 rgba(255,0,80,0.5), 1px 0 rgba(0,200,255,0.4), 0 0 40px rgba(180,100,255,0.5);
    opacity: 0.9;
  }
  52% {
    text-shadow: 0 0 55px rgba(200,120,255,0.65), 0 0 100px rgba(140,60,220,0.35);
    opacity: 1;
  }
}
.intro-title-cursed {
  animation: none;
}

/* ══════════════════════════════════════════
   MOBILE — Full responsive overhaul
═══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Header — clean & simple on mobile ── */
  .grimoire-header    { padding: 1.4rem 1rem 1rem; }
  .grimoire-title     { font-size: clamp(1.8rem, 9vw, 2.6rem); letter-spacing: 0.05em; margin-bottom: 0.4rem; }
  .rune-row                      { display: block; font-size: 0; letter-spacing: 0; margin-bottom: 0.4rem; }
  .rune-row .rune-tree-of-life   { display: inline-flex; font-size: 1rem; margin: 0; }
  .scroll-decoration             { display: none; }
  .subtitle-scroll::before,
  .subtitle-scroll::after        { display: none; }
  .subtitle-scroll               { justify-content: center; gap: 0; }
  .subtitle-text                 { font-size: 0.75rem; text-align: center; }
  .header-tagline                { display: none; }
  .torch                         { display: none; }
  .tier-legend-bar               { display: none; }
  .header-border-top,
  .header-border-bottom          { height: 3px; }

  /* ── Section tabs ── */
  .section-tab { padding: 0.75rem 1.2rem; font-size: 0.7rem; letter-spacing: 0.1em; }

  /* ── Search & filters ── */
  .search-bar-wrapper { padding: 0.6rem 0.8rem; }
  .search-container   { margin-bottom: 0.5rem; }
  #searchInput        { font-size: 0.9rem; }
  .filter-buttons     { gap: 0.3rem; }
  .filter-btn         { font-size: 0.62rem; padding: 0.25rem 0.55rem; }

  /* ── Chapter nav — hide on mobile ── */
  .chapter-nav { display: none; }

  /* ── Tier legend ── */
  .tier-legend-bar  { font-size: 0.58rem; gap: 0.5rem; padding: 0.4rem 0.6rem; }

  /* ── Cards grid — two columns on mobile ── */
  .entries-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0.7rem;
  }
  .spells-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0.7rem;
  }
  .creature-card { max-width: 100%; margin: 0; width: 100%; }
  .creature-card .card-excerpt { display: none; }
  .creature-card .card-name { font-size: 0.82rem; }
  .creature-card .card-origin { font-size: 0.62rem; }
  .creature-card .card-read-more { font-size: 0.6rem; }

  /* ── Modal ── */
  .modal-overlay { padding: 0.5rem; }
  .modal-book    { max-width: 100%; border-radius: 4px; }
  .book-columns  { flex-direction: column; }
  .book-margin-col {
    width: 100%;
    border-right: none;
    border-top: 1px dashed rgba(140,80,200,0.25);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
  }
  .book-main-col     { padding: 0 1rem 1rem; }
  .book-title-block  { flex-direction: column; gap: 0.5rem; padding: 1rem 1rem 0.5rem; }
  .book-creature-photo-wrap { height: 220px; }
  .modal-creature-name { font-size: clamp(1.2rem, 5vw, 1.8rem); }
  .book-section-head   { flex-direction: column; gap: 0.1rem; }
  .modal-close { font-size: 0.65rem; padding: 0.3rem 0.6rem; }

  /* ── Spell cards ── */
  .spell-card { min-width: 0; overflow: hidden; }
  .spell-card-inner {
    padding: 0.75rem 0.6rem;
    min-height: 160px;
    overflow: hidden;
  }
  .spell-glyph { font-size: 1.4rem; margin-bottom: 0.25rem; }
  .spell-card-name {
    font-size: clamp(0.68rem, 3vw, 0.85rem);
    word-break: break-word;
    hyphens: auto;
  }
  .spell-card-tradition { font-size: 0.5rem; }
  .spell-card-purpose { font-size: 0.68rem; margin-bottom: 0.4rem; }
  .spell-card-desc { font-size: 0.68rem; -webkit-line-clamp: 2; }
  .spell-card-footer { font-size: 0.5rem; gap: 0.2rem; }
  .spell-card-rule { font-size: 0.56rem; }

  /* ── Spell category headers ── */
  .spell-category-break { padding: 1.2rem 0 0.3rem; }
  .spell-category-break h3 { font-size: clamp(0.8rem, 4vw, 1.1rem); letter-spacing: 0.1em; }
  .spell-category-break p { font-size: 0.72rem; }

  /* ── Spell modal ── */
  .spell-modal-overlay { padding: 0.4rem 0.3rem; }
  .spell-modal-book { max-width: 100%; margin: 0; width: 100%; }
  .spell-modal-header { padding: 1rem 1rem 0.75rem; }
  .spell-modal-glyph-big { font-size: 2rem; margin-bottom: 0.3rem; }
  .spell-modal-title { font-size: clamp(0.9rem, 4.5vw, 1.2rem); letter-spacing: 0.06em; }
  .spell-modal-meta { font-size: 0.55rem; letter-spacing: 0.12em; }
  .spell-modal-close { font-size: 0.58rem; padding: 0.25rem 0.5rem; top: 0.75rem; right: 0.75rem; }
  .spell-modal-body { padding: 1rem 1rem; }
  .spell-modal-prose { font-size: 0.82rem; line-height: 1.6; }
  .spell-modal-incantation { font-size: 0.88rem; padding: 0.6rem 0.8rem; }
  .spell-modal-ingredients li { font-size: 0.78rem; }
  .spell-modal-warning { font-size: 0.75rem; padding: 0.6rem 0.8rem; }
  .spell-modal-process li { font-size: 0.78rem; padding: 0.4rem 0 0.4rem 2.2rem; }
  .spell-modal-process li::before { width: 1.4rem; height: 1.4rem; font-size: 0.55rem; }
  .spell-modal-section-title { font-size: 0.58rem; }
  .spell-modal-lore { font-size: 0.72rem; }
  .spell-dark-warning-banner { font-size: 0.55rem; }

  /* ── Age gate ── */
  .age-gate-box { padding: 1.5rem 1rem; margin: 1rem; }
  .age-gate-text { font-size: 0.8rem; }

  /* ── Footer ── */
  .grimoire-footer { padding: 1.2rem 1rem; }
  .footer-runes    { font-size: 0.7rem; letter-spacing: 0.2em; word-break: break-all; }

  /* ── Intro ── */
  .intro-click-prompt { padding: 1rem; }
  .prompt-main   { font-size: 1rem; }
  .intro-title   { font-size: clamp(1.4rem, 7vw, 2.5rem); }
  .intro-subtitle { font-size: 0.75rem; }
  .enter-btn     { font-size: 0.75rem; padding: 0.6rem 1.4rem; }
  .intro-torch   { display: none; }
}


/* ══════════════════════════════════════
   MAGIC INTERACTIONS
══════════════════════════════════════ */

/* ── Spark particle ── */
.magic-spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99;
  transform: translate(-50%, -50%);
  animation: sparkFly 0.55s ease-out forwards;
}
@keyframes sparkFly {
  0%   { opacity: 1; transform: translate(-50%,-50%) translate(0,0) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-50%) translate(var(--tx),var(--ty)) scale(0.2); }
}

/* ── Card click flash ── */
.card-click-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(200,160,255,0.28);
  border-radius: 3px;
  animation: cardFlash 0.3s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}
@keyframes cardFlash {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Modal entrance ── */
.modal-overlay:not(.hidden) .modal-book {
  animation: modalRise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes modalRise {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Creature photo — taller, face-centered ── */
.book-creature-photo-wrap {
  height: 380px;
}
.book-creature-photo {
  object-fit: cover;
  object-position: center 20%;
  filter: sepia(40%) contrast(118%) brightness(78%) saturate(85%);
  transition: filter 0.5s ease, transform 0.5s ease;
}
.book-creature-photo-wrap:hover .book-creature-photo {
  filter: sepia(20%) contrast(112%) brightness(90%) saturate(105%);
  transform: scale(1.03);
}

/* ── Filter button press ── */
.filter-btn:active, .section-tab:active {
  transform: scale(0.94);
}
.filter-btn {
  transition: transform 0.1s ease, background 0.2s ease, color 0.2s ease;
}

/* ── Card hover shimmer overlay ── */
.creature-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 40%, rgba(180,120,255,0.06) 60%, rgba(255,255,255,0) 80%);
  background-size: 200% 200%;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: 3px;
}
.creature-card:hover::after {
  opacity: 1;
  animation: shimmerSlide 1.2s ease infinite;
}
@keyframes shimmerSlide {
  0%   { background-position: 200% 200%; }
  100% { background-position: -200% -200%; }
}

/* ── Whimsy flash ── */
@keyframes whimsyVeil {
  0%   { background: rgba(180,120,255,0); }
  18%  { background: rgba(180,120,255,0.10); }
  100% { background: rgba(180,120,255,0); }
}
@keyframes whimsyBurst {
  0%   { transform: scale(0);    opacity: 0; }
  35%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1.6);  opacity: 0; }
}
@keyframes whimsyRing {
  0%   { transform: scale(0);   opacity: 0; }
  25%  { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.5); opacity: 0; }
}
@keyframes whimsyLogo {
  0%   { color: rgba(255,230,120,0);    transform: scale(0.88); }
  28%  { color: rgba(255,230,120,0.92); transform: scale(1.03); }
  100% { color: rgba(255,230,120,0);    transform: scale(1.08); }
}


/* ═══════════════════════════════════════
   ORACLE QUIZ
   ═══════════════════════════════════════ */

.quiz-wrapper {
  max-width: 820px;
  margin: 1.5rem auto 5rem;
  padding: 0 1rem;
}

.quiz-phase { width: 100%; }
.quiz-phase.hidden { display: none; }

/* ── Oracle intro ───────────────────────────────── */
.quiz-oracle-wrap {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quiz-oracle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.quiz-oracle-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem;
  max-width: 400px;
}

.quiz-intro-sub {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--gold-dim);
  margin-bottom: 0.8rem;
}

.quiz-intro-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.3rem, 5vw, 2rem);
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(240,192,64,0.5), 0 0 60px rgba(140,80,255,0.2);
  margin-bottom: 1.2rem;
  line-height: 1.2;
}

.quiz-intro-text {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--parchment);
  line-height: 1.8;
  opacity: 0.82;
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  margin-bottom: 1.6rem;
}

.quiz-begin-btn {
  display: inline-block;
  padding: 0.85rem 2.6rem;
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.quiz-begin-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(201,168,76,0.12) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.quiz-begin-btn:hover::before { opacity: 1; }
.quiz-begin-btn:hover {
  box-shadow: 0 0 22px rgba(240,192,64,0.35), 0 0 60px rgba(140,80,255,0.1);
}

/* ── Progress dots ──────────────────────────────── */
.quiz-progress-dots {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.6rem;
}

.quiz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(201,168,76,0.18);
  border: 1px solid rgba(201,168,76,0.25);
  transition: all 0.3s ease;
}
.quiz-dot-done {
  background: rgba(201,168,76,0.45);
  border-color: var(--gold-dim);
}
.quiz-dot-active {
  background: var(--gold);
  border-color: var(--gold-bright);
  box-shadow: 0 0 8px rgba(240,192,64,0.7);
  transform: scale(1.3);
}
.quiz-dot-pivotal.quiz-dot-active {
  background: var(--crimson);
  border-color: var(--crimson-bright);
  box-shadow: 0 0 10px rgba(192,24,24,0.7);
}
.quiz-dot-pivotal.quiz-dot-done {
  background: rgba(192,24,24,0.4);
  border-color: var(--crimson);
}
.quiz-dot-pivotal {
  border-color: rgba(192,24,24,0.3);
}

/* ── Question number (Roman numeral) ────────────── */
.quiz-q-number {
  text-align: center;
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--gold);
  margin-bottom: 1.2rem;
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
  letter-spacing: 0.05em;
  line-height: 1;
}

/* ── Question card ──────────────────────────────── */
.quiz-card {
  background: linear-gradient(160deg, rgba(17,12,6,0.97) 0%, rgba(13,8,4,0.97) 100%);
  border: 1px solid rgba(201,168,76,0.25);
  padding: 2rem 2.2rem 1.8rem;
  box-shadow:
    0 0 60px rgba(0,0,0,0.8),
    inset 0 0 40px rgba(0,0,0,0.5),
    0 0 0 4px rgba(201,168,76,0.04);
  position: relative;
}
.quiz-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(201,168,76,0.2), transparent 40%, transparent 60%, rgba(201,168,76,0.1)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: destination-out;
  mask-composite: exclude;
  pointer-events: none;
}

.quiz-card-ornament-top,
.quiz-card-ornament-bottom {
  text-align: center;
  color: var(--gold-dim);
  font-size: 0.65rem;
  letter-spacing: 0.5em;
  opacity: 0.5;
  margin-bottom: 1.2rem;
}
.quiz-card-ornament-bottom { margin-bottom: 0; margin-top: 1.2rem; }

/* ── Pivotal note ───────────────────────────────── */
.quiz-pivotal-note {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--crimson-bright);
  text-align: center;
  margin-bottom: 1rem;
  opacity: 0.9;
  animation: quiz-crimson-pulse 2.5s ease-in-out infinite;
}
.quiz-pivotal-note.hidden { display: none; }

@keyframes quiz-crimson-pulse {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}

/* ── Question text ──────────────────────────────── */
.quiz-question-text {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(1rem, 3.2vw, 1.22rem);
  color: var(--parchment);
  text-align: center;
  line-height: 1.75;
  margin-bottom: 1.8rem;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

/* ── Options ────────────────────────────────────── */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

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

.quiz-option-enter {
  animation: quiz-option-enter 0.3s ease both;
}

.quiz-option-btn {
  background: rgba(201,168,76,0.03);
  border: 1px solid rgba(201,168,76,0.18);
  color: var(--parchment-dark);
  font-family: 'IM Fell English', serif;
  font-size: clamp(0.85rem, 2.4vw, 0.96rem);
  line-height: 1.55;
  text-align: left;
  padding: 0.85rem 1.1rem 0.85rem 2.4rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
}
.quiz-option-btn::before {
  content: '—';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-dim);
  opacity: 0.5;
  font-style: normal;
  transition: opacity 0.2s, color 0.2s;
}
.quiz-option-btn:hover:not(:disabled) {
  background: rgba(201,168,76,0.08);
  border-color: rgba(201,168,76,0.45);
  color: var(--parchment);
  box-shadow: inset 3px 0 0 var(--gold), 0 0 16px rgba(201,168,76,0.08);
  transform: translateX(2px);
}
.quiz-option-btn:hover:not(:disabled)::before { opacity: 1; color: var(--gold); }
.quiz-option-btn.selected {
  background: rgba(201,168,76,0.13);
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: inset 3px 0 0 var(--gold), 0 0 20px rgba(240,192,64,0.15);
}
.quiz-option-btn.selected::before { color: var(--gold-bright); opacity: 1; }
.quiz-option-btn:disabled { cursor: default; opacity: 0.55; }

/* ── Pivotal options ────────────────────────────── */
.quiz-option-btn.quiz-option-pivotal {
  border-color: rgba(192,24,24,0.28);
}
.quiz-option-btn.quiz-option-pivotal::before { color: rgba(192,24,24,0.6); }
.quiz-option-btn.quiz-option-pivotal:hover:not(:disabled) {
  border-color: rgba(192,24,24,0.65);
  box-shadow: inset 3px 0 0 var(--crimson), 0 0 16px rgba(192,24,24,0.1);
  color: var(--parchment);
}
.quiz-option-btn.quiz-option-pivotal:hover:not(:disabled)::before { color: var(--crimson); opacity: 0.9; }
.quiz-option-btn.quiz-option-pivotal.selected {
  border-color: var(--crimson);
  color: #ff7070;
  box-shadow: inset 3px 0 0 var(--crimson), 0 0 20px rgba(192,24,24,0.2);
}

/* ── Result header ──────────────────────────────── */
.quiz-result-header {
  text-align: center;
  margin-bottom: 2.8rem;
  padding-top: 0.5rem;
}

.quiz-result-runes {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold-dim);
  letter-spacing: 0.35em;
  margin-bottom: 0.6rem;
  opacity: 0.6;
}

.quiz-result-label {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--gold-dim);
  margin-bottom: 0.5rem;
}

.quiz-result-archetype {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.7rem, 6vw, 2.8rem);
  color: var(--gold-bright);
  text-shadow:
    0 0 30px rgba(240,192,64,0.6),
    0 0 70px rgba(140,80,255,0.2);
  margin-bottom: 1.2rem;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.quiz-result-verdict {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--parchment);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.85;
  opacity: 0.88;
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
}

/* ── Result columns ─────────────────────────────── */
.quiz-result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
  margin-bottom: 2rem;
}
@media (max-width: 580px) {
  .quiz-result-columns { grid-template-columns: 1fr; }
}

.quiz-result-col-header {
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  color: var(--gold-dim);
  text-align: center;
  margin-bottom: 0.7rem;
  border-bottom: 1px solid rgba(201,168,76,0.18);
  padding-bottom: 0.45rem;
}

/* ── Creature card ──────────────────────────────── */
.quiz-creature-inner {
  background: linear-gradient(160deg, #110c06, #0d0804);
  border: 1px solid rgba(201,168,76,0.2);
  padding: 1.4rem 1.2rem;
  min-height: 200px;
  position: relative;
}

/* Category-coloured left accent */
.quiz-cat-border-angel     { border-left: 3px solid #f0d458; }
.quiz-cat-border-demon     { border-left: 3px solid #c01818; }
.quiz-cat-border-spirit    { border-left: 3px solid #60c8e8; }
.quiz-cat-border-undead    { border-left: 3px solid #a0b898; }
.quiz-cat-border-beast     { border-left: 3px solid #a040c0; }
.quiz-cat-border-divine    { border-left: 3px solid #f0c040; }
.quiz-cat-border-elemental { border-left: 3px solid #50d068; }
.quiz-cat-border-entheogenic { border-left: 3px solid #c850ff; }

.quiz-creature-cat {
  font-family: 'Cinzel', serif;
  font-size: 0.56rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  margin-bottom: 0.7rem;
  display: inline-block;
  border: 1px solid currentColor;
  opacity: 0.8;
}
.quiz-cat-angel     { color: #f0d458; }
.quiz-cat-demon     { color: #c01818; }
.quiz-cat-spirit    { color: #60c8e8; }
.quiz-cat-undead    { color: #a0b898; }
.quiz-cat-beast     { color: #a040c0; }
.quiz-cat-divine    { color: #f0c040; }
.quiz-cat-elemental { color: #50d068; }
.quiz-cat-entheogenic { color: #c850ff; }

.quiz-creature-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(0.88rem, 3vw, 1.1rem);
  color: var(--gold-bright);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.quiz-creature-origin {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  color: var(--gold-dim);
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
  line-height: 1.4;
}
.quiz-creature-tier {
  font-family: 'Cinzel', serif;
  font-size: 0.56rem;
  color: var(--gold-dim);
  opacity: 0.65;
  margin-bottom: 0.75rem;
}
.quiz-creature-desc {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--parchment-dark);
  line-height: 1.65;
  opacity: 0.85;
  margin-bottom: 0.65rem;
}
.quiz-creature-danger {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--crimson);
  opacity: 0.8;
}

/* ── Spell card ─────────────────────────────────── */
.quiz-spell-inner {
  background: linear-gradient(160deg, #0c0a10, #080610);
  border: 1px solid rgba(140,80,255,0.2);
  padding: 1.4rem 1.2rem;
  min-height: 200px;
  text-align: center;
}
.quiz-spell-glyph {
  font-size: 2.2rem;
  color: var(--gold);
  margin-bottom: 0.7rem;
  text-shadow: 0 0 16px rgba(201,168,76,0.5);
  display: block;
}
.quiz-spell-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(0.78rem, 2.8vw, 0.98rem);
  color: var(--gold-bright);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}
.quiz-spell-tradition {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  color: rgba(140,80,255,0.8);
  letter-spacing: 0.14em;
  margin-bottom: 0.8rem;
}
.quiz-spell-desc {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.82rem;
  color: var(--parchment-dark);
  line-height: 1.65;
  opacity: 0.82;
  text-align: left;
}

/* ── Lore footer ────────────────────────────────── */
.quiz-result-lore {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--parchment-dark);
  text-align: center;
  max-width: 580px;
  margin: 0 auto 2.5rem;
  line-height: 1.85;
  opacity: 0.72;
  font-size: 0.9rem;
  border-top: 1px solid rgba(201,168,76,0.12);
  padding-top: 1.4rem;
}

/* ── Latin seal ─────────────────────────────────── */
.quiz-latin-seal {
  position: relative;
  text-align: center;
  margin: 0 auto 2.8rem;
  max-width: 420px;
  padding: 1.6rem 2rem;
}
.quiz-latin-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(201,168,76,0.28);
  border-radius: 2px;
  box-shadow:
    inset 0 0 20px rgba(201,168,76,0.06),
    0 0 28px rgba(201,168,76,0.08);
  pointer-events: none;
}
.quiz-latin-ring::before,
.quiz-latin-ring::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(201,168,76,0.12);
  border-radius: 1px;
}
.quiz-latin-ring::after {
  inset: 10px;
  border-color: rgba(201,168,76,0.07);
}
.quiz-latin-phrase {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  color: var(--gold-bright);
  letter-spacing: 0.12em;
  font-style: italic;
  margin-bottom: 0.45rem;
  text-shadow: 0 0 18px rgba(201,168,76,0.4);
}
.quiz-latin-hint {
  font-family: 'IM Fell English', serif;
  font-size: 0.68rem;
  color: var(--gold-dim);
  opacity: 0.55;
  letter-spacing: 0.06em;
  font-style: italic;
}

/* ── Three-column result grid ───────────────────── */
.quiz-result-three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.4rem;
  margin-bottom: 2.2rem;
}
@media (max-width: 820px) {
  .quiz-result-three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .quiz-result-three { grid-template-columns: 1fr; }
}

.quiz-result-col {
  display: flex;
  flex-direction: column;
}

.quiz-result-col-header {
  font-family: 'Cinzel', serif;
  font-size: 0.63rem;
  letter-spacing: 0.22em;
  color: var(--gold-dim);
  text-align: center;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid rgba(201,168,76,0.18);
  padding-bottom: 0.45rem;
}
.col-header-rune {
  font-size: 0.95rem;
  margin-right: 0.3em;
  color: var(--gold);
  opacity: 0.75;
  vertical-align: middle;
}

/* ── Result card wrap (clickable container) ─────── */
.quiz-result-card-wrap {
  flex: 1;
  cursor: pointer;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.quiz-result-card-wrap:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}

/* ── Inner card base ────────────────────────────── */
.quiz-inner-card {
  position: relative;
  padding: 1.3rem 1.1rem 1.4rem;
  min-height: 210px;
  overflow: hidden;
}
.quiz-inner-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.18s ease;
  pointer-events: none;
}
.quiz-result-card-wrap:hover .quiz-inner-card::after {
  background: rgba(201,168,76,0.04);
}

/* familiar — warm amber-green border */
.quiz-inner-familiar {
  background: linear-gradient(155deg, #0d1008, #090c05);
  border: 1px solid rgba(160,190,80,0.22);
  border-top: 2px solid rgba(160,190,80,0.35);
}
/* entity — dark manuscript gold border */
.quiz-inner-entity {
  background: linear-gradient(155deg, #110c06, #0d0804);
  border: 1px solid rgba(201,168,76,0.22);
  border-top: 2px solid rgba(201,168,76,0.38);
}
/* spell — deep arcane purple border */
.quiz-inner-spell {
  background: linear-gradient(155deg, #0c0a10, #080610);
  border: 1px solid rgba(140,80,255,0.22);
  border-top: 2px solid rgba(140,80,255,0.38);
  text-align: center;
}

/* ── Manuscript corner ornaments ────────────────── */
.quiz-card-corner {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.quiz-card-corner::before,
.quiz-card-corner::after {
  content: '';
  position: absolute;
  background: rgba(201,168,76,0.45);
}
.quiz-card-corner::before { width: 100%; height: 1px; top: 0; left: 0; }
.quiz-card-corner::after  { width: 1px; height: 100%; top: 0; left: 0; }
.quiz-card-corner.tl { top: 5px; left: 5px; }
.quiz-card-corner.tr { top: 5px; right: 5px; transform: scaleX(-1); }
.quiz-card-corner.bl { bottom: 5px; left: 5px; transform: scaleY(-1); }
.quiz-card-corner.br { bottom: 5px; right: 5px; transform: scale(-1); }

/* ── Click hint badge ───────────────────────────── */
.quiz-card-click-hint {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 0.28rem 0.65rem;
  background: rgba(201,168,76,0.12);
  border-top: 1px solid rgba(201,168,76,0.2);
  border-left: 1px solid rgba(201,168,76,0.2);
  font-family: 'Cinzel', serif;
  font-size: 0.52rem;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.quiz-result-card-wrap:hover .quiz-card-click-hint { opacity: 1; }

/* ── Missing fallback ───────────────────────────── */
.quiz-missing {
  font-family: 'IM Fell English', serif;
  color: var(--gold-dim);
  opacity: 0.4;
  text-align: center;
  padding: 2rem;
}

/* ── Glitch / witch effect on answer ────────────── */
@keyframes quiz-card-glitch {
  0%          { transform: translate(0,0) skewX(0);       filter: none;                                    opacity: 1; }
  8%          { transform: translate(-6px,0) skewX(-3deg); filter: hue-rotate(160deg) saturate(4) brightness(1.7); box-shadow: -4px 0 0 rgba(192,0,80,0.9), 4px 0 0 rgba(0,100,255,0.7); opacity: 1; }
  16%         { transform: translate(6px,2px) skewX(2deg); filter: hue-rotate(290deg) saturate(3) brightness(0.7); box-shadow: 4px 0 0 rgba(192,0,80,0.9), -4px 0 0 rgba(0,200,255,0.6); }
  24%         { transform: translate(0,0);                 filter: none;                                    opacity: 0.65; }
  32%         { transform: translate(-4px,0) skewX(1.5deg); filter: contrast(2.2) brightness(1.5);         box-shadow: 0 0 18px rgba(130,0,255,0.7); opacity: 1; }
  40%         { transform: translate(5px,-2px) skewX(-2deg); filter: hue-rotate(330deg) saturate(2.8);    }
  48%         { transform: translate(0,0);                 filter: none;                                    opacity: 1; }
  56%         { transform: translate(-2px,1px);            filter: brightness(1.6) hue-rotate(60deg);      opacity: 0.85; }
  68%         { transform: translate(0,0);                 filter: none;                                    opacity: 1; }
  80%         { transform: translate(1px,0) skewX(0.8deg); filter: hue-rotate(200deg);                    opacity: 0.95; }
  100%        { transform: translate(0,0) skewX(0);       filter: none;                                    opacity: 1; }
}

@keyframes quiz-card-scanlines {
  0%, 100% { opacity: 0; }
  15%, 45% { opacity: 1; }
  30%      { opacity: 0; }
}

.quiz-glitching {
  animation: quiz-card-glitch 0.60s steps(2, end) forwards;
  pointer-events: none;
}

.quiz-glitching::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(100,0,220,0.07) 3px,
    rgba(100,0,220,0.07) 4px
  );
  pointer-events: none;
  z-index: 20;
  animation: quiz-card-scanlines 0.60s steps(2) forwards;
}

/* Full-page witch veil flash */
@keyframes quiz-witch-veil {
  0%   { opacity: 0; }
  18%  { opacity: 1; }
  100% { opacity: 0; }
}

.quiz-witch-veil {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 45%,
    rgba(100,10,180,0.82) 0%,
    rgba(30,0,70,0.90)   45%,
    rgba(5,0,15,0.80)   100%
  );
  pointer-events: none;
  z-index: 9998;
  animation: quiz-witch-veil 0.65s cubic-bezier(0.22,1,0.36,1) forwards;
}

/* ── Restart ────────────────────────────────────── */
.quiz-restart-btn {
  display: block;
  margin: 0 auto;
  padding: 0.75rem 2.2rem;
  background: transparent;
  border: 1px solid rgba(201,168,76,0.3);
  color: var(--gold-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.quiz-restart-btn:hover {
  background: rgba(201,168,76,0.07);
  color: var(--gold-bright);
  box-shadow: 0 0 14px rgba(201,168,76,0.15);
}

.quiz-missing {
  text-align: center;
  color: var(--gold-dim);
  padding: 2rem;
  font-family: 'Cinzel', serif;
}

@media (max-width: 520px) {
  .quiz-oracle-wrap { aspect-ratio: 1 / 1.1; }
  .quiz-card { padding: 1.5rem 1rem 1.3rem; }
  .quiz-option-btn { padding: 0.75rem 0.9rem 0.75rem 2.1rem; }
}

/* ══════════════════════════════════════════════
   THE COMMUNION
   ══════════════════════════════════════════════ */

/* ── Section wrapper ── */
.communion-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 4rem;
}

/* ── Section header ── */
.communion-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid rgba(120,60,180,0.3);
  margin-bottom: 1.5rem;
}
.communion-header-rune {
  font-size: 1.1rem;
  letter-spacing: 0.6rem;
  color: var(--gold-dim);
  text-shadow: 0 0 10px var(--gold);
  margin-bottom: 0.75rem;
  animation: runePulse 3s ease-in-out infinite;
}
.communion-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--gold-bright);
  text-shadow: 0 0 20px rgba(200,160,40,0.5), 2px 2px 0 var(--ink);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}
.communion-desc {
  font-style: italic;
  color: var(--parchment-dark);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto 1.25rem;
  line-height: 1.7;
  opacity: 0.85;
}
.communion-new-btn {
  display: inline-block;
  background: rgba(100,30,140,0.18);
  border: 1px solid rgba(160,80,220,0.55);
  color: var(--parchment);
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  padding: 0.55rem 1.4rem;
  cursor: pointer;
  transition: all 0.22s;
  text-transform: uppercase;
}
.communion-new-btn:hover {
  background: rgba(140,50,200,0.28);
  border-color: rgba(200,110,255,0.75);
  color: #e8d4ff;
  box-shadow: 0 0 18px rgba(160,80,255,0.3);
}

/* ── Category tabs ── */
.communion-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  padding: 0 1rem 1rem;
}
.communion-cat-tab {
  background: rgba(60,20,90,0.15);
  border: 1px solid rgba(120,60,180,0.28);
  color: rgba(190,160,230,0.7);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}
.communion-cat-tab:hover {
  background: rgba(100,40,160,0.22);
  border-color: rgba(170,90,240,0.5);
  color: rgba(220,190,255,1);
}
.communion-cat-tab.active {
  background: rgba(120,40,180,0.28);
  border-color: rgba(190,110,255,0.6);
  color: #ddc8ff;
  box-shadow: 0 0 10px rgba(150,70,240,0.2);
}
.cat-tab-count {
  display: inline-block;
  font-size: 0.6rem;
  opacity: 0.65;
  margin-left: 0.3em;
}

/* ── Tag cloud ── */
.communion-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0 1rem 1.2rem;
  justify-content: center;
}
.tag-cloud-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  opacity: 0.7;
  margin-right: 0.2rem;
}
.tag-cloud-item {
  background: rgba(40,15,70,0.2);
  border: 1px solid rgba(100,50,160,0.28);
  color: rgba(180,150,220,0.75);
  font-family: 'IM Fell English', serif;
  font-size: 0.72rem;
  font-style: italic;
  padding: 0.18rem 0.6rem;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 2px;
}
.tag-cloud-item:hover {
  background: rgba(80,30,130,0.28);
  border-color: rgba(160,90,220,0.5);
  color: rgba(220,190,255,1);
}
.tag-cloud-item.tag-cloud-active {
  background: rgba(110,40,170,0.32);
  border-color: rgba(200,120,255,0.6);
  color: #ddc8ff;
}
.tag-cloud-count {
  font-style: normal;
  font-size: 0.62rem;
  opacity: 0.6;
  margin-left: 0.2em;
}
.tag-cloud-clear {
  background: rgba(80,15,15,0.2);
  border: 1px solid rgba(180,60,60,0.35);
  color: rgba(230,160,160,0.8);
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.18s;
  border-radius: 2px;
}
.tag-cloud-clear:hover {
  background: rgba(130,20,20,0.3);
  border-color: rgba(220,80,80,0.55);
  color: #ffcccc;
}

/* ── Feed ── */
.communion-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 1rem;
}

/* ── Testimony card ── */
.testimony-card {
  background: linear-gradient(160deg, rgba(12,6,22,0.96) 0%, rgba(8,3,18,0.98) 100%);
  border: 1px solid rgba(110,55,170,0.4);
  padding: 1.2rem 1.3rem 1rem;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  animation: cardReveal 0.35s ease-out both;
}
.testimony-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(120,50,200,0.04) 0%, transparent 50%);
  pointer-events: none;
}
.testimony-card:hover {
  transform: translateY(-2px);
  border-color: rgba(170,90,240,0.6);
  box-shadow: 0 6px 24px rgba(0,0,0,0.55), 0 0 20px rgba(120,50,200,0.12);
}
.testimony-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.testimony-cat-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cat-color, #9955cc);
  border: 1px solid currentColor;
  padding: 0.15rem 0.55rem;
  opacity: 0.9;
}
.testimony-timestamp {
  font-family: 'Cinzel', serif;
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  opacity: 0.7;
}
.testimony-title {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--parchment);
  letter-spacing: 0.02em;
  margin-bottom: 0.55rem;
  line-height: 1.4;
}
.testimony-excerpt {
  font-style: italic;
  color: rgba(220,195,160,0.8);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}
.testimony-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}
.testimony-tag {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.72rem;
  color: rgba(170,140,210,0.8);
  background: rgba(60,20,100,0.2);
  border: 1px solid rgba(100,55,160,0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.testimony-tag:hover {
  background: rgba(100,40,160,0.3);
  border-color: rgba(160,90,220,0.5);
  color: rgba(210,180,250,1);
}
.testimony-tag.testimony-tag-active {
  background: rgba(110,40,170,0.32);
  border-color: rgba(190,110,255,0.6);
  color: #ddc8ff;
}
.testimony-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(100,50,160,0.2);
  padding-top: 0.6rem;
  margin-top: auto;
}
.testimony-read-more {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  opacity: 0.75;
  transition: color 0.15s, opacity 0.15s;
}
.testimony-card:hover .testimony-read-more {
  color: var(--gold);
  opacity: 1;
}
.testimony-comment-count {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: rgba(160,130,200,0.6);
}

/* ── Empty state ── */
.communion-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gold-dim);
  opacity: 0.65;
}
.communion-empty-glyph {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}
.communion-empty p {
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ── Testimony detail modal ── */
.testimony-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 5000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.testimony-modal-book {
  background: linear-gradient(170deg, #0c0620 0%, #08031a 60%, #0a0318 100%);
  border: 1px solid rgba(140,70,200,0.5);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(100,40,180,0.15);
  width: 100%;
  max-width: 680px;
  padding: 2rem 2rem 1.5rem;
  position: relative;
  overflow-y: auto;
  max-height: 90vh;
  animation: cardReveal 0.3s ease-out both;
}
.tm-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: 1px solid rgba(120,60,180,0.35);
  color: var(--gold-dim);
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  transition: all 0.18s;
}
.tm-close:hover {
  border-color: rgba(200,100,255,0.5);
  color: var(--parchment);
}
.tm-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  padding-right: 5rem;
}
.tm-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 600;
  color: var(--parchment);
  letter-spacing: 0.03em;
  line-height: 1.35;
  margin: 0.5rem 0 0.75rem;
  width: 100%;
}
.tm-rule {
  border: none;
  border-top: 1px solid rgba(120,60,180,0.3);
  margin: 1rem 0;
}
.tm-section-label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
  opacity: 0.7;
  margin-bottom: 0.4rem;
}
.tm-section-label span {
  font-style: italic;
  font-family: 'IM Fell English', serif;
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gold-dim);
  opacity: 0.8;
}
.tm-prose {
  font-style: italic;
  color: rgba(225,200,165,0.88);
  font-size: 0.93rem;
  line-height: 1.8;
  margin-bottom: 0.25rem;
}

/* ── Comments section ── */
.tm-comments-section {
  margin-top: 1.75rem;
  border-top: 1px solid rgba(100,50,160,0.3);
  padding-top: 1.25rem;
}
.tm-comments-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  opacity: 0.8;
  margin-bottom: 1rem;
}
.tm-comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-bottom: 1.25rem;
}
.tm-comment {
  background: rgba(40,15,70,0.2);
  border-left: 2px solid rgba(120,60,180,0.35);
  padding: 0.6rem 0.9rem;
}
.tm-comment-text {
  font-style: italic;
  color: rgba(210,185,150,0.85);
  font-size: 0.87rem;
  line-height: 1.7;
  margin-bottom: 0.3rem;
}
.tm-comment-time {
  font-family: 'Cinzel', serif;
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  color: var(--gold-dim);
  opacity: 0.55;
}
.tm-no-comments {
  text-align: center;
  font-style: italic;
  color: var(--gold-dim);
  opacity: 0.55;
  font-size: 0.83rem;
  padding: 0.75rem 0;
}
.tm-comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.tm-comment-input {
  background: rgba(40,15,70,0.15);
  border: 1px solid rgba(100,50,160,0.35);
  color: var(--parchment);
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.87rem;
  padding: 0.6rem 0.75rem;
  resize: vertical;
  min-height: 70px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  width: 100%;
}
.tm-comment-input::placeholder { color: var(--parchment-deep); opacity: 0.5; }
.tm-comment-input:focus {
  border-color: rgba(160,90,240,0.55);
  box-shadow: 0 0 12px rgba(130,60,220,0.2);
}
.tm-comment-submit {
  align-self: flex-end;
  background: rgba(80,25,120,0.18);
  border: 1px solid rgba(140,70,200,0.5);
  color: var(--parchment-dark);
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.tm-comment-submit:hover {
  background: rgba(120,40,180,0.28);
  border-color: rgba(190,100,255,0.65);
  color: #e8d4ff;
  box-shadow: 0 0 12px rgba(150,70,230,0.25);
}

/* ── Post form modal ── */
.communion-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 5100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  backdrop-filter: blur(5px);
}
.communion-form-book {
  background: linear-gradient(165deg, #0e0525 0%, #090218 60%, #0b0420 100%);
  border: 1px solid rgba(150,75,210,0.55);
  box-shadow: 0 20px 60px rgba(0,0,0,0.85), 0 0 50px rgba(110,40,190,0.18);
  width: 100%;
  max-width: 640px;
  padding: 2rem 2rem 1.75rem;
  animation: cardReveal 0.3s ease-out both;
}
.cf-header {
  text-align: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(120,55,180,0.3);
  padding-bottom: 1.25rem;
}
.cf-rune {
  font-size: 0.9rem;
  letter-spacing: 0.5rem;
  color: var(--gold-dim);
  text-shadow: 0 0 8px var(--gold);
  display: block;
  margin-bottom: 0.5rem;
  animation: runePulse 3s ease-in-out infinite;
}
.cf-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(200,160,40,0.4);
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.cf-subtitle {
  font-style: italic;
  color: var(--parchment-dark);
  opacity: 0.75;
  font-size: 0.82rem;
}
.cf-field {
  margin-bottom: 1.1rem;
}
.cf-label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  opacity: 0.8;
  margin-bottom: 0.35rem;
}
.cf-label span {
  font-style: italic;
  font-family: 'IM Fell English', serif;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
  color: rgba(200,175,135,0.65);
  margin-left: 0.3em;
}
.cf-input,
.cf-select,
.cf-textarea {
  width: 100%;
  background: rgba(30,10,60,0.18);
  border: 1px solid rgba(100,50,160,0.38);
  color: var(--parchment);
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.cf-select {
  font-style: normal;
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23c9a84c88'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}
.cf-select option {
  background: #0e0525;
  color: var(--parchment);
}
.cf-textarea { resize: vertical; font-style: italic; }
.cf-input::placeholder,
.cf-textarea::placeholder { color: var(--parchment-deep); opacity: 0.45; }
.cf-input:focus,
.cf-select:focus,
.cf-textarea:focus {
  border-color: rgba(160,90,240,0.55);
  box-shadow: 0 0 12px rgba(130,60,220,0.18);
}
.cf-hint {
  font-size: 0.68rem;
  font-style: italic;
  color: rgba(190,165,120,0.55);
  margin-top: 0.25rem;
  display: block;
}
.cf-error {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--crimson-bright);
  min-height: 1.2em;
  margin-bottom: 0.75rem;
  text-align: center;
}
.cf-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}
.cf-submit {
  background: rgba(90,25,130,0.22);
  border: 1px solid rgba(160,80,230,0.55);
  color: var(--parchment);
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 0.55rem 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.cf-submit:hover {
  background: rgba(130,45,190,0.32);
  border-color: rgba(200,120,255,0.7);
  box-shadow: 0 0 16px rgba(160,80,255,0.3);
  color: #eedcff;
}
.cf-cancel {
  background: none;
  border: 1px solid rgba(100,50,100,0.3);
  color: rgba(180,150,180,0.6);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: all 0.18s;
}
.cf-cancel:hover {
  border-color: rgba(160,80,160,0.5);
  color: rgba(220,190,220,0.85);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .testimony-modal-book,
  .communion-form-book { padding: 1.4rem 1.2rem 1.2rem; }
  .tm-header { padding-right: 3.5rem; }
  .cf-buttons { flex-direction: column-reverse; }
  .cf-submit, .cf-cancel { width: 100%; text-align: center; }
}

/* ══════════════════════════════════════════════
   MOBILE OVERHAUL
   ══════════════════════════════════════════════ */

/* Section tabs — scroll horizontally, never wrap */
.section-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  scrollbar-width: none;
}
.section-tabs::-webkit-scrollbar { display: none; }

@media (max-width: 700px) {
  .section-tab {
    padding: 0.9rem 1.1rem;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Filter bar — scroll horizontally */
  .filter-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .filter-buttons::-webkit-scrollbar { display: none; }
  .filter-btn { flex-shrink: 0; min-height: 34px; }

  /* Bestiary grid — single column */
  .entries-grid { grid-template-columns: 1fr; gap: 0.9rem; }
  .spells-grid  { grid-template-columns: 1fr; padding: 1rem 0.75rem; }

  /* Chapter nav — hide on mobile */
  .chapter-nav { display: none !important; }

  /* Tier legend — scrollable row */
  .tier-legend-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0.4rem 0.75rem;
    scrollbar-width: none;
    gap: 0.6rem;
  }
  .tier-legend-bar::-webkit-scrollbar { display: none; }

  /* Search bar */
  .search-bar-wrapper { padding: 0.6rem 0.75rem; }

  /* Creature modal — full screen from bottom */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-book {
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    margin: 0;
    overflow-y: auto;
  }
  .book-columns { flex-direction: column; }
  .book-margin-col { display: none; }
  .book-main-col { padding-right: 0; }

  /* Spell modal */
  .spell-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .spell-modal-book {
    max-height: 92vh;
    border-radius: 12px 12px 0 0;
    margin: 0;
  }

  /* Communion */
  .communion-cat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0.75rem 0.75rem;
  }
  .communion-cat-tabs::-webkit-scrollbar { display: none; }
  .communion-cat-tab { flex-shrink: 0; }

  .communion-tag-cloud { padding: 0 0.75rem 1rem; }
  .communion-feed { padding: 0 0.75rem; }

  .testimony-modal-overlay,
  .communion-form-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .testimony-modal-book,
  .communion-form-book {
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    padding: 1.4rem 1.1rem 1.2rem;
  }

  /* Header */
  .grimoire-header { padding: 1.5rem 0.75rem 1.25rem; }
  .torch-left  { left: 12px; }
  .torch-right { right: 12px; }
  .rune-row { letter-spacing: 0.25rem; font-size: 0.75rem; }

  /* Quiz */
  .quiz-result-three { flex-direction: column; gap: 1rem; }
  .quiz-result-col { width: 100%; }
}

/* ══════════════════════════════════════════════
   DESIGN MAGIC — Enhanced visual atmosphere
   ══════════════════════════════════════════════ */

/* Deeper active tab glow */
.section-tab.active {
  color: rgba(230, 200, 255, 1) !important;
  text-shadow:
    0 0 12px rgba(210, 140, 255, 0.8),
    0 0 30px rgba(170, 90, 255, 0.45) !important;
}
.section-tab.active::after {
  background: linear-gradient(90deg, transparent, rgba(210,140,255,0.95), transparent) !important;
  box-shadow: 0 0 12px rgba(200,120,255,0.6);
}

/* Card hover — more dramatic lift and glow */
.creature-card:hover {
  transform: translateY(-5px) rotate(0.2deg) !important;
  box-shadow:
    0 12px 40px rgba(0,0,0,0.75),
    0 0 30px rgba(140,60,220,0.3),
    inset 0 0 0 1px rgba(200,140,255,0.25) !important;
}

/* Spell card hover */
.spell-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 10px 35px rgba(0,0,0,0.7), 0 0 25px rgba(120,50,180,0.25) !important;
}

/* Testimony card hover */
.testimony-card:hover {
  transform: translateY(-3px) !important;
  border-color: rgba(190, 110, 255, 0.65) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.6), 0 0 22px rgba(130,60,210,0.2) !important;
}

/* Testimony cards — raw/human feel with left accent bar */
.testimony-card {
  border-left: 3px solid var(--testimony-accent, rgba(120,60,200,0.5)) !important;
  background: linear-gradient(160deg, rgba(10,5,20,0.97) 0%, rgba(6,2,15,0.98) 100%) !important;
}
.testimony-title {
  font-family: 'IM Fell English', serif !important;
  font-size: 1rem !important;
  font-style: italic;
  font-weight: normal !important;
  letter-spacing: 0 !important;
  color: var(--parchment) !important;
}
.testimony-excerpt {
  font-size: 0.84rem !important;
  color: rgba(210, 185, 150, 0.75) !important;
  line-height: 1.65 !important;
  font-style: normal !important;
}
.testimony-card-header {
  margin-bottom: 0.5rem !important;
}

/* Communion wrapper — subtle magical background */
#communionSection .communion-wrapper {
  position: relative;
}
#communionSection .communion-wrapper::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(60,20,100,0.08) 0%, transparent 65%);
}
.communion-feed, .communion-header, .communion-cat-tabs, .communion-tag-cloud {
  position: relative;
  z-index: 1;
}

/* Animated shimmer on buttons and interactive elements */
@keyframes borderShimmer {
  0%   { border-color: rgba(140,60,200,0.4); box-shadow: 0 0 0 rgba(160,80,255,0); }
  50%  { border-color: rgba(190,110,255,0.65); box-shadow: 0 0 14px rgba(160,80,255,0.2); }
  100% { border-color: rgba(140,60,200,0.4); box-shadow: 0 0 0 rgba(160,80,255,0); }
}
.communion-new-btn:not(:hover) { animation: borderShimmer 3.5s ease-in-out infinite; }
.cf-submit:not(:hover)         { animation: borderShimmer 3s ease-in-out infinite; }

/* Tier section breaks — more dramatic */
.tier-section-break { position: relative; overflow: hidden; }
.tier-section-break::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(100,40,180,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.tier-break-title {
  text-shadow: 0 0 30px rgba(160,80,255,0.3), 0 0 60px rgba(100,40,180,0.15) !important;
}
.tier-break-2 .tier-break-title {
  text-shadow: 0 0 30px rgba(180,80,40,0.3), 0 0 60px rgba(140,40,20,0.15) !important;
}
.tier-break-3 .tier-break-title {
  text-shadow: 0 0 30px rgba(220,30,20,0.5), 0 0 60px rgba(180,10,10,0.3) !important;
  animation: runePulse 2s ease-in-out infinite;
}

/* Filter buttons — glow on active */
.filter-btn.active {
  box-shadow: 0 0 16px rgba(160,80,255,0.35), inset 0 0 8px rgba(120,50,200,0.15) !important;
}

/* Modal books — keep original parchment background intact */

/* Enchiridion intro title — larger shimmer on type */
.intro-title {
  font-family: 'Cinzel Decorative', serif;
  background: linear-gradient(180deg, #fffbe8 0%, #f7d96a 25%, #f0c040 50%, #e8a820 75%, #f7d96a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter:
    drop-shadow(0 0 16px rgba(255,210,60,0.9))
    drop-shadow(0 0 40px rgba(220,150,20,0.6))
    drop-shadow(2px 3px 6px rgba(0,0,0,0.9));
}

/* Oracle eye section — extra atmosphere */
.quiz-oracle-wrap {
  position: relative;
}
.quiz-oracle-wrap::after {
  content: '';
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at 50% 50%, rgba(80,20,140,0.12) 0%, transparent 65%);
  pointer-events: none;
  border-radius: 50%;
}

/* Mobile communion form — slide-up feel */
@media (max-width: 700px) {
  .communion-form-book {
    animation: slideUp 0.3s ease-out both;
  }
  .testimony-modal-book {
    animation: slideUp 0.3s ease-out both;
  }
  @keyframes slideUp {
    from { transform: translateY(40px); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1;   }
  }
}

/* Glow on all magical glyphs */
.communion-header-rune,
.cf-rune {
  filter: drop-shadow(0 0 8px rgba(200,160,40,0.6));
}

/* Comment timestamp — more faded */
.tm-comment-time { opacity: 0.42 !important; font-size: 0.52rem !important; }

/* ══════════════════════════════════════
   ALIGNMENT & LAYOUT CLEANUP
   ══════════════════════════════════════ */

/* Header — force true center, no overflow */
.grimoire-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.8rem 2rem 2.2rem;
}
.header-content {
  width: 100%;
  max-width: 860px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.grimoire-title {
  width: 100%;
  text-align: center;
}
.subtitle-scroll {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.header-tagline {
  text-align: center;
  width: 100%;
}
.rune-row {
  text-align: center;
  width: 100%;
}

/* Section tabs — centered, contained */
.section-tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 0.6rem 1rem;
  background: rgba(4,1,14,0.92);
  border-bottom: 1px solid rgba(100,40,160,0.3);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(8px);
}
.section-tab {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 0.5rem 1.4rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: rgba(180,150,220,0.6);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-transform: uppercase;
}
.section-tab:hover {
  color: rgba(220,190,255,0.9);
  border-bottom-color: rgba(160,80,255,0.4);
}
.section-tab.active {
  color: #e0c8ff;
  border-bottom-color: rgba(200,120,255,0.75);
  text-shadow: 0 0 12px rgba(180,80,255,0.5);
}

/* Tier legend — centered */
.tier-legend-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.55rem 1.5rem;
  text-align: center;
}

/* Search bar — consistent centering */
.search-bar-wrapper {
  padding: 0.75rem 1.5rem;
}
.search-container {
  margin: 0 auto 0.75rem;
}
.filter-buttons {
  max-width: 900px;
  margin: 0 auto;
  justify-content: center;
}

/* Main content max-width — consistent across all sections */
.grimoire-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Footer — centered */
.grimoire-footer {
  text-align: center;
}

/* Mobile cleanup */
@media (max-width: 700px) {
  .grimoire-header {
    padding: 2rem 1rem 1.6rem;
  }
  .header-content {
    max-width: 100%;
  }
  .subtitle-scroll {
    font-size: 0.6rem;
  }
  .section-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 0.5rem 0.75rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .section-tabs::-webkit-scrollbar { display: none; }
  .section-tab {
    flex-shrink: 0;
    font-size: 0.7rem;
    padding: 0.45rem 1rem;
  }
  .tier-legend-bar {
    font-size: 0.65rem;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
  }
  .search-bar-wrapper {
    padding: 0.6rem 0.75rem;
  }
  .grimoire-main {
    padding: 1.2rem 0.75rem;
  }
}

/* ══════════════════════════════════════
   SORTILEGE — The Random Draw
   ══════════════════════════════════════ */

/* Floating button */
.sortilege-btn {
  position: fixed;
  bottom: 2rem;
  right: 1.6rem;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: linear-gradient(160deg, rgba(20,6,40,0.96) 0%, rgba(10,2,24,0.98) 100%);
  border: 1px solid rgba(180,100,255,0.5);
  border-radius: 6px;
  padding: 0.75rem 1rem 0.6rem;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow:
    0 0 20px rgba(140,60,255,0.2),
    0 6px 24px rgba(0,0,0,0.7);
  animation: sortilegeIdle 4s ease-in-out infinite;
}
@keyframes sortilegeIdle {
  0%, 100% {
    box-shadow: 0 0 16px rgba(140,60,255,0.18), 0 6px 24px rgba(0,0,0,0.7);
    border-color: rgba(160,80,255,0.4);
  }
  50% {
    box-shadow: 0 0 32px rgba(180,100,255,0.38), 0 6px 24px rgba(0,0,0,0.7), 0 0 60px rgba(120,40,220,0.15);
    border-color: rgba(220,140,255,0.7);
  }
}
.sortilege-btn:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: rgba(220,140,255,0.85);
  box-shadow:
    0 0 40px rgba(180,100,255,0.5),
    0 10px 30px rgba(0,0,0,0.8);
  animation: none;
}
.sortilege-glyph {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(200,160,40,0.9)) drop-shadow(0 0 25px rgba(160,80,255,0.6));
  color: #f7d96a;
}
.sortilege-label {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: #e8d8ff;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(200,140,255,0.7), 0 0 20px rgba(160,80,255,0.4);
}

/* Full-screen overlay */
.sortilege-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2,0,8,0);
  pointer-events: none;
  transition: background 0.5s ease;
}
.sortilege-overlay.active {
  pointer-events: all;
  background: rgba(2,0,8,0.92);
}

#sortilegeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sortilege-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  text-align: center;
  padding: 2rem;
}

.sortilege-incantation {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  color: rgba(210,185,130,0.85);
  letter-spacing: 0.06em;
  opacity: 0;
  text-shadow: 0 0 20px rgba(200,160,40,0.5);
}

.sortilege-sigil {
  font-size: clamp(3rem, 10vw, 6rem);
  line-height: 1;
  color: #f7d96a;
  filter:
    drop-shadow(0 0 20px rgba(255,210,60,1))
    drop-shadow(0 0 60px rgba(200,120,20,0.8))
    drop-shadow(0 0 120px rgba(150,60,255,0.5));
  opacity: 0;
  transform-origin: center;
}

@keyframes sortilegeSigilSpin {
  0%   { transform: rotate(0deg) scale(1); }
  25%  { transform: rotate(90deg) scale(1.12); }
  50%  { transform: rotate(180deg) scale(1); }
  75%  { transform: rotate(270deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes sortilegeSigilCollapse {
  0%   { transform: scale(1) rotate(0deg); opacity: 1; }
  60%  { transform: scale(2.5) rotate(180deg); opacity: 0.8; }
  100% { transform: scale(0) rotate(360deg); opacity: 0; }
}

.sortilege-result {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-size: clamp(1.4rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #fffbe8 0%, #f7d96a 30%, #f0c040 60%, #e8a820 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter:
    drop-shadow(0 0 16px rgba(255,210,60,0.95))
    drop-shadow(0 0 40px rgba(200,120,20,0.7));
  opacity: 0;
  text-align: center;
  max-width: 80vw;
}

.sortilege-dismiss {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.75rem;
  color: rgba(180, 150, 220, 0.6);
  letter-spacing: 0.1em;
  opacity: 0;
  margin-top: 0.5rem;
}

@media (max-width: 700px) {
  .sortilege-btn {
    bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 0.75rem);
    right: 1rem;
    padding: 0.6rem 0.8rem 0.5rem;
  }
  .sortilege-glyph { font-size: 1.2rem; }
  .sortilege-label { font-size: 0.52rem; }
}

/* ══════════════════════════════════════
   THE ATLAS — World Map Section
══════════════════════════════════════ */

.atlas-section-main {
  padding: 0 !important;
  min-height: 80vh;
}

.atlas-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.atlas-header {
  text-align: center;
  padding: 2rem 0 1.2rem;
}

.atlas-header-rune {
  font-family: serif;
  color: #8a6a3a;
  letter-spacing: 0.4em;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.atlas-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: #e8c97a;
  text-shadow: 0 0 30px rgba(200, 160, 40, 0.5);
  margin: 0 0 0.6rem;
}

.atlas-desc {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: #b8a88a;
  font-size: 0.95rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.atlas-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.atlas-search-container {
  position: relative;
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  background: rgba(12, 4, 28, 0.75);
  border: 1px solid rgba(200, 160, 60, 0.35);
  border-radius: 4px;
}

.atlas-search-icon {
  padding: 0 0.6rem 0 0.9rem;
  color: #8a7040;
  font-size: 1rem;
  pointer-events: none;
}

.atlas-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e8d8b8;
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  padding: 0.55rem 0;
}

.atlas-search-input::placeholder {
  color: #5a4a30;
  font-style: italic;
}

.atlas-search-clear {
  background: none;
  border: none;
  color: #5a4a30;
  cursor: pointer;
  padding: 0 0.7rem;
  font-size: 0.75rem;
  transition: color 0.2s;
}

.atlas-search-clear:hover { color: #c9a060; }

.atlas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}

.atlas-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: 'IM Fell English', serif;
  font-size: 0.78rem;
  color: #9a8a6a;
  letter-spacing: 0.03em;
}

.atlas-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}

.atlas-map-container {
  width: 100%;
  height: 540px;
  border-radius: 4px;
  border: 1px solid rgba(200, 160, 60, 0.3);
  box-shadow: 0 0 40px rgba(0,0,0,0.7), inset 0 0 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* Leaflet popup overrides for dark theme */
.atlas-popup-wrap .leaflet-popup-content-wrapper {
  background: rgba(8, 2, 20, 0.97);
  border: 1px solid rgba(200, 160, 60, 0.45);
  border-radius: 3px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.8);
  color: #c8b890;
  font-family: 'IM Fell English', serif;
}

.atlas-popup-wrap .leaflet-popup-tip {
  background: rgba(8, 2, 20, 0.97);
}

.atlas-popup-wrap .leaflet-popup-close-button {
  color: #6a5a3a !important;
}

.atlas-popup {
  padding: 0.2rem 0.1rem;
  min-width: 160px;
}

.atlas-popup-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
  font-family: 'Cinzel', serif;
}

.atlas-popup-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #e8c97a;
  margin-bottom: 0.2rem;
}

.atlas-popup-region {
  font-size: 0.82rem;
  color: #a89870;
  margin-bottom: 0.1rem;
}

.atlas-popup-origin {
  font-size: 0.75rem;
  color: #6a5a40;
  font-style: italic;
  margin-bottom: 0.6rem;
}

.atlas-popup-btn {
  background: none;
  border: 1px solid rgba(200, 160, 60, 0.4);
  color: #c9a040;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s;
  width: 100%;
}

.atlas-popup-btn:hover {
  background: rgba(200, 160, 60, 0.15);
  color: #e8c060;
}

/* Leaflet marker container reset */
.atlas-marker-wrap { background: none !important; border: none !important; }

.atlas-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform 0.15s;
}

.atlas-marker:hover { transform: scale(1.5); }

/* ── Creature modal mini-map ──────────────────── */

.creature-minimap-wrap {
  padding: 1.5rem 2.5rem 0.5rem;
  border-top: 1px solid rgba(120, 90, 40, 0.25);
  margin-top: 1rem;
}

.creature-minimap-wrap .book-section-head {
  margin-bottom: 0.8rem;
}

.creature-minimap {
  width: 100%;
  height: 200px;
  border-radius: 3px;
  border: 1px solid rgba(120, 90, 40, 0.35);
  box-shadow: 0 2px 16px rgba(0,0,0,0.5);
  overflow: hidden;
}

.minimap-region-label {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: #8a7050;
  font-size: 0.8rem;
  text-align: center;
  margin: 0.4rem 0 0;
  letter-spacing: 0.03em;
}

/* ── Atlas responsive ─────────────────────────── */
@media (max-width: 700px) {
  .atlas-map-container { height: 380px; }
  .atlas-legend { gap: 0.4rem 0.7rem; }
  .atlas-legend-item { font-size: 0.72rem; }
  .creature-minimap { height: 160px; }
  .creature-minimap-wrap { padding: 1rem 1rem 0.3rem; }
}

/* ══════════════════════════════════════════════════
   APP-MODE MOBILE — Full native feel
   Breakpoint: ≤ 700px
   ══════════════════════════════════════════════════ */

@media (max-width: 700px) {

  /* ── Global touch baseline ─────────────────────── */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body {
    /* Reserve space for the fixed bottom tab bar + safe area */
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  * {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  button, a, [role="button"] {
    user-select: none;
    -webkit-user-select: none;
  }

  /* ── BOTTOM TAB BAR — replaces top section tabs ── */
  .section-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    z-index: 200;
    display: flex;
    flex-direction: row;
    justify-content: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: rgba(4, 1, 14, 0.97);
    border-top: 1px solid rgba(140,60,200,0.45);
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.8), 0 -1px 0 rgba(120,40,180,0.2);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .section-tabs::-webkit-scrollbar { display: none; }

  .section-tab {
    flex: 1;
    min-width: 60px;
    flex-shrink: 0;
    padding: 10px 6px 8px;
    font-size: 0.5rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: none !important;
    border-top: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 56px;
    transition: background 0.15s, color 0.15s;
  }
  .section-tab::before {
    content: attr(data-icon);
    font-size: 1.1rem;
    line-height: 1;
    display: block;
  }
  .section-tab[data-section="bestiary"]::before  { content: '📖'; }
  .section-tab[data-section="spells"]::before    { content: '⚗️'; }
  .section-tab[data-section="quiz"]::before      { content: '🔮'; }
  .section-tab[data-section="communion"]::before { content: '🕯️'; }
  .section-tab[data-section="atlas"]::before     { content: '🗺️'; }

  .section-tab::after {
    display: none !important;
  }
  .section-tab.active {
    color: rgba(220,180,255,1) !important;
    border-top-color: rgba(200,120,255,0.9);
    background: rgba(120,40,180,0.18);
    text-shadow: 0 0 10px rgba(200,120,255,0.5) !important;
  }
  .section-tab:active {
    background: rgba(100,30,160,0.35);
  }

  /* ── HEADER — compact ──────────────────────────── */
  .grimoire-header {
    padding: env(safe-area-inset-top, 0px) 1rem 0.9rem;
    padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
  }
  .rune-row {
    font-size: 0;
    letter-spacing: 0;
    margin-bottom: 0.4rem;
    animation: none;
    opacity: 1;
  }
  .rune-row .rune-tree-of-life {
    font-size: 1rem;
    display: inline-flex;
    margin: 0;
  }
  .rune-tree-of-life svg { width: 2rem; height: 2.4rem; }
  .subtitle-scroll { display: none; }
  .header-tagline { display: none; }
  .torch { display: none; }
  .header-border-top { height: 4px; }
  .header-border-bottom { height: 3px; }
  .grimoire-title {
    font-size: clamp(1.6rem, 9vw, 2.4rem);
    margin-bottom: 0;
    letter-spacing: 0.12em;
  }

  /* ── SEARCH BAR ────────────────────────────────── */
  .search-bar-wrapper {
    padding: 0.55rem 0.75rem;
    top: 0;
    z-index: 150;
  }
  .search-container {
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
  }
  #searchInput {
    font-size: 1rem; /* 16px — prevents iOS auto-zoom */
    min-height: 32px;
  }
  .search-clear {
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Filter buttons — pill row, no wrap */
  .filter-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
    scrollbar-width: none;
    padding-bottom: 3px;
    gap: 0.35rem;
  }
  .filter-buttons::-webkit-scrollbar { display: none; }
  .filter-btn {
    flex-shrink: 0;
    min-height: 36px;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    font-size: 0.68rem;
  }
  .filter-btn.active {
    background: rgba(140,40,200,0.40);
  }

  /* ── TIER LEGEND BAR ───────────────────────────── */
  .tier-legend-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 0.4rem 0.75rem;
    scrollbar-width: none;
    gap: 0.6rem;
    font-size: 0.62rem;
  }
  .tier-legend-bar::-webkit-scrollbar { display: none; }

  /* ── BESTIARY GRID ─────────────────────────────── */
  .grimoire-main {
    padding: 1rem 0.65rem;
  }
  .entries-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }
  .creature-card {
    cursor: pointer;
  }
  .creature-card:hover {
    transform: none !important;
    box-shadow: none !important;
  }
  .creature-card:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s !important;
  }
  .card-page-border {
    padding: 0.65rem 0.65rem 0;
    margin: 5px;
  }
  .card-illumination {
    width: 44px;
    height: 44px;
    margin-bottom: 0.5rem;
  }
  .card-name {
    font-size: 0.78rem;
  }
  .card-origin {
    font-size: 0.65rem;
    margin-bottom: 0.3rem;
  }
  .card-excerpt {
    font-size: 0.74rem;
    -webkit-line-clamp: 2;
    line-height: 1.45;
  }
  .card-footer-bar {
    padding: 0.4rem 0 0.45rem;
  }
  .card-danger-stars {
    font-size: 0.6rem;
    letter-spacing: 0.05em;
  }

  /* ── SPELLS GRID ───────────────────────────────── */
  .spells-grid {
    grid-template-columns: 1fr;
    padding: 1rem 0.65rem;
  }

  /* ── CHAPTER NAV — hide on mobile ──────────────── */
  .chapter-nav { display: none !important; }

  /* ── CREATURE MODAL — full-screen drawer ──────── */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .modal-book {
    max-height: 94vh;
    height: 94vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: slideUpDrawer 0.32s cubic-bezier(0.32, 0.72, 0, 1) both;
    border-bottom: none;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  }
  @keyframes slideUpDrawer {
    from { transform: translateY(100%); opacity: 0.6; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  /* Drag handle pill */
  .modal-book::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(180,130,220,0.35);
    border-radius: 2px;
    margin: 0.75rem auto 0;
    flex-shrink: 0;
  }
  .book-columns {
    flex-direction: column;
  }
  .book-margin-col {
    display: none;
  }
  .book-main-col {
    padding: 0 0.9rem 1rem;
    border-right: none;
  }
  .book-title-block {
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem 0.9rem 0.5rem;
  }
  .book-creature-photo-wrap {
    height: 220px;
  }
  .book-folio { padding: 0.3rem 0.9rem 0; }
  .book-chapter-rule { padding: 0 0.9rem; }
  .book-page-num { margin: 0 0.9rem; }
  .drop-cap::first-letter { font-size: 2.2em; }

  /* Modal close button — larger tap target */
  .modal-close-btn {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* ── SPELL MODAL ────────────────────────────────── */
  .spell-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .spell-modal-book {
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpDrawer 0.32s cubic-bezier(0.32, 0.72, 0, 1) both;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ── COMMUNION ──────────────────────────────────── */
  .communion-cat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0.75rem 0.65rem;
  }
  .communion-cat-tabs::-webkit-scrollbar { display: none; }
  .communion-cat-tab { flex-shrink: 0; min-height: 38px; }
  .communion-tag-cloud { padding: 0 0.75rem 0.75rem; }
  .communion-feed { padding: 0 0.65rem; }

  .testimony-modal-overlay,
  .communion-form-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .testimony-modal-book,
  .communion-form-book {
    max-height: 95vh;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding: 1.4rem 1rem 1.2rem;
    animation: slideUpDrawer 0.32s cubic-bezier(0.32, 0.72, 0, 1) both;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.2rem);
  }

  /* ── QUIZ ───────────────────────────────────────── */
  .quiz-result-three { flex-direction: column; gap: 0.85rem; }
  .quiz-result-col   { width: 100%; }
  .quiz-card {
    margin: 0 0.25rem;
    padding: 1.2rem 1rem;
  }
  .quiz-options {
    gap: 0.55rem;
  }
  .quiz-option-btn {
    min-height: 52px;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    line-height: 1.35;
    border-radius: 8px;
  }
  .quiz-begin-btn {
    min-height: 52px;
    padding: 0.85rem 2rem;
    font-size: 0.85rem;
  }

  /* ── ATLAS ──────────────────────────────────────── */
  .atlas-map-container { height: 340px; border-radius: 6px; }
  .atlas-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: 0.35rem 0.7rem;
    padding-bottom: 2px;
  }
  .atlas-legend::-webkit-scrollbar { display: none; }
  .atlas-legend-item { flex-shrink: 0; font-size: 0.7rem; }
  .atlas-search-input, .atlas-search-btn {
    font-size: 1rem;
    min-height: 40px;
  }
  .creature-minimap { height: 150px; }
  .creature-minimap-wrap { padding: 0.75rem 0.9rem 0.3rem; }

  /* ── INTRO ──────────────────────────────────────── */
  .intro-torch { display: none; }
  .prompt-main  { font-size: 0.85rem; }
  .prompt-sub   { font-size: 0.72rem; padding: 0 1.2rem; }
  .enter-btn    { min-height: 52px; padding: 0.9rem 2rem; font-size: 0.8rem; }

  /* ── MISC POLISH ────────────────────────────────── */
  .tier-section-break { padding: 1.6rem 0.75rem 1rem; }
  .tier-break-title   { font-size: 1.1rem; }

  /* Ensure all modals cover the notch area properly */
  .modal-overlay,
  .spell-modal-overlay,
  .testimony-modal-overlay,
  .communion-form-overlay {
    padding-top: env(safe-area-inset-top, 0px);
  }
}
