/* ==========================================================
   Challenge Yourself — design tokens (from the logo)
   ========================================================== */
:root {
  /* Brand */
  --clay: #d46a45;          /* logo mountain, decorative */
  --clay-strong: #b5532f;   /* text/buttons on light: 4.9:1 with white */
  --clay-soft: #f6dccf;
  --sun: #e8b04b;           /* logo sun */
  --sun-soft: #fbecc8;
  --slate: #7b7672;         /* logo grey mountain */
  --ink: #2b2420;           /* logo outline/text */
  --ink-muted: #645a53;     /* 5.6:1 on cream */
  --cream: #f7f3e8;         /* logo background (sampled) */
  --paper: #fffdf9;
  --line: #e8dfd1;
  --missed: #efe7dc;

  /* Type */
  --font: "Rubik", system-ui, "Segoe UI", Tahoma, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --fs-hero: clamp(2.5rem, 1.4rem + 4.6vw, 4.75rem);

  /* Space (4/8 rhythm) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* Shape — circle (logo) for marks, generous radius for surfaces, pill for controls */
  --r-card: 28px;
  --r-cell: 12px;
  --r-pill: 999px;
  --shadow: 0 1px 0 rgba(43, 36, 32, .04), 0 18px 40px -24px rgba(90, 60, 40, .35);

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --t-fast: 160ms;
  --t-med: 280ms;

  --z-header: 40;
  --z-toast: 100;
}

*, *::before, *::after { box-sizing: border-box; }

/* Section scrolling is animated in app.js (eased, with header offset) */
/* the scrollbar's space is always reserved, so locking scroll doesn't shift the layout */
html { scroll-padding-top: 96px; scrollbar-gutter: stable; }
/* page behind an open pop-up stays still */
html.scroll-locked { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* decorative rays never cause sideways scroll (keeps sticky working) */
}
.hero { overflow-x: clip; }

img, video, canvas { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }

/* Arabic reads better a touch larger with more line height */
html[lang="ar"] body { line-height: 1.8; }
html[lang="ar"] h1, html[lang="ar"] h2 { line-height: 1.3; }

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

:focus-visible {
  outline: 3px solid var(--clay-strong);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; inset-inline-start: var(--s4); top: -60px;
  background: var(--ink); color: var(--paper);
  padding: var(--s2) var(--s4); border-radius: var(--r-pill);
  z-index: var(--z-toast); text-decoration: none;
}
.skip-link:focus { top: var(--s4); }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s5);
  border-radius: var(--r-pill); border: 2px solid transparent;
  font-weight: 600; font-size: var(--fs-sm);
  text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--clay-strong); color: #fff; }
.btn-primary:hover { background: #9c4526; }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.btn-text {
  background: none; border: 0; padding: var(--s2) var(--s1); min-height: 40px;
  color: var(--ink-muted); font-size: var(--fs-sm); font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.btn-text:hover { color: var(--clay-strong); }

.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--paper);
  cursor: pointer; transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  padding: var(--s3) var(--s4);
  display: flex; justify-content: center;
  pointer-events: none;
}
.nav {
  pointer-events: auto;
  display: flex; align-items: center; gap: var(--s5);
  padding: var(--s1) var(--s1) var(--s1) var(--s2);
  padding-inline: var(--s2) var(--s1);
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-pill);
  box-shadow: 0 12px 30px -16px rgba(43, 36, 32, .6);
}
.nav-brand {
  display: flex; align-items: center; gap: var(--s2);
  color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap;
}
/* Crops the circular emblem out of the full logo image */
.logo-mark {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cream) url("media/logo-mark.webp") no-repeat center / cover;
  flex: none;
}
.nav-links { display: flex; gap: var(--s1); }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s3);
  color: inherit; text-decoration: none; font-size: var(--fs-sm); font-weight: 500;
  border-radius: var(--r-pill); opacity: .85;
  transition: background-color var(--t-fast) ease, opacity var(--t-fast) ease;
}
.nav-links a:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.lang-toggle {
  min-height: 40px; padding: 0 var(--s4);
  border: 0; border-radius: var(--r-pill);
  background: var(--sun); color: var(--ink);
  font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
  transition: background-color var(--t-fast) ease;
}
.lang-toggle:hover { background: #f1c56e; }

.menu-toggle { display: none; }

/* Mobile: links move into a dropdown opened by the menu button */
@media (max-width: 720px) {
  .nav { position: relative; gap: var(--s2); }
  .nav-brand { margin-inline-end: auto; }
  .menu-toggle {
    display: grid; place-items: center;
    width: 44px; height: 44px; border-radius: 50%;
    border: 0; background: rgba(255, 255, 255, .1); color: var(--paper); cursor: pointer;
    transition: background-color var(--t-fast) ease;
  }
  .menu-toggle:hover { background: rgba(255, 255, 255, .18); }
  .menu-toggle .icon-close { display: none; }
  .menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
  .menu-toggle[aria-expanded="true"] .icon-close { display: block; }

  .nav-links {
    position: absolute; top: calc(100% + var(--s2)); inset-inline: 0;
    flex-direction: column; gap: var(--s1);
    padding: var(--s2);
    background: var(--ink); border-radius: 24px;
    box-shadow: 0 20px 40px -18px rgba(43, 36, 32, .7);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med);
  }
  .nav-links.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-out), visibility 0s;
  }
  .nav-links a {
    display: flex; min-height: 48px; padding: 0 var(--s4);
    font-size: var(--fs-base); border-radius: 16px; opacity: 1;
  }
  .nav-links a:hover, .nav-links a:focus-visible { background: rgba(255, 255, 255, .1); }
}
@media (max-width: 360px) {
  .nav-brand-text { display: none; }
}

