/* Light Body. Look B (dark athletic) + light mode. Type scale x1.25 from 16px. */
:root {
  --bg: #F4F1EA; --surface: #FFFFFF; --surface-2: #EAE5DB; --line: #DCD6CA;
  --text: #141413; --muted: #6A645B; --accent: #FF6A2B; --on-accent: #141413; --accent-text: #B8430F;
  --warn-bg: #FFF1E8; --warn-line: #F2B898; --ok: #2F7D4F;
  --invert-bg: #141413; --invert-text: #F4F1EA;
  --shadow: 0 1px 2px rgb(20 20 19 / .06), 0 8px 24px rgb(20 20 19 / .06);
  --s0: .8rem; --s1: 1rem; --s2: 1.25rem; --s3: 1.5625rem; --s4: 1.953rem; --s5: 2.441rem; --s6: 3.052rem; --s7: 3.815rem;
  --r: 20px; --r-sm: 14px;
  --display: 'Barlow Condensed', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --body: 'Barlow', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E0F; --surface: #1C1C1F; --surface-2: #26262A; --line: #2E2E33;
    --text: #F4F1EA; --muted: #A39E95; --accent: #FF6A2B; --on-accent: #0E0E0F; --accent-text: #FF8A55;
    --warn-bg: #2A1A12; --warn-line: #6B3A22; --ok: #5FC48A;
    --invert-bg: #F4F1EA; --invert-text: #0E0E0F;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E0F; --surface: #1C1C1F; --surface-2: #26262A; --line: #2E2E33;
  --text: #F4F1EA; --muted: #A39E95; --accent: #FF6A2B; --on-accent: #0E0E0F; --accent-text: #FF8A55;
  --warn-bg: #2A1A12; --warn-line: #6B3A22; --ok: #5FC48A;
  --invert-bg: #F4F1EA; --invert-text: #0E0E0F;
  --shadow: none; color-scheme: dark;
}
:lang(ar) { --display: 'IBM Plex Sans Arabic', system-ui, sans-serif; --body: 'IBM Plex Sans Arabic', system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 var(--s1)/1.5 var(--body);
  min-height: 100dvh; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen {
  flex: 1; display: flex; flex-direction: column; gap: var(--s2);
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 24px);
  animation: rise .42s var(--ease) both;
}
.screen.has-nav { padding-bottom: calc(env(safe-area-inset-bottom) + 100px); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .opt, .sheet { animation: none !important; transition: none !important; } }

