:root {
  --night: #14110e;
  --desk: #1c1712;
  --rail: #2a231b;
  --lamp: #efe4cc;
  --lamp-deep: #e4d4b0;
  --ink: #1c1610;
  --ink-soft: #4a3f32;
  --saffron: #c4922e;
  --saffron-deep: #8f6918;
  --moss: #6f8f72;
  --mist: #d7cbb3;
  --paper-line: #d8c9a6;
  --focus: #e8c56a;
  --ui: "Commissioner", "El Messiri", sans-serif;
  --display: "Aref Ruqaa", serif;
  --naskh: "Scheherazade New", "Amiri", serif;
  --radius: 10px;
}

html[data-theme="light"] {
  --night: #f9f6f0;
  --desk: #ede4d2;
  --rail: #e4d7bf;
  --lamp: #261e16;
  --lamp-deep: #161009;
  --ink: #19120a;
  --ink-soft: #473a2b;
  --saffron: #b87b1c;
  --saffron-deep: #8a570c;
  --moss: #2e6936;
  --mist: #3f3427;
  --paper-line: #cfbda2;
  --focus: #b87b1c;
}


* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
  color: var(--mist);
  font-family: var(--ui);
  font-size: 17px;
  line-height: 1.55;
}

body {
  position: relative;
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 22px 64px;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 36px;
}

.brand-mark {
  font-family: var(--display);
  font-size: 1.85rem;
  color: var(--lamp);
  margin: 0;
}

.brand-sub {
  margin: 6px 0 0;
  color: #b7a888;
  font-size: 0.92rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-btn, .theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--desk);
  border: 1px solid #3d3429;
  color: var(--mist);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 140ms ease;
}

.theme-btn {
  padding: 8px 11px;
  font-size: 1.05rem;
  line-height: 1;
  min-width: 40px;
}

.nav-btn:hover, .theme-btn:hover {
  border-color: var(--saffron);
  color: var(--lamp);
  background: #251e17;
}


.nav-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.progress-nav-btn {
  background: rgba(196, 146, 46, 0.15);
  border-color: rgba(196, 146, 46, 0.45);
  color: var(--lamp);
  font-weight: 600;
}

.progress-nav-btn:hover {
  background: rgba(196, 146, 46, 0.28);
  border-color: var(--saffron);
}

.lang {
  display: flex;
  gap: 0;
  padding: 0;
  border: 1px solid #3d3429;
  background: var(--desk);
  color: var(--mist);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  transition: all 140ms ease;
}

.lang span {
  padding: 8px 14px;
  font: inherit;
  transition: all 140ms ease;
}

html[lang="ar"] .lang-ar,
html[lang="en"] .lang-en {
  background: var(--lamp);
  color: var(--ink);
  font-weight: 600;
}

html[data-theme="light"] .lang {
  border-color: #d1c1a6;
  background: #ffffff;
  color: #4a3b2b;
}

html[data-theme="light"][lang="ar"] .lang-ar,
html[data-theme="light"][lang="en"] .lang-en {
  background: #2b2116;
  color: #ffffff;
  font-weight: 700;
}

html[data-theme="light"][lang="ar"] .lang-en,
html[data-theme="light"][lang="en"] .lang-ar {
  background: transparent;
  color: #4a3b2b;
  font-weight: 500;
}

html[data-theme="light"] .lede {
  color: #554432;
}

html[data-theme="light"] .field label,
html[data-theme="light"] .repeat-label,
html[data-theme="light"] .custom-repeat span {
  color: #483928;
  font-weight: 600;
}

html[data-theme="light"] .translation {
  color: #3b2e20;
}

html[data-theme="light"] .word-gloss {
  color: #5d4624;
}




.intro h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.55rem);
  line-height: 1.45;
  color: var(--lamp);
  margin: 0 0 16px;
}

html[lang="en"] .intro h1 {
  font-family: var(--ui);
  font-weight: 600;
  max-width: 22ch;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 0 34px;
  color: #cbbfa6;
  max-width: 62ch;
}

.dock {
  background: var(--desk);
  border: 1px solid #322a22;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.dock-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #322a22;
  padding-bottom: 12px;
}

.dock-tab {
  cursor: pointer;
  background: transparent;
  border: 1px solid #3f362a;
  color: #ad9e83;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 120ms ease;
}

.dock-tab:hover {
  border-color: var(--saffron);
  color: var(--lamp);
}

.dock-tab.on {
  background: var(--saffron);
  border-color: var(--saffron);
  color: #1a1209;
}


.dock-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.9fr;
  gap: 18px;
  align-items: end;
}

.field label,
.repeat-label,
.custom-repeat span {
  display: block;
  margin-bottom: 8px;
  color: #c4b496;
  font-size: 0.92rem;
}

input, select, button {
  font: inherit;
}

input[type="search"],
input[type="number"],
select {
  width: 100%;
  background: #15110d;
  color: var(--lamp);
  border: 1px solid #3d3429;
  border-radius: 8px;
  padding: 10px 12px;
  caret-color: var(--saffron);
}

select {
  margin-top: 8px;
  height: 168px;
}

.hint {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #9a8b70;
}

.primary, .play, .review {
  cursor: pointer;
  border: 0;
  background: var(--lamp);
  color: var(--ink);
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
}

.primary { width: 100%; }

.primary:hover, .play:hover, .review:hover {
  background: #f6edd6;
}

.ghost {
  cursor: pointer;
  background: transparent;
  color: var(--mist);
  border: 1px solid #4a4034;
  border-radius: 8px;
  padding: 12px 14px;
}

.ghost:hover { border-color: var(--saffron); color: var(--lamp); }

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.mushaf { margin-bottom: 22px; }

