/* css/style.css - The Seeker of Light - Premium UI Overlay & World Atlas System */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=Outfit:wght@300;400;500;600;700&family=Amiri:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  color-scheme: dark;
  --bg-deep: #050b14;
  --ink: #eaf0f8;
  --muted: #9aaec4;
  --gold: #e2c589;
  --line: rgba(226, 197, 137, 0.22);
  
  /* Tier Metallic Colors */
  --bronze-glow: rgba(205, 127, 50, 0.4);
  --silver-glow: rgba(192, 192, 192, 0.4);
  --gold-glow: rgba(255, 215, 0, 0.55);
  --gold-aura: 0 0 50px rgba(226, 197, 137, 0.45), 0 0 25px rgba(255, 215, 0, 0.3), inset 0 0 35px rgba(255, 215, 0, 0.12);
  --gold-shimmer: linear-gradient(90deg, #e2c589 0%, #ffffff 25%, #ffd700 50%, #f7d070 75%, #e2c589 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  overflow: hidden;
  background-color: #081426;
  color: var(--ink);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* 3D WebGL Canvas Container */
#world {
  position: fixed;
  inset: 0;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* HUD Overlay */
#hud-overlay, #hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  padding: 28px 36px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.eyebrow {
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.title-badge {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.counter-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.counter-text, #count {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.progress-dots, #progress {
  display: flex;
  gap: 6px;
}

.progress-dot, #progress span {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  transition: all 0.4s ease;
}

.progress-dot.collected, #progress span.collected {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(226, 197, 137, 0.6);
}

/* Map Location Badge in Top HUD */
#current-area-badge {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(14, 25, 42, 0.85);
  border: 1px solid rgba(226, 197, 137, 0.35);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#current-area-badge:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  background: rgba(20, 36, 60, 0.95);
  box-shadow: 0 6px 20px rgba(226, 197, 137, 0.3);
}

/* Prayer times: an aesthetic HUD readout, not a button - matches
   #current-place's unadorned-text approach rather than the bordered
   badge/icon style used elsewhere in the HUD. */
#prayer-widget {
  position: absolute;
  left: 36px;
  bottom: 28px;
  pointer-events: auto;
  cursor: pointer;
  text-align: left;
  font-family: 'Cinzel', Georgia, serif;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  transition: opacity 0.25s ease;
}

#prayer-widget:hover {
  opacity: 0.85;
}

#prayer-current-clock {
  display: block;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

#prayer-next-line {
  display: block;
  font-size: 17px;
  letter-spacing: 0.03em;
}

/* Level Chapter & Crosshair */
#chapter {
  position: fixed;
  top: 34px;
  right: 150px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.15em;
  z-index: 50;
  pointer-events: none;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 40;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

#hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 24px;
  border-radius: 30px;
  background: rgba(8, 20, 38, 0.7);
  border: 1px solid rgba(226, 197, 137, 0.2);
  backdrop-filter: blur(8px);
  text-align: center;
  color: #c6d1df;
  font-size: 13px;
  letter-spacing: 0.05em;
  pointer-events: none;
  z-index: 50;
}

/* Top Right HUD Action Buttons */
.hud-right {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

#journal-icon, .hud-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(25, 36, 56, 0.88), rgba(12, 20, 32, 0.96));
  border: 1px solid rgba(226, 197, 137, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

#journal-icon:hover, .hud-btn:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(226, 197, 137, 0.75);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(226, 197, 137, 0.35);
}

#journal-icon svg, .hud-btn svg {
  width: 24px;
  height: 24px;
  fill: #e2c589;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#journal-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd700, #d4af37);
  color: #0d1520;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border: 2px solid #0d1520;
}

.pulse-glow {
  animation: journalPulse 0.6s ease-out;
}

@keyframes journalPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.8); }
  50% { transform: scale(1.3); box-shadow: 0 0 35px 15px rgba(255, 215, 0, 0.6); }
  100% { transform: scale(1); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4); }
}

/* Base Overlays & Game Homepage Menu */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: rgba(3, 11, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.panel {
  width: min(100%, 560px);
  margin: auto;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(21, 36, 58, 0.95), rgba(9, 20, 34, 0.97));
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.75), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

