/* Be Still — calm, warm, readable. Light and dark themes share these tokens. */

:root {
  --bg: #F4F1EA;
  --surface: #FFFFFF;
  --surface-2: #EBE6DA;
  --text: #1E2A29;
  --muted: #5E6B69;
  --line: #DCD5C6;
  --accent: #3F7D73;
  --accent-text: #FFFFFF;
  --accent-soft: #DCEBE6;
  --sun: #E9C46A;
  --danger: #B3412E;
  --shadow: 0 1px 2px rgb(30 42 41 / .06), 0 4px 16px rgb(30 42 41 / .06);
  --radius: 18px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111A1B;
    --surface: #182425;
    --surface-2: #213031;
    --text: #E6ECE9;
    --muted: #9AABA7;
    --line: #2C3D3E;
    --accent: #7FC1B4;
    --accent-text: #0E1A1A;
    --accent-soft: #1F3A37;
    --sun: #E9C46A;
    --danger: #E88A76;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111A1B;
  --surface: #182425;
  --surface-2: #213031;
  --text: #E6ECE9;
  --muted: #9AABA7;
  --line: #2C3D3E;
  --accent: #7FC1B4;
  --accent-text: #0E1A1A;
  --accent-soft: #1F3A37;
  --sun: #E9C46A;
  --danger: #E88A76;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 650; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.mt { margin-top: 1rem; }
.full { width: 100%; }
.grow { flex: 1; min-width: 0; }
.danger-text { color: var(--danger); }
.switch-label { color: var(--text); font-size: 1rem; flex: 1; }
.stack { display: grid; gap: .6rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ─── Controls ─── */
label { font-size: .875rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; width: 100%;
}
textarea { min-height: 5.5rem; resize: vertical; }
.btn {
  font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: .75rem 1.2rem; cursor: pointer; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: 0; color: var(--accent); padding: .4rem; min-height: 0; }
.btn.danger { color: var(--danger); }
.btn.small { padding: .4rem .8rem; font-size: .875rem; min-height: 36px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  background: none; border: 0; color: var(--muted); width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; font-size: 1.1rem; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; font: inherit; font-size: .9rem; font-weight: 600; border: 0; background: none; color: var(--muted);
  padding: .5rem .6rem; border-radius: 999px; cursor: pointer; min-height: 38px;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ─── Layout ─── */
.view {
  max-width: 560px; margin: 0 auto; outline: none;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 96px);
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card.soft { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin-bottom: .4rem; }
.head { display: flex; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.head h1 { margin: 0; }

.tabs {
  position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); z-index: 5;
}
.tabs a {
  flex: 1; display: grid; justify-items: center; gap: 2px; color: var(--muted); text-decoration: none;
  font-size: .72rem; font-weight: 600; padding: 4px 0; border-radius: 12px;
}
.tabs svg { width: 24px; height: 24px; fill: currentColor; }
.tabs a[aria-current="page"] { color: var(--accent); }
.focus-mode .tabs { display: none; }
.focus-mode .view { padding-bottom: calc(env(safe-area-inset-bottom) + 32px); }

/* ─── Sign in ─── */
.signin { max-width: 400px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12vh) 16px 40px; text-align: center; }
.signin form { text-align: left; margin-top: 1.5rem; }
.signin-logo { border-radius: 18px; margin-bottom: .75rem; }
.msg { min-height: 1.5em; margin-top: 1rem; color: var(--muted); }
.msg.error { color: var(--danger); }

/* ─── Today ─── */
.greeting { font-size: 1.6rem; font-weight: 650; margin: .25rem 0 1rem; }
.recenter-btn {
  width: 100%; border: 0; border-radius: 26px; cursor: pointer; color: var(--accent-text);
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #1b3b37));
  padding: 1.4rem 1.2rem; text-align: left; font: inherit; margin-bottom: 1rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1rem;
}
.recenter-btn strong { display: block; font-size: 1.35rem; }
.recenter-btn span { opacity: .9; font-size: .95rem; }
.recenter-btn .orb { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--sun); opacity: .95; animation: orb 6s ease-in-out infinite; }
@keyframes orb { 50% { transform: scale(.82); opacity: .75; } }
.verse-text { font-family: var(--serif); font-size: 1.2rem; line-height: 1.55; margin-bottom: .5rem; }
.verse-ref { color: var(--muted); font-weight: 600; font-size: .9rem; }
.affirmation { font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; margin: .25rem 0 .5rem; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.quick a {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem;
  text-decoration: none; color: var(--text); font-weight: 600; box-shadow: var(--shadow);
}
.quick a small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; }
.stats { display: flex; gap: 1rem; }
.stats div { flex: 1; }
.stats b { display: block; font-size: 1.4rem; }

/* ─── Recenter flow ─── */
.flow-top { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.progress { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.flow-title { font-size: 1.5rem; font-weight: 650; margin-bottom: .35rem; }
.flow-actions { display: grid; gap: .6rem; margin-top: 1.5rem; }
.moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: 1rem 0; }
.moods button {
  font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 16px;
  padding: .7rem 0 .5rem; cursor: pointer; display: grid; justify-items: center; gap: .2rem; font-size: .72rem;
}
.moods button b { font-size: 1.6rem; line-height: 1; font-weight: 400; }
.moods button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }
.word-card { min-height: 9rem; display: grid; align-content: center; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: .5rem; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }
.done-mark { width: 84px; height: 84px; margin: 1rem auto; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; }
.done-mark svg { width: 44px; height: 44px; fill: var(--accent); }

/* ─── Checklist ─── */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.checklist label {
  display: flex; gap: .8rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: .85rem .9rem; color: var(--text); font-size: 1rem; cursor: pointer;
}
.checklist input { appearance: none; flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); padding: 0; margin: 0; display: grid; place-items: center; background: var(--surface); }
.checklist input:checked { background: var(--accent); border-color: var(--accent); }
.checklist input:checked::after { content: ""; width: 7px; height: 12px; border: solid var(--accent-text); border-width: 0 3px 3px 0; transform: translateY(-1px) rotate(45deg); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

/* ─── Breathing ─── */
.breath-stage { display: grid; justify-items: center; text-align: center; padding: .5rem 0 0; }
.breath-ring {
  --size: min(72vw, 290px);
  width: var(--size); height: var(--size); border-radius: 50%; position: relative; margin: 1rem 0 1.25rem;
  display: grid; place-items: center; background: radial-gradient(circle, var(--accent-soft) 0 58%, transparent 59%);
}
.breath-orb {
  position: absolute; inset: 18%; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, #fff), var(--accent));
  transform: scale(.55); transition-property: transform; transition-timing-function: ease-in-out;
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 40%, transparent);
}
.breath-ring.hold .breath-orb { background: radial-gradient(circle at 35% 30%, #fff6dc, var(--sun)); }
.breath-count { position: relative; font-size: 3rem; font-weight: 300; font-variant-numeric: tabular-nums; color: var(--accent-text); text-shadow: 0 1px 6px rgb(0 0 0 / .15); }
.breath-ring.small-count .breath-count { font-size: 2.2rem; }
.breath-cue { font-size: 1.35rem; font-weight: 600; min-height: 2rem; }
.breath-sub { color: var(--muted); min-height: 1.5rem; }
.safety { font-size: .85rem; color: var(--muted); background: var(--surface-2); border-radius: 14px; padding: .75rem .9rem; margin-top: 1rem; text-align: left; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
.holds { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; }
.holds span { background: var(--surface-2); border-radius: 99px; padding: .2rem .7rem; font-size: .9rem; font-variant-numeric: tabular-nums; }

/* ─── Lists / editing ─── */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: .4rem; align-items: center; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list .ref { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; }
.menu-list a, .menu-list button {
  display: flex; width: 100%; align-items: center; gap: .75rem; text-decoration: none; color: var(--text);
  background: none; border: 0; font: inherit; padding: .85rem 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left;
}
.menu-list > :last-child { border-bottom: 0; }
.menu-list .chev { margin-left: auto; color: var(--muted); }
.pill { display: inline-block; font-size: .75rem; font-weight: 650; padding: .1rem .55rem; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.on { background: var(--accent-soft); color: var(--accent); }
.days { display: flex; gap: .3rem; }
.days button {
  flex: 1; font: inherit; font-size: .82rem; font-weight: 650; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: 10px; padding: .5rem 0; cursor: pointer;
}
.days button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.switch { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; padding: 0; border: 0; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

.history-row { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.mood-change { font-size: 1.3rem; white-space: nowrap; }

/* ─── Banner / toast / sheet ─── */
.banner {
  position: sticky; top: 0; z-index: 10; display: flex; gap: .75rem; align-items: center; justify-content: center; flex-wrap: wrap;
  background: var(--accent); color: var(--accent-text); padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; font-size: .95rem;
}
.banner .btn { background: var(--accent-text); color: var(--accent); border: 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 12px; font-size: .95rem; z-index: 20;
  max-width: calc(100vw - 32px); box-shadow: 0 4px 20px rgb(0 0 0 / .2);
}
dialog {
  border: 0; border-radius: 22px; padding: 1.2rem 1.1rem; background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 32px)); box-shadow: 0 10px 40px rgb(0 0 0 / .25);
}
dialog::backdrop { background: rgb(10 20 20 / .45); }

@media (prefers-reduced-motion: reduce) {
  .recenter-btn .orb { animation: none; }
  .progress i { transition: none; }
}
.breath-ring.hold .breath-count { color: #3B2F10; text-shadow: none; }
.list.card { padding: .2rem 1rem; }