.mushaf-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: #b7a888;
}

.meta-left p {
  margin: 0;
}

.meta-left #sessionLabel {
  margin-top: 4px;
}

.hifz-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hifz-btn {
  cursor: pointer;
  background: var(--desk);
  border: 1px solid #3d3429;
  color: var(--mist);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 130ms ease;
}

.hifz-btn svg {
  width: 14px;
  height: 14px;
}

.hifz-btn:hover {
  border-color: var(--moss);
  color: var(--lamp);
}

.hifz-btn.active {
  background: #1b3823;
  border-color: #3b744a;
  color: #9fe2a9;
  font-weight: 600;
}

.hifz-btn.strengthen.active {
  background: #3d2b09;
  border-color: #a16207;
  color: #fde047;
  font-weight: 600;
}

.page {
  background:
    linear-gradient(180deg, #f4ead3 0%, var(--lamp) 40%, var(--lamp-deep) 100%);
  color: var(--ink);
  border-radius: 14px 14px 10px 10px;
  padding: 36px 28px 28px;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  min-height: 220px;
}

.ayah {
  font-family: var(--naskh);
  font-size: clamp(2rem, 5vw, 2.85rem);
  line-height: 2.05;
  margin: 0;
  text-align: center;
}

.ayah .word {
  display: inline;
  padding: 0 0.12em;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.ayah .word.active {
  background: #e7c25a;
  color: #1a140c;
}

.ayah .end {
  font-size: 0.55em;
  color: var(--saffron-deep);
  padding-inline-start: 0.35em;
}

.translation {
  margin: 22px 0 0;
  text-align: center;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

.word-gloss {
  min-height: 1.4em;
  margin: 10px 0 0;
  text-align: center;
  color: #6b5a3e;
  font-size: 0.95rem;
  font-weight: 500;
}

.meaning-box {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed rgba(143, 105, 24, 0.3);
  text-align: start;
}

.meaning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.meaning-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meaning-badge {
  background: rgba(196, 146, 46, 0.22);
  color: #61400d;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(196, 146, 46, 0.35);
}

.meaning-sub {
  font-size: 0.86rem;
  color: #6d5b45;
}

.meaning-toggle {
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(143, 105, 24, 0.35);
  color: #5c4a35;
  border-radius: 6px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 120ms ease;
}

.meaning-toggle:hover {
  background: rgba(196, 146, 46, 0.15);
  color: #1a1309;
}

.meaning-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meaning-content[hidden] {
  display: none;
}

.vocab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vocab-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(196, 146, 46, 0.28);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.vocab-term {
  font-family: var(--naskh);
  font-size: 1.05rem;
  font-weight: 700;
  color: #7c4c0b;
}

.vocab-def {
  color: #2b2216;
}

.tafsir-text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.7;
  color: #382c1f;
  background: rgba(255, 255, 255, 0.45);
  padding: 10px 14px;
  border-radius: 8px;
  border-inline-start: 3px solid var(--saffron);
}


.status {
  margin: 12px 4px 0;
  color: var(--moss);
  min-height: 1.3em;
}

.controls {
  background: var(--rail);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chips button {
  cursor: pointer;
  border: 1px solid #4a4034;
  background: #16120e;
  color: var(--mist);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
}

.chips button.on {
  background: var(--saffron);
  border-color: var(--saffron);
  color: #1a140c;
}

.custom-repeat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.custom-repeat input { width: 88px; }

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding-inline: 22px;
}

.play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

html[lang="ar"] .play svg { transform: scaleX(-1); }

.pause-btn {
  cursor: pointer;
  border: 0;
  background: #d97706;
  color: #181107;
  border-radius: 8px;
  padding: 12px 22px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.45);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.pause-btn:hover {
  background: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}

.pause-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.continuous-btn {
  cursor: pointer;
  border: 1px solid rgba(196, 146, 46, 0.45);
  background: #231b14;
  color: var(--mist);
  border-radius: 8px;
  padding: 12px 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  transition: all 120ms ease;
}

.continuous-btn:hover {
  background: #33261a;
  border-color: var(--saffron);
  color: var(--lamp);
  transform: translateY(-1px);
}

.continuous-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

html[lang="ar"] .continuous-btn svg { transform: scaleX(-1); }

.continuous-btn.active {
  background: #153822;
  border-color: #3e8858;
  color: #a7f3d0;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.28);
}

html[data-theme="light"] .continuous-btn {
  background: #fbf7ee;
  border-color: #cfbe9f;
  color: #3f3120;
}

html[data-theme="light"] .continuous-btn:hover {
  background: #f2e7d3;
  border-color: var(--saffron);
  color: #171007;
}

html[data-theme="light"] .continuous-btn.active {
  background: #e8f5e9;
  border-color: #4caf50;
  color: #1b5e20;
  box-shadow: 0 4px 14px rgba(76, 175, 80, 0.25);
}

.review-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.review-left {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.save-range-btn {
  font-weight: 600;
  border-color: rgba(111, 143, 114, 0.45);
  color: #a4d4aa;
}

.save-range-btn:hover {
  border-color: var(--moss);
  color: #c8f5ce;
  background: rgba(111, 143, 114, 0.15);
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}


.lesson details {
  border-top: 1px solid #322a22;
  padding-top: 16px;
}

summary {
  cursor: pointer;
  color: var(--lamp);
}

.lesson-note {
  color: #b7a888;
  font-size: 0.92rem;
}

.video-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #0d0b09;
  border-radius: 8px;
  overflow: hidden;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.yt-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--saffron);
}

footer {
  margin-top: 36px;
  color: #8d7e66;
  font-size: 0.88rem;
}

::selection {
  background: #e7c25a;
  color: #1a140c;
}

html[data-theme="light"] .grain {
  opacity: 0.035;
  mix-blend-mode: multiply;
}

html[data-theme="light"] input[type="search"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] select {
  background: #ffffff;
  color: #1c150c;
  border-color: #d1c1a6;
}

html[data-theme="light"] .dock {
  background: var(--desk);
  border-color: #d6c5ac;
  box-shadow: 0 4px 18px rgba(70, 50, 20, 0.05);
}

html[data-theme="light"] .dock-tabs {
  border-bottom-color: #d8c8b0;
}

html[data-theme="light"] .dock-tab {
  border-color: #c9b89f;
  color: #5c4b37;
}

html[data-theme="light"] .dock-tab.on {
  background: var(--saffron);
  border-color: var(--saffron);
  color: #ffffff;
}

html[data-theme="light"] .controls {
  background: var(--rail);
  border: 1px solid #d4c5ab;
}

html[data-theme="light"] .chips button {
  background: #fbf6ec;
  border-color: #cbbba2;
  color: #3f3325;
}

html[data-theme="light"] .chips button.on {
  background: var(--saffron);
  border-color: var(--saffron);
  color: #ffffff;
}

html[data-theme="light"] .primary,
html[data-theme="light"] .play,
html[data-theme="light"] .review {
  background: #2b2116;
  color: #fcf8ef;
}

html[data-theme="light"] .primary:hover,
html[data-theme="light"] .play:hover,
html[data-theme="light"] .review:hover {
  background: #423423;
}

html[data-theme="light"] .ghost {
  border-color: #c6b59c;
  color: #3d3123;
  background: rgba(255, 255, 255, 0.55);
}

html[data-theme="light"] .ghost:hover {
  border-color: var(--saffron);
  color: #171007;
  background: #ffffff;
}

html[data-theme="light"] .pause-btn {
  background: #b45309;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.35);
}

html[data-theme="light"] .pause-btn:hover {
  background: #92400e;
}

html[data-theme="light"] .nav-btn,
html[data-theme="light"] .theme-btn {
  border-color: #d1c1a6;
  background: #ffffff;
  color: #3a2f22;
}

html[data-theme="light"] .nav-btn:hover,
html[data-theme="light"] .theme-btn:hover {
  border-color: var(--saffron);
  background: #f9f2e4;
  color: #181007;
}

html[data-theme="light"] .progress-nav-btn {
  background: #f5ebd5;
  border-color: #d1b886;
  color: #4a3512;
}

html[data-theme="light"] .hifz-btn {
  background: #ffffff;
  border-color: #d0c0a5;
  color: #382c1f;
}

html[data-theme="light"] .hifz-btn.active {
  background: #eaf5ec;
  border-color: #81c784;
  color: #1b5e20;
}

html[data-theme="light"] .hifz-btn.strengthen.active {
  background: #fef9c3;
  border-color: #eab308;
  color: #854d0e;
}

html[data-theme="light"] .save-range-btn {
  color: #276933;
  border-color: #8bbd93;
}

html[data-theme="light"] .save-range-btn:hover {
  background: #eaf5ec;
  color: #174f22;
}

html[data-theme="light"] .page {
  background: linear-gradient(180deg, #fffef9 0%, #f6f0df 100%);
  border: 1px solid #decbb0;
  box-shadow: 0 10px 30px rgba(60, 45, 20, 0.08);
}

html[data-theme="light"] .tafsir-text {
  background: #ffffff;
  color: #2b2014;
}

html[data-theme="light"] .vocab-chip {
  background: #ffffff;
  border-color: #dfcdb0;
}

html[data-theme="light"] .meaning-box {
  border-top-color: #d8c7ad;
}

html[data-theme="light"] .meaning-badge {
  background: #f0e1bc;
  color: #5c3b0a;
}

html[data-theme="light"] .brand-sub,
html[data-theme="light"] .mushaf-meta,
html[data-theme="light"] .hint,
html[data-theme="light"] .lesson-note,
html[data-theme="light"] footer {
  color: #635340;
}

/* ==========================================================================
   PROGRESS PAGE STYLES
   ========================================================================== */
.progress-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--desk);
  border: 1px solid #332b22;
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

html[data-theme="light"] .stat-card {
  border-color: #d8cab3;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 2px;
}

.stat-value {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--saffron);
  line-height: 1.15;
}

