/* Shared controls and secondary tools. Visual tokens live in workspace.css. */
@font-face { font-family: "DM Sans"; src: url("./fonts/DM-Sans-Variable.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("./fonts/Bricolage-Grotesque-Variable.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

/* ── base ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; background: var(--canvas); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.5; font-weight: 500;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "ss01" 1;
}
body[data-authed="true"] { padding-bottom: calc(var(--line-h) + env(safe-area-inset-bottom)); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: 0.55; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(640px, 100% - 40px); margin: 0 auto; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; line-height: 1; }
.serif em { font-style: normal; color: var(--accent); }
.kicker { margin: 0; font-size: 11.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.display { margin: 8px 0 0; font-size: clamp(40px, 9vw, 60px); line-height: 0.96; }
.lede { margin: 12px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.55; max-width: 48ch; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 12.5px; }
kbd { font: 700 11px var(--sans); background: var(--surface-2); color: var(--ink-2); border-radius: 6px; padding: 2px 6px; border: 1px solid var(--hair); }
h2.serif { font-size: 30px; margin: 0; }
h3 { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-size: 14.5px; background: var(--surface); color: var(--ink); border: 1px solid var(--hair-2); transition: transform 0.08s, background 0.15s, border-color 0.15s; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: var(--accent-dark); color: var(--accent-ink); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn.block { width: 100%; }
.link { color: var(--ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--hair-2); }
.link:hover { text-decoration-color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.actions .btn { flex: 1; }

.boot { min-height: 70dvh; display: grid; place-items: center; }
.boot-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 50% { transform: scale(1.4); opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.app > section.enter { animation: rise 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.habit.done .h-btn.play { display: none; }

/* ── forms ───────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field input, .field textarea, .field select { width: 100%; background: var(--surface-2); border: 1px solid var(--hair-2); border-radius: 14px; padding: 13px 15px; font-weight: 600; color: var(--ink); }
.field input:focus, .field textarea:focus { border-color: var(--ink); outline: none; }
.field textarea { resize: vertical; line-height: 1.5; }
.form { display: grid; gap: 16px; margin-top: 18px; }
.err { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 11px 14px; font-size: 13px; font-weight: 700; }
.seg { display: inline-grid; grid-auto-flow: column; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.seg button { padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chips-sel { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-sel .chip.on { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--hair); background: var(--surface-2); font-size: 20px; }
.emoji-grid button.on { border-color: var(--ink); background: var(--surface); box-shadow: 0 0 0 2px var(--ink) inset; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); position: relative; margin: 0; flex-shrink: 0; transition: 0.16s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: 0.16s; }
.switch input:checked { background: var(--good); }
.switch input:checked::after { left: 23px; }
.switch input:disabled { opacity: 0.45; }
.range { width: 100%; accent-color: var(--accent); margin: 10px 0 0; }
.range-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.range-row output { font-family: var(--serif); font-size: 22px; color: var(--ink); }

/* ── auth ────────────────────────────────────────────────────────────────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 30px 0; }
.auth-card { width: min(440px, 100% - 40px); }
.auth-card h1 { font-size: 48px; margin: 18px 0 6px; }
.auth-card .switch-line { margin-top: 18px; font-size: 14px; color: var(--ink-2); text-align: center; }

/* ── onboarding ──────────────────────────────────────────────────────────── */
.onboard { padding: 40px 0 20px; }
.goal { display: grid; gap: 10px; margin-top: 22px; }
.goal textarea { width: 100%; background: var(--surface); border: 1px solid var(--hair-2); border-radius: 22px; padding: 18px; font-size: 17px; font-weight: 600; resize: none; line-height: 1.45; font-family: var(--sans); }
.goal textarea:focus { outline: none; border-color: var(--ink); }
.goal .btn { justify-self: start; }
.or { margin: 30px 0 12px; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pack { text-align: left; background: var(--surface); border: 1px solid var(--hair); border-radius: 22px; padding: 18px; display: grid; gap: 4px; transition: 0.15s; }
.pack:hover { border-color: var(--ink); transform: translateY(-2px); }
.pack.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.pack-ic { font-size: 26px; }
.pack-t { font-weight: 800; font-size: 16px; margin-top: 4px; }
.pack-s { color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.pack.blank { background: transparent; border-style: dashed; }

/* ── home ("Now") ────────────────────────────────────────────────────────── */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 30px 0 22px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--serif); font-size: 22px; display: grid; place-items: center; flex-shrink: 0; transition: 0.15s; }
.avatar:hover { background: var(--accent-dark); }
.pulse { margin: 0 0 30px; }
.pulse-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.pulse-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); min-width: 8px; }
.pulse.complete .pulse-bar span { background: var(--good); }
.pulse-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; flex-wrap: wrap; }
.pulse-row b { color: var(--ink); font-weight: 800; }
.pulse-row .n { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--ink); margin-right: 4px; }
.streak { display: inline-flex; align-items: center; gap: 6px; background: var(--amber-soft); color: var(--amber); border: 1px solid transparent; border-radius: 999px; padding: 6px 12px; }
.streak.zero { background: var(--surface-2); color: var(--ink-3); }
.delta { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.delta.up { background: var(--good-soft); color: var(--good); }
.delta.down { background: var(--amber-soft); color: var(--amber); }

.block { margin-bottom: 26px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.block-head h2 { font-size: 30px; display: flex; align-items: center; gap: 10px; }
.now-tag { font: 800 10.5px var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 4px 8px; border-radius: 999px; }
.block-head small { color: var(--ink-3); font-size: 13px; font-weight: 700; }
.block.clear .block-head h2 { color: var(--ink-3); }

.habits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.habit { position: relative; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--hair); border-radius: 22px; padding: 6px 8px 6px 6px; transition: background 0.2s, border-color 0.2s, opacity 0.2s; }
.block.now .habit { box-shadow: var(--shadow); }
.habit:hover { border-color: var(--hair-2); }
.tick { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; color: #fff; background: transparent; transition: background 0.2s, border-color 0.2s, transform 0.1s; }
.tick:active { transform: scale(0.92); }
.tick svg { width: 22px; height: 22px; }
.tick path { stroke-dasharray: 26; stroke-dashoffset: 26; transition: stroke-dashoffset 0.28s ease 0.04s; }
.habit.done .tick { background: var(--good); border-color: var(--good); }
.habit.done .tick path { stroke-dashoffset: 0; }
.habit.done { background: transparent; border-color: transparent; opacity: 0.6; }
.h-body { text-align: left; display: grid; gap: 2px; min-width: 0; padding: 6px 0; }
.h-name { font-weight: 750; font-size: 16px; line-height: 1.25; letter-spacing: -0.01em; }
.habit.done .h-name { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-2); }
.h-meta { font-size: 12.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-actions { display: flex; align-items: center; gap: 2px; }
.h-btn { width: 36px; height: 36px; border-radius: 50%; color: var(--ink-3); font-weight: 800; font-size: 15px; display: grid; place-items: center; transition: 0.15s; }
.h-btn:hover { background: var(--surface-2); color: var(--ink); }
.h-btn.play { color: var(--accent); }
.h-key { position: absolute; left: -30px; top: 50%; transform: translateY(-50%); opacity: 0; transition: 0.2s; }
.habits:hover .h-key { opacity: 1; }
@media (hover: none), (max-width: 760px) { .h-key { display: none; } }
.xp-float { position: absolute; right: 90px; top: -6px; font: 800 12px var(--sans); color: var(--good); animation: floatUp 0.9s ease-out forwards; pointer-events: none; }
@keyframes floatUp { from { opacity: 0; transform: translateY(6px); } 30% { opacity: 1; } to { opacity: 0; transform: translateY(-22px); } }

.alldone { background: var(--good-soft); color: var(--ink); border: 1px solid var(--good); border-radius: var(--r-lg); padding: 26px; margin-bottom: 26px; }
.alldone h2 { font-size: 40px; }
.alldone h2 em { color: var(--good); }
.alldone p { color: var(--ink-2); margin: 8px 0 0; }
.alldone .actions .btn { background: var(--surface); color: var(--ink); border-color: var(--hair-2); }
.alldone .actions .btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.empty { text-align: center; padding: 40px 20px; border: 1px dashed var(--hair-2); border-radius: var(--r-lg); color: var(--ink-2); }
.empty h2 { font-size: 34px; color: var(--ink); }

.duo { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 26px; text-align: left; width: 100%; }
.duo-head { display: flex; justify-content: space-between; align-items: center; }
.duo-row { display: grid; grid-template-columns: 64px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.duo-row b { text-align: right; }
.duo-row.them { color: var(--ink-2); }
.duo-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.duo-bar span { display: block; height: 100%; background: var(--ink); border-radius: inherit; min-width: 4px; transition: width 0.5s; }
.duo-row.them .duo-bar span { background: var(--accent); }
.foot-hint { text-align: center; margin: 10px 0 0; }

/* ── history ─────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.stat { background: var(--surface); border: 1px solid var(--hair); border-radius: 20px; padding: 16px 14px; }
.stat-n { font-family: var(--serif); font-size: 36px; line-height: 1; }
.stat-n small { font-family: var(--sans); font-size: 13px; color: var(--ink-3); font-weight: 700; margin-left: 2px; }
.stat-l { color: var(--ink-3); font-size: 12px; font-weight: 700; margin-top: 6px; }
.heat { overflow-x: auto; padding-bottom: 4px; }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; width: max-content; }
.heat-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); }
.heat-cell.l1 { background: color-mix(in srgb, var(--good) 30%, var(--surface-2)); }
.heat-cell.l2 { background: color-mix(in srgb, var(--good) 55%, var(--surface-2)); }
.heat-cell.l3 { background: color-mix(in srgb, var(--good) 80%, var(--surface-2)); }
.heat-cell.l4 { background: var(--good); }
.heat-cell.future { background: transparent; border: 1px dashed var(--hair); }
.heat-cell.today { box-shadow: 0 0 0 2px var(--accent); }
.heat-months { display: flex; gap: 0; width: max-content; font-size: 11px; color: var(--ink-3); font-weight: 700; margin-bottom: 6px; }
.heat-months span { width: 60px; }
.legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; font-size: 11px; color: var(--ink-3); }
.wk { display: grid; gap: 6px; margin-top: 14px; }
.wk-row { display: grid; grid-template-columns: 36px 1fr 40px; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.wk-bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.wk-bar span { display: block; height: 100%; background: var(--ink); border-radius: inherit; }
.wk-row.best .wk-bar span { background: var(--accent); }
.hrate { display: grid; gap: 8px; margin-top: 14px; }
.hrate-row { display: grid; grid-template-columns: 26px 1fr 48px; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.hrate-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrate-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.hrate-bar span { display: block; height: 100%; background: var(--good); border-radius: inherit; }
.hrate-row .pc { text-align: right; color: var(--ink-2); }
.sec { margin-top: 26px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-head h2 { font-size: 28px; }

.review { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg); padding: 22px; }
.md h3, .md h4 { margin: 14px 0 4px; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.md h3:first-child, .md h4:first-child { margin-top: 0; }
.md h2 { font-family: var(--serif); font-size: 26px; margin: 0 0 6px; }
.md p { margin: 4px 0 10px; line-height: 1.55; }
.md ul { margin: 4px 0 10px; padding-left: 18px; }
.md li { margin: 3px 0; line-height: 1.5; }
.md strong { font-weight: 800; }
.md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--hair); margin: 12px 0; }

/* ── you ─────────────────────────────────────────────────────────────────── */
.you-list { display: grid; gap: 8px; margin-top: 12px; }
.you-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border: 1px solid var(--hair); border-radius: 20px; padding: 16px 18px; }
.you-row .t { font-weight: 800; }
.you-row .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.you-row .r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.you-row select { background: var(--surface-2); border: 1px solid var(--hair-2); border-radius: 10px; padding: 8px 10px; font-weight: 700; }
.you-row.col { display: grid; }
.exports { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ── The Line ────────────────────────────────────────────────────────────── */
.line { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.line[hidden] { display: none; }
.line.raised { z-index: 90; }
.line-inner { width: min(640px, 100%); margin: 0 auto; pointer-events: auto; }
.line-panel { background: var(--surface); border: 1px solid var(--hair); border-radius: 24px; box-shadow: var(--shadow-lg); margin-bottom: 10px; padding: 8px; max-height: 46dvh; overflow: auto; animation: rise 0.18s ease both; }
.line-panel[hidden] { display: none; }
.line-bar { display: flex; align-items: center; gap: 6px; background: var(--bar); color: var(--bar-ink); border: 1px solid var(--hair-2); border-radius: 999px; padding: 6px; box-shadow: 0 10px 30px rgba(12, 21, 18, 0.14); }
.line-bar input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: inherit; font-weight: 650; font-size: 15px; padding: 10px 6px; }
.line-bar input::placeholder { color: inherit; opacity: 0.55; }
.line-mark, .line-send { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; transition: 0.15s; }
.line-mark { background: var(--accent); color: var(--accent-ink); }
.line-mark svg, .line-send svg { width: 20px; height: 20px; }
.line-send { background: var(--surface-2); color: var(--ink-2); }
.line-send:hover { background: var(--accent); color: var(--accent-ink); }
.line.coach .line-mark { background: var(--good); }
.li { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 16px; transition: background 0.1s; }
.li.sel, .li:hover { background: var(--surface-2); }
.li-ic { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.li.coach .li-ic { background: var(--accent); color: var(--accent-ink); }
.li-tx { display: grid; min-width: 0; }
.li-t { font-weight: 750; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-s { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.li kbd { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; }
.chip { border: 1px solid var(--hair-2); background: var(--surface-2); border-radius: 999px; padding: 9px 13px; font-size: 13px; font-weight: 700; transition: 0.12s; }
.chip:hover { border-color: var(--ink); }
.chip.ai { border-color: var(--accent); color: var(--accent); }
.nav-row { display: flex; gap: 4px; padding: 4px 6px 6px; border-top: 1px solid var(--hair); margin-top: 4px; }
.nav-row button { flex: 1; padding: 10px; border-radius: 12px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); }
.nav-row button:hover, .nav-row button.on { background: var(--surface-2); color: var(--ink); }

/* ── sheet ───────────────────────────────────────────────────────────────── */
.sheet { position: fixed; inset: 0; z-index: 80; background: rgba(12, 21, 18, 0.42); backdrop-filter: blur(8px); display: flex; align-items: flex-end; justify-content: center; padding: 10px; }
.sheet[hidden] { display: none; }
.sheet-card { width: min(560px, 100%); max-height: 88dvh; overflow: auto; background: var(--surface); border-radius: 30px; padding: 24px 22px 26px; position: relative; box-shadow: var(--shadow-lg); animation: sheetUp 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-x { position: absolute; right: 14px; top: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); font-size: 22px; display: grid; place-items: center; z-index: 2; }
.sheet-h { margin-bottom: 6px; padding-right: 40px; }
.sheet-h h2 { font-size: 34px; margin-top: 6px; }
.sheet-card.thread { height: 86dvh; display: flex; flex-direction: column; padding-bottom: calc(var(--line-h) + 6px); }
.thread-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 2px; }
.bub { max-width: 86%; padding: 12px 15px; border-radius: 20px; font-size: 14.5px; line-height: 1.5; }
.bub.me { align-self: flex-end; background: var(--ink); color: var(--canvas); border-bottom-right-radius: 6px; }
.bub.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--hair); border-bottom-left-radius: 6px; }
.bub.typing { color: var(--ink-3); letter-spacing: 3px; }
.thread-habits { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.thread-habits span { font-size: 12px; font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: 5px 10px; }
@media (min-width: 720px) { .sheet { align-items: center; } .sheet-card.thread { height: min(760px, 88dvh); } }

.focus { text-align: center; padding: 10px 0; }
.focus h2 { font-size: 32px; margin: 6px 0 20px; }
.focus-ring { width: 220px; height: 220px; margin: 0 auto; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--surface-2) 0); display: grid; place-items: center; }
.focus-ring::before { content: ""; position: absolute; width: 192px; height: 192px; border-radius: 50%; background: var(--surface); }
.focus-ring { position: relative; }
.focus-time { position: relative; font-family: var(--serif); font-size: 62px; }
.focus p { color: var(--ink-2); margin: 14px 0 0; }

.invite { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.code { font: 800 24px ui-monospace, Menlo, Consolas, monospace; letter-spacing: 5px; background: var(--surface-2); border: 1px dashed var(--hair-2); border-radius: 14px; padding: 10px 16px; user-select: all; }
.join { display: flex; gap: 8px; margin-top: 14px; }
.join input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--hair-2); border-radius: 999px; padding: 12px 16px; font-weight: 700; text-transform: uppercase; }
.join input::placeholder { text-transform: none; }
.vs { display: grid; gap: 10px; margin-top: 14px; }
.vs-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.vs-row .l { font-size: 12.5px; font-weight: 800; color: var(--ink-3); }
.vs-bars { display: grid; gap: 4px; }
.vs-bar { display: grid; grid-template-columns: 1fr 52px; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; }
.vs-bar i { display: block; height: 10px; border-radius: 99px; background: var(--ink); min-width: 6px; }
.vs-bar.them i { background: var(--accent); }
.vs-bar b { text-align: right; }

