/* ── Custom Fonts ── */
@font-face {
  font-family: 'UthmanicWarsh';
  src: url('../fonts/uthmanic_warsh_v21.ttf') format('truetype');
}
@font-face {
  font-family: 'UthmanicHafs';
  src: url('../fonts/uthmanic_hafs_v20.ttf') format('truetype');
}
@font-face {
  font-family: 'Scheherazade';
  src: url('../fonts/ScheherazadeNew-Regular.ttf') format('truetype');
}

/* ── Design Tokens ── */
:root {
  --gold: #c9a84c;
  --gold-light: #e8c96a;
  --gold-dim: rgba(201, 168, 76, 0.15);
  --gold-glow: rgba(201, 168, 76, 0.35);
  --ink: #0d0a07;
  --ink-2: #1a1410;
  --ink-3: #241e16;
  --ink-4: #2e2720;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(201, 168, 76, 0.2);
  --border-bright: rgba(201, 168, 76, 0.5);
  --text-primary: #f5edd8;
  --text-secondary: #c4aa80;
  --text-muted: #7a6540;
  --highlight: rgba(201, 168, 76, 0.3);
  --highlight-active: rgba(201, 168, 76, 0.55);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 4px 24px rgba(201, 168, 76, 0.25);
  --font-ui: 'Scheherazade', serif;
  --font-quran: 'UthmanicWarsh', serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Mode Tokens ── */
body.light-mode {
  --gold: #9a6e1a;
  --gold-light: #b8861e;
  --gold-dim: rgba(154, 110, 26, 0.12);
  --gold-glow: rgba(154, 110, 26, 0.25);
  --ink: #faf7f1;
  --ink-2: #f3ede0;
  --ink-3: #ebe2cf;
  --ink-4: #e0d5be;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-hover: rgba(0, 0, 0, 0.06);
  --border: rgba(154, 110, 26, 0.2);
  --border-bright: rgba(154, 110, 26, 0.45);
  --text-primary: #2a1f0e;
  --text-secondary: #5c4420;
  --text-muted: #9a7a4a;
  --highlight: rgba(154, 110, 26, 0.18);
  --highlight-active: rgba(154, 110, 26, 0.32);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-gold: 0 4px 24px rgba(154, 110, 26, 0.2);
}

/* Light mode specific overrides */
body.light-mode body::before {
  opacity: 0.25;
}

body.light-mode .offcanvas {
  background: linear-gradient(
    160deg,
    var(--ink-3) 0%,
    var(--ink-2) 100%
  ) !important;
}

body.light-mode .bottom-controls {
  background: linear-gradient(
    180deg,
    rgba(235, 226, 207, 0.92) 0%,
    rgba(227, 218, 200, 0.98) 100%
  ) !important;
  border-top: 1px solid var(--border) !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .ctrl-btn {
  color: var(--text-secondary) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .speed-label {
  color: var(--gold) !important;
}

body.light-mode .quran-text {
  background: rgba(255, 255, 255, 0.7) !important;
  box-shadow:
    0 4px 40px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

body.light-mode .quran-text-container {
  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(154, 110, 26, 0.07) 0%,
      transparent 60%
    ),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%) !important;
}

body.light-mode .header {
  background: linear-gradient(
    180deg,
    var(--ink-3) 0%,
    rgba(235, 226, 207, 0.97) 100%
  ) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07) !important;
}

body.light-mode .sura-header {
  background: linear-gradient(
    135deg,
    rgba(154, 110, 26, 0.1),
    rgba(154, 110, 26, 0.04)
  ) !important;
}

body.light-mode .modal-content {
  background: linear-gradient(160deg, var(--ink-2), var(--ink)) !important;
}

body.light-mode .btn-close {
  filter: none !important;
  opacity: 0.5;
}
body.light-mode .btn-close:hover {
  opacity: 0.9;
  filter: none !important;
}

body.light-mode .form-select,
body.light-mode .form-control {
  background-color: rgba(255, 255, 255, 0.7);
}

body.light-mode .report-input {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-primary);
}

/* ── Theme Toggle Button ── */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
}
.theme-toggle-btn:hover {
  border-color: var(--border-bright);
  background: var(--surface-hover);
  color: var(--text-primary);
}