.stat-label {
  font-size: 0.88rem;
  color: #b7a78a;
}

html[data-theme="light"] .stat-label {
  color: #695743;
}

.progress-banner {
  background: var(--desk);
  border: 1px solid #332b22;
  border-radius: var(--radius);
  padding: 22px 24px;
}

html[data-theme="light"] .progress-banner {
  border-color: #d8cab3;
}

.progress-banner-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #120e0b;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #3d3429;
}

html[data-theme="light"] .progress-track {
  background: #e2d5be;
  border-color: #c9b99f;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #c4922e, #e8c56a);
  border-radius: 999px;
  transition: width 400ms ease;
}

.section-box {
  background: var(--desk);
  border: 1px solid #332b22;
  border-radius: var(--radius);
  padding: 24px;
}

html[data-theme="light"] .section-box {
  border-color: #d8cab3;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  border-bottom: 1px solid #322a22;
  padding-bottom: 12px;
}

html[data-theme="light"] .section-head {
  border-bottom-color: #d8cab3;
}

.section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  color: var(--lamp);
  display: flex;
  align-items: center;
  gap: 8px;
}

.strengthen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.strengthen-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid #3d3429;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

html[data-theme="light"] .strengthen-card {
  background: #ffffff;
  border-color: #d8cab3;
}