.toast { position: fixed; left: 50%; bottom: calc(var(--line-h) + 12px + env(safe-area-inset-bottom)); z-index: 120; transform: translate(-50%, 12px); opacity: 0; background: var(--ink); color: var(--canvas); border-radius: 999px; padding: 11px 18px; font-size: 13.5px; font-weight: 700; pointer-events: none; transition: 0.2s; box-shadow: var(--shadow-lg); max-width: min(560px, 90vw); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.big { background: var(--accent); color: var(--accent-ink); font-size: 15px; padding: 14px 22px; }
body:not([data-authed="true"]) .toast { bottom: 24px; }
.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 200; }

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lp-hero { grid-template-columns: 1fr; gap: 30px; padding: 30px 0 50px; }
  .lp-grid3 { grid-template-columns: 1fr; }
  .lp-feats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap { width: min(640px, 100% - 32px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .packs { grid-template-columns: 1fr; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .top { padding-top: 22px; }
  .pulse-row { font-size: 13px; }
  .block-head h2 { font-size: 26px; }
  .lp-nav-actions .btn.ghost { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================================
   v4 — gentle days, tracked numbers, staged habits, questionnaires,
   the worry window, the doctor sheet, support
   ============================================================================ */

/* ── gentle day ──────────────────────────────────────────────────────────── */
.pulse.gentle .pulse-bar span { background: var(--ink-3); }
.gentle-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--hair); border-left: 3px solid var(--ink-3);
  border-radius: 18px; padding: 14px 16px; margin-bottom: 22px; font-size: 14px; line-height: 1.5; }
.gentle-note strong { font-weight: 800; }
.hard-day { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 14px; font-size: 13.5px; color: var(--ink-3); }

/* ── essentials + staged habits ──────────────────────────────────────────── */
.h-name .ess { font-style: normal; color: var(--accent); font-size: 11px; margin-left: 6px; vertical-align: 2px; }
.block.coming { opacity: 0.72; }
.habit.ahead { background: transparent; border-style: dashed; }
.tick.ahead { border: 2px dashed var(--line, var(--hair-2)); border-color: var(--hair-2); background: transparent;
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; opacity: 0.7; }
.habit.ahead .h-name { color: var(--ink-2); }

/* ── numbers, not just checkboxes ────────────────────────────────────────── */
.tick.val { font-family: var(--serif); font-size: 17px; color: var(--ink); border-color: var(--hair-2); line-height: 1; }
.habit.done .tick.val { color: #fff; border-color: var(--good); background: var(--good); }
.numpad { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 12px; margin: 18px 0 6px; }
.np-btn { height: 64px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--hair-2); font-size: 30px; font-weight: 300; line-height: 1; color: var(--ink); }
.np-btn:hover { border-color: var(--ink); }
.np-val { text-align: center; }
.np-val strong { display: block; font-family: var(--serif); font-size: 56px; line-height: 1; }
.np-val small { display: block; margin-top: 4px; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.np-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.np-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.4s; }

/* ── questionnaires ──────────────────────────────────────────────────────── */
.q-progress { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 12px 0 4px; }
.q-progress span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.qlist { list-style: none; counter-reset: q; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.q { padding: 14px 0; border-top: 1px solid var(--hair); }
.q:first-child { border-top: 0; }
.q-t { margin: 0 0 10px; font-size: 14.5px; font-weight: 650; line-height: 1.45; }
.q-t::before { counter-increment: q; content: counter(q) ". "; color: var(--ink-3); font-weight: 800; }
.q-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.q-o { padding: 9px 6px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--surface-2); font-size: 11.5px; font-weight: 700; line-height: 1.25; color: var(--ink-2); }
.q-o:hover { border-color: var(--ink); }
.q-o.on { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.q.ok .q-t { color: var(--ink-2); }
.rule { border: 0; border-top: 1px solid var(--hair); margin: 22px 0; }

/* score trend */
.ms-row { padding: 12px 0; border-top: 1px solid var(--hair); }
.ms-row:first-of-type { border-top: 0; }
.ms-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ms-bars { display: flex; align-items: flex-end; gap: 5px; height: 54px; }
.ms-bar { flex: 1; max-width: 26px; height: 100%; display: flex; align-items: flex-end; }
.ms-bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 2px 2px; min-height: 4px; }

/* ── support ─────────────────────────────────────────────────────────────── */
.support { margin-top: 10px; }
.support-lead { margin: 0 0 10px; font-weight: 700; }
.support-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.support-list li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 13px 15px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--hair); }
.support-list li:first-child { border-color: var(--danger); }
.sn { font-family: var(--serif); font-size: 24px; line-height: 1.1; color: var(--ink); text-decoration: none; }
a.sn:hover { color: var(--accent); }
.st { font-size: 13.5px; font-weight: 750; }
.ss { font-size: 12px; color: var(--ink-3); }
.you-row.urgent { border-color: var(--accent); }