.overlay-panel-wide {
  width: min(100%, 920px);
  position: relative;
  padding: 36px 42px;
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.btn-close-overlay {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-overlay:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gold);
}

.ornament {
  color: var(--gold);
  font-size: 28px;
  margin-bottom: 12px;
}

h1, h2 {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  line-height: 1.2;
  margin: 10px 0 16px;
}

h1 { font-size: clamp(32px, 5vw, 44px); color: #ffffff; }
h2 { font-size: 28px; color: #ffffff; }

p { color: var(--muted); margin: 0 0 18px; font-size: 15px; line-height: 1.6; }

/* ---------------- WORLD ATLAS OVERLAY (M KEY) ---------------- */
.atlas-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  margin-top: 10px;
}

/* Left Map Node Timeline Diagram */
.atlas-timeline-card {
  background: rgba(10, 18, 30, 0.6);
  border: 1px solid rgba(226, 197, 137, 0.2);
  border-radius: 16px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.timeline-path-container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 36px;
  align-items: center;
  width: 100%;
  margin: 16px 0;
}

/* Connecting Vertical Line */
.timeline-path-line {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  background: linear-gradient(180deg, #9b5de5 0%, #d4a373 33%, #81b29a 66%, #e07a5f 100%);
  border-radius: 2px;
  z-index: 0;
  box-shadow: 0 0 10px rgba(155, 93, 229, 0.4);
}

.timeline-node {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: rgba(14, 25, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.timeline-node:hover {
  transform: scale(1.04);
  border-color: var(--gold);
  box-shadow: 0 4px 15px rgba(226, 197, 137, 0.3);
}

.node-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px currentColor;
}

.node-dot.purple { background: #9b5de5; color: #9b5de5; }
.node-dot.brown { background: #d4a373; color: #d4a373; }
.node-dot.green { background: #81b29a; color: #81b29a; }
.node-dot.orange { background: #e07a5f; color: #e07a5f; }

.node-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.atlas-footer-tag {
  font-size: 11px;
  color: var(--gold);
  margin-top: 12px;
  letter-spacing: 0.08em;
}

/* Right Artifacts Cards List */
.atlas-artifacts-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.atlas-artifact-card {
  background: rgba(16, 28, 46, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.atlas-artifact-card:hover {
  background: rgba(24, 40, 64, 0.9);
  border-color: var(--gold);
  transform: translateX(4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.atlas-card-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #52b788;
  margin-bottom: 4px;
}

.atlas-card-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.atlas-card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* Atlas Bottom Toolbar */
.atlas-toolbar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.atlas-tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s ease;
}

.atlas-tool-btn:hover {
  background: rgba(226, 197, 137, 0.15);
  border-color: var(--gold);
  color: var(--gold);
}

/* ---------------- JOURNAL OF KNOWLEDGE OVERLAY (J KEY) ---------------- */
.journal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.journal-search {
  flex: 1 1 220px;
  background: #142334;
  color: #eeddbb;
  padding: 10px 14px;
  border: 1px solid #e2c58944;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}

.journal-filter {
  flex: 0 1 180px;
  background: #142334;
  color: #eeddbb;
  padding: 10px 14px;
  border: 1px solid #e2c58944;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}

/* Outer scroll container - children are per-chapter sections, not cards directly. */
.journal-grid {
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin-top: 18px;
  max-height: 480px;
  overflow-y: auto;
}

.journal-chapter-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: 'Cinzel', serif;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.journal-chapter-count {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--muted);
}

.journal-chapter-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.journal-card {
  background: rgba(14, 25, 42, 0.85);
  border: 1px solid rgba(226, 197, 137, 0.22);
  border-radius: 16px;
  padding: 22px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.journal-card:hover {
  background: rgba(20, 36, 60, 0.95);
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(226, 197, 137, 0.2);
}

.journal-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.journal-region-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-transform: uppercase;
}

.journal-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.journal-badge--bronze { background: rgba(205, 127, 50, 0.18); color: #e0a96d; border: 1px solid rgba(205, 127, 50, 0.45); }
.journal-badge--silver { background: rgba(220, 230, 245, 0.15); color: #dfe6f0; border: 1px solid rgba(220, 230, 245, 0.5); }
.journal-badge--gold { background: rgba(255, 215, 0, 0.16); color: var(--gold); border: 1px solid rgba(255, 215, 0, 0.5); }

.journal-card-title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.journal-story-excerpt {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.journal-empty {
  text-align: center;
  padding: 48px 24px;
}

.journal-empty-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: #ffffff;
  margin-bottom: 8px;
}

.journal-empty-text {
  font-size: 13px;
  color: var(--muted);
  max-width: 380px;
  margin: 0 auto 14px;
}

.journal-clear-filters {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}

.journal-clear-filters:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: var(--gold);
}

.journal-hadith-box {
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid var(--gold);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-family: 'Amiri', serif;
  font-size: 14px;
  line-height: 1.5;
  color: #f0f4f9;
}

.journal-citation {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: right;
  margin: 4px 4px 0;
}

/* ---------------- CHOOSE YOUR SEEKER OVERLAY ---------------- */
.character-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  margin-top: 10px;
}

.character-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  max-height: 420px;
  overflow-y: auto;
  padding: 4px;
}

.character-card {
  background: rgba(14, 25, 42, 0.85);
  border: 1px solid rgba(226, 197, 137, 0.22);
  border-radius: 14px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.character-card:hover {
  background: rgba(20, 36, 60, 0.95);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.character-card--selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(226, 197, 137, 0.55), 0 10px 26px rgba(0, 0, 0, 0.5);
}

.character-card-emblem {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}

.character-card-name {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.character-card-current {
  display: none;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.16);
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 999px;
  padding: 2px 8px;
}

.character-card--current .character-card-current {
  display: inline-block;
}

.character-detail {
  background: rgba(10, 18, 30, 0.6);
  border: 1px solid rgba(226, 197, 137, 0.2);
  border-radius: 16px;
  padding: 20px;
}

.character-preview-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 220px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, rgba(226, 197, 137, 0.12), transparent 70%);
  margin-bottom: 14px;
}

.character-preview-canvas[hidden] {
  display: none;
}

.character-detail-name {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.character-detail-description {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.character-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.character-actions button.primary {
  width: auto;
  padding: 12px 28px;
}

@media (max-width: 700px) {
  .character-grid { grid-template-columns: 1fr; }
}

button {
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

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

button.primary {
  width: 100%;
  padding: 15px 24px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(135deg, #e2c589 0%, #c9a456 100%);
  color: #0d1726;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 0 6px 20px rgba(226, 197, 137, 0.3);
  transition: all 0.25s ease;
}

button.primary:hover {
  background: linear-gradient(135deg, #ebd6a7 0%, #d4b062 100%);
  box-shadow: 0 8px 25px rgba(226, 197, 137, 0.45);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.controls {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 22px;
}

.controls .instructions {
  font-size: 13px;
  margin: 8px 0 16px;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 22px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

input[type=range] {
  width: 100%;
  accent-color: var(--gold);
  margin: 12px 0 6px;
}

.note {
  font-size: 12px;
  margin: 16px 0 0;
  color: #8fa0b5;
  line-height: 1.5;
}

#lockError {
  margin-top: 14px;
  color: #f1be9e;
  font-size: 13px;
}

/* Modal Overlay & 3D Perspective Container for Collectible Cards */
#modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 16, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  perspective: 1200px;
  padding: 24px;
}

.card-perspective-wrapper {
  width: min(100%, 540px);
  transform-style: preserve-3d;
  will-change: transform, opacity;
}

.collectible-card {
  position: relative;
  width: 100%;
  border-radius: 24px;
  padding: 36px 36px 30px;
  overflow: hidden;
  box-sizing: border-box;
  transform-style: preserve-3d;
}

@keyframes goldShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---------------- TIER STYLING ---------------- */
.tier-bronze {
  background: linear-gradient(145deg, rgba(26, 20, 16, 0.95), rgba(12, 17, 26, 0.97));
  border: 1.5px solid rgba(205, 127, 50, 0.45);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 25px rgba(205, 127, 50, 0.2);
}

.tier-bronze .card-badge {
  background: rgba(205, 127, 50, 0.15);
  border: 1px solid rgba(205, 127, 50, 0.5);
  color: #e0a96d;
}

.tier-bronze .ornament-icon { color: #cd7f32; }

.tier-bronze .hadith-quote {
  border-left: 3px solid #cd7f32;
  background: rgba(205, 127, 50, 0.06);
}

.tier-silver {
  background: linear-gradient(145deg, rgba(20, 27, 38, 0.95), rgba(10, 16, 26, 0.97));
  border: 1.5px solid rgba(220, 230, 245, 0.5);
  box-shadow: 0 22px 65px rgba(0, 0, 0, 0.75), 0 0 30px rgba(200, 220, 255, 0.25);
}

.tier-silver .card-badge {
  background: rgba(220, 230, 245, 0.15);
  border: 1px solid rgba(220, 230, 245, 0.6);
  color: #ffffff;
}

.tier-silver .ornament-icon { color: #c0c0c0; }

.tier-silver .hadith-quote {
  border-left: 3px solid #c0c0c0;
  background: rgba(220, 230, 245, 0.06);
}

/* ETHEREAL GOLD TIER */
.tier-gold {
  background: linear-gradient(145deg, rgba(32, 24, 12, 0.96) 0%, rgba(14, 19, 30, 0.98) 60%, rgba(38, 28, 10, 0.96) 100%);
  border: 1.5px solid rgba(255, 215, 0, 0.65);
  box-shadow: var(--gold-aura);
  backdrop-filter: blur(18px) saturate(190%);
  -webkit-backdrop-filter: blur(18px) saturate(190%);
}

.tier-gold::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 215, 0, 0.12) 0%, transparent 45%),
              radial-gradient(circle at 70% 80%, rgba(226, 197, 137, 0.1) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

.tier-gold .card-badge {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(226, 197, 137, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.8);
  color: #ffe89e;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
  background-size: 200% 100%;
  animation: goldShimmer 4s infinite linear;
}

.tier-gold .card-title {
  background: linear-gradient(135deg, #ffffff 0%, #ffe094 50%, #e2c589 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.tier-gold .ornament-icon {
  background: var(--gold-shimmer);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: goldShimmer 3s infinite linear;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.tier-gold .hadith-quote {
  border-left: 3px solid #ffd700;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.02) 100%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.card-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 30px;
}

.location-tag {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.location-tag svg {
  width: 14px;
  height: 14px;
  fill: #e2c589;
}

.ornament-icon {
  text-align: center;
  font-size: 28px;
  line-height: 1;
  margin: -4px 0 2px;
}

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  line-height: 1.25;
  text-align: center;
}

.story-text {
  font-size: 15px;
  line-height: 1.65;
  color: #d1dceb;
  font-weight: 400;
  text-align: justify;
  text-justify: inter-word;
}

.hadith-quote {
  padding: 16px 20px;
  border-radius: 0 12px 12px 0;
  font-family: 'Amiri', serif;
  font-size: 17px;
  line-height: 1.7;
  color: #f5f8fc;
  margin-top: 4px;
}

.arabic-quote {
  font-family: 'Amiri', serif;
  font-size: 22px;
  line-height: 2.1;
  color: var(--gold);
  text-align: right;
  margin: 10px 0 0;
}

.hadith-citation {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: right;
  margin: 6px 4px 0;
}

.card-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.btn-collect {
  flex: 1;
  padding: 14px 24px;
  border-radius: 12px;
  border: 1px solid rgba(226, 197, 137, 0.7);
  background: linear-gradient(135deg, #e2c589 0%, #c9a456 100%);
  color: #0a121e;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(226, 197, 137, 0.3);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-collect:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #ebd6a7 0%, #d4b062 100%);
  box-shadow: 0 8px 25px rgba(226, 197, 137, 0.45);
}

.btn-collect:active {
  transform: translateY(0);
}

/* Hidden Utility */
[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .atlas-grid { grid-template-columns: 1fr; }
  .journal-chapter-cards { grid-template-columns: 1fr; }
  #hud-overlay { padding: 18px; }
  #chapter { display: none; }
  .overlay-panel-wide { padding: 24px; }
}

/* Restored cinematic welcome; game controls remain tucked away. */
#menu{background:linear-gradient(90deg,#06111af5,#101b29b0 48%,#101b2910);backdrop-filter:none;justify-items:start;padding:7vh 8vw}
#menu>.panel{background:none;border:0;box-shadow:none;max-width:510px;margin:0;padding:0}#menu h1{font-size:clamp(55px,7vw,88px);letter-spacing:-.045em;line-height:1}#menuDescription{font:17px/1.7 Georgia;max-width:350px}#save-status{font-size:11px;color:var(--gold);margin:20px 0}#options,#account{background:#112030d9;padding:18px;border:1px solid #e2c58933}#account input[type=email]{width:100%;background:#142334;color:#eeddbb;padding:10px;border:1px solid #e2c58944;border-radius:6px;margin-top:4px;font-family:inherit;font-size:14px}#account-signed-in button{background:none;color:var(--gold);border:1px solid #e2c58944;border-radius:6px;padding:8px 14px}.title-actions{display:flex;gap:12px;margin:15px 0}.title-actions button{background:none;color:var(--gold);border:0;border-bottom:1px solid #e2c58944;padding:8px;cursor:pointer}#drag-resume{margin-top:10px}.category-qudsi{background:radial-gradient(ellipse at top,#807bc533,transparent 70%),linear-gradient(145deg,#1f2646ed,#111526f5)!important;box-shadow:0 0 45px #bbb1ff30,inset 0 0 25px #e1d5ff12!important;border-color:#cab7ed!important}#modal-overlay{perspective:1200px}.collectible-card{backdrop-filter:blur(18px)}#level-select{background:#142334;color:#eeddbb;padding:10px;border:1px solid #e2c58944;max-width:100%}#map-status{font-size:12px;flex-basis:100%}#btn-close-card{float:right}#options[hidden],[hidden]{display:none!important}
@media(prefers-reduced-motion:reduce){.pulse-glow{animation:none!important}}

/* A quiet, full-viewport transition while map bytes and geometry are prepared. */
#loading-overlay { position:fixed; inset:0; z-index:1000; display:grid; place-items:center;
  background:radial-gradient(ellipse at 50% 30%,#79533555,transparent 65%),#141919;
  color:#f3e2c8; padding:28px; }
.loading-content { width:min(360px,85vw); text-align:center; }
.loading-emblem { color:#ffb86c; font-size:40px; margin-bottom:34px;
  text-shadow:0 0 32px #ffb86c55; }
.loading-eyebrow { font:10px/1.6 sans-serif; letter-spacing:.32em; color:#c1ab8d; }
#loading-title { font:normal clamp(26px,4vw,36px)/1.4 Georgia,serif; margin:18px 0 36px; }
.loading-track { height:2px; overflow:hidden; background:#f3d5a51f; }
#loading-fill { display:block; width:100%; height:100%; background:#ffb86c;
  transform:scaleX(0); transform-origin:left; transition:transform .18s linear; }
.loading-track.is-indeterminate #loading-fill { width:35%; animation:loading-drift 1.6s ease-in-out infinite; }
#loading-detail { color:#c1ab8d; font:11px/1.8 sans-serif; letter-spacing:.08em; margin-top:18px; }
@keyframes loading-drift { from {transform:translateX(-110%)} to {transform:translateX(390%)} }
@media(prefers-reduced-motion:reduce) {
  .loading-track.is-indeterminate #loading-fill { animation:none; transform:translateX(90%); }
  #loading-fill {transition:none;}
}

#current-place {position:fixed;top:28px;left:50%;transform:translateX(-50%);z-index:70;color:#f3dfb7;font:20px Georgia,serif;letter-spacing:.09em;text-shadow:0 2px 10px #000;pointer-events:none;text-align:center}
#area-transition {position:fixed;inset:0;z-index:900;background:#131b20;display:grid;place-items:center;color:#f3dfb7;font:32px Georgia,serif;letter-spacing:.08em}
@media(max-width:700px){#current-place{top:105px;font-size:16px;width:90%}}

#key-bindings {display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:14px 0}
#key-bindings label {display:flex;align-items:center;justify-content:space-between;gap:12px;text-transform:capitalize;font-size:12px}
#key-bindings button,#reset-bindings {background:#1b2c37;border:1px solid #d4af3755;color:#f4e5c6;border-radius:6px;padding:7px 12px;cursor:pointer}
#binding-status,.source-review {font-size:12px;line-height:1.5;color:#d9c497}
#menu {overflow-y:auto}#options {max-height:60vh;overflow-y:auto}
#modal-overlay {overflow-y:auto}.card-perspective-wrapper{max-height:90vh;overflow-y:auto}
#key-bindings button:focus-visible,.journal-card:focus-visible,.atlas-artifact-card:focus-visible,#journal-icon:focus-visible,#atlas-btn:focus-visible,.character-card:focus-visible {outline:2px solid #83e9ee;outline-offset:3px}

.region-destinations {display:grid;gap:16px;margin:24px 0;}
.region-destination {padding:22px;text-align:left;border:1px solid #d4af3760;background:linear-gradient(125deg,#263d45,#111b24);color:#f7e7bc;border-radius:12px;cursor:pointer;transition:transform .2s,box-shadow .2s;}
.region-destination:hover:not(:disabled) {transform:translateY(-2px);box-shadow:0 0 24px #d4af3733;}
.region-destination:focus-visible {outline:2px solid #83e9ee;outline-offset:4px;}
.secret-region {box-shadow:inset 0 0 25px #83e9ee18,0 0 20px #d4af3722;}
.secret-region:disabled {opacity:.55;cursor:not-allowed;}
.developer-toggle {display:block;font-size:12px;color:#c9bd9f;line-height:1.7;}
/* Game title and pause shell. Existing account/settings controls retain their handlers. */
#menu {background:linear-gradient(90deg,rgba(4,12,19,.98) 0%,rgba(4,12,19,.9) 40%,rgba(4,12,19,.18) 100%);padding:5vh 7vw;align-items:center;}
#menu .game-menu-panel {width:min(440px,100%);max-width:440px;}
#menu h1 {font-size:clamp(44px,6vw,76px);max-width:420px;color:#f4e8ce;text-wrap:balance;line-height:1.04;margin:16px 0;}
#menuLabel {letter-spacing:.25em;font-size:10px;color:#d4af37;}
#menuDescription {font-size:15px;line-height:1.6;color:#b7c4cb;margin:0 0 24px;}
#continue-summary {border-left:2px solid #d4af37;padding:12px 18px;margin:22px 0;background:linear-gradient(90deg,#d4af3710,transparent);}
#menu-save-label {display:block;font-size:10px;color:#b7c4cb;letter-spacing:.08em;}
#menu-chapter {display:block;font-family:Georgia,serif;font-size:21px;font-weight:normal;margin:8px 0 12px;color:#f4e8ce;}
#continue-summary>div {display:flex;gap:20px;font-size:12px;color:#a9bac4;}
#menu #resume {width:100%;text-align:left;padding:16px 20px;border-radius:4px;font-size:15px;letter-spacing:.04em;}
#menu .title-actions {display:flex;flex-direction:column;gap:0;margin:8px 0;}
#menu .title-actions button,#return-title {text-align:left;padding:10px 20px;border:0;border-left:2px solid transparent;color:#d1d8dc;border-radius:0;background:transparent;font-size:14px;}
#menu .title-actions button:hover,#return-title:hover {background:#d4af3712;border-left-color:#d4af37;color:#fff1d2;}
#menu button:focus-visible {outline:2px solid #8ed8e3;outline-offset:3px;}
#save-status {line-height:1.5;min-height:1.5em;margin:12px 0!important;color:#afc5c3!important;}
#menu .game-menu-panel>.note {font-size:10px;line-height:1.5;color:#8b9ba6;max-width:380px;margin-top:22px;}
#menu-back {background:transparent;border:0;color:#e2c589;padding:12px 0;cursor:pointer;}
#menu[data-panel] #continue-summary,#menu[data-panel] #resume,#menu[data-panel] .title-actions,#menu[data-panel] #return-title,#menu[data-panel] #menuDescription {display:none!important;}
#menu[data-panel] #options,#menu[data-panel] #account {max-height:55vh;overflow-y:auto;}
#menu[data-mode=pause] h1 {font-size:46px;}
body[data-screen=menu] #hud-overlay,body[data-screen=menu] #current-place,body[data-screen=menu] #chapter,body[data-screen=menu] #hint {visibility:hidden;}
@media(max-height:800px){#menu{padding:24px 6vw;}#menu h1{font-size:44px;}#menuDescription{margin-bottom:12px;}#continue-summary{margin:12px 0;}#menu .title-actions button{padding:8px 16px;}#menu .game-menu-panel>.note{margin-top:10px;}}
body[data-screen=menu] #hud-overlay {display:none;}
#objective {position:fixed;left:28px;bottom:88px;z-index:30;pointer-events:none;max-width:min(320px,65vw);padding:12px 16px;border-left:2px solid #83e9ee;background:linear-gradient(90deg,#071722e8,#07172230);text-shadow:0 1px 4px #000;}
#objective span,#objective strong{display:block;}#objective .objective-label{font-size:9px;letter-spacing:.2em;color:#83e9ee;margin-bottom:6px;}#objective strong{font:18px/1.4 Georgia,serif;color:#f4e8ce;}#objective-detail{font-size:11px;color:#c2d4db;margin-top:7px;}
#waypoint{position:fixed;z-index:29;pointer-events:none;transform:translate(-50%,-50%);text-align:center;color:#9feef3;text-shadow:0 0 8px #052d36,0 1px 4px #000;}
.waypoint-dot{display:block;font-size:32px;line-height:1;}.waypoint-arrow{display:none;font-size:22px;line-height:1;}.offscreen .waypoint-arrow{display:block;}.offscreen .waypoint-dot{display:none;}.waypoint-distance{display:block;font:11px/1.8 system-ui;white-space:nowrap;}

body[data-screen=transition] #hud-overlay,body[data-screen=transition] #current-place,body[data-screen=transition] #chapter,body[data-screen=transition] #hint,body[data-screen=transition] #objective,body[data-screen=transition] #waypoint {visibility:hidden;}
#prayer-modal .panel{max-width:420px}
#prayer-setup .note,#prayer-active .note{margin:12px 0}
#prayer-current-name{font-size:22px;color:var(--gold);margin:8px 0 4px}
#prayer-current-time{font-size:15px;color:#eaf0f8}
#prayer-disable{background:none;color:var(--muted);border:1px solid var(--line);border-radius:8px;padding:8px 14px;width:100%}

/* Chapter route: connected milestones, with progress distinct from travel access. */
#atlas-regions { position:relative; width:100%; gap:24px; padding:8px 0; }
#atlas-regions::before { content:""; position:absolute; top:30px; bottom:30px;
  left:24px; border-left:2px dashed #d4af3766; pointer-events:none; }
.journey-stop { position:relative; display:grid; gap:8px; margin-left:18px;
  padding:18px 14px 16px 28px; border-radius:4px 18px 18px 4px;
  background:linear-gradient(120deg,#24363b,#111c26); }
.journey-stop:nth-child(even) { margin-left:32px; }
.journey-number { position:absolute; left:-18px; top:17px; display:grid;
  place-items:center; width:30px; height:30px; border:1px solid #b49a61;
  border-radius:50%; background:#17252c; color:#e7d4a3; font-size:11px; }
.journey-stop strong { font:600 15px Georgia,serif; line-height:1.4; }
.journey-status,.journey-tally { font-size:11px; line-height:1.5; color:#b6c4cd; }
.journey-stop progress { width:100%; height:4px; border:0; border-radius:8px;
  background:#ffffff15; accent-color:#d4af37; }
.journey-stop progress::-webkit-progress-bar { background:#ffffff15; }
.journey-stop progress::-webkit-progress-value { background:#d4af37; }
.journey-stop progress::-moz-progress-bar { background:#d4af37; }
.journey-stop.is-current { border-color:#83e9ee; box-shadow:0 0 20px #83e9ee18; }
.journey-stop.is-current .journey-status { color:#83e9ee; }
.journey-stop.is-complete .journey-number { background:#385349; }
.journey-stop:disabled { opacity:.55; cursor:not-allowed; }