.strengthen-card-title {
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--lamp);
  margin: 0 0 4px;
}

.strengthen-card-sub {
  font-size: 0.85rem;
  color: #ad9e83;
  margin: 0;
}

html[data-theme="light"] .strengthen-card-sub {
  color: #695743;
}

.strengthen-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-btn-sm {
  cursor: pointer;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 120ms ease;
}

.action-btn-sm.play-act {
  background: var(--saffron);
  color: #171107;
}

.action-btn-sm.play-act:hover {
  background: #e8c56a;
}

.action-btn-sm.remove-act {
  background: transparent;
  border: 1px solid #4a3e30;
  color: #ad9e83;
}

.action-btn-sm.remove-act:hover {
  border-color: #c95d5d;
  color: #f87171;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #382f25;
  border-radius: 8px;
  padding: 12px 16px;
}

html[data-theme="light"] .history-item {
  background: #ffffff;
  border-color: #d8cab3;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.history-title {
  font-weight: 600;
  color: var(--lamp);
  font-size: 0.96rem;
}

.history-date {
  font-size: 0.82rem;
  color: #9f8f74;
}

html[data-theme="light"] .history-date {
  color: #695743;
}

.surah-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.surah-row {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid #362e24;
  border-radius: 8px;
  overflow: hidden;
}

html[data-theme="light"] .surah-row {
  background: #ffffff;
  border-color: #d8cab3;
}

.surah-row-head {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  gap: 12px;
}

.surah-row-head:hover {
  background: rgba(196, 146, 46, 0.08);
}

.surah-row-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.surah-row-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.surah-mini-progress {
  width: 90px;
  height: 8px;
  background: #15110d;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #3d3429;
}

html[data-theme="light"] .surah-mini-progress {
  background: #e2d5be;
  border-color: #cfbe9f;
}

.surah-mini-fill {
  height: 100%;
  background: var(--moss);
  border-radius: 999px;
}

.surah-row-detail {
  padding: 14px 16px;
  border-top: 1px solid #332b22;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

html[data-theme="light"] .surah-row-detail {
  border-top-color: #d8cab3;
  background: #fbf7ee;
}

.ayah-matrix {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ayah-matrix-item {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid #3d3429;
  background: #16120e;
  color: #ad9e83;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.ayah-matrix-item:hover {
  border-color: var(--saffron);
}

.ayah-matrix-item.checked {
  background: #1e3a24;
  border-color: #3b744a;
  color: #8be098;
}

html[data-theme="light"] .ayah-matrix-item {
  background: #ffffff;
  border-color: #cfc0a7;
  color: #544431;
}

html[data-theme="light"] .ayah-matrix-item.checked {
  background: #eaf5ec;
  border-color: #81c784;
  color: #1b5e20;
}

.backup-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: #ad9e83;
  font-size: 0.95rem;
}

html[data-theme="light"] .empty-state {
  color: #695743;
}

@media (max-width: 760px) {
  body {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(48px, env(safe-area-inset-bottom));
    padding-inline: max(12px, env(safe-area-inset-left));
  }
  .top {
    flex-wrap: wrap;
    gap: 12px;
  }
  .top-actions {
    gap: 8px;
  }
  .nav-btn span {
    font-size: 0.88rem;
  }
  .dock-tabs {
    display: flex;
    width: 100%;
  }
  .dock-tab {
    flex: 1;
    text-align: center;
  }
  .dock-grid { grid-template-columns: 1fr; }
  .intro h1 { max-width: none; font-size: 1.5rem; }
  .page { padding: 20px 14px; }
  .ayah { font-size: 1.85rem; line-height: 2.2; }

  .mushaf-meta {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .hifz-actions {
    display: flex;
    width: 100%;
    gap: 8px;
  }
  .hifz-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.88rem;
    padding: 8px 10px;
  }

  .transport {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-bottom: 14px;
  }
  .play {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-height: 46px;
    font-size: 0.92rem;
    padding: 8px 10px;
    justify-content: center;
  }
  .continuous-btn {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 46px;
    font-size: 0.92rem;
    padding: 8px 10px;
    justify-content: center;
  }
  .pause-btn {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-height: 46px;
    font-size: 1rem;
    justify-content: center;
  }
  #prevBtn {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    justify-content: center;
    font-size: 0.86rem;
    padding: 9px 8px;
    min-height: 42px;
  }
  #nextBtn {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    justify-content: center;
    font-size: 0.86rem;
    padding: 9px 8px;
    min-height: 42px;
  }

  .review-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .review-left {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .review-left button {
    width: 100%;
    font-size: 0.86rem;
    padding: 10px 8px;
    justify-content: center;
  }

  .meaning-box { padding: 12px; }
  .vocab-chip { max-width: 100%; font-size: 0.88rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 12px; }
  .stat-value { font-size: 1.55rem; }
}

@media (max-width: 480px) {
  .brand-mark { font-size: 1.15rem; }
  /* nav-btn span preserved on mobile */
  .top-actions .nav-btn { padding: 8px 10px; }
  .review-left { grid-template-columns: 1fr; }
  .chips button { min-height: 38px; padding: 6px 12px; font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ayah .word { transition: none; }
}

html[lang="en"] body,
html[lang="en"] .intro,
html[lang="en"] .dock,
html[lang="en"] .controls,
html[lang="en"] .lesson,
html[lang="en"] footer,
html[lang="en"] .mushaf-meta,
html[lang="en"] .status,
html[lang="en"] .top,
html[lang="en"] .section-head,
html[lang="en"] .history-item,
html[lang="en"] .surah-row-head {
  direction: ltr;
  text-align: left;
}

html[lang="en"] .ayah { direction: rtl; text-align: center; }
html[lang="en"] .brand { text-align: left; }
html[lang="en"] .intro h1 { max-width: 18ch; }

/* ==========================================================================
   SHARE BUTTON & MODAL
   ========================================================================== */

.share-nav-btn {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.4);
  color: #34d399;
  font-weight: 600;
}

