/* BPR RESET — app.css · Matrix-green brand × Life Reset layout · RTL Darija */
:root {
  --bg0: #030303; --bg1: #070707; --card: #0E0F0E; --card2: #131513;
  --line: rgba(0, 255, 102, .13); --line2: rgba(255, 255, 255, .07);
  --neon: #00FF66; --neon2: #00E676; --glow: rgba(0, 255, 102, .35);
  --red: #FF3B4E; --gold: #FFC83D; --blue: #3EA6FF; --violet: #A78BFA;
  --text: #fff; --text2: #CFCFCF; --muted: #8F8F8F;
  --f-ar: 'Tajawal', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --f-num: 'Share Tech Mono', ui-monospace, monospace;
  --f-disp: 'Space Grotesk', sans-serif;
  --r: 22px; --r2: 16px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --g-med: linear-gradient(140deg, #8B5CF6 0%, #4C1D95 55%, #1E1B4B 100%);
  --g-move: linear-gradient(140deg, #FB923C 0%, #EA580C 45%, #7F1D1D 100%);
  --g-money: linear-gradient(140deg, #00E676 0%, #059669 45%, #0F3D3A 100%);
  --g-learn: linear-gradient(140deg, #38BDF8 0%, #2563EB 50%, #0C1E4A 100%);
  --g-nofap: linear-gradient(140deg, #FDE047 0%, #F59E0B 45%, #78350F 100%);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg0); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg0); color: var(--text);
  font-family: var(--f-ar); font-size: 16px; line-height: 1.5; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(0, 255, 102, .10), transparent 60%),
    radial-gradient(80% 40% at 100% 100%, rgba(0, 255, 102, .04), transparent 70%);
}
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .045;
  background-image: var(--grain);
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input, textarea { font: inherit; color: inherit; }
.num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-num); direction: ltr; unicode-bidi: isolate; }
.eyebrow { font-family: var(--f-num); font-size: 11px; letter-spacing: .18em; color: var(--neon); text-transform: uppercase; direction: ltr; unicode-bidi: isolate; opacity: .85; }
.hide { display: none !important; }

#app {
  position: relative; z-index: 1; max-width: 480px; margin: 0 auto;
  padding: calc(var(--sat) + 14px) 16px calc(var(--sab) + 104px);
}
.view-enter { animation: fadeUp .28s ease both; }
#app.still .view-enter { animation: none; }   /* re-render of the same view: no fade (render() toggles .still) */
@keyframes fadeUp { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- header ---------------- */
.hd { margin-bottom: 14px; }
.hd-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.ic-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--line2); color: var(--text2); font-size: 20px;
}
.ic-btn:active { transform: scale(.94); }
.ic-btn svg { width: 22px; height: 22px; }
.hd-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 2px; }
.hd-day { font-family: var(--f-disp); font-weight: 700; line-height: .9; direction: ltr; unicode-bidi: isolate; display: flex; align-items: flex-end; gap: 6px; }
.hd-day small { font-family: var(--f-num); font-size: 13px; letter-spacing: .2em; color: var(--muted); display: block; margin-bottom: 8px; }
.hd-day b { font-size: 76px; color: var(--neon); text-shadow: 0 0 28px var(--glow); letter-spacing: -.03em; font-weight: 700; }
.hd-day i { font-style: normal; font-size: 26px; color: var(--muted); margin-bottom: 8px; }
.hd-pills { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line2); font-size: 14px; white-space: nowrap;
}
.pill b { font-family: var(--f-disp); font-weight: 700; font-size: 15px; }
.pill-fire { border-color: rgba(255, 140, 50, .35); background: linear-gradient(90deg, rgba(255, 120, 40, .16), rgba(255, 120, 40, .04)); }
.pill-lv { border-color: var(--line); direction: ltr; }
.pill-lv .mono { font-size: 12px; color: var(--neon); letter-spacing: .08em; }
.hd-date { color: var(--text2); font-size: 15px; font-weight: 500; margin-top: 8px; }
.hd-title { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin: 6px 0 0; }
.hd-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------------- cards ---------------- */
.card {
  background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line2);
  border-radius: var(--r); padding: 16px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.01em; }
