/* =====================================================================
   Sunnah — design system
   Deep emerald #0F5132, gold #D4AF37, light + dark, no build step.
   ===================================================================== */

:root {
  --emerald: #0F5132;
  --emerald-dark: #0A3A24;
  --emerald-mid: #157347;
  --emerald-soft: #1E8A5A;
  --gold: #D4AF37;
  --gold-soft: #E4C86A;
  --gold-dim: #8A7124;

  --surface: #FAFAF7;
  --surface-2: #FFFFFF;
  --ink: #16201B;
  --ink-muted: #607068;
  --line: #E0E5E1;
  --shadow-card: 0 1px 2px rgba(15, 81, 50, .06), 0 8px 24px -12px rgba(15, 81, 50, .18);
  --shadow-lift: 0 2px 4px rgba(15, 81, 50, .08), 0 18px 40px -16px rgba(15, 81, 50, .32);

  --radius: 16px;
  --radius-sm: 12px;
  --font: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-arabic: "Amiri Quran", "Amiri", "Scheherazade New", "Traditional Arabic", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  color-scheme: light;
}

html[data-theme="dark"] {
  --surface: #09120E;
  --surface-2: #101D17;
  --ink: #E8F0EB;
  --ink-muted: #94A89D;
  --line: #20342A;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .35), 0 18px 40px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  overflow-x: hidden;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--surface);
  background-image:
    radial-gradient(1100px 520px at 12% -12%, rgba(15, 81, 50, .10), transparent 60%),
    radial-gradient(820px 420px at 92% 0%, rgba(212, 175, 55, .12), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 520px at 12% -12%, rgba(30, 138, 90, .16), transparent 60%),
    radial-gradient(820px 420px at 92% 0%, rgba(212, 175, 55, .10), transparent 62%);
}

::selection { background: rgba(212, 175, 55, .35); }

img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ------------------------------------------------------------- layout */

/* Fluid shell: fills the window, with the gutter growing on larger screens. */
.wrap {
  width: 100%;
  max-width: var(--shell, 1360px);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 640px)  { .wrap { padding: 0 24px; } }
@media (min-width: 1100px) { .wrap { padding: 0 40px; } }

/* Narrow variant for reading-width content (login, 404). */
.wrap-narrow { --shell: 520px; }
.wrap-wide { --shell: 1440px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.center { text-align: center; }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: initial; } }

/* --------------------------------------------------------------- card */

.card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: box-shadow .3s ease, border-color .3s ease;
}

.card.is-done {
  box-shadow: 0 0 0 1px rgba(212, 175, 55, .55), 0 12px 32px -18px rgba(15, 81, 50, .5);
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-mid); }

.btn-gold { background: var(--gold); color: #2A2205; font-weight: 600; }
.btn-gold:hover { background: var(--gold-soft); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--emerald-soft); background: rgba(15, 81, 50, .05); }
html[data-theme="dark"] .btn-ghost:hover { background: rgba(255, 255, 255, .05); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--emerald-soft); }

/* ------------------------------------------------------------- fields */

.field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.field:focus {
  outline: none;
  border-color: var(--emerald-soft);
  box-shadow: 0 0 0 3px rgba(30, 138, 90, .18);
}
.field::placeholder { color: var(--ink-muted); opacity: .75; }
textarea.field { resize: vertical; line-height: 1.6; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.password-wrap { position: relative; }
.password-wrap .field { padding-right: 44px; }
.password-toggle {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.password-toggle:hover { color: var(--emerald); }
html[data-theme="dark"] .password-toggle:hover { color: var(--gold); }
.password-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

/* --------------------------------------------------------------- chip */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
.chip-gold { border-color: rgba(212, 175, 55, .5); color: var(--gold-dim); }
html[data-theme="dark"] .chip-gold { color: var(--gold); }
.chip-emerald { border-color: rgba(30, 138, 90, .4); color: var(--emerald-mid); }
html[data-theme="dark"] .chip-emerald { color: var(--emerald-soft); }

/* ------------------------------------------------------------- arabic */

.arabic {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  line-height: 2.15;
  font-size: 23px;
  color: var(--emerald);
}
html[data-theme="dark"] .arabic { color: #B6E3CB; }
@media (min-width: 640px) { .arabic { font-size: 27px; } }
.arabic-center { text-align: center; }

.gold-rule {
  height: 1px;
  margin: 14px 0;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, .7), transparent);
}

/* ---------------------------------------------------------------- nav */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: var(--shell, 1360px);
  margin: 0 auto;
}
@media (min-width: 640px)  { .topbar-inner { padding: 10px 24px; } }
@media (min-width: 1100px) { .topbar-inner { padding: 12px 40px; } }
.topbar-wide .topbar-inner { max-width: 1440px; }

.brand {
  display: flex;
  align-items: center;
  flex: none;
  text-decoration: none;
  border-radius: 8px;
  line-height: 0;
}
.brand picture { display: block; line-height: 0; }

/* The lockup includes the wordmark and the ClouxiPlexi credit, so it stands
   alone - no separate icon or text beside it. */
.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  max-width: 100%;
}
@media (max-width: 480px) { .brand-logo { height: 36px; } }
@media (min-width: 1100px) { .brand-logo { height: 46px; } }

/* Deep-green wordmark on a dark ground: give it a light card rather than
   inverting, which would flatten the gradient in the mark. */
