
/* Layout: notebook-paper app shell; one column of focused cards, highlighter-yellow as the "you did it" color, coral for action, mint for correct. */
:root{
  /* QuizRips palette: cobalt blue, dark navy, gold, white, purple accents. */
  --paper:#0F1838; --surface:#1A2650; --surface-2:#24336A; --ink:#F4F6FF; --muted:#A6B2D6; --line:#36477E;
  --hi:#FFD23F; --hi-ink:#2A2100; --pop:#2D5BFF; --pop-ink:#FFFFFF; --go:#0FA97A; --go-soft:#123E35; --bad:#FF5A64; --bad-soft:#47202A; --sky:#4FA3FF; --sky-soft:#18306A;
  --violet:#7B3FF2; --lightbg:#F8FAFF;
  --m0:#5A4A10; --m1:#164A39; --m2:#23346A; --m3:#5A2232; --m4:#3E2C66;
  --shadow:0 1px 0 rgba(0,0,0,.25),0 12px 28px -14px rgba(0,0,0,.75);
  --f-display:"Bricolage Grotesque","Figtree",system-ui,sans-serif;
  --f-brand:"Shrikhand","Bricolage Grotesque",system-ui,sans-serif;
  --f-body:"Figtree",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-mono:"DM Mono",ui-monospace,Menlo,monospace;
  --f-pen:"Caveat Brush","Comic Sans MS","Marker Felt",cursive;
  --r:18px;
  color-scheme:dark;
}

*{box-sizing:border-box}
body{background-color:var(--paper);color:var(--ink);font-family:var(--f-body);font-size:16px;line-height:1.5;-webkit-font-smoothing:antialiased;
  background-image:radial-gradient(900px 500px at 50% -160px,rgba(123,63,242,.28),transparent 65%),radial-gradient(circle at 1px 1px,rgba(163,173,200,.09) 1px,transparent 0);background-size:100% 100%,22px 22px;background-repeat:no-repeat,repeat}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:30;background:var(--surface)}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:3px solid var(--sky);outline-offset:2px;border-radius:10px}
h1,h2,h3{font-family:var(--f-display);line-height:1.08;text-wrap:balance;margin:0;letter-spacing:-.01em}
.wrap{max-width:980px;margin:0 auto;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.eyebrow{font-size:12px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--muted)}
.mono{font-family:var(--f-mono);font-variant-numeric:tabular-nums}
.hl{background:linear-gradient(transparent 55%,var(--hi) 55%,var(--hi) 92%,transparent 92%);padding:0 .08em;color:inherit}

/* header */
.top{position:sticky;top:env(safe-area-inset-top,0px);z-index:20;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
.top .wrap{display:flex;align-items:center;gap:12px;padding-block:10px}
.logo{display:flex;align-items:center;gap:8px;font-family:var(--f-display);font-weight:800;font-size:20px;background:none;border:0;padding:4px 2px}
.logo svg{flex:none}
.tabs{display:flex;gap:4px;margin-left:8px}
.tab{border:0;background:none;padding:8px 12px;border-radius:999px;font-weight:700;color:var(--muted)}
.tab[aria-current="page"]{background:var(--surface-2);color:var(--ink)}
.spacer{flex:1}
.iconbtn{width:40px;height:40px;border-radius:12px;border:1px solid var(--line);background:var(--surface);display:grid;place-items:center}
.chip-player{display:flex;align-items:center;gap:10px;border:1px solid var(--line);background:var(--surface);border-radius:999px;padding:4px 12px 4px 4px;min-width:0}
.chip-player .meta{display:flex;flex-direction:column;align-items:flex-start;min-width:0;line-height:1.15}
.chip-player .nm{font-weight:800;font-size:14px;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chip-player .lv{font-size:11px;color:var(--muted);font-weight:700}
.xpbar{width:72px;height:5px;border-radius:9px;background:var(--surface-2);overflow:hidden;margin-top:3px}
.xpbar i{display:block;height:100%;background:var(--hi);border-radius:9px;transition:width .6s cubic-bezier(.2,.9,.3,1.2)}
.av{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:800;font-size:14px;flex:none;font-family:var(--f-display)}
@media (max-width:620px){.tabs{display:none}.chip-player .meta{display:none}.chip-player{padding:4px}.logo span{font-size:18px}}
.bottomnav{display:none}
@media (max-width:620px){
  .bottomnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--surface);border-top:1px solid var(--line);
    padding:6px max(16px,env(safe-area-inset-right,0px)) calc(6px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));gap:6px}
  .bottomnav .tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:12px;padding:6px}
  main{padding-bottom:80px}
  body.playing .bottomnav{display:none}
}