.share-nav-btn:hover {
  background: rgba(15, 118, 110, 0.25);
  border-color: #34d399;
  color: #6ee7b7;
}

:root[data-theme="light"] .share-nav-btn {
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.3);
  color: #0f766e;
}

:root[data-theme="light"] .share-nav-btn:hover {
  background: rgba(15, 118, 110, 0.16);
  border-color: #0f766e;
  color: #064e3b;
}

/* Modal Overlay */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.share-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Card */
.share-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--desk, #1e1812);
  border: 1px solid rgba(196, 146, 46, 0.35);
  border-radius: 24px;
  padding: 24px 26px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.94) translateY(10px);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--lamp, #f5ebd7);
  box-sizing: border-box;
}

.share-modal-overlay.open .share-modal-card {
  transform: scale(1) translateY(0);
}

:root[data-theme="light"] .share-modal-card {
  background: #FAF7F0;
  border-color: rgba(180, 140, 70, 0.3);
  box-shadow: 0 24px 60px -12px rgba(45, 35, 25, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
  color: #2D2319;
}

/* Header */
.share-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.share-modal-title {
  font-family: var(--display, 'El Messiri', sans-serif);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--lamp, #f5ebd7);
  margin: 0;
  line-height: 1.35;
}

:root[data-theme="light"] .share-modal-title {
  color: #2D2319;
}

.share-modal-sub {
  font-size: 0.86rem;
  color: var(--mist, #b7a888);
  margin: 4px 0 0;
  line-height: 1.45;
}

:root[data-theme="light"] .share-modal-sub {
  color: #786653;
}

.share-modal-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mist, #b7a888);
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 140ms ease;
  line-height: 1;
  flex-shrink: 0;
  padding: 0;
}

.share-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--lamp, #f5ebd7);
  border-color: rgba(255, 255, 255, 0.28);
}

:root[data-theme="light"] .share-modal-close {
  border-color: rgba(0, 0, 0, 0.12);
  color: #786653;
}

:root[data-theme="light"] .share-modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #2D2319;
  border-color: rgba(0, 0, 0, 0.25);
}

/* Section label */
.share-section-label {
  display: block;
  font-size: 0.76rem;
  font-family: var(--font-mono, monospace);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mist, #b7a888);
  margin-bottom: 12px;
}

:root[data-theme="light"] .share-section-label {
  color: #8C7863;
}

/* Channels List */
.share-channels {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 146, 46, 0.3) transparent;
}

.share-channel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  min-width: 60px;
  cursor: pointer;
  color: inherit;
  border: none;
  background: none;
  font: inherit;
  padding: 0;
  transition: transform 140ms ease;
}

.channel-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 160ms ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.share-channel:hover .channel-circle {
  transform: translateY(-4px) scale(1.06);
}