.sec-h { display: flex; align-items: center; gap: 8px; margin: 22px 4px 10px; color: var(--text2); font-size: 15px; font-weight: 700; }
.sec-h .ln { flex: 1; height: 1px; background: var(--line2); }

/* week strip */
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 14px; }
.wk-d { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 7px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2); min-width: 0; }
.wk-d.is-tap { cursor: pointer; font: inherit; color: inherit; }
.wk-d.is-tap:active { transform: scale(.96); }
.wk-l { font-size: 11px; color: var(--text2); font-weight: 700; line-height: 1; white-space: nowrap; letter-spacing: 0; }
.wk-c { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; border: 1.5px solid rgba(255, 255, 255, .12); color: var(--muted); }
.wk-n { font-family: var(--f-num); font-size: 11px; color: var(--muted); line-height: 1; }
.wk-d.st-win .wk-c { background: var(--neon); border-color: var(--neon); color: #001a0a; box-shadow: 0 0 12px var(--glow); }
.wk-d.st-perfect .wk-c { background: var(--gold); border-color: var(--gold); color: #2a1c00; box-shadow: 0 0 12px rgba(255, 200, 61, .45); }
.wk-d.st-lost .wk-c { background: rgba(255, 59, 78, .14); border-color: rgba(255, 59, 78, .45); color: var(--red); }
.wk-d.st-empty .wk-c { background: rgba(255, 255, 255, .03); }
.wk-d.st-pre, .wk-d.st-future { opacity: .7; }
.wk-d.st-pre .wk-l, .wk-d.st-future .wk-l { color: var(--muted); }
.wk-d.is-today { border-color: var(--neon); background: rgba(0, 255, 102, .06); }
.wk-d.is-today .wk-l, .wk-d.is-today .wk-n { color: var(--neon); }
.wk-d.is-today.st-today .wk-c { border-color: var(--neon); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 255, 102, .35); } 50% { box-shadow: 0 0 0 6px rgba(0, 255, 102, 0); } }

/* progress */
.prog { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring circle { fill: none; stroke-width: 6; }
.ring .rg-bg { stroke: rgba(255, 255, 255, .07); }
.ring .rg-fg { stroke: var(--neon); stroke-linecap: round; transition: stroke-dashoffset .5s ease; filter: drop-shadow(0 0 5px var(--glow)); }
.ring.is-perfect .rg-fg { stroke: var(--gold); filter: drop-shadow(0 0 6px rgba(255, 200, 61, .5)); }
.ring-t { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-disp); font-weight: 700; font-size: 21px; }
.prog-tx { min-width: 0; }
.prog-tx > b { display: block; font-size: 18px; font-weight: 800; line-height: 1.35; }
.prog-tx > span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--neon2), var(--neon)); }

