/* Layout: phone-first, one column; sticky top bar, bottom tab bar, record button pinned above tabs; overlays are full-height sheets */
:root{
  --bg:#f3f1ed; --surface:#ffffff; --sunk:#e9e6e0; --line:#d9d4cc;
  --fg:#1a1a1a; --muted:#6b6763; --accent:#8b2e1f; --accent-ink:#ffffff; --accent-soft:#f3e3df;
  --good:#2f6b3f; --good-soft:#e1eee3; --bad:#a3271f; --bad-soft:#f8e1de; --wait:#6b6763; --wait-soft:#ebe8e3;
  --f-display:"Barlow Condensed","Arial Narrow",sans-serif;
  --f-body:"Barlow",system-ui,sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  --r:12px;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#121110; --surface:#1c1a19; --sunk:#262321; --line:#38332f;
  --fg:#eeebe7; --muted:#a39d97; --accent:#e0705b; --accent-ink:#1a0d0a; --accent-soft:#3a201b;
  --good:#7cc88f; --good-soft:#1d2e22; --bad:#f08a80; --bad-soft:#3b1e1b; --wait:#a39d97; --wait-soft:#2a2724;
  color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#121110; --surface:#1c1a19; --sunk:#262321; --line:#38332f;
  --fg:#eeebe7; --muted:#a39d97; --accent:#e0705b; --accent-ink:#1a0d0a; --accent-soft:#3a201b;
  --good:#7cc88f; --good-soft:#1d2e22; --bad:#f08a80; --bad-soft:#3b1e1b; --wait:#a39d97; --wait-soft:#2a2724;
  color-scheme:dark}

*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--fg);font-family:var(--f-body);font-size:16px;line-height:1.45;-webkit-font-smoothing:antialiased}
button,textarea{font:inherit;color:inherit}
h1,h2,h3{font-family:var(--f-display);font-weight:600;letter-spacing:.01em;margin:0;text-wrap:balance}
h1{font-size:1.75rem;line-height:1.1} h2{font-size:1.3rem} h3{font-size:1.08rem}
p{margin:0}
.num{font-family:var(--f-mono);font-variant-numeric:tabular-nums}
.muted{color:var(--muted)} .small{font-size:.86rem}
.label{font-size:.72rem;text-transform:uppercase;letter-spacing:.09em;color:var(--muted);font-weight:600}
[hidden]{display:none!important}

.top{position:sticky;top:0;z-index:5;background:var(--surface);border-bottom:1px solid var(--line);
  padding:calc(10px + env(safe-area-inset-top,0px)) 16px 10px;display:flex;align-items:center;gap:10px}
.brand{flex:1;display:flex;align-items:baseline;gap:8px;min-width:0}
.brand b{white-space:nowrap;font-family:var(--f-display);font-size:1.3rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--accent)}
.brand span{font-size:.82rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chip{border:1px solid var(--line);background:var(--sunk);border-radius:999px;padding:5px 12px;font-size:.82rem;font-weight:600;cursor:pointer}

main{max-width:520px;margin:0 auto;padding:16px 16px 190px;display:flex;flex-direction:column;gap:14px}
main.setup{padding-bottom:120px}

.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;display:flex;flex-direction:column;gap:12px}
.row{display:flex;gap:12px;align-items:center}
.between{justify-content:space-between}

.btn{border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:10px 16px;font-weight:600;cursor:pointer;min-height:46px}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.ghost{background:none;border-color:transparent;color:var(--accent);padding-inline:4px;min-height:36px}
.btn:disabled{opacity:.4;cursor:not-allowed}
.btn.block{width:100%;font-size:1.05rem;min-height:54px}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

/* setup */
.intro{display:flex;flex-direction:column;gap:6px;padding:4px 2px}
.progress{height:6px;border-radius:99px;background:var(--sunk);overflow:hidden}
.progress i{display:block;height:100%;background:var(--accent);width:0;transition:width .4s}
.q{gap:10px}
.qhead{display:flex;gap:12px;align-items:flex-start}
.qn{font-family:var(--f-mono);font-size:.8rem;color:var(--accent);font-weight:500;padding-top:3px;min-width:22px}
.qtext{flex:1;display:flex;flex-direction:column;gap:2px}
.qtext b{font-weight:600;font-size:1.02rem;line-height:1.3}
.mic{flex:none;width:58px;height:58px;border-radius:50%;border:2px solid var(--accent);background:var(--surface);color:var(--accent);
  display:grid;place-items:center;cursor:pointer;transition:transform .15s}
