*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
:root{
  --cream:#fff8e8;
  --paper:#fffdf7;
  --ink:#263047;
  --muted:#64748b;
  --orange:#f59e0b;
  --orange-deep:#ea580c;
  --blue:#38bdf8;
  --blue-deep:#2563eb;
  --yellow:#fde68a;
  --green:#22c55e;
  --line:#f0dcc0;
  --shadow:0 18px 42px rgba(120,72,20,.14);
}
html{overflow-x:hidden}
body{
  margin:0;
  min-height:100vh;
  overflow-x:hidden;
  color:var(--ink);
  font-family:Arial,"PingFang SC","Microsoft YaHei",sans-serif;
  background:
    radial-gradient(circle at 12% 10%,rgba(253,230,138,.66),transparent 24%),
    radial-gradient(circle at 88% 6%,rgba(56,189,248,.20),transparent 26%),
    linear-gradient(180deg,#fff7df 0%,#eaf7ff 100%);
}
a{color:inherit;text-decoration:none}
.site-nav{
  width:min(1120px,calc(100% - 28px));
  margin:0 auto;
  padding:18px 0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.brand-mark{
  width:46px;height:46px;border-radius:14px;
  display:grid;place-items:center;
  color:#fff;font-size:22px;font-weight:900;
  background:linear-gradient(135deg,#38bdf8,#2563eb,#f59e0b);
  box-shadow:0 12px 26px rgba(37,99,235,.22);
}
.brand strong{display:block;font-size:19px;line-height:1.1}.brand small{display:block;color:var(--muted);font-size:12px;margin-top:3px}
.nav-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.nav-actions a{
  min-height:40px;padding:0 14px;border-radius:999px;
  display:inline-flex;align-items:center;justify-content:center;
  color:#0f4f78;font-size:14px;font-weight:900;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(56,189,248,.26);
}
.page-shell{width:min(1120px,calc(100% - 28px));margin:0 auto 28px}
.hero{
  position:relative;
  min-height:250px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:34px;
  border-radius:8px;
  background:
    linear-gradient(135deg,rgba(255,255,255,.90),rgba(255,248,232,.94)),
    radial-gradient(circle at right,#fed7aa,transparent 40%);
  border:1px solid rgba(240,220,192,.9);
  box-shadow:var(--shadow);
  overflow:hidden;
}
.hero::after{
  content:"★";
  position:absolute;
  right:28px;
  top:20px;
  color:#facc15;
  font-size:34px;
  transform:rotate(12deg);
}
.eyebrow,.section-head p{
  margin:0 0 8px;
  color:var(--orange-deep);
  font-size:13px;
  font-weight:900;
  letter-spacing:1px;
}
.hero h1{margin:0;font-size:clamp(38px,8vw,70px);line-height:1.05;font-weight:900;color:#1f2937}
.hero-copy p:last-child{max-width:660px;margin:16px 0 0;color:#475569;font-size:19px;line-height:1.8}
.hero-badge{
  width:150px;height:150px;border-radius:50%;
  display:grid;place-items:center;
  background:linear-gradient(135deg,#fef3c7,#fdba74);
  border:8px solid #fff;
  box-shadow:0 20px 40px rgba(245,158,11,.22);
  flex:0 0 auto;
}
.hero-badge span{font-size:62px;font-weight:900;color:#9a3412;line-height:1}.hero-badge small{margin-top:-38px;color:#9a3412;font-weight:900}
.panel,.info-card{
  border-radius:8px;
  background:rgba(255,253,247,.92);
  border:1px solid rgba(240,220,192,.92);
  box-shadow:var(--shadow);
}
.panel{padding:24px}.section-head h2{margin:0;font-size:26px;line-height:1.2}
.visual-panel{margin-top:18px}
.visual-grid{display:grid;grid-template-columns:1.1fr 1fr 1fr 1.1fr;gap:16px;margin-top:18px;align-items:stretch}
.visual-card{min-width:0;display:flex;flex-direction:column;justify-content:center;padding:16px;border-radius:8px;background:#fffaf0;border:1px solid #fed7aa}
.visual-card h3{margin:0 0 12px;font-size:20px;color:#7c2d12;text-align:center}
.pizza-card{align-items:center}
.pizza-svg{width:100%;max-width:260px;aspect-ratio:1;filter:drop-shadow(0 14px 22px rgba(146,64,14,.18))}
.pizza-slice{stroke:#fff7ed;stroke-width:2.8;transition:fill .18s ease,transform .18s ease}
.pizza-slice.selected{fill:#fb923c}.pizza-slice.empty{fill:#ffe8bf}
.pizza-crust{fill:none;stroke:#d97706;stroke-width:9}
.topping{pointer-events:none}
.fraction-row{display:grid;grid-template-columns:minmax(112px,150px) 1fr;gap:16px;align-items:center;margin-top:18px}
.fraction-card{
  min-height:176px;
  padding:16px 12px;
  border-radius:8px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  background:#eff6ff;
  border:2px solid #bfdbfe;
}
.numerator,.denominator{font-size:54px;font-weight:900;line-height:.95}.numerator{color:var(--orange-deep)}.denominator{color:var(--blue-deep)}
.fraction-line{width:76px;height:5px;border-radius:999px;background:#334155;margin:10px 0}
.explain-text{margin:12px 0 0;padding:14px 16px;border-radius:8px;background:#fff7ed;border:1px solid #fed7aa;color:#7c2d12;font-size:18px;font-weight:800;line-height:1.7}
.fraction-row .explain-text{margin:0}
.shape-note{margin-top:12px}
.controls-panel{display:grid;grid-template-columns:1fr 1.3fr;gap:18px;align-content:start;margin-top:18px}.control-block h2{margin:0 0 10px;font-size:21px}
.button-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.take-grid{grid-template-columns:repeat(5,minmax(0,1fr))}
.chip{
  min-height:48px;
  border:0;
  border-radius:8px;
  color:#7c2d12;
  background:#ffedd5;
  border:2px solid #fed7aa;
  font:inherit;
  font-size:18px;
  font-weight:900;
  cursor:pointer;
  transition:transform .15s ease,background .15s ease,border-color .15s ease;
}
.chip:hover,.chip.active{transform:translateY(-1px);background:#fb923c;border-color:#ea580c;color:#fff}
.chocolate-bar{
  display:grid;
  gap:0;
  padding:12px;
  border-radius:8px;
  background:#7c2d12;
  box-shadow:inset 0 0 0 4px rgba(255,255,255,.28);
}
.choco-piece{
  min-height:58px;
  border-radius:0;
  background:#d6a77a;
  border:1px solid rgba(255,255,255,.65);
  box-shadow:inset 0 8px 14px rgba(255,255,255,.18);
}
.choco-piece.selected{background:#92400e}
.fraction-grid{display:grid;gap:0;padding:0;border-radius:8px;background:#e0f2fe;border:3px solid #60a5fa;overflow:hidden}
.square-grid{aspect-ratio:1;align-content:stretch}
.rectangle-grid{aspect-ratio:3 / 1;align-content:stretch}
.shape-piece{min-height:42px;border-radius:0;background:#bfdbfe;border:1px solid rgba(255,255,255,.95);box-shadow:inset 0 8px 14px rgba(255,255,255,.22)}
.shape-piece.selected{background:#38bdf8}
.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin-top:18px}
.info-card{padding:22px}.info-card strong{display:block;font-size:23px}.info-card p{margin:10px 0 0;color:#475569;font-size:17px;line-height:1.7}
.numerator-card{border-color:#fdba74;background:#fff7ed}.numerator-card strong{color:var(--orange-deep)}
.denominator-card{border-color:#bfdbfe;background:#eff6ff}.denominator-card strong{color:var(--blue-deep)}
.game-panel{margin-top:18px}.game-tip{margin:10px 0 18px;color:#475569;font-size:18px;font-weight:900}
.target-word{display:inline-block;margin:0 8px;font-size:34px;line-height:1;color:#ea580c;text-shadow:0 3px 0 rgba(253,230,138,.9)}
.target-word.small-target{color:#2563eb;text-shadow:0 3px 0 rgba(191,219,254,.9)}
.target-word.big-target{color:#ea580c;text-shadow:0 3px 0 rgba(253,186,116,.9)}
.game-board{display:grid;grid-template-columns:1fr auto 1fr;gap:16px;align-items:center}
.choice-card{
  min-width:0;
  min-height:250px;
  border-radius:8px;
  border:3px solid #fed7aa;
  background:#fff7ed;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  cursor:pointer;
  font:inherit;
  transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease;
}
.choice-card:hover{transform:translateY(-2px);border-color:#fb923c;box-shadow:0 14px 28px rgba(245,158,11,.18)}
.choice-label{font-size:34px;font-weight:900;color:#7c2d12}
.mini-shape{width:min(190px,84%);min-height:160px;display:grid;place-items:center}
.mini-pizza{width:100%;aspect-ratio:1;filter:drop-shadow(0 10px 14px rgba(146,64,14,.15))}
.mini-grid{display:grid;gap:0;overflow:hidden;border:3px solid #60a5fa;background:#dbeafe;box-shadow:0 10px 14px rgba(37,99,235,.10)}
.mini-square{width:min(160px,100%);aspect-ratio:1;border-radius:8px}
.mini-rectangle{width:min(190px,100%);aspect-ratio:3 / 1;border-radius:8px}
.mini-piece{min-width:0;min-height:44px;border:1px solid rgba(255,255,255,.95);background:#bfdbfe;box-shadow:inset 0 8px 14px rgba(255,255,255,.20)}
.mini-piece.selected{background:#38bdf8}
.vs{padding:10px 12px;border-radius:999px;background:#dbeafe;color:#1d4ed8;font-weight:900;white-space:nowrap}
.feedback{margin-top:16px;padding:14px 16px;border-radius:8px;background:#f8fafc;border:1px solid #dbeafe;color:#334155;font-size:18px;font-weight:800;line-height:1.7}
.feedback.good{background:#ecfdf5;border-color:#bbf7d0;color:#047857}.feedback.try{background:#fff1f2;border-color:#fecdd3;color:#be123c}
.cheer-modal{position:fixed;inset:0;z-index:80;display:grid;place-items:center;padding:18px;background:rgba(15,23,42,.18);opacity:0;pointer-events:none;transition:opacity .18s ease}
.cheer-modal.show{opacity:1}
.cheer-card{width:min(360px,92vw);padding:28px 22px;border-radius:8px;text-align:center;background:linear-gradient(135deg,#fff7ed,#eff6ff);border:3px solid #facc15;box-shadow:0 24px 70px rgba(120,72,20,.28);animation:cheerPop .36s ease both}
.cheer-stars{color:#f59e0b;font-size:32px;letter-spacing:8px;animation:sparkle .8s ease infinite alternate}.cheer-card strong{display:block;margin-top:8px;color:#ea580c;font-size:38px;line-height:1}.cheer-card p{margin:12px 0 0;color:#1d4ed8;font-size:18px;font-weight:900}
@keyframes cheerPop{from{transform:scale(.82);opacity:.2}to{transform:scale(1);opacity:1}}
@keyframes sparkle{from{transform:translateY(0) scale(1);filter:brightness(1)}to{transform:translateY(-3px) scale(1.08);filter:brightness(1.25)}}
.next-btn{
  margin-top:14px;
  min-height:50px;
  padding:0 20px;
  border:0;
  border-radius:8px;
  background:linear-gradient(135deg,#38bdf8,#2563eb);
  color:#fff;
  font:inherit;
  font-size:18px;
  font-weight:900;
  cursor:pointer;
}
.secondary-btn{background:linear-gradient(135deg,#f59e0b,#ea580c)}
.calc-entry{margin-top:18px;display:flex;align-items:center;justify-content:space-between;gap:16px}
.calc-entry h2{margin:0 0 8px;font-size:26px}.calc-entry p:last-child{margin:0;color:#475569;font-size:17px}
.entry-btn{min-height:52px;padding:0 18px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#38bdf8,#2563eb);color:#fff;font-weight:900;white-space:nowrap}
.calc-hero .hero-badge span{font-size:58px}
.calc-panel{margin-top:18px}.calc-expression{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin-top:18px;padding:16px;border-radius:8px;background:#eff6ff;border:2px solid #bfdbfe;color:#1e3a8a;font-size:clamp(28px,7vw,54px);font-weight:900}
.custom-calc{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) auto;gap:12px;align-items:end;margin-top:18px;padding:16px;border-radius:8px;background:#fff7ed;border:1px solid #fed7aa}.custom-field label{display:block;margin-bottom:6px;color:#7c2d12;font-size:14px;font-weight:900}.custom-field select{width:100%;min-height:48px;border-radius:8px;border:2px solid #fed7aa;background:#fff;color:#263047;font:inherit;font-size:17px;font-weight:900;padding:0 10px}.custom-field select:focus{outline:3px solid rgba(56,189,248,.28);border-color:#38bdf8}.custom-apply{border:0;min-height:48px;cursor:pointer}.custom-hint{margin:10px 0 0;color:#7c2d12;font-size:15px;font-weight:800}
.calc-stage{display:grid;gap:16px;margin-top:18px}.calc-row{display:grid;grid-template-columns:86px 1fr;gap:12px;align-items:center}.calc-label{font-size:18px;font-weight:900;color:#7c2d12}.calc-bar{display:grid;gap:0;min-height:76px;border-radius:8px;overflow:hidden;border:3px solid #60a5fa;background:#dbeafe}.calc-piece{min-width:0;border:1px solid rgba(255,255,255,.95);background:#bfdbfe;transition:background .25s ease,transform .25s ease}.calc-piece.selected{background:#38bdf8}.calc-piece.added{background:#f59e0b;animation:popPiece .45s ease both}.calc-piece.removed{background:#fca5a5;animation:fadePiece .55s ease both}.result-row .calc-bar{border-color:#22c55e}.result-row .calc-piece.selected{background:#22c55e;animation:popPiece .35s ease both}.calc-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:16px}.calc-lesson{margin-top:18px}.lesson-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
@keyframes popPiece{from{transform:scale(.86);opacity:.35}to{transform:scale(1);opacity:1}}
@keyframes fadePiece{from{transform:scale(1);opacity:1}to{transform:scale(.9);opacity:.45}}
.site-footer{
  width:min(1120px,calc(100% - 28px));
  margin:0 auto 24px;
  padding:18px 22px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  color:#475569;
  background:rgba(255,255,255,.62);
  border:1px solid rgba(240,220,192,.9);
  border-radius:8px;
}
.site-footer strong{color:#0f4f78}
@media (max-width:860px){
  .site-nav{align-items:flex-start;flex-direction:column}
  .nav-actions{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .visual-grid{grid-template-columns:1fr 1fr}
  .controls-panel,.info-grid,.lesson-grid{grid-template-columns:1fr}
  .custom-calc{grid-template-columns:1fr 1fr}.custom-apply{grid-column:1 / -1}
  .fraction-row{grid-template-columns:1fr;justify-items:center}
  .calc-entry{align-items:stretch;flex-direction:column}.entry-btn{width:100%}.calc-row{grid-template-columns:1fr}.calc-label{font-size:16px}
  .fraction-card{width:min(220px,100%);min-height:150px}
  .game-board{grid-template-columns:1fr}
  .vs{justify-self:center}
}
@media (max-width:560px){
  .page-shell,.site-nav,.site-footer{width:min(100% - 20px,1120px)}
  .hero{padding:26px 18px;display:block}.hero-badge{width:116px;height:116px;margin:22px auto 0}.hero-badge span{font-size:48px}.hero-badge small{margin-top:-30px}
  .panel{padding:18px}.hero-copy p:last-child,.explain-text,.feedback{font-size:16px}
  .visual-grid{grid-template-columns:1fr}
  .visual-card:has(.square-grid),.visual-card:has(.rectangle-grid){padding:12px}
  .visual-card:has(.square-grid) h3,.visual-card:has(.rectangle-grid) h3{font-size:18px;margin-bottom:8px}
  .square-grid{width:min(220px,74vw);justify-self:center}
  .rectangle-grid{width:min(260px,78vw);justify-self:center}
  .button-grid,.take-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .choco-piece{min-height:48px}.rectangle-grid{aspect-ratio:2 / 1}.shape-piece{min-height:38px}.choice-card{min-height:220px}
  .site-footer{flex-direction:column;text-align:center}
}
