/* =========================================================
   The Cartographer's Sanctum — Art Direction
   Dark medieval fantasy · candlelight · parchment · brass
   ========================================================= */

:root {
  --ink: #1a1410;
  --ink-soft: #2a2118;
  --parchment: #e8d5b0;
  --parchment-deep: #c4a574;
  --parchment-stain: #b8956a;
  --gold: #c9a227;
  --gold-bright: #e8c547;
  --brass: #b08d57;
  --brass-ox: #8a6a3e;
  --walnut: #3d2914;
  --walnut-deep: #24180c;
  --stone: #4a453c;
  --stone-lit: #6b6358;
  --moon: #a8c0d4;
  --ember: #d4783a;
  --blood: #8b3a2f;
  --forest: #3d5c3a;
  --river: #3a6b7a;
  --fog: rgba(180, 190, 200, 0.12);
  --glow-candle: rgba(255, 180, 80, 0.22);
  --glow-gold: rgba(201, 162, 39, 0.45);
  --shadow-deep: rgba(0, 0, 0, 0.65);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body: "Cormorant Garamond", Georgia, serif;
  --font-hand: "IM Fell English", Georgia, serif;
  --ease-ceremonial: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-ink: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  background: #0b0907;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
}

img, video, svg { max-width: 100%; height: auto; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10000;
  background: var(--gold);
  color: var(--ink);
  padding: 0.5rem 1rem;
  font-family: var(--font-display);
  text-decoration: none;
  border-radius: 2px;
}
.skip-link:focus { top: 1rem; }

/* ---------- PORTAL ---------- */
.portal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, #2a1c10 0%, #0b0907 70%),
    #0b0907;
  transition: opacity 1.2s var(--ease-ceremonial), visibility 1.2s;
}
.portal.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.portal.is-gone { display: none; }

#ink-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
}

.portal-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, transparent 10%, rgba(0,0,0,0.55) 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    );
  pointer-events: none;
}

.portal-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem 1.25rem;
  max-width: 36rem;
  animation: portalRise 1.4s var(--ease-ceremonial) both;
}

@keyframes portalRise {
  from { opacity: 0; transform: translateY(24px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

.portal-eyebrow {
  font-family: var(--font-hand);
  font-style: italic;
  color: var(--brass);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  margin: 0 0 0.75rem;
}

.portal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.75rem, 6vw, 3rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  color: var(--parchment);
  text-shadow:
    0 0 40px rgba(201, 162, 39, 0.35),
    0 2px 12px rgba(0,0,0,0.8);
  letter-spacing: 0.04em;
}

.portal-sub {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(232, 213, 176, 0.78);
  margin: 0 0 1.75rem;
  font-style: italic;
}

.enter-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  background:
    linear-gradient(180deg, rgba(201,162,39,0.18), rgba(61,41,20,0.85));
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.95rem 1.75rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 0 30px rgba(201,162,39,0.25),
    inset 0 1px 0 rgba(255,230,160,0.2);
  transition: transform 0.25s var(--ease-ceremonial), box-shadow 0.25s, border-color 0.25s;
}
.enter-btn:hover,
.enter-btn:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold-bright);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 0 48px rgba(201,162,39,0.45),
    inset 0 1px 0 rgba(255,230,160,0.35);
  outline: none;
}
.enter-btn:active { transform: translateY(0); }
.enter-btn-glow {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent, rgba(201,162,39,0.25), transparent 40%);
  animation: spinGlow 8s linear infinite;
  pointer-events: none;
}
.enter-btn-label { position: relative; z-index: 1; }

@keyframes spinGlow {
  to { transform: rotate(360deg); }
}

.portal-hint {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: rgba(232, 213, 176, 0.45);
  letter-spacing: 0.08em;
}

.portal-tear {
  position: absolute;
  inset: 40% 20%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,0.15), transparent 70%);
  filter: blur(30px);
  animation: tearPulse 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes tearPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.08); }
}

/* ---------- SANCTUM CHAMBER ---------- */
.sanctum {
  position: relative;
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.4s var(--ease-ceremonial), transform 1.6s var(--ease-ceremonial);
}
.sanctum.is-hidden { visibility: hidden; pointer-events: none; }
.sanctum.is-revealed {
  opacity: 1;
  transform: none;
  visibility: visible;
  pointer-events: auto;
}