/* ── worry window ────────────────────────────────────────────────────────── */
.notes { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.notes.dim { opacity: 0.55; }
.note { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 16px; }
.note .nb { font-size: 14px; line-height: 1.45; }
.note .nd { grid-column: 1; font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.note .na { grid-row: 1 / span 2; display: flex; gap: 2px; }
.notes.dim .nb { text-decoration: line-through; }

/* ── doctor sheet ────────────────────────────────────────────────────────── */
.handout { background: var(--surface-2); border: 1px solid var(--hair); border-radius: 20px; padding: 18px 20px; max-height: 46dvh; overflow: auto; font-size: 13.5px; }
.handout h2 { font-size: 22px; }
.handout ul { padding-left: 18px; }

/* ── edit-sheet extras ───────────────────────────────────────────────────── */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg.wrap-seg { display: flex; flex-wrap: wrap; grid-auto-flow: unset; }
.ess-row { padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--hair); border-radius: 16px; }
.ess-row strong { display: block; font-size: 14px; }
.ess-row small { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.field .hint { font-weight: 500; margin: 2px 0 0; }

@media (max-width: 640px) {
  .q-opts { grid-template-columns: repeat(2, 1fr); }
  .numpad { grid-template-columns: 56px 1fr 56px; }
  .np-val strong { font-size: 46px; }
  .two { grid-template-columns: 1fr; }
}

/* Printing is for the doctor sheet: the page around it disappears. */
@media print {
  .line, .toast, .sheet-x, .actions, .app { display: none !important; }
  .sheet { position: static; background: none; backdrop-filter: none; padding: 0; display: block; }
  .sheet-card { box-shadow: none; max-height: none; width: 100%; padding: 0; animation: none; }
  .handout { max-height: none; overflow: visible; border: 0; padding: 0; background: none; }
  body { background: #fff; }
}
