.mode-tabs{flex-wrap:wrap}.thinking-hero{position:relative;border:2px solid #ecd488;border-radius:20px;overflow:hidden;margin:20px 0}.thinking-hero>img{width:100%;height:auto;display:block}.thinking-hero>div{position:absolute;bottom:0;left:0;width:100%;padding:30px 20px 12px;background:linear-gradient(transparent,#101b2af5)}.thinking-hero h2{color:#ffe59c;margin:0;font-size:clamp(1.2rem,3vw,2rem)}.thinking-hero p{font-size:.7rem;letter-spacing:.15em;margin:0}.thinking-courses{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.thinking-course{border:2px solid var(--quest-color);border-radius:18px;overflow:hidden;background:linear-gradient(140deg,#303c4b,#14202f)}.thinking-course header{display:flex;align-items:center;gap:12px;padding:14px;background:linear-gradient(120deg,#ffffff14,transparent)}.thinking-course header>img{width:72px;height:108px;object-fit:contain;filter:drop-shadow(0 4px 5px #0008)}.thinking-course h3{font-size:1.1rem;color:var(--quest-color);margin:6px 0}.thinking-course small{font-size:.65rem;letter-spacing:.1em}.thinking-levels{display:flex;gap:6px;padding:10px}.thinking-levels>button{flex:1;min-width:0;padding:10px 2px;background:#f6e6b8;color:#162335;border:1px solid #d3bb77}.thinking-levels span{display:block}.thinking-levels .stars{font-size:.7rem}.thinking-treasure{margin-top:22px;padding:20px;border:1px solid #e6ce84;border-radius:18px;background:#182638}.thinking-treasure>div{display:flex;justify-content:center;gap:16px}.thinking-treasure figure{margin:0;flex:1;max-width:140px;text-align:center}.thinking-treasure img{width:100%;height:180px;object-fit:contain}.thinking-treasure figcaption{font-size:.8rem}.thinking-treasure p{font-size:.85rem;margin:15px 0 0}.thinking-mode .arena{max-height:160px}.thinking-mode .fighter-art{height:90px}.thinking-mode .fighter-label,.thinking-mode .vs small{display:none}.quest-prompt{display:flex;align-items:center;gap:12px;padding:12px;border:1px solid #e3ca85;border-radius:14px;background:linear-gradient(120deg,#f6edcf,#d7e0eb);color:#141f2e}.quest-prompt>img{width:58px;height:87px;object-fit:contain;flex-shrink:0}.quest-prompt p{font-size:1.05rem;font-weight:700;line-height:1.65;margin:0}.thinking-choices{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:10px 0}.thinking-choices>button{background:#e8edda;color:#17263a;border:3px solid #8c99ab;padding:10px;line-height:1.5}.thinking-choices>button[aria-pressed=true]{border-color:#ffd65e;background:#ffecaf;box-shadow:0 0 0 2px #ffd65e}.choice-question .equation{position:absolute!important;opacity:0;pointer-events:none;width:1px!important;height:1px!important;overflow:hidden}.choice-question .keypad{display:block!important}.choice-question .keypad>button:not(.confirm){display:none}.choice-question .keypad>.confirm{width:100%}.picture-groups{display:flex;flex-wrap:wrap;justify-content:center;gap:5px;margin-bottom:6px}.picture-box{border:2px solid #947c46;border-bottom:5px solid #947c46;border-radius:5px;padding:3px;display:flex;gap:2px;background:#fff6db}.picture-box img{width:24px;height:36px;object-fit:contain}.thinking-help{display:flex;align-items:center;gap:14px;padding:12px;border-radius:14px;background:#243449}.thinking-help>img{width:60px;height:90px;object-fit:contain}.thinking-help p{margin:0;line-height:1.6}.own-reason{display:block;font-size:.8rem;line-height:1.6;margin:12px 0}.own-reason textarea{display:block;width:100%;font:inherit;padding:8px;border-radius:8px}#thinking-feedback>strong{display:block;margin:10px 0;color:#ffe59c}#thinking-next{width:100%;margin-top:10px}.thinking-mode .equation{font-size:1rem}.thinking-mode .question-zone{max-width:900px;margin:12px auto}
@media(max-width:900px){.thinking-courses{grid-template-columns:repeat(2,minmax(0,1fr))}.thinking-course header{gap:8px;padding:10px}.thinking-course header>img{width:52px;height:78px}.thinking-course h3{font-size:.9rem}.thinking-mode #app{display:flex;flex-direction:column;height:100dvh;gap:5px}.thinking-mode .arena{display:none}.thinking-mode .battle-header{flex-shrink:0;min-height:40px}.thinking-mode .question-zone{flex:1;min-height:0;width:100%;margin:0;padding:8px;display:flex;flex-direction:column;gap:4px;overflow:auto}.thinking-mode .battle-settings{display:none}.thinking-mode .question-top,.thinking-mode .mistake-count{margin:0;font-size:.7rem;flex-shrink:0}.quest-prompt{gap:8px;padding:8px}.quest-prompt>img{width:42px;height:63px}.quest-prompt p{font-size:clamp(.8rem,2.9vw,1rem);line-height:1.5}.thinking-mode #answer-form{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center}.thinking-mode #answer-form[hidden]{display:none}.thinking-mode .equation{margin:4px 0;flex-shrink:0}.thinking-mode .answer-input{height:42px;min-height:42px;font-size:1.5rem}.thinking-mode .keypad{flex-shrink:0;gap:4px}.thinking-mode .keypad button{height:40px;min-height:40px;font-size:1.1rem;padding:3px}.thinking-mode .battle-message{min-height:18px;font-size:.7rem;margin:3px}.thinking-mode .hint-button{flex-shrink:0;min-height:32px;margin:0;padding:4px;font-size:.75rem}.thinking-mode .thinking-choices{gap:6px;margin:5px 0}.thinking-mode .thinking-choices>button{padding:5px;font-size:.8rem}.thinking-mode .picture-box img{width:21px;height:31px}.thinking-mode #thinking-feedback{flex:1;min-height:0}.thinking-mode #thinking-feedback .thinking-help p{font-size:.85rem}.thinking-treasure img{height:130px}}
@media(max-width:380px){.thinking-courses{grid-template-columns:1fr}.thinking-mode .picture-box{gap:1px;padding:2px}.thinking-mode .picture-box img{width:18px;height:27px}}
.quest-scene{display:block;width:100%;height:145px;object-fit:contain;margin:8px auto;border-radius:12px;background:#101c2b}.thinking-mode .keypad{width:100%;max-width:400px}.thinking-choices:not(.picture-choices){grid-template-columns:1fr}.thinking-mode .choice-question .keypad>.confirm{min-height:44px}.thinking-mode .thinking-choices>button{min-height:48px}.thinking-mode .picture-box img{width:32px;height:48px}.thinking-mode .picture-groups{gap:6px}.thinking-mode .question-zone{background:linear-gradient(160deg,#24354b,#101b2a)}
.exclusive-badge{font-size:.65rem;color:#ffe194}.collection-grid[data-size=small] .exclusive-badge{display:none}
.mixed-thinking{grid-template-columns:1fr}.mixed-thinking header p{margin:0;font-size:.9rem}.thinking-treasure>div{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.thinking-treasure figure{max-width:none;min-width:0}.thinking-treasure figcaption small{display:block;color:#f5d477;font-size:.7rem;margin-top:6px}.thinking-treasure img{height:180px;width:100%;object-fit:contain}@media(max-width:600px){.thinking-treasure>div{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 10px}.thinking-treasure img{height:160px}}
.thinking-mode .many-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.thinking-mode .many-groups .picture-box{display:flex;flex-wrap:wrap;justify-content:center;align-content:center;gap:1px;max-width:100%;padding:2px}.thinking-mode .many-groups .picture-box img{width:16px;height:24px}
@media(max-width:900px){.thinking-mode #answer-form{justify-content:flex-start}.thinking-mode .quest-scene{height:clamp(75px,16dvh,145px)}.thinking-mode .quest-prompt p{font-size:15px}.thinking-mode .thinking-choices>button{font-size:15px}.thinking-mode .picture-box img{width:28px;height:42px}.thinking-mode #answer-form>.keypad{margin-top:8px}.thinking-mode .hint-button{margin-top:auto}.thinking-mode #thinking-feedback~#answer-form{display:none}}
@media(max-height:550px) and (max-width:900px){.thinking-mode .question-zone{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto 1fr auto;gap:4px 10px}.thinking-mode .mistake-count{grid-column:1}.thinking-mode .question-top{grid-column:2;grid-row:1}.thinking-mode #thinking-question{grid-column:1;grid-row:2}.thinking-mode #answer-form{grid-column:2;grid-row:2/4}.thinking-mode #show-hint{grid-column:1;grid-row:3}.thinking-mode #thinking-feedback{grid-column:2;grid-row:2/4;overflow:auto}.thinking-mode .keypad button{min-height:32px;height:32px}.thinking-mode .picture-box img{width:16px;height:24px}.thinking-mode .quest-prompt p{font-size:.8rem}}
@media(max-height:700px) and (max-width:900px){.thinking-mode .quest-scene{display:none}.thinking-mode .quest-prompt p{font-size:14px;line-height:1.45}.thinking-mode .quest-prompt>img{width:34px;height:51px}.thinking-mode .thinking-choices>button{font-size:14px}.thinking-mode .thinking-help{padding:6px;gap:6px}.thinking-mode .thinking-help>img{width:34px;height:51px}.thinking-mode .keypad button{height:36px;min-height:36px}}
@media(max-height:550px) and (max-width:900px){.thinking-mode .many-groups .picture-box img{width:12px;height:18px}}
@media(max-height:700px) and (max-width:900px){.thinking-mode .many-groups .picture-box img{width:12px;height:18px}.thinking-mode .many-groups{gap:3px}.thinking-mode .many-groups .picture-box{padding:1px;border-bottom-width:3px}.thinking-mode .picture-choices>button{padding:3px}}
@media(min-width:901px){.thinking-mode .topbar{display:none}.thinking-mode #app{height:100dvh;display:grid;grid-template-columns:220px minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:12px;padding:16px;max-width:1200px;margin:auto}.thinking-mode .battle-header{grid-column:1/-1;margin:0}.thinking-mode .arena{grid-column:1;grid-row:2;display:flex;flex-direction:column;justify-content:center;max-height:none;margin:0;gap:18px}.thinking-mode .fighter-art{height:160px}.thinking-mode .fighter h3{font-size:.9rem;margin:6px}.thinking-mode .question-zone{grid-column:2;grid-row:2;width:100%;margin:0;padding:14px;overflow:auto}.thinking-mode .battle-settings{display:none}.thinking-mode .quest-scene{height:120px}.thinking-mode .equation{margin:6px}.thinking-mode .answer-input{height:48px;min-height:48px;font-size:1.5rem}.thinking-mode .keypad button{height:42px;padding:5px}.thinking-mode .keypad{margin:5px auto}.thinking-mode .battle-message{margin:4px;font-size:.85rem}.thinking-mode .mistake-count,.thinking-mode .question-top{margin:3px}.thinking-mode .hint-button{margin:8px}.thinking-mode .thinking-help{font-size:.95rem}}

.thinking-levels{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;padding:14px}.thinking-levels>button{min-height:92px;padding:10px 6px}.thinking-levels>button:nth-child(n+5){background:#dfd9f0;border:2px solid #b6a3d6}.thinking-levels small{display:block;line-height:1.5;font-size:.75rem;margin:6px 0}.thinking-level-note{padding:0 14px;font-size:.9rem;line-height:1.7}.quest-prompt p,.thinking-help p{white-space:pre-line}.logic-visuals{display:flex;justify-content:center;gap:12px;flex-wrap:wrap;margin:10px 0}.logic-visuals figure{margin:0;text-align:center}.logic-visuals figcaption{font-size:.75rem;margin:4px}.logic-grid{display:grid;grid-template-columns:repeat(3,1fr);width:120px;max-width:100%;margin:auto;border:2px solid #bba878;background:#fff2cc}.logic-grid>span{height:40px;border:1px solid #a79a73;display:flex;align-items:center;justify-content:center}.logic-grid img{width:24px;height:36px;object-fit:contain}.logic-lineup{display:flex;gap:8px;justify-content:center}.logic-lineup img{width:38px;height:56px;object-fit:contain}.logic-path{display:grid;grid-template-columns:repeat(var(--cols),32px);border:2px solid #d4b862}.logic-path>span{height:32px;display:grid;place-items:center;background:#e9edd7;color:#18273b;border:1px solid #747f8e;font-weight:800}.logic-path .blocked{background:#704939;color:#fff2c2}.advanced-thinking .picture-choices{grid-template-columns:repeat(3,minmax(0,1fr))}.advanced-thinking .quest-scene{display:none}
@media(max-width:600px){.thinking-levels{grid-template-columns:repeat(2,minmax(0,1fr))}.thinking-levels>button{min-height:84px}.logic-grid{width:90px}.logic-grid>span{height:30px}.logic-grid img{height:27px;width:18px}.logic-path{grid-template-columns:repeat(var(--cols),25px)}.logic-path>span{height:25px}}
@media(max-width:900px){.thinking-mode.advanced-thinking .question-zone{display:flex;flex-direction:column;overflow:hidden}.advanced-thinking #thinking-question{flex:1;min-height:50px;overflow:auto}.thinking-mode.advanced-thinking #answer-form{flex:0 0 auto;min-height:0}.advanced-thinking .thinking-choices{max-height:27dvh;overflow:auto}.advanced-thinking #thinking-feedback{flex:1;min-height:0;overflow:auto}.advanced-thinking .quest-prompt{align-items:flex-start}.advanced-thinking .logic-visuals{margin:6px 0}}
@media(max-height:550px) and (max-width:900px){.thinking-mode.advanced-thinking .question-zone{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto minmax(0,1fr) auto}.advanced-thinking #thinking-question{min-height:0}.advanced-thinking .thinking-choices{max-height:55dvh}.advanced-thinking .quest-prompt>img{display:none}}
.advanced-thinking .order-choices{grid-template-columns:repeat(2,minmax(0,1fr))}.lineup-caption{text-align:center;font-size:.7rem;line-height:1.5;margin:3px}
.thinking-explanation>strong{display:block;margin:10px 0;color:#ffe59c}@media(max-width:900px){.thinking-mode.advanced-thinking #thinking-feedback{display:flex;flex-direction:column;overflow:hidden}.advanced-thinking .thinking-explanation{flex:1;min-height:0;overflow:auto}.advanced-thinking #thinking-next{flex-shrink:0;min-height:44px;margin:6px 0 0}}

.logic-lineup>figure{min-width:0;flex:1;max-width:64px}.logic-lineup figcaption{white-space:nowrap;font-size:.65rem;color:#ffe59c}

/* Original, lightweight diagrams keep reasoning visible without new image downloads. */
.thinking-puzzle-art{display:block;width:100%;max-width:340px;max-height:210px;background:#f4f9ff;border:2px solid #83bce8;border-radius:12px;margin:3px auto;flex-shrink:0;font-family:Arial,'Yu Gothic',sans-serif}
.thinking-mode .picture-choices .thinking-puzzle-art{max-height:110px;min-width:0;margin:0}
.thinking-mode.advanced-thinking .picture-choices{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:900px){.thinking-puzzle-art{max-height:180px}.advanced-thinking .quest-prompt p{font-size:.9rem}.advanced-thinking .quest-prompt>img{width:38px;height:57px}.advanced-thinking .thinking-choices>button{font-size:.85rem}}
/* Content-led layout: questions and answers stay together, without a flex spacer. */
.thinking-mode .question-zone{min-width:0;align-self:start}
.thinking-mode #thinking-question,.thinking-mode #answer-form,.thinking-mode #thinking-feedback{min-width:0}
.thinking-mode .quest-prompt p,.thinking-mode .thinking-help p{min-width:0;overflow-wrap:anywhere}
.thinking-mode .thinking-correct-label{font-size:clamp(24px,5vw,36px);font-weight:900;color:#ffe294;text-align:center;padding:8px;border:2px solid #ffe294;border-radius:12px;background:linear-gradient(110deg,#134c87,#116b91)}
#thinking-verdict{position:fixed;z-index:110;left:50%;top:50%;transform:translate(-50%,-50%);width:min(360px,calc(100% - 40px));box-sizing:border-box;padding:24px 16px;text-align:center;border:3px solid #ffe294;border-radius:24px;background:linear-gradient(135deg,#123674f5,#087da5f5);color:#ffe294;box-shadow:0 16px 60px #00183ba6,0 0 25px #78dbff66;pointer-events:none}
#thinking-verdict.verdict-retry{border-color:#ffc995;background:linear-gradient(135deg,#192e65f5,#71456cf5);color:#ffe1b1}
#thinking-verdict strong{display:block;font-size:clamp(30px,8vw,44px);font-weight:900;line-height:1.3}
#thinking-verdict small{display:block;font-size:14px;color:white;margin-top:10px}
#thinking-verdict .verdict-symbol{display:block;font-size:60px;line-height:1.1;font-weight:900}
#thinking-verdict .verdict-close{position:absolute;right:3px;top:3px;min-width:44px;min-height:44px;padding:4px;background:transparent;color:white;font-size:24px;pointer-events:auto}
@media(max-width:900px) and (min-height:551px){
 .thinking-mode .question-zone,.thinking-mode.advanced-thinking .question-zone{flex:0 1 auto;align-self:center;max-height:100%;min-height:0;overflow:hidden;gap:6px}
 .thinking-mode #thinking-question,.thinking-mode.advanced-thinking #thinking-question{flex:0 1 auto;min-height:0;overflow:auto}
 .thinking-mode #answer-form,.thinking-mode.advanced-thinking #answer-form{flex:0 0 auto;min-height:0}
 .thinking-mode #thinking-feedback,.thinking-mode.advanced-thinking #thinking-feedback{flex:0 1 auto;min-height:0;display:flex;flex-direction:column;overflow:hidden}
 .thinking-mode .thinking-explanation{flex:0 1 auto;min-height:0;overflow:auto}
 .thinking-mode #thinking-next{flex-shrink:0;min-height:44px;margin:6px 0 0}
 .thinking-mode .hint-button{margin-top:0}
 .thinking-mode .quest-scene{height:80px}
 .thinking-mode .thinking-puzzle-art{max-height:160px}
 .thinking-mode .thinking-choices{max-height:27dvh;overflow:auto}
}
/* A separate home destination for multiplication stories, using the existing VI colors. */
#kuku-content .hub-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}
.word-courses{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.word-course{display:flex;align-items:center;gap:10px;text-align:start;padding:10px;background:#164b94;color:#f4faff;border:1px solid #78bdff}
.word-course img{width:clamp(34px,6vw,55px);height:auto;aspect-ratio:2/3;object-fit:contain}
.word-course span,.word-course strong,.word-course small{display:block;min-width:0}
.word-course small{color:#ffe49a}
.thinking-mode .thinking-choices.word-choices{grid-template-columns:minmax(0,1fr);gap:4px;max-height:min(40dvh,235px);overflow:auto}
.thinking-mode .word-choices>button{padding:2px;min-height:46px}
.word-art{display:block;width:100%;height:clamp(42px,6.6dvh,60px)}
.book-open{display:block;margin:6px auto 0;border:1px solid #78bdff;background:#143e78;color:white;min-height:44px}
.word-reader{display:flex;flex-direction:column;gap:12px;max-height:calc(var(--visible-screen-height,100dvh) - var(--screen-safe-top,0px) - var(--screen-safe-bottom,0px) - 110px);min-height:0}
.word-reader header{padding-inline-end:42px}.word-reader header h2{margin-bottom:0}
.word-reader header b{color:#ffdf85}.word-pages{overflow:auto;min-height:0;line-height:1.85}
.word-reader nav{display:flex;gap:6px}.word-reader nav button{flex:1;min-width:0;min-height:44px;padding:6px}
@media(max-width:600px){#kuku-content .hub-tabs button{padding:5px 2px;gap:4px;font-size:clamp(12px,3vw,14px)}.word-course{gap:6px}.word-course strong{font-size:.87rem}}
@media(max-height:550px){.thinking-mode .thinking-choices.word-choices{max-height:50dvh}.word-art{height:37px}}
.thinking-mode .word-art.word-picture{height:clamp(50px,8dvh,76px)}
.quest-prompt .word-question{display:block;margin-top:.35em;padding-top:.35em;border-top:1px solid #9baec2;color:#103b70;text-align:start}.quest-prompt p:has(.word-question){text-align:start}

@media (min-width:901px) and (max-width:1366px), (min-width:901px) and (pointer:coarse){
  body.thinking-mode #app{grid-template-columns:minmax(0,1fr);padding-inline:max(16px,env(safe-area-inset-left),env(safe-area-inset-right))}
  body.thinking-mode .arena{display:none}
  body.thinking-mode .question-zone{grid-column:1;justify-self:center;margin-inline:auto;width:min(100%,900px)}
}
@media (min-width:601px) and (max-width:900px){
  body.battle-mode .question-zone{margin-inline:auto}
}
.save-slots{display:grid;gap:8px;margin:16px 0}
.save-slots h3{margin:0}
.save-slots button{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:46px;color:#eef6ff;background:#173c70;border:1px solid #84b4e2}
.save-slots button[aria-current]{color:#172b49;background:#ffe398;opacity:1;cursor:default}
.save-slots button span{font-size:.82em}
.save-slots button[data-save-slot]{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.5em;text-align:start}
.save-slots button[data-save-slot] strong{min-width:0}
.save-slots button[data-save-slot] bdi{display:block;overflow-wrap:anywhere}
.save-slots button[data-save-slot] span{white-space:nowrap}
.measure-text{white-space:nowrap}
.thinking-mode .quest-prompt p{line-break:strict;word-break:normal}
@media(max-width:600px){
  #player-badge{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .rank-list li>strong,.board-leaders em{max-width:12em;line-break:strict;text-wrap:balance}
}

.subject-tabs:has([data-subject="length"]){display:grid;grid-template-columns:repeat(5,minmax(0,1fr))}
.subject-tabs:has([data-subject="length"]) button{min-width:0;padding-inline:3px}
.length-panel{padding:clamp(10px,2vw,24px)}
.length-panel .word-course small{line-height:1.5}
.length-ruler{display:block;width:min(100%,520px);margin:8px auto;background:#fff5d6;border:2px solid #e8bd61;border-radius:10px;fill:#12365e}
@media(max-width:480px){.length-panel .word-course{flex-direction:column;align-items:flex-start}}
