:root{--bg:#ffffff;--card:#ffffff;--ink:#2a2350;--muted:#6d6889;--line:#ece9f7;--soft:#f7f5ff;--accent:#7c4dff;}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font:17px/1.5 "Fredoka",system-ui,-apple-system,"Segoe UI",sans-serif;
  background-image:radial-gradient(circle at 8% 6%,#ffe3ec 0,transparent 22%),radial-gradient(circle at 92% 4%,#dff4ff 0,transparent 24%),radial-gradient(circle at 50% 100%,#fff4d6 0,transparent 30%);background-attachment:fixed}
.wrap{max-width:1180px;margin:0 auto;padding:28px 16px 64px}
header{text-align:center}
header h1{font-size:clamp(34px,6vw,58px);margin:0 0 8px;font-weight:700;letter-spacing:-.01em;line-height:1.1}
header h1 span{display:inline-block}
header h1 span:nth-child(6n+1){color:#ff4d6d}header h1 span:nth-child(6n+2){color:#ff9f1c}header h1 span:nth-child(6n+3){color:#ffc300}
header h1 span:nth-child(6n+4){color:#2ec27e}header h1 span:nth-child(6n+5){color:#2f8cff}header h1 span:nth-child(6n){color:#9b5cff}
header h1 span:hover{transform:translateY(-4px) rotate(-6deg);transition:transform .15s}
header p{margin:0 auto;color:var(--muted);max-width:680px;font-size:18px}
.deco{display:flex;justify-content:center;gap:10px;margin:0 0 12px}
.deco svg{animation:bob 2.4s ease-in-out infinite}
.deco svg:nth-child(2){animation-delay:.3s}.deco svg:nth-child(3){animation-delay:.6s}.deco svg:nth-child(4){animation-delay:.9s}
@keyframes bob{50%{transform:translateY(-6px) rotate(8deg)}}
.legend{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:18px 0 6px;font-size:15px}
.legend span{display:inline-flex;align-items:center;gap:6px;background:#fff;border:2px solid var(--line);border-radius:999px;padding:4px 12px}
.filters{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin:22px 0 22px}
.chip{border:2.5px solid var(--c,#2a2350);background:#fff;color:var(--c,#2a2350);padding:8px 16px;border-radius:999px;font:inherit;font-size:15px;font-weight:600;cursor:pointer;transition:transform .12s}
.chip:hover{transform:scale(1.05)}
.chip[aria-pressed="true"]{background:var(--c,#2a2350);color:#fff}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:18px}
.card{background:#fff;border:3px solid var(--c);border-radius:24px;padding:12px;cursor:pointer;text-align:left;font:inherit;color:inherit;display:flex;flex-direction:column;gap:6px;transition:transform .15s,box-shadow .15s;box-shadow:0 6px 0 var(--c)}
.card:hover{transform:translateY(-4px) rotate(-.6deg);box-shadow:0 10px 0 var(--c)}
.card:active{transform:translateY(3px);box-shadow:0 2px 0 var(--c)}
.thumb{background:var(--bgc);border-radius:16px;aspect-ratio:1/1;display:flex;align-items:center;justify-content:center}
.thumb svg{width:100%;height:100%}
.card h3{margin:2px 0 0;font-size:21px;font-weight:700}
.card p{margin:0;font-size:15px;color:var(--muted)}
.meta{display:flex;justify-content:space-between;align-items:center;font-size:14px;color:var(--muted)}
.lvl{display:inline-flex;align-items:center;gap:6px;font-weight:700}
.badge{background:var(--c);color:#fff;border-radius:999px;padding:2px 10px;font-weight:600;font-size:13px}
.stars{letter-spacing:1px;font-size:14px}
section.geo{margin-top:48px;background:linear-gradient(135deg,#fff7e0,#ffe9f1 50%,#e6f3ff);border-radius:24px;padding:22px}
section.geo h2{margin:0 0 8px;font-size:26px}
section.geo ul{margin:8px 0 0;padding-left:20px}
section.geo li{margin:6px 0}
dialog{border:none;padding:0;border-radius:26px;background:#fff;color:var(--ink);width:min(1000px,calc(100vw - 32px));max-height:calc(100vh - 32px)}
dialog::backdrop{background:rgba(42,35,80,.45)}
.dlg{display:grid;grid-template-columns:1.1fr 1fr;gap:0}
.viewer{background:var(--bgc,#f7f5ff);position:relative;touch-action:none;cursor:grab;min-height:360px}
.viewer:active{cursor:grabbing}
.viewer svg{width:100%;height:100%;display:block}
.vhint{position:absolute;left:14px;bottom:12px;font-size:13px;color:var(--muted)}
.vbtn{position:absolute;right:12px;bottom:10px;border:2px solid var(--line);background:#fff;color:var(--ink);border-radius:999px;padding:4px 12px;font:inherit;font-size:13px;cursor:pointer}
.panel{padding:22px 24px;overflow:auto;max-height:calc(100vh - 32px)}
.panel h2{margin:2px 0 0;font-size:30px;font-weight:700}
.close{float:right;border:none;background:var(--soft);color:var(--ink);width:38px;height:38px;border-radius:50%;font-size:18px;cursor:pointer}
.pieces{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0}
.pc{display:flex;align-items:center;gap:6px;background:var(--soft);border-radius:999px;padding:5px 12px;font-size:15px}
.pc b{font-variant-numeric:tabular-nums}
.tip{background:#fff7d6;border:2px dashed #ffc300;padding:10px 14px;border-radius:16px;font-size:15px;margin:12px 0}
.steps{margin-top:14px}
.stepnav{display:flex;align-items:center;gap:8px;margin:8px 0}
.stepnav button{border:none;background:var(--c,#7c4dff);color:#fff;border-radius:999px;padding:9px 18px;font:inherit;font-weight:600;cursor:pointer;box-shadow:0 4px 0 rgba(0,0,0,.15)}
.stepnav button:active{transform:translateY(2px);box-shadow:0 2px 0 rgba(0,0,0,.15)}
.stepnav button:disabled{opacity:.35;cursor:default}
.stepnav span{font-size:15px;color:var(--muted);flex:1;text-align:center;font-weight:600}
.steptext{background:var(--soft);border-radius:16px;padding:14px;font-size:17px;min-height:70px}
.steptext small{display:block;color:var(--muted);margin-top:6px;font-size:14px}
@media (max-width:760px){
  .dlg{grid-template-columns:1fr}
  .viewer{min-height:300px;height:52vw}
  .panel{max-height:none}
  dialog{overflow:auto}
}

/* ---------- v2: toolbar, categories, progress, actions, footer, print ---------- */
.headActions{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:10px;margin-top:14px}
.progress{background:#fff7d6;border:2px solid #ffd54a;border-radius:999px;padding:4px 14px;font-weight:600;font-size:15px}
.kofi{background:#ff5e5b;color:#fff;text-decoration:none;font-weight:600;border-radius:999px;padding:6px 16px;box-shadow:0 4px 0 #c94441}
.kofi:hover{filter:brightness(1.05)}
footer .kofi{background:none;color:inherit;box-shadow:none;padding:0;font-weight:inherit;text-decoration:underline}
.toolbar{margin:22px 0 18px;display:flex;flex-direction:column;align-items:center;gap:10px}
.toolbar .filters{margin:0}
#search{width:min(520px,100%);font:inherit;font-size:17px;padding:11px 18px;border-radius:999px;border:2.5px solid var(--line);background:#fff;color:var(--ink);outline:none}
#search:focus{border-color:var(--accent)}
.chip.cat{--c:#5b4fc4;font-size:14px;padding:6px 13px}
.thumb{position:relative}
.done{position:absolute;top:8px;right:8px;background:#22c55e;color:#fff;width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:700;box-shadow:0 3px 0 #15803d}
.empty{text-align:center;color:var(--muted);font-size:18px;margin:30px 0}
.catTag{display:inline-block;margin-left:8px;font-size:13px;background:var(--soft);border-radius:999px;padding:2px 10px;color:var(--muted)}
.sub{margin:4px 0 0;color:var(--muted)}
.finish{margin-top:10px;font-weight:600;color:#15803d}
.finish a{display:block;font-weight:500;color:#c94441;margin-top:4px}
.actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
.act{border:2px solid var(--line);background:#fff;color:var(--ink);border-radius:999px;padding:7px 14px;font:inherit;font-size:15px;cursor:pointer}
.act.on{background:#22c55e;border-color:#22c55e;color:#fff;font-weight:600}
section.about{margin-top:24px;background:#fff;border:2px solid var(--line);border-radius:24px;padding:22px}
section.about h2{margin:0 0 8px;font-size:26px}
section.about h3{margin:14px 0 4px}
section.about p{margin:6px 0;color:var(--muted)}
footer{margin-top:28px;display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--muted);font-size:15px;text-align:center}
footer a{color:inherit}
footer small{font-size:12px;opacity:.8}
#print{display:none}
@media print{
  body{background:#fff}
  body>.wrap,dialog{display:none!important}
  #print{display:block;color:#000;font-family:"Fredoka",sans-serif}
  #print h1{margin:0;font-size:30px}
  .pmain svg{width:300px;height:300px;display:block;margin:0 auto}
  .ptip{border:1.5px dashed #999;border-radius:10px;padding:8px 10px}
  .psteps{list-style:none;padding:0;display:grid;grid-template-columns:1fr 1fr;gap:10px}
  .psteps li{display:flex;gap:8px;align-items:center;break-inside:avoid;border:1px solid #ddd;border-radius:10px;padding:6px}
  .psteps svg{width:110px;height:110px;flex:none}
  .pfoot{color:#777;font-size:12px;text-align:center}
}
