@import url("../fonts/fonts.css");

/* Layout: dark-first app. Phone = single column + bottom tab bar. iPad/desktop (>=900px) = side rail on the right + two-column grids. */
:root {
  --bg: #0B0D12;
  --surface: #141821;
  --surface-2: #1C2130;
  --surface-3: #252B3D;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #F4F5F8;
  --text-2: #C3C8D4;
  --muted: #8B93A6;
  --ink-on-accent: #0B0D12;
  --primary: #F4F5F8;          /* main buttons: light pill on dark */
  --r-task: #EC4F73;           /* ring 1: tasks */
  --r-move: #66AC1E;           /* ring 2: movement */
  --r-soul: #3594DC;           /* ring 3: prayers & adhkar */
  --flame: #FFB547;            /* streak / XP */
  --good: #34C77B;
  --warn: #F5A524;
  --bad: #F2555A;
  --glow-a: rgba(236, 79, 115, .22);
  --glow-b: rgba(53, 148, 220, .20);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 22px;
  --radius-sm: 14px;
  --font-display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Readex Pro", system-ui, sans-serif;
  --font-quran: "IBM Plex Sans Arabic", "Geeza Pro", "Traditional Arabic", serif;
  --tabbar-h: 64px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F4F8;
  --surface: #FFFFFF;
  --surface-2: #F1F2F7;
  --surface-3: #E6E8F0;
  --line: rgba(14, 18, 32, .08);
  --line-2: rgba(14, 18, 32, .14);
  --text: #0E1220;
  --text-2: #353C50;
  --muted: #5F6779;
  --ink-on-accent: #FFFFFF;
  --primary: #0E1220;
  --r-task: #E03A62;
  --r-move: #5E9F00;
  --r-soul: #2D7FF0;
  --flame: #D98200;
  --good: #1E9E5A;
  --warn: #C27C00;
  --bad: #D6363C;
  --glow-a: rgba(224, 58, 98, .10);
  --glow-b: rgba(45, 127, 240, .10);
  --shadow: 0 8px 24px rgba(14, 18, 32, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F3F4F8; --surface: #FFFFFF; --surface-2: #F1F2F7; --surface-3: #E6E8F0;
    --line: rgba(14, 18, 32, .08); --line-2: rgba(14, 18, 32, .14);
    --text: #0E1220; --text-2: #353C50; --muted: #5F6779; --ink-on-accent: #FFFFFF; --primary: #0E1220;
    --r-task: #E03A62; --r-move: #5E9F00; --r-soul: #2D7FF0; --flame: #D98200;
    --good: #1E9E5A; --warn: #C27C00; --bad: #D6363C;
    --glow-a: rgba(224, 58, 98, .10); --glow-b: rgba(45, 127, 240, .10);
    --shadow: 0 8px 24px rgba(14, 18, 32, .08);
    color-scheme: light;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  background: var(--bg); z-index: 30;
}
.glow {
  position: fixed; inset: -20vh -20vw auto; height: 70vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 50% at 80% 20%, var(--glow-a), transparent 70%),
    radial-gradient(40% 50% at 15% 10%, var(--glow-b), transparent 70%);
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--r-soul); outline-offset: 2px; border-radius: 8px; }
.num, .tabular { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.25; margin: 0; text-wrap: balance; font-weight: 600; }
h1 { font-size: clamp(26px, 6vw, 34px); letter-spacing: -.01em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }

/* ---------- shell ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.main {
  flex: 1; min-width: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: calc(env(safe-area-inset-top, 0px) + 14px) calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 28px);
}
.view { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; animation: viewIn .35s ease both; }
@keyframes viewIn { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px;
  background: none; border: 0; color: var(--muted); font-size: 11.5px; font-weight: 500; text-decoration: none;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { stroke: var(--r-task); }
.rail { display: none; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .rail {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; width: 248px; flex: none;
    padding: calc(env(safe-area-inset-top, 0px) + 22px) 14px 22px max(14px, env(safe-area-inset-right, 0px));
    border-inline-start: 0; border-inline-end: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
  }
  .rail .brand { padding: 4px 12px 18px; }
  .rail a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
    color: var(--text-2); text-decoration: none; font-weight: 500;
  }
  .rail a svg { width: 22px; height: 22px; }
  .rail a:hover { background: var(--surface-2); }
  .rail a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
  .rail a[aria-current="page"] svg { stroke: var(--r-task); }
  .rail .rail-sep { height: 1px; background: var(--line); margin: 10px 12px; }
  .main { padding-block: 28px 48px; padding-inline: 32px; }
}
.brand { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; font-size: 15px; direction: ltr; text-align: right; }
.brand b { background: linear-gradient(90deg, var(--r-task), var(--flame)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- generic ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; min-width: 0;
}
.card.flat { background: transparent; border-style: dashed; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.grid { display: grid; gap: 14px; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-family: var(--font-display); font-size: 15px;
  text-decoration: none; transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--bg); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--bad); }
.btn svg { width: 18px; height: 18px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.icon-btn svg { width: 20px; height: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip.on { background: var(--text); color: var(--bg); border-color: transparent; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.pill.good { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.flame { background: color-mix(in srgb, var(--flame) 18%, transparent); color: var(--flame); }

input[type="text"], input[type="number"], input[type="time"], input[type="date"], input[type="password"], textarea, select {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--r-soul); }
textarea { min-height: 140px; resize: vertical; line-height: 1.8; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }

.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--line); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg a { padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; text-decoration: none; }
.seg a[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.2); }

.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(-20px); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; background: none; border-inline: 0; border-top: 0; width: 100%; text-align: start; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .chev { color: var(--muted); width: 18px; height: 18px; flex: none; transform: scaleX(-1); }
.ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface-2); }
.ic svg { width: 21px; height: 21px; }

details.acc { border-bottom: 1px solid var(--line); }
details.acc:last-child { border-bottom: 0; }
details.acc > summary { list-style: none; cursor: pointer; padding: 14px 2px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-family: var(--font-display); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: "+"; margin-inline-start: auto; font-size: 20px; color: var(--muted); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(45deg); }
details.acc .acc-body { padding: 0 2px 16px; color: var(--text-2); display: flex; flex-direction: column; gap: 10px; }
ul.dots { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
ul.dots li::marker { color: var(--muted); }
ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
ol.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
ol.steps li::before { content: counter(s); font-family: var(--font-display); font-weight: 600; font-size: 13px; width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); margin-top: 1px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 4px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.back svg { width: 16px; height: 16px; }

/* ---------- hero (today) ---------- */
.hero { display: grid; gap: 18px; grid-template-columns: 1fr; padding: 22px; position: relative; overflow: hidden; }
@media (min-width: 700px) { .hero { grid-template-columns: 1.1fr .9fr; align-items: center; } }
.hero .day-big { display: flex; align-items: baseline; gap: 8px; direction: rtl; }
.hero .day-big .n { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.hero .day-big .of { font-size: 20px; color: var(--muted); font-weight: 500; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--r-task), var(--flame)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
[dir="rtl"] .bar > i { margin-inline-start: 0; }
.rings-wrap { display: flex; align-items: center; gap: 18px; justify-content: center; }
.rings { width: 156px; height: 156px; flex: none; }
.rings circle { fill: none; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.ring-legend { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ring-legend .lg { display: flex; flex-direction: column; }
.ring-legend .lg b { font-family: var(--font-display); font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ring-legend .lg span { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ring-legend .lg span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.lg.t span::before { background: var(--r-task); } .lg.m span::before { background: var(--r-move); } .lg.s span::before { background: var(--r-soul); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-family: var(--font-display); font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.flame b { color: var(--flame); }

.quote { font-family: var(--font-display); font-size: 18px; font-weight: 500; line-height: 1.6; }
.quote-card { background: linear-gradient(135deg, color-mix(in srgb, var(--r-task) 16%, var(--surface)), color-mix(in srgb, var(--r-soul) 16%, var(--surface))); border: 1px solid var(--line); }

.alert-card { display: flex; gap: 14px; align-items: flex-start; border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.alert-card .ic { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }

/* ---------- tasks ---------- */
.task-group + .task-group { margin-top: 6px; }
.task-group h4 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 8px 2px 4px; }
.task {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2);
  border: 1px solid transparent; margin-bottom: 8px; transition: background .2s, opacity .2s;
}
.task .t-main { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.task .t-title { font-weight: 600; font-size: 15.5px; }
.task .t-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.done .t-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.check {
  width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid var(--line-2); background: transparent;
  display: grid; place-items: center; transition: transform .15s, background .2s, border-color .2s; padding: 0;
}
.check svg { width: 16px; height: 16px; stroke: var(--bg); stroke-width: 3; opacity: 0; transform: scale(.5); transition: .2s; }
.check.on { background: var(--good); border-color: var(--good); }
.check.on svg { opacity: 1; transform: none; }
.check:active { transform: scale(.88); }
.check.pop { animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
.task .xp { font-size: 12px; font-weight: 600; color: var(--flame); font-family: var(--font-display); }

.water { display: flex; gap: 6px; flex-wrap: wrap; }
.water button { width: 34px; height: 40px; border-radius: 10px 10px 14px 14px; border: 1.5px solid var(--line-2); background: transparent; padding: 0; position: relative; overflow: hidden; }
.water button.on { border-color: var(--r-soul); background: color-mix(in srgb, var(--r-soul) 35%, transparent); }

.prayers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.prayer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; font-size: 13px; font-weight: 600; }
.prayer .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; }
.prayer.on { border-color: color-mix(in srgb, var(--r-soul) 50%, transparent); }
.prayer.on .dot { background: var(--r-soul); border-color: var(--r-soul); }
.prayer .dot svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; opacity: 0; }
.prayer.on .dot svg { opacity: 1; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week .d { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.week .d i { width: 100%; max-width: 40px; aspect-ratio: 1; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-style: normal; font-family: var(--font-display); font-weight: 600; color: var(--text-2); font-size: 14px; position: relative; overflow: hidden; }
.week .d i::before { content: ""; position: absolute; inset: auto 0 0 0; height: var(--p, 0%); background: color-mix(in srgb, var(--r-task) 55%, transparent); }
.week .d i span { position: relative; }
.week .d.today i { outline: 2px solid var(--text); outline-offset: 2px; }
.week .d.full i { background: var(--r-task); color: #fff; }
.week .d.full i::before { display: none; }

/* ---------- 60-day grid ---------- */
.journey { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.journey i { aspect-ratio: 1; border-radius: 6px; background: var(--surface-3); position: relative; display: grid; place-items: center; font-style: normal; font-size: 10px; color: var(--muted); font-family: var(--font-display); }
.journey i.l1 { background: color-mix(in srgb, var(--r-task) 30%, var(--surface-3)); color: var(--text-2); }
.journey i.l2 { background: color-mix(in srgb, var(--r-task) 60%, var(--surface-3)); color: #fff; }
.journey i.l3 { background: var(--r-task); color: #fff; }
.journey i.today { outline: 2px solid var(--text); outline-offset: 1px; }
.journey i.future { opacity: .45; }
.legend-scale { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.legend-scale i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-display); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-wrap { position: relative; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); font-size: 12.5px; padding: 6px 10px; border-radius: 10px; white-space: nowrap; transform: translate(-50%, -110%); font-family: var(--font-display); z-index: 5; }

/* ---------- exercises ---------- */
.ex-card { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); text-decoration: none; color: inherit; border: 1px solid transparent; }
.ex-card:hover { border-color: var(--line-2); }
.ex-card .meta { font-size: 12.5px; color: var(--muted); }
.ex-pic { width: 52px; height: 52px; border-radius: 14px; flex: none; display: grid; place-items: center; }
.ex-pic svg { width: 28px; height: 28px; }
.ex-hero { border-radius: var(--radius); padding: 22px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kv div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.kv b { display: block; font-family: var(--font-display); font-size: 19px; font-variant-numeric: tabular-nums; }
.kv span { font-size: 12px; color: var(--muted); }
.mistake { display: flex; gap: 10px; align-items: flex-start; }
.mistake svg { width: 18px; height: 18px; flex: none; margin-top: 4px; stroke: var(--bad); }
.tip-line { display: flex; gap: 10px; align-items: flex-start; }
.tip-line svg { width: 18px; height: 18px; flex: none; margin-top: 4px; stroke: var(--good); }

.sets { display: flex; flex-direction: column; gap: 8px; }
.set-row { display: grid; grid-template-columns: 34px 1fr 1fr 44px; gap: 8px; align-items: center; }
.set-row .n { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-family: var(--font-display); font-size: 13px; font-weight: 600; }
.set-row input { min-height: 40px; padding: 6px 10px; text-align: center; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.set-row.done .n { background: var(--good); color: #fff; }
.set-head { display: grid; grid-template-columns: 34px 1fr 1fr 44px; gap: 8px; font-size: 12px; color: var(--muted); text-align: center; }

.sched { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.sched .s { border-radius: 14px; padding: 10px 4px; text-align: center; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sched .s b { font-size: 12px; color: var(--muted); font-weight: 600; }
.sched .s span { font-family: var(--font-display); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.sched .s.today { outline: 2px solid var(--text); outline-offset: 1px; }
.sched .s.k-rest span { color: var(--muted); }
.sched .s.k-cardio span { color: var(--r-soul); }
.sched .s.k-str span { color: var(--r-move); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 600; }
table.tbl td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

/* ---------- adhkar ---------- */
.dhikr { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.dhikr .txt { font-family: var(--font-quran); font-size: 21px; line-height: 2.1; white-space: pre-line; }
.dhikr .src { font-size: 13px; color: var(--muted); }
.dhikr .virtue { font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.counter {
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; position: relative;
  border: 0; background: var(--surface-2); color: var(--text); font-family: var(--font-display);
}
.counter svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.counter circle { fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .3s; }
.counter b { font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.counter small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.counter:active { transform: scale(.96); }
.counter.done { background: color-mix(in srgb, var(--good) 18%, var(--surface-2)); }
.dots-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.dots-nav i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.dots-nav i.on { background: var(--good); }
.dots-nav i.cur { background: var(--text); width: 18px; border-radius: 4px; }

/* ---------- lessons / mind ---------- */
.lesson-text { font-size: 16.5px; line-height: 1.95; color: var(--text-2); max-width: 65ch; }
.action-box { background: color-mix(in srgb, var(--r-move) 12%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--r-move) 35%, transparent); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.track-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.days-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
@media (min-width: 600px) { .days-grid { grid-template-columns: repeat(10, 1fr); } }
.days-grid a { aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; text-decoration: none; color: var(--text-2); font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.days-grid a.done { background: color-mix(in srgb, var(--good) 25%, var(--surface-2)); color: var(--text); }
.days-grid a.cur { outline: 2px solid var(--text); outline-offset: 1px; }
.days-grid a.lock { opacity: .4; }
.mood { display: flex; gap: 8px; justify-content: space-between; }
.mood button { flex: 1; min-height: 54px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); padding: 6px 2px; }
.mood button b { font-family: var(--font-display); font-size: 18px; color: var(--text); }
.mood button[aria-pressed="true"] { background: var(--text); border-color: transparent; color: var(--bg); }
.mood button[aria-pressed="true"] b { color: var(--bg); }
.entry { padding: 14px; border-radius: 16px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.entry p { white-space: pre-wrap; color: var(--text-2); }
.breath { width: 180px; height: 180px; margin: 10px auto; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, color-mix(in srgb, var(--r-soul) 45%, transparent), transparent 70%); transition: transform 4s ease-in-out; font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.breath.in { transform: scale(1.3); }
.lock-screen { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 0; text-align: center; }
.pin-dots { display: flex; gap: 12px; direction: ltr; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pinpad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; direction: ltr; }
.pinpad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--surface-2); font-family: var(--font-display); font-size: 24px; font-weight: 500; }

/* ---------- badges ---------- */
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 700px) { .badges { grid-template-columns: repeat(6, 1fr); } }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 18px; background: var(--surface-2); text-align: center; }
.badge .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.badge .medal svg { width: 24px; height: 24px; }
.badge b { font-size: 13px; font-weight: 600; line-height: 1.4; }
.badge span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.badge.on .medal { background: linear-gradient(135deg, var(--flame), var(--r-task)); color: #fff; }
.badge:not(.on) { opacity: .6; }

.level { display: flex; align-items: center; gap: 14px; }
.level .lv { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, var(--flame), var(--r-task)); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 22px; flex: none; }

/* ---------- overlays ---------- */
.sheet-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
  animation: up .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; gap: 14px;
}
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 26px; padding: 22px; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 4px; }
.toast-wrap { position: fixed; z-index: 80; inset: calc(env(safe-area-inset-top, 0px) + 12px) 0 auto 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--text); color: var(--bg); border-radius: 18px; padding: 12px 16px; font-weight: 600; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; max-width: 520px; animation: toastIn .35s cubic-bezier(.2,1.4,.4,1); font-size: 14.5px; }
.toast .xp { color: var(--flame); font-family: var(--font-display); }
@keyframes toastIn { from { transform: translateY(-20px) scale(.95); opacity: 0; } }
.toast.out { opacity: 0; transform: translateY(-10px); transition: .3s; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; width: 100%; height: 100%; }

.timer-ring { width: 200px; height: 200px; margin: 0 auto; position: relative; display: grid; place-items: center; }
.timer-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.timer-ring b { font-family: var(--font-display); font-size: 52px; font-variant-numeric: tabular-nums; }

/* ---------- focus mode (ابدأ يومك) ---------- */
.focus { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; padding: calc(env(safe-area-inset-top, 0px) + 16px) max(18px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 18px) max(18px, env(safe-area-inset-left, 0px)); animation: fade .25s; }
.focus .f-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; max-width: 620px; width: 100%; margin: 0 auto; padding-top: 10px; }
.focus .f-steps { display: flex; gap: 4px; }
.focus .f-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); }
.focus .f-steps i.on { background: var(--text); }
.focus .f-foot { display: flex; gap: 10px; max-width: 620px; width: 100%; margin: 0 auto; }
.focus .f-foot .btn { flex: 1; }
.big-emoji { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--surface-2); }
.big-emoji svg { width: 36px; height: 36px; }

/* ---------- onboarding ---------- */
.onb { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 22px; max-width: 460px; margin: 0 auto; padding: 40px 0; }
.onb .logo-rings { width: 96px; height: 96px; }
.onb h1 { font-size: 36px; }
.onb .big { font-family: var(--font-display); font-size: 44px; font-weight: 700; letter-spacing: .06em; direction: ltr; text-align: right; line-height: 1.05; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice button { min-height: 54px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; }
.choice button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

.install-card { display: flex; gap: 14px; align-items: center; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.search { position: relative; }
.search input { padding-inline-start: 42px; }
.search svg { position: absolute; top: 50%; inset-inline-start: 14px; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.result { padding: 12px 4px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; }
.result small { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