.chamber-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.stone-wall {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% 100%, #1c1510 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 0%, #151a22 0%, transparent 50%),
    linear-gradient(180deg, #12141a 0%, #1a1410 40%, #0e0b08 100%);
}
.stone-wall::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent 48px, rgba(0,0,0,0.4) 49px),
    repeating-linear-gradient(0deg, transparent, transparent 22px, rgba(0,0,0,0.25) 23px);
}

.celestial-ceiling {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 38%;
  background:
    radial-gradient(ellipse 70% 80% at 50% 0%, rgba(40, 55, 80, 0.55), transparent 70%),
    radial-gradient(circle at 20% 20%, rgba(168, 192, 212, 0.08), transparent 25%),
    radial-gradient(circle at 75% 15%, rgba(201, 162, 39, 0.06), transparent 20%);
}

.constellation {
  position: absolute;
  inset: 0 0 50% 0;
  opacity: 0.55;
}

.constellation .star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #e8f0ff;
  border-radius: 50%;
  box-shadow: 0 0 4px #fff;
  animation: twinkle var(--d, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.4); }
}

.dust .mote {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 220, 160, 0.45);
  border-radius: 50%;
  animation: floatMote var(--d, 12s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}
@keyframes floatMote {
  0% { transform: translateY(20vh) translateX(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.4; }
  100% { transform: translateY(-30vh) translateX(20px); opacity: 0; }
}

.candle-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-candle), transparent 70%);
  filter: blur(8px);
  animation: flicker 4s ease-in-out infinite;
  opacity: 0.7;
}
.candle-l { left: -40px; bottom: 10%; animation-delay: 0s; }
.candle-r { right: -40px; bottom: 18%; animation-delay: 1.2s; }
.candle-c { left: 50%; bottom: -40px; transform: translateX(-50%); width: 420px; height: 200px; animation-delay: 0.6s; }

@keyframes flicker {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  30% { opacity: 0.8; transform: scale(1.04); }
  55% { opacity: 0.5; transform: scale(0.98); }
  80% { opacity: 0.75; transform: scale(1.02); }
}
.candle-c { /* keep centering */ }
.sanctum .candle-c { transform: translateX(-50%); }

.shelf {
  position: absolute;
  top: 12%;
  bottom: 18%;
  width: min(12vw, 110px);
  background:
    linear-gradient(90deg, rgba(0,0,0,0.5), transparent),
    repeating-linear-gradient(
      180deg,
      #2a1c12 0px,
      #3d2914 14px,
      #1a120a 15px,
      #1a120a 28px
    );
  opacity: 0.55;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.6);
}
.shelf-l { left: 0; border-right: 2px solid rgba(176, 141, 87, 0.25); }
.shelf-r { right: 0; border-left: 2px solid rgba(176, 141, 87, 0.25); transform: scaleX(-1); }

.beams {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, transparent 40%, rgba(255,200,120,0.03) 50%, transparent 60%),
    linear-gradient(75deg, transparent 35%, rgba(168,192,212,0.04) 48%, transparent 58%);
  mix-blend-mode: screen;
}

/* ---------- RITUAL BAR ---------- */
.ritual-bar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1rem;
  background:
    linear-gradient(180deg, rgba(20,14,10,0.92), rgba(20,14,10,0.55));
  border-bottom: 1px solid rgba(176, 141, 87, 0.28);
  backdrop-filter: blur(8px);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.compass-mini {
  color: var(--gold);
  display: grid;
  place-items: center;
  animation: compassSpin 40s linear infinite;
}
@keyframes compassSpin {
  to { transform: rotate(360deg); }
}
.brand-kicker {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
  font-family: var(--font-display);
}
.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2.5vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--parchment);
  white-space: nowrap;
}

