:root{
  --bg:#F7F7FB; --card:#fff; --ink:#1F2340; --muted:#7A7F9A; --line:#E5E5EF;
  --green:#58CC02; --green-d:#46A302; --red:#FF4B4B; --red-d:#D33131; --orange:#FF9600; --gold:#FFC800; --indigo:#4338CA; --blue:#1CB0F6;
  --c:#58CC02; --cd:#46A302; --r:18px;
  --safe-t:env(safe-area-inset-top,0px); --safe-b:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.45 -apple-system,BlinkMacSystemFont,"SF Pro Rounded","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;-webkit-text-size-adjust:100%}
body{min-height:100dvh;overscroll-behavior-y:none}
button{font:inherit;color:inherit;cursor:pointer;border:0;background:none}
button:disabled{cursor:default}
.ic{width:1.25em;height:1.25em;fill:currentColor;vertical-align:middle;flex:none}
.flame.on{fill:var(--orange)} .flame.on .core{fill:var(--gold)} .flame.off{fill:#C9CBD8} .flame.off .core{fill:#E3E4EC}
.bolt{fill:var(--gold)} .heart.on{fill:var(--red)} .heart.off{fill:#C9CBD8}
.muted{color:var(--muted)}
.card{background:var(--card);border:2px solid var(--line);border-radius:var(--r)}

/* ---------- math ---------- */
.m{font-family:"Times New Roman","STIX Two Math",Cambria,Georgia,serif;font-size:1.12em;white-space:nowrap;letter-spacing:.01em}
.m i{font-style:italic;padding-right:.04em}
.m .fn{font-style:normal;padding-right:.08em}
.m sup,.m sub{font-size:.68em;line-height:0}
.fr{display:inline-flex;flex-direction:column;vertical-align:middle;text-align:center;margin:0 .12em;font-size:.92em}
.fr>.nu{border-bottom:1.5px solid currentColor;padding:0 .2em .05em}
.fr>.de{padding:.05em .2em 0}
.sq{white-space:nowrap}
.sq .rs{font-family:"Times New Roman",serif}
.sq .rd{border-top:1.5px solid currentColor;padding:0 .1em 0 .05em;margin-left:-.02em}
.sq .ri{font-size:.6em;margin-right:-.35em;vertical-align:.9em}

/* ---------- buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.4em;min-height:52px;padding:0 22px;border-radius:16px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;font-size:15px;background:#fff;border:2px solid var(--line);border-bottom-width:5px;color:var(--ink);transition:transform .05s}
.btn:active:not(:disabled){transform:translateY(3px);border-bottom-width:2px;margin-bottom:3px}
.btn.wide{width:100%}
.btn.colored{background:var(--c);border-color:var(--cd);color:#fff}
.btn.good{background:var(--green);border-color:var(--green-d);color:#fff}
.btn.bad{background:var(--red);border-color:var(--red-d);color:#fff}
.btn:disabled{background:#E5E5EF;border-color:#D4D4E0;color:#A3A6BC}
.btn.ghost{background:transparent}
.btn.danger{color:var(--red)}
.iconbtn{display:inline-grid;place-items:center;width:44px;height:44px;border-radius:12px;color:#9AA0B8}
.iconbtn:active{background:#0001}

/* ---------- top bar ---------- */
.topbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:calc(8px + var(--safe-t)) 14px 8px;background:#fffffff2;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);border-bottom:2px solid var(--line)}
.brand{display:flex;align-items:center;gap:6px;font-weight:900;font-size:20px;color:var(--indigo);letter-spacing:-.01em}
.brand .ic{width:26px;height:26px}
.stats{display:flex;align-items:center;gap:4px}
.stat{display:flex;align-items:center;gap:4px;padding:6px 8px;border-radius:12px;font-weight:800;color:var(--muted)}
.stat .ic{width:24px;height:24px}
.stat.streak.lit b{color:var(--orange)}
.stat.xp b{color:#D9A800}
.ring .bg{fill:none;stroke:#E5E5EF;stroke-width:4}.ring .fg{fill:none;stroke:var(--green);stroke-width:4;stroke-linecap:round;transform:rotate(-90deg);transform-origin:center;transition:stroke-dashoffset .6s}
.stat.goal b{font-size:13px}

/* ---------- home ---------- */
.home{max-width:640px;margin:0 auto;padding:16px 16px calc(40px + var(--safe-b))}
.hero{display:flex;gap:16px;align-items:center;padding:16px;margin-bottom:14px}
.hero-flame{position:relative;width:76px;height:76px;flex:none;display:grid;place-items:center}
.hero-flame .ic{width:76px;height:76px}
.hero-flame span{position:absolute;bottom:8px;font-weight:900;color:#fff;font-size:20px;text-shadow:0 1px 2px #0004}
.hero-text h3{margin:0;font-size:20px}
.hero-text p{margin:2px 0 10px;color:var(--muted);font-size:14px}
.week{display:flex;gap:6px}
.day{display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;font-weight:800;color:var(--muted)}
.day i{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#EEF0F6}
.day.on i{background:var(--orange);color:#fff}.day.on i .ic{width:16px;height:16px}
.day.today span{color:var(--orange)}
.install{display:flex;gap:10px;align-items:flex-start;padding:12px 8px 12px 16px;margin-bottom:14px;border-color:#C7D2FE;background:#EEF2FF}
.install p{margin:2px 0 0;font-size:14px;color:#4B5180}
.unit{margin:22px 0 10px}
.unit-banner{display:flex;justify-content:space-between;align-items:center;gap:10px;background:var(--c);color:#fff;border-radius:var(--r);padding:14px 16px;border-bottom:5px solid var(--cd)}
.unit-banner small{font-weight:800;opacity:.85;letter-spacing:.06em;font-size:12px}
.unit-banner h2{margin:2px 0 2px;font-size:19px;line-height:1.2}
.unit-banner p{margin:0;font-size:14px;opacity:.92}
.practice-btn{display:flex;flex-direction:column;align-items:center;gap:2px;flex:none;padding:8px 10px;border-radius:12px;border:2px solid #fff6;font-size:11px;font-weight:800;text-transform:uppercase;color:#fff}
.practice-btn .ic{width:24px;height:24px}
.unit.locked .unit-banner{background:#C9CBD8;border-color:#AFB2C4}
.path{display:flex;flex-direction:column;align-items:center;padding:18px 0 4px;gap:6px}
.node-wrap{position:relative;display:flex;flex-direction:column;align-items:center;width:150px}
.node{width:72px;height:68px;border-radius:50%;display:grid;place-items:center;background:var(--c);color:#fff;border-bottom:7px solid var(--cd);transition:transform .08s}
.node .ic{width:34px;height:34px}
.node:active{transform:translateY(4px);border-bottom-width:3px}
.node.done{background:var(--gold);border-color:#D9A800}
.node.locked{background:#E5E5EF;border-color:#C9CBD8;color:#AFB2C4}
.node.current{box-shadow:0 0 0 6px #fff,0 0 0 10px color-mix(in srgb,var(--c) 35%,transparent);animation:pulse 1.8s ease-in-out infinite}
.node.open{opacity:.9}
.node-label{margin-top:6px;font-size:13px;font-weight:700;color:var(--muted);text-align:center;line-height:1.2;min-height:2.4em}
.start-bubble{position:absolute;top:-34px;background:#fff;color:var(--c);border:2px solid var(--line);font-weight:900;font-size:13px;letter-spacing:.08em;padding:4px 12px;border-radius:10px;animation:bob 1.4s ease-in-out infinite;z-index:1}
.start-bubble::after{content:"";position:absolute;left:50%;bottom:-8px;width:12px;height:12px;background:#fff;border:2px solid var(--line);border-top:0;border-left:0;transform:translateX(-50%) rotate(45deg)}
.path .node-wrap:has(.start-bubble){margin-top:30px}
.foot{text-align:center;color:var(--muted);font-size:13px;margin-top:30px}
@keyframes bob{50%{transform:translateY(-5px)}}
@keyframes pulse{50%{transform:scale(1.05)}}

/* ---------- sheets ---------- */
#sheet-root .scrim{position:fixed;inset:0;background:#0007;z-index:20;opacity:0;transition:opacity .2s}
#sheet-root .sheet{position:fixed;left:0;right:0;bottom:0;z-index:21;max-height:90dvh;overflow:auto;background:#fff;border-radius:24px 24px 0 0;padding:22px 20px calc(20px + var(--safe-b));transform:translateY(100%);transition:transform .25s cubic-bezier(.2,.8,.2,1);max-width:560px;margin:0 auto}
#sheet-root.open .scrim{opacity:1}#sheet-root.open .sheet{transform:none}
.sheet-body{display:flex;flex-direction:column;gap:10px}
.sheet-body small{font-weight:800;color:var(--c);letter-spacing:.06em}
.sheet-body h3{margin:0;font-size:22px;display:flex;align-items:center;gap:8px}
.sheet-body p{margin:0 0 6px;color:#4B5070}
.big-flame{position:relative;align-self:center;width:110px;height:110px;display:grid;place-items:center}
.big-flame .ic{width:110px;height:110px}.big-flame span{position:absolute;bottom:14px;color:#fff;font-weight:900;font-size:28px;text-shadow:0 1px 2px #0004}
.goalbar{height:16px;border-radius:9px;background:#E5E5EF;overflow:hidden}.goalbar div{height:100%;background:var(--gold);border-radius:9px;transition:width .6s}
.settings h4{margin:8px 0 0}
.statgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.statgrid div{border:2px solid var(--line);border-radius:14px;padding:10px;text-align:center}
.statgrid b{display:block;font-size:22px}.statgrid span{font-size:12px;color:var(--muted);font-weight:700}
.goalpick{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.chip{border:2px solid var(--line);border-bottom-width:4px;border-radius:14px;padding:10px;text-align:left;display:flex;flex-direction:column}
.chip span{font-size:13px;color:var(--muted)}
.chip.sel{border-color:var(--blue);background:#DDF4FF}
.toggle{display:flex;justify-content:space-between;align-items:center;padding:12px 0;border-bottom:2px solid var(--line);font-weight:700}
.toggle small{display:block;font-weight:500;color:var(--muted);font-size:13px}
.toggle input{width:48px;height:28px;accent-color:var(--green)}

/* ---------- lesson ---------- */
.lesson{display:flex;flex-direction:column;min-height:100dvh;max-width:720px;margin:0 auto}
.lbar{display:flex;align-items:center;gap:12px;padding:calc(10px + var(--safe-t)) 14px 10px}
.progress{flex:1;height:18px;border-radius:10px;background:#E5E5EF;overflow:hidden}
.progress div{height:100%;background:var(--green);border-radius:10px;transition:width .4s;box-shadow:inset 0 -4px 0 #0001,inset 0 4px 0 #fff4}
.hearts{display:flex;align-items:center;gap:4px;font-weight:900;color:var(--red)}.hearts .ic{width:28px;height:28px}
.shake{animation:shake .4s}@keyframes shake{25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}
.lmain{flex:1;padding:8px 18px 18px;display:flex;flex-direction:column}
.lfoot{position:sticky;bottom:0;padding:14px 18px calc(14px + var(--safe-b));border-top:2px solid var(--line);background:var(--bg)}
.qwrap{display:flex;flex-direction:column;gap:14px;padding-top:6px}
.qtype{font-size:13px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--c)}
.prompt{font-size:22px;font-weight:800;line-height:1.3}
.big{font-size:28px;text-align:center;padding:22px 12px;background:#fff;border:2px solid var(--line);border-radius:var(--r);overflow-x:auto}
.big .m{font-size:1.1em}
.choices{display:grid;gap:10px}
@media (min-width:600px){.choices:not(.long){grid-template-columns:1fr 1fr}}
.choice{display:flex;align-items:center;gap:12px;text-align:left;padding:14px;min-height:60px;border:2px solid var(--line);border-bottom-width:4px;border-radius:16px;background:#fff;font-size:18px}
.choice .kbd{display:grid;place-items:center;flex:none;width:28px;height:28px;border:2px solid var(--line);border-radius:8px;font-size:13px;font-weight:800;color:var(--muted)}
.choice.sel{border-color:var(--blue);background:#DDF4FF}.choice.sel .kbd{border-color:var(--blue);color:var(--blue)}
.choice.right{border-color:var(--green);background:#D7FFB8}
.choice.wrong{border-color:var(--red);background:#FFDFE0}
.choice .ct{flex:1;white-space:normal}
.answer input{width:100%;font-size:24px;padding:14px 16px;border:2px solid var(--line);border-radius:16px;background:#fff;color:var(--ink);outline:none;font-family:inherit}
.answer input:focus{border-color:var(--blue)}
.answer input.right{border-color:var(--green);background:#D7FFB8}.answer input.wrong{border-color:var(--red);background:#FFDFE0}
.keys{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.key{min-width:48px;height:46px;padding:0 12px;border:2px solid var(--line);border-bottom-width:4px;border-radius:12px;background:#fff;font-size:20px;font-weight:700;font-family:"Times New Roman",serif}
.key:active{transform:translateY(2px);border-bottom-width:2px}
.hint{margin-top:10px;font-size:14px;color:var(--muted)}
.concept{padding:20px;display:flex;flex-direction:column;gap:6px}
.concept .tag{font-size:12px;font-weight:900;letter-spacing:.08em;color:var(--c);display:flex;align-items:center;gap:6px}
.concept h2{margin:0;font-size:26px}
.concept p{font-size:18px;margin:4px 0 8px}
.example{background:#F4F5FA;border-radius:14px;padding:14px 16px}
.example small{font-weight:900;letter-spacing:.08em;color:var(--muted);font-size:12px}
.ex-q{font-size:20px;margin:6px 0}
.example ol{margin:6px 0 0;padding-left:22px;font-size:17px}.example li{margin:4px 0}
.feedback{display:flex;flex-direction:column;gap:8px;animation:up .2s ease-out}
@keyframes up{from{transform:translateY(20px);opacity:0}}
.lfoot:has(.feedback.good){background:#D7FFB8;border-color:#B8F28B}
.lfoot:has(.feedback.bad){background:#FFDFE0;border-color:#FFC1C1}
.fb-head{display:flex;align-items:center;gap:8px;font-size:22px}
.feedback.good .fb-head{color:var(--green-d)}.feedback.bad .fb-head{color:var(--red-d)}
.fb-head .ic{width:30px;height:30px;padding:4px;border-radius:50%;background:#fff;fill:currentColor}
.fb-ans{font-weight:800;color:var(--red-d);font-size:18px}
.fb-ex{color:#5B3A3A;font-size:16px;line-height:1.5}
.feedback.good .fb-ex{color:#3B6B12}
.fb-why summary{cursor:pointer;color:var(--green-d);font-weight:700}
.endcard{display:flex;flex-direction:column;align-items:center;text-align:center;gap:12px;padding-top:20px}
.endcard h2{margin:0;font-size:30px;color:var(--orange)}
.endcard.done h2{color:#D9A800}
.trophy .ic{width:110px;height:110px;fill:var(--gold);filter:drop-shadow(0 6px 0 #D9A800);animation:pop .5s cubic-bezier(.3,1.6,.5,1)}
@keyframes pop{from{transform:scale(.3)}}
.big-heart .ic{width:100px;height:100px}
.unlock{background:#EEF2FF;color:var(--indigo);padding:8px 14px;border-radius:12px;margin:0}
.tiles{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;width:100%;max-width:440px}
.tile{border:2px solid var(--gold);border-radius:16px;overflow:hidden;background:#fff}
.tile small{display:block;background:var(--gold);color:#fff;font-weight:900;font-size:11px;letter-spacing:.06em;padding:4px}
.tile div{display:flex;align-items:center;justify-content:center;gap:4px;padding:10px 4px;font-size:20px}
.tile.acc{border-color:var(--green)}.tile.acc small{background:var(--green)}
.tile.time{border-color:var(--blue)}.tile.time small{background:var(--blue)}
.streak-card{display:flex;align-items:center;gap:12px;width:100%;max-width:440px;padding:12px 16px;border:2px solid var(--line);border-radius:16px;background:#fff;text-align:left}
.streak-card .ic{width:48px;height:48px}.streak-card b{display:block;font-size:20px}.streak-card span{color:var(--muted);font-size:14px}
.streak-card.extended{border-color:var(--orange);background:#FFF4E5}.streak-card.extended .ic{animation:pop .6s cubic-bezier(.3,1.6,.5,1)}
.goal-card{width:100%;max-width:440px;padding:12px 16px;border:2px solid var(--line);border-radius:16px;background:#fff;text-align:left}
.goal-top{display:flex;justify-content:space-between;margin-bottom:8px;font-weight:700}
.goalhit{margin:8px 0 0;color:#B8860B;font-weight:800}
#confetti{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none;z-index:50;display:none}

/* ---------- larger screens (iPad / Mac) ---------- */
@media (min-width:768px){
  .home{padding-top:24px}
  .prompt{font-size:26px}.big{font-size:34px}
  .lmain{padding:20px 32px}
  .lfoot{padding-left:32px;padding-right:32px}
  .lfoot .btn.wide{max-width:none}
}
@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}
html,body{overflow-x:clip}
.home{overflow-x:clip}
@media (max-width:430px){.topbar:has(.stats) .brand span{display:none}.stat{padding:6px 5px}}
.sum{display:inline-flex;flex-direction:column;align-items:center;vertical-align:middle;line-height:1;margin-right:.15em}
.sum .sg{font-size:1.5em;line-height:1}.sum .up,.sum .lo{font-size:.6em}

/* ---------- jump to topic ---------- */
.jump{padding:14px;margin-bottom:6px;display:flex;flex-direction:column;gap:10px}
.jump-head{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.jump-head b{font-size:17px}
.upnext{background:var(--c);color:#fff;font-weight:800;font-size:13px;padding:7px 12px;border-radius:12px;border-bottom:3px solid var(--cd);max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search input{width:100%;font-size:16px;padding:12px 14px 12px 40px;border:2px solid var(--line);border-radius:14px;background:#F4F5FA url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239AA0B8'%3E%3Cpath d='M10 2a8 8 0 0 1 6.300 12.900l5.400 5.400-1.400 1.400-5.400-5.400A8 8 0 1 1 10 2zm0 2a6 6 0 1 0 0 12 6 6 0 0 0 0-12z'/%3E%3C/svg%3E") 12px center/20px no-repeat;color:var(--ink);outline:none;-webkit-appearance:none;appearance:none}
.search input:focus{border-color:var(--blue);background-color:#fff}
.results{display:flex;flex-direction:column;gap:6px}
.results:empty{display:none}
.hit{display:flex;align-items:center;gap:10px;text-align:left;padding:10px 12px;border:2px solid var(--line);border-bottom-width:4px;border-radius:14px;background:#fff}
.hit b{display:block;font-size:15px}.hit small{color:var(--muted);font-size:13px}
.hit .dot{flex:none;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--c);color:#fff}
.hit .dot.done{background:var(--green);color:#fff}.hit .dot .ic{width:16px;height:16px}
.none{margin:0;font-size:14px}
.unit-chips{display:flex;gap:8px;overflow-x:auto;scroll-snap-type:x proximity;padding-bottom:4px;margin:0 -14px;padding-left:14px;padding-right:14px;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.unit-chips::-webkit-scrollbar{display:none}
.uchip{flex:none;scroll-snap-align:start;display:flex;align-items:center;gap:8px;max-width:230px;padding:8px 12px 8px 8px;border:2px solid var(--line);border-bottom-width:4px;border-radius:14px;background:#fff;text-align:left}
.uchip .un{display:grid;place-items:center;flex:none;width:28px;height:28px;border-radius:9px;background:var(--c);color:#fff;font-weight:900;font-size:14px}
.uchip .ut{font-weight:700;font-size:14px;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.uchip .up{flex:none;font-size:12px;font-weight:800;color:var(--muted)}
.uchip.full .up{color:#D9A800}
@media (min-width:768px){.unit-chips{flex-wrap:wrap;overflow:visible}.uchip{max-width:none}}
.unit{scroll-margin-top:70px}

/* ---------- v3: deep dives, gems, practice mode, feedback ---------- */
.gem .g1{fill:#9B5DE5}.gem .g2{fill:#7B3FC4}.gem .g3{fill:#C8A2FF}
.node{position:relative}
.gem-badge{position:absolute;right:-6px;top:-6px;width:28px;height:28px;border-radius:50%;background:#fff;display:grid;place-items:center;box-shadow:0 1px 3px #0003}
.gem-badge .ic{width:20px;height:20px}
.btn.small{min-height:40px;padding:0 14px;font-size:13px;border-bottom-width:4px}
.btn.gembtn{background:#9B5DE5;border-color:#7B3FC4;color:#fff}
.btn.gembtn .ic .g1,.btn.gembtn .ic .g2,.btn.gembtn .ic .g3{fill:#fff}.btn.gembtn .ic .g2{opacity:.8}.btn.gembtn .ic .g3{opacity:.6}
.btn.ghostgem{background:#F3EBFF;color:#6B2FB8;border-color:#D9C2FF}
.btn.ghostgem .ic .g1,.btn.ghostgem .ic .g2,.btn.ghostgem .ic .g3{fill:currentColor}
.btn.deepbtn{color:#6B2FB8;border-color:#D9C2FF;background:#F8F3FF;margin-bottom:10px}
.lfoot .btn.deepbtn{text-transform:none;letter-spacing:0}
.modebar{display:flex;align-items:center;justify-content:center;gap:6px;margin:0 14px;padding:6px 10px;border-radius:12px;background:#F3EBFF;color:#6B2FB8;font-weight:800;font-size:13px}
.modebar .ic{width:18px;height:18px}
.mode-free .modebar{background:#E6F6FF;color:#1477A8}
.mode-challenge .qtype,.mode-free .qtype{color:#7B3FC4}
.freecount{display:flex;align-items:center;gap:4px;font-weight:900;color:var(--green-d)}
.freecount .ic{width:24px;height:24px}
.trophy.gemwin .ic{fill:none;filter:drop-shadow(0 6px 0 #5E2A9E)}
.gemnote{background:#F3EBFF;color:#6B2FB8}
/* deep dive page */
.deep{max-width:760px;margin:0 auto;min-height:100dvh}
.dbar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:10px;padding:calc(8px + var(--safe-t)) 12px 10px;background:var(--c);color:#fff;border-bottom:5px solid var(--cd)}
.dbar .iconbtn{color:#fff}
.dbar small{font-weight:800;letter-spacing:.08em;opacity:.85;font-size:12px}
.dbar h1{margin:0;font-size:22px;line-height:1.15}
.dbar>div:nth-child(2){flex:1;min-width:0}
.gemstat{flex:none;width:44px;height:44px;border-radius:50%;background:#fff3;display:grid;place-items:center}
.gemstat .ic{width:30px;height:30px;opacity:.45;filter:grayscale(1)}
.gemstat.on{background:#fff}.gemstat.on .ic{opacity:1;filter:none}
.dmain{padding:14px 14px calc(30px + var(--safe-b));display:flex;flex-direction:column;gap:12px}
.dcard{background:#fff;border:2px solid var(--line);border-radius:var(--r);padding:16px}
.dcard h2{margin:0 0 8px;font-size:18px;display:flex;align-items:center;gap:8px}
.dcard h2 .ic{width:22px;height:22px;color:var(--c)}
.dcard p{margin:0 0 10px;font-size:16px;line-height:1.55}
.dcard ul{margin:0;padding-left:20px}.dcard li{margin:6px 0;line-height:1.5}
.dcard.warn{border-color:#FFD7A8;background:#FFF8EF}
.dcard.challenge{border-color:#D9C2FF;background:#FBF8FF}
.links{display:flex;flex-direction:column;gap:8px}
.linkrow{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.linkchip{display:inline-flex;align-items:center;gap:6px;padding:6px 10px 6px 6px;border:2px solid var(--line);border-bottom-width:4px;border-radius:12px;background:#fff;font-weight:700;font-size:14px}
.linkchip span{background:var(--c);color:#fff;border-radius:7px;padding:2px 6px;font-size:12px;font-weight:900}
.wex{border:2px solid var(--line);border-radius:14px;padding:12px;margin-top:10px;background:#FAFAFD}
.wex-q{display:flex;gap:10px;align-items:baseline;font-size:17px;font-weight:600}
.wex-q .num{flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;background:var(--c);color:#fff;font-size:14px;font-weight:900}
.steps{margin:8px 0 10px;padding-left:28px;font-size:16px}
.steps li{margin:6px 0}
.steps li.pop{animation:up .25s ease-out}
.reveal.done{background:#EEF0F6}
.twobtn{display:grid;grid-template-columns:1fr 1fr;gap:10px}
/* feedback */
.fbtypes{display:flex;flex-wrap:wrap;gap:8px}
.fbtype{flex-direction:row;padding:8px 12px;font-weight:700}
.fl{font-weight:700;margin-top:4px}.fl small{color:var(--muted);font-weight:500}
.stars{display:flex;gap:6px}
.star{width:44px;height:44px;display:grid;place-items:center;border-radius:10px}
.star .ic{width:32px;height:32px;fill:#E1E3EC}
.star.on .ic{fill:var(--gold)}
.fbform textarea,.fbform input[type=email],.quickfb textarea{width:100%;font:inherit;font-size:16px;padding:12px;border:2px solid var(--line);border-radius:14px;outline:none;background:#fff;color:var(--ink);resize:vertical}
.fbform textarea:focus,.fbform input:focus,.quickfb textarea:focus{border-color:var(--blue)}
.ctxline{display:flex;gap:8px;align-items:flex-start;font-size:14px;color:var(--muted)}
.ctxline input{width:20px;height:20px;accent-color:var(--green);flex:none}
.fberr{color:var(--red-d);font-weight:700;margin:0}
.thanks{text-align:center;padding:10px 0}
.thanks .ic{width:56px;height:56px;animation:pop .5s cubic-bezier(.3,1.6,.5,1)}
.thanks h3{justify-content:center;margin:6px 0}
.thanks p{color:var(--muted);margin:0}
.quickfb{width:100%;max-width:440px;padding:12px 16px;border:2px solid var(--line);border-radius:16px;background:#fff;text-align:left;display:flex;flex-direction:column;gap:10px}
.thumbs{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.thumb{width:48px;height:44px;display:grid;place-items:center;border:2px solid var(--line);border-bottom-width:4px;border-radius:12px;background:#fff;color:#9AA0B8}
.thumb .ic{width:24px;height:24px}
.thumb.down .ic{transform:scaleY(-1)}
.thumb.sel{color:#fff;background:var(--blue);border-color:#1899D6}
.thumb.down.sel{background:var(--orange);border-color:#CC7A00}
.qchip{flex-direction:row;padding:8px 12px;font-weight:700;font-size:14px}
.qmore{display:flex;flex-direction:column;gap:8px}
.qmore .btn{align-self:flex-end}
.small{font-size:13px}.ver{text-align:center;margin:0}
.statgrid{grid-template-columns:repeat(4,1fr)}

/* ---------- v4: Sunday→Saturday week strip, scratch pad ---------- */
.day.future i{background:transparent;border:2px dashed #DADDE8;width:22px;height:22px}
.day.today i{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--orange)}
.weekbox{display:flex;flex-direction:column;align-items:center;gap:8px;margin:4px 0 14px;padding:12px;border:2px solid var(--line);border-radius:16px}
.weekbox small{font-weight:800;letter-spacing:.08em;color:var(--muted);font-size:12px}
.weekbox .week{gap:10px}
.qarea{display:flex;flex-direction:column;gap:16px}
.scratch{background:#fff;border:2px solid var(--line);border-radius:var(--r);overflow:hidden;transition:box-shadow .3s}
.scratch.flash{box-shadow:0 0 0 4px var(--blue)}
.shead{display:flex;align-items:center;gap:6px;padding:6px 8px;flex-wrap:wrap}
.padtoggle{display:flex;align-items:center;gap:6px;padding:8px 6px;font-weight:800;font-size:15px;color:var(--ink);margin-right:auto;min-height:40px}
.padtoggle .ic{width:20px;height:20px}.padtoggle .ic:first-child{color:var(--c)}
.padtoggle .chev{transition:transform .2s;color:var(--muted)}
.scratch.open .padtoggle .chev{transform:rotate(180deg)}
.stools{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.scratch:not(.open) .stools{display:none}
.sbtn{width:40px;height:40px;display:grid;place-items:center;border-radius:10px;color:#5A607A;border:2px solid transparent}
.sbtn .ic{width:22px;height:22px}
.sbtn.sel{background:#E6F6FF;color:#1477A8;border-color:#B6E3FA}
.sbtn:disabled{opacity:.35}
.sbtn.finger.sel{background:#FFF1DC;color:#B86A00;border-color:#FFD7A8}
.sdiv{width:2px;height:24px;background:var(--line);margin:0 2px}
.swatch{width:30px;height:30px;border-radius:50%;background:var(--sw);border:3px solid #fff;box-shadow:0 0 0 2px var(--line);margin:0 3px}
.swatch.sel{box-shadow:0 0 0 3px var(--sw)}
.pbody{border-top:2px solid var(--line)}
.pad{position:relative;height:260px;background:#FFFEF8;background-image:radial-gradient(#DCDFEA 1px,transparent 1.2px);background-size:22px 22px;
  touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;overscroll-behavior:contain}
.pad canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;cursor:crosshair}
.pempty{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);margin:0;text-align:center;color:#B4B8CA;font-weight:600;font-size:14px;pointer-events:none;padding:0 20px}
.pad.has-ink .pempty{display:none}
.linkbtn{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;font-weight:800;color:inherit;opacity:.85;padding:4px 0}
.linkbtn .ic{width:18px;height:18px}
.feedback.good .linkbtn{color:var(--green-d)}.feedback.bad .linkbtn{color:var(--red-d)}
/* iPad portrait / small Mac windows: pad below the question, taller */
@media (min-width:600px){.pad{height:360px}}
/* iPad landscape / Mac: pad beside the question */
@media (min-width:960px){
  .lesson.pad-open{max-width:1180px}
  .lesson.pad-open .qarea{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);align-items:start;gap:24px}
  .lesson.pad-open .scratch{position:sticky;top:12px}
  .lesson.pad-open .pad{height:calc(100dvh - 300px);min-height:380px}
  .lesson.pad-open .choices:not(.long){grid-template-columns:1fr}
}
.sbtn[hidden]{display:none}
@media (max-width:430px){.sbtn{width:36px;height:38px}.swatch{width:26px;height:26px}.stools{width:100%;justify-content:space-between}}

/* ---------- legal pages (privacy, terms) and in-app legal links ---------- */
a.brand{text-decoration:none;color:var(--indigo)}
.legal-top-link{font-weight:800;font-size:14px;color:var(--indigo);text-decoration:none;padding:8px 4px}
.legal-top-link:hover{text-decoration:underline}
.legal{max-width:640px;margin:0 auto;padding:24px 16px calc(40px + var(--safe-b))}
.legal-kicker{margin:0 0 6px;font-weight:800;letter-spacing:.08em;font-size:12px;color:var(--indigo)}
.legal h1{margin:0 0 8px;font-size:28px;line-height:1.2;letter-spacing:-.02em}
.legal .effective{margin:0 0 20px}
.legal .card{padding:18px 18px 6px;margin-bottom:14px}
.legal h2{margin:0 0 8px;font-size:18px;color:var(--indigo)}
.legal p,.legal li{margin:0 0 12px;color:#4B5070;font-size:16px;line-height:1.55}
.legal ul{margin:0 0 12px;padding-left:20px}
.legal .placeholder{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.95em;background:#EEF2FF;color:var(--indigo);padding:1px 6px;border-radius:6px}
.legal-nav{text-align:center;margin:18px 0 0}
.legal-nav a,.legal-links a{color:var(--indigo);font-weight:700;text-decoration:none}
.legal-nav a:hover,.legal-links a:hover{text-decoration:underline}
.foot p{margin:0 0 8px}
.foot .legal-links{margin:0}
.settings .legal-links{margin:0;text-align:center}