/* type */
.label { font: 600 var(--s0)/1.2 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
:lang(ar) .label { letter-spacing: 0; text-transform: none; font-weight: 500; font-size: .9rem; }
.h1 { font: 800 var(--s6)/.95 var(--display); margin: 0; letter-spacing: -.01em; text-transform: uppercase; }
.h2 { font: 800 var(--s4)/1.05 var(--display); margin: 0; }
.h3 { font: 700 var(--s2)/1.25 var(--body); margin: 0; }
:lang(ar) .h1 { font-size: var(--s5); line-height: 1.5; text-transform: none; font-weight: 700; }
:lang(ar) .h2 { font-size: var(--s3); line-height: 1.5; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: var(--s0); }
.num { font-family: 'Barlow Condensed', system-ui, sans-serif; font-weight: 800; font-variant-numeric: tabular-nums; }
.accent { color: var(--accent-text); }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font: 800 var(--s2)/1 'Barlow Condensed', sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.brand svg { width: 34px; height: 34px; }

/* top row */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.iconbtn svg { width: 20px; height: 20px; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.progress { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .95rem; }
.input {
  height: 54px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface);
  padding: 0 16px; font-size: var(--s1); width: 100%;
}
.input:focus { border-color: var(--accent); outline: none; }
.input[dir="ltr"] { text-align: start; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: #D2361F; font-weight: 600; min-height: 1.5em; margin: 0; }
:root[data-theme="dark"] .err { color: #FF7A66; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err { color: #FF7A66; } }

/* buttons */
.btn {
  height: 56px; border-radius: 28px; border: 0; padding: 0 24px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 800 var(--s2)/1 var(--display); letter-spacing: .06em; text-transform: uppercase; width: 100%;
  transition: transform .15s var(--ease), opacity .2s;
}
:lang(ar) .btn { letter-spacing: 0; font-weight: 700; font-size: 1.1rem; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-dark { background: var(--invert-bg); color: var(--invert-text); }
.btn-ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line); }
.btn-danger { background: #D2361F; color: #fff; }
.link { background: none; border: 0; padding: 10px 4px; color: var(--accent-text); font-weight: 600; min-height: 44px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.push { margin-top: auto; }

/* options */
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  min-height: 60px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface);
  padding: 14px 16px; text-align: start; display: flex; align-items: center; gap: 14px; font-size: 1.05rem; font-weight: 500;
  transition: border-color .2s, background .2s, transform .15s var(--ease); animation: rise .4s var(--ease) both;
}
.opt:active { transform: scale(.985); }
.opt .tick { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; transition: .2s; }
.opt.radio .tick { border-radius: 12px; }
.opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt[aria-pressed="true"] .tick { background: var(--accent); border-color: var(--accent); }
.opt[aria-pressed="true"] .tick::after { content: ''; width: 10px; height: 6px; border: 2.5px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.chip {
  height: 72px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface);
  font: 800 var(--s4)/1 'Barlow Condensed', sans-serif;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { background: var(--line); } }

/* cards */
.card { background: var(--surface); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card-invert { background: var(--invert-bg); color: var(--invert-text); }
.card-invert .label { color: color-mix(in srgb, var(--invert-text) 60%, transparent); }
.warn { background: var(--warn-bg); border: 1.5px solid var(--warn-line); border-radius: var(--r); padding: 18px; }
.note { border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; font-size: .95rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: 16px; padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.tile .num { font-size: var(--s5); line-height: 1; }
.tile .num small { font-size: var(--s1); color: var(--muted); font-weight: 600; }

/* hero countdown */
.count { display: flex; align-items: baseline; gap: 10px; }
.count .num { font-size: var(--s7); line-height: .85; }
.count .unit { font: 800 var(--s4)/1 var(--display); color: var(--accent-text); text-transform: uppercase; }

/* empty state */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 20px; }
.empty .ring { width: 96px; height: 96px; border-radius: 48px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); }
.empty .ring svg { width: 40px; height: 40px; color: var(--accent); }

/* list (Me) */
.list { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 16px; border: 0; background: none; width: 100%; text-align: start; }
.item + .item { border-top: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .val { color: var(--muted); }
.item svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.item.danger { color: #D2361F; }
.section { display: flex; flex-direction: column; gap: 8px; }
.facts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.facts li { display: flex; gap: 10px; }
.facts li::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-top: .55em; flex: none; }

/* bottom nav */
.nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav div { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a {
  height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none;
  color: var(--muted); font: 600 .78rem/1 var(--display); letter-spacing: .08em; text-transform: uppercase;
}
:lang(ar) .nav a { letter-spacing: 0; font-size: .8rem; }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--accent-text); }

/* sheet (modal) */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .45); z-index: 10; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  background: var(--bg); width: 100%; max-width: 480px; border-radius: 24px 24px 0 0; padding: 24px 20px calc(env(safe-area-inset-bottom) + 20px);
  display: flex; flex-direction: column; gap: 14px; animation: up .35s var(--ease) both; max-height: 90dvh; overflow: auto;
}
@keyframes up { from { transform: translateY(100%); } }
.toast {
  position: fixed; inset-inline: 20px; bottom: calc(env(safe-area-inset-bottom) + 90px); z-index: 20; max-width: 440px; margin: 0 auto;
  background: var(--invert-bg); color: var(--invert-text); border-radius: 14px; padding: 14px 18px; font-weight: 600; animation: rise .3s var(--ease) both;
}
.credits { text-align: center; font-size: var(--s0); color: var(--muted); padding: 8px 0; }
.credits a { color: inherit; }
