/* ═════════════════════════════════════════════════════════════════════
   GUIDED UMRAH — ADVANCED 3D LUXURY ISLAMIC DESIGN SYSTEM
   Featuring 3D Perspective Transforms, Scroll-Driven Animations,
   Glassmorphism, 24K Gold Accents, and Sacred Emerald Palettes.
   ═════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Light Theme — Sandstone Marble & Royal Emerald */
  --bg: #f8f6f0;
  --bg-gradient: radial-gradient(circle at 50% 0%, #ffffff 0%, #f6f3ea 60%, #ece7dc 100%);
  --surface: #ffffff;
  --surface-2: #f2ede2;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --surface-glass-border: rgba(212, 175, 55, 0.22);
  --text: #121c17;
  --muted: #53645b;
  --border: #dcd6c8;
  
  /* Brand Accents */
  --accent: #0c5a39;
  --accent-strong: #08432a;
  --accent-ink: #ffffff;
  --accent-soft: #e1f2e9;
  --accent-glow: rgba(12, 90, 57, 0.25);
  
  /* 24K Royal Gold Accents */
  --gold: #b38b29;
  --gold-light: #f7e6a4;
  --gold-dark: #8c6815;
  --gold-soft: #fcf6e8;
  --gold-glow: rgba(179, 139, 41, 0.35);
  --gold-gradient: linear-gradient(135deg, #f7e6a4 0%, #c99c2d 50%, #946f17 100%);
  
  --kaaba: #121614;
  --green: #199750;
  
  /* Status Colors */
  --warn-bg: #fff8e8;
  --warn-ink: #784e03;
  --warn-line: #f1cf7c;
  --info-bg: #eef6fc;
  --info-ink: #164673;
  --info-line: #b6d3ee;
  --err-bg: #fdf0f0;
  --err-ink: #8c1d1d;
  --err-line: #f3baba;
  --ok-bg: #e5f6ec;
  --ok-ink: #0b5936;
  --ok-line: #a6dfc0;
  
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 20px -2px rgba(18, 28, 23, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 14px 34px -4px rgba(18, 28, 23, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-gold: 0 8px 24px -4px rgba(179, 139, 41, 0.28);
  
  --text-scale: 1;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme — Deep Sacred Emerald, Obsidian & Glowing Gold */
    --bg: #070e0b;
    --bg-gradient: radial-gradient(circle at 50% 0%, #0d2018 0%, #08130f 60%, #040907 100%);
    --surface: #101c17;
    --surface-2: #16241e;
    --surface-glass: rgba(16, 28, 23, 0.78);
    --surface-glass-border: rgba(212, 175, 55, 0.28);
    --text: #f0f5f2;
    --muted: #95a89e;
    --border: #23352c;
    
    --accent: #2dc483;
    --accent-strong: #3fe29b;
    --accent-ink: #04140c;
    --accent-soft: #0e2f21;
    --accent-glow: rgba(45, 196, 131, 0.3);
    
    --gold: #dfb64c;
    --gold-light: #ffefb8;
    --gold-dark: #b88d2a;
    --gold-soft: #28210f;
    --gold-glow: rgba(223, 182, 76, 0.4);
    --gold-gradient: linear-gradient(135deg, #fff0ba 0%, #dfb64c 50%, #9e7518 100%);
    
    --kaaba: #050806;
    --green: #30d17d;
    
    --warn-bg: #291d09;
    --warn-ink: #f8d793;
    --warn-line: #614716;
    --info-bg: #0d1e2d;
    --info-ink: #b2d5f8;
    --info-line: #1e3f5e;
    --err-bg: #2d1111;
    --err-ink: #f9b6b6;
    --err-line: #5e2424;
    --ok-bg: #0d281a;
    --ok-ink: #9ee6be;
    --ok-line: #1d5336;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
    --shadow-gold: 0 8px 30px rgba(223, 182, 76, 0.25);
    
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  -webkit-text-size-adjust: 100%;
  font-size: calc(100% * var(--text-scale, 1));
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Sacred Starlight Background */
.ambient-stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    radial-gradient(1.5px 1.5px at 20px 30px, rgba(212, 175, 55, 0.45), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 140px, rgba(255, 255, 255, 0.35), rgba(0,0,0,0)),
    radial-gradient(1.8px 1.8px at 150px 70px, rgba(212, 175, 55, 0.3), rgba(0,0,0,0)),
    radial-gradient(1.2px 1.2px at 240px 220px, rgba(45, 196, 131, 0.35), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 320px 110px, rgba(212, 175, 55, 0.4), rgba(0,0,0,0));
  background-size: 380px 380px;
  opacity: 0.65;
}

#app {
  max-width: 620px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
  perspective: 1200px;
}

@media (min-width: 1024px) {
  #app {
    max-width: 760px;
  }
}

.boot {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--gold);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
}

a {
  color: var(--accent);
  transition: color 0.2s ease, opacity 0.2s ease;
}
a:hover {
  opacity: 0.88;
}

h1, h2, h3 {
  font-family: "Outfit", "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.4em;
  letter-spacing: -0.015em;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 0.85em; }
small { display: block; color: var(--muted); font-size: 0.85rem; }
.muted { color: var(--muted); }
.center { text-align: center; }

.page {
  padding: 16px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  perspective: 1000px;
}
.page > * { margin: 0; }

/* ── Top Bar with Glassmorphic Luxury ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--surface-glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-family: "Cinzel", "Outfit", serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(212, 175, 55, 0.2);
}
.brand span {
  -webkit-text-fill-color: initial;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.review-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom: 1px solid var(--warn-line);
  transition: all 0.2s ease;
}
.review-strip:hover {
  background: var(--warn-line);
  color: #000;
}

/* ── 3D Bottom Floating Glass Tab Bar ── */
.tabbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 540px;
  margin: 0 auto;
  padding: 6px 8px;
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), var(--shadow-gold);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.tabbar a span {
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.tabbar a:active span {
  transform: scale(0.85);
}

.tabbar a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
.tabbar a[aria-current="page"] span {
  transform: translateY(-2px) scale(1.15);
  filter: drop-shadow(0 2px 6px var(--accent-glow));
}

/* ── 3D Interactive Canvas & Visualizer Container ── */
.scene-3d-container {
  position: relative;
  width: 100%;
  min-height: 270px;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 50%, #162a21 0%, #09140f 75%, #030806 100%);
  border: 1px solid var(--surface-glass-border);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  overflow: hidden;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.scene-3d-canvas {
  display: block;
  cursor: grab;
  width: 100%;
  height: 100%;
}
.scene-3d-canvas:active {
  cursor: grabbing;
}

.scene-3d-badge {
  position: absolute;
  top: 14px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(8, 20, 15, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid var(--gold);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.scene-3d-hint {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(5, 12, 9, 0.6);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  pointer-events: none;
  z-index: 2;
}

/* ── 3D Card Hover & Scroll-Reveal Effects ── */
.scroll-reveal-item {
  opacity: 0;
  transform: perspective(900px) rotateX(10deg) translateY(24px) scale(0.97);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

.scroll-reveal-item.revealed-3d {
  opacity: 1;
  transform: perspective(900px) rotateX(0deg) translateY(0) scale(1);
}

/* Interactive 3D Card Tilt with Specular Glare */
.card, .tile, .hero, .status-card, .done-card, .counter, .complete, .dua, .step-card {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.25s ease;
  overflow: hidden;
}

.card:hover, .tile:hover, .dua:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-lg), 0 0 16px rgba(212, 175, 55, 0.12);
}

/* Specular Light Flare on 3D Tilt */
.card::after, .tile::after, .hero::after, .status-card::after, .dua::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle 280px at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.15), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: inherit;
}

.card.tilt-active::after, .tile.tilt-active::after, .hero.tilt-active::after, .dua.tilt-active::after {
  opacity: 1;
}

details.card summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1.02rem;
  outline: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after {
  content: '▾';
  font-size: 1.1rem;
  color: var(--gold);
  transition: transform 0.25s ease;
}
details.card[open] summary::after {
  transform: rotate(180deg);
}
details.card[open] summary {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Refined Buttons & Tactile Micro-Interactions ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97) translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-2px);
}