/* ---------------- task cards ---------------- */
.tc { background: var(--card); border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; margin-bottom: 12px; }
.tc-ph { position: relative; height: 84px; display: flex; align-items: flex-end; padding: 10px 14px; overflow: hidden; isolation: isolate; }
.tc-ph::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--grain); opacity: .32; mix-blend-mode: overlay; }
.tc-ph::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .1) 60%, rgba(255, 255, 255, .06) 100%); }
.g-med { background: var(--g-med); } .g-move { background: var(--g-move); } .g-money { background: var(--g-money); }
.g-learn { background: var(--g-learn); } .g-nofap { background: var(--g-nofap); }
.tc-emo { position: absolute; top: 50%; left: 14px; font-size: 44px; line-height: 1.15; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); transform: translateY(-58%) rotate(-6deg); }
.tc-tt { position: relative; max-width: 78%; }
.tc-tt h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; text-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.tc-tt p { margin: 3px 0 0; font-size: 14px; color: rgba(255, 255, 255, .86); line-height: 1.4; text-shadow: 0 1px 8px rgba(0, 0, 0, .55); }
.tc-x { padding: 10px 14px 0; }
.tc-x:empty { display: none; }
.tc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 14px 12px; }
.b-done, .b-skip {
  height: 50px; border-radius: var(--r2); font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease;
}
.b-done { background: var(--neon); color: #00140a; box-shadow: 0 8px 24px -10px var(--glow); }
.b-skip { border: 1.5px solid rgba(255, 59, 78, .55); color: var(--red); }
.b-done:active, .b-skip:active { transform: scale(.97); }
.b-done[aria-pressed="true"] { outline: 3px solid rgba(0, 255, 102, .3); outline-offset: 2px; }
.b-skip[aria-pressed="true"] { background: rgba(255, 59, 78, .14); }
.tc-edit-row { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 14px; margin-top: -4px; }
.lnk { color: var(--muted); font-size: 14px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; }
.lnk:active { color: var(--text); }
.lnk-red { color: var(--red); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line2);
  font-size: 14px; font-weight: 700; color: var(--text2); display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: rgba(0, 255, 102, .12); border-color: rgba(0, 255, 102, .55); color: var(--neon); }
