
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
html,body{-webkit-text-size-adjust:100%;touch-action:pan-x pan-y}
:root{--bg:#fff;--tx:#222;--chip:#eee;--mu:#888;--bd:#e5e5e5}
[data-theme=dark]{--bg:#14161a;--tx:#eee;--chip:#2a2d33;--mu:#9aa;--bd:#33363c}
body{margin:0;font-family:-apple-system,"SF Pro Display",Roboto,sans-serif;background:var(--bg);color:var(--tx)}
#app{max-width:480px;min-height:100vh;min-height:100dvh;margin:auto;display:flex;flex-direction:column;background:var(--bg)}
.top{position:relative;height:52vh;height:52dvh;min-height:340px;color:#fff;text-align:center;background:linear-gradient(135deg,#ff6b57,#f4364f 55%,#ee1650);transition:background .4s}
.top.rest{background:linear-gradient(135deg,#2dd4bf,#0ea5e9)}
.top.setrest{background:linear-gradient(135deg,#8b5cf6,#6366f1)}
.top.switch{background:linear-gradient(135deg,#fbbf24,#f97316)}
h1{margin:0;padding:calc(env(safe-area-inset-top,0px) + 22px) 60px 0;font-size:24px;font-weight:700}
#menu{position:absolute;right:14px;top:calc(env(safe-area-inset-top,0px) + 14px);width:44px;height:44px;border-radius:50%;border:0;background:rgba(255,255,255,.25);color:#fff;font-size:22px;cursor:pointer}
#label{margin-top:34px;font-size:18px;opacity:.9;min-height:24px}
#time{font-size:80px;font-size:clamp(72px,24vw,96px);font-weight:700;line-height:1.1;margin-top:10px;font-variant-numeric:tabular-nums}
#info{font-size:16px;opacity:.9;margin-top:6px;min-height:22px}
#prog{position:absolute;left:0;bottom:0;height:5px;background:rgba(255,255,255,.7);width:0;transition:width .2s}
.sheet{flex:1;background:var(--bg);border-radius:34px 34px 0 0;margin-top:-34px;position:relative;padding:62px 16px calc(30px + env(safe-area-inset-bottom,0px))}
#play{position:absolute;top:-45px;left:50%;transform:translateX(-50%);width:96px;height:96px;border-radius:50%;border:7px solid #f2284f;background:var(--bg);display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 0 0 12px var(--bg);padding:0}
#play svg{width:38px;height:38px;fill:#f2284f}
.tools{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-bottom:14px}
.tools button{border:0;background:var(--chip);border-radius:14px;padding:8px 4px;min-height:52px;font-size:13.5px;font-weight:600;line-height:1.25;color:var(--tx);cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}
.tools small{display:block;font-size:11.5px;font-weight:400;color:var(--mu);margin-top:1px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row{display:flex;align-items:center;border-radius:20px;padding:8px 12px 8px 16px;min-height:68px;margin-bottom:10px;font-size:18px;font-weight:600}
.row .ic{width:28px;height:28px;margin-right:12px;flex:none}
.row .n{flex:1;min-width:0;cursor:pointer;color:var(--tx);line-height:1.2}
.row .n small{display:block;font-size:12px;font-weight:400;line-height:1.25;color:var(--mu);margin-top:2px}
.row .v{font-size:26px;font-weight:600;min-width:62px;text-align:center;cursor:pointer;font-variant-numeric:tabular-nums}
.row button{width:42px;height:42px;flex:none;border:0;border-radius:50%;background:rgba(255,255,255,.8);font-size:22px;font-weight:700;margin-left:2px;color:inherit;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0}
.row button.sw{width:60px;height:34px;border-radius:17px;background:rgba(0,0,0,.18);position:relative;margin:0 6px 0 8px;padding:0;transition:background .2s}
.row button.sw::after{content:"";position:absolute;top:3px;left:3px;width:28px;height:28px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.3);transition:transform .2s}
.row button.sw.on{background:currentColor}
.row button.sw.on::after{transform:translateX(26px)}
[data-theme=dark] .row button.sw{background:rgba(255,255,255,.25)}
[data-theme=dark] .row button.sw.on{background:currentColor}
@media (prefers-reduced-motion:reduce){.row button.sw,.row button.sw::after{transition:none}}
.r1{background:#e6f9f0;color:#15803d}.r2{background:#fde1e6;color:#d81b45}
.r3{background:#f3f3f3;color:#5f5f5f}.r4{background:#e8eafd;color:#4350d8}
.r5{background:#f1e9fc;color:#7c3aed}.r6{background:#fdf6e3;color:#a16207}
[data-theme=dark] .r1{background:#12301f}[data-theme=dark] .r2{background:#3a1520}[data-theme=dark] .r3{background:#2a2a2a}
[data-theme=dark] .r4{background:#1b1f45}[data-theme=dark] .r5{background:#2a1c47}[data-theme=dark] .r6{background:#3a3115}
[data-theme=dark] .row button{background:rgba(255,255,255,.15)}
[data-theme=dark] .r1{color:#4ade80}[data-theme=dark] .r2{color:#ff7b95}[data-theme=dark] .r3{color:#c4c4c4}
[data-theme=dark] .r4{color:#9aa5ff}[data-theme=dark] .r5{color:#b9a0ff}[data-theme=dark] .r6{color:#f0cc55}
#run{display:none;position:fixed;inset:0;z-index:9;flex-direction:column;align-items:center;color:#fff;padding:calc(env(safe-area-inset-top,0px) + 16px) 14px calc(env(safe-area-inset-bottom,0px) + 20px);overflow-y:auto;transition:background .4s}
#rTitle{font-size:22px;font-weight:700;height:44px;margin:-4px 0 clamp(8px,2dvh,16px);display:flex;align-items:center;justify-content:center;text-align:center;padding:0 52px;white-space:nowrap}
.pan{width:100%;max-width:480px;display:flex;justify-content:space-between;align-items:center;border:2px solid rgba(255,255,255,.25);border-radius:26px;padding:0 20px;height:56px;height:clamp(48px,7dvh,56px);flex:none;margin-bottom:10px;font-size:20px;font-weight:600}
.dots{display:flex;gap:12px;align-items:center}.dots i{font-style:normal;font-size:22px;font-weight:600;min-width:20px;text-align:center;color:#fff;opacity:.35;transition:opacity .3s,transform .3s}.dots i.on{opacity:1;font-weight:800;transform:scale(1.2)}
.ringw{position:relative;flex:none;width:min(80vw,380px);width:clamp(180px,min(80vw,380px,calc(100dvh - 505px)),380px);aspect-ratio:1;margin:auto;container-type:inline-size}
.ringw svg{width:100%;height:100%;transform:rotate(-90deg)}
.mid{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
#rPhase{font-size:22px;font-weight:600;text-transform:uppercase}
#rTime{font-size:64px;font-size:clamp(44px,22cqw,84px);font-weight:700;font-variant-numeric:tabular-nums;line-height:1.1}
#rTotal{font-size:24px;font-weight:600;display:flex;align-items:center;gap:8px}#rTotal small{font-size:13px;font-weight:400;opacity:.8}
#rName{font-size:30px;font-size:clamp(26px,4.6dvh,38px);font-weight:800;text-transform:uppercase;text-align:center;overflow-wrap:anywhere;padding:0 8px}
#rSub{opacity:.85;margin:10px 0 clamp(14px,3dvh,28px);min-height:20px;text-align:center}
.ctl{display:flex;align-items:center;justify-content:space-between;width:100%;max-width:420px}
.ctl .c{background:none;border:0;color:#fff;font-size:18px;width:70px;cursor:pointer;text-align:left}
#rPlay{width:104px;height:104px;width:clamp(84px,13dvh,116px);height:clamp(84px,13dvh,116px);border-radius:50%;border:0;background:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center}
#rPlay svg{width:46px;height:46px;fill:currentColor}
#rSkip{width:70px;height:70px;border-radius:50%;border:0;background:rgba(255,255,255,.25);cursor:pointer;display:flex;align-items:center;justify-content:center}
#done{display:none;position:fixed;inset:0;z-index:20;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:#fff;padding:24px;
background:radial-gradient(circle at 50% 35%,#34d399,#0ea5e9 70%,#6366f1);animation:dfade .5s ease both}
#cf{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.medal{width:150px;height:150px;border-radius:50%;background:rgba(255,255,255,.2);display:flex;align-items:center;justify-content:center;
position:relative;animation:dpop .7s cubic-bezier(.2,1.6,.4,1) .15s both}
.medal::before{content:"";position:absolute;inset:-14px;border-radius:50%;border:3px solid rgba(255,255,255,.5);animation:dpulse 1.8s ease-out .8s infinite}
.medal svg{width:84px;height:84px}
.medal path{stroke-dasharray:60;stroke-dashoffset:60;animation:dcheck .6s ease .75s forwards}
#done h2{font-size:36px;font-weight:800;margin:28px 0 8px;letter-spacing:.5px;animation:dup .6s ease .5s both}
#done p{margin:0;font-size:18px;opacity:.95;animation:dup .6s ease .7s both}
#dStats{display:flex;gap:12px;margin:26px 0 34px;animation:dup .6s ease .9s both}
#dStats div{background:rgba(255,255,255,.2);border-radius:18px;padding:12px 18px;min-width:84px}
#dStats b{display:block;font-size:26px;font-variant-numeric:tabular-nums}
#dStats span{font-size:13px;opacity:.9}
#dDone{border:0;border-radius:30px;background:#fff;color:#0ea5e9;font-size:18px;font-weight:700;padding:16px 56px;cursor:pointer;animation:dup .6s ease 1.1s both;position:relative}
#bkp{display:none;position:fixed;inset:0;z-index:30;background:rgba(0,0,0,.5);align-items:center;justify-content:center;padding:24px}
.bkp-box{background:var(--bg);color:var(--tx);border-radius:22px;padding:26px 22px;max-width:340px;width:100%;text-align:center;box-shadow:0 12px 40px rgba(0,0,0,.35);animation:up .25s ease-out}
.bkp-box p{font-size:16px;line-height:1.45;margin:0 0 20px}
.bkp-btns{display:flex;gap:10px}
#bkpYes{flex:1;border:0;border-radius:16px;background:#0ea5e9;color:#fff;font-size:16px;font-weight:700;padding:13px 0;cursor:pointer}
#bkpNo{flex:1;border:1px solid var(--bd);border-radius:16px;background:var(--chip);color:var(--tx);font-size:16px;font-weight:600;padding:13px 0;cursor:pointer}
@keyframes dfade{from{opacity:0}to{opacity:1}}
@keyframes dpop{from{transform:scale(0)}to{transform:scale(1)}}
@keyframes dcheck{to{stroke-dashoffset:0}}
@keyframes dpulse{from{transform:scale(.9);opacity:1}to{transform:scale(1.35);opacity:0}}
@keyframes dup{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){#done,#done *,.medal::before{animation-duration:.01s!important;animation-delay:0s!important;animation-iteration-count:1!important}}
.ctl{display:grid;grid-template-columns:1fr 1fr auto 1fr 1fr;align-items:center;justify-items:center}.ctl .c{width:auto;justify-self:start}#rPrev,#rSkip{width:64px;height:64px}#rPrev{border-radius:50%;border:0;background:rgba(255,255,255,.25);cursor:pointer;display:flex;align-items:center;justify-content:center}
#wk{font-size:14px;opacity:.9;margin-top:4px;min-height:20px}
.sug{background:var(--chip);border-radius:16px;padding:12px 14px;margin-bottom:14px;font-size:14px;line-height:1.4}.sug b{display:block;margin-bottom:2px}.sug .btn{margin:8px 8px 0 0}
#lockBtn{position:absolute;right:14px;top:calc(env(safe-area-inset-top,0px) + 12px);width:44px;height:44px;border-radius:50%;border:0;background:rgba(255,255,255,.25);color:#fff;font-size:20px;cursor:pointer;padding:0}
#lk{display:none;position:fixed;inset:0;z-index:15;background:rgba(0,0,0,.12);color:#fff;touch-action:none;-webkit-user-select:none;user-select:none}
#lkHold{position:absolute;right:14px;top:calc(env(safe-area-inset-top,0px) + 12px);width:44px;height:44px;border:0;border-radius:50%;background:rgba(0,0,0,.35);color:#fff;padding:0;touch-action:none;font-size:20px}
#lkHint{position:absolute;right:14px;top:calc(env(safe-area-inset-top,0px) + 66px);padding:8px 12px;border-radius:14px;background:rgba(0,0,0,.55);font-size:13px;line-height:1.3;max-width:70vw;opacity:0;pointer-events:none}
#lkHint.show{animation:lkToastIn .3s ease forwards}
@keyframes lkToastIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){#lkHint.show{animation:none;opacity:1}}
.fi{width:1.15em;height:1.15em;vertical-align:-.22em;fill:currentColor;flex:none}
.row .ic .g{fill:var(--bg)}.row .ic .s{fill:none;stroke:var(--bg);stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
#menu .fi,#lockBtn .fi,#lkHold>.fi{width:22px;height:22px;vertical-align:middle}
/* Popup / menu */
.ov{display:none;overscroll-behavior:contain;position:fixed;inset:0;z-index:20;background:rgba(0,0,0,.5);align-items:flex-end;justify-content:center}
.box{background:var(--bg);color:var(--tx);width:100%;max-width:480px;height:84vh;height:84dvh;max-height:calc(100dvh - env(safe-area-inset-top,0px) - 20px);border-radius:28px 28px 0 0;display:flex;flex-direction:column;padding-bottom:env(safe-area-inset-bottom,0px);box-shadow:0 -8px 30px rgba(0,0,0,.25);animation:up .24s ease-out}
.box::before{content:"";flex:none;width:40px;height:5px;border-radius:3px;background:var(--bd);margin:9px auto 0}
.box.sm{height:auto}
@keyframes up{from{transform:translateY(28px);opacity:0}}
@media (prefers-reduced-motion:reduce){.box{animation:none}}
.mh{flex:none;display:flex;justify-content:space-between;align-items:center;padding:10px 18px 10px;font-size:22px;font-weight:700}
.mh button{border:0;background:var(--chip);color:var(--tx);width:40px;height:40px;border-radius:50%;font-size:16px;cursor:pointer}
.tabs{flex:none;display:flex;flex-wrap:nowrap;gap:4px;padding:0 12px 12px;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.tabs::-webkit-scrollbar{display:none}
.tabs .tb{flex:1 0 auto;text-align:center;padding:10px 7px;font-size:13.5px;font-weight:600}
.tb,.btn{border:0;background:var(--chip);color:var(--tx);border-radius:12px;padding:9px 13px;min-height:38px;font-size:14px;cursor:pointer;white-space:nowrap}
.tb.on,.btn.p{background:#f2284f;color:#fff}
.btn{margin:6px 6px 0 0}
#mb{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:6px 18px 22px;font-size:15px;line-height:1.55}
html.lock,html.lock body{overflow:hidden}
#mb a{color:#f2284f;font-weight:600;text-decoration:none}#mb p{margin:10px 0}#mb ul{padding-left:20px;margin:6px 0}
.st{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:6px 0 8px}
.st div{background:var(--chip);border-radius:12px;padding:8px 2px;text-align:center;font-size:11px;color:var(--mu)}
.st b{display:block;font-size:19px;color:var(--tx)}
.nav{display:flex;justify-content:space-between;align-items:center;margin:8px 0;font-weight:600}
.nav .btn{margin:0}
.cal{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;text-align:center;font-size:13px}
.cal i{font-style:normal;color:var(--mu);font-size:11px}
.cal b{font-weight:500;padding:9px 0;border-radius:10px;cursor:pointer;background:var(--chip)}
.cal b.n{visibility:hidden}.cal b.t{outline:2px solid #f2284f}
.yr{display:flex;align-items:flex-end;gap:5px;height:160px;margin:8px 0}
.yr div{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;font-size:11px;color:var(--mu);cursor:pointer}
.yr span{width:100%;background:#f2284f;border-radius:6px 6px 0 0;min-height:2px}
.it{border:1px solid var(--bd);border-radius:14px;padding:11px 14px;margin:10px 0}
.it small{display:block;color:var(--mu)}
.it b{font-size:16px}
.ill{display:block;width:100%;max-height:170px;margin:8px auto;color:var(--tx)}
img.ill{max-height:none;height:auto;border-radius:12px}
#rCancel{position:absolute;left:14px;top:calc(env(safe-area-inset-top,0px) + 12px);width:44px;height:44px;border-radius:50%;border:0;background:rgba(255,255,255,.25);color:#fff;padding:0;cursor:pointer;display:flex;align-items:center;justify-content:center}
#rCancel .fi{width:20px;height:20px;vertical-align:middle}
.ctl{display:flex;justify-content:center;align-items:center;gap:24px}
