/* One Thing — calm, minimal, big type, big tap targets.
   Colors: maroon #7D0204 (primary), off-white #FAF7F5 (background), green #2F7D5B (done).
   There is deliberately no red "missed" color anywhere. */

:root {
  --maroon: #7D0204;      /* buttons, brand */
  --accent: #7D0204;      /* accent text */
  --on-maroon: #FFFFFF;
  --bg: #FAF7F5;
  --surface: #FFFFFF;
  --surface-2: #F3EDEA;
  --text: #241B1B;
  --muted: #6E6261;
  --line: #E7DFDB;
  --green: #2F7D5B;
  --green-soft: #E2F0E9;
  --soft: #F5E8E7;
  --shadow: 0 1px 2px rgba(60, 20, 20, .05), 0 8px 24px rgba(60, 20, 20, .06);
  --radius: 22px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

/* Dark mode: follows the phone unless Settings picks Light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --maroon: #9E1C1F; --accent: #F2A0A1; --on-maroon: #FFFFFF;
    --bg: #141011; --surface: #1E1718; --surface-2: #2A2122; --text: #F4EDEA; --muted: #B4A8A6;
    --line: #34292A; --green: #5CB68C; --green-soft: #1C3328; --soft: #2C1B1C;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --maroon: #9E1C1F; --accent: #F2A0A1; --on-maroon: #FFFFFF;
  --bg: #141011; --surface: #1E1718; --surface-2: #2A2122; --text: #F4EDEA; --muted: #B4A8A6;
  --line: #34292A; --green: #5CB68C; --green-soft: #1C3328; --soft: #2C1B1C;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 0 0 10px; }
h3 { font-size: 18px; margin: 18px 0 8px; }
p { margin: 0 0 12px; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) calc(var(--safe-r) + 20px) calc(var(--safe-b) + 104px) calc(var(--safe-l) + 20px);
  min-height: 100vh;
  min-height: 100dvh;
}
body.full #app { padding-bottom: calc(var(--safe-b) + 32px); }
body.full #tabs { display: none; }

.screen { display: flex; flex-direction: column; gap: 14px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }
.right { text-align: right; display: block; }
.block { display: block; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

/* ---- top bar ---- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.top h1 { margin: 0; flex: 1; }
.top-date { color: var(--muted); font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { background: var(--soft); color: var(--accent); border-radius: 99px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.icon-btn { min-width: 48px; min-height: 48px; border: 0; background: transparent; font-size: 30px; color: var(--accent); border-radius: 14px; }

/* ---- buttons ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 12px 20px; width: 100%;
  border-radius: 16px; border: 1.5px solid transparent;
  font-weight: 600; font-size: 18px; text-align: center;
  transition: transform .08s ease, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; }
.btn.primary { background: var(--maroon); color: var(--on-maroon); }
.btn.done { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.small { min-height: 44px; width: auto; padding: 8px 14px; font-size: 15px; border-radius: 14px; }
.link { background: none; border: 0; color: var(--accent); min-height: 44px; font-weight: 600; font-size: 16px; padding: 8px; }
.actions { display: flex; gap: 10px; }
.actions > * { flex: 1; }

.chip { min-height: 44px; padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-size: 16px; }
.chip.on { background: var(--maroon); color: var(--on-maroon); border-color: var(--maroon); }
.chip.big { min-height: 52px; font-size: 18px; padding: 10px 20px; }
.chips, .helpers, .day-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.helpers { justify-content: center; }

.choice { text-align: left; width: 100%; min-height: 54px; padding: 12px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); font-size: 17px; }
.choice.on { border-color: var(--maroon); background: var(--soft); }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---- cards ---- */
.card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.focus { display: flex; flex-direction: column; gap: 14px; padding: 26px 22px; }
.soft-card { background: var(--soft); border: 0; box-shadow: none; }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.block-title { font-size: 32px; margin: 0; }
.block-title.big { font-size: 30px; }
.first-step { font-size: 19px; margin: 0; }
.then { color: var(--muted); text-align: center; min-height: 26px; margin: 4px 0 0; }

/* ---- ring timer ---- */
.ring-wrap { display: flex; justify-content: center; padding: 6px 0; }
.ring { position: relative; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--surface-2); }
.ring-prog { fill: none; stroke: var(--maroon); stroke-linecap: round; transition: stroke-dasharray 1s linear; }
.ring.soft .ring-prog { stroke: var(--green); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label strong { font-size: 44px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-label span { color: var(--muted); font-size: 15px; margin-top: 4px; }

/* ---- landing (after Done) ---- */
.landing { align-items: center; text-align: center; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; font-size: 34px; display: grid; place-items: center; margin: 0 auto; animation: pop .45s ease; }
.landing-steps { font-size: 20px; margin: 0; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---- capture button ---- */
.fab {
  position: fixed; right: calc(var(--safe-r) + 20px); bottom: calc(var(--safe-b) + 88px);
  width: 62px; height: 62px; border-radius: 50%; border: 0;
  background: var(--maroon); color: var(--on-maroon); font-size: 34px; line-height: 1;
  box-shadow: 0 6px 20px rgba(125, 2, 4, .3); z-index: 5;
}

/* ---- tabs ---- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  padding: 6px calc(var(--safe-r) + 6px) calc(var(--safe-b) + 6px) calc(var(--safe-l) + 6px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
#tabs button { flex: 1; min-height: 56px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#tabs button.on { color: var(--accent); }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
#tabs button.on .tab-dot { background: var(--accent); }

#testbar { position: sticky; top: 0; z-index: 20; background: #5B4A00; color: #fff; font-size: 13px; text-align: center; padding: calc(var(--safe-t) + 4px) 12px 4px; }

/* ---- segmented control ---- */
.seg { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; gap: 4px; }
.seg-btn { flex: 1; min-height: 46px; border: 0; border-radius: 12px; background: transparent; font-weight: 600; font-size: 16px; color: var(--muted); }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---- lists ---- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: stretch; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 6px 6px 8px; }
.row.current { border-color: var(--maroon); box-shadow: inset 4px 0 0 var(--maroon); }
.row.done .row-title { color: var(--muted); }
.row.past { opacity: .62; }
.row-body { flex: 1; text-align: left; border: 0; background: none; padding: 8px 6px; display: flex; flex-direction: column; gap: 2px; min-height: 56px; justify-content: center; }
.row.static .row-body { cursor: default; }
.row-time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-title { font-size: 18px; font-weight: 600; }
.row-meta { font-size: 14px; color: var(--muted); }
.check { flex: 0 0 52px; min-height: 52px; align-self: center; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); font-size: 24px; color: #fff; transition: background .2s, transform .1s; }
.check.on { background: var(--green); border-color: var(--green); }
.check.pressing { transform: scale(.92); }
.parked { margin: 0; padding-left: 20px; color: var(--muted); }
.parked li { margin-bottom: 6px; }
.plain { margin: 0; padding-left: 20px; }
.plain li { margin-bottom: 6px; }

.note { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; font-size: 16px; color: var(--text); margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }
.section { margin-top: 18px; }

/* ---- week ---- */
.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-chip { min-height: 60px; border-radius: 14px; border: 1.5px solid transparent; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); padding: 4px 0; }
.day-chip strong { font-size: 19px; color: var(--text); }
.day-chip.today { border-color: var(--line); }
.day-chip.on { background: var(--maroon); color: var(--on-maroon); }
.day-chip.on strong { color: var(--on-maroon); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.day-head h2 { margin: 0; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 15px; font-weight: 600; color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); }
.input { width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); font-size: 17px; }
.input.big { font-size: 30px; text-align: center; }
textarea.input { resize: vertical; min-height: 84px; }
.input:focus, .btn:focus-visible, .chip:focus-visible, .check:focus-visible { outline: 3px solid color-mix(in srgb, var(--maroon) 40%, transparent); outline-offset: 2px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; }
.toggle input { width: 26px; height: 26px; accent-color: var(--maroon); }
.form-msg p { background: var(--soft); border-radius: 14px; padding: 12px 14px; margin: 0 0 8px; }
.form-msg .btn { margin-bottom: 6px; width: 100%; }
.file { font-size: 15px; }
details.tracking { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 16px; }
details.tracking summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }

/* ---- score ---- */
.score-card { text-align: center; }
.score-pct { font-size: 64px; font-weight: 700; color: var(--accent); line-height: 1.1; }
.score-line { font-size: 20px; margin: 4px 0 0; }
.kpis { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kpi { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 10px 16px; }
.kpi-main { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: baseline; }
.kpi-name { font-weight: 600; }
.kpi-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.bar { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--green); border-radius: 99px; }
.pm { width: 52px; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); font-size: 26px; }
.kpi-edit { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kpi-edit .link { align-self: flex-start; padding-left: 0; }
.lifetime p { font-size: 18px; }

/* ---- calm screens: reset, morning, meditate ---- */
.reset-step { display: flex; flex-direction: column; gap: 16px; align-items: stretch; text-align: center; padding-top: 12px; }
.breath-wrap { display: grid; place-items: center; height: 280px; }
.breath { width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--maroon) 30%, transparent), color-mix(in srgb, var(--maroon) 10%, transparent)); transform: scale(.5); transition: transform 4s ease-in-out; }
.breath.big { transform: scale(1); }
.breath-label { font-size: 26px; font-weight: 600; margin: 0; }
.word-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.reset-line { font-size: 21px; font-weight: 600; margin: 8px 0; }
.glow { width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--green) 55%, transparent), transparent 70%); animation: glow 5s ease-in-out infinite; }
@keyframes glow { 0%, 100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1.05); opacity: 1; } }
.hold-text { font-size: 22px; font-weight: 600; }
.guidance { font-size: 17px; text-align: center; color: var(--muted); font-style: italic; }
.picture { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo { width: 96px; height: 96px; border-radius: 24px; margin: 24px auto 4px; background: url("../assets/icons/icon-192.png") center / cover; }

/* ---- review ---- */
.review-timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 15px; text-align: right; }
.steps { display: flex; gap: 4px; flex-wrap: wrap; }
.step-dot { font-size: 12px; padding: 4px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.step-dot.on { background: var(--maroon); color: var(--on-maroon); }
.step-dot.past { background: var(--green-soft); color: var(--green); }
.about { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- sheet, toast, banner ---- */
.sheet-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20, 10, 10, 0); display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.sheet-overlay.show { background: rgba(20, 10, 10, .35); }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 10px calc(var(--safe-r) + 20px) calc(var(--safe-b) + 20px) calc(var(--safe-l) + 20px);
  display: flex; flex-direction: column; gap: 12px;
  transform: translateY(100%); transition: transform .22s ease;
}
.sheet-overlay.show .sheet { transform: translateY(0); }
.grabber { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 6px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 96px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 16px;
  font-size: 16px; max-width: calc(100vw - 40px); width: max-content; text-align: center;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#banner {
  position: fixed; left: 12px; right: 12px; top: calc(var(--safe-t) + 10px); z-index: 60;
  max-width: 536px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
  transform: translateY(-140%); transition: transform .3s ease;
}
#banner.show { transform: translateY(0); }
#banner span { color: var(--muted); font-size: 15px; }

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