:root{
  --bg:#F2F3F1; --surface:#FFFFFF; --ink:#1F252C; --muted:#646E78; --line:#DCDFE0;
  --am:#C9831F; --am-soft:#FBEEDA; --pm:#5A57A6; --pm-soft:#E7E6F6;
  --mt:#A8487A; --mt-soft:#F6E4EE;
  --done:#3F8263; --done-soft:#DDEFE5; --skip:#8A6D3B; --warn:#B3412E;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#15181C; --surface:#1E2227; --ink:#ECEEF0; --muted:#9AA3AC; --line:#30363D;
    --am:#E9AA4E; --am-soft:#3A2F1E; --pm:#A09DEB; --pm-soft:#2A2946;
    --mt:#E58DB8; --mt-soft:#3A2331;
    --done:#72C299; --done-soft:#1E3529; --skip:#D2B07A; --warn:#F08A76;
  }
}
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  -webkit-font-smoothing:antialiased;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
/* the strip under the phone's status bar: solid page colour, so the list doesn't show through it */
body::before{content:"";position:fixed;top:0;left:0;right:0;height:env(safe-area-inset-top);background:var(--bg);z-index:6;pointer-events:none}
body.s-am{--acc:var(--am);--acc-soft:var(--am-soft)}
body.s-pm{--acc:var(--pm);--acc-soft:var(--pm-soft)}
body.s-maint{--acc:var(--mt);--acc-soft:var(--mt-soft)}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
.wrap{max-width:560px;margin:0 auto;padding:18px 16px 48px}
.empty{padding:40px 8px;text-align:center;color:var(--muted)}

/* Day header */
.dayline{margin-bottom:16px}
.dwk{font-size:15px;font-weight:600;color:var(--muted)}
.dbig{font-family:"Young Serif",Georgia,"Times New Roman",serif;font-size:40px;line-height:1.05;color:var(--acc);letter-spacing:-.01em}
.dmeta{color:var(--muted);font-size:14px;margin-top:4px}
.navrow{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font-size:14px;color:var(--muted)}
.nav{display:flex;gap:6px}
.nav button{background:var(--surface);border:1px solid var(--line);border-radius:999px;min-width:36px;height:36px;padding:0 12px;font-size:14px}
.nav button:disabled{opacity:.35;cursor:default}

/* Calendar */
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin-bottom:8px}
.wk{font-size:12px;color:var(--muted);text-align:center}
.cell{border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:5px 5px 6px;min-height:44px;text-align:left;
  display:flex;flex-direction:column;justify-content:space-between}