.theme-toggle-track {
  width: 38px;
  height: 20px;
  background: var(--ink-4);
  border-radius: 50px;
  border: 1px solid var(--border);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.theme-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  transition:
    transform var(--transition),
    background var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
body.light-mode .theme-toggle-track {
  background: var(--gold-dim);
  border-color: var(--gold);
}
body.light-mode .theme-toggle-track::after {
  transform: translateX(-18px);
  background: var(--gold);
}

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

html,
body {
  height: 100%;
  max-height: 100dvh;
  overscroll-behavior: none;
  font-family: var(--font-ui);
  background-color: var(--ink);
  color: var(--text-primary);
  overflow: hidden;
}
body {
  height: 100dvh;
}

/* ── Noise texture overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
  opacity: 0.4;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-light);
}

/* ── Layout Shell ── */
.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar Drawer ── */
.offcanvas {
  background: linear-gradient(160deg, var(--ink-3) 0%, var(--ink-2) 100%);
  border-left: 1px solid var(--border);
  width: 300px !important;
  max-width: 88vw;
  backdrop-filter: blur(20px);
  z-index: 1100 !important;
}

/* Force offcanvas + backdrop above everything including bottom bar */
:root {
  --bs-offcanvas-zindex: 1100;
}
.offcanvas,
.offcanvas.show,
.offcanvas.showing,
.offcanvas.hiding {
  z-index: 1100 !important;
}
.offcanvas-backdrop,
.offcanvas-backdrop.show {
  z-index: 1099 !important;
}

.offcanvas-header {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.12), transparent);
}

.sidebar-logo {
  height: 36px;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}

.btn-close {
  filter: invert(1) opacity(0.6);
  transition: opacity var(--transition);
}
.btn-close:hover {
  opacity: 1;
  filter: invert(1);
}

/* ── Sidebar sections ── */
.offcanvas-body {
  padding: 18px 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color var(--transition);
}
.sidebar-section:hover {
  border-color: var(--border-bright);
}

.sidebar-section-title {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--gold-dim));
}

/* ── Select / Form Controls ── */
.form-label {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 5px;
  display: block;
}

.form-select,
.form-control {
  background: var(--ink-4);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 8px 12px;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c9a84c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 30px;
}
.form-select:focus,
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  background-color: var(--ink-3);
}
.form-select option {
  background: var(--ink-3);
  color: var(--text-primary);
}
.form-select:hover {
  border-color: rgba(201, 168, 76, 0.4);
}

/* ── Sidebar Buttons ── */
.btn-custom {
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.btn-custom:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}
.btn-custom:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

.btn-custom.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-custom.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
  box-shadow: none;
}

/* ── Audio player in sidebar ── */
audio#audio-player {
  width: 100%;
  height: 32px;
  border-radius: var(--radius-sm);
  accent-color: var(--gold);
  filter: invert(1) hue-rotate(180deg) brightness(0.85);
}

/* ── Header ── */
.header {
  background: linear-gradient(
    180deg,
    var(--ink-3) 0%,
    rgba(26, 20, 16, 0.95) 100%
  );
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  flex-shrink: 0;
  overflow: hidden;
  max-height: 120px;
  opacity: 1;
  transition:
    max-height 0.4s ease,
    opacity 0.3s ease,
    padding 0.35s ease;
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto;
}

/* ── Navigation buttons ── */
.nav-btn {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 0;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-btn i {
  font-size: 1rem;
  line-height: 1;
  display: block;
}
.nav-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: var(--shadow-gold);
}
.nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* ── Header title block ── */
.header-title-block {
  text-align: center;
  flex: 1;
  min-width: 160px;
  max-width: 360px;
}

#sura-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

#page-info {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
  letter-spacing: 0.06em;
}

/* ── Riwaya badge ── */
.riwaya-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  border-radius: 50px;
  padding: 3px 12px;
  font-size: 0.8rem;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.riwaya-badge::after {
  content: '⇅';
  font-size: 0.8rem;
  opacity: 0.7;
}
.riwaya-badge:hover {
  background: rgba(201, 168, 76, 0.25);
  box-shadow: var(--shadow-gold);
  transform: scale(1.04);
}

/* ── Main Content ── */
.main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
  position: relative;
  z-index: 1;
}

/* ── Quran text container ── */
.quran-text-container {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 24px 16px 80px;
  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(201, 168, 76, 0.06) 0%,
      transparent 60%
    ),
    linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
}