.mic svg{width:24px;height:24px}
.mic.live{background:var(--accent);color:var(--accent-ink);animation:pulse 1.2s infinite}
.mic.done{border-color:var(--good);color:var(--good)}
@keyframes pulse{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--accent) 45%,transparent)}100%{box-shadow:0 0 0 16px transparent}}
.wave{display:flex;gap:3px;align-items:center;height:22px}
.wave i{width:3px;border-radius:2px;background:var(--accent);animation:wv .9s infinite ease-in-out}
.wave i:nth-child(2){animation-delay:.1s}.wave i:nth-child(3){animation-delay:.2s}.wave i:nth-child(4){animation-delay:.3s}
.wave i:nth-child(5){animation-delay:.4s}.wave i:nth-child(6){animation-delay:.15s}.wave i:nth-child(7){animation-delay:.25s}
@keyframes wv{0%,100%{height:5px}50%{height:22px}}
textarea{width:100%;border:1px solid var(--line);background:var(--sunk);border-radius:10px;padding:10px 12px;resize:vertical;min-height:70px;line-height:1.4}
.tlabel{display:flex;justify-content:space-between;align-items:center}
.opt{font-size:.72rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;padding:3px 8px;border-radius:99px;background:var(--sunk);color:var(--muted)}
.req{background:var(--accent-soft);color:var(--accent)}
.q.skipped{opacity:.55}
.section-h{display:flex;flex-direction:column;gap:2px;padding:10px 2px 0}
.dock{position:fixed;left:0;right:0;bottom:0;z-index:6;background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(8px);
  border-top:1px solid var(--line);padding:12px 16px calc(12px + env(safe-area-inset-bottom,0px))}
.dock .inner{max-width:520px;margin:0 auto;display:flex;flex-direction:column;gap:6px}

/* plan */
.goal{border-left:4px solid var(--accent);padding-left:12px;display:flex;flex-direction:column;gap:4px}
.ms{display:grid;grid-template-columns:auto 1fr;gap:8px 14px;align-items:baseline}
.ms .wk{font-family:var(--f-mono);font-size:.8rem;color:var(--accent)}
.hl{display:flex;flex-direction:column}
.hl > div{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-top:1px solid var(--line)}
.hl > div:first-child{border-top:0;padding-top:0}
.tag{font-size:.78rem;color:var(--muted);white-space:nowrap}

/* today */
.stats{display:grid;grid-template-columns:1fr auto auto;gap:14px;align-items:center}
.ring{width:82px;height:82px;position:relative}
.ring svg{width:100%;height:100%;transform:rotate(-90deg)}
.ring .v{position:absolute;inset:0;display:grid;place-items:center;font-family:var(--f-display);font-size:1.6rem;font-weight:700}
.streak{display:flex;flex-direction:column;align-items:center;gap:0;padding:0 6px}
.streak b{font-family:var(--f-display);font-size:1.9rem;font-weight:700;line-height:1}
.task{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--line)}
.task:first-of-type{border-top:0}
.task .t{flex:1;display:flex;flex-direction:column;gap:1px;min-width:0}
.task .t b{font-weight:600}
.dot{width:28px;height:28px;border-radius:50%;flex:none;display:grid;place-items:center;border:2px dashed var(--line);color:var(--muted)}
.dot svg{width:16px;height:16px}
.dot.done{background:var(--good);border:0;color:var(--surface)}
.dot.miss{background:var(--bad);border:0;color:var(--surface)}
.pill{font-size:.74rem;font-weight:600;padding:4px 10px;border-radius:99px;white-space:nowrap}
.pill.wait{background:var(--wait-soft);color:var(--wait)}
.pill.done{background:var(--good-soft);color:var(--good)}
.pill.miss{background:var(--bad-soft);color:var(--bad)}
.commit{background:var(--fg);color:var(--bg);border-color:var(--fg)}
.commit .label{color:color-mix(in srgb,var(--bg) 65%,transparent)}
.commit .track{display:flex;gap:4px}
.commit .track i{flex:1;height:6px;border-radius:2px;background:color-mix(in srgb,var(--bg) 22%,transparent)}
.commit .track i.on{background:var(--accent)}
.commit .track i.now{background:color-mix(in srgb,var(--accent) 55%,var(--bg))}
.privacy{display:flex;gap:8px;align-items:center;justify-content:center;font-size:.8rem;color:var(--muted)}
.privacy svg{width:14px;height:14px}

.recordbar{position:fixed;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom,0px));z-index:6;padding:10px 16px;
  background:linear-gradient(to top,var(--bg) 70%,transparent)}
.recordbar .inner{max-width:520px;margin:0 auto}
.recbtn{width:100%;display:flex;align-items:center;justify-content:center;gap:12px;min-height:64px;border-radius:16px;border:0;cursor:pointer;
  background:var(--accent);color:var(--accent-ink);font-family:var(--f-display);font-size:1.35rem;font-weight:600;letter-spacing:.03em}
.recbtn svg{width:26px;height:26px}
.recbtn.sent{background:var(--good-soft);color:var(--good);font-size:1.1rem}

.tabs{position:fixed;left:0;right:0;bottom:0;z-index:7;background:var(--surface);border-top:1px solid var(--line);
  display:flex;justify-content:center;padding:6px 8px calc(6px + env(safe-area-inset-bottom,0px))}