.btn.big {
  width: 100%;
  min-height: 64px;
  font-size: 1.15rem;
  border-radius: 16px;
  letter-spacing: 0.02em;
}

.btn.final {
  background: var(--gold-gradient);
  border-color: var(--gold-light);
  color: #121008;
  font-weight: 800;
  box-shadow: var(--shadow-gold);
}
.btn.final:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.btn.small {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.88rem;
  border-radius: 10px;
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
  box-shadow: none;
}
.btn.ghost:hover {
  background: var(--accent-soft);
}

.btn.danger {
  color: var(--err-ink);
  border-color: var(--err-line);
  background: var(--err-bg);
}

.btn.current {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row.actions > * { flex: 1 1 0; }
.grid-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }

/* ── Alerts & Glowing Feedback ── */
.alert {
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}
.alert p:last-child { margin-bottom: 0; }
.alert.info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }
.alert.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.alert.error { background: var(--err-bg); color: var(--err-ink); border-color: var(--err-line); }
.alert.success {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: var(--ok-line);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(25, 151, 80, 0.15);
}

.alert.suggest {
  background: var(--gold-soft);
  color: var(--text);
  border-color: var(--gold);
  border-width: 2px;
  animation: pulse-border 1.6s ease-in-out infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); }
}

.alert.suggest.big {
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  padding: 18px 16px;
  border-radius: 16px;
  animation: pulse-big 1.2s ease-in-out infinite;
}
.alert.suggest.big b { font-size: 1.25rem; color: var(--gold); }