.quran-text-inner {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Quran text block ── */
.quran-text {
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.035) 0%,
    rgba(255, 255, 255, 0.018) 100%
  );
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  line-height: 2.8;
  font-size: 28px;
  font-family: var(--font-quran);
  text-align: justify;
  min-height: 300px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(201, 168, 76, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  transition: font-size var(--transition);
}

/* Decorative corner accents */
.quran-text::before,
.quran-text::after {
  content: '';
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--gold);
  border-style: solid;
  opacity: 0.45;
}
.quran-text::before {
  top: 10px;
  right: 10px;
  border-width: 2px 2px 0 0;
  border-radius: 0 4px 0 0;
}
.quran-text::after {
  bottom: 10px;
  left: 10px;
  border-width: 0 0 2px 2px;
  border-radius: 0 0 4px 0;
}

/* ── Ayah spans ── */
.ayah {
  display: inline;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  transition: background 0.18s ease;
}
.ayah:hover {
  background: rgba(201, 168, 76, 0.18);
}
.ayah.active {
  background: var(--highlight-active);
  border-radius: 4px;
  transition:
    background 0.25s ease,
    color 0.25s ease;
}

/* ── Surah header & basmala ── */
.sura-header {
  text-align: center;
  font-family: var(--font-ui);
  color: var(--gold-light);
  background: linear-gradient(
    135deg,
    rgba(201, 168, 76, 0.12),
    rgba(201, 168, 76, 0.04)
  );
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 24px;
  margin: 18px 0 8px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  position: relative;
}
.sura-header::before,
.sura-header::after {
  content: '✦';
  color: var(--gold-dim);
  font-size: 0.8rem;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.sura-header::before {
  right: 16px;
}
.sura-header::after {
  left: 16px;
}

.basmala {
  text-align: center;
  font-family: var(--font-ui);
  color: var(--text-secondary);
  font-size: 1.1em;
  margin: 4px 0 12px;
  opacity: 0.85;
}

/* ── Bottom Controls Bar ── */
.bottom-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px 10px;
  background: linear-gradient(
    180deg,
    rgba(13, 10, 7, 0.85) 0%,
    rgba(10, 8, 5, 0.97) 100%
  );
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
}

.ctrl-btn {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.ctrl-btn i {
  font-size: 0.9rem;
  line-height: 1;
  display: block;
}
.ctrl-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-bright);
  color: var(--gold-light);
  transform: scale(1.1);
}
.ctrl-btn:active {
  transform: scale(0.94);
}
.ctrl-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.ctrl-btn--primary {
  width: 46px;
  height: 46px;
  font-size: 0;
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  border: none;
  color: var(--ink);
  box-shadow: 0 2px 16px rgba(201, 168, 76, 0.4);
  border-radius: 50%;
}
.ctrl-btn--primary i {
  font-size: 1.15rem;
  line-height: 1;
  display: block;
}
.ctrl-btn--primary:hover {
  filter: brightness(1.15);
  transform: scale(1.12);
  box-shadow: 0 4px 24px rgba(201, 168, 76, 0.55);
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  border: none;
}

.speed-btn {
  width: 28px;
  height: 28px;
  font-size: 0;
}
.speed-btn i {
  font-size: 0.78rem;
  line-height: 1;
  display: block;
}

.speed-label {
  color: var(--gold);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ctrl-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* ── Audio Progress Strip ── */
.audio-progress-strip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.audio-progress-strip.is-playing {
  opacity: 1;
}
.audio-progress-strip__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 0 1px 1px 0;
  box-shadow: 0 0 8px var(--gold-glow);
}

/* ── Speed-dial FAB ── */
.fab-speed-dial {
  position: fixed;
  left: 14px;
  bottom: 70px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Main trigger button */
.fab-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  color: var(--ink);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.45),
    var(--shadow-gold);
  transition: all var(--transition);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.fab-trigger:hover {
  filter: brightness(1.15);
  transform: scale(1.08);
}
.fab-trigger:active {
  transform: scale(0.93);
}
.fab-trigger .fab-trigger-icon {
  font-size: 1.05rem;
  line-height: 1;
  display: block;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.fab-speed-dial.open .fab-trigger .fab-trigger-icon {
  transform: rotate(45deg);
}

/* Child action buttons */
.fab-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  /* closed state */
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.2s ease,
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fab-speed-dial.open .fab-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink-3);
  color: var(--gold);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  transition: all var(--transition);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.fab-action-btn i {
  font-size: 0.9rem;
  line-height: 1;
  display: block;
}
.fab-action-btn:hover {
  background: var(--gold-dim);
  border-color: var(--gold);
  box-shadow: var(--shadow-gold);
  transform: scale(1.1);
}
.fab-action-btn:active {
  transform: scale(0.93);
}