.search-parchment {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 520px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, #f0e0c0 0%, #d4b88a 100%);
  border: 1px solid var(--brass-ox);
  box-shadow:
    0 4px 20px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -2px 8px rgba(90,60,20,0.15);
  border-radius: 2px;
  display: flex;
  align-items: center;
  padding: 0 0.5rem 0 0.65rem;
  transform: rotate(-0.3deg);
}
.search-parchment::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.search-quill {
  color: var(--walnut);
  font-size: 1rem;
  opacity: 0.7;
  margin-right: 0.35rem;
}
#search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--ink);
  padding: 0.7rem 0.25rem;
  outline: none;
}
#search-input::placeholder {
  color: rgba(36, 24, 12, 0.45);
  font-style: italic;
}
#search-input:focus {
  box-shadow: none;
}
.search-parchment:focus-within {
  box-shadow:
    0 0 0 2px rgba(201,162,39,0.55),
    0 6px 28px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.35);
}
.search-kbd {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: rgba(36,24,12,0.45);
  border: 1px solid rgba(36,24,12,0.2);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.25rem;
}
.search-ink {
  position: absolute;
  left: 1.5rem;
  right: 2rem;
  bottom: 4px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ink), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s var(--ease-ink);
  opacity: 0.5;
}
.search-parchment.is-writing .search-ink {
  transform: scaleX(1);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: linear-gradient(180deg, #efe0c0, #d8c09a);
  border: 1px solid var(--brass-ox);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  max-height: 280px;
  overflow: auto;
  color: var(--ink);
}
.search-results[hidden] { display: none; }
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid rgba(61,41,20,0.12);
}
.search-result:hover,
.search-result:focus-visible,
.search-result.is-active {
  background: rgba(201,162,39,0.22);
  outline: none;
}
.search-result small {
  display: block;
  opacity: 0.65;
  font-family: var(--font-hand);
  font-style: italic;
}

.ritual-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.icon-relic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 3.25rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid rgba(176,141,87,0.35);
  background: linear-gradient(180deg, rgba(61,41,20,0.65), rgba(20,14,10,0.85));
  color: var(--parchment);
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  font-family: var(--font-display);
}
.icon-relic:hover,
.icon-relic:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201,162,39,0.3);
  outline: none;
  transform: translateY(-1px);
}
.icon-relic[aria-pressed="true"] {
  border-color: var(--gold-bright);
  box-shadow: 0 0 20px rgba(201,162,39,0.45), inset 0 0 12px rgba(201,162,39,0.15);
  color: var(--gold-bright);
}
.relic-icon { font-size: 1rem; line-height: 1; }
.relic-label {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

/* ---------- MAIN STAGE ---------- */
.main-stage {
  position: relative;
  z-index: 10;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem 0.35rem;
}

@media (min-width: 720px) {
  .main-stage {
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(200px, 280px);
    grid-template-rows: 1fr;
    gap: 0.85rem;
    padding: 0.85rem 1rem 0.4rem;
  }
}

@media (min-width: 1100px) {
  .main-stage {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(260px, 340px);
  }
}

.wing {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  min-width: 0;
}
.wing-left { order: 2; }
.wing-right { order: 3; }
.map-table-wrap { order: 1; min-width: 0; }

@media (min-width: 720px) {
  .wing-left { order: 1; }
  .map-table-wrap { order: 2; }
  .wing-right { order: 3; }
}

.panel-card {
  background:
    linear-gradient(165deg, rgba(45, 32, 20, 0.88), rgba(18, 12, 8, 0.92));
  border: 1px solid rgba(176, 141, 87, 0.28);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,220,160,0.06);
  border-radius: 3px;
  padding: 0.75rem;
  min-height: 0;
}
.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.panel-head p {
  margin: 0.2rem 0 0.65rem;
  font-family: var(--font-hand);
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(232,213,176,0.55);
}

/* Collections as leather books */
.book-shelf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 200px;
  overflow: auto;
}
@media (min-width: 720px) {
  .book-shelf { max-height: min(28vh, 240px); }
}