.cell .n{font-size:13px;font-weight:600;line-height:1}
.cell.future .n{color:var(--muted);font-weight:500}
.cell.today{border-color:var(--ink)}
.cell.sel{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.cell.sel .n{color:var(--bg)}
.cell.off{background:none;border-style:dashed;opacity:.45}
.cell.off .n{font-weight:500;color:var(--muted)}
.cell.blank{border:0;background:none}
.bars{display:flex;flex-direction:column;gap:3px}
.bar{height:4px;border-radius:2px;background:var(--line);overflow:hidden}
.cell.sel .bar{background:color-mix(in srgb,var(--bg) 25%,transparent)}
.bar i{display:block;height:100%}
.bar.a i{background:var(--am)} .bar.p i{background:var(--pm)} .bar.m i{background:var(--mt)} .bar i.full{background:var(--done)}
.cal-key{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:12px;color:var(--muted);margin:0 0 18px}
.cal-key span::before{content:"";display:inline-block;width:14px;height:4px;border-radius:2px;margin-right:6px;vertical-align:middle}
.cal-key .ka::before{background:var(--am)} .cal-key .kp::before{background:var(--pm)} .cal-key .km::before{background:var(--mt)} .cal-key .kd::before{background:var(--done)}

/* Morning / evening switch */
.switch{display:grid;grid-template-columns:1fr 1fr 1fr;background:var(--surface);border:1px solid var(--line);border-radius:12px;
  padding:4px;gap:4px;position:sticky;top:env(safe-area-inset-top);z-index:5;margin-bottom:16px}
.switch button{border:0;background:none;border-radius:9px;padding:8px 4px;font-weight:600;font-size:15px;display:flex;flex-direction:column;align-items:center;gap:1px;min-width:0}
.switch button span{font-weight:500;font-size:13px;color:var(--muted)}
.switch button[aria-pressed="true"]{background:var(--acc-soft)}
.switch button[aria-pressed="true"] span{color:var(--ink)}

.banner{background:var(--surface);border:1px dashed var(--line);border-radius:12px;padding:12px 14px;color:var(--muted);font-size:14px;margin-bottom:16px}
.banner.err{border-style:solid;border-color:var(--warn);color:var(--warn);margin-bottom:18px}
.banner.err b{font-weight:700}
.hint{font-size:13px;color:var(--muted);margin:-8px 2px 14px}

/* Steps */
.group{margin-bottom:18px}
.ghead{display:flex;align-items:baseline;justify-content:space-between;margin:0 2px 8px}
.ghead h2{font-size:15px;font-weight:700;margin:0}
.ghead .ct{font-size:13px;color:var(--muted)}
.ghead .ct.all{color:var(--done);font-weight:600}
.list{background:var(--surface);border:1px solid var(--line);border-radius:12px;overflow:hidden}
.item{display:flex;gap:12px;align-items:flex-start;width:100%;text-align:left;background:none;border:0;border-top:1px solid var(--line);
  padding:12px 14px;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:manipulation;
  transition:background .15s}
.item:first-child{border-top:0}
.item.pressing{background:var(--acc-soft)}
.item:disabled{cursor:default}
.box{flex:none;width:22px;height:22px;border:1.5px solid var(--muted);border-radius:6px;margin-top:1px;display:grid;place-items:center;transition:background .15s,border-color .15s}
.box svg{width:14px;height:14px;opacity:0}
.item.done .box{background:var(--done);border-color:var(--done)}
.item.done .box svg{opacity:1}
.item.skip .box{border-style:dashed;border-color:var(--skip)}
.item.skip .box svg{display:none}
.item.skip .box::after{content:"";width:10px;height:1.8px;background:var(--skip);border-radius:1px}
.item:disabled .box{opacity:.45}
.txt{flex:1;min-width:0}
.nm{display:block;font-weight:500}
.item.done .nm,.item.skip .nm{color:var(--muted)}
.ar{display:block;font-size:13px;color:var(--muted);margin-top:2px}
.why{display:block;font-size:13px;color:var(--skip);margin-top:3px}

/* Notes */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px;margin-bottom:16px}
.panel h2{font-size:15px;font-weight:700;margin:0 0 8px}
textarea{width:100%;resize:vertical;border:1px solid var(--line);border-radius:8px;padding:10px;background:var(--bg);line-height:1.4}
#note{min-height:84px}

.status{font-size:13px;color:var(--muted);text-align:center;min-height:18px;margin:4px 0}
.status.err{color:var(--warn)}
.status button{background:none;border:0;color:var(--acc);font-weight:600;padding:4px 6px;text-decoration:underline}

.btn{border-radius:999px;padding:9px 16px;font-weight:600;border:1px solid var(--line);background:var(--surface)}
.btn.primary{background:var(--acc);border-color:var(--acc);color:#fff}
.btn:disabled{opacity:.5}

/* Setup */
.setup{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:18px}
.setup h1{font-size:20px;margin:0 0 6px}
.setup p{color:var(--muted);margin:0 0 14px}
.setup input{width:100%;padding:10px;border:1px solid var(--line);border-radius:8px;background:var(--bg);margin-bottom:12px}

/* Sign in */
.signin{text-align:center;margin-top:12vh}
.signin img{border-radius:14px;margin-bottom:10px}
.signin label{display:block;text-align:left;font-size:14px;font-weight:600;margin-bottom:6px}
.signin input{text-align:center;font-size:20px;letter-spacing:.08em;text-transform:uppercase}
.signin .btn{width:100%;padding:13px 16px;font-size:16px}

/* Settings */
.settings{margin-top:24px}
.set-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}