/* Staggered entrance for each child */
.fab-actions .fab-action-btn:nth-child(1) {
  transition-delay: 0ms;
}
.fab-actions .fab-action-btn:nth-child(2) {
  transition-delay: 30ms;
}
.fab-actions .fab-action-btn:nth-child(3) {
  transition-delay: 60ms;
}
.fab-actions .fab-action-btn:nth-child(4) {
  transition-delay: 90ms;
}

/* Backdrop to close on outside tap */
.fab-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 949;
}
.fab-speed-dial.open ~ .fab-backdrop {
  display: block;
}

/* Fullscreen enter/exit — live on the action btns */
.fab-fs-enter {
  display: flex;
}
.fab-fs-exit {
  display: none;
}
body.fullscreen-mode .fab-fs-enter {
  display: none;
}
body.fullscreen-mode .fab-fs-exit {
  display: flex;
}

/* Light mode tweaks */
body.light-mode .fab-action-btn {
  background: var(--ink-3);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

/* ── Fullscreen mode ── */
body.fullscreen-mode .header {
  max-height: 0 !important;
  opacity: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  pointer-events: none;
}
body.fullscreen-mode .quran-text-container {
  padding-top: 12px;
}

.fab-fullscreen-enter {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
body.fullscreen-mode .fab-fullscreen-enter {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}
.fab-fullscreen-exit {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}
body.fullscreen-mode .fab-fullscreen-exit {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

/* ── Modal base overrides ── */
.modal-content {
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary);
  font-family: var(--font-ui);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(201, 168, 76, 0.1);
  overflow: hidden;
}
.modal-header {
  background: linear-gradient(
    135deg,
    rgba(201, 168, 76, 0.15),
    rgba(201, 168, 76, 0.04)
  );
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}
.modal-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
}
.modal-body {
  padding: 20px 22px;
}
.modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
}

/* ── Warsh Modal ── */
.warsh-modal-header {
  background: linear-gradient(
    135deg,
    rgba(201, 168, 76, 0.2),
    rgba(139, 90, 43, 0.15)
  ) !important;
}
.warsh-font {
  font-family: 'UthmanicWarsh', serif;
}
.warsh-card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 16px;
}
.warsh-card-trust {
  background: rgba(201, 168, 76, 0.06);
  border-color: rgba(201, 168, 76, 0.35) !important;
}
.warsh-card-title {
  color: var(--gold-light);
}
.warsh-text {
  color: var(--text-secondary);
}
.warsh-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.warsh-dot-brown {
  background: var(--gold);
}
.warsh-dot-gold {
  background: var(--gold-light);
}
.warsh-letter-card {
  background: var(--ink-4);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
}
.warsh-letter-demo {
  font-size: 2.6rem;
  color: var(--gold-light);
  line-height: 1.3;
}
.warsh-letter-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.warsh-link {
  color: var(--gold);
  text-decoration: none;
}
.warsh-link:hover {
  color: var(--gold-light);
  text-decoration: underline !important;
}
.warsh-modal-footer {
  border-color: var(--border) !important;
}
.warsh-progress-wrapper {
  min-width: 130px;
}
.warsh-progress-track {
  height: 4px;
  background: var(--ink-4);
  border-radius: 4px;
  overflow: hidden;
}
.warsh-progress-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 4px;
}
.warsh-timer-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
}
.warsh-close-btn {
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 20px;
  transition: all var(--transition);
}
.warsh-close-btn:not(.disabled):hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
  color: var(--ink);
}
.warsh-close-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── About Modal ── */
.about-card {
  background: var(--surface);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: 14px;
  transition: border-color var(--transition);
}
.about-card:hover {
  border-color: rgba(201, 168, 76, 0.4) !important;
}
.about-card-report {
  background: rgba(201, 168, 76, 0.05);
  border-color: rgba(201, 168, 76, 0.3) !important;
}
.about-card-title {
  color: var(--gold-light);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.about-text {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.8;
}
.about-link {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}
.about-link:hover {
  color: var(--gold-light);
  text-decoration: underline !important;
}
.about-report-btn {
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 9px 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
  cursor: pointer;
}
.about-report-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
  color: var(--ink);
}