html[data-theme="dark"] .brand {
  padding: 6px 10px;
  background: rgba(255, 255, 255, .94);
}

/* Still used for the app tile wherever a compact square mark is wanted. */
.brand-mark {
  display: block;
  width: 36px; height: 36px;
  border-radius: 10px;
  object-fit: contain;
}

.nav-links { display: none; gap: 4px; margin-left: 16px; }
@media (min-width: 640px) { .nav-links { display: flex; } }
.nav-link {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition: background-color .2s, color .2s;
}
.nav-link:hover { color: var(--ink); }
.nav-link.is-active { color: var(--emerald); background: rgba(15, 81, 50, .08); }
html[data-theme="dark"] .nav-link.is-active { color: var(--gold); background: rgba(255, 255, 255, .05); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 640px) { .tabbar { display: none; } }
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
}
.tabbar a.is-active { color: var(--emerald); }
html[data-theme="dark"] .tabbar a.is-active { color: var(--gold); }

/* ------------------------------------------------------- theme switch */

.theme-toggle {
  position: relative;
  width: 62px; height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(212, 175, 55, .18);
  cursor: pointer;
  transition: background-color .3s;
}
html[data-theme="dark"] .theme-toggle { background: var(--emerald); }
.theme-toggle-knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: #fff;
  color: var(--emerald);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), background-color .3s, color .3s;
}
html[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(28px);
  background: var(--gold);
  color: #2A2205;
}
.theme-toggle .sun { display: block; }
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ------------------------------------------------------- day header */

.day-head {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  padding: 22px;
}
@media (min-width: 640px) { .day-head { padding: 26px; } }
.day-head .eyebrow {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-soft);
}
.day-head h1 { margin-top: 4px; font-size: 24px; }
.day-head .date { margin-top: 4px; font-size: 14px; color: rgba(255, 255, 255, .65); }

.streak-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .12);
  flex: none;
}
.streak-badge .n { font-family: var(--font-mono); font-size: 21px; font-weight: 600; line-height: 1; }
.streak-badge .u { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .6); }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

/* ------------------------------------------------------ checklist card */

.item {
  overflow: hidden;
  animation: rise .45s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.item-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px; }
@media (min-width: 640px) { .item-head { padding: 18px 20px; } }

.check {
  flex: none;
  width: 36px; height: 36px;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .15s;
}
.check:hover { border-color: var(--emerald-soft); color: var(--emerald); }
.check:active { transform: scale(.9); }
.check:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.check .tick { display: none; }
.item.is-done .check {
  border-color: var(--gold);
  background: var(--gold);
  color: #2A2205;
}
.item.is-done .check .tick { display: block; }
.item.is-done .check .glyph { display: none; }

.item-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item-title h3 { font-size: 16px; }
@media (min-width: 640px) { .item-title h3 { font-size: 17px; } }
.item.is-done .item-title h3 { color: var(--ink-muted); text-decoration: line-through; text-decoration-color: rgba(212, 175, 55, .6); }
.item-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.item-sub { margin-top: 3px; font-size: 14px; color: var(--ink-muted); }
.item-timing { margin-top: 5px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted); }

.mini-track { margin-top: 10px; height: 6px; max-width: 220px; border-radius: 999px; background: var(--line); overflow: hidden; }
.mini-fill { height: 100%; border-radius: 999px; background: var(--gold); transition: width .35s ease; }

.expand {
  flex: none;
  border: 0;
  background: none;
  padding: 6px;
  border-radius: 8px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color .2s, background-color .2s, transform .3s;
}
.expand:hover { color: var(--emerald); background: rgba(15, 81, 50, .06); }
.item.is-open .expand { transform: rotate(180deg); }