@keyframes pulse-big {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5); }
  50% { box-shadow: 0 0 0 14px rgba(212, 175, 55, 0); }
}

.btn.ready-pulse {
  animation: ready-pulse 1.2s ease-in-out infinite;
}
@keyframes ready-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.6); }
  50% { box-shadow: 0 0 0 18px rgba(212, 175, 55, 0); }
}

/* ── Chips & Badges ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip.ok { background: rgba(45, 196, 131, 0.15); color: var(--ok-ink); border-color: var(--ok-line); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chips .chip { flex: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); border: 1px solid var(--ok-line); }
.pill { font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* ── Status Card & Progress Bar ── */
.status-card {
  padding: 16px 20px;
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
}
.status-row { display: flex; justify-content: space-between; align-items: center; }
.status-overall { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.status-overall .bar { flex: 1; }
.status-current { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 0.95rem; }
.status-dir { font-weight: 800; color: var(--accent); }
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}

.bar {
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}
.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--green) 100%);
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ── 3D Step Timeline Nodes ── */
.steps {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 12px 0 8px;
}
.steps li {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  opacity: 0.55;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.steps li.done {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  opacity: 1;
  font-weight: 800;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.steps li.current {
  background: var(--gold-soft);
  border: 2px solid var(--gold);
  opacity: 1;
  transform: scale(1.18);
  box-shadow: 0 0 14px var(--gold-glow);
}

/* ── Stage Content & Counters ── */
.stage-head h1 { margin-top: 6px; }
.lead { font-size: 1.08rem; color: var(--muted); }
.hint { font-size: 0.92rem; color: var(--muted); text-align: center; }
.next-up { font-size: 1.05rem; }
.points { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 8px; }
.left-hint { text-align: center; font-size: 1.05rem; }
.tracking-line { font-size: 0.88rem; color: var(--muted); text-align: center; }
.tracking-line.ok { color: var(--green); font-weight: 600; }
.tracking-toggle { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.tracking-toggle.ok { border-color: var(--green); }
.tracking-toggle.ok b { color: var(--green); }

.counter {
  text-align: center;
  padding: 24px 20px;
}
.counter.final {
  border-color: var(--gold);
  border-width: 2px;
  background: linear-gradient(160deg, var(--gold-soft) 0%, var(--surface) 100%);
  box-shadow: var(--shadow-gold);
}
.count { font-size: 1.4rem; font-weight: 700; margin: 6px 0 14px; }
.count b { font-size: 4rem; line-height: 1; color: var(--accent); font-family: "Outfit", sans-serif; font-weight: 800; }
.counter.final .count b { color: var(--gold); }
.count span { color: var(--muted); font-size: 1.8rem; }
.direction { font-size: 1.35rem; margin: 12px 0 0; font-weight: 700; }
.direction b { color: var(--accent); }

.dots { display: flex; justify-content: center; gap: 8px; padding: 0; margin: 0; list-style: none; }
.dots li {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--muted);
  transition: all 0.3s ease;
}
.dots li.done {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 10px var(--accent-glow);
}
.dots li.current {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  transform: scale(1.15);
}

/* ── Tawaf Ring & Visualizer ── */
.ring { display: block; width: min(320px, 85vw); margin: 0 auto; filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.1)); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.ring-progress { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--accent-glow)); }
.kaaba { fill: var(--kaaba); }
.kaaba-band { fill: var(--gold); }
.black-stone { fill: var(--gold); stroke: var(--surface); stroke-width: 1.5; filter: drop-shadow(0 0 4px var(--gold-glow)); }
.start-line { stroke: var(--green); stroke-width: 2.5; stroke-dasharray: 4 4; }
.start-dot { fill: var(--green); stroke: var(--surface); stroke-width: 3; }
.ring-label { font-size: 13px; font-weight: 800; fill: var(--green); font-family: "Outfit", sans-serif; }
.chev { fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.pilgrim { fill: var(--gold); stroke: var(--surface); stroke-width: 3; transition: cx 0.6s ease-out, cy 0.6s ease-out; }
.pilgrim-pulse { fill: var(--gold); opacity: 0.4; transform-origin: center; transition: cx 0.6s ease-out, cy 0.6s ease-out; animation: live-pulse-big 1.8s ease-out infinite; }
@keyframes live-pulse-big { from { r: 8; opacity: 0.5; } to { r: 24; opacity: 0; } }

/* ── Sa'i Layout ── */
.sai-layout { display: grid; grid-template-columns: minmax(130px, 42%) 1fr; gap: 14px; align-items: center; }
.sai { width: 100%; max-height: 340px; }
.sai-line { stroke: var(--border); stroke-width: 9; stroke-linecap: round; }
.green-zone { fill: var(--green); opacity: 0.35; filter: drop-shadow(0 0 6px rgba(48, 209, 125, 0.4)); }
.green-label { font-size: 11px; fill: var(--green); font-weight: 800; }
.hill { fill: var(--surface); stroke: var(--muted); stroke-width: 3; }
.hill.to { fill: var(--accent); stroke: var(--accent); }
.hill.from { stroke: var(--accent); }
.hill-label { font-size: 13px; font-weight: 800; fill: var(--text); }
.card.green { border-left: 6px solid var(--green); }
.card.green.active { background: var(--ok-bg); }
.card.paused { border: 2px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }

/* ── Done & Complete Screen ── */
.done-card, .complete { text-align: center; padding: 28px 20px; }
.complete h1 {
  font-size: 2.2rem;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.arabic {
  font-family: "Amiri", "Noto Naskh Arabic", "Scheherazade New", serif;
  font-size: 1.65rem;
  line-height: 2.2;
  margin: 10px 0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.arabic.big { font-size: 2.6rem; color: var(--gold); margin: 0; }
.count-list { list-style: none; padding: 0; margin: 14px 0; text-align: left; }
.count-list li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.summary { display: grid; grid-template-columns: 1fr auto; gap: 8px 18px; text-align: left; margin: 14px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 700; text-align: right; }

/* ── Forms & Input Fields ── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 700; }
.field input, .field select, .field textarea {
  font: inherit;
  font-weight: 500;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.checks { display: flex; flex-direction: column; gap: 6px; }
.check { display: flex; gap: 14px; align-items: flex-start; padding: 12px 6px; cursor: pointer; }
.check input { width: 24px; height: 24px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.check span { display: flex; flex-direction: column; gap: 3px; }
.check.inline { padding: 8px 0 0; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 700; margin-bottom: 10px; font-size: 1.05rem; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.segmented legend { grid-column: 1 / -1; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.25s ease;
}
.segmented input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Hero & Exploration Tiles ── */
.hero {
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--surface-glass) 60%);
  border: 1px solid var(--surface-glass-border);
}
.hero h1 { font-size: 1.7rem; margin-top: 8px; }
.start-form { margin-top: 16px; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface-glass);
}
.tile-icon { font-size: 1.75rem; margin-bottom: 2px; }
.tile b { font-size: 1.05rem; font-weight: 700; }

