:root{
  --bg1:#fff6e5;--bg2:#e2f3ff;--ink:#4a3b5c;--muted:#8a7a99;--card:#ffffff;
  --pink:#ff7eb3;--blue:#5bb4ff;--mint:#3fcf9c;--yellow:#ffc93c;--orange:#ff9a4d;--purple:#a98bff;--red:#ff6b6b;
  --line:#efe3f5;--shadow:0 6px 0 rgba(74,59,92,.13);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;min-height:100%}
body{color:var(--ink);overflow-x:hidden;font-family:"Microsoft JhengHei","PingFang TC","Noto Sans TC","Heiti TC",sans-serif;
  background:linear-gradient(180deg,var(--bg2) 0%,#f3f9ff 35%,var(--bg1) 100%);background-attachment:fixed;font-size:20px}
button{font-family:inherit;touch-action:manipulation;color:var(--ink)}
[hidden]{display:none!important}

/* 背景 */
.deco{position:fixed;inset:0;pointer-events:none;z-index:0;overflow:hidden}
.cloud{position:absolute;background:#fff;border-radius:999px;opacity:.85;animation:drift linear infinite}
.cloud::before{content:"";position:absolute;background:#fff;border-radius:50%;width:55%;height:150%;left:15%;top:-60%}
@keyframes drift{from{transform:translateX(-30vw)}to{transform:translateX(130vw)}}
@keyframes bob{50%{transform:translateY(-10px)}}
#app{position:relative;z-index:1;max-width:1000px;margin:0 auto;padding:76px 16px 48px}

.grade-link{position:fixed;top:12px;left:12px;z-index:60;border:3px solid var(--mint);background:#fff;font-size:18px;font-weight:900;padding:9px 16px;border-radius:999px;color:var(--ink);text-decoration:none;box-shadow:0 4px 0 #26a37a}
.home-btn{position:fixed;top:12px;left:150px;z-index:60;border:3px solid var(--blue);background:#fff;font-size:18px;font-weight:900;padding:9px 16px;border-radius:999px;cursor:pointer;box-shadow:0 4px 0 #3b8fd6}
.sound-btn{position:fixed;top:12px;right:12px;z-index:60;width:52px;height:52px;border-radius:50%;border:3px solid var(--purple);background:#fff;font-size:22px;cursor:pointer;box-shadow:0 4px 0 #7f63d9}

/* 首頁 */
.hero{text-align:center;margin:0 0 18px}
.hero h1{margin:0;font-size:clamp(34px,7vw,56px);font-weight:900;letter-spacing:2px}
.hero h1 .rb{display:inline-block;animation:wiggle 2.4s ease-in-out infinite}
.hero h1 .rb:nth-child(2n){animation-delay:.3s}
@keyframes wiggle{0%,100%{transform:rotate(-4deg)}50%{transform:rotate(4deg) translateY(-4px)}}
.hero p{color:var(--muted);margin:8px 0 0;font-size:17px;font-weight:700}
.total{display:inline-flex;gap:8px;align-items:center;margin-top:12px;padding:8px 18px;border-radius:999px;background:#fff;border:3px solid var(--yellow);font-weight:900;box-shadow:var(--shadow)}
.total b{color:var(--orange);font-size:24px}
.reset-link{background:none;border:none;color:var(--muted);text-decoration:underline;cursor:pointer;font-size:14px;margin-top:8px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:18px}
.ucard{position:relative;border-radius:28px;padding:16px 16px 14px;background:#fff;border:4px solid var(--c);box-shadow:0 8px 0 var(--c)}
.u-no{display:inline-block;font-size:15px;font-weight:900;padding:3px 12px;border-radius:999px;background:var(--c);color:#fff}
.u-icon{position:absolute;right:14px;top:8px;font-size:44px;animation:bob 3s ease-in-out infinite}
.ucard h3{margin:8px 0 10px;font-size:28px;font-weight:900}
.lv-btns{display:grid;gap:8px}
.lv-btn{display:flex;justify-content:space-between;align-items:center;gap:8px;width:100%;min-height:52px;padding:8px 12px;border-radius:16px;border:3px solid var(--line);background:#faf6ff;font-size:18px;font-weight:900;cursor:pointer;text-align:left}
.lv-btn:hover{border-color:var(--c)}
.lv-btn:active{transform:translateY(2px)}
.lv-btn .st{font-size:18px;letter-spacing:1px;white-space:nowrap}
.star{color:#e6dcef}.star.on{color:var(--yellow);text-shadow:0 2px 0 #e0a800}

/* 關卡 */
.lv-title{font-size:22px;font-weight:900;text-align:center;line-height:1.6}
.coach{display:flex;gap:12px;align-items:flex-start;margin:12px 0}
.coach-face{flex:0 0 72px;width:72px;height:72px;border-radius:50%;background:#fff;border:4px solid var(--orange);box-shadow:var(--shadow);display:grid;place-items:center;font-size:44px;animation:bob 3s ease-in-out infinite}
.coach-bubble{position:relative;flex:1;background:#fff;border:3px solid var(--orange);border-radius:22px;padding:10px 60px 12px 16px;font-size:24px;line-height:1.6;min-height:70px;box-shadow:var(--shadow);font-weight:700}
.coach-bubble .who{display:block;font-size:14px;color:var(--orange);font-weight:900}
.coach-bubble.pulse{animation:pop .35s}
@keyframes pop{50%{transform:scale(1.03)}}
.speak{position:absolute;right:8px;top:10px;width:46px;height:46px;border-radius:50%;border:3px solid var(--purple);background:#f4efff;font-size:22px;cursor:pointer}
.stage{background:#fff;border-radius:28px;border:4px solid var(--line);padding:16px;box-shadow:var(--shadow);min-height:300px}
.prog{display:flex;justify-content:center;gap:8px;margin-bottom:10px}
.prog i{width:16px;height:16px;border-radius:50%;background:#eee3f3}
.prog i.done{background:var(--mint)}.prog i.now{background:var(--yellow);transform:scale(1.3)}

.qvis{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:14px;margin:6px 0 14px;font-size:26px;font-weight:900;text-align:center}
.after{width:100%;text-align:center;font-size:28px;color:#1fa979;font-weight:900;animation:pop .4s}
.opts{display:flex;flex-wrap:wrap;justify-content:center;gap:14px;margin-top:10px}
.opt{min-width:96px;min-height:80px;padding:10px 18px;border-radius:22px;border:4px solid var(--line);background:#fff;font-size:28px;font-weight:900;cursor:pointer;box-shadow:0 5px 0 #e3d6ec;display:inline-flex;align-items:center;justify-content:center;gap:6px}
.opt:active{transform:translateY(3px);box-shadow:0 2px 0 #e3d6ec}
.opt.right{border-color:var(--mint);background:#e6fbf3;box-shadow:0 5px 0 #26a37a;animation:pop .4s}
.opt.wrong{border-color:var(--red);background:#fff0f0;animation:shake .4s;opacity:.55}
.opt:disabled{cursor:default}
@keyframes shake{20%,60%{transform:translateX(-8px)}40%,80%{transform:translateX(8px)}}
.num{font-size:44px;font-weight:900;line-height:1;font-family:"Arial Rounded MT Bold",Arial,sans-serif}
.numpad{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;max-width:560px;margin:10px auto 0}
.numpad .opt{min-width:0;min-height:64px;padding:6px}
.numpad .num{font-size:34px}
.big{font-size:1.5em;color:#e5508f}
.box{display:inline-block;min-width:1.6em;padding:0 6px;border:3px dashed var(--pink);border-radius:10px;color:var(--pink)}
.eq{font-size:40px;font-weight:900;font-family:"Arial Rounded MT Bold",Arial,"Microsoft JhengHei",sans-serif;letter-spacing:2px}

.pics{display:inline-grid;grid-template-columns:repeat(5,1fr);gap:2px;font-size:34px;line-height:1.2}
.pics.sm{font-size:26px}
.plate{display:inline-flex;align-items:center;justify-content:center;min-width:150px;min-height:110px;padding:10px;border-radius:50%/40%;background:#fffaf0;border:4px solid #f3d9a6}
.opt .plate{border:none;background:transparent;min-width:120px;min-height:80px}
.row{display:flex;gap:6px;justify-content:center;font-size:40px;line-height:1.2}
.row span{width:52px;text-align:center}
.lbl{font-size:18px;color:var(--muted);font-weight:900}

/* 點數場地 */
.field{position:relative;height:300px;background:#fbfdff;border-radius:24px;border:3px dashed #cfe6fb;margin-bottom:12px;overflow:hidden}
.thing{position:absolute;width:64px;height:64px;margin:-32px 0 0 -32px;font-size:44px;line-height:64px;border:none;background:none;cursor:pointer;padding:0;transition:opacity .3s}
.thing.counted{opacity:.45}
.thing.counted::after{content:attr(data-n);position:absolute;right:-4px;top:-4px;width:30px;height:30px;border-radius:50%;background:var(--pink);color:#fff;font-size:18px;line-height:30px;font-weight:900;opacity:1}
.readout{text-align:center;font-size:24px;font-weight:900;padding:8px 14px;border-radius:18px;background:#f6f2ff;margin:6px 0}
.btn{border:none;border-radius:999px;padding:12px 26px;font-size:22px;font-weight:900;color:#fff;cursor:pointer;min-height:56px;background:var(--pink);box-shadow:0 5px 0 #d9568f}
.btn:active{transform:translateY(3px)}
.btn.mint{background:var(--mint);box-shadow:0 5px 0 #26a37a}
.btn.blue{background:var(--blue);box-shadow:0 5px 0 #3b8fd6}
.btn.ghost{background:#fff;color:var(--ink);border:3px solid var(--line);box-shadow:0 5px 0 #e3d6ec}
.center{text-align:center;margin-top:12px}

/* 拖曳 / 籃子 */
.dragging{z-index:50;position:relative;filter:drop-shadow(0 6px 6px rgba(0,0,0,.2))}
.supply{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;min-height:80px;padding:10px;border-radius:20px;background:#f7fbff;border:3px dashed #cfe6fb}
.item{font-size:44px;width:64px;height:64px;line-height:64px;text-align:center;border:none;background:none;cursor:grab;padding:0;user-select:none;touch-action:none}
.basket{min-height:130px;margin-top:12px;padding:10px 10px 30px;border-radius:24px 24px 60px 60px;background:#fff4dc;border:5px solid #e6b45f;display:flex;flex-wrap:wrap;justify-content:center;align-content:flex-start;gap:4px;position:relative}
.basket::after{content:attr(data-label);position:absolute;bottom:4px;left:0;right:0;text-align:center;font-size:16px;font-weight:900;color:#b98326}
.basket .item{cursor:pointer}
.plates{display:flex;gap:14px;justify-content:center;flex-wrap:wrap}
.plates .basket{flex:1;min-width:200px;max-width:340px;border-radius:50%/36%;margin-top:0}

/* 比長短 */
.track{position:relative;height:250px;border-radius:20px;background:#fbfdff;border:3px dashed #cfe6fb;overflow:hidden;touch-action:none}
.startline{position:absolute;top:0;bottom:0;width:6px;background:var(--pink);border-radius:3px}
.startline::after{content:"起點";position:absolute;top:4px;left:10px;font-size:15px;font-weight:900;color:var(--pink);white-space:nowrap}
.pencil{position:absolute;height:48px;border-radius:10px 0 0 10px;cursor:grab;touch-action:none;box-shadow:inset 0 -6px 0 rgba(0,0,0,.12)}
.pencil::after{content:"";position:absolute;right:-30px;top:0;border-left:30px solid #f5d29b;border-top:24px solid transparent;border-bottom:24px solid transparent}
.pencil.snap{outline:4px solid var(--mint);outline-offset:3px}
.pencil.pick{outline:5px solid var(--yellow);outline-offset:4px}
.ribbons{display:grid;gap:12px;padding:10px 0}
.ribbon{height:44px;border-radius:8px;border:none;cursor:pointer;position:relative;box-shadow:inset 0 -6px 0 rgba(0,0,0,.12);padding:0}
.ribbon .tag{position:absolute;right:-46px;top:2px;width:38px;height:38px;border-radius:50%;background:var(--ink);color:#fff;font-weight:900;line-height:38px;font-size:22px}
.blocks{display:flex;gap:3px;align-items:center}
.blocks i{width:34px;height:34px;border-radius:6px;display:inline-block;box-shadow:inset 0 -4px 0 rgba(0,0,0,.15)}
.blockrow{display:flex;align-items:center;gap:10px;width:100%;justify-content:flex-start;padding-left:10px}

/* 排隊 */
.queue{display:flex;justify-content:center;gap:6px;flex-wrap:wrap;align-items:flex-end;padding:8px}
.queue .q{font-size:44px;width:70px;height:84px;border-radius:18px;border:3px solid transparent;background:#fbf8ff;cursor:pointer;padding:0;position:relative}
.queue .q.sel{border-color:var(--pink);background:#ffe9f2}
.queue .q.sel::before{content:"⭕";position:absolute;inset:0;font-size:68px;line-height:84px;opacity:.55}
.front{font-size:18px;font-weight:900;color:var(--orange);text-align:left;padding-left:10px}

/* 十格框 / 花片 */
.frames{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-top:8px}
.tf{display:grid;grid-template-columns:repeat(5,36px);gap:4px;padding:6px;border:3px solid var(--blue);border-radius:12px;background:#fff}
.tf i{width:36px;height:36px;border:2px dashed #d9d0e3;border-radius:8px;font-style:normal;display:grid;place-items:center;font-size:24px}
.tf i.on{border-style:solid;border-color:#ffd56b;background:#fff8dd}

/* 形狀 */
.bins{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin-top:12px}
.bin{min-height:120px;border-radius:20px;border:4px dashed var(--c);background:#fff;padding:6px;display:flex;flex-wrap:wrap;align-content:flex-start;justify-content:center;gap:2px}
.bin h4{width:100%;margin:0 0 4px;text-align:center;font-size:20px;color:var(--ink)}
.bin svg{width:44px;height:44px}
.shape{width:76px;height:76px;padding:4px;border:none;background:none;cursor:grab;touch-action:none}
.shape svg{width:100%;height:100%;pointer-events:none}
.opt svg{width:90px;height:90px}
.pic svg{width:min(320px,80vw);height:auto}

/* 時鐘 */
.clockwrap{display:flex;justify-content:center}
.clock{width:min(300px,76vw);height:auto;touch-action:none;cursor:pointer}
.opt .clock{width:120px;height:120px}
.pk{cursor:pointer}.pk.marked{opacity:.35}

/* 氣球 */
.balloon{transition:transform 1s ease-in,opacity 1s}
.balloon.away{transform:translateY(-360px) rotate(15deg);opacity:0}

/* 結果 */
.result{position:fixed;inset:0;z-index:80;background:rgba(74,59,92,.45);display:grid;place-items:center;padding:16px}
.result-card{background:#fff;border-radius:32px;border:5px solid var(--yellow);padding:22px;text-align:center;max-width:520px;width:100%;animation:pop .4s}
.r-title{font-size:36px;font-weight:900}
.r-stars{font-size:60px;letter-spacing:8px;margin:6px 0}
.r-msg{font-size:20px;color:var(--muted);font-weight:700}
.nav-next{display:flex;justify-content:center;gap:10px;margin-top:16px;flex-wrap:wrap}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(120px);background:var(--ink);color:#fff;padding:12px 22px;border-radius:999px;font-size:20px;font-weight:900;z-index:90;transition:transform .3s;max-width:92vw;text-align:center}
.toast.show{transform:translateX(-50%) translateY(0)}
.confetti{position:fixed;inset:0;pointer-events:none;z-index:85;overflow:hidden}
.confetti i{position:absolute;top:-20px;width:12px;height:16px;border-radius:3px;animation:fall 1.8s linear forwards}
@keyframes fall{to{transform:translateY(110vh) rotate(720deg)}}

@media (max-width:600px){
  body{font-size:18px}
  .coach-bubble{font-size:20px}
  .coach-face{flex-basis:56px;width:56px;height:56px;font-size:34px}
  .thing{font-size:36px}
  .queue .q{width:54px;height:70px;font-size:36px}
  .queue .q.sel::before{font-size:54px;line-height:70px}
  .tf{grid-template-columns:repeat(5,28px)}.tf i{width:28px;height:28px;font-size:18px}
  .numpad{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* ===== 二年級新增 ===== */
/* 小鍵盤 */
.kwrap{max-width:420px;margin:10px auto 0}
.kwrap:empty{display:none}
.kp-show{display:flex;justify-content:center;align-items:center;gap:8px;min-height:76px;border:4px dashed var(--pink);border-radius:20px;background:#fff7fb;margin-bottom:10px}
.kp-val{font-size:48px;font-weight:900;color:#e5508f;font-family:"Arial Rounded MT Bold",Arial,sans-serif;min-width:1em;text-align:center}
.kp-unit{font-size:26px;font-weight:900;color:var(--muted)}
.kp-show.right{border-style:solid;border-color:var(--mint);background:#e6fbf3}
.kp-show.wrong{animation:shake .4s}
.kpad{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.kbtn{min-height:64px;border-radius:18px;border:4px solid var(--line);background:#fff;font-size:32px;font-weight:900;cursor:pointer;box-shadow:0 5px 0 #e3d6ec;font-family:"Arial Rounded MT Bold",Arial,sans-serif}
.kbtn:active{transform:translateY(3px);box-shadow:0 2px 0 #e3d6ec}
.kbtn.go{background:var(--mint);border-color:var(--mint);color:#fff;box-shadow:0 5px 0 #26a37a}
.kbtn.del{background:#fff4dc}

/* 位值積木 */
.bfield{min-height:120px;padding:10px;border-radius:20px;background:#fbfdff;border:3px dashed #cfe6fb;margin:8px 0}
.blocks2{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:center;gap:6px}
.blk.b100{width:96px;height:96px}.blk.b10{width:15px;height:96px}.blk.b1{width:18px;height:18px}
.blocks2 .ones{display:inline-grid;grid-template-columns:repeat(5,18px);gap:2px}
.bbtns{display:flex;justify-content:center;gap:10px;flex-wrap:wrap}
.bcol{display:flex;flex-direction:column;gap:8px;align-items:center}
.badd{flex-direction:column;min-width:120px}
.badd span{font-size:20px}
.opt .blk.b100{width:48px;height:48px}.opt .blk.b10{width:10px;height:48px}.opt .blk.b1{width:16px;height:16px}
.bsub{font-size:16px;min-height:44px;padding:6px 14px}

/* 錢幣 */
.coins{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px}
.coin.bill,.opt .coin.bill{width:110px;height:55px}
.opt .coin{width:44px;height:44px}
.opt .coins{max-width:280px}

/* 直式 */
.vwrap{display:flex;justify-content:center;margin:6px 0}
.vert{display:inline-block;font-family:"Arial Rounded MT Bold",Arial,sans-serif;font-size:52px;font-weight:900;padding:8px 18px;background:#fbfdff;border-radius:20px;border:3px solid #cfe6fb}
.vrow{display:flex;justify-content:flex-end;align-items:center;line-height:1.25}
.vrow span{width:1.1em;text-align:center;position:relative}
.vop{width:1em;text-align:left;color:var(--pink)}
.vline{height:5px;background:var(--ink);border-radius:3px;margin:4px 0}
.vbox{display:inline-block;width:.85em;height:1em;border:3px dashed #cdbfe0;border-radius:10px;vertical-align:middle}
.vbox.now{border-color:var(--pink);background:#fff0f7;animation:pop 1s infinite}
.cy{font-style:normal;font-size:28px;color:var(--orange)}
.vrow s{text-decoration-color:var(--red);text-decoration-thickness:4px}
.bw{font-size:24px;color:var(--red);position:absolute;top:-6px}
.vrow span:last-child .bw{left:-8px}
.vrow s + .bw{right:-14px}

/* 尺 */
.rwrap{display:flex;justify-content:center;overflow:hidden}
.ruler{height:auto;touch-action:none;max-width:100%}

/* 容器 */
.bottles{display:flex;justify-content:center;align-items:flex-end;gap:24px;flex-wrap:wrap}
.bcell{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px;border-radius:20px;background:#fbfdff;border:3px dashed #cfe6fb;min-width:150px}
.bname{font-size:26px;font-weight:900}
.bottle{width:110px;height:auto}
.bottles.sm .bottle{width:80px}
.bottles.sm>div{text-align:center;font-weight:900}
.cups{font-size:22px;font-weight:900;color:var(--blue);min-height:30px}
.pour{font-size:18px;min-height:48px;padding:8px 18px}

/* 青蛙 */
.frog{display:flex;justify-content:center;align-items:center;gap:20px;margin:6px 0}
.fpos{display:flex;flex-direction:column;align-items:center}
.hops{display:flex;flex-wrap:wrap;justify-content:center;gap:6px;min-height:44px;margin:6px 0}
.hop{padding:4px 12px;border-radius:999px;background:#e6fbf3;border:3px solid var(--mint);font-weight:900;font-size:20px}

/* 公車 */
.bus{background:#fff3c4;border:5px solid #f0b400;border-radius:30px 60px 20px 20px;padding:10px;position:relative}
.bus-top{font-size:24px;font-weight:900;text-align:center;margin-bottom:6px}
.bus-top b{color:var(--orange);font-size:32px}
.seats,.stop{display:flex;flex-wrap:wrap;justify-content:center;gap:2px;min-height:50px}
.stop{margin-top:12px;padding:8px;border-radius:20px;background:#eef6ff;border:3px dashed #cfe6fb;align-items:center}
.pp{font-size:32px;width:44px;height:48px;border:none;background:none;padding:0;cursor:pointer}

/* 乘法盤子 */
.groups{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;min-height:60px}
.plate2{display:inline-flex;align-items:center;justify-content:center;padding:8px 10px;border-radius:50%/40%;background:#fffaf0;border:4px solid #f3d9a6;min-width:90px;min-height:64px}
.plate2 .pics.sm{font-size:22px}
.nline{display:flex;justify-content:center}

/* 時鐘 */
.dclock{display:inline-block;font-family:"Courier New",monospace;font-size:46px;font-weight:900;background:#2d2540;color:#7dffb3;padding:4px 20px;border-radius:14px;letter-spacing:3px;margin-bottom:6px}
.clocks2{display:flex;justify-content:center;align-items:center;gap:14px;flex-wrap:wrap}
.clocks2>div{text-align:center}
.clock.sm{width:min(170px,38vw)}

/* 方格 */
.paint{display:grid;gap:4px;max-width:420px;margin:8px auto}
.cell{aspect-ratio:1;border:3px solid #d9d0e3;border-radius:6px;background:#fff;cursor:pointer;padding:0}
.cell.on{background:var(--yellow);border-color:#d99a00}
.gshape{height:auto}

@media (max-width:600px){
  .vert{font-size:42px}
  .blk.b100{width:72px;height:72px}.blk.b10{width:11px;height:72px}
  .bbtns{gap:6px;flex-wrap:nowrap}.bcol{flex:1;min-width:0}.badd{min-width:0;width:100%;padding:8px 4px}.badd span{font-size:16px}.bsub{font-size:13px;padding:6px 8px}
  .bottle{width:84px}
  .bcell{min-width:120px}
  .pp{font-size:26px;width:36px;height:40px}
}

/* ===== 四年級新增 ===== */
.eq.sm{font-size:30px;letter-spacing:1px;word-break:break-all}
.small-opt{font-size:21px;line-height:1.35}
.small-note{font-size:16px;color:var(--muted);margin:4px 0}
.kbtn.wide{grid-column:1/-1}
/* 位值表 */
.pc-wrap{overflow-x:auto;padding-bottom:4px}
.pchart{border-collapse:collapse;margin:6px auto;background:#fff;border-radius:14px;overflow:hidden;font-family:"Arial Rounded MT Bold",Arial,"Microsoft JhengHei",sans-serif}
.pchart th,.pchart td{border:2px solid #e3d6ec;padding:4px 8px;text-align:center;min-width:44px}
.pchart th{font-size:15px;background:#f6f2ff}
.pchart th.w{background:#ffe8f2}
.pchart td{font-size:30px;font-weight:900;height:46px}
.pchart .hi{background:#fff3c4}
.pchart.play td{padding:2px}
.pcb{display:block;width:100%;min-width:38px;min-height:44px;border:none;background:#e2f3ff;border-radius:10px;font-size:18px;padding:8px 0;cursor:pointer;color:#2f7fc4}
.pcb:active{background:#bfe1ff}
.pcd{font-size:34px;font-weight:900;line-height:1.3}
/* 乘法、除法直式 */
.vert.mul{font-size:40px}
.ghost0{color:#cdbfe0;font-style:normal}
.ldiv{display:inline-block;font-family:"Arial Rounded MT Bold",Arial,sans-serif;font-size:40px;font-weight:900;padding:8px 18px;background:#fbfdff;border-radius:20px;border:3px solid #cfe6fb}
.lq,.lrow{display:flex;align-items:center}
.lq span,.lrow .ld{width:1.1em;text-align:center}
.lq .ldv{width:auto;min-width:1.8em}
.lrow .ldv{min-width:1.8em;text-align:right;color:var(--pink)}
.lbr{font-size:1.1em;margin:0 2px;color:var(--ink)}
.lrow .ld{border-top:4px solid var(--ink)}
.llog{font-size:20px;font-weight:700;text-align:center;margin:8px 0;color:#2f7fc4;line-height:1.6}
/* 角 */
.prot-wrap{display:flex;justify-content:center;cursor:pointer}
.prot{width:min(520px,94vw);height:auto;user-select:none}
.ang{display:inline-block}
.angs{display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap}
/* 三角形 */
.tris{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;min-height:100px;padding:6px;background:#fbfdff;border-radius:20px;border:3px dashed #cfe6fb}
.tshape{width:124px;height:104px}
.bin .tshape{width:74px;height:62px}
.bin .tshape svg{width:100%!important;height:100%!important}
/* 分數 */
.frac{display:inline-flex;align-items:center;gap:4px;vertical-align:middle;font-family:"Arial Rounded MT Bold",Arial,sans-serif;font-weight:900}
.fw{font-size:1.2em}
.fnd{display:inline-flex;flex-direction:column;align-items:center;line-height:1.05;font-size:.8em}
.fnd span:first-child{border-bottom:3px solid currentColor;padding:0 4px}
.fbars{display:flex;flex-direction:column;gap:10px;align-items:center;margin:8px 0}
.fline{display:flex;align-items:center;gap:8px;width:min(520px,92vw)}
.flabel{font-weight:900;color:var(--muted);width:1em}
.fbar{display:flex;flex:1;height:54px;border:4px solid #ff9a4d;border-radius:12px;overflow:hidden;background:#fff}
.fbar i{flex:1;border-right:3px solid #ffc999}
.fbar i:last-child{border-right:none}
.fbar i.on{background:#ffc93c}
.fbar.play i{cursor:pointer}
/* 數線 */
.nlwrap{display:flex;justify-content:center}
.nlsvg{width:min(560px,94vw);height:auto}
/* 規律 */
.dfigs{display:flex;gap:14px;justify-content:center;align-items:flex-end;flex-wrap:wrap;margin-bottom:8px}
.dfig{display:flex;flex-direction:column;align-items:center;gap:2px;font-weight:900}
.dfig small{font-size:14px;color:var(--muted)}
.dfig.q{font-size:40px;color:var(--pink)}
.dgrid .cell.on{background:#ff7eb3;border-color:#c94f84;border-radius:50%}
.cal{border-collapse:collapse;margin:0 auto;background:#fff}
.cal th,.cal td{border:2px solid #e3d6ec;width:44px;height:40px;text-align:center;font-size:20px;font-weight:900}
.cal th{background:#f6f2ff;font-size:16px}
/* 四則 */
.expr{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:6px;font-size:38px;font-weight:900;font-family:"Arial Rounded MT Bold",Arial,sans-serif;margin:10px 0}
.opk{font-size:36px;font-weight:900;min-width:60px;min-height:60px;border-radius:16px;border:4px solid var(--blue);background:#e2f3ff;cursor:pointer;box-shadow:0 4px 0 #b9dcfb}
.opk.wrong{border-color:var(--red);background:#ffe3e3}
/* 百格板 */
.g100{display:grid;grid-template-columns:repeat(10,1fr);gap:2px;width:min(300px,80vw);margin:6px auto;border:4px solid #5bb4ff;border-radius:10px;padding:3px;background:#fff}
.g100 i{aspect-ratio:1;background:#eef6ff;border-radius:2px}
.g100 i.on{background:#ff9a4d}
.qvis .g100{width:min(200px,60vw)}
.g100.play i{cursor:pointer}
/* 跑道 */
.trackw{display:flex;justify-content:center;cursor:pointer;touch-action:none}
.trk{width:min(620px,96vw);height:auto;user-select:none}
@media (max-width:600px){
  .eq.sm{font-size:24px}
  .pchart th,.pchart td{min-width:34px;padding:3px 4px}.pchart th{font-size:12px}.pchart td{font-size:24px}
  .pcd{font-size:26px}.pcb{min-width:30px}
  .vert.mul,.ldiv{font-size:30px}
  .expr{font-size:28px}.opk{min-width:48px;min-height:48px;font-size:28px}
  .cal th,.cal td{width:36px;height:34px;font-size:16px}
}
/* ---------- 三年級新增 ---------- */
.blk.b1000{width:96px;height:96px}
.blkbox{min-height:110px;margin:8px 0}
.card{display:inline-grid;place-items:center;width:58px;height:74px;border-radius:12px;background:#fff;border:3px solid var(--blue);font-size:38px;font-weight:900;box-shadow:0 4px 0 #cfe6fb}
.mcup{width:min(190px,50vw);height:auto;touch-action:none;cursor:ns-resize}
.pizza.play path,.pizza.play circle{cursor:pointer}
.pizza{max-width:70vw;height:auto}
.quad{display:block}
.opt .quad,.opt .pizza,.opt .ang{pointer-events:none}
.circ{width:min(240px,70vw);height:auto}
.circ .seg{cursor:pointer}
.circ .seg.hit line:last-of-type{stroke:#1fa979}
.circ .seg.hit circle:last-of-type{fill:#1fa979}
@keyframes drawc{to{stroke-dashoffset:0}}
.ashape{width:108px;height:108px}
.bin .ashape{width:76px;height:76px}
.dvp{min-height:90px;flex-wrap:wrap;gap:2px}
.dvp .item{width:40px;height:40px;line-height:40px;font-size:30px}
.bags{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;margin:8px 0}
.bag{display:flex;flex-wrap:wrap;width:120px;min-height:60px;padding:6px;border:3px dashed #ff9a4d;border-radius:16px 16px 26px 26px;background:#fff8ef;justify-content:center}
.bag.full{border-style:solid;background:#fff3c4}
.bag .item{width:36px;height:36px;line-height:36px;font-size:26px}
#sup .item.dv{cursor:pointer}
.ldv{display:inline-block;font-family:"Arial Rounded MT Bold",Arial,sans-serif;font-size:46px;font-weight:900;padding:8px 22px;background:#fbfdff;border-radius:20px;border:3px solid #cfe6fb;text-align:right}
.ldv-q{padding-right:.15em;min-height:1.2em}
.ldv-row{display:flex;align-items:stretch}
.ldv-d{padding-right:.25em}
.ldv-n{border-top:5px solid var(--ink);border-left:5px solid var(--ink);border-top-left-radius:18px;padding:0 .15em 0 .5em;min-width:2.2em}
.ldv-p{padding-right:.15em;min-height:1.2em}
.ldv-line{height:5px;background:var(--ink);border-radius:3px;margin:4px 0 4px 1.6em}

/* 🎯 進階挑戰：詳解與陷阱提醒 */
.xpl{margin-top:16px;padding:14px 16px;border-radius:20px;background:#f3fbff;border:3px solid var(--blue);font-size:21px;line-height:1.6;font-weight:700;text-align:left;animation:pop .4s}
.xpl-trap{margin-top:8px;padding:8px 12px;border-radius:14px;background:#fff4dc;border:3px dashed var(--orange)}
.xsvg{display:block;max-width:100%}
@media (max-width:600px){.xpl{font-size:18px}}

/* ===== 列式小幫手（2026-11） ===== */
.eqwrap{max-width:560px;margin:8px auto 0}
.eq-tip{text-align:center;font-weight:900;color:var(--muted);font-size:17px;margin-bottom:6px}
.eq-chips{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;margin:4px 0 8px}
.eq-lbl{font-weight:900;font-size:16px}
.eq-chip{min-width:52px;min-height:48px;padding:4px 12px;border-radius:14px;border:3px solid var(--blue);background:#fff;color:#2f8de0;font-size:26px;font-weight:900;cursor:pointer;box-shadow:0 4px 0 #3b8fd6;font-family:"Arial Rounded MT Bold",Arial,sans-serif}
.eq-chip:active{transform:translateY(3px);box-shadow:0 1px 0 #3b8fd6}
.eq-chip.sm{font-size:16px;min-height:44px;font-family:inherit}
.eq-row{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px;margin:8px 0;padding:12px 6px;border-radius:20px;background:#f6f2ff;border:3px solid transparent}
.eq-row.done{background:#e6fbf3;border-color:#bdeedb}
.eq-step{width:100%;text-align:center;font-weight:900;color:var(--orange);display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:8px}
.eq-slot{min-width:80px;height:64px;padding:0 10px;border-radius:16px;border:4px dashed #cbb8e0;background:#fff;font-size:32px;font-weight:900;cursor:pointer;display:inline-grid;place-items:center;font-family:"Arial Rounded MT Bold",Arial,sans-serif}
.eq-slot.op{min-width:60px;color:var(--purple);font-size:36px}
.eq-slot.filled{border-style:solid;border-color:var(--blue)}
.eq-slot.act{border-style:solid;border-color:var(--pink);box-shadow:0 0 0 5px #ffe1ee}
.eq-slot.res{border-style:solid;border-color:var(--mint);background:#fff;color:#1fa979;cursor:default;min-width:88px}
.eq-sign{font-size:34px;font-weight:900}
.eq-pad{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;max-width:420px;margin:10px auto 0}
.eq-key{min-height:60px;border-radius:18px;border:4px solid var(--line);background:#fff;font-size:30px;font-weight:900;cursor:pointer;box-shadow:0 5px 0 #e3d6ec;font-family:"Arial Rounded MT Bold",Arial,sans-serif}
.eq-key:active{transform:translateY(3px);box-shadow:0 2px 0 #e3d6ec}
.eq-key.op{background:#f3eeff;color:var(--purple);border-color:#d9ccff}
.eq-msg{min-height:30px;margin:10px 0 4px;text-align:center;font-size:19px;font-weight:900;line-height:1.6}
.eq-ans{color:#1fa979;font-size:1.3em}
.eqwrap .center{text-align:center}
@media (max-width:600px){
  .eq-tip{font-size:15px}
  .eq-chip{font-size:22px;min-width:48px}
  .eq-row{gap:4px;padding:10px 2px}
  .eq-slot{min-width:56px;height:56px;font-size:24px;padding:0 4px;border-width:3px}
  .eq-slot.op{min-width:44px;font-size:28px}
  .eq-slot.res{min-width:60px}
  .eq-sign{font-size:24px}
  .eq-key{min-height:54px;font-size:26px}
  .eq-msg{font-size:17px}
}


/* 📝 月考測驗卷區塊（內容由 kg-exam.js 畫） */
.exam-sec{margin:26px 0 10px;background:#fff;border-radius:24px;border:4px solid var(--line);box-shadow:var(--shadow);padding:16px;max-width:100%;overflow:hidden}
/* 三版本：一個單元卡片裡有兩組關卡時的小標題 */
.u-sub{margin:10px 0 6px;font-size:17px;font-weight:900;color:var(--c);border-top:2px dashed var(--c);padding-top:8px}
/* 三版本補充單元（extra.js）：錢、方格、砝碼、表格、規律 */
.xmoney{display:flex;flex-wrap:wrap;gap:6px;justify-content:center;align-items:center;max-width:100%}
.xmg{display:inline-flex;flex-wrap:wrap;gap:4px;align-items:center}
.xmg b{font-size:20px;color:var(--ink)}
.xm.bill{width:84px;height:auto}
.opt .xmoney{max-width:300px}
.xgrid{max-width:100%;height:auto;touch-action:none;user-select:none}
.xgrid rect.c{fill:#fff;stroke:#d9d0e3;stroke-width:1.5;cursor:pointer}
.xgrid rect.c.on{fill:var(--mint)}
.xweights{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}
.xwbtn{border:0;border-radius:12px 12px 6px 6px;background:linear-gradient(#a98bff,#7a5cc4);color:#fff;font-weight:900;font-size:17px;padding:10px 12px;cursor:pointer;box-shadow:0 4px 0 #5a3f9c}
.xtray{min-height:60px;display:flex;flex-wrap:wrap;gap:6px;justify-content:center;align-items:flex-end;padding:8px;border-bottom:8px solid var(--purple);border-radius:6px;margin:10px auto;max-width:520px}
.xtray .xwbtn{font-size:15px;padding:6px 8px}
.xtable{border-collapse:collapse;margin:0 auto;font-size:20px;background:#fff}
.xtable td,.xtable th{border:2px solid #d9d0e3;padding:6px 10px;min-width:48px;text-align:center}
.xtable th{background:#f6f2ff}
.xtable td.q{color:var(--pink);font-weight:900}
.xseq{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;align-items:center;font-size:30px}
.xcell{min-width:56px;height:56px;padding:0 8px;border-radius:14px;background:#fff;border:3px solid var(--line);display:grid;place-items:center;font-size:24px;font-weight:900}
.xcell.blank{border:3px dashed var(--pink);color:var(--pink)}
.xscatter{position:relative;height:200px;background:linear-gradient(#fff8dd,#ffe7c2);border-radius:16px;margin-bottom:12px;overflow:hidden}
.xscatter span{position:absolute;font-size:30px;transform:translate(-50%,-50%);cursor:pointer;transition:opacity .2s}
.xscatter span.done{opacity:.25}
.xtally{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}
.xtally .t{background:#fff;border:2px solid var(--line);border-radius:14px;padding:8px 12px;text-align:center;font-size:19px;font-weight:900}
.xtally .t .v{display:block;font-size:26px;color:var(--purple);min-width:40px}
.xtally .t button{width:44px;height:40px;border-radius:10px;border:2px solid var(--line);background:#fff;font-size:22px;font-weight:900;cursor:pointer}
@media (max-width:480px){.xtable{font-size:15px}.xtable td,.xtable th{padding:4px 4px;min-width:32px}.xcell{min-width:42px;height:44px;font-size:19px}.xm.bill{width:66px}}