/* ---------------- Sections ---------------- */
.section {
  max-width: 1180px; margin: 0 auto;
  padding: var(--s9) var(--s5);
}
.section-head { max-width: 640px; margin-bottom: var(--s6); }
.section-head h2, .cal-copy h2, .todo-card h2 { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.01em; }
.section-head p { margin-top: var(--s3); color: var(--ink-muted); font-size: var(--fs-lg); }
html[lang="ar"] .section-head h2, html[lang="ar"] h1 { letter-spacing: 0; }

/* ---------------- Email verification banner ---------------- */
.verify-banner {
  width: calc(100% - 2 * var(--s5)); max-width: calc(1180px - 2 * var(--s5));
  margin: var(--s3) auto 0; padding: var(--s4) var(--s5);
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  background: var(--sun-soft); border: 1.5px solid #f1d48e; border-radius: 20px;
}
.verify-icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--paper); color: #8a5a07;
}
.verify-body { flex: 1 1 260px; min-width: 0; }
.verify-title { font-weight: 700; }
.verify-text { font-size: var(--fs-sm); color: var(--ink-muted); overflow-wrap: anywhere; }
.verify-status { font-size: var(--fs-sm); font-weight: 500; color: #24531c; }
.verify-status:not(:empty) { margin-top: var(--s1); }
.verify-status[data-kind="error"] { color: #b3261e; }
.verify-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.verify-btn { min-height: 44px; }
.reminder-verify-note {
  margin-top: var(--s3); padding: var(--s4); border-radius: 16px;
  background: var(--sun-soft); color: #6d4c0c; font-size: var(--fs-sm); font-weight: 500;
  display: grid; gap: var(--s2);
}
.reminder-verify-title { display: flex; align-items: center; gap: var(--s2); font-weight: 700; color: var(--ink); }
.reminder-verify-title .icon { width: 18px; height: 18px; color: #8a5a07; }
.reminder-verify-note .verify-actions { margin-top: var(--s1); }
/* locked until the email is verified: controls fade and can't be used */
#reminderForm.is-locked .switch-row,
#reminderForm.is-locked .reminder-options,
#reminderForm.is-locked #reminderSave { opacity: .45; }
#reminderForm.is-locked .switch-row { cursor: not-allowed; }
#reminderForm.is-locked #reminderSave { cursor: not-allowed; }
@media (max-width: 480px) {
  .verify-banner { width: calc(100% - 2 * var(--s3)); padding: var(--s4); }
  .verify-actions { width: 100%; }
  .verify-btn { flex: 1; }
}

/* ---------------- Hero ---------------- */
.hero {
  max-width: 1180px; margin: 0 auto;
  padding: var(--s7) var(--s5) var(--s8);
  display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--s7);
  align-items: center;
}
.hero-tag {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: var(--s1) var(--s4) var(--s1) var(--s3);
  padding-inline: var(--s3) var(--s4);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-muted);
}
.hero-tag .icon { color: var(--clay); width: 18px; height: 18px; }
.hero h1 {
  margin-top: var(--s5);
  font-size: var(--fs-hero); font-weight: 800; letter-spacing: -.025em;
  max-width: 12ch;
}
html[lang="ar"] .hero h1 { max-width: 14ch; }
.hero-lead { margin-top: var(--s5); max-width: 46ch; font-size: var(--fs-lg); color: var(--ink-muted); }
.hero-actions { margin-top: var(--s6); display: flex; flex-wrap: wrap; gap: var(--s3); }

.hero-visual { position: relative; aspect-ratio: 1; max-width: 520px; width: 100%; justify-self: center; }
.hero-rays { position: absolute; inset: -6%; width: 112%; height: 112%; stroke: var(--sun); stroke-width: 6; }
.hero-photo {
  position: absolute; inset: 7%;
  border-radius: 50%; overflow: hidden;
  border: 5px solid var(--ink);
  background: var(--sun-soft);
}
/* Frame on the middle of the scene (woman, dog and man) so no one is cut off */
.hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 50%; }
.hero-trail {
  position: absolute; inset-inline-end: -10%; bottom: -14%;
  width: 46%; height: auto;
  fill: none; stroke: var(--clay); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 0 12;
}
[dir="rtl"] .hero-trail { transform: scaleX(-1); }
.streak-card {
  position: absolute; inset-inline-start: -4%; bottom: 8%;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s5) var(--s3) var(--s3);
  padding-inline: var(--s3) var(--s5);
  background: var(--paper); border-radius: var(--r-pill);
  box-shadow: var(--shadow);
}
.streak-icon {
  width: 44px; height: 44px; padding: 10px; border-radius: 50%;
  background: var(--clay-soft); color: var(--clay-strong);
}
.streak-num { font-size: 1.75rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.streak-label { font-size: var(--fs-xs); color: var(--ink-muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: var(--s5); }
  .hero-visual { max-width: 400px; margin-top: var(--s5); }
  .hero-trail { display: none; }
}

/* ---------------- Habit tags ---------------- */
.habit-panel {
  background: var(--paper); border-radius: var(--r-card);
  padding: var(--s6); box-shadow: var(--shadow);
}
.habit-panel-top {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  margin-bottom: var(--s5);
}
.habit-count { font-weight: 600; }
.habit-count strong { color: var(--clay-strong); }
.habit-grid { display: flex; flex-wrap: wrap; gap: var(--s3); }
.habit-chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: var(--paper); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500; cursor: pointer;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
  touch-action: manipulation;
}
.habit-chip .icon { width: 18px; height: 18px; color: var(--clay-strong); transition: color var(--t-fast) ease; }
.habit-chip:hover { border-color: var(--clay); background: #fff7f2; }
.habit-chip:active { transform: scale(.96); }
.habit-chip .chip-check { display: none; }
.habit-chip[aria-pressed="true"] {
  background: var(--clay-strong); border-color: var(--clay-strong); color: #fff;
}
.habit-chip[aria-pressed="true"] .icon { color: #fff; }
.habit-chip[aria-pressed="true"] .chip-check {
  display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--clay-strong);
}
.habit-chip[aria-pressed="true"] .chip-check .icon { width: 12px; height: 12px; stroke-width: 3.5; color: var(--clay-strong); }

/* "Add custom habit" chip */
.habit-add {
  border-style: dashed; border-color: var(--clay); color: var(--clay-strong); font-weight: 600;
  background: transparent;
}
.habit-add:hover { background: #fff7f2; border-style: solid; }

/* "Edit list" mode: chip + small remove button side by side */
.habit-actions { display: flex; align-items: center; gap: var(--s3); }
#editHabits[aria-pressed="true"] { color: var(--clay-strong); font-weight: 700; }
.habit-item { display: inline-flex; align-items: center; }
.habit-item.is-editing .habit-chip { padding-inline-end: var(--s3); border-start-end-radius: 0; border-end-end-radius: 0; }
.habit-removed-label {
  flex-basis: 100%; margin-top: var(--s3); padding-top: var(--s4);
  border-top: 1px dashed var(--line);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-muted);
}
.habit-restore {
  border-style: dashed; color: var(--ink-muted); background: transparent;
}
.habit-restore .icon { color: var(--ink-muted); }
.habit-restore:hover { color: var(--ink); border-style: solid; }
.chip-remove {
  display: grid; place-items: center;
  width: 36px; min-height: 44px;
  border: 1.5px solid var(--line); border-inline-start: 0;
  border-start-end-radius: var(--r-pill); border-end-end-radius: var(--r-pill);
  background: var(--paper); color: var(--ink-muted); cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.chip-remove .icon { width: 14px; height: 14px; }
.chip-remove:hover { background: #fbe3dc; color: #b3261e; }
.habit-chip[aria-pressed="true"] + .chip-remove { border-color: var(--clay-strong); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ---------------- Calendar ---------------- */
.calendar-section {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s8); align-items: center;
}
.cal-copy p { margin-top: var(--s4); color: var(--ink-muted); max-width: 52ch; }
.cal-copy h2 + p { margin-top: var(--s5); }
.check-list { margin-top: var(--s6); display: grid; gap: var(--s3); }
.check-list li { display: flex; align-items: center; gap: var(--s3); font-size: var(--fs-sm); }
.check-dot {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  border: 2px solid var(--clay); position: relative;
}
.check-dot::after {
  content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--sun);
}

.cal-card-wrap {
  background: #efe7da; border-radius: calc(var(--r-card) + 12px);
  padding: var(--s4);
}
.cal-card {
  background: var(--paper); border-radius: var(--r-card);
  padding: var(--s5); box-shadow: var(--shadow);
}
.cal-habits {
  display: flex; gap: var(--s2); overflow-x: auto;
  padding-bottom: var(--s3); margin-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.cal-habits:empty { display: none; }
.cal-tab {
  flex: none; display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4);
  border: 0; border-radius: var(--r-pill);
  background: var(--cream); color: var(--ink-muted);
  font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.cal-tab .icon { width: 16px; height: 16px; }
.cal-tab:hover { color: var(--ink); }
.cal-tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
/* the tab row scrolls sideways, which clips anything drawn outside it,
   so the focus ring is drawn inside the tab instead */
.cal-tab:focus-visible { outline: 3px solid var(--sun); outline-offset: -3px; border-radius: var(--r-pill); }

.cal-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.cal-month { font-size: var(--fs-lg); font-weight: 700; text-align: center; }
.cal-stats { display: flex; justify-content: center; gap: var(--s2); margin: var(--s3) 0 var(--s4); flex-wrap: wrap; }
.pill {
  padding: var(--s1) var(--s3); border-radius: var(--r-pill);
  background: var(--clay-soft); color: #7d3519;
  font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums;
}
.pill-sun { background: var(--sun-soft); color: #6d4c0c; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
}
.cal-dow {
  text-align: center; font-size: var(--fs-xs); font-weight: 500; color: var(--ink-muted);
  padding-bottom: var(--s2);
  overflow: hidden; white-space: nowrap; text-overflow: clip;
}
.cal-dow .dow-short { display: none; }
html[lang="ar"] .cal-dow { font-size: 0.75rem; }
@media (max-width: 1100px) {
  html[lang="ar"] .cal-dow .dow-long { display: none; }
  html[lang="ar"] .cal-dow .dow-short { display: inline; }
}
.cal-day {
  aspect-ratio: 1; min-height: 36px;
  display: grid; place-items: center; position: relative;
  border: 0; border-radius: var(--r-cell);
  background: var(--cream); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
  touch-action: manipulation;
}
.cal-day:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--clay); }
.cal-day:active:not(:disabled) { transform: scale(.94); }
.cal-day.is-done { background: var(--clay-strong); color: #fff; }
.cal-day.is-missed {
  color: #8a3b1f;
  background: repeating-linear-gradient(135deg, #f8e6dc 0 6px, #f2d3c3 6px 9px);
}
.cal-day.is-missed::after {
  content: ""; position: absolute; inset-inline-end: 6px; top: 6px;
  width: 6px; height: 6px; border-radius: 50%; background: #c0573a;
}
.cal-day.is-today { box-shadow: inset 0 0 0 2.5px var(--ink); }
.cal-day:disabled { color: #b8aea4; background: #f8f4ee; cursor: default; }
.cal-day.is-blank { visibility: hidden; }

.cal-day.is-selected { outline: 3px solid var(--sun); outline-offset: 2px; z-index: 1; }

.cal-empty { text-align: center; color: var(--ink-muted); padding: var(--s6) var(--s4); }

/* Completed / Missed toggle for the selected day */
.cal-mark {
  margin-top: var(--s4); padding: var(--s4);
  background: var(--cream); border-radius: 20px;
  display: grid; gap: var(--s3);
}
.cal-mark-date { font-size: var(--fs-sm); font-weight: 600; text-align: center; }
.cal-mark-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; background: var(--paper); border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
}
.mark-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s3);
  border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-muted);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
  touch-action: manipulation;
}
.mark-btn .icon { width: 18px; height: 18px; }
.mark-btn:hover:not(:disabled) { color: var(--ink); background: var(--cream); }
.mark-btn:active:not(:disabled) { transform: scale(.97); }
.mark-btn:disabled { opacity: .45; cursor: not-allowed; }
.mark-done[aria-pressed="true"] { background: var(--clay-strong); color: #fff; }
.mark-missed[aria-pressed="true"] { background: #f2d3c3; color: #7d3519; }

/* Pop-up shown after marking a day */
.cheer {
  width: min(320px, calc(100vw - 32px));
  padding: var(--s6) var(--s5) var(--s5);
  border: 0; border-radius: var(--r-card);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 60px -20px rgba(43, 36, 32, .55);
  text-align: center;
}
/* open/close motion is done in app.js (Web Animations) */
.cheer::backdrop { background: rgba(43, 36, 32, .45); backdrop-filter: blur(2px); }
.cheer-icon {
  width: 64px; height: 64px; margin: 0 auto var(--s4);
  display: grid; place-items: center; border-radius: 50%;
}
.cheer-icon .icon { width: 30px; height: 30px; stroke-width: 2.5; }
.cheer[data-kind="done"] .cheer-icon { background: var(--clay-strong); color: #fff; }
.cheer[data-kind="missed"] .cheer-icon { background: var(--sun-soft); color: #8a5a07; }
.cheer h3 { font-size: var(--fs-lg); font-weight: 800; }
.cheer p { margin-top: var(--s3); color: var(--ink-muted); font-size: var(--fs-sm); line-height: 1.6; }
.cheer .cheer-streak {
  display: inline-block; margin-top: var(--s3);
  padding: var(--s1) var(--s3); border-radius: var(--r-pill);
  background: var(--sun-soft); color: #6d4c0c; font-weight: 600; font-size: var(--fs-xs);
}
.cheer-close { margin-top: var(--s5); width: 100%; }

/* Add-your-own-habit pop-up */
.add-habit { width: min(380px, calc(100vw - 32px)); text-align: start; }
.add-habit h3, .add-habit > form > p { text-align: center; }
.add-habit-icon { background: var(--clay-soft); color: var(--clay-strong); }
.field-label { display: block; margin-top: var(--s5); margin-bottom: var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.field-input {
  width: 100%; min-height: 48px; padding: 0 var(--s4);
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: var(--cream); font: inherit; font-size: 1rem; color: var(--ink);
}
.field-input::placeholder { color: #8f857c; }
.field-input:focus { outline: none; border-color: var(--clay-strong); background: #fff; box-shadow: 0 0 0 3px var(--clay-soft); }
.field-input[aria-invalid="true"] { border-color: #b3261e; }
.add-habit .field-error { min-height: 1.3em; margin-top: var(--s1); font-size: var(--fs-xs); color: #b3261e; font-weight: 500; text-align: start; }
.icon-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.icon-picker .field-label { margin-top: var(--s2); padding: 0; }
.icon-options { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.icon-option { position: relative; cursor: pointer; }
.icon-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-swatch {
  display: grid; place-items: center; aspect-ratio: 1; min-height: 36px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink-muted);
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.icon-swatch .icon { width: 18px; height: 18px; }
.icon-option:hover .icon-swatch { border-color: var(--clay); color: var(--clay-strong); }
.icon-option input:checked + .icon-swatch { background: var(--clay-strong); border-color: var(--clay-strong); color: #fff; }
.icon-option input:focus-visible + .icon-swatch { outline: 3px solid var(--clay-strong); outline-offset: 2px; }
.add-habit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin-top: var(--s5); }
@media (max-width: 400px) {
  .icon-options { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.cal-legend {
  display: flex; flex-wrap: wrap; gap: var(--s4);
  margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--ink-muted);
}
.cal-legend > span { display: inline-flex; align-items: center; gap: var(--s2); }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legend-swatch.done { background: var(--clay-strong); }
.legend-swatch.missed { background: repeating-linear-gradient(135deg, #f8e6dc 0 3px, #e9bfab 3px 5px); }
.legend-swatch.today { box-shadow: inset 0 0 0 2px var(--ink); }

@media (max-width: 900px) {
  .calendar-section { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
}
@media (max-width: 420px) {
  .cal-card-wrap { padding: var(--s2); }
  .cal-card { padding: var(--s4); }
  .cal-grid { gap: 4px; }
  .cal-day { border-radius: 8px; font-size: var(--fs-xs); }
}

/* ---------------- Mountain progress ---------------- */
.climb-section { padding-top: 0; }
.climb-grid {
  display: grid; gap: var(--s5);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.climb-card {
  width: 100%; height: 100%; padding: 0; text-align: start;
  display: flex; flex-direction: column;
  border: 0; border-radius: var(--r-card); overflow: hidden;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
  font: inherit; cursor: pointer;
  transition: transform var(--t-med) var(--ease-out), box-shadow var(--t-med) ease;
}
.climb-card:hover { transform: translateY(-3px); box-shadow: 0 1px 0 rgba(43, 36, 32, .04), 0 24px 44px -24px rgba(90, 60, 40, .45); }
.climb-card:focus-visible { outline: 3px solid var(--clay-strong); outline-offset: 3px; border-radius: var(--r-card); }

/* the illustration */
.climb-art {
  display: block; width: 100%; height: auto; aspect-ratio: 240 / 170;
  background: linear-gradient(180deg, #fbf3e2 0%, var(--cream) 100%);
}
.climb-sun circle { fill: var(--sun); }
.climb-rays { transform-origin: 150px 52px; transform-box: view-box; }
.climb-rays line { stroke: var(--sun); stroke-width: 3; stroke-linecap: round; opacity: .55; }
.climb-card.is-summit .climb-rays line { opacity: 1; }
.climb-back { fill: var(--slate); }
.climb-front { fill: var(--clay); }
.climb-shade { fill: var(--clay-strong); opacity: .55; }
.climb-trail {
  fill: none; stroke: #fff6e6; stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 0.1 7; opacity: .9;
}
.climb-trail-done { fill: none; stroke: var(--sun); stroke-width: 4; stroke-linecap: round; }
.climb-flag { transform-origin: 104px 31px; transform-box: view-box; transform: scaleY(0); }
.climb-card.is-summit .climb-flag { transform: scaleY(1); }
.climb-flag line { stroke: var(--ink); stroke-width: 2; }
.climb-flag path { fill: var(--sun); stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.climber circle { fill: var(--ink); }
.climber .climber-halo { fill: rgba(255, 253, 249, .85); }
.climber path { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* the text under it */
.climb-info { display: grid; gap: var(--s2); padding: var(--s4) var(--s5) var(--s5); }
.climb-name { display: flex; align-items: center; gap: var(--s2); font-weight: 700; }
.climb-name .icon { width: 18px; height: 18px; color: var(--clay-strong); }
.climb-count { font-size: var(--fs-sm); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.climb-bar { height: 6px; border-radius: 999px; background: var(--cream); overflow: hidden; }
.climb-bar span { display: block; height: 100%; border-radius: inherit; background: var(--sun); }
.climb-status { font-size: var(--fs-xs); font-weight: 600; color: var(--clay-strong); }
.climb-status.is-summit { color: #6d4c0c; }

.climb-empty {
  display: grid; justify-items: center; gap: var(--s4); text-align: center;
  padding: var(--s7) var(--s5); border-radius: var(--r-card); background: var(--paper); color: var(--ink-muted);
}

/* ---------------- Banner ---------------- */
/* Banner scrolls past like any other section (no pinning, no waiting) */
.banner-track {
  position: relative;
  margin: var(--s5) var(--s5) 0;
}
.banner {
  position: relative;
  height: clamp(380px, 75vh, 680px);
  overflow: hidden;
  display: grid; place-items: center;
  /* sunset backdrop, matching the clip; shows if a phone can't play the video */
  background:
    radial-gradient(120% 70% at 70% 62%, rgba(232, 176, 75, .9) 0%, rgba(212, 106, 69, .75) 35%, rgba(43, 36, 32, 0) 70%),
    linear-gradient(180deg, #3b2c25 0%, #6e3a26 55%, #2b2420 100%);
  border-radius: var(--r-card);
  isolation: isolate;
}
.banner-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.banner-shade {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(43, 36, 32, .35), rgba(43, 36, 32, .6));
}
.banner-content { text-align: center; color: #fff; padding: var(--s6) var(--s5); }
.banner-content h2 {
  font-size: clamp(3rem, 1.6rem + 7vw, 7.5rem); font-weight: 800; letter-spacing: -.03em;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .25);
}
html[lang="ar"] .banner-content h2 { letter-spacing: 0; }
.banner-content p { margin-top: var(--s4); font-size: var(--fs-lg); font-weight: 500; opacity: .95; }

/* ---------------- To-do ---------------- */
.todo-section {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: var(--s7); align-items: start;
}
.todo-card {
  background: var(--paper); border-radius: var(--r-card);
  padding: var(--s6); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.todo-form { margin-top: var(--s5); }
.todo-label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--s2); }
.todo-input-row { display: flex; gap: var(--s2); }
.todo-input-row input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--s4);
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  background: var(--cream); font: inherit; font-size: 1rem; color: var(--ink);
  transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.todo-input-row input::placeholder { color: #8f857c; }
.todo-input-row input:focus { outline: none; border-color: var(--clay-strong); background: #fff; box-shadow: 0 0 0 3px var(--clay-soft); }
.todo-input-row input[aria-invalid="true"] { border-color: #b3261e; }
.todo-error { min-height: 1.4em; margin-top: var(--s1); font-size: var(--fs-xs); color: #b3261e; font-weight: 500; }

.todo-list { display: grid; gap: var(--s2); margin-top: var(--s2); }
.todo-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  padding-inline: var(--s4) var(--s2);
  border: 1.5px solid var(--line); border-radius: 18px;
  background: var(--paper);
  transition: background-color var(--t-med) ease, border-color var(--t-med) ease;
}
.todo-item.is-new { animation: todo-in var(--t-med) var(--ease-out); }
@keyframes todo-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.todo-item label { flex: 1; display: flex; align-items: center; gap: var(--s3); min-height: 40px; cursor: pointer; overflow-wrap: anywhere; }
.todo-item input[type="checkbox"] {
  appearance: none; flex: none; margin: 0;
  width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--slate); background: #fff; cursor: pointer;
  display: grid; place-items: center;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease;
}
.todo-item input[type="checkbox"]::after {
  content: ""; width: 6px; height: 11px; margin-top: -2px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0);
  transition: transform var(--t-fast) var(--ease-out);
}
.todo-item input[type="checkbox"]:checked { background: var(--clay-strong); border-color: var(--clay-strong); }
.todo-item input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
.todo-item.is-done { background: var(--cream); border-color: transparent; }
.todo-item.is-done .todo-text { text-decoration: line-through; color: var(--ink-muted); }
.todo-delete {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.todo-delete:hover { background: #fbe3dc; color: #b3261e; }
.todo-delete .icon { width: 18px; height: 18px; }

.todo-empty { color: var(--ink-muted); padding: var(--s5) 0; }
.todo-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-top: var(--s5); flex-wrap: wrap; }
.todo-remaining { font-weight: 600; }
.todo-quote {
  margin: auto 0 0; padding-top: var(--s5);
  font-style: italic; color: var(--ink-muted); font-size: var(--fs-sm);
}
.todo-quote:not(:empty) { margin-top: var(--s5); border-top: 1px dashed var(--line); }

/* a fixed portrait frame: the picture keeps the same framing however long
   the list gets, and stays in view while you scroll past a long list */
.todo-photo {
  margin: 0; border-radius: var(--r-card); overflow: hidden;
  aspect-ratio: 4 / 5;
  position: sticky; top: 96px;
}
/* centred on the man and his to-do list */
.todo-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }

@media (max-width: 900px) {
  .todo-section { grid-template-columns: 1fr; }
  .todo-photo { order: -1; aspect-ratio: 16 / 9; position: static; }
}
@media (max-width: 480px) {
  .section { padding: var(--s8) var(--s4); }
  .habit-panel, .todo-card { padding: var(--s5) var(--s4); }
  .btn-add span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .btn-add { width: 48px; padding: 0; }
  .banner-track { margin-inline: var(--s3); }
}

/* ---------------- Contact ---------------- */
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
.contact-card {
  background: var(--paper); border-radius: var(--r-card);
  padding: var(--s6); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3);
}
.contact-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--clay-soft); color: var(--clay-strong);
  margin-bottom: var(--s2);
}
.contact-icon .icon { width: 26px; height: 26px; }
.contact-card h3 { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-muted); }
.contact-value {
  font-size: clamp(1.25rem, 1rem + 1.2vw, 1.75rem); font-weight: 700;
  color: var(--ink); text-decoration: none; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.contact-value:hover { color: var(--clay-strong); text-decoration: underline; text-underline-offset: 4px; }
[dir="rtl"] .contact-value { text-align: right; align-self: flex-start; }
.contact-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
@media (max-width: 760px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-card { padding: var(--s5); }
}

/* ---------------- Login / register page ---------------- */
.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.auth-top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  max-width: 1180px; width: 100%; margin: 0 auto; padding: var(--s4) var(--s5);
}
.auth-brand { color: var(--ink); font-size: var(--fs-base); }
.auth-main {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: var(--s8); align-items: center;
  padding: var(--s5) var(--s5) var(--s8);
}
.footer-logo-frame.auth-logo { width: min(200px, 50vw); margin-bottom: var(--s5); }
.auth-intro h1 { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.01em; }
html[lang="ar"] .auth-intro h1 { letter-spacing: 0; }
.auth-lead { margin-top: var(--s4); max-width: 44ch; font-size: var(--fs-lg); color: var(--ink-muted); }
.auth-intro .check-list { margin-top: var(--s5); }

.auth-card {
  background: var(--paper); border-radius: var(--r-card);
  padding: var(--s6); box-shadow: var(--shadow);
}
.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  padding: 4px; background: var(--cream); border-radius: var(--r-pill);
}
.auth-tabs [role="tab"] {
  position: relative; z-index: 1;
  min-height: 44px; border: 0; background: transparent; border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-sm); color: var(--ink-muted); cursor: pointer;
  transition: color var(--t-med) ease;
}
.auth-tabs [role="tab"][aria-selected="true"] { color: var(--paper); }
.auth-tab-indicator {
  position: absolute; top: 4px; bottom: 4px; left: 0;
  background: var(--ink); border-radius: var(--r-pill);
}
.auth-heading { margin-top: var(--s5); font-size: var(--fs-lg); font-weight: 700; }
.auth-panel .field-label { margin-top: var(--s4); }
.auth-panel .field-error { min-height: 1.3em; margin-top: var(--s1); font-size: var(--fs-xs); color: #b3261e; font-weight: 500; }
.field-hint { margin-top: var(--s1); font-size: var(--fs-xs); color: var(--ink-muted); }
.field-hint + .field-error { margin-top: 0; }

.password-wrap { position: relative; }
.password-wrap .field-input { padding-inline-end: 52px; }
.pw-toggle {
  position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-muted); cursor: pointer;
}
.pw-toggle:hover { background: var(--paper); color: var(--ink); }
.pw-toggle .icon { width: 18px; height: 18px; }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s1); }
.remember { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); cursor: pointer; min-height: 40px; }
.remember input { width: 18px; height: 18px; accent-color: var(--clay-strong); cursor: pointer; }

.auth-submit { width: 100%; margin-top: var(--s5); }
.auth-submit:disabled { cursor: progress; opacity: .85; }
.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
}
.auth-submit.is-busy .spinner { display: inline-block; animation: spin .8s linear infinite; animation-duration: .8s !important; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-switch { margin-top: var(--s4); text-align: center; font-size: var(--fs-sm); color: var(--ink-muted); }

.auth-alert {
  margin-top: var(--s4); padding: var(--s3) var(--s4); border-radius: 16px;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1.5;
  background: #fbe3dc; color: #8c2a14;
}
.auth-alert[data-kind="success"] { background: #e6f2e4; color: #24531c; }

@media (max-width: 900px) {
  .auth-main { grid-template-columns: minmax(0, 1fr); gap: var(--s6); padding-top: 0; }
  .auth-intro { text-align: center; }
  .footer-logo-frame.auth-logo { margin-inline: auto; width: 110px; margin-bottom: var(--s3); }
  .auth-intro h1 { font-size: 1.6rem; }
  .auth-lead { margin-inline: auto; margin-top: var(--s2); font-size: var(--fs-base); }
  .auth-intro .check-list { display: none; }
}
@media (max-width: 480px) {
  .auth-card { padding: var(--s5) var(--s4); }
  .auth-top { padding-inline: var(--s4); }
}

/* Privacy page */
.privacy-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: var(--s3) var(--s5) var(--s8); }
.privacy-card {
  background: var(--paper); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: var(--s7) var(--s7) var(--s8);
}
.privacy-card h1 { font-size: var(--fs-xl); font-weight: 800; }
.privacy-updated { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--ink-muted); }
.privacy-lead { margin-top: var(--s5); font-size: var(--fs-lg); line-height: 1.6; }
.privacy-card h2 { margin-top: var(--s7); font-size: var(--fs-lg); font-weight: 700; }
.privacy-card p, .privacy-card li { color: var(--ink-muted); max-width: 64ch; }
.privacy-card h2 + p, .privacy-card h2 + ul { margin-top: var(--s3); }
.privacy-card ul { padding-inline-start: var(--s5); display: grid; gap: var(--s2); list-style: disc; }
.privacy-card li::marker { color: var(--clay); }
.privacy-card strong { color: var(--ink); }
.privacy-card a:not(.btn) { color: var(--clay-strong); text-underline-offset: 3px; }
.privacy-back { margin-top: var(--s7); }
@media (max-width: 480px) {
  .privacy-main { padding-inline: var(--s3); }
  .privacy-card { padding: var(--s6) var(--s5) var(--s7); }
}

/* Unsubscribe page */
.unsub-main { flex: 1; display: grid; place-items: center; padding: var(--s5) var(--s4) var(--s8); }
.unsub-card { width: min(460px, 100%); text-align: center; }
.unsub-card h1 { font-size: var(--fs-xl); font-weight: 800; }
.unsub-card .auth-lead { margin-inline: auto; font-size: var(--fs-base); }
.unsub-icon { background: var(--sun-soft); color: #8a5a07; }
.unsub-icon.is-done { background: var(--clay-strong); color: #fff; }
.unsub-card .auth-submit { margin-top: var(--s5); }
/* reset-password page: the form reads left-to-right / right-to-left normally */
.reset-card .reset-form { text-align: start; margin-top: var(--s4); }
.reset-card .reset-form .field-error { min-height: 1.3em; margin-top: var(--s1); font-size: var(--fs-xs); color: #b3261e; font-weight: 500; }
.reset-card .reset-form .field-label { margin-top: var(--s4); }
.reset-card #resetText { overflow-wrap: anywhere; }

/* Main site: hidden until the login check finishes */
html.auth-pending body { visibility: hidden; }
html.auth-pending::after {
  content: ""; position: fixed; inset: 0; margin: auto;
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--clay-soft); border-top-color: var(--clay-strong);
  animation: spin .8s linear infinite; animation-duration: .8s !important;
}
.auth-error-screen {
  position: fixed; inset: 0; display: grid; place-items: center; padding: var(--s5);
  background: var(--cream); text-align: center; visibility: visible;
}
.auth-error-screen p { max-width: 40ch; margin: var(--s3) auto var(--s5); color: var(--ink-muted); }

/* ---------------- Avatar + profile side panel ---------------- */
.avatar {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--clay-strong); color: #fff;
  font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase; line-height: 1;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.375rem; }
.nav-avatar {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; padding: 0; background: transparent; cursor: pointer;
}
.nav-avatar .avatar { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px rgba(255, 255, 255, .25); transition: box-shadow var(--t-fast) ease; }
.nav-avatar:hover .avatar { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--sun); }

.drawer {
  /* side sheet pinned to the end edge (right in English, left in Arabic) */
  margin: 0; inset-block: 0; inset-inline: auto 0;
  width: min(420px, 100vw); height: 100vh; height: 100dvh; max-height: none; max-width: 100vw;
  padding: 0 var(--s5) var(--s6);
  border: 0; border-start-start-radius: var(--r-card); border-end-start-radius: var(--r-card);
  background: var(--paper); color: var(--ink);
  box-shadow: -30px 0 60px -30px rgba(43, 36, 32, .5);
  overflow-y: auto; overscroll-behavior: contain;
}
[dir="rtl"] .drawer { box-shadow: 30px 0 60px -30px rgba(43, 36, 32, .5); }
.drawer::backdrop { background: rgba(43, 36, 32, .45); backdrop-filter: blur(2px); }
.drawer-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s5) 0 var(--s4); background: var(--paper);
}
.drawer-head h2 { font-size: var(--fs-lg); font-weight: 800; }
.drawer-user {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4); border-radius: 20px; background: var(--cream);
}
.drawer-user-text { min-width: 0; }
.drawer-name { font-weight: 700; font-size: var(--fs-lg); overflow-wrap: anywhere; }
.drawer-email { font-size: var(--fs-sm); color: var(--ink-muted); overflow-wrap: anywhere; }
[dir="rtl"] .drawer-email { text-align: right; }

.drawer-section { padding: var(--s5) 0; border-bottom: 1px solid var(--line); }
.drawer-section h3 { font-size: var(--fs-base); font-weight: 700; }
.drawer-section .field-label { margin-top: var(--s3); }
.drawer-section .field-error { min-height: 1.3em; margin-top: var(--s1); font-size: var(--fs-xs); color: #b3261e; font-weight: 500; }
.drawer-section form > .field-label:first-child { margin-top: var(--s3); }
.drawer-text { margin-top: var(--s2); font-size: var(--fs-sm); color: var(--ink-muted); }
.inline-field { display: flex; gap: var(--s2); margin-top: var(--s3); }
.inline-field .field-input { flex: 1; min-width: 0; }
.drawer-btn { margin-top: var(--s3); }
.form-status { font-size: var(--fs-sm); font-weight: 500; color: #24531c; }
.form-status:not(:empty) { margin-top: var(--s2); }
.form-status[data-kind="error"] { color: #b3261e; }

/* on/off switch (checkbox styled as a toggle) */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  margin-top: var(--s3); min-height: 44px; cursor: pointer; font-size: var(--fs-sm); font-weight: 600;
}
.switch {
  appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 48px; height: 28px; border-radius: 999px;
  background: #d9cfc3; position: relative;
  transition: background-color var(--t-fast) ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform var(--t-med) var(--ease-out);
}
.switch:checked { background: var(--clay-strong); }
.switch:checked::after { transform: translateX(20px); }
[dir="rtl"] .switch:checked::after { transform: translateX(-20px); }
.switch:disabled { opacity: .5; cursor: progress; }
.reminder-options[hidden] { display: none; }
.field-select { appearance: none; cursor: pointer; padding-inline-end: var(--s6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23645a53' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
[dir="rtl"] .field-select { background-position: left 16px center; }

.segmented {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: var(--s3);
  padding: 4px; background: var(--cream); border-radius: var(--r-pill);
}
.seg-btn {
  min-height: 44px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-muted); font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
  transition: background-color var(--t-fast) ease, color var(--t-fast) ease;
}
.seg-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.confirm-box {
  margin-top: var(--s3); padding: var(--s4); border-radius: 18px;
  background: #fbefe9; border: 1.5px solid #f2d3c3;
}
.confirm-box > p:first-child { font-size: var(--fs-sm); font-weight: 500; color: #7d3519; }
.confirm-actions { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }
.confirm-actions .btn { flex: 1; }
.btn-danger { background: #b3261e; color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-danger-ghost { border-color: #b3261e; color: #b3261e; background: transparent; }
.btn-danger-ghost:hover { background: #b3261e; color: #fff; }
.danger-zone h3 { color: #8f1d17; }
.drawer-logout { width: 100%; margin-top: var(--s5); }
.drawer-logout .icon { width: 18px; height: 18px; }

/* ---------------- Footer ---------------- */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
  padding: var(--s7) var(--s5) var(--s8);
  text-align: center;
}
/* Shows the emblem and "Challenge Yourself" only, cropping off the
   "Maintain the habit" line (image area x 430–950, y 80–645 of 1376×768) */
.footer-links { display: flex; gap: var(--s5); margin-top: var(--s2); }
.footer-links a, .auth-footer a {
  color: var(--ink-muted); font-size: var(--fs-sm); font-weight: 500;
  text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; display: inline-flex; align-items: center;
}
.footer-links a:hover, .auth-footer a:hover { color: var(--clay-strong); }
.footer-copy { font-size: var(--fs-xs); color: var(--ink-muted); }
.auth-footer {
  display: flex; align-items: center; justify-content: center; gap: var(--s4); flex-wrap: wrap;
  padding: 0 var(--s5) var(--s5);
}

.footer-logo-frame {
  width: min(240px, 64vw);
  aspect-ratio: 520 / 565;
  overflow: hidden;
  direction: ltr;            /* keep the crop identical on the Arabic (RTL) page */
}
.footer-logo {
  width: 264.62%;            /* 1376 / 520 */
  max-width: none; height: auto;
  margin-left: -82.69%;      /* 430 / 520 (physical left, same in Arabic) */
  margin-top: -15.38%;       /* 80 / 520 (% of frame width) */
}
.footer-note { font-size: var(--fs-xs); color: var(--ink-muted); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; inset-inline-start: 50%; bottom: var(--s5);
  transform: translate(-50%, 20px);
  padding: var(--s3) var(--s5); border-radius: var(--r-pill);
  background: var(--ink); color: var(--paper); font-size: var(--fs-sm); font-weight: 500;
  opacity: 0; pointer-events: none; z-index: var(--z-toast);
  transition: opacity var(--t-med) ease, transform var(--t-med) var(--ease-out);
  display: flex; align-items: center; gap: var(--s3);
}
[dir="rtl"] .toast { transform: translate(50%, 20px); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
[dir="rtl"] .toast.is-visible { transform: translate(50%, 0); }
.toast button {
  background: none; border: 0; color: var(--sun); font-weight: 700; cursor: pointer;
  min-height: 32px; text-decoration: underline; text-underline-offset: 3px;
}
