/* ===== 수학 개념 놀이터 1-2 · 갤럭시탭 가로 1280×800 기준 ===== */
:root {
  --bg: #FFF6E0;
  --paper: #FFFDF8;
  --ink: #3B3024;
  --sub: #8A7A66;
  --line: #EEDDBE;
  --orange: #F28A2E;
  --orange-d: #D46F17;
  --yellow: #FFC94A;
  --yellow-l: #FFE7A0;
  --pink: #F8B4CF;
  --pink-d: #E0558F;
  --blue: #3E6FD8;
  --blue-d: #24478F;
  --green: #4DB45A;
  --green-l: #DDF3D8;
  --red: #E8504A;
  --red-l: #FDE1DF;
  --card-y: #FBE08A;
  --card-p: #F6C5C9;
  --card-g: #B9E2C5;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #F1DFB8;
  font-family: 'Jua', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
#viewport { position: fixed; inset: 0; overflow: hidden; }
#app {
  position: absolute; width: 1280px; height: 800px; transform-origin: 0 0;
  background: var(--bg); overflow: hidden;
  background-image: radial-gradient(circle at 1px 1px, rgba(214, 180, 120, .18) 1.5px, transparent 0);
  background-size: 28px 28px;
}

/* 세로 안내 */
#rotate { display: none; position: fixed; inset: 0; z-index: 99; background: rgba(59, 48, 36, .92); color: #fff; align-items: center; justify-content: center; text-align: center; }
body.portrait #rotate { display: flex; }
.rotate-ic { font-size: 72px; margin-bottom: 10px; }
.rotate-box p { font-size: 28px; margin: 0; }

