/* Känguru – träning med riktiga Känguruproblem. Prefix: kg- */
.kg-toy-host{position:relative;width:100%;border-radius:20px;overflow:hidden;background:#eef2e5;border:1px solid #d7e0ce;min-height:120px}
.kg-toy-host.big{min-height:520px}
.kg-toy-loading{padding:40px;text-align:center;color:var(--muted)}
.toy-test{padding:24px;max-width:1150px;margin:auto}.toy-test-block{margin-bottom:30px}.toy-test-block h2{font-size:1rem;color:var(--muted)}

.kg-hero{position:relative;display:grid;grid-template-columns:1.3fr 1fr;gap:20px;border-radius:28px;padding:36px 42px;margin-bottom:30px;color:#fff;overflow:hidden;background:radial-gradient(circle at 85% 20%,#e58f4f 0,#c8692f 45%,#8f4318 100%)}
.kg-hero h1{font-size:clamp(2.3rem,4.6vw,3.6rem);color:#fffaf0;letter-spacing:-2px;margin:14px 0 12px}
.kg-hero h1 span{color:var(--yellow)}
.kg-hero p{color:#ffe9d6;max-width:520px}
.kg-hero .pill{background:#ffffff26}
.kg-hero-art svg{width:100%;height:100%;max-height:230px}
.kg-hero-die{transform-origin:130px 95px;animation:kg-bob 4s ease-in-out infinite}
@keyframes kg-bob{50%{transform:translateY(-8px) rotate(-3deg)}}

.kg-classes{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:26px}
.kg-class{position:relative;display:grid;gap:2px;text-align:left;background:#fff;border:1.5px solid var(--line);border-radius:20px;padding:18px 20px;box-shadow:0 4px 0 #e9ede4;transition:transform .15s,border-color .15s}
.kg-class:hover{transform:translateY(-2px);border-color:#c8692f}
.kg-class.chosen{background:var(--green);color:#fff;border-color:var(--green);box-shadow:0 4px 0 #092f28}
.kg-class-mark{font-size:1.6rem;color:#c8692f;line-height:1}
.kg-class.chosen .kg-class-mark{color:var(--yellow)}
.kg-class strong{font-size:1.3rem;letter-spacing:-.4px}
.kg-class small{font-size:.8rem;opacity:.75}
.kg-class-meta{font-size:.72rem;font-weight:800;margin-top:6px;opacity:.8}
.kg-pick-hint{text-align:center;color:var(--muted);padding:20px}

.kg-modes{display:grid;grid-template-columns:1fr 1.25fr;gap:16px;margin-bottom:28px}
.kg-mode{border-radius:22px;padding:24px 26px;display:flex;flex-direction:column;gap:8px}
.kg-mode h2{margin:0;font-size:1.5rem}.kg-mode p{margin:0;font-size:.92rem}
.kg-mode .eyebrow{margin:0}
.kg-mode-mix{background:var(--green);color:#fff}.kg-mode-mix p,.kg-mode-mix small{color:#cfe2d9}.kg-mode-mix .eyebrow{color:var(--yellow)}
.kg-mode-mix .primary{align-self:flex-start;margin-top:8px}
.kg-mode-exam{background:#fcf6e3;border:1px solid #efe1b4}.kg-mode-exam .eyebrow{color:#a2752f}
.kg-meter{height:10px;border-radius:10px;background:#ffffff2a;overflow:hidden;margin-top:6px}
.kg-meter span{display:block;height:100%;width:var(--w,0%);background:var(--yellow);border-radius:10px;transition:width .6s}
.kg-meter.big{height:14px;background:#e4eadf;max-width:420px;margin:12px auto 0}
.kg-years{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.kg-years button{background:#fff;border:1.5px solid #eadcae;border-radius:10px;padding:7px 12px;font-weight:800;font-size:.88rem}
.kg-years button:hover{border-color:#c8692f}

.kg-themes{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin-bottom:32px}
.kg-theme{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;column-gap:12px;align-items:center;text-align:left;background:#fff;border:1.5px solid var(--line);border-radius:16px;padding:14px 16px;transition:transform .15s,border-color .15s}
.kg-theme:hover{transform:translateY(-2px);border-color:var(--green)}
.kg-theme span{grid-row:1/3;width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:#eef4ee;color:var(--green);font-size:1.35rem;font-weight:900}
.kg-theme strong{font-size:.95rem}.kg-theme small{font-size:.74rem;color:var(--muted)}

.kg-playground{margin-bottom:26px}
.kg-toys{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.kg-toy-card{display:grid;gap:4px;text-align:left;background:#eef2e5;border:1px solid #d7e0ce;border-radius:18px;padding:16px 18px;transition:transform .15s}
.kg-toy-card:hover{transform:translateY(-2px)}
.kg-toy-card span{font-size:1.8rem;color:#c8692f;line-height:1}
.kg-toy-card strong{font-size:1rem}.kg-toy-card small{font-size:.8rem;color:var(--muted)}
.kg-toys.small{grid-template-columns:repeat(3,1fr);margin-top:16px}

.kg-credit{font-size:.82rem;color:var(--muted);border-top:1px solid var(--line);padding-top:16px;max-width:880px}
.kg-credit.small{font-size:.76rem;margin-top:18px}

/* Problem */
.kg-crumbs{display:flex;align-items:center;justify-content:space-between;margin-bottom:14px}
.kg-crumbs .back{background:none;font-weight:800;color:var(--green);padding:6px 0}
.kg-queue{font-size:.75rem;font-weight:900;letter-spacing:1px;color:var(--muted)}
.kg-card{background:#fff;border:1px solid var(--line);border-radius:26px;padding:28px 32px;box-shadow:0 5px 0 #eef1ea;max-width:900px;margin:0 auto}
.kg-card.celebrate{animation:kg-pop .5s cubic-bezier(.3,1.5,.5,1)}
@keyframes kg-pop{40%{transform:scale(1.015)}}
.kg-card-meta{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:16px;flex-wrap:wrap}
.kg-card-meta .pill{background:#eef2e8;color:#4b6453;font-size:.64rem}
.kg-points{font-size:.72rem;font-weight:900;border-radius:20px;padding:5px 11px}
.kg-p3{background:#e3f1e6;color:#1d6b43}.kg-p4{background:#fdf0d2;color:#8a5f12}.kg-p5{background:#fbe2d6;color:#a04a1f}
.kg-question{font-size:clamp(1.15rem,2.2vw,1.45rem);letter-spacing:-.2px;line-height:1.45;font-weight:700;margin:0 0 18px;outline:none}
.kg-figure{margin:0 0 20px;padding:16px;background:#fbfbf7;border:1px solid #ebeee4;border-radius:18px;text-align:center}
.kg-figure img{max-width:100%;height:auto;max-height:340px;mix-blend-mode:multiply}
.kg-answers{border:0;padding:0;margin:0 0 14px;display:grid;gap:8px}
.kg-answers legend{font-size:.78rem;font-weight:800;color:var(--muted);margin-bottom:8px;padding:0}
.kg-answers.text{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.kg-answers.letters{grid-template-columns:repeat(5,1fr)}
.kg-answer{display:flex;align-items:center;gap:10px;background:#f7f8f3;border:1.5px solid #e2e7dc;border-radius:14px;padding:11px 13px;font-weight:700;text-align:left;min-height:52px;transition:transform .1s,border-color .15s}
.kg-answers.letters .kg-answer{justify-content:center}
.kg-answer>span{flex:none;width:30px;height:30px;border-radius:9px;background:#fff;border:1px solid #dde3d6;display:grid;place-items:center;font-weight:900}
.kg-answers.letters .kg-answer>span{width:40px;height:40px;font-size:1.2rem}
.kg-answer:hover:not(:disabled){border-color:var(--green)}
.kg-answer.selected{border-color:var(--green);background:#e8f3ec}.kg-answer.selected>span{background:var(--green);color:#fff;border-color:var(--green)}
.kg-answer.wrong{opacity:.55;border-color:#e0a58a;background:#fbefe9;text-decoration:line-through}
.kg-answer.correct{border-color:#2f8a55;background:#e3f3e8}.kg-answer.correct>span{background:#2f8a55;color:#fff;border-color:#2f8a55}
.kg-answer b{margin-left:auto;color:#2f8a55}
.kg-feedback{min-height:1.4em;font-weight:700;color:#93603b;margin:0 0 8px}
.kg-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:16px}
.kg-actions .primary{margin:0}
.kg-toy-btn{display:inline-flex;align-items:center;gap:8px}
.kg-toy-btn span{font-size:1.2rem;color:#c8692f}
.kg-toy-panel{margin:4px 0 18px;border-radius:20px;background:#f5f7f0;padding:12px}
.kg-toy-panel[hidden]{display:none}
.kg-toy-head{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;padding:2px 6px 10px}
.kg-toy-head span{font-size:.84rem;color:var(--muted)}
.kg-solution{border-left:5px solid #2f8a55;background:#f2f9f4;border-radius:16px;padding:16px 20px;margin-bottom:16px}
.kg-solution h2{margin:0 0 6px;font-size:1.3rem}
.kg-solution p{margin:0 0 6px;color:#30504a}
.kg-earned{font-weight:900;color:#1d6b43!important}
.kg-idea{font-size:.86rem}
.kg-source{display:flex;gap:12px;background:#f6f4ec;border-radius:16px;padding:14px 16px;font-size:.86rem;margin-top:8px}
.kg-source-icon{font-size:1.8rem;line-height:1;color:#c8692f;font-family:Georgia,serif}
.kg-source p{margin:4px 0 0;font-size:.8rem}
.kg-source-links{display:flex;gap:16px;flex-wrap:wrap}
.kg-next{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin-top:18px}
.kg-next .primary{margin:0}

/* Playground page */
.kg-play-head{display:flex;gap:18px;align-items:center;margin-bottom:18px}
.kg-play-icon{width:64px;height:64px;border-radius:18px;background:#c8692f;color:#fff;display:grid;place-items:center;font-size:2rem;flex:none}
.kg-play-head h1{margin:0 0 4px;outline:none}.kg-play-head p{margin:0}.kg-play-head .eyebrow{margin:0 0 4px;color:#c8692f}

/* Exam */
.kg-exam-card,.kg-result-head{max-width:720px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:26px;padding:30px 34px;box-shadow:0 5px 0 #eef1ea;text-align:left}
.kg-exam-card h1,.kg-result-head h1{outline:none;margin:6px 0 10px}
.kg-exam-rules{padding-left:20px;color:var(--muted);display:grid;gap:4px;margin:0 0 16px}
.kg-check{display:flex;gap:10px;align-items:center;font-weight:700;margin-bottom:16px}
.kg-check input{width:20px;height:20px;accent-color:var(--green)}
.kg-exam-bar{position:sticky;top:0;z-index:5;display:flex;align-items:center;gap:14px;justify-content:space-between;background:var(--paper);padding:10px 0;margin-bottom:6px}
.kg-clock{font-weight:900;font-variant-numeric:tabular-nums;background:#fff;border:1px solid var(--line);border-radius:20px;padding:6px 14px}
.kg-clock.low{background:#fbe2d6;color:#a04a1f}
.kg-clock[hidden]{display:none}
.kg-exam-dots{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:16px;justify-content:center}
.kg-exam-dots button{width:36px;height:36px;border-radius:10px;background:#fff;border:1.5px solid var(--line);font-weight:800;font-size:.82rem}
.kg-exam-dots button.answered{background:#e3f1e6;border-color:#9fcfae}
.kg-exam-dots button.current{background:var(--green);color:#fff;border-color:var(--green)}
.kg-result-head{text-align:center}
.kg-result-list{list-style:none;padding:0;max-width:820px;margin:20px auto;display:grid;gap:6px}
.kg-result-list li{background:#fff;border:1px solid var(--line);border-radius:14px;border-left:5px solid #c9d3c6}
.kg-result-list li.ok{border-left-color:#2f8a55}.kg-result-list li.no{border-left-color:#d9895f}
.kg-result-list summary{display:grid;grid-template-columns:40px 1fr auto;gap:12px;align-items:center;padding:10px 14px;cursor:pointer;font-weight:700;font-size:.9rem}
.kg-result-list p{padding:0 16px;margin:0 0 8px;color:#3e5650}
.kg-result-list .text-button{margin:0 16px 12px}
.kg-r-n{width:30px;height:30px;border-radius:9px;background:#eef2e8;display:grid;place-items:center;font-weight:900}

@media(max-width:950px){.kg-hero{grid-template-columns:1fr}.kg-hero-art{display:none}.kg-classes{grid-template-columns:repeat(2,1fr)}.kg-modes{grid-template-columns:1fr}.kg-toys{grid-template-columns:repeat(2,1fr)}}
@media(max-width:700px){
  .kg-hero{padding:26px 22px}
  .kg-card{padding:20px 18px;border-radius:20px}
  .kg-answers.letters{grid-template-columns:repeat(5,1fr);gap:6px}
  .kg-answers.letters .kg-answer{padding:8px 4px}
  .kg-answers.text{grid-template-columns:1fr 1fr}
  .kg-toys,.kg-toys.small{grid-template-columns:1fr 1fr}
  .kg-exam-card,.kg-result-head{padding:22px 20px}
  .kg-result-list summary{grid-template-columns:32px 1fr;font-size:.82rem}.kg-result-list summary span:last-child{grid-column:2}
  .kg-toy-host.big{min-height:420px}
}
@media(prefers-reduced-motion:reduce){.kg-hero-die,.kg-card.celebrate{animation:none}}

/* A quiet work surface: the problem and its answers stay together. */
body.question-mode .header{height:64px;padding-inline:28px;gap:24px}
body.question-mode .brand{font-size:1.35rem}
body.question-mode .brand-symbol{width:32px;height:34px;font-size:1.8rem;border-radius:9px 9px 9px 3px}
body.question-mode .nav-button{padding:20px 0 16px;font-size:.85rem}
body.question-mode .header nav{gap:20px}
body.question-mode main{max-width:1360px;margin:14px auto 24px;min-height:0}
body.question-mode>footer{display:none}
body.question-mode .play-heading{flex-wrap:wrap;gap:10px}
body.question-mode .play-heading>.question-tool{margin-left:auto}
body.question-mode .trail{margin-block:14px 18px}
.question-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:36px;margin-bottom:14px}
.question-toolbar>div{display:flex;align-items:center;justify-content:flex-end;gap:16px}
.question-toolbar .back{font-weight:700;font-size:.88rem;padding:6px 0}
.question-tool{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;padding:8px 12px;border:1px solid #d6dfd3;border-radius:10px;background:#fff;color:var(--green);font-size:.82rem;font-weight:700;white-space:nowrap}
.question-tool:hover{background:#edf3e9;border-color:#99b6a3}
.question-tool>span{font-size:1.2em;line-height:1}
.kg-card.kg-workspace{display:grid;grid-template-columns:minmax(0,1fr) minmax(270px,.43fr);gap:0 32px;max-width:none;padding:24px 28px;border-radius:22px;box-shadow:0 3px 0 #e9eee4;align-items:start}
.kg-workspace>.kg-card-meta{grid-column:1/-1;margin-bottom:20px}
.kg-workspace .kg-prompt{min-width:0}
.kg-workspace .kg-question{font-size:clamp(1.15rem,1.8vw,1.5rem);line-height:1.5;font-weight:700;letter-spacing:-.3px;margin-bottom:20px;text-wrap:pretty}
.question-figure{margin:0;background:#fafbf7;border:1px solid #e7ebdf;border-radius:14px;overflow:hidden}
.question-image{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;width:100%;padding:16px 18px 10px;background:transparent;cursor:zoom-in}
.question-image img{display:block;max-width:100%;width:auto;height:auto;max-height:var(--question-image-limit,clamp(190px,calc(100dvh - 360px),390px));object-fit:contain;mix-blend-mode:multiply}
.question-image-hint{align-self:flex-end;color:#61766b;font-size:.7rem;font-weight:700;display:flex;align-items:center;gap:5px}
.question-image:hover .question-image-hint{color:var(--green);text-decoration:underline}
.question-source{font-size:.75rem;color:var(--muted);margin-top:14px}
.question-source summary{cursor:pointer;width:fit-content;padding:4px 0;color:#577163;font-weight:700}
.question-source>div{padding:12px 0 2px;line-height:1.6}
.question-source p{margin:4px 0 8px}
.question-source a{display:inline-block;margin:0 14px 4px 0}
.kg-response{min-width:0;padding:20px;background:#f3f6ee;border:1px solid #e4eadc;border-radius:16px}
.kg-response .kg-answers{margin-bottom:14px;gap:8px}
.kg-response .kg-answers legend{font-size:.8rem;margin-bottom:12px;color:#526d5f}
.kg-response .kg-answers.text{grid-template-columns:1fr}
.kg-response .kg-answers.letters{grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
.kg-response .kg-answer{position:relative;background:#fff;min-height:50px;padding:8px 11px;gap:12px;border-color:#dce5d5;box-shadow:0 2px 0 #e5ebdf;line-height:1.4}
.kg-response .kg-answer>span{background:#f2f5ed;border:0;border-radius:8px;width:30px;height:30px;color:#496653;font-size:.9rem}
.kg-response .kg-answer strong{font-size:1rem;font-weight:700;overflow-wrap:anywhere}
.kg-response .kg-answers.letters .kg-answer{padding:8px 2px;min-height:52px}
.kg-response .kg-answers.letters .kg-answer>span{width:28px;height:32px;font-size:1.05rem}
.kg-response .kg-answers.letters .kg-answer b{position:absolute;right:-2px;top:-5px;display:grid;place-items:center;width:16px;height:16px;border-radius:50%;font-size:.7rem;background:#2b7047;color:#fff}
.kg-response .kg-answers.letters .kg-answer.wrong b{background:#9d6446;color:#fff}
.kg-response .kg-answer:hover:not(:disabled){background:#edf4e8;border-color:#4f8063}
.kg-response .kg-answer:active:not(:disabled){transform:translateY(1px);box-shadow:none}
.kg-response .kg-answer.wrong{opacity:1;background:#f7eeea;border-color:#d8b7a5;color:#8b5840;box-shadow:none}
.kg-response .kg-answer.wrong b{color:#9d6446}
.kg-response .kg-answer.wrong>span{background:#f0dfd4;color:#8b5840}
.kg-response .kg-answer.correct{background:#e5f2e6;border-color:#509569;box-shadow:0 2px 0 #d0e5d2}
.kg-response .kg-answer.correct>span{background:#2b7047;color:#fff}
.kg-response .kg-answer.selected:not(.wrong):not(.correct){background:#eaf2e6;border-color:#527e61}
.kg-response .kg-answer.selected>span{background:#386d4e;color:#fff}
.kg-response .kg-feedback{min-height:76px;margin:0;padding:12px 0;color:#526d5f;font-size:.85rem;line-height:1.5;font-weight:400;outline:none}
.kg-feedback strong{display:block;font-size:1.02rem;color:var(--green);line-height:1.4}
.kg-feedback p{margin:3px 0 0;font-size:.85rem;color:inherit}
.kg-feedback.done{display:flex;align-items:flex-start;gap:11px;color:#39704c}
.kg-result-mark{display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:50%;color:#fff;background:#2b7047;font-size:1.2rem;font-weight:900}
.kg-feedback.try-again{color:#8b593d}
.kg-feedback.try-again strong,.kg-feedback.has-error strong{color:#8b593d}
.kg-feedback.has-error{color:#8b593d}
.kg-feedback .text-button{padding:5px 0}
.kg-response .kg-next{display:block;margin:4px 0 16px}
.kg-response .primary{width:100%;min-height:48px;padding:12px 16px;justify-content:space-between;gap:16px;font-size:.94rem;border-radius:10px;box-shadow:0 3px 0 #092f28}
.kg-response .kg-actions{margin:0;gap:12px}
.kg-response .text-button{font-size:.8rem;padding:7px 0;min-height:36px;text-align:left}
.kg-response .kg-toy-btn{margin-top:12px;background:transparent;font-size:.77rem;min-height:36px}
.kg-explanation{border-top:1px solid #dce5d5;padding-top:10px;font-size:.86rem;line-height:1.6}
.kg-explanation summary{cursor:pointer;font-size:.83rem;font-weight:700;color:var(--green);padding:5px 0}
.kg-explanation p{margin:10px 0 0;color:#405f4e;white-space:pre-line}
.kg-workspace>.kg-toy-panel{grid-column:1/-1;margin-top:20px}
.kg-workspace .kg-toy-panel[hidden]{display:none}
.question-mode .kg-exam-dots{flex-wrap:nowrap;overflow-x:auto;justify-content:flex-start;gap:5px;margin:0 0 12px;padding:0 0 5px;scrollbar-width:thin}
.question-mode .kg-exam-dots button{flex:none;width:34px;height:34px}
.kg-exam-controls>.primary{margin:4px 0 10px}
.kg-exam-controls>div{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap}
.question-toolbar .kg-clock{font-size:.8rem;padding:5px 9px}

/* Native fullscreen and a window-filling fallback share the same readable layout. */
body.question-presenting{overflow:hidden}
body.question-presenting>.header,body.question-presenting>footer{display:none}
body.question-presenting main,main:fullscreen{position:fixed;inset:0;z-index:1000;box-sizing:border-box;width:100%;height:100dvh;max-width:none;margin:0;padding:clamp(14px,2.3vmin,36px);overflow-y:auto;background:var(--paper);--question-image-limit:clamp(220px,calc(100dvh - 310px),650px)}
body.question-presenting main>.kg,main:fullscreen>.kg{max-width:1680px;margin-inline:auto}
body.question-presenting .question-toolbar,main:fullscreen .question-toolbar{position:sticky;top:0;z-index:5;background:var(--paper);padding-bottom:6px;margin-bottom:16px}
body.question-presenting .kg-workspace,main:fullscreen .kg-workspace{padding:clamp(20px,2.5vmin,38px);gap:0 clamp(24px,3vmin,48px)}
body.question-presenting .kg-workspace .kg-question,main:fullscreen .kg-workspace .kg-question{font-size:clamp(1.2rem,2.4vmin,1.9rem)}
body.question-presenting .kg-response .kg-answer strong,main:fullscreen .kg-response .kg-answer strong{font-size:clamp(1rem,1.9vmin,1.3rem)}
body.question-presenting .kg-response .kg-answer,main:fullscreen .kg-response .kg-answer{min-height:clamp(50px,6vmin,70px)}
body.question-presenting .kg-response,main:fullscreen .kg-response{padding:clamp(18px,2.1vmin,30px)}
body.question-presenting .kg-feedback strong,main:fullscreen .kg-feedback strong{font-size:clamp(1.02rem,2vmin,1.3rem)}
body.question-presenting .kg-feedback p,main:fullscreen .kg-feedback p{font-size:clamp(.85rem,1.6vmin,1.05rem)}
body.question-presenting .kg-response .primary,main:fullscreen .kg-response .primary{font-size:clamp(.94rem,1.8vmin,1.2rem)}
.question-image-dialog{box-sizing:border-box;max-width:min(1200px,96vw);width:max-content;max-height:94dvh;padding:16px;border:1px solid #d7dfd1;border-radius:18px;background:#fff;box-shadow:0 20px 80px #102d2940}
.question-image-dialog::backdrop{background:#183b32c9;backdrop-filter:blur(3px)}
.question-image-bar{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:12px;color:var(--green)}
.question-image-bar>div{display:flex;gap:8px}
.question-image-scroll{max-height:calc(94dvh - 130px);overflow:auto;max-width:100%}
.question-image-scroll:focus-visible{outline:3px solid #e88c2e;outline-offset:-3px}
.question-image-scroll img{display:block;max-width:none;height:auto;margin:auto}
.question-image-scroll.image-fit img{width:auto!important;max-width:100%;max-height:calc(94dvh - 150px)}
.question-image-dialog>p{font-size:.75rem;margin:10px 0 0;color:var(--muted)}

@media(min-width:821px) and (max-height:700px){
  body.question-mode .header{height:56px}
  body.question-mode .nav-button{padding:16px 0 12px}
  body.question-mode main{margin-top:8px}
  .question-toolbar{margin-bottom:6px}
  .question-toolbar .question-tool{min-height:36px}
  body.question-mode .kg-card.kg-workspace{padding:16px 22px;gap:0 24px}
  .kg-workspace>.kg-card-meta{margin-bottom:10px}
  .kg-workspace .kg-question{font-size:1.15rem;margin-bottom:14px}
  .question-image img{max-height:var(--question-image-limit,clamp(160px,calc(100dvh - 320px),300px))}
  body.question-mode .kg-response{padding:12px}
  body.question-mode .kg-response .kg-answers{gap:6px;margin-bottom:10px}
  body.question-mode .kg-response .kg-answers.text{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.question-mode .kg-response .kg-answers.text .kg-answer.long-answer{grid-column:1/-1}
  body.question-mode .kg-response .kg-answers legend{margin-bottom:8px}
  body.question-mode .kg-response .kg-answer{min-height:44px;padding:6px 10px}
  body.question-mode .kg-response .kg-answer>span{width:26px;height:26px}
  body.question-mode .kg-response .kg-feedback{min-height:58px;padding:8px 0}
  body.question-mode .kg-response .kg-next{margin:0 0 10px}
  body.question-mode .kg-response .primary{min-height:44px;padding:10px 14px}
  .kg-explanation{padding-top:6px}
  .kg-explanation summary{padding-block:4px}
}
@media(max-width:1100px){
  body.question-mode .header{gap:18px;padding-inline:22px}
  body.question-mode .header nav{gap:15px}
  body.question-mode .brand{font-size:1.2rem}
  .kg-card.kg-workspace{gap:0 22px;padding:22px;grid-template-columns:minmax(0,1fr) minmax(250px,.55fr)}
  .kg-response{padding:16px}
}
@media(max-width:820px){
  .kg-card.kg-workspace{grid-template-columns:minmax(0,1fr) minmax(230px,.75fr);gap:0 16px;padding:18px}
  .kg-workspace .kg-question{font-size:1.1rem}
  .kg-workspace>.kg-card-meta{margin-bottom:16px}
  .kg-response{padding:14px}
  .question-toolbar>div{gap:10px}
}
@media(max-width:700px){
  body.question-mode .header{height:auto;min-height:88px;padding:10px 18px 0;gap:0 16px}
  body.question-mode .header nav{gap:18px}
  body.question-mode .nav-button{padding:11px 0 9px;font-size:.8rem}
  body.question-mode .brand{font-size:1.2rem}
  body.question-mode main{margin:10px auto 18px;padding-inline:12px}
  .question-toolbar{gap:8px;margin-bottom:10px}
  .question-toolbar .back{font-size:.78rem}
  .question-toolbar>div{gap:8px}
  .question-toolbar .kg-queue{font-size:.65rem;letter-spacing:0;white-space:nowrap}
  .question-tool{font-size:.73rem;padding:7px 9px;min-height:38px}
  .kg-card.kg-workspace{grid-template-columns:1fr;padding:18px;gap:16px;border-radius:16px}
  .kg-workspace>.kg-card-meta{margin:0;gap:8px}
  .kg-workspace .kg-question{font-size:1.1rem;margin-bottom:14px;line-height:1.45}
  .kg-card-meta .pill{font-size:.58rem;letter-spacing:.5px;padding:5px 8px}
  .kg-card-meta .kg-points{font-size:.65rem;padding:4px 8px}
  .question-image{padding:12px 10px 8px}
  .question-image img{max-height:var(--question-image-limit,min(32dvh,280px))}
  .question-source{margin-top:8px;font-size:.7rem}
  .kg-response{padding:16px}
  .kg-response .kg-answers.text{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kg-response .kg-answers.text .kg-answer.long-answer{grid-column:1/-1}
  .kg-response .kg-answer{gap:7px;padding:8px;min-height:50px}
  .kg-response .kg-answer strong{font-size:.95rem}
  .kg-response .kg-feedback{min-height:60px;padding:10px 0}
  .kg-workspace>.kg-toy-panel{grid-column:auto;margin-top:0}
  body.question-presenting main,main:fullscreen{padding:12px;padding-bottom:max(12px,env(safe-area-inset-bottom));--question-image-limit:min(38dvh,340px)}
  body.question-presenting .kg-workspace,main:fullscreen .kg-workspace{padding:18px;gap:16px}
  .question-image-dialog{padding:12px;border-radius:14px}
  .question-image-bar{flex-wrap:wrap;gap:10px}
  .question-image-bar>div{margin-left:auto}
  .question-mode .kg-exam-dots button{width:40px;height:40px}
}
@media(max-width:380px){.question-toolbar .kg-queue{display:none}.kg-card.kg-workspace{padding:14px}.kg-response{padding:12px}}

/* With a figure, the answer box sits beside the picture and shares its bottom edge, so the buttons are level
   with the choices printed in the picture. If the answer box is taller, the figure box grows to match. */
@media(min-width:701px){
  .kg-workspace:has(>.kg-prompt>.question-figure)>.kg-prompt{display:contents}
  .kg-workspace:has(>.kg-prompt>.question-figure) .kg-question{grid-column:1;grid-row:2}
  .kg-workspace:has(>.kg-prompt>.question-figure) .question-figure{grid-column:1;grid-row:3;align-self:stretch;display:flex;flex-direction:column}
  .kg-workspace:has(>.kg-prompt>.question-figure) .question-figure>.question-image{flex:1}
  .kg-workspace:has(>.kg-prompt>.question-figure) .question-source{grid-column:1;grid-row:4}
  .kg-workspace:has(>.kg-prompt>.question-figure)>.kg-response{grid-column:2;grid-row:3;align-self:end}
}
