/* ======================================================
   GLOBAL RESET + SAFETY
====================================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
}

.no-copy {
  user-select: none;
  -webkit-user-select: none;
}

/* ======================================================
   ROOT DESIGN TOKENS
====================================================== */
:root {
  --bg-main: #fafafa;
  --bg-card: #ffffff;
  --bg-muted: #f2f2f7;

  --text-main: #1c1c1e;
  --text-secondary: #6e6e73;

  --accent: #bfa742;
  --accent-soft: rgba(191,167,66,0.15);

  --border-light: rgba(0,0,0,0.08);

  --radius-lg: 20px;
  --radius-md: 14px;

  --font-quran: "Amiri Quran", serif;

  /* Reading variables (JS controlled) */
  --arabic-font-size: 1.9rem;
  --arabic-line-height: 4.1rem;
  --translation-font-size: 1.05rem;
  --translation-line-height: 1.9rem;

  --reading-line-opacity: 0.14;
}

/* ======================================================
   BODY
====================================================== */
body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
  padding-bottom: 120px;
}

/* ======================================================
   TOP BAR
====================================================== */
.surah-top-bar {
  position: sticky;
  top: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 10px 12px;
  background: rgba(250,250,250,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.back-btn {
  position: absolute;
  left: 16px;
  font-size: 20px;
  text-decoration: none;
  color: var(--accent);
}

.surah-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.surah-meta {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
}

/* ======================================================
   READING SETTINGS BUTTON
====================================================== */
.reading-settings-btn {
  position: absolute;
  right: 16px;

  height: 32px;
  min-width: 36px;

  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border-light);

  background: var(--bg-card);
  color: var(--text-secondary);

  font-size: 12px;
  font-weight: 700;
  cursor: pointer;

  transition: transform 0.15s ease, background 0.2s ease;
}

.reading-settings-btn:active {
  transform: scale(0.96);
}

/* ======================================================
   READING CONTROLS (SLIDERS)
====================================================== */
.reading-controls {
  display: none;
  max-width: 760px;
  margin: 14px auto 6px;
  padding: 0 16px;
}

.reading-controls.open {
  display: block;
}

.reading-controls label {
  display: block;
  margin-bottom: 18px;

  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.reading-controls input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ======================================================
   SURAH CONTAINER
====================================================== */
.surah-container {
  max-width: 720px;
  margin: auto;
  padding: 22px 16px 0;
}

/* ======================================================
   AYAH CARD
====================================================== */
.ayah-card {
  position: relative;
  margin-bottom: 36px;
  padding: 28px 26px;

  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 26px rgba(0,0,0,0.04);

  scroll-margin-top: 120px;
}

/* ======================================================
   AYAH TEXT (MUSHAF STYLE)
====================================================== */
.ayah-text {
  direction: rtl;
  text-align: center;

  font-family: var(--font-quran);
  font-size: var(--arabic-font-size);
  line-height: var(--arabic-line-height);

  max-width: 40ch;
  margin: auto;

  font-feature-settings: "liga" 1, "calt" 1;

  background-image: linear-gradient(
    to bottom,
    transparent 86%,
    rgba(0,0,0,var(--reading-line-opacity)) 86%,
    rgba(0,0,0,var(--reading-line-opacity)) 88%,
    transparent 88%
  );
  background-size: 100% var(--arabic-line-height);
}

.ayah-number {
  font-size: 1.05rem;
  color: var(--accent);
  margin-inline-start: 0.4rem;
}

/* ======================================================
   BOOKMARK MARKER
====================================================== */
.ayah-marker {
  position: absolute;
  left: 14px;
  top: 22px;

  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(191,167,66,0.3);
  cursor: pointer;
}

.ayah-card.marked {
  background: var(--accent-soft);
}

.ayah-card.marked .ayah-marker {
  background: var(--accent);
}

/* ======================================================
   FLOATING BOOKMARK BUTTON
====================================================== */
.floating-bookmark-btn {
  position: fixed;
  right: 18px;
  bottom: 92px;

  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;

  background: rgba(191,167,66,0.9);
  color: #fff;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  z-index: 999;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.floating-bookmark-btn[hidden] {
  display: none;
}

/* ======================================================
   AUDIO BAR
====================================================== */
.audio-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

  background: rgba(255, 255, 255, 0.056);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-light);

  padding: 10px 14px;
  z-index: 50;

  display: flex;
  justify-content: center;
}

.audio-bar audio {
  width: min(680px, 100%);
  border-radius: var(--radius-md);
}









/* ================= AUDIO BAR ================= */



/* ================= AUDIO PLAYER ================= */

audio {
  width: 100%;
  border-radius: 0.75rem;
  background: transparent;
}

/* DIM MODE → darker professional gray/blue (#0e1520 feel) */
body.dim audio {
  filter:
    invert(0.92)       /* darker base */
    hue-rotate(180deg) /* keep tint natural */
    brightness(0.80)   /* slightly darker */
    contrast(1);       /* maintain clarity */
  opacity: 0.95;       /* subtle polish */
}

/* DARK MODE → deep professional gray/blue (#0e1520 feel) */
body.dark audio {
  filter:
    invert(0.92)       
    hue-rotate(180deg) 
    brightness(0.75)   /* slightly darker than dim mode */
    contrast(1);       
  opacity: 0.95;       
}



/* ================= AUDIO PLAYER ================= */





/* ======================================================
   DARK / DIM MODES
====================================================== */
body.dim {
  --bg-main: #0f141c;
  --bg-card: #161e2f;
  --bg-muted: #141c2d;

  --text-main: #f2f2f7;
  --text-secondary: #a1a1aa;
  --border-light: rgba(255,255,255,0.08);
}

body.dark {
  --bg-main: #000;
  --bg-card: #0b1020;
  --bg-muted: #050e34;

  --text-main: #f2f2f7;
  --text-secondary: #a1a1aa;
  --border-light: rgba(255,255,255,0.08);
}

body.dark .ayah-text,
body.dim .ayah-text {
  background-image: linear-gradient(
    to bottom,
    transparent 86%,
    rgba(255,255,255,calc(var(--reading-line-opacity) + 0.03)) 86%,
    rgba(255,255,255,calc(var(--reading-line-opacity) + 0.03)) 88%,
    transparent 88%
  );
}

/* ======================================================
   MOBILE REFINEMENTS
====================================================== */
@media (max-width: 480px) {
  .ayah-text {
    max-width: 32ch;
  }

  .surah-title {
    font-size: 16px;
  }
}