.item-body {
  display: none;
  border-top: 1px solid var(--line);
  padding: 16px;
}
@media (min-width: 640px) { .item-body { padding: 18px 20px; } }
.item.is-open .item-body { display: block; animation: fade .3s both; }
.item-body > * + * { margin-top: 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------ passage */

.passage {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: linear-gradient(180deg, rgba(15, 81, 50, .04), transparent);
}
html[data-theme="dark"] .passage { background: linear-gradient(180deg, rgba(30, 138, 90, .07), transparent); }
.passage .translit { font-size: 14px; font-style: italic; color: var(--ink-muted); }
.passage .english { margin-top: 8px; font-size: 14px; }
.passage-meta { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.passage-meta button { cursor: pointer; background: none; }
.passage-meta button:hover { border-color: var(--emerald-soft); color: var(--emerald); }
html[data-theme="dark"] .passage-meta button:hover { color: var(--gold); }

/* -------------------------------------------------------------- audio */

.audio {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.audio-play {
  flex: none;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--emerald);
  color: #fff;
  cursor: pointer;
  transition: background-color .2s, transform .15s;
}
.audio-play:hover { background: var(--emerald-mid); }
.audio-play:active { transform: scale(.94); }
.audio-play .pause { display: none; }
.audio.is-playing .audio-play .pause { display: block; }
.audio.is-playing .audio-play .play { display: none; }
.audio-seek { flex: 1; height: 6px; border-radius: 999px; background: var(--line); position: relative; overflow: hidden; }
.audio-seek span { position: absolute; inset: 0 100% 0 0; background: var(--gold); transition: right .2s linear; }
.audio-time { flex: none; width: 84px; text-align: right; font-family: var(--font-mono); font-size: 11px; color: var(--ink-muted); }

.audio-missing {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--ink-muted);
}
.audio-missing code { font-family: var(--font-mono); background: rgba(15, 81, 50, .08); padding: 1px 5px; border-radius: 4px; }

/* ------------------------------------------------------------ counter */

.counters { display: grid; gap: 8px; }
@media (min-width: 640px) { .counters { grid-template-columns: 1fr 1fr; } }

.counter {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .25s, background-color .25s;
}
.counter.is-met { border-color: rgba(212, 175, 55, .6); background: rgba(212, 175, 55, .07); }
.counter-bg { position: absolute; inset: 0 auto 0 0; background: rgba(15, 81, 50, .07); transition: width .3s ease; }
html[data-theme="dark"] .counter-bg { background: rgba(30, 138, 90, .12); }
.counter > * { position: relative; }
.counter-label { font-size: 14px; font-weight: 500; }
.counter-controls { display: flex; align-items: center; gap: 6px; flex: none; }
.counter-value { font-family: var(--font-mono); font-size: 14px; color: var(--ink-muted); margin-right: 4px; }
.counter.is-met .counter-value { color: var(--gold-dim); }
html[data-theme="dark"] .counter.is-met .counter-value { color: var(--gold); }
.counter-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: transform .15s, background-color .2s, color .2s, border-color .2s;
}
.counter-btn:active { transform: scale(.9); }
.counter-btn.plus { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.counter-btn.plus:hover { background: var(--emerald-mid); }
.counter.is-met .counter-btn.plus { background: var(--gold); border-color: var(--gold); color: #2A2205; }

/* ------------------------------------------------------------- tasbih */

.tasbih { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0; }
.tasbih-dial { position: relative; width: 208px; height: 208px; }
.tasbih-dial svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.tasbih-ring-bg { stroke: var(--line); }
.tasbih-ring { stroke: var(--emerald); transition: stroke-dashoffset .4s cubic-bezier(.4, 0, .2, 1), stroke .3s; }
.tasbih.is-met .tasbih-ring { stroke: var(--gold); }

.tasbih-btn {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  transition: transform .12s ease;
}
.tasbih-btn:active { transform: scale(.955); }
.tasbih-btn:focus-visible { outline: 4px solid rgba(212, 175, 55, .5); outline-offset: 2px; }
.tasbih-count { font-family: var(--font-mono); font-size: 46px; font-weight: 600; line-height: 1; }
.tasbih-of { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .6); }
.tasbih-caption { margin-top: 4px; max-width: 80%; text-align: center; font-size: 11px; line-height: 1.35; color: var(--gold-soft); }

.ripple {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 2px solid rgba(212, 175, 55, .6);
  pointer-events: none;
  animation: ripple .7s ease-out forwards;
}
@keyframes ripple {
  from { transform: scale(.92); opacity: .55; }
  to { transform: scale(1.85); opacity: 0; }
}

/* ------------------------------------------------------------ choices */

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s, border-color .2s, background-color .2s, color .2s;
}
.choice:active { transform: scale(.96); }
.choice:hover { border-color: var(--emerald-soft); color: var(--ink); }
.choice.is-on { border-color: var(--gold); background: rgba(212, 175, 55, .15); color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------ verdict */

.verdicts { display: flex; flex-wrap: wrap; gap: 8px; }
.verdict {
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .15s, border-color .2s, background-color .2s, color .2s;
}
.verdict:active { transform: scale(.96); }
.verdict.is-on[data-verdict="yes"] { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.verdict.is-on[data-verdict="partly"] { background: var(--gold); border-color: var(--gold); color: #2A2205; }
.verdict.is-on[data-verdict="no"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

/* ---------------------------------------------------------- resources */

.resource {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  transition: border-color .2s;
}
.resource:hover { border-color: var(--emerald-soft); }
.resource strong { display: block; font-size: 14px; font-weight: 500; }
.resource span { display: block; font-size: 12px; color: var(--ink-muted); }

/* ------------------------------------------------------------- drawer */

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(3px);
  animation: fade .2s both;
}
.drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 51;
  padding: 20px 20px 32px;
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: var(--surface-2);
  animation: slide-up .3s cubic-bezier(.2, .8, .2, 1) both;
}
@media (min-width: 640px) {
  .drawer {
    left: 50%; right: auto; bottom: 24px;
    width: 520px;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 24px;
  }
  @keyframes slide-up { from { opacity: 0; transform: translate(-50%, 24px); } to { opacity: 1; transform: translate(-50%, 0); } }
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.drawer-grip { width: 40px; height: 4px; margin: 0 auto 16px; border-radius: 999px; background: var(--line); }
@media (min-width: 640px) { .drawer-grip { display: none; } }

/* -------------------------------------------------------------- stats */

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 16px; }
.stat-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin-bottom: 8px;
  border-radius: 9px;
  background: rgba(15, 81, 50, .1);
  color: var(--emerald);
}
html[data-theme="dark"] .stat-icon { background: rgba(30, 138, 90, .14); color: var(--emerald-soft); }
.stat-icon.gold { background: rgba(212, 175, 55, .16); color: var(--gold-dim); }
html[data-theme="dark"] .stat-icon.gold { color: var(--gold); }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; line-height: 1; }
.stat-value small { margin-left: 4px; font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.stat-label { margin-top: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); }