.book-item {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  border-radius: 2px;
  transition: transform 0.3s var(--ease-ceremonial);
}
.book-item:hover,
.book-item:focus-visible {
  transform: translateX(6px);
  outline: none;
}
.book-item.is-active .book-spine {
  box-shadow: 0 0 16px rgba(201,162,39,0.45);
  border-color: var(--gold);
}
.book-spine {
  width: 10px;
  flex-shrink: 0;
  border-radius: 2px 0 0 2px;
  border: 1px solid rgba(0,0,0,0.4);
  background:
    linear-gradient(90deg, rgba(0,0,0,0.35), transparent 40%),
    linear-gradient(180deg, var(--spine, #5c3a1e), #2a180c);
  box-shadow: inset -2px 0 0 rgba(201,162,39,0.25);
}
.book-body {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  background:
    linear-gradient(90deg, #4a3018, #2e1c0e);
  border: 1px solid rgba(176,141,87,0.25);
  border-left: 0;
  border-radius: 0 2px 2px 0;
}
.book-body strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--parchment);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-body span {
  font-size: 0.75rem;
  color: rgba(232,213,176,0.5);
  font-family: var(--font-hand);
  font-style: italic;
}

/* Worlds rail */
.worlds-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.worlds-rail {
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.25rem;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 720px) {
  .worlds-rail {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
  }
}

.world-card {
  flex: 0 0 auto;
  width: 150px;
  border: 1px solid rgba(176,141,87,0.3);
  background: linear-gradient(160deg, #2c1e12, #15100c);
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  border-radius: 3px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.25s, transform 0.25s;
}
@media (min-width: 720px) {
  .world-card { width: 100%; }
}
.world-card:hover,
.world-card:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201,162,39,0.25);
  outline: none;
  transform: translateY(-2px);
}
.world-card.is-active {
  border-color: var(--gold-bright);
  box-shadow: 0 0 24px rgba(201,162,39,0.4), inset 0 0 20px rgba(201,162,39,0.08);
}
.world-art {
  height: 64px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.world-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(10,8,6,0.9));
}
.world-info {
  padding: 0.45rem 0.55rem 0.55rem;
}
.world-info strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}
.world-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.68rem;
  color: rgba(232,213,176,0.55);
  font-family: var(--font-hand);
}
.world-meta .rating { color: var(--gold); }
.completion-bar {
  margin-top: 0.35rem;
  height: 3px;
  background: rgba(0,0,0,0.4);
  border-radius: 2px;
  overflow: hidden;
}
.completion-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brass), var(--gold-bright));
  border-radius: 2px;
}

/* ---------- MAP TABLE ---------- */
.map-table-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  position: relative;
}

.table-pedestal {
  position: relative;
  width: 100%;
  max-width: 920px;
  flex: 1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
}

.table-rim {
  position: absolute;
  inset: -6px -6px 18px;
  border-radius: 12px 12px 6px 6px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,162,39,0.15), transparent 50%),
    linear-gradient(180deg, #4a3420, #1a120c);
  box-shadow:
    0 20px 50px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,220,160,0.12);
  border: 1px solid rgba(176,141,87,0.4);
  z-index: 0;
}
.table-brass {
  position: absolute;
  inset: 2px 2px 26px;
  border-radius: 10px 10px 4px 4px;
  border: 2px solid rgba(176,141,87,0.45);
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.5),
    0 0 40px rgba(201,162,39,0.08);
  pointer-events: none;
  z-index: 3;
}
.table-brass::before,
.table-brass::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--brass);
  border-radius: 50%;
  top: 10px;
  box-shadow: 0 0 8px rgba(201,162,39,0.4);
}
.table-brass::before { left: 10px; }
.table-brass::after { right: 10px; }

.map-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 240px;
  margin: 8px 8px 28px;
  border-radius: 6px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: #1a1510;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5);
}
.map-stage:active { cursor: grabbing; }
.map-stage:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.map-stage.is-inspecting {
  transform: scale(1.02);
  transition: transform 0.55s var(--ease-ceremonial);
  box-shadow:
    inset 0 0 80px rgba(0,0,0,0.55),
    0 0 40px rgba(201,162,39,0.15);
}
.map-stage.is-inspecting #map-canvas {
  filter: contrast(1.05) saturate(1.05);
}