.chip:active { transform: scale(.96); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; background: var(--bg1); border: 1px solid var(--line2); border-radius: 14px; }
.seg .chip { border-radius: 11px; justify-content: center; border-color: transparent; background: transparent; }
.seg .chip.on { background: var(--card2); border-color: rgba(0, 255, 102, .45); }
.tool {
  width: 100%; min-height: 48px; margin-top: 10px; border-radius: 14px; border: 1px dashed rgba(0, 255, 102, .35);
  background: rgba(0, 255, 102, .05); color: var(--neon); font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tool:active { background: rgba(0, 255, 102, .12); }
.tool .num { font-family: var(--f-num); font-weight: 400; opacity: .8; }
.lbl { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin: 12px 2px 6px; }
.lbl:first-child { margin-top: 0; }
.inp {
  width: 100%; height: 48px; border-radius: 14px; border: 1px solid var(--line2); background: var(--bg1);
  padding: 0 14px; font-size: 16px; outline: none; color: var(--text);
}
.inp:focus { border-color: rgba(0, 255, 102, .55); box-shadow: 0 0 0 3px rgba(0, 255, 102, .1); }
.inp::placeholder { color: #5f5f5f; }
.inp-row { display: flex; gap: 8px; }
.inp-row .inp { flex: 1; min-width: 0; }
.btn-sm { height: 48px; padding: 0 16px; border-radius: 14px; background: var(--neon); color: #00140a; font-weight: 800; flex: none; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: 13px; }
.meta b { color: var(--text); font-family: var(--f-disp); font-weight: 700; }
.timers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timers .chip { justify-content: center; border-style: dashed; border-color: rgba(0, 255, 102, .3); color: var(--neon); }
.nf-big { display: flex; align-items: baseline; gap: 10px; }
.nf-big b { font-family: var(--f-disp); font-size: 44px; line-height: 1; color: var(--gold); text-shadow: 0 0 22px rgba(255, 200, 61, .35); }
.nf-big span { font-size: 17px; font-weight: 800; }
.sos { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-top: 4px; color: var(--text2); font-size: 14px; text-decoration: none; }
.sos span { text-decoration: underline dashed rgba(255, 255, 255, .3); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.sos:hover span, .sos:focus-visible span { text-decoration-color: currentColor; }

/* compact resolved row */
.tr {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; padding: 10px 12px 10px 14px;
  background: var(--card); border: 1px solid var(--line2); border-radius: 18px; margin-bottom: 10px; min-height: 64px;
}
.tr:active { background: var(--card2); }
.tr-emo { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 22px; flex: none; position: relative; overflow: hidden; }
.tr.is-skip .tr-emo { filter: grayscale(.8) brightness(.6); }
.tr-tx { flex: 1; min-width: 0; }
.tr-tx > b { display: block; font-size: 16px; font-weight: 800; line-height: 1.3; }
.tr-tx > span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr.is-skip .tr-tx b { color: var(--text2); }
.stamp { font-family: var(--f-num); font-size: 11px; letter-spacing: .14em; padding: 6px 9px; border-radius: 9px; flex: none; direction: ltr; }
.st-done { color: var(--neon); background: rgba(0, 255, 102, .1); border: 1px solid rgba(0, 255, 102, .35); }
.st-skip { color: var(--red); background: rgba(255, 59, 78, .08); border: 1px solid rgba(255, 59, 78, .3); }

/* day summary + mood */
.sum { text-align: center; padding: 22px 16px 18px; }
.sum.is-perfect { border-color: rgba(255, 200, 61, .4); background: radial-gradient(120% 90% at 50% 0%, rgba(255, 200, 61, .16), transparent 60%), linear-gradient(180deg, var(--card2), var(--card)); }
.sum.is-win { border-color: rgba(0, 255, 102, .35); background: radial-gradient(120% 90% at 50% 0%, rgba(0, 255, 102, .12), transparent 60%), linear-gradient(180deg, var(--card2), var(--card)); }
.sum-big { font-family: var(--f-disp); font-weight: 700; font-size: 30px; letter-spacing: .04em; direction: ltr; }
.sum.is-perfect .sum-big { color: var(--gold); text-shadow: 0 0 22px rgba(255, 200, 61, .45); }
.sum.is-win .sum-big { color: var(--neon); text-shadow: 0 0 22px var(--glow); }
.sum.is-lost .sum-big { color: var(--text2); }
.sum p { margin: 6px 0 0; color: var(--text2); font-size: 15px; }
.mood { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.mood button { height: 56px; border-radius: 16px; background: var(--bg1); border: 1px solid var(--line2); font-size: 28px; transition: transform .12s; }
.mood button.on { border-color: var(--neon); background: rgba(0, 255, 102, .1); transform: scale(1.06); }
.mood.has-pick button:not(.on) { opacity: .45; }
.mood-q { font-size: 15px; font-weight: 800; margin: 16px 0 0; text-align: right; }

/* completion */
.fin { text-align: center; padding: 26px 18px 20px; border-color: rgba(255, 200, 61, .45); background: radial-gradient(100% 80% at 50% 0%, rgba(255, 200, 61, .2), transparent 65%), linear-gradient(180deg, var(--card2), var(--card)); }
.fin .trophy { font-size: 60px; line-height: 1; }
.fin h2 { margin: 10px 0 4px; font-size: 26px; font-weight: 900; }
.fin p { margin: 0 0 16px; color: var(--text2); }
.btn-main { width: 100%; height: 56px; border-radius: 18px; background: var(--neon); color: #00140a; font-weight: 900; font-size: 18px; box-shadow: 0 10px 30px -12px var(--glow); }
.btn-main:active { transform: scale(.98); }
.btn-gold { background: var(--gold); color: #261800; box-shadow: 0 10px 30px -12px rgba(255, 200, 61, .6); }
.btn-ghost { width: 100%; height: 52px; border-radius: 16px; border: 1px solid var(--line2); background: var(--card2); font-weight: 800; color: var(--text2); }
.btn-danger { width: 100%; height: 52px; border-radius: 16px; border: 1.5px solid rgba(255, 59, 78, .5); color: var(--red); font-weight: 800; }

/* ---------------- onboarding ---------------- */
.ob { min-height: calc(100vh - 40px); display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 20px 4px 30px; }
.ob-66 { font-family: var(--f-disp); font-weight: 700; font-size: 150px; line-height: .9; color: var(--neon); text-shadow: 0 0 50px var(--glow), 0 0 12px var(--glow); letter-spacing: -.05em; direction: ltr; }
.ob h1 { margin: 10px 0 6px; font-size: 30px; font-weight: 900; letter-spacing: -.01em; }
.ob .lead { color: var(--text2); margin: 0 auto 20px; max-width: 320px; }
.ob .chips { justify-content: center; margin-bottom: 26px; }
.ob .chip { background: var(--card); }
.ob-q { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 8px; direction: ltr; }
.stepper button { width: 56px; height: 56px; border-radius: 18px; background: var(--card2); border: 1px solid var(--line2); font-size: 26px; font-weight: 700; }
.stepper output { min-width: 96px; font-family: var(--f-disp); font-weight: 700; font-size: 54px; color: var(--gold); }
.ob .hint { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.ob-quick { display: flex; justify-content: center; gap: 8px; margin: 6px 0 4px; }
.ob-quick .chip { min-height: 44px; min-width: 44px; justify-content: center; font-family: var(--f-num); }

/* ---------------- journey ---------------- */
.grid66 { display: grid; grid-template-columns: repeat(11, 1fr); gap: 5px; direction: rtl; }
.cell {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .1); display: grid; place-items: center;
  font-family: var(--f-num); font-size: 10px; color: rgba(255, 255, 255, .35); min-width: 0; position: relative;
}
.cell::after { content: ""; position: absolute; inset: -3px; }   /* larger hit area without overlapping neighbours across the 5px gap */
.cell.st-win { background: var(--neon); border-color: var(--neon); color: #00260f; }
.cell.st-perfect { background: var(--gold); border-color: var(--gold); color: #3a2700; }
.cell.st-lost { background: rgba(255, 59, 78, .22); border-color: rgba(255, 59, 78, .4); color: rgba(255, 140, 150, .9); }
.cell.st-empty { background: #161616; border-color: #1f1f1f; color: #777; }
.cell.st-today { border: 2px solid var(--neon); color: var(--neon); animation: pulse 2s ease-in-out infinite; }
.cell.is-today { outline: 2px solid #fff; outline-offset: 1px; }
.cell.st-future { border-style: dashed; border-color: rgba(255, 255, 255, .09); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 5px; vertical-align: -1px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line2); border-radius: 20px; padding: 14px; min-width: 0; }
.tile .k { color: var(--muted); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.tile .v { font-family: var(--f-disp); font-weight: 700; font-size: 32px; line-height: 1.1; margin-top: 6px; direction: ltr; text-align: right; unicode-bidi: isolate; }
.tile .v small { font-size: 15px; color: var(--muted); font-weight: 500; }
.tile .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile .bar { margin-top: 8px; }
.tile.t-fire .v { color: #FF8A3D; } .tile.t-gold .v { color: var(--gold); } .tile.t-neon .v { color: var(--neon); } .tile.t-violet .v { color: var(--violet); }
.hb { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.hb:first-of-type { border-top: 0; padding-top: 0; }
.hb .tr-emo { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
.hb-m { flex: 1; min-width: 0; }
.hb-m b { font-size: 15px; font-weight: 800; }
.hb-m .bar { margin-top: 6px; }
.hb-r { text-align: left; flex: none; min-width: 56px; }
.hb-r b { display: block; font-family: var(--f-disp); font-size: 17px; }
.hb-r span { font-size: 12px; color: var(--muted); }
.tot { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tot > div { background: var(--bg1); border: 1px solid var(--line2); border-radius: 16px; padding: 12px; }
.tot > div:last-child { grid-column: 1 / -1; }
.tot .k { font-size: 13px; color: var(--muted); font-weight: 700; }
.tot .v { font-family: var(--f-disp); font-weight: 700; font-size: 24px; margin-top: 2px; direction: ltr; text-align: right; unicode-bidi: isolate; }
.tot .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.tot .v.nf3 { direction: rtl; display: flex; justify-content: space-between; gap: 8px; text-align: center; }
.tot .v.nf3 span { display: flex; flex-direction: column; align-items: center; flex: 1; }
.tot .v.nf3 small { font-family: var(--f-ar); font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.badge { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-disp); font-weight: 700; font-size: 16px; border: 1.5px dashed rgba(255, 255, 255, .2); color: #777; position: relative; }
.badge.on { border: 2px solid var(--neon); color: var(--neon); background: radial-gradient(circle, rgba(0, 255, 102, .18), rgba(0, 255, 102, .02)); box-shadow: 0 0 16px -4px var(--glow); }
.badge.on.b66 { border-color: var(--gold); color: var(--gold); background: radial-gradient(circle, rgba(255, 200, 61, .2), transparent); }
.badges-l { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 6px; text-align: center; font-family: var(--f-num); font-size: 9px; color: var(--muted); letter-spacing: .06em; }

/* ---------------- journal ---------------- */
.jl { display: flex; flex-direction: column; gap: 10px; }
.je { background: var(--card); border: 1px solid var(--line2); border-radius: 18px; padding: 14px; width: 100%; text-align: right; }
.je-h { display: flex; align-items: center; gap: 10px; }
.je-h .d { font-weight: 800; font-size: 15px; flex: 1; min-width: 0; }
.je-h .d small { color: var(--muted); font-weight: 500; font-family: var(--f-num); font-size: 11px; margin-right: 6px; letter-spacing: .1em; }
.je-h .mo { font-size: 22px; }
.tag { font-family: var(--f-num); font-size: 10px; letter-spacing: .12em; padding: 4px 7px; border-radius: 7px; direction: ltr; }
.tag-win { color: var(--neon); border: 1px solid rgba(0, 255, 102, .35); }
.tag-perfect { color: var(--gold); border: 1px solid rgba(255, 200, 61, .45); }
.tag-lost { color: var(--red); border: 1px solid rgba(255, 59, 78, .3); }
.je-l { margin-top: 8px; font-size: 14px; color: var(--text2); display: flex; gap: 8px; line-height: 1.45; }
.je-l .e { flex: none; }
.je-jn { margin-top: 8px; font-size: 14px; color: var(--text); background: var(--bg1); border-radius: 12px; padding: 8px 10px; border-right: 3px solid var(--neon); }
.toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 52px; padding: 0 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line2); margin-bottom: 12px; font-weight: 800; }
.toggle .sw { width: 46px; height: 28px; border-radius: 99px; background: #2a2a2a; position: relative; transition: background .2s; flex: none; }
.toggle .sw::after { content: ''; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on .sw { background: var(--neon); }
.toggle.on .sw::after { transform: translateX(-18px); }
.lesson { background: var(--card); border: 1px solid var(--line2); border-radius: 18px; padding: 14px 16px; border-right: 3px solid var(--blue); }
.lesson .q { font-size: 16px; font-weight: 700; line-height: 1.5; }
.lesson .w { color: var(--muted); font-size: 12px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 15px; }
.empty .e { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------------- tab bar ---------------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #050605;
  border-top: 1px solid var(--line2); padding-bottom: var(--sab);
}
#tabs .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: 66px; }
#tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; font-weight: 700; position: relative; }
#tabs button .ti { font-size: 22px; line-height: 1; filter: grayscale(1) brightness(.75); transition: filter .2s, transform .2s; }
#tabs button.on { color: var(--neon); }
#tabs button.on .ti { filter: none; transform: translateY(-1px); }
#tabs button.on::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--neon); box-shadow: 0 0 12px var(--glow); }

/* ---------------- sheets ---------------- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .66); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease both; }
#sheet.still .sheet, #sheet.still .sheet-bg { animation: none; }   /* same sheet re-rendered (chip / ✓ tap): don't re-slide */
.sheet {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #0b0c0b; border: 1px solid var(--line2); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(var(--sab) + 22px); animation: sheetUp .26s cubic-bezier(.2, .8, .2, 1) both;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: #333; margin: 0 auto 12px; }
.sheet h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.sheet .sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.sheet .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sheet .kind { color: var(--text2); font-size: 16px; line-height: 1.7; margin: 6px 0 14px; }
@keyframes sheetUp { from { transform: translateY(40%); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ds-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line2); }
.ds-row:first-of-type { border-top: 0; }
.ds-row .tr-emo { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
.ds-row .tr-tx { flex: 1; }
.ds-tg { display: flex; gap: 6px; flex: none; }
.ds-tg button { width: 46px; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); font-size: 18px; font-weight: 800; color: var(--muted); }
.ds-tg button.on-d { background: var(--neon); color: #00140a; border-color: var(--neon); }
.ds-tg button.on-s { background: rgba(255, 59, 78, .16); color: var(--red); border-color: rgba(255, 59, 78, .5); }
.set-g { margin-bottom: 18px; }
.set-g .lbl { margin-top: 0; }
.set-foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 18px; }

/* ---------------- overlays (timers, counter, celebrations) ---------------- */
.ov {
  position: fixed; inset: 0; z-index: 80; background: #020302; display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--sat) + 14px) 18px calc(var(--sab) + 22px); overflow: hidden; animation: fadeIn .25s ease both;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.ov-top { width: 100%; max-width: 480px; display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.ov-x { width: 48px; height: 48px; border-radius: 16px; background: rgba(255, 255, 255, .06); font-size: 22px; display: grid; place-items: center; }
.ov-mid { flex: 1; width: 100%; max-width: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.ov-bot { width: 100%; max-width: 480px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ov-bot.three { grid-template-columns: 1fr 1fr 1.4fr; }
.ov-btn { height: 58px; border-radius: 18px; background: rgba(255, 255, 255, .07); border: 1px solid var(--line2); font-weight: 800; font-size: 17px; }
.ov-btn.main { background: var(--neon); color: #00140a; border: 0; }
.ov-time { font-family: var(--f-disp); font-weight: 700; font-size: 64px; letter-spacing: .02em; direction: ltr; line-height: 1; }
.ov-cap { color: var(--text2); font-size: 15px; }
/* meditation */
.ov-med { background: radial-gradient(90% 60% at 50% 40%, rgba(139, 92, 246, .18), transparent 70%), #030205; }
.breath { position: relative; width: 250px; height: 250px; display: grid; place-items: center; margin-bottom: 26px; }
.breath .orb {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, rgba(167, 139, 250, .55), rgba(76, 29, 149, .35) 55%, rgba(30, 27, 75, .1) 72%);
  box-shadow: 0 0 60px rgba(139, 92, 246, .35), inset 0 0 40px rgba(255, 255, 255, .06);
  animation: breathe 11s ease-in-out infinite;
}
.breath .ring2 { position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(167, 139, 250, .25); }
.breath .w { position: relative; font-size: 22px; font-weight: 800; height: 34px; }
.breath .w span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.breath .w .in { animation: wIn 11s ease-in-out infinite; }
.breath .w .out { animation: wOut 11s ease-in-out infinite; }
@keyframes breathe { 0% { transform: scale(.55); } 50% { transform: scale(1); } 100% { transform: scale(.55); } }
@keyframes wIn { 0%, 44% { opacity: 1; } 50%, 94% { opacity: 0; } 100% { opacity: 1; } }
@keyframes wOut { 0%, 44% { opacity: 0; } 50%, 94% { opacity: 1; } 100% { opacity: 0; } }
.ov.paused .orb, .ov.paused .w span { animation-play-state: paused; }
.ov-prog { width: 100%; max-width: 300px; height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 8px; }
.ov-prog i { display: block; height: 100%; background: var(--violet); border-radius: inherit; transition: width .5s linear; }
.ov-end .big { font-size: 60px; }
/* focus timer */
.ov-focus { background: radial-gradient(90% 60% at 50% 35%, rgba(0, 255, 102, .1), transparent 70%), #020302; }
.fring { position: relative; width: 260px; height: 260px; margin-bottom: 18px; }
.fring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.fring circle { fill: none; stroke-width: 7; }
.fring .bg { stroke: rgba(255, 255, 255, .06); }
.fring .fg { stroke: var(--neon); stroke-linecap: round; filter: drop-shadow(0 0 8px var(--glow)); transition: stroke-dashoffset .5s linear; }
.fring .ov-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 58px; }
.f-task { font-size: 24px; font-weight: 800; line-height: 1.45; max-width: 340px; overflow-wrap: anywhere; }
.f-task.dim { color: var(--muted); font-size: 18px; font-weight: 700; }
/* pushups */
.ov-push { background: radial-gradient(80% 50% at 50% 45%, rgba(251, 146, 60, .16), transparent 70%), #050302; cursor: pointer; }
.ov-push.bump .p-count { transform: scale(1.08); }
.p-count { font-family: var(--f-disp); font-weight: 700; font-size: 170px; line-height: 1; color: #FF8A3D; text-shadow: 0 0 50px rgba(255, 138, 61, .45); transition: transform .08s ease; direction: ltr; }
.p-hint { color: var(--text2); font-size: 17px; font-weight: 700; }
.p-sets { color: var(--muted); font-size: 14px; min-height: 22px; }
.p-sets b { color: var(--text); font-family: var(--f-disp); }
.ov-push .ov-bot .ov-btn.main { background: #FF8A3D; color: #200b00; }
/* celebrate */
.ov-cel { background: rgba(0, 0, 0, .86); justify-content: center; cursor: pointer; }
.cel-t { font-family: var(--f-disp); font-weight: 700; font-size: 52px; line-height: 1; color: var(--gold); text-shadow: 0 0 40px rgba(255, 200, 61, .6); direction: ltr; letter-spacing: .02em; text-align: center; }
.cel-s { color: var(--text2); font-size: 18px; margin-top: 12px; text-align: center; }
.cel-badge { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; border: 3px solid var(--neon); box-shadow: 0 0 60px var(--glow), inset 0 0 30px rgba(0, 255, 102, .2); font-family: var(--f-disp); font-weight: 700; font-size: 64px; color: var(--neon); margin: 0 auto 18px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
#fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

/* toasts + offline pill */
#toasts { position: fixed; z-index: 95; left: 0; right: 0; top: calc(var(--sat) + 12px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 440px; background: #0d120e; border: 1px solid rgba(0, 255, 102, .35); color: var(--text); padding: 12px 16px; border-radius: 16px; font-weight: 700; font-size: 15px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .8); animation: toastIn .3s cubic-bezier(.2, 1.2, .4, 1) both; }
.toast.err { border-color: rgba(255, 59, 78, .5); }
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { transform: translateY(-14px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
#offline.srv { color: var(--red); border-color: rgba(255, 59, 78, .45); background: #1a0709; }
#offline { position: fixed; z-index: 40; bottom: calc(var(--sab) + 76px); left: 50%; transform: translateX(-50%); background: #1a1405; color: var(--gold); border: 1px solid rgba(255, 200, 61, .35); padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap; }

@media (max-width: 360px) {
  .hd-day b { font-size: 64px; }
  .tc-tt h3 { font-size: 18px; }
  .ob-66 { font-size: 120px; }
  .p-count { font-size: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .breath .orb { animation: breathe 11s ease-in-out infinite !important; }
  .breath .w .in { animation: wIn 11s ease-in-out infinite !important; }
  .breath .w .out { animation: wOut 11s ease-in-out infinite !important; }
  .ring .rg-fg { transition: none; }
}

/* money categories: 4 equal tiles, emoji over label */
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cats .chip { flex-direction: column; gap: 1px; height: 60px; padding: 0; justify-content: center; font-size: 13px; border-radius: 14px; min-width: 0; }
.cats .chip .ce { font-size: 20px; line-height: 1.1; }
.hd-day > div { text-align: right; }