/* ------------------------------------------------------------- charts */

.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; }
.bar { flex: 1; min-width: 0; border-radius: 3px 3px 0 0; background: var(--line); transition: opacity .2s; }
.bar.partial { background: var(--emerald); }
html[data-theme="dark"] .bar.partial { background: var(--emerald-soft); }
.bar.full { background: var(--gold); }
.bar:hover { opacity: .75; }

.heat { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat-col { display: flex; flex-direction: column; gap: 3px; }
.heat-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--line); }
.heat-cell.l1 { background: rgba(15, 81, 50, .3); }
.heat-cell.l2 { background: rgba(15, 81, 50, .6); }
.heat-cell.l3 { background: var(--emerald); }
.heat-cell.core { background: var(--gold); }
html[data-theme="dark"] .heat-cell.l1 { background: rgba(30, 138, 90, .3); }
html[data-theme="dark"] .heat-cell.l2 { background: rgba(30, 138, 90, .6); }
html[data-theme="dark"] .heat-cell.l3 { background: var(--emerald-soft); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 11.5px; color: var(--ink-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.consistency li { display: flex; align-items: center; gap: 12px; }
.consistency li + li { margin-top: 10px; }
.consistency .name { width: 150px; flex: none; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 640px) { .consistency .name { width: 210px; } }
.consistency .track {
  display: block;                 /* a bare span is inline - width/height would be ignored */
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.consistency .fill {
  display: block;                 /* same reason */
  height: 100%;
  min-width: 3px;                 /* 0% still reads as a bar, not a missing element */
  border-radius: 999px;
  background: var(--emerald);
  transition: width .4s ease;
}
html[data-theme="dark"] .consistency .fill { background: var(--emerald-soft); }
.consistency .fill.high { background: var(--gold); }
.consistency .fill.zero { background: var(--line); }
.consistency .pct {
  width: 44px; flex: none; text-align: right;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  color: var(--ink-muted);
}
.consistency .pct.high { color: var(--gold-dim); }
html[data-theme="dark"] .consistency .pct.high { color: var(--gold); }

.kpi-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); }
.kpi-bar span { display: block; }
.kpi-bar .yes { background: var(--emerald); }
html[data-theme="dark"] .kpi-bar .yes { background: var(--emerald-soft); }
.kpi-bar .partly { background: var(--gold); }
.kpi-bar .no { background: var(--ink-muted); }

/* ------------------------------------------------------------ notices */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.notice-error { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .06); color: #B91C1C; }
html[data-theme="dark"] .notice-error { color: #FCA5A5; }
.notice-ok { border-color: rgba(30, 138, 90, .4); background: rgba(30, 138, 90, .07); color: var(--emerald-mid); }
html[data-theme="dark"] .notice-ok { color: var(--emerald-soft); }
.notice-gold { border-color: rgba(212, 175, 55, .45); background: rgba(212, 175, 55, .1); }

/* ------------------------------------------------------------- toggle */

.switch {
  position: relative;
  flex: none;
  width: 48px; height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background-color .25s, border-color .25s;
}
.switch.is-on { background: var(--emerald); border-color: var(--emerald); }
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 22px; height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.switch.is-on::after { transform: translateX(20px); }

/* ------------------------------------------------------------ landing */

.hero { display: grid; gap: 32px; align-items: center; padding: 40px 16px 24px; }
@media (min-width: 900px) { .hero { grid-template-columns: 1fr 1fr; gap: 48px; padding-top: 56px; } }
.hero h1 { font-size: 34px; line-height: 1.08; }
@media (min-width: 640px) { .hero h1 { font-size: 46px; } }
.hero-underline { position: relative; color: var(--emerald); white-space: nowrap; }
html[data-theme="dark"] .hero-underline { color: var(--gold); }
.hero-underline svg { position: absolute; left: 0; bottom: -6px; width: 100%; height: 9px; color: var(--gold); }
.hero p.lead { margin-top: 18px; max-width: 34em; font-size: 16px; color: var(--ink-muted); }
@media (min-width: 640px) { .hero p.lead { font-size: 17.5px; } }
.hero-cta { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 480px) { .hero-cta { flex-direction: row; } }

.hero-art-wrap { position: relative; }
.hero-art-wrap::before {
  content: "";
  position: absolute;
  inset: -22px;
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(15, 81, 50, .12), rgba(212, 175, 55, .12));
  filter: blur(30px);
  z-index: -1;
}

.feature-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 20px; height: 100%; }
.feature-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: rgba(15, 81, 50, .1);
  color: var(--emerald);
  transition: transform .3s ease;
}
html[data-theme="dark"] .feature-icon { background: rgba(30, 138, 90, .14); color: var(--emerald-soft); }
.feature:hover { box-shadow: var(--shadow-lift); }
.feature:hover .feature-icon { transform: scale(1.1); }
.feature h3 { font-size: 16px; }
.feature p { margin-top: 6px; font-size: 14px; color: var(--ink-muted); }

.explorer { display: grid; gap: 16px; }
/* Grid children default to min-width:auto, so the horizontal scroller below
   would otherwise push the whole page wider than the viewport. */