#map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-pins {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.55));
  animation: pinFloat 3.5s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  transition: transform 0.35s var(--ease-ceremonial), filter 0.25s;
  z-index: 1;
}
.map-pin:hover,
.map-pin:focus-visible,
.map-pin.is-focused {
  transform: translate(-50%, -100%) scale(1.25) translateY(-4px);
  filter: drop-shadow(0 0 12px rgba(201,162,39,0.7));
  outline: none;
  z-index: 6;
}
.map-pin.is-selected {
  z-index: 7;
  filter: drop-shadow(0 0 16px rgba(232, 197, 71, 0.9));
}
.map-pin.is-bookmarked .pin-glyph {
  color: var(--gold-bright);
}
.map-pin.is-dim {
  opacity: 0.22;
  pointer-events: none;
}
.map-pin .pin-glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 34px;
  font-size: 1.05rem;
  color: var(--parchment);
  background:
    radial-gradient(circle at 50% 30%, rgba(201,162,39,0.35), transparent 60%),
    linear-gradient(180deg, #5a4030, #2a1a10);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  border: 1px solid rgba(201,162,39,0.4);
  line-height: 1;
  padding-bottom: 6px;
}
.map-pin .pin-label {
  position: absolute;
  left: 50%;
  top: -1.4rem;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: var(--font-hand);
  font-size: 0.68rem;
  color: var(--parchment);
  background: rgba(20,14,10,0.82);
  border: 1px solid rgba(176,141,87,0.35);
  padding: 0.1rem 0.4rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.map-pin:hover .pin-label,
.map-pin:focus-visible .pin-label,
.map-pin.is-focused .pin-label,
.map-pin.is-selected .pin-label {
  opacity: 1;
}

@keyframes pinFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

.map-threads {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.map-threads svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.map-threads path {
  fill: none;
  stroke: rgba(201, 162, 39, 0.45);
  stroke-width: 1.5;
  stroke-dasharray: 4 6;
  animation: dashMove 20s linear infinite;
}
@keyframes dashMove {
  to { stroke-dashoffset: -200; }
}

.map-fog {
  position: absolute;
  inset: -10%;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 40% 30% at 30% 40%, rgba(200,210,220,0.12), transparent 70%),
    radial-gradient(ellipse 35% 25% at 70% 55%, rgba(180,190,200,0.1), transparent 70%);
  animation: fogDrift 28s ease-in-out infinite alternate;
  mix-blend-mode: screen;
  opacity: 0.7;
}
@keyframes fogDrift {
  from { transform: translate(-2%, 1%); }
  to { transform: translate(3%, -2%); }
}

.map-ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(201,162,39,0.7);
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}
.map-ripple.is-active {
  animation: ripple 0.9s var(--ease-ceremonial) forwards;
}
@keyframes ripple {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(12); opacity: 0; }
}

.map-vignette {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 65% at 50% 50%, transparent 40%, rgba(10,8,6,0.55) 100%);
}
.map-breath {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(201,162,39,0.05);
  animation: mapBreathe 8s ease-in-out infinite;
}
@keyframes mapBreathe {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.map-stage.is-night .map-vignette {
  background: radial-gradient(ellipse 70% 65% at 50% 50%, transparent 30%, rgba(5,10,20,0.7) 100%);
}
.map-stage.is-night #map-canvas {
  filter: brightness(0.72) saturate(0.85) hue-rotate(12deg);
}
.map-stage.weather-storm #map-canvas {
  filter: brightness(0.65) contrast(1.1) saturate(0.7);
}
.map-stage.weather-storm .map-fog {
  opacity: 1;
  background:
    radial-gradient(ellipse 50% 40% at 40% 30%, rgba(120,130,150,0.25), transparent 70%),
    radial-gradient(ellipse 40% 35% at 70% 60%, rgba(100,110,130,0.2), transparent 70%);
}
.map-stage.weather-clear .map-fog { opacity: 0.25; }

