:root{
  --bg:#FFF9ED; --card:#FFFFFF; --bg2:#F4EBDD; --text:#2D2A26; --muted:#7C7268; --line:#EADFCF;
  --primary:#2F8F83; --primary-dark:#26766C; --on-primary:#FFFFFF; --accent:#2F8F83; --accent-soft:rgba(47,143,131,.16);
  --danger:#C2453B; --radius:22px; --shadow:0 2px 14px rgba(110,80,40,.08);
  --font:system-ui,-apple-system,"Segoe UI",Roboto,"Noto Sans",sans-serif;
  --pic:#FFF9ED; color-scheme:light;
}
/* Tamna tema: near-black, readable teal; pictures keep their own warm card */
:root[data-theme="dark"]{
  --bg:#141210; --card:#211E1B; --bg2:#2C2824; --text:#F3EEE6; --muted:#ADA398; --line:#3A352F;
  --primary:#4DB8A9; --primary-dark:#3FA394; --on-primary:#0B1F1C; --accent:#5CC7B8; --accent-soft:rgba(92,199,184,.18);
  --danger:#E0675C; --shadow:0 2px 14px rgba(0,0,0,.45); --pic:#FFF6E6; color-scheme:dark;
}
:root[data-theme="dark"] .btn.primary.huge{box-shadow:0 6px 18px rgba(77,184,169,.25)}
:root[data-theme="dark"] .fig,:root[data-theme="dark"] .tpic:not(.trio),:root[data-theme="dark"] .today-pic{box-shadow:0 0 0 1px rgba(255,255,255,.06),var(--shadow)}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:var(--font);-webkit-text-size-adjust:100%}
body{overscroll-behavior:none}
button{font:inherit;color:inherit}
[hidden]{display:none !important}
#app{max-width:560px;margin:0 auto;min-height:100%;min-height:100dvh;display:flex;flex-direction:column}
.screen{flex:1;display:flex;flex-direction:column;min-height:100dvh;padding:0 20px calc(18px + env(safe-area-inset-bottom))}
.bar{display:flex;align-items:center;justify-content:space-between;height:60px;padding-top:env(safe-area-inset-top)}
.brand{font-weight:700;font-size:18px}
.icon-btn{width:48px;height:48px;border:0;background:transparent;border-radius:14px;display:grid;place-items:center;cursor:pointer;margin-right:-10px}
#menuBack{margin-right:0;margin-left:-10px}
.icon-btn:active{background:var(--bg2)}
.icon-btn-spacer{width:48px}
.home-body{flex:1;display:flex;flex-direction:column;justify-content:center;gap:14px;padding:4px 0}
.today{text-align:center;padding:10px 0 4px}
.today-pic{width:min(100%,360px,34dvh*4/3);aspect-ratio:4/3;margin:0 auto 8px;border-radius:var(--radius);overflow:hidden;background:var(--pic)}
.today-pic img{width:100%;height:100%;display:block;object-fit:cover}
.eyebrow{margin:0 0 6px;font-size:14px;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.06em}
.big{margin:0;font-size:52px;line-height:1.05;font-weight:800;letter-spacing:-.01em}
.big.word{font-size:32px}
.line{margin:8px 0 0;font-size:19px;line-height:1.35}
.muted{color:var(--muted)}
.small{font-size:15px;margin:10px 0 0;line-height:1.4}
.card{background:var(--card);border-radius:var(--radius);padding:16px 18px;box-shadow:var(--shadow)}
.card p{margin:0}
.note-title{font-weight:700;margin-bottom:8px !important}
ul.plain{margin:0 0 14px;padding-left:20px;line-height:1.6;font-size:16px}
.row{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.row .btn{flex:1 1 120px}
.btn{min-height:52px;border:0;border-radius:16px;background:var(--bg2);font-size:17px;font-weight:700;padding:12px 18px;cursor:pointer}
.btn.primary{background:var(--primary);color:var(--on-primary)}
.btn.huge{width:100%;min-height:68px;font-size:22px;border-radius:22px}
.btn.primary.huge{box-shadow:0 6px 16px rgba(47,143,131,.28)}
.btn:disabled{opacity:.45}
.btn:active{filter:brightness(.94)}
.link{border:0;background:transparent;color:var(--muted);font-size:16px;min-height:48px;text-decoration:underline;cursor:pointer;width:100%}
.home-foot{display:flex;flex-direction:column;gap:12px;padding-bottom:4px}
.progress{text-align:center}
.progress .small{margin-top:8px}
.segs{display:flex;gap:6px;justify-content:center}
.seg{flex:0 0 36px;height:7px;border-radius:4px;background:var(--line)}
.seg.on{background:var(--accent)}
/* Session */
#session{justify-content:space-between;padding-top:calc(12px + env(safe-area-inset-top))}
.session-meta{text-align:center;margin:4px 0 0;font-size:16px;color:var(--muted);font-variant-numeric:tabular-nums}
.ring-wrap{position:relative;width:min(62vw,270px,32dvh);aspect-ratio:1;margin:6px auto 0}
.ring{width:100%;height:100%;display:block}
.ring-track{fill:none;stroke:var(--line);stroke-width:14}
.ring-arc{fill:none;stroke:var(--accent);stroke-width:14;stroke-linecap:round}
.ring-disc{fill:var(--accent-soft);transform-box:fill-box;transform-origin:center;transform:scale(1);transition:transform var(--breath,600ms) ease-in-out}
.squeezing .ring-disc{transform:scale(.68)}
.ring-text{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;pointer-events:none}
.count{font-size:60px;font-weight:800;line-height:1;font-variant-numeric:tabular-nums}
.cue{font-size:22px;font-weight:700;margin-top:4px;color:var(--primary-dark)}
.hint{min-height:2.7em;margin:8px auto 0;max-width:330px;text-align:center;font-size:18px;line-height:1.35;font-weight:600}
.fig-btn{border:0;background:transparent;padding:0;margin:6px auto 0;display:flex;flex-direction:column;align-items:center;gap:6px;cursor:pointer;width:100%}
.fig{position:relative;border-radius:var(--radius);overflow:hidden;background:var(--pic);box-shadow:var(--shadow)}
.fig.pose{aspect-ratio:4/3}
.fig.close{aspect-ratio:4/5}
#sessFig{height:min(28dvh,250px)}
.fig img,.fig svg{position:absolute;inset:0;width:100%;height:100%;display:block}
.fig-caption{font-size:13px;color:var(--muted)}
.session-foot{padding-top:10px}
.session-foot .row{margin-top:0}
#stopBtn.armed{background:var(--danger);color:#fff}
/* Moving parts of the drawings: only on squeeze / relax */
.an-zone,.an-scr,.an-pen,.an-anus,.an-arrow,.an-bub{transform-box:fill-box;transform-origin:center;transition:transform var(--breath,700ms) ease-in-out,opacity var(--breath,700ms) ease-in-out}
.an-arrow,.an-bub{transition-duration:var(--breath,700ms),280ms}
.an-pen{transform-origin:50% 0}
.an-zone-fill{fill-opacity:.32;transition:fill-opacity var(--breath,700ms) ease-in-out}
.an-arrow,.an-bub{opacity:0}
.an-up{opacity:.3}
.lifted .an-zone{transform:translateY(-22px) scale(.8)}
.lifted .an-zone-fill{fill-opacity:.75}
.lifted .an-scr{transform:translateY(-12px)}
.lifted .an-pen{transform:translateY(-6px) scaleY(.95)}
.lifted .an-anus{transform:translateY(-6px) scale(.86)}
.lifted .an-up{opacity:1;transform:translateY(-14px)}
.lifted .an-bub-up{opacity:1}
.relaxing .an-up{opacity:0}
.relaxing .an-down{opacity:1;transform:translateY(12px)}
.relaxing .an-bub-down{opacity:1}
.an-cap{opacity:.85;transition:opacity 280ms}
.lifted .an-cap{opacity:1}
.relaxing .an-cap{opacity:0}
.static .an-zone,.static .an-scr,.static .an-pen,.static .an-anus,.static .an-arrow,.static .an-bub,.static .an-zone-fill,.static .ring-disc{transition:none}
@media (prefers-reduced-motion: reduce){
  .ring-disc,.an-zone,.an-scr,.an-pen,.an-anus,.an-arrow,.an-bub,.an-zone-fill{transition:none !important}
}
/* Tutorial */
#tutorial{padding-left:0;padding-right:0}
#tutorial .bar{padding:0 20px}
.tcards{flex:1;display:flex;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.tcards::-webkit-scrollbar{display:none}
.tcard{flex:0 0 100%;scroll-snap-align:center;padding:4px 20px 8px;display:flex;flex-direction:column;gap:12px}
.tpic{width:100%;margin:0 auto;border-radius:var(--radius);overflow:hidden;background:var(--pic);box-shadow:var(--shadow);position:relative}
.tpic.pose{aspect-ratio:4/3;max-height:40dvh;width:min(100%,40dvh*4/3)}
.tpic.close{aspect-ratio:4/5;max-height:40dvh;width:min(100%,40dvh*4/5)}
.tpic.trio{aspect-ratio:auto;display:grid;grid-template-columns:repeat(3,1fr);gap:6px;background:transparent;box-shadow:none}
.tpic.trio figure{margin:0;background:var(--card);border-radius:16px;overflow:hidden;box-shadow:var(--shadow);text-align:center;font-size:13px;font-weight:600;padding-bottom:6px}
.tpic.trio img{width:100%;aspect-ratio:4/3;object-fit:cover;display:block;background:var(--pic)}
.tpic img,.tpic svg{position:absolute;inset:0;width:100%;height:100%;display:block}
.tpic.trio img{position:static;height:auto}
.tpic.trio figcaption{padding:6px 4px 0;line-height:1.3}
.tcard h2{margin:4px 0 0;font-size:24px;line-height:1.2}
.tcard p{margin:0;font-size:18px;line-height:1.45}
.tfoot{padding:8px 20px 0;display:flex;flex-direction:column;gap:10px}
.dots{display:flex;gap:8px;justify-content:center}
.dot{width:9px;height:9px;border-radius:50%;background:var(--line)}
.dot.on{background:var(--accent);width:22px;border-radius:5px}
.skip{border:0;background:transparent;color:var(--muted);font-size:16px;font-weight:600;min-height:48px;padding:0 4px;cursor:pointer}
/* Done */
.done-body{flex:1;display:flex;flex-direction:column;justify-content:center;text-align:center}
/* Menu */
.menu-body{display:flex;flex-direction:column;gap:12px;padding-bottom:24px}
.menu-list{display:flex;flex-direction:column;background:var(--card);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.menu-item{display:flex;justify-content:space-between;align-items:center;min-height:58px;padding:0 18px;border:0;border-bottom:1px solid var(--line);background:transparent;font-size:18px;text-align:left;cursor:pointer}
.menu-item:last-child{border-bottom:0}
.menu-item:active{background:var(--bg2)}
.chev{color:var(--muted)}
.menu-body h2{font-size:18px;margin:12px 0 0}
.menu-body p{margin:0;line-height:1.5;font-size:16px}
.kv{display:flex;flex-direction:column;background:var(--card);border-radius:var(--radius);padding:0 18px;box-shadow:var(--shadow)}
.kv div{display:flex;justify-content:space-between;gap:12px;padding:13px 0;border-bottom:1px solid var(--line);font-size:16px}
.kv div:last-child{border-bottom:0}
.kv span:first-child{color:var(--muted)}
.field{display:flex;flex-direction:column;gap:6px;font-size:15px;color:var(--muted)}
.field input{font:inherit;font-size:18px;color:var(--text);background:var(--card);border:1px solid var(--line);border-radius:14px;min-height:52px;padding:0 14px}
.switch{display:flex;justify-content:space-between;align-items:center;min-height:56px;font-size:18px;border-bottom:1px solid var(--line)}
.switch input{width:26px;height:26px;accent-color:var(--primary)}
.stepper{display:flex;align-items:center;justify-content:space-between;min-height:60px;border-bottom:1px solid var(--line);font-size:17px}
.stepper .ctl{display:flex;align-items:center;gap:8px}
.stepper button{width:48px;height:48px;border-radius:14px;border:0;background:var(--bg2);font-size:22px;font-weight:700;cursor:pointer}
.stepper output{min-width:56px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}
.days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px;width:100%;max-width:360px;box-sizing:border-box}
.day{aspect-ratio:1;border-radius:8px;background:var(--line)}
.day.full{background:var(--accent)}
.day.today{box-shadow:inset 0 0 0 2px var(--muted)}
.hist{list-style:none;margin:0;padding:0 18px;background:var(--card);border-radius:var(--radius);box-shadow:var(--shadow)}
.hist li{display:flex;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--line);font-size:16px}
.hist li:last-child{border-bottom:0}
.figs{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}
.figs .fig{width:100%}
.credit{font-size:13px;color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.status{font-size:15px;color:var(--muted)}
a{color:var(--primary-dark)}
@media (max-height:720px){.ring-wrap{width:min(62vw,270px,28dvh)}#sessFig{height:min(24dvh,250px)}.today-pic{width:min(100%,360px,26dvh*4/3)}.big{font-size:44px}}
#tutorial{height:100dvh;min-height:0;overflow:hidden}
.tcards{min-height:0}
.tcard{overflow-y:auto}
@media (max-height:720px){
  .tpic.pose{max-height:30dvh;width:min(100%,30dvh*4/3)}
  .tpic.close{max-height:30dvh;width:min(100%,30dvh*4/5)}
  .tcard h2{font-size:21px}
  .tcard p{font-size:16px;line-height:1.4}
  .tcard{gap:8px}
}

/* theme choice + reminder */
.choice{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;background:var(--bg2);border-radius:16px;padding:4px}
.choice button{min-height:48px;border:0;border-radius:12px;background:transparent;font-size:16px;font-weight:600;color:var(--text);cursor:pointer}
.choice button[aria-checked="true"]{background:var(--card);color:var(--primary);box-shadow:var(--shadow)}
.hm{display:flex;align-items:center;gap:4px}
.hm select{min-height:44px;font:inherit;font-size:18px;color:var(--text);background:var(--card);border:1px solid var(--line);border-radius:12px;padding:0 8px}
.remind{display:flex;align-items:center;gap:8px;border-left:5px solid var(--primary);padding:10px 8px 10px 16px}
.remind p{margin:0;flex:1;font-size:16px;line-height:1.35}
.remind .icon-btn{margin:0;flex:0 0 44px;width:44px;height:44px;font-size:18px;color:var(--muted)}
@media (max-height:720px){.remind:not([hidden]) ~ .today .today-pic{display:none}}

/* fingerprint lock */
html[data-lock="1"] #app{visibility:hidden}
.lock{position:fixed;inset:0;z-index:50;background:var(--bg);display:flex;align-items:center;justify-content:center;padding:24px}
.lock-box{width:min(100%,420px);text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--text)}
.lock-box svg{color:var(--primary)}
.lock-box h1{margin:6px 0 0;font-size:26px}
.lock-box p{margin:0}
.lock-box .btn{width:100%;margin-top:16px}