.explorer > * { min-width: 0; }
@media (min-width: 900px) { .explorer { grid-template-columns: 240px minmax(0, 1fr); } }
.explorer-list {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
}
.explorer-list li { scroll-snap-align: start; }
@media (min-width: 900px) { .explorer-list { flex-direction: column; overflow: visible; padding-bottom: 0; } }
.explorer-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, background-color .2s, color .2s;
}
.explorer-btn:hover { border-color: var(--emerald-soft); color: var(--ink); }
.explorer-btn.is-on { border-color: var(--emerald); background: var(--emerald); color: #fff; }
.explorer-btn .n { font-family: var(--font-mono); font-size: 12px; }
.explorer-btn.is-on .n { color: var(--gold); }
.explorer-panel[hidden] { display: none; }

.timeline { position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 19px; top: 8px; bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--emerald-soft), var(--gold), transparent);
}
.timeline li { position: relative; display: flex; align-items: flex-start; gap: 16px; }
.timeline li + li { margin-top: 16px; }
.timeline-dot {
  position: relative;
  z-index: 1;
  flex: none;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--emerald-soft);
}
.timeline-dot.gold { color: var(--gold); }
.timeline-dot.dim { color: var(--ink-muted); }

.item-list { display: grid; gap: 8px; }
@media (min-width: 640px) { .item-list { grid-template-columns: 1fr 1fr; } }
.item-list li {
  display: flex; align-items: flex-start; gap: 14px;
  height: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color .2s;
}
.item-list li:hover { border-color: rgba(30, 138, 90, .6); }
.item-list .n {
  flex: none;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: rgba(15, 81, 50, .1);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
}
html[data-theme="dark"] .item-list .n { background: rgba(30, 138, 90, .14); color: var(--emerald-soft); }

.closing {
  position: relative;
  padding: 32px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
}
.closing::before {
  content: "";
  position: absolute; inset: 0;
  opacity: .14;
  background:
    radial-gradient(circle at 20% 20%, var(--gold) 0, transparent 45%),
    radial-gradient(circle at 80% 70%, var(--gold) 0, transparent 45%);
}
.closing > * { position: relative; }
.closing .arabic { color: #fff; }

.site-footer { border-top: 1px solid var(--line); padding: 26px 16px; text-align: center; font-size: 12px; color: var(--ink-muted); }

/* --------------------------------------------------------- reveal-in */

.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.is-in { opacity: 1; transform: none; }

/* ------------------------------------------------------------ utility */

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.page { padding-top: 24px; padding-bottom: 96px; }
@media (min-width: 640px) { .page { padding-bottom: 40px; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* =====================================================================
   Pronunciation video (click-to-load YouTube)
   ===================================================================== */

.video {
  display: block;
  max-width: 420px;
  margin-inline: auto;   /* the preview sits centred, not stranded to one side */
}

.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  aspect-ratio: 16 / 9;
}
.video-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  /* hqdefault is 4:3 with letterbox bars; scale past them */
  transform: scale(1.35);
  transition: transform .4s ease;
}
.video-thumb:hover img { transform: scale(1.42); }
.video-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 58, 36, .25), rgba(10, 58, 36, .78));
}
.video-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: 999px;
  background: var(--gold);
  color: #2A2205;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  transition: transform .2s ease, background-color .2s ease;
}
.video-thumb:hover .video-btn { transform: translate(-50%, -50%) scale(1.08); }
.video-thumb:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.video-caption {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500;
  color: #fff;
  text-align: left;
}
.video-meta { margin-top: 8px; font-size: 11.5px; color: var(--ink-muted); text-align: center; }
.video-meta a { color: var(--emerald-mid); font-weight: 500; }
html[data-theme="dark"] .video-meta a { color: var(--gold); }

.video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: block;
}

.video-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink-muted);
  transition: border-color .2s, background-color .2s;
}
.video-search:hover { border-color: var(--emerald-soft); background: rgba(15, 81, 50, .04); }
html[data-theme="dark"] .video-search:hover { background: rgba(255, 255, 255, .04); }
.video-search-icon {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, .16);
  color: var(--gold-dim);
}
html[data-theme="dark"] .video-search-icon { color: var(--gold); }
.video-search strong { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.video-search span span { display: block; font-size: 12.5px; }

/* =====================================================================
   Wide-screen layouts — use the room instead of a narrow column
   ===================================================================== */

/* ---- Today: sticky day summary beside the checklist ---- */
.today-grid { display: grid; gap: 20px; align-items: start; }

@media (min-width: 1080px) {
  .today-grid { grid-template-columns: 360px minmax(0, 1fr); gap: 28px; }
  .today-aside { position: sticky; top: 84px; }
}

.today-main > * + * { margin-top: 12px; }

/* Two columns of cards once there is genuinely room for them. */
@media (min-width: 1500px) {
  .today-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-content: start;
  }
  .today-main > * + * { margin-top: 0; }
  /* Cards that open into something large should not be squeezed. */
  .today-main .item.is-open { grid-column: 1 / -1; }
  .today-main .full-span { grid-column: 1 / -1; }
}

/* ---- Dashboard ---- */
.dash-grid { display: grid; gap: 20px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.dash-grid .span-2 { grid-column: 1 / -1; }

@media (min-width: 640px)  { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1400px) { .stat-grid { gap: 20px; } }

/* ---- Settings ---- */
.settings-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 1000px) { .settings-grid { grid-template-columns: 1fr 1fr; } }
.settings-grid .span-2 { grid-column: 1 / -1; }