/* ── Report Modal ── */
.report-modal-header {
  background: linear-gradient(
    135deg,
    rgba(201, 50, 50, 0.15),
    rgba(201, 168, 76, 0.08)
  ) !important;
}
.report-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}
.report-input {
  background: var(--ink-4);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}
.report-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
  background: var(--ink-3);
  color: var(--text-primary);
}
.report-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
.report-input option {
  background: var(--ink-3);
}
textarea.report-input {
  resize: vertical;
  min-height: 88px;
}
.report-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}
.report-status {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  text-align: center;
}
.report-status--success {
  background: rgba(50, 180, 80, 0.12);
  color: #6ed88a;
  border: 1px solid rgba(50, 180, 80, 0.3);
}
.report-status--error {
  background: rgba(220, 60, 60, 0.12);
  color: #f08080;
  border: 1px solid rgba(220, 60, 60, 0.3);
}
.report-submit-btn {
  background: linear-gradient(135deg, var(--gold), #a87d2a);
  color: var(--ink);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 11px;
  width: 100%;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.report-submit-btn:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}
.report-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.report-field-error {
  font-size: 0.78rem;
  color: #f08080;
  min-height: 1rem;
  margin-top: 3px;
}
.report-input--error {
  border-color: rgba(220, 60, 60, 0.7) !important;
  background: rgba(220, 60, 60, 0.05) !important;
}
.report-input--error:focus {
  box-shadow: 0 0 0 3px rgba(220, 60, 60, 0.12) !important;
}

/* ── Responsive ── */
@media (max-width: 767px) {
  .bottom-controls {
    gap: 2px;
    padding: 6px 8px 8px;
  }
  .ctrl-btn {
    width: 30px;
    height: 30px;
  }
  .ctrl-btn i {
    font-size: 0.8rem;
  }
  .ctrl-btn--primary {
    width: 40px;
    height: 40px;
  }
  .ctrl-btn--primary i {
    font-size: 1rem;
  }
  .speed-btn {
    width: 24px;
    height: 24px;
  }
  .speed-btn i {
    font-size: 0.7rem;
  }
  .speed-label {
    font-size: 0.72rem;
    min-width: 22px;
  }
  .header {
    padding: 8px 10px;
  }
  .nav-btn {
    width: 34px;
    height: 34px;
  }
  .nav-btn i {
    font-size: 0.88rem;
  }
  #sura-title {
    font-size: 0.9rem;
  }
  .quran-text-container {
    padding: 12px 10px 76px;
  }
  .quran-text {
    font-size: 20px;
    padding: 22px 14px;
    line-height: 2.3;
  }
  .fab-speed-dial {
    left: 10px;
    bottom: 62px;
  }
  .fab-trigger {
    width: 36px;
    height: 36px;
  }
  .fab-trigger .fab-trigger-icon {
    font-size: 0.95rem;
  }
  .fab-action-btn {
    width: 32px;
    height: 32px;
  }
  .fab-action-btn i {
    font-size: 0.82rem;
  }
  .offcanvas {
    width: 280px !important;
  }
  .sura-header {
    font-size: 1rem;
    padding: 8px 16px;
  }
}

@media (max-width: 374px) {
  .quran-text {
    font-size: 18px;
    padding: 18px 10px;
  }
  .nav-btn {
    width: 30px;
    height: 30px;
  }
  #sura-title {
    font-size: 0.82rem;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .header {
    padding: 6px 10px;
  }
  .quran-text-container {
    padding: 8px 10px 72px;
  }
  .quran-text {
    font-size: 17px;
    line-height: 2;
    padding: 16px 12px;
  }
}

/* ── Print ── */
@media print {
  .offcanvas,
  .header,
  .nav-btn,
  .fab-speed-dial,
  .fab-backdrop,
  .bottom-controls {
    display: none !important;
  }
  .main-content {
    height: auto;
  }
  .quran-text-container {
    padding: 0;
    background: #fff;
  }
  .quran-text {
    box-shadow: none;
    border: 1px solid #ccc;
    color: #000;
    background: #fff;
  }
}

/* ── Entrance animation ── */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.quran-text {
  animation: fadeSlideUp 0.45s ease both;
}