.table-legs {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 22px;
  background:
    linear-gradient(180deg, #2a1c12, #120c08);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.5);
  z-index: 0;
}

/* Relic ring filters */
.relic-ring {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  max-width: 920px;
  padding: 0.15rem 0 0.35rem;
  max-height: 88px;
  overflow: auto;
}

.relic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 3rem;
  padding: 0.35rem 0.4rem;
  border: 1px solid rgba(176,141,87,0.3);
  background:
    radial-gradient(circle at 50% 30%, rgba(201,162,39,0.12), transparent 60%),
    linear-gradient(180deg, #2e2014, #14100c);
  color: var(--parchment);
  cursor: pointer;
  border-radius: 999px;
  font-family: var(--font-display);
  transition: all 0.25s var(--ease-ceremonial);
}
.relic:hover,
.relic:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(201,162,39,0.35);
  outline: none;
  transform: translateY(-2px);
}
.relic.is-active {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  box-shadow:
    0 0 18px rgba(201,162,39,0.5),
    inset 0 0 12px rgba(201,162,39,0.15);
  background:
    radial-gradient(circle at 50% 30%, rgba(201,162,39,0.35), transparent 65%),
    linear-gradient(180deg, #3d2a14, #1a120c);
}
.relic-sym { font-size: 0.95rem; line-height: 1; }
.relic-name {
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.8;
}

.map-legend {
  font-family: var(--font-hand);
  font-style: italic;
  font-size: 0.8rem;
  color: rgba(232,213,176,0.6);
  text-align: center;
  padding: 0.15rem 0 0.25rem;
}
.map-legend .dot { margin: 0 0.35rem; opacity: 0.4; }

/* ---------- ATLAS BOOK ---------- */
.atlas-book {
  position: relative;
  flex: 1;
  min-height: 220px;
  background:
    linear-gradient(100deg, #1a1008 0%, #2a1a0e 8%, #3d2814 12%, #2a1a0e 100%);
  border: 1px solid rgba(176,141,87,0.4);
  border-radius: 2px 6px 6px 2px;
  box-shadow:
    0 16px 40px rgba(0,0,0,0.5),
    inset 4px 0 0 rgba(201,162,39,0.25),
    inset 0 0 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.atlas-cover-edge {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 10px;
  background:
    repeating-linear-gradient(
      180deg,
      #5a3a18 0px,
      #3d2814 3px,
      #2a1a0e 6px
    );
  border-right: 1px solid rgba(201,162,39,0.35);
  z-index: 2;
}
.atlas-pages {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  margin-left: 10px;
}
.atlas-page {
  position: relative;
  background:
    linear-gradient(180deg, #efe2c4 0%, #e0cda8 50%, #d4bc90 100%);
  color: var(--ink);
}
.left-page {
  display: none;
  width: 8px;
  flex-shrink: 0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  background: linear-gradient(90deg, #c4a878, #e8d5b0);
}
@media (min-width: 1100px) {
  .left-page { display: block; }
}
.right-page {
  flex: 1;
  min-width: 0;
  overflow: auto;
  box-shadow: inset 8px 0 16px rgba(90,60,20,0.08);
}
.page-stain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.15;
  background:
    radial-gradient(circle at 80% 20%, rgba(120,80,40,0.4), transparent 30%),
    radial-gradient(circle at 20% 80%, rgba(90,60,30,0.3), transparent 25%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.atlas-inner {
  position: relative;
  z-index: 1;
  padding: 1rem 1rem 1.25rem 1.15rem;
  font-family: var(--font-body);
  animation: pageTurn 0.45s var(--ease-ceremonial);
}
@keyframes pageTurn {
  from { opacity: 0; transform: translateX(12px) rotateY(-6deg); }
  to { opacity: 1; transform: none; }
}

.atlas-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-ox);
}
.atlas-title {
  margin: 0.25rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.atlas-rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61,41,20,0.35), transparent);
  margin: 0.5rem 0 0.75rem;
}
.atlas-body {
  font-size: 0.98rem;
  line-height: 1.5;
  color: rgba(26,20,16,0.88);
}
.atlas-body p { margin: 0 0 0.65rem; }
.atlas-body em { font-family: var(--font-hand); }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.5rem 0;
}
.stat-cell {
  background: rgba(61,41,20,0.08);
  border: 1px solid rgba(61,41,20,0.12);
  padding: 0.4rem 0.5rem;
  border-radius: 2px;
}
.stat-cell b {
  display: block;
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brass-ox);
  font-weight: 500;
}
.stat-cell span {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--ink);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.5rem 0;
}
.tag {
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.4rem;
  border: 1px solid rgba(61,41,20,0.25);
  color: var(--walnut);
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
}