/* ---- Landing ---- */
@media (min-width: 1400px) {
  .hero h1 { font-size: 56px; }
  .hero p.lead { font-size: 19px; }
  .feature-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .item-list { grid-template-columns: repeat(3, 1fr); }
}



/* =====================================================================
   Hero photograph — filling its frame, no backdrop art
   ===================================================================== */

.hero-photo {
  position: relative;
  margin: 0;
  display: block;
  border-radius: 22px;
  overflow: hidden;
  /* Shows through wherever the cut-out is transparent. */
  background: linear-gradient(160deg,
              rgba(232, 240, 234, .9) 0%,
              rgba(244, 240, 224, .95) 55%,
              rgba(250, 250, 247, 1) 100%);
  box-shadow: var(--shadow-card);
}
html[data-theme="dark"] .hero-photo {
  background: linear-gradient(160deg,
              rgba(10, 58, 36, .95) 0%,
              rgba(15, 81, 50, .8) 55%,
              rgba(6, 32, 24, 1) 100%);
}

.hero-photo picture { display: block; height: 100%; }

.hero-photo-img {
  display: block;
  /* width/height attributes act as CSS dimensions; override both so the
     image fills the frame exactly. */
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

/* =====================================================================
   Timeline — a left-to-right flow on wide screens
   ===================================================================== */

@media (min-width: 860px) {
  .timeline::before {
    top: 27px; bottom: auto; left: 8%; right: 8%;
    width: auto; height: 2px;
    background: linear-gradient(90deg,
                transparent, var(--emerald-soft) 12%, var(--gold) 62%, transparent);
  }

  .timeline ol,
  ol.timeline {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
  }

  .timeline li {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 0 6px;
  }
  .timeline li + li { margin-top: 0; }

  .timeline-dot {
    width: 54px; height: 54px;
    border-radius: 18px;
    box-shadow: 0 0 0 6px var(--surface);
  }

  .timeline-step { padding-top: 0 !important; }

  /* A small chevron between steps, so the order reads as a flow. */
  .timeline li:not(:last-child) .timeline-dot::after {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(100% + 14px);
    width: 9px; height: 9px;
    border-top: 2px solid var(--gold);
    border-right: 2px solid var(--gold);
    transform: translateY(-50%) rotate(45deg);
    opacity: .75;
  }
}

/* =====================================================================
   Dashboard legibility
   ===================================================================== */

/* A faint floor so "recorded nothing" reads differently from "no data". */
.bars { position: relative; }
.bars::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--line);
}
.bar { min-height: 3px; }
.bar.empty { background: var(--line); opacity: .55; }
.bar.today { outline: 2px solid var(--gold); outline-offset: 1px; }

.chart-axis {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* ---- heatmap with day and month labels ---- */
.heat-wrap { display: flex; gap: 8px; align-items: flex-start; padding-bottom: 4px; }

.heat-days {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  flex: none;
  padding-top: 18px;
  font-size: 9.5px;
  color: var(--ink-muted);
  text-align: right;
  align-items: center;
}
/* A single strip of days needs no weekday gutter. */
.heat-wrap.is-strip .heat-days { display: none; }

/* The body takes the remaining width, and the columns divide it, so the
   squares always fill the card instead of huddling on the left. */
.heat-body { flex: 1; min-width: 0; }

.heat-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  height: 18px;
  font-size: 10.5px;
  color: var(--ink-muted);
}
.heat-month { overflow: visible; white-space: nowrap; }

.heat {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
}
.heat-col {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
}
.heat-wrap.is-strip .heat-col { grid-template-rows: 1fr; }

.heat-cell {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  /* Without a cap, a short range would render a handful of giant squares. */
  max-width: 34px;
  justify-self: center;
  border-radius: 4px;
}
.heat-cell.is-today { box-shadow: 0 0 0 2px var(--gold); }

/* ---- KPI legend ---- */
.kpi-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--ink-muted); }
.kpi-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---- empty-state hint inside a populated dashboard ---- */
.thin-data {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink-muted);
}

/* A number badge on each timeline step, so the order is unmistakable. */
.timeline-dot { position: relative; }
.timeline-num {
  position: absolute;
  top: -6px; right: -6px;
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--emerald);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}
html[data-theme="dark"] .timeline-num { background: var(--gold); color: #2A2205; }

/* ---- landing tasbih teaser: text left, dial right ---- */
.teaser-grid {
  display: grid;
  gap: 24px;
  align-items: center;
  padding: 24px;
}
.teaser-dial-cell { justify-self: center; }

@media (min-width: 720px) {
  .teaser-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 40px;
    padding: 28px 32px;
  }
  .teaser-dial-cell { justify-self: end; padding-right: 12px; }
}

@media (min-width: 1100px) {
  .teaser-grid { padding: 36px 44px; }
}

/* =====================================================================
   Dashboard: date filter and the enriched consistency card
   ===================================================================== */

.dash-head { margin-bottom: 16px; }

.date-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
}

.date-presets { display: flex; flex-wrap: wrap; gap: 6px; }