/* Skip sheet */
.sheet-bg{position:fixed;inset:0;background:rgba(10,12,14,.45);display:flex;align-items:flex-end;justify-content:center;z-index:20}
.sheet-bg[hidden]{display:none}
.sheet{background:var(--surface);width:100%;max-width:560px;max-height:88vh;overflow-y:auto;border-radius:16px 16px 0 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom))}
.sheet h2{margin:0 0 4px;font-size:18px}
.sheet-step{margin:0 0 12px;color:var(--muted);font-size:14px}
.sheet label{display:block;font-size:14px;font-weight:600;margin-bottom:6px}
.sheet-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:12px}
.sheet-actions [hidden]{display:none}
/* Photo items */
.box.shoot{border:1.5px solid var(--acc);color:var(--acc);width:30px;height:30px;margin-top:-2px}
.box.shoot svg{opacity:1;width:18px;height:18px}
.item.skip .box.shoot svg{display:none}
.thumb{flex:none;width:30px;height:40px;border-radius:6px;overflow:hidden;margin-top:-2px;outline:2px solid var(--done)}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}

/* Camera */
body.cam-open{overflow:hidden}
.cam{position:fixed;inset:0;z-index:30;background:#000;color:#fff;display:flex;flex-direction:column;
  padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}
.cam[hidden]{display:none}
.cam-top{display:flex;align-items:flex-start;gap:10px;padding:10px 14px}
.cam-x{flex:none;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.16);color:#fff;font-size:16px}
.cam-head{flex:1;min-width:0}
#camTitle{font-weight:700;font-size:17px;line-height:1.25}
#camSub{font-size:13px;color:rgba(255,255,255,.75);margin-top:2px}
#camPos{flex:none;font-size:13px;color:rgba(255,255,255,.75);padding-top:3px}
.cam-view{position:relative;flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden;container-type:size}
/* a true 3:4 frame, as large as fits: what's inside it is exactly what gets saved */
.cam-frame{position:relative;width:min(100cqw,75cqh);height:min(100cqh,133.333cqw);border-radius:10px;overflow:hidden}
.cam-frame video,.cam-frame img,.cam-frame svg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cam-frame [hidden]{display:none}
.cam-view .mirror{transform:scaleX(-1)}
#camGuide{fill:none;stroke:rgba(255,255,255,.85);stroke-width:2.5;stroke-dasharray:7 6;pointer-events:none}
#camGuide .thin{stroke-width:1;stroke-dasharray:3 5;stroke:rgba(255,255,255,.55)}
.cam-countdown{position:absolute;font:700 96px/1 system-ui,sans-serif;text-shadow:0 2px 12px rgba(0,0,0,.6)}
.cam-msg{position:absolute;inset:auto 20px;text-align:center;font-size:15px;line-height:1.5}
.linkish{background:none;border:0;color:#fff;text-decoration:underline;font-weight:600;padding:0}
.cam-checks{display:flex;justify-content:center;gap:8px;min-height:30px;padding:8px 12px 0}
.chk{font-size:13px;font-weight:600;border-radius:999px;padding:4px 10px}
.chk:empty{display:none}
.chk.ok{background:rgba(114,194,153,.2);color:#9FE0BE}
.chk.bad{background:rgba(240,138,118,.22);color:#FFB3A3}
.cam-bar{display:flex;align-items:center;justify-content:space-around;gap:12px;padding:14px 16px 18px}
.cam-bar[hidden]{display:none}
.cam-btn{min-width:84px;height:44px;border-radius:999px;border:1px solid rgba(255,255,255,.35);background:rgba(255,255,255,.08);color:#fff;font-weight:600;font-size:14px;padding:0 14px}
.cam-btn[aria-pressed="true"]{background:#fff;color:#000}
.cam-btn.wide{flex:1}
.cam-btn.primary{background:#fff;color:#000;border-color:#fff}
.shutter{width:72px;height:72px;border-radius:50%;border:4px solid #fff;background:rgba(255,255,255,.25);box-shadow:inset 0 0 0 4px #000}
.shutter:active{background:#fff}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