/* ── Duas & Islamic Recitations ── */
.dua-section { display: flex; flex-direction: column; gap: 12px; }
.dua header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dua.highlight {
  border-color: var(--gold);
  border-width: 2px;
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--surface-glass) 30%);
}
.dua .when { font-size: 0.9rem; color: var(--muted); }
.dua .translit { font-style: italic; color: var(--muted); }
.dua .note { font-size: 0.92rem; background: var(--surface-2); padding: 10px 12px; border-radius: 10px; }
.dua footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; font-size: 0.82rem; color: var(--muted); }
.personal { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.personal li { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 8px 8px 14px; }

/* Sound Wave Animation for Recitations */
.btn.listen.playing {
  background: var(--gold-gradient);
  border-color: var(--gold-light);
  color: #151003;
  box-shadow: var(--shadow-gold);
  animation: audio-glow 1.4s infinite ease-in-out;
}
@keyframes audio-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 175, 55, 0.4); }
  50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.7); }
}

/* ── Haram Real Map & Schematic ── */
.map { display: block; width: 100%; max-height: 72vh; }
.map-page { padding: 10px; }
.real-map-canvas {
  width: 100%;
  height: 60vh;
  max-height: 520px;
  min-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
@media (prefers-color-scheme: dark) {
  .real-map-canvas .leaflet-tile-pane { filter: brightness(0.65) invert(1) contrast(0.85) hue-rotate(180deg) saturate(0.6); }
  .real-map-canvas .leaflet-control-zoom a { background: var(--surface); color: var(--text); border-color: var(--border); }
  .real-map-canvas .leaflet-control-attribution { background: rgba(0, 0, 0, 0.65); color: var(--muted); }
  .real-map-canvas .leaflet-control-attribution a { color: var(--text); }
}

.map-ground { fill: var(--surface-2); }
.map-mosque { fill: var(--surface); stroke: var(--border); stroke-width: 3; }
.map-mataf { fill: none; stroke: var(--border); stroke-width: 2; stroke-dasharray: 6 6; }
.map-mataf-outer { fill: none; stroke: var(--border); stroke-width: 1.5; stroke-dasharray: 3 9; }
.map-kaaba { fill: var(--kaaba); }
.map-kaaba-band { fill: var(--gold); }
.map-black-stone { fill: var(--gold); stroke: var(--surface); stroke-width: 0.8; }
.map-hijr { fill: none; stroke: var(--muted); stroke-width: 2.5; }
.map-maqam { fill: none; stroke: var(--muted); stroke-width: 2; }
.map-start-line { stroke: var(--green); stroke-width: 2; stroke-dasharray: 5 5; }
.map-start { fill: var(--green); stroke: var(--surface); stroke-width: 2; }
.map-masa { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.map-green { stroke: var(--green); stroke-width: 20; opacity: 0.3; }
.map-hill { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.map-label { font-size: 13px; font-weight: 800; fill: var(--text); }
.map-note { font-size: 10px; fill: var(--muted); }
.map-trail { fill: none; stroke: var(--accent); stroke-width: 3; opacity: 0.5; stroke-linejoin: round; stroke-linecap: round; }
.map-pilgrim { fill: var(--gold); stroke: var(--surface); stroke-width: 3; transition: cx 0.6s ease-out, cy 0.6s ease-out; }
.map-pilgrim-pulse { fill: var(--gold); opacity: 0.4; transform-origin: center; transition: cx 0.6s ease-out, cy 0.6s ease-out; animation: live-pulse-small 1.8s ease-out infinite; }
@keyframes live-pulse-small { from { r: 6; opacity: 0.4; } to { r: 16; opacity: 0; } }
.map-accuracy { fill: var(--accent); opacity: 0.12; transition: cx 0.6s ease-out, cy 0.6s ease-out, r 0.6s ease-out; }
.map-north { fill: var(--muted); }
.map-scale { stroke: var(--muted); stroke-width: 2; }
.map.focus-sai .map-mataf-group { opacity: 0.5; }
.map.focus-tawaf .map-masa-group { opacity: 0.5; }

/* ── Modals & Audio Overlay Bar ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: end center;
  animation: fade-in 0.25s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--surface-glass-border);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }

.picker { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.picker .btn { min-height: 58px; padding: 4px; flex-direction: column; gap: 0; font-size: 1.25rem; }
.picker small { font-size: 0.68rem; }

.audio-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 45;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  background: var(--surface-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--gold);
  border-radius: var(--radius-pill);
  font-weight: 700;
  box-shadow: var(--shadow-gold);
}

/* ── Tracking Sector, Corners, Sources ── */
.tracking-box { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.sources { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sources .chip { opacity: 0.5; font-size: 0.75rem; }
.sources .chip.on { opacity: 1; background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.sources .chip.warn { opacity: 1; }
.corners { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; padding: 0; margin: 0; }
.corners li {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  background: var(--surface);
}
.corners li.done { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.card.sector { border-left: 6px solid var(--gold); }
.card.sector p { margin: 6px 0 0; }
.card.inner { box-shadow: none; margin-top: 12px; }
.map-card summary, details.card.inner summary { cursor: pointer; font-weight: 700; }
.dua-play { align-self: flex-start; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 0.88em; }

/* ── Step Hero ── */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.step-card { text-align: center; padding: 12px 6px 4px; }
.step-card h1 { font-size: 1.85rem; margin: 8px 0; }
.step-card .lead { font-size: 1.12rem; }
.step-icon {
  font-size: 3.6rem;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.15));
}
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.lang-grid .btn { flex-direction: column; min-height: 96px; }
.lang-native { font-size: 1.45rem; font-weight: 800; }

.credit { text-align: center; font-size: 0.85rem; color: var(--gold); font-weight: 600; padding: 12px 0 4px; }
.dua .reciter { margin-top: 6px; font-size: 0.82rem; color: var(--accent); font-weight: 600; }

/* ── Advanced Recitation Player ── */
.listen-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
.player { width: 100%; display: flex; flex-direction: column; gap: 6px; padding: 8px 2px 2px; }
.player-track-wrap { position: relative; width: 100%; height: 30px; }
.player-track-fill {
  position: absolute;
  left: 0;
  top: 12px;
  height: 6px;
  border-radius: var(--radius-pill);
  width: var(--pct, 0%);
  max-width: 100%;
  background: var(--gold-gradient);
  pointer-events: none;
  box-shadow: 0 0 8px var(--gold-glow);
}
.player-seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.player-seek::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-pill); background: var(--border); }
.player-seek::-moz-range-track { height: 6px; border-radius: var(--radius-pill); background: var(--border); }
.player-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--surface);
  margin-top: -6px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.player-seek::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); }