.date-preset {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
.date-preset:hover { border-color: var(--emerald-soft); color: var(--ink); }
.date-preset.is-on {
  border-color: var(--emerald);
  background: var(--emerald);
  color: #fff;
}
html[data-theme="dark"] .date-preset.is-on {
  border-color: var(--gold);
  background: var(--gold);
  color: #2A2205;
}

.date-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.date-custom .field {
  width: auto;
  padding: 7px 10px;
  font-size: 12.5px;
}

.range-note {
  margin: 12px 2px 16px;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.range-note a { margin-left: 8px; font-weight: 600; color: var(--emerald-mid); }
html[data-theme="dark"] .range-note a { color: var(--gold); }

/* ---- consistency card: squares beside the figures ---- */

.consistency-layout { display: grid; gap: 20px; align-items: start; }

/* Side by side only when the squares are a tall block of week columns. A
   single-row strip beside a tall figures panel leaves a large empty well. */
@media (min-width: 900px) {
  .consistency-layout:not(.is-stacked) {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
    gap: 32px;
  }
}

/* Stacked: squares across the top, figures in a row beneath them. */
.consistency-layout.is-stacked .figure-list { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 760px) {
  .consistency-layout.is-stacked .figure-list { grid-template-columns: repeat(4, 1fr); }
  .consistency-layout.is-stacked .figure-note { margin-top: 14px; padding-top: 12px; }
}

.consistency-figures {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.figure-list { display: grid; gap: 14px; }
@media (min-width: 480px) { .figure-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .figure-list { grid-template-columns: 1fr 1fr; } }

.figure-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--emerald);
}
html[data-theme="dark"] .figure-value { color: var(--emerald-soft); }
.figure-value.figure-gold { color: var(--gold-dim); }
html[data-theme="dark"] .figure-value.figure-gold { color: var(--gold); }
.figure-value small { font-size: 12px; font-weight: 400; color: var(--ink-muted); }

.figure-label { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-muted); }

.figure-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-muted);
}
.figure-note svg { flex: none; margin-top: 2px; }
.figure-note strong { color: var(--ink); white-space: nowrap; }

.heat-cell.is-blank { background: transparent; }

/* =====================================================================
   Mobile first-class treatment
   Phones are the primary device for this app, so touch targets, form
   fields and the checklist layout are tuned for them here.
   ===================================================================== */

/* iOS Safari zooms the page whenever a focused field is under 16px.
   Everything stays visually the same size; only the input text grows. */
@media (max-width: 767px) {
  .field,
  input[type="text"], input[type="email"], input[type="password"],
  input[type="date"], input[type="time"], input[type="number"],
  select, textarea {
    font-size: 16px;
  }
  .date-custom .field { font-size: 15px; }
}

/* Touch pointers need larger hit areas than a mouse. Keyed off the pointer
   rather than the width, so it also covers tablets and touch laptops. */
@media (pointer: coarse) {

  /* The single most-tapped control in the app. */
  .check { width: 46px; height: 46px; border-radius: 14px; }

  .expand {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    margin: -4px -6px 0 0;
  }

  .icon-btn { width: 44px; height: 44px; }

  .audio-play { width: 44px; height: 44px; }

  .counter-btn { width: 44px; height: 44px; border-radius: 12px; }

  .btn { padding: 12px 18px; min-height: 46px; }
  .btn-sm { padding: 9px 14px; min-height: 40px; font-size: 13px; }
  .btn-lg { min-height: 52px; }

  .chip { padding: 7px 12px; font-size: 11px; }
  .passage-meta button { min-height: 36px; }

  .choice, .verdict { min-height: 46px; }

  .date-preset { padding: 11px 16px; }

  .tabbar a { padding: 11px 0 9px; font-size: 11.5px; }

  .theme-toggle { width: 66px; height: 38px; }
  .theme-toggle-knob { width: 30px; height: 30px; }
  html[data-theme="dark"] .theme-toggle-knob { transform: translateX(28px); }

  .switch { width: 54px; height: 32px; }
  .switch::after { width: 26px; height: 26px; }
  .switch.is-on::after { transform: translateX(22px); }

  .password-toggle { width: 48px; }
  .password-wrap .field { padding-right: 48px; }

  /* Text links that sit alone need a tappable band around them. */
  .brand { min-height: 44px; }
  .video-meta a,
  .range-note a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 4px;
  }
}

/* ---- narrow phones: give counters a row of their own ---- */
@media (max-width: 480px) {
  .counter {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px 14px;
  }
  .counter-label { font-size: 15px; }
  .counter-controls { justify-content: flex-end; }
  .counter-value { font-size: 15px; }

  .counters { grid-template-columns: 1fr; }

  /* The day header reads better with a little less air on a phone. */
  .day-head { padding: 18px; }
  .day-head h1 { font-size: 21px; }

  .item-head { padding: 14px; gap: 11px; }
  .item-body { padding: 14px; }
  .item-title h3 { font-size: 15.5px; }

  .arabic { font-size: 20px; line-height: 2; }
  .passage { padding: 14px; }

  .tasbih-dial { width: 200px; height: 200px; }
  .tasbih-count { font-size: 42px; }

  .stat-value { font-size: 21px; }
  .stat { padding: 14px; }

  /* Item names would otherwise squeeze the bars to nothing. */
  .consistency li { flex-wrap: wrap; gap: 6px 10px; }
  .consistency .name { width: calc(100% - 56px); font-size: 12.5px; }
  .consistency .pct { width: 44px; }
  .consistency .track { flex: 1 0 100%; order: 3; }

  .date-filter { padding: 12px; gap: 10px; }
  .date-presets { width: 100%; }
  .date-custom { width: 100%; }
  .date-custom .field { flex: 1; min-width: 0; }

  .figure-list { grid-template-columns: 1fr 1fr; gap: 12px; }
  .consistency-figures { padding: 14px; }

  .drawer .verdicts { flex-direction: column; }
  .drawer .verdicts .verdict { width: 100%; }

  .site-footer { padding: 20px 16px; }
}