.tabs button{flex:1;max-width:160px;border:0;background:none;padding:6px 4px;border-radius:10px;cursor:pointer;color:var(--muted);
  display:flex;flex-direction:column;align-items:center;gap:2px;font-size:.78rem;font-weight:600;min-height:50px}
.tabs button svg{width:22px;height:22px}
.tabs button[aria-current="true"]{color:var(--accent);background:var(--accent-soft)}

/* leaderboard */
.seg{display:grid;grid-template-columns:1fr 1fr;background:var(--sunk);border-radius:10px;padding:4px;gap:4px}
.seg button{border:0;background:none;border-radius:8px;padding:9px;font-weight:600;cursor:pointer;color:var(--muted)}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--fg);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.lb{display:flex;flex-direction:column}
.lbrow{display:grid;grid-template-columns:28px 1fr 64px;gap:10px;align-items:center;padding:12px 0;border-top:1px solid var(--line)}
.lbrow:first-child{border-top:0}
.lbrow .rk{font-family:var(--f-mono);color:var(--muted);font-size:.85rem}
.lbrow .nm{display:flex;flex-direction:column;gap:6px;min-width:0}
.lbrow .nm b{font-weight:600}
.lbrow .bar{height:8px;border-radius:99px;background:var(--sunk);overflow:hidden}
.lbrow .bar i{display:block;height:100%;background:var(--muted);border-radius:99px;transition:width .6s}
.lbrow.me .bar i{background:var(--accent)}
.lbrow.me b{color:var(--accent)}
.lbrow .pc{text-align:right;font-family:var(--f-display);font-size:1.35rem;font-weight:700}
.lbrow .pc.na{font-family:var(--f-body);font-size:.78rem;font-weight:600;color:var(--muted)}

/* overlay */
.sheet{position:fixed;inset:0;z-index:20;background:var(--bg);overflow-y:auto;display:flex;flex-direction:column}
.sheet .wrap{max-width:520px;width:100%;margin:0 auto;padding:calc(18px + env(safe-area-inset-top,0px)) 16px calc(24px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:14px;flex:1}
.recview{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:22px;text-align:center}
.count{width:220px;height:220px;position:relative}
.count svg{width:100%;height:100%;transform:rotate(-90deg)}
.count .v{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.count .v b{font-family:var(--f-display);font-size:4.2rem;font-weight:700;line-height:1}
.prompts{display:flex;flex-direction:column;gap:6px;font-size:.95rem}
.stopbtn{width:84px;height:84px;border-radius:50%;border:0;background:var(--accent);color:var(--accent-ink);display:grid;place-items:center;cursor:pointer}
.stopbtn i{width:28px;height:28px;border-radius:6px;background:currentColor}
.spinner{width:44px;height:44px;border-radius:50%;border:4px solid var(--sunk);border-top-color:var(--accent);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.feedback{background:var(--bad-soft);color:var(--bad);border-radius:var(--r);padding:14px 16px;display:flex;gap:10px;align-items:flex-start;font-weight:600}
.feedback svg{width:20px;height:20px;flex:none;margin-top:2px}
.quote{font-size:.95rem;line-height:1.5;color:var(--fg);border-left:3px solid var(--line);padding-left:12px}
.bigscore{display:flex;align-items:baseline;gap:10px}
.bigscore b{font-family:var(--f-display);font-size:3.4rem;font-weight:700;line-height:1;color:var(--accent)}

.perm{display:flex;flex-direction:column;gap:14px}
.permrow{display:flex;gap:14px;align-items:flex-start;padding:14px 0;border-top:1px solid var(--line)}
.permrow:first-child{border-top:0;padding-top:0}
.permrow .ic{flex:none;width:44px;height:44px;border-radius:12px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center}
.permrow .ic svg{width:22px;height:22px}
.permrow .t{flex:1;display:flex;flex-direction:column;gap:2px}
.permrow .t b{font-weight:600}
.permrow .ok{flex:none;color:var(--good);opacity:0;transition:opacity .3s}
.permrow .ok svg{width:22px;height:22px}
.permrow.on .ok{opacity:1}
@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}
/* flask additions */
.err{color:var(--bad);font-weight:600;font-size:.9rem}
.input{width:100%;border:1px solid var(--line);background:var(--sunk);border-radius:10px;padding:12px 14px;min-height:50px;font-size:1.1rem;letter-spacing:.12em;text-transform:uppercase;font-family:var(--f-mono)}
.hrow{display:flex;flex-direction:column;gap:8px;padding-top:10px;border-top:1px dashed var(--line)}
.hrow input[type=text]{width:100%;border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:9px 11px}
.days{display:flex;gap:4px;flex-wrap:wrap}
.days button{border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:5px 8px;font-size:.78rem;font-weight:600;cursor:pointer;color:var(--muted)}
.days button[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.toggle{cursor:pointer;border:0}
a.chip{text-decoration:none;color:inherit}
