/* ===========================
   HOME (html/index.html)
   =========================== */
body.page-home main {
  padding: clamp(32px, 6vw, 80px) clamp(18px, 8vw, 96px);
}
.home {
  display: grid;
  gap: clamp(32px, 6vw, 72px);
}
.hero {
  position: relative;
  display: grid;
  gap: clamp(24px, 5vw, 48px);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: center;
  padding: clamp(32px, 5vw, 60px);
  border-radius: 38px;
  background: linear-gradient(135deg, rgba(12, 62, 24, 0.98), rgba(20, 110, 46, 0.88));
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-shadow: 0 36px 70px rgba(12, 62, 24, 0.28);
}

body[data-theme="dark"] .hero {
  background: linear-gradient(135deg, rgba(22, 35, 26, 0.98), rgba(30, 50, 38, 0.95));
  box-shadow: 0 36px 70px rgba(0, 0, 0, 0.6);
}

body[data-theme="sepia"] .hero {
  background: linear-gradient(135deg, rgba(138, 95, 26, 0.95), rgba(160, 115, 40, 0.88));
  box-shadow: 0 36px 70px rgba(138, 95, 26, 0.35);
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto auto -40% 55%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle at center, rgba(208, 161, 43, 0.32), transparent 68%);
  opacity: 0.9;
}
.hero-body {
  position: relative;
  display: grid;
  gap: 18px;
  z-index: 1;
}
.hero-body .eyebrow {
  font-size: 0.82rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.hero-body h1 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 2.9rem);
  line-height: 1.1;
  font-weight: 700;
  color: #ffffff;
}
.hero-body p {
  margin: 0;
  color: rgba(255,255,255,0.78);
  font-size: clamp(1rem, 2vw, 1.1rem);
  max-width: 580px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero .btn.primary {
  background: #ffffff;
  color: #0c3e18;
  border-color: transparent;
}

.hero .btn.primary:hover {
  background: #e6f4eb;
  color: #0c3e18;
}

body[data-theme="dark"] .hero .btn.primary {
  background: #5fb377;
  color: #0a0f0d;
}

body[data-theme="dark"] .hero .btn.primary:hover {
  background: #7bc98f;
  color: #0a0f0d;
}

body[data-theme="sepia"] .hero .btn.primary {
  background: #fff6e8;
  color: #4a3417;
}

body[data-theme="sepia"] .hero .btn.primary:hover {
  background: #f3e8d1;
  color: #4a3417;
}
.hero .btn.ghost {
  background: rgba(255,255,255,0.14);
  color: #ffffff;
  border-color: rgba(255,255,255,0.24);
}
.hero .btn.ghost:hover {
  background: rgba(255,255,255,0.22);
}
.hero-glance {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.glance-item {
  background: rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 14px 18px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(12px);
}
.glance-item .label {
  font-size: 0.74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.glance-item .value {
  font-weight: 600;
  font-size: 1rem;
  color: #ffffff;
}
.hero-card {
  position: relative;
  z-index: 1;
  align-self: stretch;
  display: grid;
  place-items: center;
}
.hero-card-inner {
  width: min(340px, 100%);
  background: rgba(255,255,255,0.08);
  border-radius: 28px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(14px);
  display: grid;
  gap: 18px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
}
.hero-metric {
  display: grid;
  gap: 4px;
}
.hero-metric span {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: rgba(255,255,255,0.7);
}
.hero-progress {
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  overflow: hidden;
  position: relative;
}
.hero-progress::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 58%;
  border-radius: inherit;
  background: linear-gradient(135deg, #d0a12b, #f9cd55);
  box-shadow: 0 10px 20px rgba(208, 161, 43, 0.38);
}
.hero-metric strong {
  font-size: 1.9rem;
  font-weight: 700;
  color: #ffffff;
}
.hero-note {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.5;
}

.menu {
  display: grid;
  gap: 24px;
}
.section-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: var(--text);
}
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 520px;
}
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.menu-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 24px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(12, 62, 24, 0.12);
  box-shadow: 0 18px 40px rgba(12, 62, 24, 0.12);
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}

body[data-theme="dark"] .menu-card {
  background: rgba(22, 35, 26, 0.9);
  border-color: rgba(95, 179, 119, 0.18);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
}

body[data-theme="sepia"] .menu-card {
  background: rgba(243, 232, 209, 0.88);
  border-color: rgba(138, 95, 26, 0.18);
  box-shadow: 0 18px 40px rgba(138, 95, 26, 0.15);
}
.menu-card::after {
  content: "";
  position: absolute;
  inset: auto -40% -60% 20%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle at center, rgba(208, 161, 43, 0.28), transparent 70%);
  opacity: 0;
  transition: opacity .22s ease;
}
.menu-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 28px 60px rgba(12, 62, 24, 0.18);
}