@media (max-width: 380px) {
  .stat-grid { gap: 8px; }
  /* The numbers stay: the app refers to items by number ("item 12"), so
     dropping them on the smallest screens would break that reference. */
  .item-num { font-size: 11px; }
}

/* A 30-day strip squeezed into a phone gives 6px squares, which is useless.
   Let it wrap onto several rows instead, so each day stays legible. */
@media (max-width: 700px) {
  .heat-wrap.is-strip .heat {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(26px, 1fr));
    gap: 5px;
  }
  .heat-wrap.is-strip .heat-months { display: none; }
  .heat-wrap.is-strip .heat-cell { max-width: 40px; }

  /* Week columns on a phone: keep the squares from collapsing. */
  .heat-wrap:not(.is-strip) { overflow-x: auto; }
  .heat-wrap:not(.is-strip) .heat-body { min-width: 420px; }
}

/* ---- recent KPI reviews ---- */

/* Cards in a row should not stretch into empty space when their neighbour
   is taller; each ends where its content does. */
.dash-grid { align-items: start; }

.kpi-log { display: grid; gap: 2px; }

.kpi-log li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
}
.kpi-log li:first-child { border-top: 0; }

.kpi-log-dot {
  flex: none;
  width: 9px; height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--ink-muted);
}
.kpi-log-dot.yes { background: var(--emerald); }
html[data-theme="dark"] .kpi-log-dot.yes { background: var(--emerald-soft); }
.kpi-log-dot.partly { background: var(--gold); }
.kpi-log-dot.no { background: var(--ink-muted); }
.kpi-log-dot.none { background: var(--line); }

.kpi-log-body { flex: 1; min-width: 0; }

.kpi-log-date {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.kpi-log-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
.kpi-log-text em { color: var(--ink-muted); }

.kpi-log-verdict {
  flex: none;
  align-self: center;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-muted);
}
.kpi-log-verdict.yes { border-color: rgba(15,81,50,.45); color: var(--emerald); }
html[data-theme="dark"] .kpi-log-verdict.yes { border-color: rgba(30,138,90,.5); color: var(--emerald-soft); }
.kpi-log-verdict.partly { border-color: rgba(212,175,55,.6); color: var(--gold-dim); }
html[data-theme="dark"] .kpi-log-verdict.partly { color: var(--gold); }

/* =====================================================================
   Email codes: verification and password reset
   ===================================================================== */

.auth-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--emerald);
  color: var(--gold);
}

.auth-alt {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--emerald-mid);
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }
html[data-theme="dark"] .auth-link { color: var(--gold); }

/* The code itself: wide tracking makes six digits easy to read back. */
.otp-input {
  font-family: var(--font-mono);
  font-size: 26px !important;
  font-weight: 600;
  letter-spacing: 12px;
  text-align: center;
  padding-left: 12px;   /* letter-spacing adds a trailing gap; offset it */
}
.otp-input::placeholder { letter-spacing: 12px; opacity: .35; }

/* =====================================================================
   Brand lockup on the sign-in and code pages
   ===================================================================== */

.auth-logo {
  /* Block-level and centred, so anything after it starts on a new line. */
  display: block;
  width: fit-content;
  margin: 0 auto 6px;
  line-height: 0;
  border-radius: 12px;
}
.auth-logo img {
  width: auto;
  height: 62px;
  max-width: 100%;
}
@media (max-width: 420px) {
  .auth-logo img { height: 52px; }
}

/* The wordmark is deep green and the credit line is near-black, so on a dark
   ground the lockup sits on a light card rather than being recoloured -
   inverting it would flatten the gradient in the mark. */
html[data-theme="dark"] .auth-logo {
  padding: 12px 18px;
  background: rgba(255, 255, 255, .94);
}

/* =====================================================================
   Site footer: the lockup above the source references
   ===================================================================== */

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 28px 16px 32px;
  text-align: center;
}

/* The app shell has a fixed tab bar on phones; keep clear of it. */
@media (max-width: 639px) {
  .site-footer { padding-bottom: 80px; }
}

.footer-logo {
  display: block;
  width: fit-content;
  line-height: 0;
  border-radius: 10px;
  opacity: .9;
  transition: opacity .2s ease;
}
.footer-logo:hover { opacity: 1; }
.footer-logo img { width: auto; height: 44px; }
@media (max-width: 480px) { .footer-logo img { height: 38px; } }

/* Deep-green wordmark needs a light ground in dark mode, as in the header. */
html[data-theme="dark"] .footer-logo {
  padding: 8px 12px;
  background: rgba(255, 255, 255, .92);
}

.footer-refs {
  max-width: 58ch;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-muted);
}