.note-card {
  margin: 0.5rem 0;
  padding: 0.55rem 0.65rem;
  background: rgba(255,248,230,0.55);
  border: 1px dashed rgba(61,41,20,0.25);
  border-radius: 2px;
  font-family: var(--font-hand);
  font-style: italic;
  font-size: 0.9rem;
  transform: rotate(-0.4deg);
  box-shadow: 1px 2px 0 rgba(61,41,20,0.08);
}
.note-card .seal {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c44, #6b1e1e);
  vertical-align: middle;
  margin-right: 0.35rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.atlas-empty {
  text-align: center;
  padding: 2rem 1rem;
  font-family: var(--font-hand);
  font-style: italic;
  color: rgba(36,24,12,0.55);
}
.atlas-empty .big {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.atlas-tabs {
  display: flex;
  border-top: 1px solid rgba(176,141,87,0.3);
  background: linear-gradient(180deg, #2a1a0e, #1a1008);
}
.atlas-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgba(232,213,176,0.55);
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.55rem 0.25rem;
  cursor: pointer;
  border-right: 1px solid rgba(176,141,87,0.15);
  transition: color 0.2s, background 0.2s;
}
.atlas-tab:last-child { border-right: 0; }
.atlas-tab:hover,
.atlas-tab:focus-visible {
  color: var(--parchment);
  outline: none;
  background: rgba(201,162,39,0.08);
}
.atlas-tab.is-active {
  color: var(--gold-bright);
  background: rgba(201,162,39,0.12);
  box-shadow: inset 0 2px 0 var(--gold);
}

.quick-satchel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
}
@media (min-width: 400px) {
  .quick-satchel { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .quick-satchel { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .quick-satchel { grid-template-columns: repeat(3, 1fr); }
}

.satchel-btn {
  border: 1px solid rgba(176,141,87,0.35);
  background: linear-gradient(180deg, rgba(61,41,20,0.7), rgba(20,14,10,0.9));
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.55rem 0.4rem;
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.satchel-btn:hover:not(:disabled),
.satchel-btn:focus-visible:not(:disabled) {
  border-color: var(--gold);
  box-shadow: 0 0 14px rgba(201,162,39,0.3);
  outline: none;
}
.satchel-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- STONE TABLET ---------- */
.stone-tablet::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(6, 4, 2, 0.35);
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.stone-tablet.is-open::before {
  opacity: 1;
  pointer-events: auto;
}
.stone-tablet {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(20px);
  width: min(440px, calc(100vw - 1.5rem));
  max-height: min(70vh, 520px);
  overflow: auto;
  background:
    linear-gradient(165deg, #5a5348 0%, #3a3630 40%, #2a2824 100%);
  border: 2px solid #7a7368;
  border-radius: 4px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.65),
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 0 40px rgba(0,0,0,0.35);
  color: #e8e0d0;
  padding: 1.1rem 1.15rem 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease-ceremonial), transform 0.45s var(--ease-ceremonial);
}
.stone-tablet.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.stone-tablet[hidden] { display: block; } /* controlled by is-open */

.tablet-close {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  border: 1px solid rgba(200,190,170,0.3);
  background: rgba(0,0,0,0.25);
  color: #e8e0d0;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  border-radius: 2px;
  font-size: 0.85rem;
}
.tablet-close:hover,
.tablet-close:focus-visible {
  border-color: var(--gold);
  outline: none;
}
.tablet-carving { padding-right: 1.5rem; }
.tablet-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.tablet-carving h2 {
  margin: 0.25rem 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: #f2ead8;
}
.tablet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: rgba(232,224,208,0.7);
}
.tablet-meta .chip {
  border: 1px solid rgba(201,162,39,0.35);
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tablet-desc {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  line-height: 1.5;
  color: rgba(232,224,208,0.88);
  font-family: var(--font-body);
}
.tablet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.tablet-grid .cell {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(200,190,170,0.12);
  padding: 0.4rem 0.5rem;
  border-radius: 2px;
}
.tablet-grid .cell b {
  display: block;
  font-family: var(--font-display);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(201,162,39,0.8);
  margin-bottom: 0.15rem;
}
.tablet-grid .cell span {
  font-family: var(--font-hand);
  font-size: 0.88rem;
}
.tablet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tablet-btn {
  flex: 1 1 auto;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, rgba(201,162,39,0.25), rgba(0,0,0,0.35));
  color: #f2ead8;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.tablet-btn:hover,
.tablet-btn:focus-visible {
  box-shadow: 0 0 16px rgba(201,162,39,0.4);
  outline: none;
  transform: translateY(-1px);
}
.tablet-btn.ghost {
  border-color: rgba(200,190,170,0.35);
  background: rgba(0,0,0,0.2);
}

/* ---------- SCROLL SEAL ---------- */
.scroll-seal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(8,6,4,0.72);
  backdrop-filter: blur(4px);
}
.scroll-seal[hidden] { display: none; }
.scroll-body {
  text-align: center;
  color: var(--parchment);
}
.scroll-roll {
  width: 80px;
  height: 120px;
  margin: 0 auto 1rem;
  background:
    linear-gradient(90deg, #c4a574, #e8d5b0 20%, #e8d5b0 80%, #c4a574);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  position: relative;
  animation: sealRoll 1.6s var(--ease-ceremonial) forwards;
}
.scroll-roll::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c44, #5a1515);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  opacity: 0;
  animation: waxAppear 0.4s 1s forwards;
}
@keyframes sealRoll {
  0% { transform: scaleY(1) scaleX(1); }
  60% { transform: scaleY(0.35) scaleX(1.1); border-radius: 40px; }
  100% { transform: scaleY(0.28) scaleX(1.15); border-radius: 40px; }
}
@keyframes waxAppear {
  to { opacity: 1; }
}
#scroll-msg {
  font-family: var(--font-hand);
  font-style: italic;
  font-size: 1.1rem;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 300;
  background: linear-gradient(180deg, #3d2a14, #1a120c);
  border: 1px solid var(--gold);
  color: var(--parchment);
  font-family: var(--font-hand);
  font-style: italic;
  padding: 0.65rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), 0 0 20px rgba(201,162,39,0.2);
  opacity: 0;
  transition: opacity 0.35s, transform 0.35s;
  max-width: min(90vw, 360px);
  text-align: center;
}
.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast[hidden] { display: block; pointer-events: none; }

/* ---------- FOOTER ---------- */
.sanctum-foot {
  position: relative;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0.75rem 0.55rem;
  font-family: var(--font-hand);
  font-style: italic;
  font-size: 0.72rem;
  color: rgba(232,213,176,0.35);
  text-align: center;
}
.foot-sep { opacity: 0.4; }

/* ---------- REDUCED MOTION ---------- */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
.reduce-motion .map-breath,
.reduce-motion .map-fog,
.reduce-motion .dust,
.reduce-motion .constellation {
  animation: none !important;
}
.reduce-motion .map-pin {
  animation: none !important;
}

/* ---------- SCROLLBARS ---------- */
.book-shelf::-webkit-scrollbar,
.worlds-rail::-webkit-scrollbar,
.right-page::-webkit-scrollbar,
.relic-ring::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.book-shelf::-webkit-scrollbar-thumb,
.worlds-rail::-webkit-scrollbar-thumb,
.right-page::-webkit-scrollbar-thumb,
.relic-ring::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
  background: rgba(176,141,87,0.45);
  border-radius: 3px;
}

/* Mobile stacking tweaks */
@media (max-width: 719px) {
  .ritual-bar { padding: 0.55rem 0.65rem; }
  .brand-title { font-size: 0.8rem; }
  .collections-panel { max-height: none; }
  .book-shelf { max-height: 120px; flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .book-item { flex: 0 0 160px; }
  .book-item:hover { transform: translateY(-3px); }
  .map-table-wrap { min-height: 300px; }
  .table-pedestal { min-height: 280px; }
  .wing-right { max-height: 280px; }
  .atlas-book { min-height: 200px; }
  .shelf { display: none; }
}

/* High contrast focus for a11y */
:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