.player-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player-time { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.btn.tiny { min-height: 30px; padding: 2px 12px; font-size: 0.8rem; font-weight: 700; border-radius: var(--radius-pill); }
.player-queue { margin: 0; font-size: 0.82rem; }
.btn.play-all { width: 100%; margin-bottom: 6px; }

.review-dot { display: inline-block; font-size: 0.75rem; line-height: 1; cursor: default; vertical-align: middle; }
.review-dot.warn { color: var(--warn-line); }
.review-dot.ok { color: var(--ok-ink); font-size: 0.9rem; }

/* ── Right-To-Left Languages (Urdu) ── */
main[dir="rtl"] { direction: rtl; text-align: right; }
main[dir="rtl"] .dua .arabic { text-align: center; }
main[dir="rtl"] .row, main[dir="rtl"] .row.actions, main[dir="rtl"] .lang-grid,
main[dir="rtl"] .tiles, main[dir="rtl"] .grid-buttons, main[dir="rtl"] .segmented,
main[dir="rtl"] .steps, main[dir="rtl"] .corners, main[dir="rtl"] .sources,
main[dir="rtl"] .chips { direction: ltr; }
main[dir="rtl"] .row > *, main[dir="rtl"] .tiles > *, main[dir="rtl"] .grid-buttons > *,
main[dir="rtl"] .chips > * { direction: rtl; }
main[dir="rtl"] .check { flex-direction: row; }
main[dir="rtl"] .summary { direction: ltr; }
main[dir="rtl"] .summary dt, main[dir="rtl"] .summary dd { text-align: right; direction: rtl; }
main[dir="rtl"] .status-current, main[dir="rtl"] .direction { direction: ltr; }
main[dir="rtl"] .status-current > *, main[dir="rtl"] .direction > * { direction: rtl; }

/* ── Reduced Motion Accessibility ── */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .scroll-reveal-item { opacity: 1; transform: none !important; }
}