main{padding-block:24px 64px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:0;border-radius:14px;padding:12px 18px;font-weight:800;font-size:16px;
  background:var(--surface-2);color:var(--ink);transition:transform .12s ease,box-shadow .12s ease,background .2s;position:relative}
.btn:active{transform:translateY(2px) scale(.98)}
.btn.primary{background:var(--pop);color:var(--pop-ink);box-shadow:0 4px 0 color-mix(in srgb,var(--pop) 60%,#000)}
.btn.primary:active{box-shadow:0 1px 0 color-mix(in srgb,var(--pop) 60%,#000)}
.btn.yellow{background:var(--hi);color:var(--hi-ink);box-shadow:0 4px 0 color-mix(in srgb,var(--hi) 55%,#000)}
.btn.ghost{background:transparent;border:1.5px solid var(--line)}
.btn.big{padding:16px 24px;font-size:18px;border-radius:18px}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow)}
.muted{color:var(--muted)}
.row{display:flex;gap:12px;flex-wrap:wrap;align-items:center}

/* home */
.hero{display:grid;grid-template-columns:1.05fr 1fr;gap:28px;align-items:center;margin-bottom:36px}
@media (max-width:820px){.hero{grid-template-columns:1fr;gap:18px}}
.hero h1{font-size:clamp(34px,6vw,56px);font-weight:800;letter-spacing:-.025em}
.hero p.lede{font-size:18px;color:var(--muted);max-width:44ch;margin:14px 0 0}
.stats{display:flex;gap:10px;margin-top:20px;flex-wrap:wrap}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:8px 14px;display:flex;align-items:center;gap:8px;font-weight:700}
.stat b{font-family:var(--f-mono);font-size:18px}
.drop{padding:20px;display:flex;flex-direction:column;gap:14px;position:relative}
.dz{border:2.5px dashed color-mix(in srgb,var(--sky) 55%,var(--line));border-radius:14px;padding:26px 16px;text-align:center;background:var(--sky-soft);transition:transform .15s,background .15s;display:flex;flex-direction:column;align-items:center;gap:10px}
.dz.over{transform:scale(1.02);background:color-mix(in srgb,var(--hi) 35%,var(--sky-soft))}
.dz h3{font-size:22px}
.dz .tip{font-size:13px;color:var(--muted);max-width:36ch}
.thumbs{display:flex;gap:10px;flex-wrap:wrap}
.thumb{position:relative;width:76px;height:96px;border-radius:10px;overflow:hidden;border:1px solid var(--line);background:var(--surface-2);animation:pop .3s cubic-bezier(.2,.9,.3,1.4)}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb .x{position:absolute;top:4px;right:4px;width:24px;height:24px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;font-size:14px;display:grid;place-items:center;line-height:1}
.thumb .pg{position:absolute;bottom:4px;left:4px;font-size:11px;font-weight:800;background:rgba(0,0,0,.6);color:#fff;padding:1px 6px;border-radius:6px}
.thumb.add{display:grid;place-items:center;border:2px dashed var(--line);background:none;color:var(--muted);font-weight:800;font-size:28px}
.seg{display:inline-flex;background:var(--surface-2);border-radius:12px;padding:3px;gap:2px}
.seg button{border:0;background:none;padding:7px 12px;border-radius:9px;font-weight:700;color:var(--muted);font-size:14px}
.seg button[aria-pressed="true"]{background:var(--surface);color:var(--ink);box-shadow:var(--shadow)}
textarea{width:100%;min-height:170px;border:1.5px solid var(--line);border-radius:12px;padding:12px;background:var(--paper);resize:vertical;line-height:1.45}
.note{font-size:14px;color:var(--muted);background:var(--surface-2);border-radius:12px;padding:10px 12px}
.note.warn{background:color-mix(in srgb,var(--hi) 28%,var(--surface))}

.sech{display:flex;align-items:end;justify-content:space-between;gap:12px;margin:0 0 14px}
.sech h2{font-size:26px}
.sets{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:14px}
.set{padding:16px;display:flex;flex-direction:column;gap:10px;text-align:left;border:1px solid var(--line);transition:transform .15s,box-shadow .15s;min-width:0}
.set:hover{transform:translateY(-3px) rotate(-.3deg)}
.set h3{font-size:19px;overflow-wrap:anywhere}
.set .foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:auto}
.tag{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:800;padding:3px 9px;border-radius:999px;background:var(--surface-2);color:var(--muted);letter-spacing:.02em}
.tag.sample{background:color-mix(in srgb,var(--hi) 45%,var(--surface));color:var(--hi-ink)}
.gradebadge{font-family:var(--f-pen);font-size:26px;color:var(--pop);line-height:1;transform:rotate(-6deg)}
.empty{padding:28px;text-align:center;color:var(--muted)}

/* generating */
.gen{max-width:520px;margin:30px auto;text-align:center;display:flex;flex-direction:column;align-items:center;gap:18px;padding:28px 20px}
.scan{position:relative;width:180px;height:230px;border-radius:14px;overflow:hidden;background:var(--surface-2);border:1px solid var(--line);box-shadow:var(--shadow)}
.scan img{width:100%;height:100%;object-fit:cover;filter:saturate(.8)}
.scan .doc{position:absolute;inset:18px;display:flex;flex-direction:column;gap:9px}
.scan .doc i{display:block;height:8px;border-radius:4px;background:var(--line)}
.scan::after{content:"";position:absolute;left:0;right:0;height:46px;top:-46px;background:linear-gradient(transparent,color-mix(in srgb,var(--hi) 70%,transparent));border-bottom:3px solid var(--hi);animation:scan 1.8s ease-in-out infinite}
@keyframes scan{0%{top:-46px}100%{top:100%}}
.gen h2{font-size:28px}
.dots{display:inline-flex;gap:5px}
.dots i{width:8px;height:8px;border-radius:50%;background:var(--pop);animation:bounce 1s infinite}
.dots i:nth-child(2){animation-delay:.15s;background:var(--hi)}.dots i:nth-child(3){animation-delay:.3s;background:var(--go)}
@keyframes bounce{0%,100%{transform:translateY(0)}40%{transform:translateY(-8px)}}

/* guide page */
.back{border:0;background:none;color:var(--muted);font-weight:700;padding:6px 0;margin-bottom:10px;display:inline-flex;gap:6px;align-items:center}
.gtitle{display:flex;flex-direction:column;gap:8px;margin-bottom:22px}
.gtitle h1{font-size:clamp(28px,5vw,44px);font-weight:800;overflow-wrap:anywhere}
.ggrid{display:grid;grid-template-columns:1.2fr 1fr;gap:18px;align-items:start}
@media (max-width:820px){.ggrid{grid-template-columns:1fr}}
.setup{padding:20px;display:flex;flex-direction:column;gap:18px}
.setup h2{font-size:22px}
.types{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.type{border:2px solid var(--line);background:var(--surface);border-radius:14px;padding:12px 8px;display:flex;flex-direction:column;align-items:center;gap:6px;font-weight:800;font-size:14px;transition:transform .12s,border-color .15s,background .15s;text-align:center}
.type svg{width:30px;height:30px}
.type[aria-pressed="true"]{border-color:var(--sky);background:var(--sky-soft)}
.type[aria-pressed="true"]::after{content:"✓";font-size:12px;color:var(--sky)}
.type[aria-pressed="false"]::after{content:" ";font-size:12px}
.lbl{font-weight:800;font-size:14px;margin-bottom:8px;display:block}
.side{display:flex;flex-direction:column;gap:18px}
.panel{padding:18px}
.panel h3{font-size:18px;margin-bottom:12px}
.bars{display:flex;align-items:end;gap:6px;height:90px;padding-top:6px}
.bars .b{flex:1;max-width:28px;border-radius:6px 6px 3px 3px;background:var(--sky);position:relative;min-height:4px;transform-origin:bottom;animation:grow .6s cubic-bezier(.2,.9,.3,1.2) both}
.bars .b.good{background:var(--go)}.bars .b.ok{background:var(--hi)}.bars .b.low{background:var(--pop)}
@keyframes grow{from{transform:scaleY(0)}}
.terms{display:flex;flex-direction:column;gap:8px;max-height:340px;overflow:auto}
.term{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.4fr);gap:10px;font-size:14px;padding:8px 0;border-bottom:1px solid var(--line)}
.term b{overflow-wrap:anywhere}
.history{display:flex;flex-direction:column;gap:8px}
.hrow{display:flex;justify-content:space-between;gap:10px;font-size:14px;align-items:center}

/* play */
.play{max-width:720px;margin:0 auto;display:flex;flex-direction:column;gap:16px}
.pbar{display:flex;align-items:center;gap:12px}
.segs{flex:1;display:flex;gap:4px;min-width:0}
.segs i{flex:1;height:10px;border-radius:6px;background:var(--surface-2);transition:background .3s}
.segs i.cur{background:color-mix(in srgb,var(--sky) 45%,var(--surface-2))}
.segs i.ok{background:var(--go)}.segs i.no{background:var(--bad)}.segs i.part{background:var(--hi)}
.hud{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.combo{display:inline-flex;align-items:center;gap:6px;font-weight:800;background:color-mix(in srgb,var(--pop) 16%,var(--surface));color:var(--pop);padding:5px 12px;border-radius:999px;font-size:14px;animation:pop .35s cubic-bezier(.2,.9,.3,1.6)}
.xpc{font-family:var(--f-mono);font-weight:500;background:var(--hi);color:var(--hi-ink);border-radius:999px;padding:5px 12px;font-size:14px}
.qcard{padding:24px 22px;display:flex;flex-direction:column;gap:18px;animation:slidein .35s cubic-bezier(.2,.9,.3,1.1)}
@keyframes slidein{from{opacity:.0;transform:translateX(24px)}}
.qkind{align-self:flex-start}
.qtext{font-family:var(--f-display);font-weight:700;font-size:clamp(21px,3.4vw,27px);line-height:1.25;overflow-wrap:anywhere}
.quote{border-left:4px solid var(--hi);padding:8px 14px;background:var(--surface-2);border-radius:0 10px 10px 0;font-size:17px;overflow-wrap:anywhere}
.choices{display:grid;gap:10px}
.choice{display:flex;align-items:center;gap:12px;text-align:left;border:2px solid var(--line);background:var(--surface);border-radius:14px;padding:13px 14px;font-weight:600;font-size:17px;
  box-shadow:0 3px 0 var(--line);transition:transform .1s,border-color .15s,background .15s;min-width:0}
.choice span.t{min-width:0;overflow-wrap:anywhere}
.choice:hover:not(:disabled){border-color:var(--sky);transform:translateY(-1px)}
.choice:active:not(:disabled){transform:translateY(2px);box-shadow:0 1px 0 var(--line)}
.choice .k{flex:none;width:30px;height:30px;border-radius:9px;background:var(--surface-2);display:grid;place-items:center;font-family:var(--f-mono);font-size:14px;color:var(--muted)}
.choice.right{border-color:var(--go);background:var(--go-soft);box-shadow:0 3px 0 var(--go)}
.choice.right .k{background:var(--go);color:#fff}
.choice.wrong{border-color:var(--bad);background:var(--bad-soft);box-shadow:0 3px 0 var(--bad)}
.choice.wrong .k{background:var(--bad);color:#fff}
.choice:disabled{cursor:default}
.choice.dim{opacity:.55}
.tf{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.tf .choice{justify-content:center;font-size:20px;font-weight:800;padding:20px 12px;flex-direction:column;gap:6px}
.tf .choice .k{display:none}
.match{display:grid;grid-template-columns:fit-content(42%) minmax(0,1fr);gap:10px}
.mi.mterm{overflow-wrap:break-word;hyphens:auto}
@media (max-width:520px){.qcard{padding:18px 14px}.mi{font-size:14px;padding:10px}.match{gap:8px}.mcol{gap:8px}}
.mcol{display:flex;flex-direction:column;gap:10px}
.mi{border:2px solid var(--line);background:var(--surface);border-radius:12px;padding:11px 12px;text-align:left;font-weight:600;font-size:15px;box-shadow:0 3px 0 var(--line);transition:transform .1s,background .2s,border-color .2s;overflow-wrap:anywhere;min-height:52px}
.mi.mterm{font-weight:800}
.mi.sel{border-color:var(--sky);background:var(--sky-soft);transform:translateY(-2px)}
.mi.done{cursor:default;box-shadow:none;border-color:transparent}
.mi.c0{background:var(--m0)}.mi.c1{background:var(--m1)}.mi.c2{background:var(--m2)}.mi.c3{background:var(--m3)}.mi.c4{background:var(--m4)}
.shake{animation:shake .4s}
@keyframes shake{20%,60%{transform:translateX(-7px)}40%,80%{transform:translateX(7px)}}
@keyframes pop{from{transform:scale(.6);opacity:0}}
.fb{position:fixed;left:0;right:0;bottom:0;z-index:25;transform:translateY(110%);visibility:hidden;transition:transform .3s cubic-bezier(.2,.9,.3,1.1),visibility 0s .3s;background:var(--surface);border-top:3px solid var(--line);
  padding:16px max(16px,env(safe-area-inset-right,0px)) calc(16px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.fb.show{transform:none;visibility:visible;transition:transform .3s cubic-bezier(.2,.9,.3,1.1)}
.fb.good{border-color:var(--go);background:var(--go-soft)}
.fb.bad{border-color:var(--bad);background:var(--bad-soft)}
.fb .in{max-width:720px;margin:0 auto;display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.fb .msg{flex:1;min-width:220px}
.fb .msg b{font-family:var(--f-display);font-size:22px;display:block}
.fb.good .msg b{color:var(--go)}.fb.bad .msg b{color:var(--bad)}
.fb .msg p{margin:2px 0 0;font-size:15px;overflow-wrap:anywhere}
.float{position:fixed;z-index:40;pointer-events:none;font-family:var(--f-mono);font-weight:500;color:var(--hi-ink);background:var(--hi);padding:3px 9px;border-radius:999px;font-size:15px;animation:floatup 1s ease-out forwards}
@keyframes floatup{from{transform:translate(-50%,0) scale(.7);opacity:0}20%{transform:translate(-50%,-14px) scale(1.1);opacity:1}to{transform:translate(-50%,-70px) scale(1);opacity:0}}

/* results */
.res{max-width:720px;margin:0 auto;display:flex;flex-direction:column;gap:18px}
.reshead{padding:26px 22px;display:grid;grid-template-columns:auto 1fr;gap:22px;align-items:center}
@media (max-width:520px){.reshead{grid-template-columns:1fr;justify-items:center;text-align:center}}
.gradecircle{width:132px;height:132px;display:grid;place-items:center;border:5px solid var(--pop);border-radius:52% 48% 55% 45% / 48% 55% 45% 52%;transform:rotate(-8deg);
  font-family:var(--f-pen);font-size:68px;color:var(--pop);line-height:1;animation:stamp .5s cubic-bezier(.2,.9,.3,1.5) .2s both}
@keyframes stamp{from{transform:rotate(-30deg) scale(2.2);opacity:0}}
.reshead h1{font-size:clamp(28px,5vw,40px)}
.score{font-family:var(--f-mono);font-size:18px;color:var(--muted);margin-top:6px}
.xpbox{padding:18px 20px;display:flex;flex-direction:column;gap:10px}
.xprow{display:flex;justify-content:space-between;font-size:15px;animation:pop .3s both}
.xprow b{font-family:var(--f-mono)}
.xptotal{font-family:var(--f-display);font-size:24px;font-weight:800;display:flex;justify-content:space-between;border-top:2px dashed var(--line);padding-top:10px}
.lvbar{height:14px;border-radius:9px;background:var(--surface-2);overflow:hidden}
.lvbar i{display:block;height:100%;background:linear-gradient(90deg,var(--hi),color-mix(in srgb,var(--hi) 60%,var(--pop)));border-radius:9px;transition:width 1.2s cubic-bezier(.2,.9,.3,1)}
.levelup{background:var(--hi);color:var(--hi-ink);border-radius:var(--r);padding:16px 20px;display:flex;gap:14px;align-items:center;animation:pop .5s cubic-bezier(.2,.9,.3,1.6) .6s both}
.levelup h3{font-size:22px}
.badges{display:flex;gap:10px;flex-wrap:wrap}
.badge{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:14px;background:var(--surface);border:2px solid var(--hi);font-weight:800;animation:pop .45s cubic-bezier(.2,.9,.3,1.6) both}
.badge.locked{border-color:var(--line);opacity:.5;filter:grayscale(1);font-weight:600}
.badge .ic{width:34px;height:34px;border-radius:10px;background:var(--hi);display:grid;place-items:center;color:var(--hi-ink)}
.badge.locked .ic{background:var(--surface-2);color:var(--muted)}
.review{display:flex;flex-direction:column;gap:10px}
.rv{padding:14px 16px;border-left:4px solid var(--bad)}
.rv p{margin:4px 0 0;font-size:14px}
.actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px}

/* leaderboard */
.podium{display:grid;grid-template-columns:1fr 1.1fr 1fr;gap:10px;align-items:end;max-width:560px;margin:10px auto 22px}
.pod{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0}
.pod .av{width:58px;height:58px;font-size:22px;box-shadow:0 0 0 4px var(--surface)}
.pod .nm{font-weight:800;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pod .blk{width:100%;border-radius:14px 14px 4px 4px;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;padding-top:10px;font-family:var(--f-display);font-weight:800;font-size:30px;animation:grow .7s cubic-bezier(.2,.9,.3,1.2) both}
.pod .blk small{font-family:var(--f-mono);font-size:13px;font-weight:500}
.pod.p1 .blk{height:130px;background:var(--hi);color:var(--hi-ink)}
.pod.p2 .blk{height:96px;background:var(--surface-2)}
.pod.p3 .blk{height:76px;background:color-mix(in srgb,var(--pop) 22%,var(--surface))}
.lrows{display:flex;flex-direction:column}
.lrow{display:grid;grid-template-columns:36px 40px minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line)}
.lrow:last-child{border-bottom:0}
.lrow.me{background:color-mix(in srgb,var(--hi) 22%,var(--surface))}
.lrow .rk{font-family:var(--f-mono);color:var(--muted);text-align:center}
.lrow .nm{font-weight:800;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.lrow .sub{font-size:13px;color:var(--muted)}
.lrow .xp{font-family:var(--f-mono);font-weight:500;text-align:right}

/* sheet */
.scrim{position:fixed;inset:0;background:rgba(10,14,28,.45);z-index:50;display:grid;place-items:end center;animation:fade .2s}
@keyframes fade{from{opacity:0}}
.sheet{width:min(520px,100%);max-height:88vh;overflow:auto;background:var(--surface);border-radius:22px 22px 0 0;padding:20px max(18px,env(safe-area-inset-right,0px)) calc(20px + env(safe-area-inset-bottom,0px)) max(18px,env(safe-area-inset-left,0px));display:flex;flex-direction:column;gap:16px;animation:up .3s cubic-bezier(.2,.9,.3,1.1)}
@media (min-width:640px){.scrim{place-items:center}.sheet{border-radius:22px}}
@keyframes up{from{transform:translateY(40px);opacity:0}}
.sheet h2{font-size:24px}
.plist{display:flex;flex-direction:column;gap:8px}
.pitem{display:flex;align-items:center;gap:12px;border:2px solid var(--line);border-radius:14px;padding:8px 12px;background:var(--surface);text-align:left}
.pitem[aria-current="true"]{border-color:var(--sky);background:var(--sky-soft)}
.pitem .nm{font-weight:800}
.input{width:100%;border:1.5px solid var(--line);border-radius:12px;padding:11px 12px;background:var(--paper)}
.swatches{display:flex;gap:8px;flex-wrap:wrap}
.sw{width:34px;height:34px;border-radius:50%;border:3px solid transparent}
.sw[aria-pressed="true"]{border-color:var(--ink)}
.switch{display:flex;align-items:center;justify-content:space-between;gap:12px;font-weight:700}
.switch input{width:22px;height:22px;accent-color:var(--sky)}

#fx{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:45}
#toast{position:fixed;left:50%;bottom:calc(90px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:60;background:var(--ink);color:var(--paper);padding:10px 16px;border-radius:12px;font-weight:700;font-size:14px;max-width:calc(100% - 32px);box-shadow:var(--shadow);transition:opacity .2s}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}

/* ---- additions for the standalone version ---- */
.blank{display:inline-block;min-width:4.5em;border-bottom:3px solid var(--sky);margin:0 .15em;height:1.1em;vertical-align:-.15em}
.filled{background:linear-gradient(transparent 52%,var(--hi) 52%,var(--hi) 92%,transparent 92%);font-weight:800;padding:0 .12em;display:inline-block;animation:pop .35s cubic-bezier(.2,.9,.3,1.5)}
.prog{height:12px;border-radius:9px;background:var(--surface-2);overflow:hidden;width:100%;max-width:340px}
.prog i{display:block;height:100%;background:linear-gradient(90deg,var(--sky),var(--go));width:0;transition:width .35s ease}
.thumb .rot{position:absolute;bottom:4px;right:4px;width:26px;height:26px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;display:grid;place-items:center}
.thumb img{transition:transform .25s}
.privacy{display:flex;gap:8px;align-items:center;font-size:13px;color:var(--muted)}
.ed{display:flex;flex-direction:column;gap:16px;max-width:860px;margin:0 auto}
.edhead h1{font-size:clamp(28px,5vw,40px)}
.edhead p{color:var(--muted);margin:8px 0 0;max-width:60ch}
.edsec{padding:18px 18px 12px}
.edsec>header{display:flex;justify-content:space-between;align-items:baseline;gap:10px;margin-bottom:6px}
.edsec h2{font-size:20px}
.edsec .hint{font-size:13px;color:var(--muted)}
.edrow{display:grid;grid-template-columns:minmax(0,.75fr) minmax(0,1.5fr) 40px;gap:8px;align-items:center;padding:6px 0;border-bottom:1px dashed var(--line)}
.edrow:last-of-type{border-bottom:0}
.edrow.one{grid-template-columns:minmax(0,1fr) 40px}
.edrow .input{padding:9px 11px;font-size:15px}
.edrow .a{font-weight:700}
.del{width:40px;height:40px;border-radius:10px;border:1px solid var(--line);background:var(--surface);color:var(--muted);font-size:18px}
.del:hover{color:var(--bad);border-color:var(--bad)}
.addrow{margin-top:8px;border:2px dashed var(--line);background:none;border-radius:12px;padding:9px 14px;font-weight:800;color:var(--muted);width:100%}
@media (max-width:600px){.edrow{grid-template-columns:minmax(0,1fr) 40px;grid-template-areas:"a x" "b b"}.edrow .a{grid-area:a}.edrow .b{grid-area:b}.edrow .del{grid-area:x}.edrow.one{grid-template-areas:none}}
.edbar{position:sticky;bottom:calc(12px + env(safe-area-inset-bottom,0px));z-index:15;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
  background:var(--ink);color:var(--paper);border-radius:18px;padding:12px 12px 12px 18px;box-shadow:var(--shadow)}
.edbar b{font-family:var(--f-mono);font-size:20px}
@media (max-width:620px){.edbar{bottom:calc(76px + env(safe-area-inset-bottom,0px))}}
.rawtext{min-height:220px;font-family:var(--f-mono);font-size:13px}
.twocol{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:600px){.twocol{grid-template-columns:1fr}}
@media (max-width:600px){.edbar{padding:10px 10px 10px 14px;flex-wrap:nowrap}.edbar>span{font-size:13px;line-height:1.2}.edbar b{font-size:17px;display:block}.edbar .row{flex-wrap:nowrap;gap:6px}.edbar [data-act="cancel-draft"]{display:none}.edbar .btn{padding:10px 14px;font-size:15px}}