/* ---------- 공통 애니메이션 ---------- */
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-18px) rotate(-6deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(6px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 0 var(--orange-d), 0 0 0 0 rgba(242, 138, 46, .55); } 50% { box-shadow: 0 6px 0 var(--orange-d), 0 0 0 14px rgba(242, 138, 46, 0); } }
@keyframes spark { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2); opacity: 0; } }
@keyframes starIn { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.25) rotate(10deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes shine { 0%, 100% { filter: none; } 50% { filter: brightness(1.5) drop-shadow(0 0 8px #FFD25E); transform: translateY(-6px); } }
.pop { animation: popIn .45s ease-out both; }
.pop-in { animation: fadeIn .35s ease-out both; }
.fade-in { animation: fadeIn .35s ease-out both; }
.hop { animation: hop .5s ease-out; }
.shake { animation: shake .45s; }
.mascot.bob { animation: bob 2.4s ease-in-out infinite; }

/* ---------- 머리글 ---------- */
.top {
  height: 76px; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: linear-gradient(#FFD36B, #FFC94A); border-bottom: 4px solid #F2B53A;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .04);
}
.ib { width: 54px; height: 54px; border-radius: 16px; background: #fff; font-size: 24px; box-shadow: 0 4px 0 #E6A82E; flex: none; }
.ib:active { transform: translateY(3px); box-shadow: 0 1px 0 #E6A82E; }
.top-t { font-size: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5A3A10; }
.top-mid { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-right: 8px; }

/* ---------- 처음 화면 ---------- */
.home { display: flex; height: 100%; padding: 28px; gap: 28px; }
.hero {
  width: 400px; flex: none; border-radius: 34px; padding: 34px 32px 26px;
  background: linear-gradient(160deg, #FFD873, #FFB547); box-shadow: 0 10px 0 #E59A2C;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255, 255, 255, .18); right: -110px; top: -90px; }
.hero-badge { align-self: flex-start; background: #fff; color: var(--orange-d); padding: 8px 18px; border-radius: 99px; font-size: 22px; }
.hero h1 { font-size: 68px; line-height: 1.08; margin: 22px 0 0; color: #5A3A10; font-weight: normal; letter-spacing: -1px; }
.hero-m { margin-top: auto; display: flex; align-items: flex-end; gap: 8px; }
.bubble { background: #fff; border-radius: 22px; padding: 14px 18px; font-size: 22px; line-height: 1.35; position: relative; margin-bottom: 60px; box-shadow: 0 4px 0 rgba(0, 0, 0, .08); }
.bubble::before { content: ''; position: absolute; left: -12px; bottom: 18px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
.bubble.sm { font-size: 20px; margin: 0; }
.hero-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.hero-stars { font-size: 22px; color: #5A3A10; }
.hero-stars b { font-size: 28px; color: #fff; text-shadow: 0 2px 0 #D88A1E; }
.snd { background: rgba(255, 255, 255, .7); border-radius: 99px; padding: 10px 16px; font-size: 18px; }

.units { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 22px; }
.unit {
  border-radius: 30px; background: var(--paper); box-shadow: 0 8px 0 rgba(150, 110, 50, .22);
  border: 4px solid var(--uc); position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; gap: 8px;
  transition: transform .12s;
}
.unit::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 46%; background: var(--uc); opacity: .45; }
.unit > * { position: relative; }
.unit:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(150, 110, 50, .22); }
.u-no { position: absolute; top: 16px; left: 18px; background: #fff; border-radius: 99px; padding: 4px 14px; font-size: 18px; color: var(--sub); }
.u-ic { font-size: 72px; line-height: 1; margin-top: 16px; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .08)); }
.u-t { font-size: 30px; margin-top: 6px; }
.u-p { width: 76%; height: 14px; background: #F2E6CF; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.u-p i { display: block; height: 100%; background: linear-gradient(90deg, #FFC94A, #F28A2E); border-radius: 99px; min-width: 14px; }
.u-ps { font-size: 18px; color: var(--sub); }
.u-lock { font-size: 18px; color: var(--sub); background: #F4ECDD; padding: 6px 14px; border-radius: 99px; margin-top: 4px; }
.unit.locked { filter: saturate(.55); opacity: .78; }

/* ---------- 단원 화면 ---------- */
.lessons { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 22px; padding: 24px 28px 28px; height: 724px; }
.lesson {
  background: var(--paper); border-radius: 28px; padding: 18px 22px 18px; position: relative;
  box-shadow: 0 7px 0 rgba(150, 110, 50, .2); border: 3px solid var(--line);
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.l-head { align-self: stretch; display: flex; justify-content: space-between; align-items: center; }
.l-no { background: var(--orange); color: #fff; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; box-shadow: 0 4px 0 var(--orange-d); }
.l-done { background: var(--green-l); color: #2E7D38; padding: 5px 12px; border-radius: 99px; font-size: 17px; }
.l-ic { font-size: 48px; line-height: 1; margin-top: -8px; }
.l-t { font-size: 27px; margin-top: 8px; }
.l-g { font-size: 17px; color: var(--sub); margin-top: 6px; line-height: 1.35; min-height: 46px; font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif; font-weight: 500; }
.l-stars { margin-top: 4px; font-size: 30px; letter-spacing: 4px; }
.st { color: #E8DCC6; }
.st.on { color: #FFB800; text-shadow: 0 2px 0 #E09A00; }
.l-btns { display: flex; gap: 10px; margin-top: auto; align-self: stretch; }
.lb { flex: 1; height: 58px; border-radius: 18px; font-size: 21px; color: #fff; }
.lb.lb-blue { background: var(--blue); box-shadow: 0 5px 0 var(--blue-d); }
.lb.lb-orange { background: var(--orange); box-shadow: 0 5px 0 var(--orange-d); }
.lb.lb-green { background: var(--green); box-shadow: 0 5px 0 #2F8B3B; }
.lb:active { transform: translateY(4px); box-shadow: none; }

/* ---------- 개념 화면 ---------- */
.dots-nav { display: flex; gap: 8px; }
.dn { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .6); font-size: 19px; color: #A4782E; }
.dn.past { background: #FFF1C9; }
.dn.on { background: #fff; color: var(--orange-d); box-shadow: 0 0 0 3px var(--orange); }
.concept { height: 608px; padding: 16px 32px 0; display: flex; flex-direction: column; }
.st-title { font-size: 30px; display: flex; align-items: center; gap: 14px; color: #5A3A10; }
.st-badge { background: var(--orange); color: #fff; font-size: 18px; padding: 5px 13px; border-radius: 99px; }
.st-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 0; }
.c-foot { height: 116px; display: flex; align-items: center; gap: 22px; padding: 0 28px 14px; }
.guide { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.say {
  flex: 1; background: #fff; border-radius: 22px; padding: 14px 22px; font-size: 23px; line-height: 1.35;
  box-shadow: 0 4px 0 rgba(150, 110, 50, .15); border: 3px solid var(--line); position: relative; min-height: 74px; display: flex; align-items: center;
}
.say::before { content: ''; position: absolute; left: -14px; top: 50%; margin-top: -10px; border: 10px solid transparent; border-right: 12px solid var(--line); border-left: 0; }
.c-nav { display: flex; gap: 12px; flex: none; }
.nb { height: 70px; padding: 0 26px; border-radius: 20px; font-size: 24px; background: #fff; box-shadow: 0 5px 0 #DCC9A6; }
.nb:disabled { opacity: .35; }
.nb.next { background: var(--orange); color: #fff; box-shadow: 0 6px 0 var(--orange-d); min-width: 160px; }
.nb.next.ready { animation: pulse 1.4s infinite; }
.nb:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }

.cbtns { display: flex; gap: 14px; justify-content: center; }
.cbtns.col { flex-direction: column; }
.cbtn { height: 62px; padding: 0 26px; border-radius: 18px; font-size: 23px; background: var(--blue); color: #fff; box-shadow: 0 5px 0 var(--blue-d); transition: opacity .2s; }
.cbtn:disabled { background: #C9CFDB; box-shadow: 0 5px 0 #A8AFBD; opacity: .7; }
.cbtn:active:not(:disabled) { transform: translateY(4px); box-shadow: none; }
.result { min-height: 76px; display: flex; align-items: center; justify-content: center; }
.res-box { display: flex; align-items: center; gap: 18px; background: #fff; border: 4px solid var(--yellow); border-radius: 24px; padding: 6px 26px; box-shadow: 0 5px 0 rgba(242, 181, 58, .5); }
.res-say { font-size: 22px; color: var(--orange-d); }
.res-arrow { font-size: 30px; color: var(--sub); }
.res-now { opacity: .8; }
.steps-eq { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 3px solid var(--yellow); border-radius: 20px; padding: 8px 22px; }

/* 식 */
.eq { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 52px; line-height: 1; }
.eq .tk { display: inline-flex; align-items: center; justify-content: center; }
.eq .op { color: #7A6650; margin: 0 4px; }
.eq .q { color: var(--orange); }
.eq .txt { font-size: .62em; margin: 0 4px; }
.eq.xl { font-size: 84px; }
.eq.lg { font-size: 60px; }
.eq.md { font-size: 50px; }
.eq.sm { font-size: 34px; justify-content: flex-start; }
.eq .ans { color: var(--red); }

/* 가르기 나무 */
.split-eq { margin-bottom: 118px; }
.split-eq.wide .op { margin: 0 66px; }
.opnd { position: relative; min-width: 1.1em; }
.opnd.hl::before, .kid.hl::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 1.25em; height: 1.25em; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--pink); z-index: -1; opacity: .85;
}
.split-eq .opnd.hl::before { width: calc(100% + .45em); min-width: 1.25em; border-radius: .7em; }
.split-eq { position: relative; z-index: 0; isolation: isolate; }
.tree { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); width: 180px; font-size: 44px; }
.tree-lines { display: block; width: 180px; height: 52px; }
.tree-lines path { stroke: var(--pink-d); stroke-width: 3.2; fill: none; stroke-linecap: round; }
.tree-kids { display: flex; justify-content: space-between; margin-top: 2px; }
.kid { position: relative; width: 68px; height: 64px; display: flex; align-items: center; justify-content: center; }
.kid .tk.num { font-size: 44px; }
.eq.md .tree, .eq.md.split-eq .tree { font-size: 40px; }

/* 정리 카드 */
.ov { display: flex; gap: 28px; }
.ov-card { width: 520px; background: #fff; border-radius: 28px; border: 3px solid var(--line); padding: 20px 24px 18px; box-shadow: 0 6px 0 rgba(150, 110, 50, .14); display: flex; flex-direction: column; align-items: center; }
.ov-label { font-size: 24px; color: #fff; background: var(--pink-d); border-radius: 99px; padding: 6px 18px; margin-bottom: 14px; }
.ov-lines { margin: 0; padding: 0; list-style: none; counter-reset: s; align-self: stretch; }
.ov-lines li { counter-increment: s; font-size: 23px; padding: 6px 0 6px 44px; position: relative; }
.ov-lines li::before { content: counter(s); position: absolute; left: 6px; top: 4px; width: 30px; height: 30px; border-radius: 50%; background: var(--yellow-l); display: grid; place-items: center; font-size: 18px; color: var(--orange-d); }

/* 컵 */
.cups { display: flex; gap: 10px; align-items: flex-end; }
.cup { width: 58px; height: 72px; transition: transform .4s, opacity .4s; }
.cups.big .cup { width: 64px; height: 80px; }
.cups.sm { gap: 6px; }
.cups.sm .cup { width: 36px; height: 45px; }
.cups.tap .cup { cursor: pointer; }
.cup.given { transform: translateY(-60px) scale(.5) rotate(18deg); opacity: .12; }
.cup-labels { display: flex; gap: 40px; font-size: 26px; color: var(--sub); }
.cup-labels b { color: var(--ink); font-size: 32px; }
.gift { font-size: 26px; color: var(--sub); }
.gift b { color: var(--pink-d); font-size: 34px; }

/* 이어 세기 줄 */
.cline { display: flex; padding-bottom: 46px; }
.ci { width: 64px; position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.dot { width: 44px; height: 44px; border-radius: 50%; display: inline-block; transition: background .2s, transform .2s; }
.dot.hollow { border: 4px solid #8B8B8B; background: #fff; }
.dot.blue { background: var(--blue); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .15); }
.dot.blue.off { background: #fff; border: 4px dashed #9FB6E8; box-shadow: none; }
.dot.green { background: #6CC04A; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .15); }
.dot.x { opacity: .28; position: relative; }
.dot.x::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font-size: 34px; opacity: 1; }
.cn { height: 38px; font-size: 30px; margin-top: 6px; }
.cn.ans { color: #fff; background: var(--red); border-radius: 12px; padding: 0 10px; }
.arc { position: absolute; top: 92px; left: -32px; width: 64px; height: 24px; border: 3px solid #9A8B78; border-top: 0; border-radius: 0 0 32px 32px; animation: fadeIn .3s; }
.arc::after { content: ''; position: absolute; right: -7px; top: -9px; border: 7px solid transparent; border-bottom: 9px solid #9A8B78; border-top: 0; }
.arc.left { left: -32px; }
.arc.left::after { right: auto; left: -7px; }

/* 10칸 틀 */
.frames { display: flex; gap: 26px; align-items: flex-start; }
.frame { display: grid; grid-template-columns: repeat(5, 60px); grid-auto-rows: 60px; border: 3px solid #7B7468; border-radius: 12px; overflow: hidden; background: #fff; }
.cell { border-right: 2px solid #CFC7B8; border-bottom: 2px solid #CFC7B8; display: grid; place-items: center; }
.cell:nth-child(5n) { border-right: 0; }
.cell:nth-child(n+6) { border-bottom: 0; }
.frames.tap .cell { cursor: pointer; }
.mk { display: inline-block; }
.mk.o { width: 38px; height: 38px; border: 4px solid #6A6A6A; border-radius: 50%; }
.mk.t .tri { width: 40px; height: 36px; display: block; }
.mk.r, .mk.b { width: 44px; height: 44px; border-radius: 50%; cursor: pointer; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18); }
.mk.r { background: #EE5A5A; }
.mk.b { background: var(--blue); }
.frames.sm .frame { grid-template-columns: repeat(5, 48px); grid-auto-rows: 48px; }
.frames.sm .mk.o { width: 30px; height: 30px; }
.frames.sm .mk.t .tri { width: 32px; height: 29px; }
.fwrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fcount { font-size: 30px; background: #fff; border-radius: 99px; min-width: 56px; text-align: center; padding: 2px 12px; border: 3px solid var(--line); }
.fcount.full { background: var(--yellow); border-color: #F2B53A; }
.fplus { font-size: 54px; color: #7A6650; align-self: center; margin-top: -40px; }
.counter, .ab-count, .cube-count { font-size: 26px; color: var(--sub); }
.counter b, .ab-count b, .cube-count b { color: var(--ink); font-size: 32px; }
.mt-area { display: flex; justify-content: center; }
.mt-row { display: flex; align-items: flex-start; gap: 60px; }
.mt-row .split-eq { margin-bottom: 100px; }
.mt-side { display: flex; flex-direction: column; gap: 16px; align-items: center; min-width: 300px; }
.play-tip { font-size: 22px; color: var(--sub); }
.play-tip b { color: var(--orange-d); }
.same { display: flex; align-items: center; gap: 20px; background: #fff; border: 4px solid var(--yellow); border-radius: 24px; padding: 6px 24px; }
.same-eq { font-size: 46px; color: var(--pink-d); }

/* 구슬틀 */
.ab-wrap { padding: 6px 0; }
.abacus { position: relative; width: 640px; padding: 18px 20px; background: #FFF3DC; border-radius: 16px; }
.ab-post { position: absolute; top: 0; bottom: 0; width: 14px; background: #7A4E2C; border-radius: 6px; }
.ab-post.l { left: 0; } .ab-post.r { right: 0; }
.ab-row { position: relative; height: 56px; width: 600px; }
.ab-row + .ab-row { margin-top: 16px; }
.ab-wire { position: absolute; left: 0; right: 0; top: 27px; height: 3px; background: #333; }
.bead { position: absolute; top: 6px; left: 0; width: 44px; height: 44px; border-radius: 50%; transition: transform .25s ease-out; box-shadow: inset -4px -5px 0 rgba(0, 0, 0, .16), inset 4px 4px 0 rgba(255, 255, 255, .25); }
.bead.red { background: #E44E5A; }
.bead.blue { background: var(--blue); }
.ab-wrap.sm .abacus { transform: scale(.8); transform-origin: top center; margin-bottom: -28px; }

/* 연결 모형 */
.cube-stage { padding: 10px; }
.cubes { display: flex; align-items: center; gap: 22px; }
.bar { display: flex; border-radius: 8px; box-shadow: 0 4px 0 #1E3F86; }
.cube { width: 54px; height: 54px; background: linear-gradient(#5584E6, #3E6FD8); border: 2px solid #284E9E; position: relative; cursor: pointer; transition: transform .3s, opacity .3s, background .3s; }
.cube::after { content: ''; position: absolute; inset: 15px; border-radius: 50%; border: 3px solid #1E3F86; background: #6B95EC; }
.bar .cube + .cube { border-left-width: 1px; }
.cube.single { border-radius: 8px; box-shadow: 0 4px 0 #1E3F86; }
.cube.gone { background: transparent; border-style: dashed; border-color: #B8C2D8; box-shadow: none; transform: translateY(-10px); }
.cube.gone::after { opacity: .15; }
.cube.shine { animation: shine .8s 2; }
.cube-stage.sm .cube { width: 40px; height: 40px; }
.cube-stage.sm .cube::after { inset: 10px; border-width: 2px; }

/* 짝 짓기 */
.pairs { display: flex; flex-direction: column; }
.prow { display: flex; gap: 8px; }
.pc { width: 60px; text-align: center; font-size: 46px; transition: transform .3s, filter .3s; }
.pc.glow { filter: drop-shadow(0 0 8px #FFC94A); transform: scale(1.12); }
.prow.lines { height: 44px; }
.pl { width: 60px; position: relative; }
.pl.on::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: var(--red); border-radius: 2px; animation: fadeIn .2s; }

/* 규칙 찾기 */
.pat { display: flex; flex-direction: column; gap: 18px; }
.pat-row { display: flex; align-items: center; gap: 40px; opacity: .12; transition: opacity .3s; }
.pat-row.show { opacity: 1; animation: fadeIn .35s; }
.pat-row .eq { width: 360px; justify-content: flex-start; }
.strip { display: flex; gap: 6px; }
.sd { width: 30px; height: 30px; border-radius: 50%; display: inline-block; }
.sd.r { background: #EE5A5A; } .sd.b { background: var(--blue); }
.sd.x { background: #fff; border: 3px dashed #B8C2D8; }
.rule { min-height: 70px; display: flex; align-items: center; }
.rule-box { background: #FFF1C2; border: 3px solid var(--yellow); border-radius: 20px; padding: 12px 24px; font-size: 26px; }

/* 정리 */
.sum3 { display: flex; gap: 24px; }
.sum-card { width: 300px; background: #fff; border: 3px solid var(--line); border-radius: 26px; padding: 22px; text-align: center; box-shadow: 0 6px 0 rgba(150, 110, 50, .14); }
.sum-t { font-size: 26px; color: var(--blue); }
.sum-v { font-size: 26px; margin-top: 10px; }

/* 수 카드 */
.ncards { display: flex; gap: 24px; }
.ncard { width: 100px; height: 120px; border-radius: 16px; background: #fff; border: 5px solid; font-size: 50px; display: grid; place-items: center; box-shadow: 0 6px 0 rgba(0, 0, 0, .1); }
.ncard:nth-child(1) { border-color: #F2B96B; background: #FFF4DF; }
.ncard:nth-child(2) { border-color: #9CCB7E; background: #EEF8E6; }
.ncard:nth-child(3) { border-color: #74B57D; background: #E6F4E8; }
button.ncard:active { transform: translateY(4px); }
.ncards.static .ncard { width: 80px; height: 96px; font-size: 40px; }
.slots { display: flex; align-items: center; gap: 12px; font-size: 56px; }
.slot { width: 110px; height: 90px; border: 4px dashed #C9B68F; border-radius: 16px; font-size: 52px; background: #fff; }
.slot.filled { border-style: solid; border-color: var(--orange); }
.made { display: flex; gap: 20px; min-height: 56px; }
.made-eq { font-size: 34px; background: var(--green-l); color: #2E7D38; padding: 6px 22px; border-radius: 16px; }

/* ---------- 문제 화면 ---------- */
.pbar { width: 300px; height: 18px; background: rgba(255, 255, 255, .6); border-radius: 99px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; transition: width .4s; }
.pcount { font-size: 22px; color: #5A3A10; min-width: 64px; }
.prac { display: flex; gap: 22px; padding: 20px 24px 24px; height: 724px; }
.pcard { flex: 1; background: var(--paper); border-radius: 30px; border: 3px solid var(--line); box-shadow: 0 7px 0 rgba(150, 110, 50, .18); padding: 22px 30px 18px; display: flex; flex-direction: column; position: relative; min-width: 0; }
.pq { display: flex; align-items: flex-start; gap: 14px; font-size: 27px; line-height: 1.35; }
.pnum { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 25px; margin-top: -4px; }
.pbody { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 0; overflow: visible; }
.pbody:has(.model-wrap) { justify-content: flex-start; gap: 12px; padding-top: 4px; }
.pfeed { min-height: 92px; display: flex; align-items: flex-end; }

.blank {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.45em; height: 1.35em; padding: 0 .12em; border: 4px solid #A99A84; border-radius: 14px; background: #fff;
  cursor: pointer; font-size: 1em; color: var(--blue-d); transition: border-color .15s, box-shadow .15s, background .15s; position: relative;
}
.blank.focus { border-color: var(--orange); box-shadow: 0 0 0 5px rgba(242, 138, 46, .25); background: #FFF8EC; }
.blank.focus:empty::after { content: ''; width: 3px; height: .7em; background: var(--orange); animation: bob 1s steps(2) infinite; }
.blank.right { border-color: var(--green); background: var(--green-l); color: #2E7D38; }
.blank.wrong { border-color: var(--red); background: var(--red-l); animation: shake .45s; }
.kid .blank { font-size: 42px; }
.eq.pe { font-size: 54px; }
.eq-line { display: flex; align-items: center; gap: 16px; }
.tag { font-size: 22px; background: var(--yellow); color: #5A3A10; padding: 6px 14px; border-radius: 10px; }
.tag.dap { background: #FFD6A0; }

.pgrid { display: grid; gap: 22px 70px; }
.pgrid.cols-2 { grid-template-columns: repeat(2, auto); }
.pgrid.flow-col { grid-auto-flow: column; grid-template-rows: repeat(3, auto); }
.pgrid .gi { display: flex; justify-content: flex-start; }
.pgrid .eq.pe { font-size: 48px; justify-content: flex-start; }
.pgrid.has-split { gap: 22px 90px; }
.pgrid.has-split .eq.pe { font-size: 50px; }

.ptable { display: flex; align-items: center; gap: 0; }
.pt-op { background: #C9D6F5; border: 4px solid #8EA8E6; border-radius: 50%; width: 120px; height: 80px; display: grid; place-items: center; font-size: 40px; margin-right: 30px; position: relative; }
.pt-op::after { content: '➜'; position: absolute; right: -32px; font-size: 26px; color: var(--sub); }
.ptable table { border-collapse: separate; border-spacing: 0; border: 4px solid #F0C36B; border-radius: 18px; overflow: hidden; font-size: 46px; }
.ptable td { width: 128px; height: 84px; text-align: center; border-right: 2px solid #F0D79B; background: #fff; }
.ptable td:last-child { border-right: 0; }
.ptable td.th { background: #FCE3A2; border-bottom: 3px solid #F0C36B; }

.parrow { display: flex; align-items: flex-end; gap: 0; position: relative; padding-top: 70px; font-size: 52px; }
.pa-from { background: #D7CBF0; border: 5px solid #A18BD6; border-radius: 40px; padding: 10px 36px; }
.pa-svg { width: 260px; height: 90px; margin: 0 -20px 30px; }
.pa-op { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background: #C9D6F5; border: 4px solid #8EA8E6; border-radius: 40px; padding: 4px 26px; font-size: 42px; }
.pa-to .blank { border-radius: 40px; min-width: 2.6em; border-width: 5px; border-color: #A18BD6; }

.pbox { border: 4px solid #F0B260; border-radius: 26px; padding: 18px 40px; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.pbox .eq.pe { font-size: 46px; }
.pbox .eq.long { font-size: 28px; justify-content: flex-start; flex-wrap: wrap; row-gap: 10px; }
.pbox .eq.long .blank { width: 54px; height: 50px; font-size: 26px; }

.pics { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pic-row { display: flex; gap: 2px; flex-wrap: wrap; max-width: 860px; }
.pic { font-size: 40px; width: 48px; text-align: center; transition: opacity .2s; position: relative; }
.pic-row.tap .pic { cursor: pointer; }
.pic.x { opacity: .3; }
.pic.x::after { content: '✕'; position: absolute; inset: 0; color: var(--red); font-size: 40px; display: grid; place-items: center; opacity: 1; }
.pics.pair .pic { width: 52px; font-size: 42px; }
.pic-note { font-size: 20px; color: var(--sub); margin-top: 4px; }
.pic-cnt { color: var(--orange-d); font-weight: normal; }
.story { display: flex; align-items: center; gap: 14px; align-self: stretch; justify-content: center; }
.who { font-size: 56px; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.who small { font-size: 18px; color: var(--sub); margin-top: 4px; }
.speech { background: #fff; border: 3px solid #3B3024; border-radius: 30px; padding: 14px 24px; font-size: 24px; max-width: 640px; line-height: 1.35; position: relative; }
.speech::before { content: ''; position: absolute; left: -14px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-right: 13px solid #3B3024; border-left: 0; }
.pdots { display: flex; gap: 10px; }
.pdots .dot { width: 46px; height: 46px; }

/* 고르기 */
.picks { display: flex; gap: 40px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.pick-card { background: var(--card-y); border-radius: 14px; padding: 18px 34px; font-size: 48px; box-shadow: 0 5px 0 #E8C35E; transition: transform .15s; }
.pick:active .pick-card { transform: translateY(4px); box-shadow: none; }
.pick-par { font-size: 46px; color: #7A6650; display: flex; align-items: center; gap: 10px; }
.pick-o { width: 64px; height: 64px; display: inline-block; }
.pick-o svg { width: 64px; height: 64px; }
.pick-o circle { fill: none; stroke: var(--red); stroke-width: 6; stroke-dasharray: 160; stroke-dashoffset: 160; transition: stroke-dashoffset .35s ease-out; }
.pick.on .pick-o circle { stroke-dashoffset: 0; }
.pick.on .pick-card { box-shadow: 0 0 0 5px var(--red), 0 5px 0 #E8C35E; }
.pick.right .pick-card { box-shadow: 0 0 0 6px var(--green), 0 5px 0 #E8C35E; }

/* 색칠 */
.colors { display: grid; grid-template-columns: repeat(4, 140px); gap: 26px 34px; }
.fruit { width: 140px; height: 140px; border-radius: 50%; border: 5px solid var(--red); background: #fff; font-size: 38px; position: relative; transition: background .2s, color .2s; }
.leaf { position: absolute; top: -10px; right: 26px; width: 28px; height: 20px; background: #58A845; border-radius: 0 60% 0 60%; transform: rotate(-20deg); }
.fruit.on { background: #F26D5B; color: #fff; }
.fruit.right { box-shadow: 0 0 0 6px var(--green-l); }
.fruit.wrong { animation: shake .45s; box-shadow: 0 0 0 6px var(--red-l); }

/* 선 잇기 */
.match { position: relative; display: flex; justify-content: space-between; width: 720px; }
.m-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.m-svg line { stroke: #6A5B48; stroke-width: 6; stroke-linecap: round; }
.m-svg line.ok { stroke: var(--green); }
.m-svg line.bad { stroke: var(--red); stroke-dasharray: 12 10; }
.m-col { display: flex; flex-direction: column; gap: 30px; }
.m-item { display: flex; align-items: center; gap: 26px; font-size: 44px; }
.m-txt { width: 200px; height: 84px; border-radius: 14px; display: grid; place-items: center; box-shadow: 0 5px 0 rgba(0, 0, 0, .1); transition: box-shadow .15s; }
.m-item.l .m-txt { background: var(--card-p); }
.m-item.r .m-txt { background: var(--card-g); }
.m-dot { width: 22px; height: 22px; border-radius: 50%; background: #3B3024; display: inline-block; }
.m-item.sel .m-txt { box-shadow: 0 0 0 6px var(--orange); }
.m-item.linked .m-dot { background: var(--orange); }

/* 오른쪽 숫자판 */
.pside { width: 300px; flex: none; display: flex; flex-direction: column; gap: 16px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: #fff; border-radius: 28px; padding: 16px; border: 3px solid var(--line); box-shadow: 0 7px 0 rgba(150, 110, 50, .18); }
.pk { height: 86px; border-radius: 20px; background: #FFF4DA; font-size: 42px; box-shadow: 0 5px 0 #E9CF99; }
.pk.fn { background: #EEF1F8; color: #5B6B8C; font-size: 30px; box-shadow: 0 5px 0 #C9D0E0; }
.pk:active { transform: translateY(4px); box-shadow: none; }
.pad.cards { grid-template-columns: repeat(3, 1fr); }
.pad.cards .pk.card { height: 110px; font-size: 44px; background: #EEF8E6; box-shadow: 0 5px 0 #B7D9A4; }
.pad.cards .pk.fn { grid-column: span 3; height: 70px; font-size: 26px; }
.pad.cards .pk.fn[data-k="del"] { grid-column: span 3; }
.acts { display: flex; flex-direction: column; gap: 12px; margin-top: auto; }
.btn { height: 70px; border-radius: 22px; font-size: 26px; }
.btn.hint { background: #FFF1C2; color: #8A6410; box-shadow: 0 5px 0 #EBCB6A; height: 60px; font-size: 23px; }
.btn.check { background: var(--orange); color: #fff; box-shadow: 0 6px 0 var(--orange-d); height: 84px; font-size: 32px; }
.btn.check.go { background: var(--green); box-shadow: 0 6px 0 #2F8B3B; animation: none; }
.btn:active { transform: translateY(4px); box-shadow: none; }
.side-tip { background: #fff; border-radius: 28px; padding: 20px; border: 3px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.side-tip .bubble::before { display: none; }

/* 피드백 */
.fb { display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 20px; border-radius: 22px; font-size: 22px; }
.fb > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.fb b { font-size: 26px; font-weight: normal; }
.fb span { line-height: 1.35; }
.fb-ic { font-size: 40px; }
.fb.ok { background: var(--green-l); color: #2A6F33; border: 3px solid #A6DAA0; }
.fb.no { background: #FFF0E3; color: #9A4B12; border: 3px solid #F7C99E; }
.fb.hintbox { background: #FFF8D9; color: #7B5A0E; border: 3px solid #F2DC8A; }
.fb.show { background: #E8F0FF; color: #2B4C8F; border: 3px solid #B8CBF2; }
.reveal { background: #fff; border: 3px solid #F7C99E; border-radius: 16px; padding: 10px 16px; font-size: 20px; color: #9A4B12; flex: none; }
.spark { position: absolute; left: 50%; top: 45%; font-size: 34px; pointer-events: none; animation: spark .9s ease-out forwards; z-index: 5; }

/* 결과 */
.result-screen { height: 724px; display: grid; place-items: center; }
.rs-card { width: 720px; background: var(--paper); border-radius: 40px; padding: 30px 40px 36px; border: 4px solid var(--yellow); box-shadow: 0 10px 0 #E9B544; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rs-stars { display: flex; gap: 16px; }
.big-st { font-size: 90px; color: #EADFC9; line-height: 1; }
.big-st.on { color: #FFB800; text-shadow: 0 5px 0 #DB9200; animation: starIn .6s both; }
.rs-t { font-size: 30px; margin-top: 6px; }
.rs-t b { color: var(--orange-d); font-size: 38px; }
.rs-m { font-size: 23px; color: var(--sub); }
.rs-btns { display: flex; gap: 14px; margin-top: 18px; align-self: stretch; }
.rs-btns .lb { height: 66px; font-size: 22px; }

/* 토스트 */
#toast { position: absolute; left: 50%; bottom: 120px; transform: translate(-50%, 30px); background: rgba(59, 48, 36, .92); color: #fff; padding: 14px 28px; border-radius: 99px; font-size: 24px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   펜 입력 · 끌어 옮기기 (검수 반영)
   ===================================================================== */
#app { touch-action: none; }
.ink { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 30; }
.concept, .pcard { position: relative; }

/* 손글씨 빈칸: 펜으로 쓰기 좋게 크게 */
.blank {
  width: 116px; min-width: 0; height: 92px; padding: 0; font-size: 56px;
  border: 4px dashed #B9A88C; border-radius: 18px; background: rgba(255, 255, 255, .9);
  color: #27355E; vertical-align: middle;
}
.blank::before { content: '✎'; position: absolute; right: 7px; bottom: 3px; font-size: 18px; color: #D3C5AB; }
.blank.filled::before, .blank.writing::before { content: none; }
.blank.filled { border-style: solid; border-color: #8E9CC4; background: #F7F9FF; }
.blank.writing { border-style: solid; border-color: var(--orange); background: #FFF8EC; box-shadow: 0 0 0 6px rgba(242, 138, 46, .18); }
.blank.focus { border-color: #B9A88C; box-shadow: none; background: rgba(255, 255, 255, .9); }
.blank.focus:empty::after { content: none; }
.blank.right { border-style: solid; }
.blank.drop-hover { border-color: var(--green); background: var(--green-l); }
.kid .blank { width: 104px; height: 86px; font-size: 50px; }

/* 가르기 나무: 손글씨 칸이 들어가도록 넓게 */
.tree { width: 240px; }
.tree-lines { width: 240px; height: 54px; }
.kid { width: 104px; height: 86px; }
.split-eq { margin-bottom: 152px; }
.split-eq.wide .op { margin: 0 96px; }
.mt-row .split-eq { margin-bottom: 140px; }
.pgrid.has-split { gap: 30px 120px; }
.pgrid { gap: 26px 80px; }
.pgrid .eq.pe { font-size: 50px; }
.ptable td { width: 150px; height: 112px; }
.pa-to .blank { width: 180px; height: 96px; border-radius: 48px; border-width: 5px; }
.pbox { padding: 18px 44px; gap: 14px; }

/* 문제 화면: 숫자판 대신 도구 모음 */
.ptools { width: 176px; flex: none; display: flex; flex-direction: column; gap: 14px; }
.ptools .side-tip { padding: 14px 14px; font-size: 18px; line-height: 1.45; text-align: left; display: block; color: #6B5B45; border-radius: 22px; }
.ptools .side-tip b { color: var(--orange-d); font-weight: normal; }
.ptools .acts { margin-top: auto; }
.ptools .btn.check { height: 96px; font-size: 30px; }
.ink-tools { display: flex; gap: 10px; }
.ink-tools.col { flex-direction: column; background: #fff; border: 3px solid var(--line); border-radius: 24px; padding: 12px; box-shadow: 0 6px 0 rgba(150, 110, 50, .15); }
.tool { display: flex; align-items: center; gap: 10px; height: 62px; border-radius: 16px; padding: 0 14px; font-size: 28px; background: #F7F1E4; box-shadow: 0 4px 0 #E4D6B9; }
.tool span { font-size: 19px; color: #6B5B45; }
.tool.on { background: #FFE3B8; box-shadow: 0 0 0 3px var(--orange), 0 4px 0 #E4B46A; }
.tool:active { transform: translateY(3px); box-shadow: none; }
.ink-tools.row .tool { flex-direction: column; justify-content: center; gap: 0; width: 70px; height: 70px; padding: 0; font-size: 26px; }
.ink-tools.row .tool span { font-size: 13px; }
.c-foot { gap: 16px; }

/* 고르기: 펜으로 그린 ○표일 때는 자동 동그라미 숨김 */
.pick.ink .pick-o circle { stroke-dashoffset: 160 !important; }

/* 끌어 옮기기 */
[data-drag] { cursor: grab; }
.drag-src { opacity: .3; }
.drag-ghost { position: absolute !important; z-index: 200; pointer-events: none; margin: 0 !important; transition: none; filter: drop-shadow(0 10px 10px rgba(0, 0, 0, .25)); transform-origin: center; }
.drag-ghost.back { transition: transform .25s ease-out, opacity .25s; opacity: 0; }
[data-drop].drop-hover { outline: 5px dashed var(--orange); outline-offset: 5px; }
.frame[data-drop].drop-hover { outline-color: var(--green); }
.bead[data-drag] { cursor: ew-resize; }

/* 선물 상자 */
.gift-row { display: flex; align-items: center; gap: 30px; }
.gift { min-width: 380px; min-height: 110px; border: 4px dashed #E7A0BF; border-radius: 24px; background: #FFF0F6; display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 24px; color: var(--pink-d); }
.gift-ic { font-size: 48px; }
.gift-in { display: flex; gap: 4px; }
.cup.mini { width: 34px; height: 42px; }
.gift-count { font-size: 26px; color: var(--sub); }
.gift-count b { color: var(--pink-d); font-size: 34px; }

/* 빼낸 모형 상자 */
.cube-row { display: flex; align-items: center; gap: 30px; }
.cube-tray { width: 520px; min-height: 96px; border: 4px dashed #A8B8DE; border-radius: 22px; background: #F1F5FF; padding: 10px 16px; display: flex; flex-direction: column; gap: 6px; }
.tray-label { font-size: 20px; color: #6D80AE; }
.tray-in { display: flex; flex-wrap: wrap; gap: 6px; min-height: 40px; }
.cube.mini { width: 34px; height: 34px; cursor: default; }
.cube.mini::after { inset: 9px; border-width: 2px; }
.cube-count { line-height: 1.5; }

/* 펜으로 △ 그린 칸 */
.frames.big .frame { grid-template-columns: repeat(5, 76px); grid-auto-rows: 76px; }
.frames.big .mk.o { width: 46px; height: 46px; }
.frames.big .mk.t .tri { width: 50px; height: 45px; }
.cell.drawn { background: #FFF6E8; }

/* ===== 수정: 손글씨를 칸에 그대로 남기기 · 모든 화면 펜 쓰기 ===== */
.blank.inked { border-style: solid; border-color: #9FB0DA; background: rgba(255, 255, 255, .55); }
.blank.inked::before { content: none; }
.blank .read {
  position: absolute; right: -12px; top: -14px; min-width: 34px; height: 30px; padding: 0 8px;
  border-radius: 15px; background: #4C6BC4; color: #fff; font-size: 19px; font-style: normal;
  display: grid; place-items: center; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); z-index: 2; animation: popIn .3s;
}
.blank .read.unk { background: var(--red); }
.blank.right .read { background: var(--green); }
.blank.wrong .read { background: var(--red); }
.press { transform: scale(1.08); transition: transform .3s; filter: drop-shadow(0 0 6px rgba(242, 138, 46, .7)); }
.ink-tools.mini .tool { width: 58px; height: 54px; flex-direction: column; justify-content: center; gap: 0; padding: 0; font-size: 22px; }
.ink-tools.mini .tool span { font-size: 11px; }
.top .ink-tools.mini .tool { background: rgba(255, 255, 255, .75); box-shadow: 0 3px 0 #E6A82E; }
.hero-tools { margin-top: 12px; justify-content: flex-start; }
.hero-tools .tool { background: rgba(255, 255, 255, .7); box-shadow: 0 3px 0 #E59A2C; }
.hero h1 { margin-top: 14px; }

/* 구슬틀 문제: 처음 옮긴 구슬 / 더 옮긴 구슬 구분 */
.bead.added { box-shadow: 0 0 0 4px #FFC94A, inset -4px -5px 0 rgba(0, 0, 0, .16); }
.ab-legend { display: flex; gap: 26px; justify-content: center; align-items: center; font-size: 22px; color: var(--sub); margin-top: 4px; }
.ab-legend i { display: inline-block; width: 22px; height: 22px; border-radius: 50%; background: #E44E5A; vertical-align: -4px; margin-right: 6px; }
.ab-legend .lg-b { box-shadow: 0 0 0 4px #FFC94A; }
.ab-now b { color: var(--ink); font-size: 28px; }
.ab-replay { display: block; margin: 8px auto 0; background: #EEF1F8; color: #5B6B8C; border-radius: 14px; padding: 6px 16px; font-size: 19px; box-shadow: 0 3px 0 #C9D0E0; }
.ab-wrap.sm .abacus { margin-bottom: -20px; }

/* 손글씨 칸 맞음/틀림 표시가 보이도록 (inked가 덮어쓰던 문제 수정) */
.blank.inked.wrong { border-color: var(--red); background: var(--red-l); }
.blank.inked.right { border-color: var(--green); background: var(--green-l); }

/* 내 글씨 알려주기 */
.hand-entry { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; background: #fff; border-radius: 18px; padding: 10px 16px; font-size: 21px; color: #5A3A10; box-shadow: 0 4px 0 #E59A2C; margin-top: 14px; position: relative; z-index: 1; }
.hand-entry small { font-size: 15px; color: var(--sub); }
.hand { display: flex; gap: 22px; padding: 20px 24px 24px; height: 724px; position: relative; }
.hand-card { background: var(--paper); border-radius: 30px; border: 3px solid var(--line); box-shadow: 0 7px 0 rgba(150, 110, 50, .18); padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.hand-card.reg { flex: 1.35; }
.hand-card.test { flex: 1; }
.hand-q { font-size: 27px; text-align: center; min-height: 72px; line-height: 1.35; }
.hand-q b { font-size: 40px; color: var(--orange-d); }
.hand-q span, .hand-q small { font-size: 18px; color: var(--sub); }
.hand-t { font-size: 26px; }
.hand-sub { font-size: 18px; color: var(--sub); text-align: center; }
.hand-box { position: relative; background: #fff; border: 4px dashed #B9A88C; border-radius: 22px; }
.reg-box { width: 300px; height: 300px; }
.test-box { width: 340px; height: 220px; }
.hand-ghost { position: absolute; inset: 0; display: grid; place-items: center; font-size: 220px; color: rgba(185, 168, 140, .16); pointer-events: none; }
.hand-digits { display: flex; gap: 8px; }
.hd { width: 54px; height: 66px; border-radius: 14px; background: #F7F1E4; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 26px; cursor: pointer; }
.hd i { font-style: normal; font-size: 10px; color: var(--orange); letter-spacing: 1px; }
.hd.full { background: var(--green-l); }
.hd.on { box-shadow: 0 0 0 3px var(--orange); background: #FFE3B8; }
.hand-btns { display: flex; gap: 12px; align-self: stretch; margin-top: auto; }
.hand-read { font-size: 26px; color: var(--sub); }
.hand-read b { font-size: 48px; color: var(--blue-d); display: inline-block; }
.lb:disabled { opacity: .45; }

/* ===== 수정: 답은 숫자판으로 (펜은 문제 칸 계산용) ===== */
.blank { width: 96px; height: 80px; font-size: 52px; border: 4px solid #A99A84; background: #fff; color: var(--blue-d); }
.blank::before { content: none; }
.blank.filled { border-color: #A99A84; background: #fff; }
.blank.focus { border-color: var(--orange); box-shadow: 0 0 0 6px rgba(242, 138, 46, .28); background: #FFF8EC; }
.blank.focus:empty::after { content: ''; width: 3px; height: .7em; background: var(--orange); animation: bob 1s steps(2) infinite; }
.blank.right { border-color: var(--green); background: var(--green-l); color: #2E7D38; }
.blank.wrong { border-color: var(--red); background: var(--red-l); }
.kid .blank { width: 88px; height: 74px; font-size: 46px; }
.ptable td { width: 136px; height: 100px; }
.pa-to .blank { width: 160px; height: 86px; }
.ptools { width: 300px; gap: 12px; }
.ptools .ink-tools.mini { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 8px; justify-content: space-between; }
.ptools .ink-tools.mini .tool { width: 84px; height: 54px; }
.ptools .pad { padding: 12px; gap: 10px; }
.ptools .pk { height: 74px; font-size: 40px; }
.ptools .pad.cards .pk.card { height: 96px; }
.ptools .pad.cards .pk.fn { height: 60px; font-size: 22px; }
.ptools .side-tip { font-size: 16px; padding: 10px 14px; }
.ptools .btn.check { height: 80px; }
.ptools .btn.hint { height: 54px; }

/* ===== 5단원 규칙 찾기 ===== */
.gl { width: 100%; height: 100%; display: block; }
.gl-t { font-size: 46px; line-height: 1; }
.gl-e { font-size: 44px; line-height: 1; }
.gl-q { font-size: 44px; color: var(--orange); }
.gl-num { font-size: 40px; }
.gl-sw { display: block; width: 100%; height: 100%; border-radius: 4px; }
.seq { display: flex; border: 3px solid #A99A84; border-radius: 14px; overflow: hidden; background: #fff; }
.sq-cell { width: 84px; height: 80px; display: grid; place-items: center; border-right: 2px solid #D9CDB6; padding: 8px; position: relative; }
.sq-cell:last-child { border-right: 0; }
.sq-cell .blank { width: 66px; height: 62px; font-size: 40px; padding: 4px; border-radius: 12px; }
.sq-cell .blank.gfill { padding: 6px; }
.blank.gfill .gl-t, .blank.gfill .gl-e { font-size: 38px; }
.seq.clock .sq-cell { width: 110px; height: 108px; }
.seq.clock .sq-cell .blank { width: 90px; height: 90px; }
.seq.num { border: 0; background: none; gap: 14px; overflow: visible; }
.seq.num .sq-cell { width: 76px; height: 70px; border: 0; border-radius: 12px; background: #FBE6A2; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.seq.num.pink .sq-cell { background: #F6CACD; }
.seq.num.violet .sq-cell { background: #DCCBEB; }
.seq.num .sq-cell:not(:last-child)::after { content: ''; position: absolute; right: -14px; top: 50%; width: 14px; height: 3px; background: #C9B68F; }
.seq.num .sq-cell .blank { width: 64px; height: 58px; font-size: 38px; }
.seq + .seq { margin-top: -8px; }
.cgrid { display: flex; flex-direction: column; border: 3px solid #555; }
.cg-row { display: flex; }
.sq-cell.cg { width: 78px; height: 74px; padding: 0; border-right: 2px solid #555; border-bottom: 2px solid #555; }
.cg-row:last-child .sq-cell.cg { border-bottom: 0; }
.sq-cell.cg .gl { width: 60px; height: 60px; }
.sq-cell.cg .blank { width: 100%; height: 100%; border-radius: 0; border-width: 4px; padding: 0; }
.sq-cell.cg .blank.gfill .gl { width: 60px; height: 60px; margin: auto; }
.sq-cell.cg .blank .gl-sw { border-radius: 0; }
.cgrid.big .sq-cell.cg { width: 92px; height: 88px; }
.tapc { background: #fff; cursor: pointer; }
.balls { display: flex; gap: 16px; }
.balls .blank { width: 76px; height: 76px; border-radius: 50%; padding: 0; overflow: hidden; }
.balls .blank .gl-sw { border-radius: 50%; }
.ngrid { display: flex; flex-direction: column; gap: 22px; }
.ng-row { display: flex; gap: 26px; }
.ng-cell { width: 82px; height: 72px; border-radius: 12px; background: #E8B97E; display: grid; place-items: center; font-size: 38px; position: relative; }
.ng-cell:not(:last-child)::after { content: ''; position: absolute; right: -26px; top: 50%; width: 26px; height: 3px; background: #9A8B78; }
.ng-row:not(:last-child) .ng-cell::before { content: ''; position: absolute; bottom: -22px; left: 50%; width: 3px; height: 22px; background: #9A8B78; }
.ng-cell .blank { width: 70px; height: 60px; font-size: 36px; }
.chart { display: flex; flex-direction: column; border: 3px solid #E0B562; border-radius: 8px; overflow: hidden; background: #fff; }
.ch-row { display: flex; }
.ch-cell { width: 62px; height: 46px; display: grid; place-items: center; font-size: 25px; border-right: 1px solid #EED9AE; border-bottom: 1px solid #EED9AE; position: relative; }
.chart.small .ch-cell { width: 50px; height: 38px; font-size: 21px; }
.ch-cell.pre, .ch-cell.on { background: #D9C6EC; }
.ch-cell.tap { cursor: pointer; }
.ch-cell.right { background: #BFE6B8; }
.ch-row.hi-row .ch-cell { background: #FCE1EA; box-shadow: inset 0 -3px 0 #E0558F; }
.ch-cell.hi-col { background: #DCE8FB; box-shadow: inset 3px 0 0 #3E6FD8, inset -3px 0 0 #3E6FD8; }
.ch-cell.hr { background: #FCE1EA; }
.ch-cell.hc { background: #DCE8FB; }
.ch-cell.me { background: var(--orange); color: #fff; }
.choice-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.choice-wrap.side { flex-direction: row; gap: 26px; align-items: center; }
.choices { display: flex; flex-direction: column; gap: 12px; min-width: 520px; }
.choice-wrap.side .choices { min-width: 0; width: 330px; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 12px 16px; font-size: 22px; line-height: 1.35; box-shadow: 0 4px 0 rgba(150, 110, 50, .14); }
.opt-no { font-size: 26px; color: var(--orange-d); }
.opt.on { border-color: var(--orange); background: #FFF4E2; }
.opt.right { border-color: var(--green); background: var(--green-l); }
.choices.gopts { flex-direction: row; min-width: 0; }
.choices.gopts .opt { flex-direction: column; padding: 10px 22px; }
.choices.gopts .opt-t .gl-e { font-size: 60px; }
.pk.gpk { padding: 10px; }
.pk.gpk .gl { width: 54px; height: 54px; margin: auto; }
.pk.gpk .gl-sw { width: 54px; height: 54px; margin: auto; border-radius: 10px; }
.pk.gpk .gl-t { font-size: 44px; }
.ptools .pad.cards .pk.card.gpk { height: 84px; }
/* 개념 화면 */
.seq.big .sq-cell { width: 96px; height: 92px; }
.sq-cell.grp0 { background: #FFF1C9; }
.sq-cell.grp1 { background: #DDEBFF; }
.nx-opts { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.nx-q { font-size: 22px; color: var(--sub); }
.nx-row { display: flex; gap: 14px; }
.nx-o { width: 96px; height: 92px; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 4px 0 rgba(150, 110, 50, .15); }
.nx-o .gl-num { font-size: 44px; }
.mk-pal { display: flex; gap: 14px; }
.mk-p { width: 84px; height: 80px; background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 12px; }
.mk-p .gl-sw { border-radius: 10px; }
.mk-p.on { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(242, 138, 46, .25); }
.mk-cell { background: #fff; cursor: pointer; }
.mk-cell .gl-sw { border-radius: 50%; }
.jumps { display: flex; gap: 6px; padding-top: 50px; }
.jp { position: relative; width: 96px; display: flex; justify-content: center; }
.jp-n { width: 82px; height: 72px; border-radius: 14px; background: #F6CACD; display: grid; place-items: center; font-size: 36px; }
.jp-a { position: absolute; top: -46px; left: -48px; width: 96px; text-align: center; font-size: 22px; color: var(--pink-d); opacity: 0; border: 3px solid var(--pink-d); border-bottom: 0; border-radius: 40px 40px 0 0; height: 34px; padding-top: 2px; }
.jp-a.on { opacity: 1; animation: popIn .4s; }
.rep-row { min-height: 98px; }
/* 규칙 칸 크게 */
.pbody .sq-cell { width: 98px; height: 92px; }
.pbody .sq-cell .blank { width: 76px; height: 72px; }
.pbody .seq.num .sq-cell { width: 84px; height: 76px; }
.pbody .sq-cell.cg { width: 90px; height: 84px; }
.pbody .sq-cell.cg .blank { width: 100%; height: 100%; }
.pbody .sq-cell .gl-e { font-size: 52px; }
.pbody .seq.clock .sq-cell { width: 124px; height: 120px; }
.pbody .seq.clock .sq-cell .blank { width: 104px; height: 104px; }
.pk.gpk .gl { width: 62px; height: 62px; }
.touch-badge { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 14px; font-size: 20px; text-align: center; color: #6B5B45; }
.pk.card[data-drag], .mk-p[data-drag], .nx-o[data-drag] { touch-action: none; }
/* 빈칸 이름표 ㉠ ㉡ */
.cell-tag { position: absolute; top: -16px; left: -12px; width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 24px; display: grid; place-items: center; box-shadow: 0 2px 0 var(--orange-d); z-index: 2; pointer-events: none; }
.hero-foot { flex-wrap: wrap; gap: 8px; }
.hero-foot .reset-all { font-size: 16px; padding: 8px 12px; }

/* ===== 6단원 덧셈과 뺄셈(3): 수 모형 · 표 · 체인 ===== */
.ten-rod { display: inline-block; width: 24px; height: 86px; margin: 2px; border: 3px solid #2A4FA0; border-radius: 5px; background: repeating-linear-gradient(to bottom, #7CA0EA 0 8px, #5A82D8 8px 9.1px); position: relative; }
.ten-rod.green { border-color: #2E7D38; background: repeating-linear-gradient(to bottom, #9CD79A 0 8px, #6EB86C 8px 9.1px); }
.one-unit { display: inline-block; width: 19px; height: 19px; margin: 2px; border: 3px solid #2A4FA0; border-radius: 5px; background: #7CA0EA; }
.one-unit.green { border-color: #2E7D38; background: #9CD79A; }
.ten-rod.rm, .one-unit.rm { position: relative; opacity: .55; filter: grayscale(.4); }
.ten-rod.rm::after, .one-unit.rm::after { content: ''; position: absolute; top: 50%; left: -10%; width: 120%; height: 6px; background: #D81E1E; border-radius: 3px; transform: translateY(-50%) rotate(-30deg); opacity: 1; }
.tbox { border: 3px solid #333; border-radius: 16px; overflow: hidden; background: #fff; }
.tbox-h { display: flex; }
.tbox-h span { flex: 1; text-align: center; background: #F6D3E6; font-size: 19px; padding: 6px 14px; white-space: nowrap; }
.tbox-h span:first-child { background: #BFDBF7; }
.tbox-b { display: flex; min-height: 110px; }
.tbox-b > * { flex: 1; min-width: 0; }
.tbox-b > *:first-child { border-right: 3px dashed #333; }
.tb-col { display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; align-items: flex-start; padding: 6px; gap: 2px; height: 100%; }
.tb-colwrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.tb-colwrap > .tb-col { flex: 1; width: 100%; }
.tb-col.hl { margin: 4px; border: 3px dashed #999; border-radius: 14px; padding: 5px; }
.tb-col.hl-tens { border-color: #3E6FD8; }
.tb-col.hl-ones, .tb-col.hl-rm { border-color: #E0545A; }
.tb-arrow { flex: none; width: 4px; height: 12px; background: #3E6FD8; position: relative; border-radius: 2px; margin-top: 1px; }
.tb-arrow::after { content: ''; position: absolute; bottom: -2px; left: -6px; border: 7px solid transparent; border-top-color: #3E6FD8; }
.tb-arrow.ones, .tb-arrow.rm { background: #E0545A; }
.tb-arrow.ones::after, .tb-arrow.rm::after { border-top-color: #E0545A; }
.tbox.src .tbox-b > * { align-self: stretch; }
.tbox.wide, .tbox.result { width: 100%; }
.model-wrap { display: flex; justify-content: center; align-self: stretch; width: 100%; max-height: 100%; min-height: 0; overflow: visible; }
.tmerge, .tsub { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.tm-top { display: flex; justify-content: center; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.tm-top .tbox { flex: 1; max-width: 48%; }
.tbox.result { box-shadow: 0 0 0 4px rgba(242, 138, 46, .25); }
.tpair { display: flex; align-items: center; justify-content: center; gap: 14px; }
.tpair-op { font-size: 34px; color: #7A6650; }
.tpair .tbox-b > *:first-child { border-right: 2px dashed #999; }
.tpair .ten-rod { width: 20px; height: 84px; }
.tpair .one-unit { width: 18px; height: 18px; }
.tpair .tbox-b { min-height: 92px; padding: 0; }
.tpair .tb-col { padding: 6px; }
.optable { border-collapse: collapse; font-size: 26px; }
.optable td { width: 78px; height: 66px; border: 2px solid #D9C195; text-align: center; background: #fff; }
.ot-head { background: #FCE3A2; font-size: 28px; }
.ot-corner { background: #F6CACD; position: relative; font-size: 22px; }
.ot-arrow.right { position: absolute; right: -18px; top: 50%; width: 18px; height: 3px; background: #E0558F; }
.ot-arrow.right::after { content: ''; position: absolute; right: 0; top: -4px; border: 5px solid transparent; border-left-color: #E0558F; }
.ot-arrow.down { position: absolute; left: 50%; bottom: -18px; width: 3px; height: 18px; background: #E0558F; }
.ot-arrow.down::after { content: ''; position: absolute; bottom: 0; left: -4px; border: 5px solid transparent; border-top-color: #E0558F; }
.chainstep { display: flex; align-items: center; gap: 14px; }
.chainstep .cs-n { width: 86px; height: 66px; border-radius: 16px; background: #E8D6F3; display: grid; place-items: center; font-size: 34px; }
.chainstep .cs-op { background: #C9D6F5; border: 3px solid #8EA8E6; border-radius: 40px; padding: 6px 16px; font-size: 24px; }
.chainstep .blank { width: 86px; height: 66px; }
.cmp { display: flex; align-items: center; gap: 22px; }
.cmp .blank { width: 70px; height: 70px; font-size: 40px; }