.circle-whatsapp { background: #25D366; box-shadow: 0 6px 18px rgba(37, 211, 102, 0.4); }
.circle-x { background: #111111; border: 1px solid rgba(255, 255, 255, 0.2); }
:root[data-theme="light"] .circle-x { background: #000; }
.circle-telegram { background: #229ED9; box-shadow: 0 6px 18px rgba(34, 158, 217, 0.4); }
.circle-facebook { background: #1877F2; box-shadow: 0 6px 18px rgba(24, 119, 242, 0.4); }
.circle-linkedin { background: #0A66C2; box-shadow: 0 6px 18px rgba(10, 102, 194, 0.4); }
.circle-email { background: #64748B; }
.circle-native { background: #0f766e; box-shadow: 0 6px 18px rgba(15, 118, 110, 0.4); }

.channel-name {
  font-size: 0.75rem;
  color: var(--mist, #b7a888);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

:root[data-theme="light"] .channel-name {
  color: #635242;
}

/* Copy Link */
.share-modal-copy {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .share-modal-copy {
  border-top-color: rgba(0, 0, 0, 0.08);
}

.share-url-box {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(196, 146, 46, 0.35);
  border-radius: 999px;
  padding: 4px 5px 4px 16px;
  gap: 10px;
}

:root[data-theme="light"] .share-url-box {
  background: #EFE8DD;
  border-color: rgba(180, 140, 70, 0.35);
}

.share-url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--lamp, #f5ebd7);
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  direction: ltr;
  text-align: left;
  text-overflow: ellipsis;
  overflow: hidden;
  padding: 4px 0;
}

:root[data-theme="light"] .share-url-input {
  color: #2D2319;
}

.share-copy-btn {
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--saffron, #c4922e);
  color: #171410;
  font-weight: 700;
  font-size: 0.84rem;
  border: none;
  cursor: pointer;
  transition: all 140ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  flex-shrink: 0;
}

.share-copy-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.02);
}

.share-copy-btn.copied {
  background: #10B981 !important;
  color: #fff !important;
}



/* ==========================================================================
   USAGE STATS, ACTIVITY HEATMAP, KUTTAB BOARDS & REPETITION TRACKER
   ========================================================================== */

/* Board Mode Switcher in Studio */
.board-selector-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--desk, #1c1712);
  border: 1px solid rgba(196, 146, 46, 0.28);
  border-radius: var(--radius, 12px);
  padding: 10px 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

:root[data-theme="light"] .board-selector-bar {
  background: #FAF7F0;
  border-color: rgba(180, 140, 70, 0.28);
}

.board-pills {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 4px;
  gap: 4px;
}

:root[data-theme="light"] .board-pills {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

.board-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--mist, #d7cbb3);
  font-family: var(--ui);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.board-pill:hover {
  color: var(--lamp, #efe4cc);
}

.board-pill.active {
  background: var(--saffron, #c4922e);
  color: #14110e;
  box-shadow: 0 2px 8px rgba(196, 146, 46, 0.35);
  font-weight: 700;
}

.board-pill.pill-madi.active {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.board-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #10b981;
}

.pill-madi .board-dot {
  background: #3b82f6;
}

.board-pill-meta {
  font-size: 0.84rem;
  color: var(--lamp-deep, #e4d4b0);
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-pill-meta .board-hint {
  color: #a89f91;
  font-size: 0.8rem;
}

/* Repetition Badge in Mushaf Meta */
.ayah-repeat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(196, 146, 46, 0.12);
  border: 1px solid rgba(196, 146, 46, 0.3);
  color: var(--saffron, #c4922e);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  transition: all 0.2s ease;
}

.ayah-repeat-badge.pulse {
  animation: badgePulse 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); background: rgba(196, 146, 46, 0.35); }
  100% { transform: scale(1); }
}

.board-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.board-tag.hadir {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.board-tag.madi {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

/* Complete Hadir & Move to Madi Button */
.complete-hadir-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(5, 150, 105, 0.28) 100%);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-weight: 700;
}

.complete-hadir-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28) 0%, rgba(5, 150, 105, 0.4) 100%);
  border-color: #34d399;
  color: #a7f3d0;
}

:root[data-theme="light"] .complete-hadir-btn {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
}

/* ==========================================================================
   USAGE STATS & ACTIVITY HEATMAP (PROGRESS PAGE)
   ========================================================================== */

.usage-stats-card {
  background: var(--desk, #1c1712);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

:root[data-theme="light"] .usage-stats-card {
  background: #FAF7F0;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 30px rgba(45, 35, 25, 0.08);
}

.usage-stats-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.usage-stats-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--lamp, #efe4cc);
  margin: 0;
  letter-spacing: -0.02em;
}

.usage-stats-tag {
  background: rgba(255, 255, 255, 0.1);
  color: var(--lamp, #efe4cc);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

:root[data-theme="light"] .usage-stats-tag {
  background: rgba(0, 0, 0, 0.08);
  color: #2D2319;
}

/* Top 5 Metrics Row - Matching user photo exactly */
.usage-metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .usage-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .usage-metric-item:last-child {
    grid-column: span 2;
  }
}

.usage-metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.usage-metric-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

html[dir="rtl"] .usage-metric-item:not(:last-child)::after {
  left: auto;
  right: -8px;
}

:root[data-theme="light"] .usage-metric-item:not(:last-child)::after {
  background: rgba(0, 0, 0, 0.08);
}

.usage-metric-val {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--lamp, #efe4cc);
  line-height: 1.2;
  margin-bottom: 4px;
}

.usage-metric-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 500;
}

:root[data-theme="light"] .usage-metric-label {
  color: #786c5e;
}

/* Heatmap Activity Container - Matching photo */
.activity-heatmap-box {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 18px 20px;
}

:root[data-theme="light"] .activity-heatmap-box {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.heatmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.heatmap-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lamp, #efe4cc);
  margin: 0;
}

.heatmap-toggles {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 3px;
  gap: 2px;
}

:root[data-theme="light"] .heatmap-toggles {
  background: rgba(0, 0, 0, 0.06);
}

.heatmap-toggle-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.heatmap-toggle-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

:root[data-theme="light"] .heatmap-toggle-btn.active {
  background: #ffffff;
  color: #1c1712;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Heatmap Grid */
.heatmap-scroll-area {
  overflow-x: auto;
  padding-bottom: 8px;
}

.heatmap-scroll-area::-webkit-scrollbar {
  height: 6px;
}

.heatmap-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-flow: column;
  grid-auto-columns: 13px;
  gap: 3.5px;
  width: max-content;
  margin: 0 auto;
}

.heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 2.5px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.1s ease, outline 0.1s ease;
  position: relative;
}

:root[data-theme="light"] .heatmap-cell {
  background: rgba(0, 0, 0, 0.06);
}

.heatmap-cell:hover {
  transform: scale(1.3);
  outline: 1.5px solid var(--lamp, #efe4cc);
  z-index: 5;
}

/* Heatmap Color Levels (Photo Match) */
.heatmap-cell.level-1 { background: #1e3a5f; }
.heatmap-cell.level-2 { background: #2563eb; }
.heatmap-cell.level-3 { background: #38bdf8; }
.heatmap-cell.level-4 { background: #93c5fd; box-shadow: 0 0 6px rgba(147, 197, 253, 0.4); }

:root[data-theme="light"] .heatmap-cell.level-1 { background: #bfdbfe; }
:root[data-theme="light"] .heatmap-cell.level-2 { background: #60a5fa; }
:root[data-theme="light"] .heatmap-cell.level-3 { background: #3b82f6; }
:root[data-theme="light"] .heatmap-cell.level-4 { background: #1d4ed8; }

.heatmap-months {
  display: flex;
  justify-content: space-between;
  padding: 8px 6px 0;
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 500;
}

.heatmap-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
  gap: 10px;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  color: #94a3b8;
}

.heatmap-ranges {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 2px;
  gap: 2px;
}

:root[data-theme="light"] .heatmap-ranges {
  background: rgba(0, 0, 0, 0.06);
}

.heatmap-range-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 14px;
  cursor: pointer;
}

.heatmap-range-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

:root[data-theme="light"] .heatmap-range-btn.active {
  background: #ffffff;
  color: #1c1712;
}

/* Tooltip for Heatmap */
.heatmap-tooltip {
  position: fixed;
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
  display: none;
}

/* ==========================================================================
   AYAH REPETITION & BOARD DIRECTORY (TABLE & CARDS)
   ========================================================================== */

.board-directory-box {
  background: var(--desk, #1c1712);
  border: 1px solid rgba(196, 146, 46, 0.25);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 28px;
}

:root[data-theme="light"] .board-directory-box {
  background: #FAF7F0;
  border-color: rgba(180, 140, 70, 0.25);
}

.directory-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.directory-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dir-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--mist, #d7cbb3);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dir-filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--lamp, #efe4cc);
}

.dir-filter-btn.active {
  background: var(--saffron, #c4922e);
  color: #14110e;
  border-color: var(--saffron, #c4922e);
  font-weight: 700;
}

.directory-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.dir-search-input {
  flex: 1;
  min-width: 180px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--lamp, #efe4cc);
  font-family: var(--ui);
  font-size: 0.86rem;
  outline: none;
}

:root[data-theme="light"] .dir-search-input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1c1712;
}

.dir-sort-select {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--lamp, #efe4cc);
  font-family: var(--ui);
  font-size: 0.86rem;
  outline: none;
  cursor: pointer;
}

:root[data-theme="light"] .dir-sort-select {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #1c1712;
}

.ayah-repeat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ayah-repeat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

:root[data-theme="light"] .ayah-repeat-item {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.06);
}

.ayah-repeat-item:hover {
  border-color: rgba(196, 146, 46, 0.4);
  transform: translateY(-1px);
}

.ayah-repeat-info {
  flex: 1;
  min-width: 0;
}

.ayah-repeat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.ayah-ref-badge {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--lamp, #efe4cc);
}

.ayah-repeat-snippet {
  font-family: var(--naskh);
  font-size: 1.15rem;
  color: var(--mist, #d7cbb3);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}

:root[data-theme="light"] .ayah-repeat-snippet {
  color: #2D2319;
}

.ayah-repeat-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.repeat-count-pill {
  background: rgba(196, 146, 46, 0.14);
  border: 1px solid rgba(196, 146, 46, 0.35);
  color: var(--saffron, #c4922e);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

.mastery-indicator {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 85px;
}

.mastery-label {
  font-size: 0.74rem;
  font-weight: 700;
}

.mastery-bar-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

:root[data-theme="light"] .mastery-bar-track {
  background: rgba(0, 0, 0, 0.08);
}

.mastery-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.mastery-high { color: #34d399; }
.mastery-high .mastery-bar-fill { background: #10b981; }
.mastery-med { color: #fbbf24; }
.mastery-med .mastery-bar-fill { background: #f59e0b; }
.mastery-low { color: #f87171; }
.mastery-low .mastery-bar-fill { background: #ef4444; }

/* Kuttab Transition Modal */
.kuttab-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 6, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.kuttab-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.kuttab-modal-card {
  background: var(--desk, #1c1712);
  border: 1px solid rgba(196, 146, 46, 0.4);
  border-radius: 22px;
  padding: 28px 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.kuttab-modal-overlay.open .kuttab-modal-card {
  transform: scale(1);
}

:root[data-theme="light"] .kuttab-modal-card {
  background: #FAF7F0;
  border-color: rgba(180, 140, 70, 0.35);
  box-shadow: 0 24px 60px rgba(45, 35, 25, 0.2);
}

.kuttab-modal-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  line-height: 1;
}

.kuttab-modal-title {
  font-family: var(--display);
  font-size: 1.65rem;
  color: var(--lamp, #efe4cc);
  margin: 0 0 10px 0;
}

.kuttab-modal-desc {
  font-size: 0.94rem;
  color: #b7a888;
  margin: 0 0 24px 0;
  line-height: 1.6;
}

.kuttab-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kuttab-modal-btn {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--ui);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.kuttab-btn-primary {
  background: var(--saffron, #c4922e);
  color: #14110e;
  border: none;
}

.kuttab-btn-primary:hover {
  background: var(--focus, #e8c56a);
  transform: translateY(-1px);
}

.kuttab-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--lamp, #efe4cc);
}

:root[data-theme="light"] .kuttab-btn-secondary {
  border-color: rgba(0, 0, 0, 0.15);
  color: #1c1712;
}

.kuttab-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}


/* ==========================================================================
   MOBILE & HEATMAP DYNAMIC ALIGNMENT REFINEMENTS
   ========================================================================== */

/* Dynamic Heatmap Months Row */
.heatmap-months-row {
  display: flex;
  gap: 3.5px;
  width: max-content;
  margin: 0 auto 6px;
  padding: 0;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}

.heatmap-month-label {
  display: inline-block;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heatmap-days-row {
  display: flex;
  gap: 3.5px;
  width: max-content;
  margin: 0 auto 6px;
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 600;
}

.heatmap-day-label {
  width: 13px;
  text-align: center;
  overflow: hidden;
  font-size: 0.65rem;
}

/* Mobile & Tablet Optimizations for Tracking Tool and Progress Dashboard */
@media (max-width: 760px) {
  .directory-controls {
    margin-bottom: 12px;
  }
  .directory-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .directory-filters::-webkit-scrollbar {
    display: none;
  }
  .dir-filter-btn {
    flex-shrink: 0;
    padding: 7px 14px;
    font-size: 0.82rem;
    border-radius: 20px;
  }
  .directory-actions-row {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
  }
  .dir-search-input, .dir-sort-select {
    width: 100%;
    min-height: 44px;
  }
  .ayah-repeat-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
    border-radius: 14px;
  }
  .ayah-repeat-head {
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .ayah-repeat-snippet {
    font-size: 1.25rem;
    line-height: 1.8;
    margin: 6px 0;
    white-space: normal;
  }
  .ayah-repeat-stats {
    width: 100%;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-wrap: wrap;
    gap: 8px;
  }
  .repeat-count-pill {
    font-size: 0.82rem;
    padding: 5px 12px;
  }
  .mastery-indicator {
    flex: 1;
    min-width: 90px;
  }
  .action-btn-sm.play-act {
    padding: 8px 16px;
    font-size: 0.86rem;
    min-height: 40px;
  }
  .usage-metrics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .usage-metric-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px 8px;
  }
  :root[data-theme="light"] .usage-metric-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
  }
  .usage-metric-item::after {
    display: none !important;
  }
  .usage-metric-item:last-child {
    grid-column: span 2;
  }
  .usage-metric-val {
    font-size: 1.35rem;
  }
  .heatmap-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .heatmap-toggles {
    width: 100%;
    justify-content: center;
  }
  .heatmap-toggle-btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
  }
  .heatmap-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .heatmap-ranges {
    width: 100%;
    justify-content: center;
  }
  .heatmap-range-btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
  }
}

/* ==========================================================================
   ENHANCED TOP BAR, ICONS & RESPONSIVE UX ARCHITECTURE
   ========================================================================== */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.brand-mark {
  font-family: var(--display, 'El Messiri', sans-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--lamp, #efe4cc);
  margin: 0;
  line-height: 1.25;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--mist, #b7a888);
  font-size: 0.88rem;
  line-height: 1.35;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Nav Buttons System */
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--desk, #1c1712);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--mist, #d7cbb3);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--ui, system-ui, sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  transition: all 150ms ease;
  user-select: none;
  white-space: nowrap;
}

:root[data-theme="light"] .nav-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #2D2319;
}

.nav-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* App Download Button (APK) */
.app-download-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(5, 150, 105, 0.28) 100%);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.app-download-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28) 0%, rgba(5, 150, 105, 0.42) 100%);
  border-color: #34d399;
  color: #a7f3d0;
  transform: translateY(-1px);
}

:root[data-theme="light"] .app-download-btn {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
}

/* Progress Link */
.progress-nav-btn {
  background: rgba(196, 146, 46, 0.15);
  border-color: rgba(196, 146, 46, 0.4);
  color: var(--lamp, #efe4cc);
}

.progress-nav-btn:hover {
  background: rgba(196, 146, 46, 0.28);
  border-color: var(--saffron, #c4922e);
  color: #ffffff;
  transform: translateY(-1px);
}

:root[data-theme="light"] .progress-nav-btn {
  background: #fdf6e7;
  border-color: #c4922e;
  color: #7c4b00;
}

/* Share Button */
.share-nav-btn {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.35);
  color: #60a5fa;
}

.share-nav-btn:hover {
  background: rgba(59, 130, 246, 0.24);
  border-color: #3b82f6;
  color: #93c5fd;
  transform: translateY(-1px);
}

:root[data-theme="light"] .share-nav-btn {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1d4ed8;
}

/* Theme Toggle */
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--desk, #1c1712);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--mist, #d7cbb3);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 150ms ease;
}

.theme-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

:root[data-theme="light"] .theme-btn {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #2D2319;
}

/* Language Toggle Segmented Pill */
.lang {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--desk, #1c1712);
  border-radius: 999px;
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  height: 36px;
}

:root[data-theme="light"] .lang {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
}

.lang span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  height: 100%;
  color: var(--mist, #d7cbb3);
  transition: all 140ms ease;
}

html[lang="ar"] .lang-ar,
html[lang="en"] .lang-en {
  background: var(--lamp, #efe4cc);
  color: #14110e;
}

:root[data-theme="light"] html[lang="ar"] .lang-ar,
:root[data-theme="light"] html[lang="en"] .lang-en {
  background: #2D2319;
  color: #ffffff;
}

html[lang="ar"] .back-icon {
  transform: scaleX(-1);
}

/* Mobile Overrides (Phone & Small Tablets) */
@media (max-width: 760px) {
  .top {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 20px;
  }
  .brand-mark {
    font-size: 1.45rem;
  }
  .brand-sub {
    font-size: 0.8rem;
  }
  .top-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: 100%;
    flex-wrap: wrap;
  }
  .nav-btn {
    padding: 6px 11px;
    font-size: 0.78rem;
    gap: 5px;
    min-height: 34px;
  }
  .nav-btn svg {
    width: 14px;
    height: 14px;
  }
  .theme-btn {
    width: 34px;
    height: 34px;
    font-size: 0.88rem;
  }
  .lang {
    height: 34px;
  }
  .lang span {
    padding: 0 8px;
    font-size: 0.74rem;
  }
  .board-selector-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    margin-bottom: 16px;
  }
  .board-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    padding: 3px;
    gap: 4px;
    box-sizing: border-box;
  }
  .board-pill {
    padding: 7px 6px;
    font-size: 0.78rem;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .board-pill-meta {
    justify-content: space-between;
    font-size: 0.78rem;
    width: 100%;
  }
  .mushaf-meta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    margin-bottom: 14px;
  }
  .mushaf-meta > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
  }
  .hifz-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .hifz-btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    font-size: 0.84rem;
    padding: 6px 10px;
  }
}
