/* Luyện toán trong phạm vi 10/20, bao gồm cả hai mốc. */
.calc-range-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.calc-mode-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.calc-range-card{padding-right:34px}
.calc-story{font-size:clamp(18px,2.2vw,25px);font-weight:800;line-height:1.45;color:#294f79;margin:8px 0 14px;text-wrap:pretty}
.calc-equation.compact-equation{font-size:clamp(30px,4.6vw,54px);overflow-wrap:anywhere}
.calc-visual{margin:10px auto 16px;max-width:490px}
.number-bond{display:grid;justify-items:center;gap:25px;padding:4px 0}
.bond-total,.bond-part{border:3px solid #76b5e4;border-radius:19px;min-width:64px;min-height:55px;padding:6px 14px;display:grid;place-items:center;background:#e9f7ff;color:#164b78;font-size:32px}
.bond-total{background:#fff1cc;border-color:#ebbd56;position:relative}
.bond-total:after{content:'';position:absolute;height:15px;width:3px;bottom:-18px;background:#9cbed9}
.bond-branches{position:relative;display:flex;gap:18px}
.bond-branches:before{content:'';position:absolute;top:-12px;left:32px;right:32px;border-top:3px solid #9cbed9}
.bond-part{position:relative}
.bond-part:before{content:'';position:absolute;top:-14px;height:11px;width:3px;background:#9cbed9}
.bond-missing{color:#d24a88!important}
.number-groups{display:flex;justify-content:center;gap:12px;align-items:stretch}
.number-group{flex:1;min-width:0;min-height:65px;border:2px dashed #80b2dc;border-radius:17px;padding:9px;background:#edf8ff;display:grid;place-items:center;font-size:30px}
.number-group.group-1{background:#fff0f6;border-color:#dc96b4}.number-group.group-2{background:#f1ffe9;border-color:#94bf78}
.group-dots{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;font-size:clamp(13px,2vw,23px);color:#1e6aaa;line-height:1.2}
.calc-compare-answers{position:relative;z-index:1;width:min(510px,100%);margin:16px auto 10px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.calc-compare-answers button{min-height:106px;cursor:pointer;border:3px solid #a5c6e4;border-radius:23px;background:#ecf7ff;color:#174679;box-shadow:0 5px 0 #7ca8d0;display:grid;place-items:center;padding:10px}
.calc-compare-answers button:nth-child(2){background:#fff3d7;border-color:#e8c474;box-shadow:0 5px 0 #c7a14a}
.calc-compare-answers button:nth-child(3){background:#ffeaf3;border-color:#e3a0c0;box-shadow:0 5px 0 #c477a0}
.calc-compare-answers b{font-size:48px;line-height:1.1}.calc-compare-answers span{font-size:15px;font-weight:800}.calc-compare-answers .selected{outline:4px solid #32ac6b;outline-offset:3px}
.calc-compare-answers button:disabled{cursor:default}.calc-compare-answers button:disabled:not(.selected){opacity:.6}
.calc-keypad button.calc-key-ok{background:linear-gradient(180deg,#71e392,#28bd65);color:#fff;box-shadow:0 6px 0 #168344}
.calc-keypad button.calc-key-action{background:linear-gradient(180deg,#f3f4fa,#e2e5ed);color:#5c677a;box-shadow:0 6px 0 #b8bdca}
.calc-game-card:has(.calc-visual:not(.hidden)) .calc-mascot{display:none}
.calc-feedback{overflow-wrap:anywhere}
.answer-blank{display:inline-flex!important;align-items:center;justify-content:center;width:1.15em!important;height:1.15em!important;min-width:1.15em!important;min-height:1.15em!important;vertical-align:middle;background:#fff0bf!important;border:3px solid #dd8d13!important;border-radius:.16em;box-shadow:inset 0 0 0 3px #fff9e8,0 2px 0 #bb721526;position:relative}
.calc-equation .answer-blank{margin:0 .12em;background:#ffe3ef!important;border-color:#d3578c!important;box-shadow:inset 0 0 0 3px #fff3f8,0 2px 0 #b0416b22}
.calc-answer-display:has(.answer-blank){background:transparent;box-shadow:none;border-color:transparent}
.calc-answer-display .answer-blank{font-size:52px}
.bond-part:has(.answer-blank),.bond-total:has(.answer-blank){background:transparent;border-color:transparent;box-shadow:none;padding:0}
.bond-part .answer-blank,.bond-total .answer-blank{width:60px!important;height:60px!important;border-color:#d3578c!important;background:#ffe3ef!important}
.seq-pill.missing,.mini-cell.missing{background:#ffe3ef!important;border-color:#d3578c!important}
.seq-pill.missing .answer-blank,.mini-cell.missing .answer-blank{width:70%!important;height:70%!important;min-width:0!important;min-height:0!important;background:#fff0bf!important}
.study-view-tools{position:fixed;right:max(12px,env(safe-area-inset-right));bottom:calc(10px + env(safe-area-inset-bottom));z-index:500;display:flex;align-items:flex-end;gap:8px;flex-direction:column;max-width:calc(100vw - 24px)}
.study-fullscreen-btn{border:2px solid #fff;background:#174b7d;color:#fff;box-shadow:0 4px 12px #12385b33;border-radius:16px;min-height:44px;padding:9px 15px;font-family:inherit;font-weight:800;font-size:14px;line-height:1.3;cursor:pointer}
.study-fullscreen-btn:focus-visible,.calc-compare-answers button:focus-visible{outline:3px solid #ffae23;outline-offset:4px}
.study-display-status{background:#fff;color:#26486b;border-radius:12px;padding:8px 12px;font-size:13px;max-width:330px;box-shadow:0 4px 18px #12385b22}
.study-display-status:empty{display:none}
body.exam-mode .floating-page-tools,body.calculator-mode .floating-page-tools{display:none!important}
body.exam-mode .page-shell,body.calculator-mode .page-shell{padding-bottom:76px}
body.study-focus .sky-decor,body.study-focus .game-header,body.study-focus .developer-credit,body.study-focus .site-footer-credit{display:none!important}
body.study-focus .page-shell{width:min(1440px,100%)!important;margin:0 auto!important;padding-top:10px!important}
body.study-focus.calculator-mode .calc-page-head{display:none}
body.study-focus.calculator-mode .calc-setup{margin-top:8px}
body.study-focus .calc-page{width:100%}
body.study-focus{min-height:100dvh}
@media(max-width:600px){
  .calc-range-grid{grid-template-columns:1fr 1fr}.calc-range-card:last-child{grid-column:1/-1;min-height:76px}
  .calc-mode-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .calc-main-zone{grid-template-columns:minmax(0,1fr)!important;gap:12px}
  .calc-grade-panel{min-height:0;display:grid;grid-template-columns:1fr auto 1fr;gap:5px;padding:8px;align-items:center}
  .calc-grade-label{margin:0}.calc-grade-paper{width:65px;height:56px}.calc-grade-value{font-size:32px}.calc-grade-panel:before,.calc-grade-panel small{display:none}.calc-grade-stars{margin:0;width:80px;justify-self:center}
  .calc-equation{font-size:clamp(35px,9vw,55px)}.calc-equation.compact-equation{font-size:clamp(26px,7vw,40px)}
  .calc-story{font-size:18px}.calc-visual{max-width:360px}.group-dots{font-size:16px}.bond-total,.bond-part{min-width:55px;min-height:45px;font-size:27px;padding:4px 10px}
  .calc-compare-answers{gap:8px}.calc-compare-answers button{min-height:90px;padding:8px}.calc-compare-answers b{font-size:40px}.calc-compare-answers span{font-size:12px}
}
/* Tablet ngang: chia câu hỏi và đáp án thành hai vùng lớn, không dùng cỡ chữ của điện thoại. */
@media(orientation:landscape) and (min-width:768px) and (min-height:561px){
  body.touch-device.exam-mode{height:auto!important;min-height:100dvh!important;overflow:auto!important}
  body.touch-device.exam-mode .game-header,body.touch-device.exam-mode .developer-credit,body.touch-device.exam-mode .site-footer-credit,body.touch-device.exam-mode .sky-decor{display:none!important}
  body.touch-device.exam-mode .page-shell{width:100%!important;max-width:1600px!important;height:auto!important;margin:0 auto!important;padding:10px 14px 68px!important;overflow:visible!important}
  body.touch-device.exam-mode #examScreen{height:auto!important;overflow:visible!important}
  body.touch-device.exam-mode .exam-stage{height:calc(var(--study-height,100dvh) - 88px)!important;min-height:450px!important;display:grid!important;grid-template-rows:60px minmax(0,1fr)!important;gap:12px!important;overflow:visible!important}
  body.touch-device.exam-mode .exam-topline{grid-template-columns:160px minmax(0,1fr) 220px!important;gap:12px!important}
  body.touch-device.exam-mode .game-timer,body.touch-device.exam-mode .game-progress,body.touch-device.exam-mode .exam-title-board{height:56px!important;min-height:56px!important;font-size:17px!important;padding:6px 12px!important}
  body.touch-device.exam-mode .exam-title-board b{font-size:18px!important}.exam-title-board span{font-size:12px}
  body.touch-device.exam-mode .ok-count,body.touch-device.exam-mode .bad-count,body.touch-device.exam-mode .progress-badge{font-size:14px!important;padding:5px 8px!important}
  body.touch-device.exam-mode .exam-board{display:grid!important;grid-template-columns:minmax(0,1.1fr) minmax(270px,.9fr)!important;grid-template-rows:minmax(0,1fr)!important;gap:20px!important;height:100%!important;padding:36px 22px 18px!important;overflow:auto!important}
  body.touch-device.exam-mode .question-number{display:none!important}
  body.touch-device.exam-mode .question-layout{grid-column:1!important;grid-row:1!important;display:flex!important;flex-direction:column!important;justify-content:center!important;align-items:center!important;height:auto!important;min-height:0!important;gap:14px!important;padding:0!important;overflow:visible!important}
  body.touch-device.exam-mode .question-main{display:flex!important;flex-direction:column!important;justify-content:center!important;gap:8px!important;height:auto!important;padding:0!important;overflow:visible!important}
  body.touch-device.exam-mode .question-prompt{font-size:clamp(22px,2.2vw,32px)!important;line-height:1.3!important;padding:0!important;max-height:none!important;overflow:visible!important}
  body.touch-device.exam-mode .question-visual{min-height:100px!important;max-height:none!important;height:auto!important;overflow:visible!important}
  body.touch-device.exam-mode .visual-card{max-height:none!important;overflow:visible!important;padding:10px!important}
  body.touch-device.exam-mode .question-sub{font-size:15px!important;line-height:1.35!important;max-height:none!important;overflow:visible!important}
  body.touch-device.exam-mode .confirm-column{width:min(100%,340px)!important;min-width:0!important;height:auto!important}
  body.touch-device.exam-mode .confirm-btn{min-height:52px!important;height:auto!important;font-size:18px!important;padding:12px!important}
  body.touch-device.exam-mode .feedback{max-height:none!important;font-size:14px!important;line-height:1.35!important;overflow:visible!important}
  body.touch-device.exam-mode .answer-area,body.touch-device.exam-mode .input-area{grid-column:2!important;grid-row:1!important;align-self:center!important;padding:0!important;overflow:visible!important}
  body.touch-device.exam-mode .answer-hint{font-size:16px!important;line-height:1.3!important;margin-bottom:12px!important}
  body.touch-device.exam-mode .option-grid{grid-template-columns:1fr!important;gap:13px!important}
  body.touch-device.exam-mode .option{min-height:62px!important;font-size:clamp(20px,2vw,27px)!important;padding:12px 16px!important}
  body.touch-device.exam-mode .option.image-only{min-height:76px!important}.option-object{object-fit:contain}
  body.touch-device.exam-mode .input-row{grid-template-columns:1fr!important;gap:12px!important}
  body.touch-device.exam-mode .input-row input{height:60px!important;font-size:26px!important}
  body.touch-device.exam-mode .floating-quit{font-size:12px!important;padding:6px 10px!important;top:6px!important;right:10px!important}
  body.touch-device.exam-mode .exam-footer-decor{display:none!important}
  body.touch-device.calculator-mode .game-header,body.touch-device.calculator-mode .developer-credit,body.touch-device.calculator-mode .site-footer-credit{display:none!important}
  body.touch-device.calculator-mode .page-shell{width:100%;max-width:1440px;margin:0 auto;padding:12px 18px 72px}
  body.touch-device.calculator-mode .calc-page-head{padding:10px 16px}.calc-page-head h2{margin-top:4px}
  body.touch-device.calculator-mode .calc-page:has(.calc-play:not(.hidden)) .calc-page-head{display:none}
  body.touch-device.calculator-mode .calc-game-card{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(270px,.8fr);gap:18px;align-items:center;padding:20px}
  body.touch-device.calculator-mode .calc-main-zone{grid-column:1;grid-template-columns:minmax(0,1fr) 120px;gap:12px;margin:0}
  body.touch-device.calculator-mode .calc-grade-panel{min-height:170px;padding:8px 4px}.calc-grade-panel:before{display:none}
  body.touch-device.calculator-mode .calc-grade-paper{width:88px;height:76px}.calc-grade-value{font-size:45px}
  body.touch-device.calculator-mode .calc-grade-stars{width:90px}.calc-grade-label{font-size:12px}
  body.touch-device.calculator-mode .calc-keypad,body.touch-device.calculator-mode .calc-compare-answers{grid-column:2;grid-row:1;width:100%;margin:0;gap:10px}
  body.touch-device.calculator-mode .calc-keypad button{height:64px}.calc-mascot{display:none}
  body.touch-device.calculator-mode .calc-equation{font-size:clamp(36px,4.5vw,64px)}
  body.touch-device.calculator-mode .calc-equation.compact-equation{font-size:clamp(27px,3.5vw,44px)}
  body.touch-device.calculator-mode .calc-story{font-size:20px}.group-dots{font-size:18px}
}
@media(orientation:landscape) and (max-height:560px){
  .calc-game-card{overflow:visible}.calc-story{font-size:14px;line-height:1.25;margin:3px 0}.calc-visual{margin:3px auto 7px}
  .bond-total,.bond-part{min-width:40px;min-height:32px;padding:2px 8px;font-size:21px;border-width:2px;border-radius:10px}.number-bond{gap:20px}.number-group{padding:4px;min-height:38px}.group-dots{font-size:12px;gap:2px}
  .calc-equation.compact-equation{font-size:29px!important;margin:4px 0!important}.calc-compare-answers{grid-column:2!important;grid-row:1!important;gap:7px;margin:0}.calc-compare-answers button{min-height:85px}.calc-compare-answers b{font-size:36px}
  .calc-answer-display .answer-blank{font-size:36px}.bond-part .answer-blank,.bond-total .answer-blank{width:36px!important;height:36px!important}
  body.calculator-mode .page-shell{padding-bottom:65px!important}.study-fullscreen-btn{min-height:38px;padding:6px 12px;font-size:12px}
}
/* Giữ bài luyện vừa màn hình điện thoại ngang, cả khi trình duyệt báo pointer fine. */
@media(orientation:landscape) and (max-height:560px){
 body.touch-device.calculator-mode .game-header,body.touch-device.calculator-mode .developer-credit,body.touch-device.calculator-mode .site-footer-credit,body.touch-device.calculator-mode .calc-page-head{display:none!important}
 body.touch-device.calculator-mode .page-shell{width:100%!important;margin:0!important;padding:5px 10px 58px!important}
 body.touch-device.calculator-mode .calc-page{width:100%;padding:0}
 .calc-play{margin-top:0}.calc-statusbar{grid-template-columns:auto 1fr auto;padding:5px;gap:6px}.calc-level-label{grid-column:auto;font-size:11px;padding:6px}.calc-score span{font-size:11px;padding:5px}.calc-change-btn{font-size:12px;padding:7px}
 .calc-game-card{display:grid!important;grid-template-columns:minmax(0,1.35fr) minmax(180px,.65fr)!important;gap:10px;padding:8px 12px!important;margin-top:9px!important}
 .calc-main-zone{grid-column:1!important;grid-row:1!important;grid-template-columns:minmax(0,1fr) 85px!important;gap:8px!important;margin:0!important}
 .calc-grade-panel{display:flex!important;min-height:140px!important;padding:5px!important}.calc-grade-paper{width:65px;height:58px}.calc-grade-value{font-size:32px}.calc-grade-label{font-size:10px}.calc-grade-stars{width:68px}.calc-grade-stars span{font-size:10px}.calc-grade-panel small,.calc-mascot{display:none!important}
 .calc-keypad,.calc-compare-answers{grid-column:2!important;grid-row:1!important;width:100%!important;margin:0!important;gap:6px!important}.calc-keypad button{height:38px!important;font-size:23px;border-radius:11px}
 .calc-equation{font-size:32px!important;margin:4px 0!important}.calc-equation.compact-equation{font-size:25px!important}.calc-instruction{font-size:11px}.calc-answer-display{height:49px!important;margin-bottom:4px!important}.calc-answer-display span{font-size:30px}.calc-feedback{font-size:12px;min-height:20px;margin:3px 0}
 .calc-compare-answers button{min-height:76px;padding:5px}.calc-compare-answers b{font-size:30px}.calc-compare-answers span{font-size:10px}
}
/* Một ô trả lời duy nhất cho bài tách/gộp; số có hai chữ số không xuống dòng. */
.answer-blank{white-space:nowrap!important;overflow-wrap:normal!important;word-break:normal!important;flex-shrink:0;line-height:1!important;font-variant-numeric:tabular-nums}
.calc-equation .answer-blank{width:1.7em!important;height:1.7em!important;min-width:1.7em!important;min-height:1.7em!important;font-size:.78em!important}
.bond-part .answer-blank,.bond-total .answer-blank,.combine-total .answer-blank{width:64px!important;height:64px!important;min-width:64px!important;min-height:64px!important;font-size:30px!important;border-color:#d3578c!important;background:#ffe3ef!important;color:#174b82;font-weight:900}
.combine-picture{width:100%;padding:8px 0;display:grid;justify-items:center}
.combine-picture .number-groups{width:100%}
.combine-picture .number-group{position:relative}
.combine-picture .number-group:after{content:'';position:absolute;bottom:-17px;left:50%;width:3px;height:15px;background:#9cbed9}
.group-join{width:70%;height:0;border-top:3px solid #9cbed9;position:relative;margin:14px auto 20px}
.group-join:after{content:'';position:absolute;top:0;left:50%;height:20px;width:3px;background:#9cbed9}
.combine-total{display:grid;place-items:center}
@media(max-width:600px){.bond-part .answer-blank,.bond-total .answer-blank,.combine-total .answer-blank{width:56px!important;height:56px!important;min-width:56px!important;min-height:56px!important;font-size:27px!important}}
@media(orientation:landscape) and (max-height:560px){.bond-part .answer-blank,.bond-total .answer-blank,.combine-total .answer-blank{width:42px!important;height:42px!important;min-width:42px!important;min-height:42px!important;font-size:23px!important}.group-join{margin:8px auto 14px}.group-join:after{height:14px}.combine-picture .number-group:after{bottom:-11px;height:9px}.combine-picture{padding:2px 0}}
/* Không để thao tác bàn phím cuộn ngầm nội dung bên trong thẻ bài. */
.calc-game-card{overflow:clip}
/* Phụ huynh chọn một tập dạng bài để trộn; ô chọn vẫn dùng được bằng bàn phím. */
.custom-mix{margin:22px 0 0;padding:22px;border:2px solid #b4d5ed;border-radius:22px;background:#f3fbff;color:#194c72}
.custom-mix legend{font-weight:800;padding:0 10px}
.custom-mix-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.custom-mix-choices label{display:flex;align-items:center;gap:10px;padding:14px;background:white;border:2px solid #dceaf4;border-radius:14px;cursor:pointer;font-weight:700}
.custom-mix-choices label:has(input:checked){background:#e1f8ed;border-color:#77caa8}
.custom-mix-choices input{width:22px;height:22px;accent-color:#198672;flex-shrink:0}
.custom-mix p{margin:15px 0 0;line-height:1.6}
.calc-start-btn:disabled{opacity:.5;cursor:not-allowed}
.pc-home-card{display:flex;gap:18px;align-items:center;margin-top:16px;padding:22px 26px;border:2px solid #9bd5cb;border-radius:22px;background:linear-gradient(110deg,#e8fbf3,#f0f8ff);color:#19546a;text-decoration:none}
.pc-home-card b{display:block;font-size:21px}.pc-home-card small{display:block;margin-top:6px;line-height:1.6}.pc-home-card>span:first-child{font-size:36px}.pc-home-card>span:last-child{margin-left:auto;font-weight:800}