body[data-theme="dark"] .menu-card:hover {
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.6);
}

body[data-theme="sepia"] .menu-card:hover {
  box-shadow: 0 28px 60px rgba(138, 95, 26, 0.22);
}
.menu-card:hover::after { opacity: 0.9; }
.menu-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(12, 62, 24, 0.12);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

body[data-theme="dark"] .menu-card-icon {
  background: rgba(95, 179, 119, 0.18);
  box-shadow: inset 0 1px 0 rgba(95, 179, 119, 0.15);
}

body[data-theme="sepia"] .menu-card-icon {
  background: rgba(138, 95, 26, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 246, 232, 0.5);
}
.menu-card h2 {
  margin: 0;
  font-size: 1.2rem;
}
.menu-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}
.menu-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.menu-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(12, 62, 24, 0.08);
}

body[data-theme="dark"] .menu-meta span {
  background: rgba(95, 179, 119, 0.12);
}

body[data-theme="sepia"] .menu-meta span {
  background: rgba(138, 95, 26, 0.1);
}
.menu-meta ion-icon { font-size: 1rem; }

.quick-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.quick-nav label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.quick-nav .nav-select,
.quick-nav select {
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(12,62,24,0.08);
}
.quick-nav select:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .quick-nav {
    align-items: stretch;
  }
  .quick-nav label {
    width: 100%;
  }
  .quick-nav select {
    width: 100%;
    min-width: 0;
  }
}

.page-hero {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
  padding: clamp(28px, 5vw, 48px);
  margin: clamp(24px, 5vw, 48px) 0;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(12, 62, 24, 0.9), rgba(20, 110, 46, 0.82));
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 60px rgba(12, 62, 24, 0.22);
}
.page-hero .hero-copy {
  display: grid;
  gap: 18px;
}
.page-hero .eyebrow {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.page-hero h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  line-height: 1.2;
  color: #ffffff;
}
.page-hero p {
  margin: 0;
  color: rgba(255,255,255,0.78);
  font-size: 1rem;
  max-width: 520px;
}
.page-hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.page-hero .btn.ghost {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
  border-color: rgba(255,255,255,0.28);
}
.page-hero .btn.ghost:hover {
  background: rgba(255,255,255,0.22);
}
.page-hero .hero-stats {
  display: grid;
  gap: 14px;
}
.hero-stat {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 18px;
  padding: 16px 20px;
  display: grid;
  gap: 6px;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.hero-stat .label {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.hero-stat .value {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: #ffffff;
}
.hifdh-hero {
  background: linear-gradient(135deg, rgba(12, 62, 24, 0.92), rgba(22, 92, 42, 0.82));
}
.test-hero {
  background: linear-gradient(135deg, rgba(38, 61, 120, 0.92), rgba(64, 92, 152, 0.82));
}
.settings-hero {
  background: linear-gradient(135deg, rgba(10, 88, 60, 0.9), rgba(18, 132, 92, 0.78));
}

@media (max-width: 720px) {
  .page-hero {
    border-radius: 22px;
  }
}


@media (max-width: 720px) {
  .hero {
    border-radius: 28px;
  }
  .hero-body h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); }
  .hero-card-inner { width: 100%; }
  .menu-card {
    padding: 20px;
    border-radius: 22px;
  }
}

/* ===========================
   HIFDH PROGRESS (html/hifdh.html)
   =========================== */
.wrap { max-width: 1000px; margin: 20px auto; padding: 0 20px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stat { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; box-shadow: inset 0 1px 2px rgba(12,62,24,0.04); }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-weight: 600; font-size: 16px; }
.list { display: grid; gap: 10px; max-height: 60vh; overflow: auto; padding-right: 4px; }
.surah { display: grid; grid-template-columns: 44px 1fr 320px; gap: 10px; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.sid { width: 44px; text-align: center; font-weight: 600; color: var(--text-dim); }
.names { display: flex; flex-direction: column; }
.names .en { font-weight: 600; }
.names .ar { font-family: 'Amiri Quran', serif; color: var(--muted); font-size: 18px; }
.ctrls { display: grid; gap: 6px; }
.ctrls .top { display: flex; align-items: center; gap: 8px; }
.ctrls .top .perc { min-width: 70px; text-align: right; }
.ctrls input[type="range"] { width: 100%; }
.quick { display: flex; gap: 6px; }
.plan-pages { font-size: 22px; font-weight: 600; color: var(--text); }
.quick button { cursor: pointer; border-radius: 999px; border: 1px solid transparent; padding: 6px 12px; background: var(--accent); color: #291a00; font-size: 12px; font-weight: 600; transition: transform .2s ease, box-shadow .2s ease; }
.quick button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(12,62,24,0.12); }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }

.plan-assignment { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.plan-start-custom { display: grid; gap: 8px; }
#plan-assignment-card.completed { border-color: var(--ring); background: rgba(34,197,94,0.12); }

#plan-status-text { font-size: 13px; }
.plan-actions { justify-content: space-between; }
.plan-actions .btn { flex: 1 1 200px; }
.plan-start-input { width: 120px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); box-shadow: inset 0 1px 2px rgba(12,62,24,0.06); }
.plan-start-inputs { display: flex; gap: 12px; flex-wrap: wrap; }
.plan-start-inputs .plan-start-input { width: 120px; }
#plan-unit { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); box-shadow: inset 0 1px 2px rgba(12,62,24,0.06); }
@media (max-width: 640px) {
  .plan-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .plan-actions .btn { width: 100%; }
}
.field { display: grid; gap: 6px; }
.field input, .field select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); box-shadow: inset 0 1px 2px rgba(12,62,24,0.06); }
.sep { height: 1px; background: var(--border); margin: 8px 0; }

/* ===========================
   HIFDH TEST (html/hifdh-test.html)
   =========================== */
.shell { max-width: 1100px; margin: 16px auto; padding: 0 20px; }
.panel { background: var(--surface); border:1px solid var(--border); border-radius: 18px; padding: 18px; margin: 14px 0; box-shadow: var(--shadow-sm); }
.row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.field { display:flex; flex-direction:column; gap:6px; min-width: 220px; }
.field input[type="text"], .field input[type="number"], .field select { background: var(--surface-soft); color: var(--text); border:1px solid var(--border); border-radius:12px; padding:10px 12px; box-shadow: inset 0 1px 2px rgba(12,62,24,0.06); }
.options { display:flex; gap:10px; flex-wrap:wrap; }
.question { direction: rtl; font-family: 'Amiri Quran', serif; font-size: var(--arabic-size, 34px); line-height:2.1; padding: 12px; }
.choices { display:grid; grid-template-columns: 1fr; gap: 10px; }
.choices button { text-align:right; }
.muted { color: var(--muted); font-size: 12px; }
.draggable-list { list-style: none; padding: 0; margin: 0; }
.draggable-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin: 8px 0; cursor: move; direction: rtl; font-family: 'Amiri Quran', serif; font-size: var(--arabic-size, 30px); box-shadow: var(--shadow-sm); }
.draggable-list li.locked { background: var(--surface); cursor: default; border-style: dashed; }
.draggable-list li.correct { border-color: var(--primary); outline: 2px solid var(--ring); background: rgba(34,197,94,0.08); }
.hidden { display:none !important; }

/* ===========================
   SETTINGS (html/settings.html)
   =========================== */
.settings-wrap { max-width: 800px; margin: 24px auto; padding: 0 20px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card h2 { margin: 0 0 10px; font-size: 18px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.option { display: flex; gap: 10px; align-items: center; }
.preview { font-family: 'Amiri Quran', serif; border: 1px dashed var(--border); border-radius: 14px; padding: 12px 14px; margin-top: 10px; background: var(--surface-soft); }
.preview-tr { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial; direction: ltr; color: var(--text-dim); }
.stack { display: grid; gap: 8px; }

/* ===========================
   SURAHS LIST (html/surahs.html)
   ===========================
   NOTE: The global styles.css already defines .list-shell, .list-head,
   .list-grid, .block, .id, .names, .en, .ar, .search, .segmented, etc.
   No extra page-specific rules needed here.
*/

/* ===========================
   READER (html/reader.html)
   =========================== */

#sm-controls { flex-wrap: wrap; gap: 12px; }
#sm-controls .field { min-width: 160px; }
#sm-strength-filter { flex-wrap: wrap; }
#sm-legend-row { align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
#sm-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sm-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.sm-legend-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); }
.sm-legend-count { font-weight: 600; color: var(--text); }

#sm-juz-select-field { margin-top: 12px; max-width: 240px; }
#sm-juz-select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); color: var(--text); box-shadow: inset 0 1px 2px rgba(12,62,24,0.06); }
#sm-juz-select:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

#sm-empty { margin-top: 10px; }





