/* One screen (user decision 06.10.2026, »Jeg køber anbefalingen til layout«): the task, all
   answers and Godkend on one screen. Rules R1–R6 of the prototype
   (koordination/2026-10-06/en-skaerm/prototype.html), built on the app's own classes.
   Only pupils' task screens carry body.task-screen (Lær, fagrunder, tests); admin and the
   parent pages are untouched. */

/* ---- R1 · Compact frame: small rail/top bar, no footer, Tilbage + progress + »?« in one row ---- */
.task-screen { --rail: 0px; --main-x: 10px; }
.task-screen .app-footer { display: none; }
.task-screen .app-shell { max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; min-height: 100vh; min-height: 100dvh; }
/* One row: the rail spans the page's height, so a panel that fills the screen does not stretch the page past it. */
.task-screen .app-shell { grid-template-rows: minmax(0, 1fr); }
.task-screen .main-content { position: relative; min-height: 0; padding: 8px var(--main-x) 10px; }
.task-screen .app-header { flex-direction: row; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 12px; }
.task-screen .brand-wordmark { font-size: 24px; }
.task-screen .brand-subtitle { display: none; }
.task-screen .student-nav { flex: 0 1 auto; width: auto; gap: 4px; justify-content: flex-end; }
.task-screen .student-nav a, .task-screen .student-switch { display: grid; place-items: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
.task-screen .student-switch { border: 0; opacity: 1; }
.task-screen .student-nav .luxi-icon { width: 26px; height: 26px; flex-basis: 26px; }
.task-screen .student-nav .luxi-mascot { width: 32px; height: 32px; flex-basis: 32px; }
/* The labels stay for screen readers; the icons carry them on screen. */
.task-screen .student-nav a > span:last-child:not(.luxi-mascot), .task-screen .student-switch > span {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (min-width: 1000px) {
  .task-screen { --rail: 68px; }
  [data-student-interface="true"].task-screen .app-shell { grid-template-columns: 68px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
  [data-student-interface="true"].task-screen .app-header { flex-direction: column; justify-content: flex-start; align-items: center; gap: 14px; padding: 12px 4px; }
  [data-student-interface="true"].task-screen .brand-wordmark { font-size: 21px; }
  [data-student-interface="true"].task-screen .student-nav { flex-direction: column; gap: 8px; }
  [data-student-interface="true"].task-screen .student-nav a { width: 44px; min-height: 44px; }
}

/* The panel is the screen: thin padding, the head row on top. */
.task-screen .task-panel { --task-pad: 14px; padding: 8px var(--task-pad) var(--task-pad); border-radius: 20px; }
.task-screen .assessment-shell { gap: 6px; }
@media (max-width: 430px) {
  .task-screen { --main-x: 6px; }
  .task-screen .task-panel { --task-pad: 10px; border-radius: 16px; }
}
/* Head row: Tilbage (+ speaker) on the left, progress, »?« and the flag in the middle, the
   subject (or Lær's task type) on the right. Tilbage and the subject stay in their own
   markup (page-context, ov-task-heading) and are laid over the panel's top line. */
.task-screen .main-content > :is(.page-context, .challenge-mark--task) {
  position: absolute; z-index: 5; margin: 8px 0 0; min-height: 44px; }
.task-screen .main-content > .page-context { left: calc(var(--main-x) + var(--task-pad, 14px)); right: calc(var(--main-x) + var(--task-pad, 14px)); pointer-events: none; color: var(--muted); font-size: 13px; }
.task-screen .main-content > .page-context > * { pointer-events: auto; }
.task-screen .page-context .action-with-audio { gap: 6px; }
.task-screen .page-context .button.back-button { min-width: 0; min-height: 44px; padding: 6px 12px; }
.task-screen :is(.page-context .audio-control, .prompt-listen) { width: 40px; height: 40px; flex-basis: 40px; padding: 8px; }
.task-screen .page-context > span { max-width: 22%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-screen .page-context:has(~ .challenge-mark--task) > span, .task-screen:has(.task-topline .ov-task-heading) .page-context > span { display: none; }
.task-screen .main-content > .challenge-mark--task { right: calc(var(--main-x) + var(--task-pad, 14px)); max-width: 24%; display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
/* Lær's head row (user 07.10.2026): »?« has its own place; the task type in bold (two lines, never cut), the
   child's step under it in small type, »Ny!« on its own line; nothing overlaps. It sits in the row's flow. */
.task-screen .task-topline > .ov-task-heading { flex: 0 1 clamp(150px, 27%, 300px); min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0 0 0 10px; padding: 2px 0; color: var(--ink); line-height: 1.2; }
.task-screen .ov-task-type { font-size: 15px; font-weight: 800; overflow-wrap: anywhere; }
.task-screen .ov-task-level { font-size: 12px; font-weight: 500; color: var(--muted); }
.task-screen .ov-level-up { font-weight: 800; color: var(--theme-primary, var(--purple)); }
.task-screen .ov-new-badge { flex: 0 0 auto; padding: 1px 9px; font-size: 12px; }
.task-screen .ov-new-badge .luxi-icon { width: 14px; height: 14px; }
.task-screen .main-content > .challenge-mark--task { min-height: 36px; margin-top: 12px; padding: 4px 12px; }
.task-screen .task-panel > .task-topline { min-height: 44px; gap: 8px; padding: 0 24% 0 var(--head-left, 168px); margin: 0 0 4px; }
.task-screen .task-panel > .task-topline:has(> .ov-task-heading) { padding-right: 0; }
.task-screen .task-topline .progress-numbers { font-size: 12px; line-height: 1.2; }
.task-screen .task-topline .progress-track { height: 8px; margin-top: 3px; }
.task-screen .assessment-task > .task-topline { padding-right: 24%; }
@media (max-width: 600px) {
  .task-screen .page-context > span { display: none; }
  .task-screen .main-content > .challenge-mark--task { max-width: none; }
  .task-screen .task-panel > .task-topline { padding-right: 0; }
  /* Narrow: Tilbage, speaker and progress on the first line; »?«, the type name, the step and »Ny!« on the second. */
  .task-screen .task-panel > .task-topline:has(> .ov-task-heading) { flex-wrap: wrap; padding-left: 0; row-gap: 2px; }
  .task-screen .task-topline:has(> .ov-task-heading) > .progress-meter { flex: 1 1 calc(100% - var(--head-left, 168px)); margin-left: var(--head-left, 168px); }
  .task-screen .task-topline > .ov-task-heading { flex: 1 1 0; margin-left: 4px; }
  .task-screen .task-topline:has(> .ov-task-heading) > .progress-meter { min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
  .task-screen:has(.main-content > .challenge-mark--task) .task-panel > .task-topline { padding-right: 56px; }
  /* »0 af 1« and »0 %« never break inside: one line when there is room, else »0 %« on a tidy second line
     (two »?« beside a video squeezed them over 3 lines, prodtest 22.11.2026). */
  .task-screen .task-topline .progress-numbers { flex-wrap: wrap; gap: 0 6px; }
  .task-screen .task-topline .progress-numbers > span { white-space: nowrap; }
  .task-screen .challenge-mark--task > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
@media (max-width: 380px) {
  .task-screen .page-context .back-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .task-screen { --head-left: 104px; }
}
/* »?« (guides) as round buttons in the head row; the title stays for screen readers. */
.task-screen .task-topline > .task-guides { display: flex; flex: 0 0 auto; gap: 6px; margin: 0; }
.task-screen .task-topline > .task-guides > .guided-intro { flex: 0 0 auto; margin: 0; padding: 0; border: 0; min-width: 0; }
.task-screen .task-guides > .guided-intro > summary { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 0; list-style: none; border-radius: 50%; }
.task-screen .task-guides > .guided-intro > summary::-webkit-details-marker { display: none; }
.task-screen .task-guides > .guided-intro > summary .guided-intro-badge { margin: 0; width: 40px; height: 40px; font-size: 1.35rem; }
/* Guide (»Kør med kladden«, 06.10.2026): on a landscape iPad from 1100 px the guide is a side
   panel without the dim layer, so the task stays in view; below that a sheet from the bottom as before. */
@media (min-width: 1100px) and (orientation: landscape) {
  .task-screen :is(.guide-sheet-mode, .guide-docked)[open] > .guide-scrim { background: transparent; pointer-events: none; }
  .task-screen :is(.guide-sheet-mode, .guide-docked)[open] > .guide-sheet { top: 0; right: 0; bottom: 0; left: auto; width: min(42%, 480px); max-width: none; max-height: none; margin: 0;
    border-radius: 20px 0 0 20px; box-shadow: -8px 0 28px rgb(10 42 40 / 22%); }
  .task-screen:has(.guide-docked[open]) .app-shell { margin-right: min(42%, 480px); }
}

/* ---- R2 · Closer vertical rhythm ---- */
.task-screen .task-body { padding-top: 4px; }
.task-screen .assessment-task .task-body { margin-top: 0; }
.task-screen .task-prompt { font-size: clamp(1.15rem, 1.1vw + .6rem + 1.3vh, 1.75rem); line-height: 1.3; letter-spacing: -.025em; margin: 0 0 10px; }
.task-screen .assessment-prompt-row { margin-bottom: 10px; }
.task-screen .reading-passage { padding: 10px 14px; margin-bottom: 10px; }
.task-screen .reading-passage p + p { margin-top: 6px; }
.task-screen .chat-stimulus { margin: 0 auto 8px; padding: 8px; }
.task-screen .chat-bubble { padding: 6px 11px; }
.task-screen .letter-target { font-size: clamp(64px, 11dvh, 110px); margin: 0 auto 10px; }
/* A whole word on a letter card still shrinks with its length (application.css), never past its card. */
.task-screen .guided-flashcard .letter-target { font-size: min(clamp(64px, 11dvh, 110px), calc(90cqw / (var(--stimulus-length) + 1))); }
.task-screen .math-expression { margin: 8px 0 12px; }
.task-screen .scratchpad-launch { margin: 0 0 8px; }
.task-screen .scratchpad-toggle { min-height: 44px; padding-block: 6px; }
.task-screen .button.stimulus-play { min-height: 56px; margin: 0 auto 8px; }
.task-screen .assessment-stimulus-audio { margin-bottom: 10px; }
.task-screen .uses-answer-pad .response-fields { gap: 8px; }
html:has(body.task-screen) { scroll-padding-bottom: 96px; }
.task-screen .answer-choices, .task-screen .answer-choices .choice { scroll-margin-bottom: 96px; }

/* ---- R3 · The picture follows the screen's height ---- */
.task-screen .task-image { width: auto; max-width: 100%; height: clamp(110px, 34dvh, 270px); margin: 0 auto 8px; object-fit: contain; }
.task-screen .task-body > .assessment-media-image { max-height: min(34dvh, 270px); margin-bottom: 8px; }
.task-screen .stimulus-panel-image { max-height: min(26dvh, 240px); }
.task-screen .guided-choice-image { max-height: min(24dvh, 220px); }

/* ---- R5 · Answers in columns by length; lower cards, speaker to the side ---- */
.task-screen .answer-choices { gap: 10px; margin-bottom: 0; }
.task-screen .answer-choices.answers-tiny { grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); }
.task-screen .answer-choices.answers-short { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); }
.task-screen .answer-choices.answers-medium { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.task-screen .answer-choices.answers-long { grid-template-columns: minmax(0, 1fr); }
.task-screen .letter-choices { max-width: 460px; margin-inline: auto; }
.task-screen .task-panel .answer-choices[class*="answers-"]:not(.letter-choices) .choice > label {
  height: auto; min-height: clamp(56px, 9dvh, 88px); padding: 10px 16px; --label-size: clamp(1.05rem, .6vw + .8rem + .8vh, 1.4rem); font-size: var(--label-size); font-weight: 650; }
.task-screen .task-panel .answer-choices[class*="answers-"]:not(.letter-choices) .choice:has(.choice-speech) > label { padding-right: 52px; }
.task-screen .task-panel .answer-choices[class*="answers-"] .choice-speech { top: 50%; bottom: auto; right: 2px; transform: translateY(-50%); }
.task-screen .task-panel .letter-choices .choice > label { min-height: clamp(64px, 10dvh, 96px); padding: 8px 12px; }
.task-screen .task-panel .letter-choices .choice:has(.choice-speech) > label { padding-right: 48px; }
/* Picture answers keep their grid; three fit on one row when there is room. */
.task-screen .answer-choices.guided-choices:has(.guided-choice-image) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); }
.task-screen .answer-choices.guided-choices .choice:has(.guided-choice-image) > label { min-height: 0; padding: 8px; }
.task-screen .answer-choices.guided-choices .choice:has(.guided-choice-image):has(.choice-speech) > label { padding-bottom: 54px; }
.task-screen .guided-choices .choice:has(.guided-choice-image) .choice-speech .spoken-button { width: 44px; height: 44px; }
/* Picture answers side by side on a phone too (UI review 19.11.2026, H5): one under the other, the third
   picture, in the rhyme task the right one, lay below the screen at 360 px. Four pictures make two rows of two. */
@media (max-width: 480px) {
  .task-screen .task-panel .answer-choices.guided-choices:not(.layout-rows):has(.guided-choice-image) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); }
  .task-screen .task-panel .answer-choices.guided-choices:not(.layout-rows):has(.guided-choice-image):has(> .choice:nth-of-type(4):last-of-type) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .task-screen .task-prompt { font-size: clamp(1.05rem, 4.2vw, 1.3rem); }
  .task-screen .task-panel .answer-choices[class*="answers-"]:not(.letter-choices) .choice > label { min-height: 54px; padding: 8px 12px; --label-size: 1.02rem; font-size: var(--label-size); }
  .task-screen .task-panel .answer-choices[class*="answers-"]:not(.letter-choices) .choice:has(.choice-speech) > label { padding-right: 46px; }
  .task-screen .answer-choices.answers-tiny { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-screen .task-panel .answer-choices.answers-tiny[class*="answers-"]:not(.letter-choices) .choice:has(.choice-speech) > label { padding: 8px 6px 40px; }
  /* Short answer tiles (0. kl. Natur, F2 11.11): the speaker sits in the bottom corner with its own tap area, so a tap
     in the middle of the tile always chooses the answer. */
  .task-screen .task-panel .answer-choices.answers-tiny .choice-speech { top: auto; bottom: 0; right: 0; transform: none; }
}

/* ---- R6 · Godkend right under the answers; no feedback block before an answer ---- */
/* The bar keeps position: sticky; bottom: 0 (answer_ui.css), so it stays on screen when the
   task is taller than the screen. Before an answer the feedback line is hidden. */
.task-screen .task-panel[data-task-state-value="unanswered"] > .task-feedback { display: none; }
.task-screen .task-feedback { height: auto; min-height: 52px; margin-top: 10px; padding-top: 8px; gap: 10px; }
.task-screen .task-feedback .luxi-mascot { width: 48px; height: 48px; flex-basis: 48px; }
.task-screen .task-explanation { gap: 10px; margin-top: 8px; padding: 14px 16px; }
.task-screen .guide-offer { margin: 8px 0; padding: 6px 8px 6px 12px; }
.task-screen .task-panel > .save-status { min-height: 0; margin: 4px 0 0; }
.task-screen .task-action-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin: 8px calc(-1 * var(--task-pad)) calc(-1 * var(--task-pad)); padding: 8px var(--task-pad) calc(8px + env(safe-area-inset-bottom)); }
.task-screen .task-action-bar > .task-actions, .task-screen .task-action-bar > .task-action-listening { display: contents; }
.task-screen .task-action-bar .save-status { order: 0; flex: 1 1 auto; min-width: 0; min-height: 0; margin: 0; font-size: 12px; line-height: 1.3; }
.task-screen .task-action-bar > .task-action-listening > div:first-child { order: 1; }
.task-screen .task-action-bar .task-secondary-slot { order: 2; }
.task-screen .task-action-bar > .task-action-listening > div:last-child { order: 3; }
.task-screen .task-action-bar .task-primary-slot { order: 4; }
.task-screen .task-action-bar > .task-action-listening > div { min-height: 0; }
.task-screen .task-action-bar > .task-action-listening > div:not(:has(button)) { display: none; }
.task-screen .task-action-bar .task-primary-slot, .task-screen .task-action-bar .task-secondary-slot { height: auto; }
.task-screen .task-action-bar .task-secondary-slot:not(:has(button:not([hidden]), form)) { display: none; }
.task-screen .task-action-bar .task-action { display: inline-flex; width: auto; min-width: 190px; height: clamp(56px, 8dvh, 68px); padding: 8px 22px; font-size: 1.05rem; }
.task-screen .task-action-bar .task-secondary-slot .task-action { min-width: 0; }
.task-screen .assessment-action-bar .assessment-save-state { flex: 1 1 auto; text-align: left; font-size: 12px; }
@media (max-width: 430px) {
  .task-screen .task-action-bar .save-status { flex: 0 1 5.5rem; }
  .task-screen .task-action-bar .task-primary-slot { flex: 1 1 auto; min-width: 0; }
  .task-screen .task-action-bar .task-secondary-slot { flex: 1 1 auto; min-width: 0; }
  .task-screen .task-action-bar .task-action { display: inline-flex; grid-template-rows: none; width: 100%; min-width: 0; height: 56px; padding: 6px 10px; font-size: .95rem; }
  .task-screen .task-action-bar .task-action .luxi-icon { width: 24px; height: 24px; }
}
/* Phone dock with two buttons (user's phone 08.10.2026, obs. 18: »Prøv igen«/»Næste opgave« cut off at the right edge,
   »Se svar og forklaring« on 3 lines). Up to 560 px the dock breaks into two rows: the save line on a thin row of its
   own, then 🔊 · second button · 🔊 · main button sharing the full width. The icon sits above the label, the label is
   at most 2 lines and never broken inside a word; every button keeps a tap area of at least 44 px. With only one
   button (Godkend, the last task) the row is unchanged. */
@media (max-width: 560px) {
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) { flex-wrap: wrap; column-gap: 6px; row-gap: 2px; padding-top: 4px; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .save-status { flex: 1 0 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-secondary-slot { flex: 1 1 0; min-width: 0; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-secondary-slot:has(.explanation-button) { flex-grow: 1.2; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-primary-slot { flex: 1 1 0; min-width: 0; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) > .task-action-listening > div { flex: 0 0 44px; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-action {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; width: 100%; min-width: 0;
    height: auto; min-height: 56px; padding: 5px 6px; font-size: .9rem; line-height: 1.15; text-align: center; white-space: normal; overflow-wrap: normal; hyphens: manual; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-action .luxi-icon { flex: none; width: 20px; height: 20px; }
  .task-screen .task-action-bar:has(.task-secondary-slot :is(button:not([hidden]), form)) .task-action .pause-symbol { font-size: 18px; }
}
/* The pad with Godkend (talpanel/tastatur) keeps sticking, with thinner padding. */
.task-screen .task-panel[data-task-state-value="unanswered"] .answer-form .answer-pad:has(.pad-submit) { padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }

/* Læsevisning (K9, 17.10.2026): the scroll box and the side-by-side layout below also hold for discrete
   (huller, udsagn, match …) and typed answers with a reading text (.reading-answers, set by the view), not
   only for multiple choice and the number pad. Discrete answers with a picture keep their own layouts,
   except those typed on the answer pad (brøk, koordinatpar, tekst: .discrete-response .answer-pad), the column
   builder (.discrete-columns) and the grid (.discrete-grid): stacked on a laptop the answer left the picture a
   strip or lay below the screen (UI review 19.11.2026), so they sit beside the picture like a number task. */
/* ---- R4 · Landscape: picture, reading text or chat beside the question and answers ----
   Not for tasks whose text points at a place (».. øverst«, PLACEMENT_WORDS): task-media-stacked keeps the media on top. */
@media (orientation: landscape) and (min-width: 700px) {
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers):not(:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)) ~ :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)))) {
    display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); grid-template-rows: repeat(9, minmax(var(--task-grid-row-min, auto), auto)) minmax(0, 1fr); column-gap: 20px; align-items: start;
  }
  .task-screen .task-body > * { min-width: 0; }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) > :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)) {
    grid-column: 1; grid-row: 1 / -1; align-self: start; margin-top: 0; }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) > :not(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)) { grid-column: 2; }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) :is(.task-prompt, .assessment-prompt-row) { text-align: left; justify-content: flex-start; }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) .task-image { width: 100%; height: auto; max-height: min(62dvh, 340px); }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) > .assessment-media-image { max-height: min(62dvh, 340px); }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) :is(.reading-passage, .task-stimulus .guided-reading) { max-height: calc(100dvh - 130px); overflow: auto; }
  .task-screen .task-panel:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) .chat-stimulus { margin: 0; }
  /* A number task without a picture: the question on the left, the answer box and the pad on the right. */
  /* Not once the explanation shows beside a picture (.explanation-top with .a-media): there the picture is wrapped,
     so this grid matched too, and the folded question and Kladde lay on top of the explanation (UI review H4). */
  .task-screen .task-panel:not(.scratchpad-open, .explanation-top:has(.a-media)) > .task-body:has(.uses-answer-pad):not(:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)))) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: repeat(9, minmax(var(--task-grid-row-min, auto), auto)) minmax(0, 1fr); column-gap: 24px; align-items: start;
  }
  .task-screen .task-panel:not(.scratchpad-open, .explanation-top:has(.a-media)) > .task-body:has(.uses-answer-pad):not(:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)))) > * { grid-column: 1; }
  .task-screen .task-panel:not(.scratchpad-open, .explanation-top:has(.a-media)) > .task-body:has(.uses-answer-pad):not(:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)))) > .answer-form { grid-column: 2; grid-row: 1 / -1; }
  .task-screen .task-panel:not(.scratchpad-open, .explanation-top:has(.a-media)) > .task-body:has(.uses-answer-pad):not(:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none)))) .task-prompt { text-align: left; }
  /* Beside the question the pad fits on screen, so it sits still in its column. */
  .task-screen .task-panel[data-task-state-value="unanswered"]:not(.scratchpad-open, .task-media-stacked) > .task-body:has(.uses-answer-pad) .answer-form .answer-pad:has(.pad-submit) {
    position: static; margin: var(--task-answer-pad-top, 4px) 0 0; padding: 0; border: 0; box-shadow: none; background: none; max-width: 30rem; }
  .task-screen .task-panel:not(.scratchpad-open) > .task-body:has(.uses-answer-pad) .pad-key { min-height: max(44px, min(60px, 8dvh)); }
}
/* Portrait and phone: a long reading text gets its own scroll box. */
@media (orientation: portrait), (max-width: 699.98px) {
  .task-screen .task-panel:not(.scratchpad-open) > .task-body:is(:has(.answer-choices, .uses-answer-pad, .discrete-response .answer-pad, .discrete-columns, .discrete-grid), .reading-answers) :is(.reading-passage, .task-stimulus .guided-reading) { max-height: clamp(120px, 26dvh, 300px); overflow: auto; }
}

/* Help nudge (HelpNudge, user 06.10.2026): the »?« pulses gently 3 times with a small bubble
   »Brug for hjælp?«; with reduced motion a still ring instead. No sound. */
.task-guides { position: relative; }
.task-guides.help-nudge .guided-intro-badge { position: relative; }
.task-guides.help-nudge .guided-intro-badge::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--theme-primary, var(--purple)); }
@media (prefers-reduced-motion: no-preference) {
  .task-guides.help-nudge .guided-intro-badge::after { animation: guide-ring 1.4s ease-out 3; opacity: 0; }
}
/* Repeated idle nudge: a short dingle (wiggle) of the »?«; reduced motion: a still ring. */
@keyframes help-dingle { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-16deg); } 30% { transform: rotate(14deg); } 45% { transform: rotate(-11deg); } 60% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
@media (prefers-reduced-motion: no-preference) {
  .task-guides.help-dingle .guided-intro-badge { animation: help-dingle .7s ease-in-out 1; transform-origin: 50% 60%; }
}
@media (prefers-reduced-motion: reduce) {
  .task-guides.help-ring .guided-intro-badge { position: relative; }
  .task-guides.help-ring .guided-intro-badge::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 3px solid var(--theme-primary, var(--purple)); }
}
/* The bubble sits beside the »?« in the head row, level with it, with a small arrow pointing at it, so it never covers
   the task text under the head row and never leaves the screen (user's phone 08.10.2026, obs. 19: »or hjælp?« cut off
   on the left over the question). Default: to the left of the »?« (it sits at the right of the progress bar); in Lær,
   where the »?« starts the row with the type name beside it, to the right. */
.task-guides[data-help-bubble]::after { content: attr(data-help-bubble); position: absolute; top: 50%; right: calc(100% + 10px); left: auto; z-index: 6; padding: 6px 12px; border-radius: 12px;
  transform: translateY(-50%); background: var(--theme-primary, var(--purple)); color: #fff; font-size: .9rem; font-weight: 700; line-height: 1.2; white-space: nowrap; box-shadow: 0 4px 14px #0a2a2830; pointer-events: none; }
.task-guides[data-help-bubble]::before { content: ""; position: absolute; top: 50%; right: calc(100% + 2px); left: auto; z-index: 6; transform: translateY(-50%);
  border: 8px solid transparent; border-left-color: var(--theme-primary, var(--purple)); border-right-width: 0; pointer-events: none; }
/* While the bubble shows (about 4 s) it stands in for the type name, which is hidden so the two do not overlap. */
.task-topline:has(> .task-guides[data-help-bubble]) > .ov-task-heading { visibility: hidden; }
.task-topline:has(> .ov-task-heading) > .task-guides[data-help-bubble]::after { right: auto; left: calc(100% + 10px); }
.task-topline:has(> .ov-task-heading) > .task-guides[data-help-bubble]::before { right: auto; left: calc(100% + 2px); border-left-width: 0; border-left-color: transparent; border-right-width: 8px; border-right-color: var(--theme-primary, var(--purple)); }

/* Kladde on portrait and phone (placering A): the dock under the kladde keeps the compact Godkend row. */
@media (max-width: 699.98px), (orientation: portrait) {
  .task-screen .task-panel.scratchpad-open > .task-action-bar:has(.task-actions button:not([hidden]), .task-actions form) { display: flex; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .task-screen .task-panel.scratchpad-open > .task-action-bar > .task-action-listening { display: none; }
}

/* ---- R7 · Short tasks use the height (user 07.10.2026: »De korte opgaver ser ret sammenpresset ud på iPad«) ----
   task-compact (set on the server: short question, at most 4 short answers or pictures): the panel fills the
   screen, the content is centred vertically, and the type, the answers and the pictures grow with the height
   (dvh). Answers and Godkend stay on the one screen: the sizes are fractions of the screen's height. */
.task-screen .task-panel.task-compact { display: flex; flex-direction: column; min-height: calc(100dvh - var(--compact-chrome, 78px)); }
/* Below 1000 px the rail is a top bar (57 px) above the panel. */
@media (max-width: 999.98px) { .task-screen .task-panel.task-compact { min-height: calc(100dvh - var(--compact-chrome, 78px) - 57px); } }
.task-screen .task-panel.task-compact > .task-body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: clamp(8px, 2.2dvh, 26px); padding-top: 0; }
.task-screen .task-panel.task-compact > .task-body > * { margin-block: 0; }
.task-screen .task-compact .task-prompt { font-size: clamp(1.5rem, .8vw + .8rem + 2.8dvh, 2.9rem); text-align: center; }
.task-screen .task-compact .answer-form { width: 100%; }
.task-screen .task-compact .answer-choices { gap: clamp(10px, 2dvh, 24px); width: min(100%, 64rem); margin-inline: auto; }
.task-screen .task-panel.task-compact .answer-choices[class*="answers-"]:not(.letter-choices) .choice > label {
  min-height: clamp(80px, 17dvh, 190px); padding-block: clamp(10px, 2dvh, 24px); --label-size: clamp(1.4rem, .6vw + .8rem + 2.3dvh, 2.6rem); font-size: var(--label-size); }
.task-screen .task-compact .letter-choices { max-width: 680px; }
.task-screen .task-panel.task-compact .letter-choices .choice > label { min-height: clamp(84px, 17dvh, 180px); }
.task-screen .task-compact .answer-choices:not(:has(.choice-text-long)) .choice-text-short { font-size: clamp(2rem, 1vw + 1rem + 4.4dvh, 4.6rem); }
.task-screen .task-compact .task-image { height: clamp(120px, 38dvh, 360px); }
.task-screen .task-compact .task-body > .assessment-media-image { max-height: min(38dvh, 360px); }
.task-screen .task-compact .stimulus-panel-image { max-height: min(30dvh, 300px); }
.task-screen .task-compact .guided-choice-image { max-height: min(28dvh, 300px); }
.task-screen .task-compact .answer-choices.guided-choices:has(.guided-choice-image) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
.task-screen .task-compact .letter-target { font-size: clamp(80px, 17dvh, 170px); }
.task-screen .task-compact .guided-flashcard .letter-target { font-size: min(clamp(80px, 17dvh, 170px), calc(90cqw / (var(--stimulus-length) + 1))); }
.task-screen .task-compact .button.stimulus-play { min-height: clamp(64px, 10dvh, 96px); font-size: clamp(1.1rem, .5vw + .8rem + 1dvh, 1.6rem); }
.task-screen .task-compact .task-stimulus { text-align: center; }
/* Phone: the height is shared with the picture rows, so the growth is gentler. */
@media (max-width: 650px) {
  .task-screen .task-panel.task-compact .answer-choices[class*="answers-"]:not(.letter-choices) .choice > label { min-height: clamp(60px, 10dvh, 110px); --label-size: clamp(1.1rem, 4.6vw, 1.5rem); font-size: var(--label-size); }
  .task-screen .task-compact .task-prompt { font-size: clamp(1.25rem, 5.4vw, 1.7rem); }
  .task-screen .task-compact > .task-body { gap: clamp(6px, 1.4dvh, 14px); }
  .task-screen .task-compact .guided-choice-image { max-height: min(15dvh, 120px); }
  .task-screen .task-compact .task-image { height: clamp(100px, 24dvh, 220px); }
  .task-screen .task-compact .letter-target { font-size: clamp(56px, 10dvh, 90px); }
  .task-screen .task-compact .guided-flashcard .letter-target { font-size: min(clamp(56px, 10dvh, 90px), calc(90cqw / (var(--stimulus-length) + 1))); }
  .task-screen .task-short-big :is(.guided-reading, .reading-passage p) { font-size: clamp(1.5rem, 7vw, 2.1rem); }
}

/* A short reading text or stimulus sentence stands alone: big, centred and on top; then the question and the
   answers, also centred (user 07.10.2026: »Svært at fokusere øjnene på læseteksten, fordi den er presset op til venstre«). */
.task-screen .task-short-text .reading-passage, .task-screen .task-short-text .task-stimulus-text { text-align: center; }
.task-screen .task-short-text .reading-passage { border-left: 0; background: transparent; padding: 4px 8px; }
.task-screen .task-short-text :is(.guided-reading, .reading-passage p) { text-align: center; font-size: clamp(1.1rem, .4vw + .9rem + .6dvh, 1.45rem); line-height: 1.45; font-weight: 600; }
/* Big type only for one short sentence (L1, 17.11). */
.task-screen .task-short-big :is(.guided-reading, .reading-passage p) { font-size: clamp(1.7rem, 1.2vw + 1rem + 3.2dvh, 3.4rem); line-height: 1.35; }
.task-screen .task-short-text .guided-reading { margin: 0 auto; max-width: 40ch; }
.task-screen .task-short-text.task-compact .task-prompt { font-size: clamp(1.3rem, .6vw + .8rem + 2dvh, 2.1rem); font-weight: 700; }

/* A task's own introduction (»Vi øver sammen«) sits like the type guides (07.10.2026): a side panel on a landscape
   screen from 1100 px (above), otherwise a compact sheet from the bottom. Compact = the heading, the picture and the
   listen button fit without empty room, and the task's question stays visible above the sheet. */
.task-screen .guide-docked[open] > .guide-sheet { max-height: min(80dvh, 640px); padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
.task-screen .guide-docked .intro-heading { gap: 8px; }
.task-screen .guide-docked .intro-heading h2 { font-size: 1.15rem; }
.task-screen .guide-docked .intro-step { margin: 6px 0; }
.task-screen .guide-docked .intro-step > p:first-child { margin: 0 0 4px; font-size: .95rem; color: var(--muted); }
.task-screen .guide-docked .intro-picture:not(.guide-frames) { margin: 6px auto; }
.task-screen .guide-docked .intro-image { max-height: min(27dvh, 250px); }
.task-screen .guide-docked .guide-frames .intro-image { max-height: min(34dvh, 320px); width: auto; margin-inline: auto; }
.task-screen .guide-docked .intro-caption, .task-screen .guide-docked .intro-word { margin: 6px 0; }
.task-screen .guide-docked .button.intro-listen { min-height: 56px; padding: 8px 18px; }
.task-screen .guide-docked .intro-dots { margin: 2px 0; }
.task-screen .guide-docked .intro-practice-status { min-height: 0; margin: 0; }
.task-screen .guide-docked .intro-actions { margin-top: 6px; }
@media (min-width: 1100px) and (orientation: landscape) {
  .task-screen .guide-docked[open] > .guide-sheet { max-height: none; padding: 16px 18px; }
  .task-screen .guide-docked .intro-image { max-height: min(36dvh, 340px); }
}

/* Words in the answer buttons are never broken (user 07.10.2026: »Sommer« broke in the middle of the word). The
   server sets --longest-word (letters in the longest word); every button is a size container, and the type shrinks
   until the longest word fits the room beside the speaker. */
.task-screen .answer-choices:not(.letter-choices) .choice { container-type: inline-size; overflow-wrap: normal; word-break: normal; hyphens: none; }
.task-screen .task-panel .answer-choices[style*="--longest-word"][class*="answers-"]:not(.letter-choices) .choice > label {
  overflow-wrap: normal; word-break: normal; hyphens: none;
  font-size: min(var(--label-size, 1.4rem), max(.8rem, calc((100cqw - 5.2rem) / (var(--longest-word) * .64)))); }

/* The closed »Rapportér fejl« form must not add to the page's height (Chromium still counts its box), or a short
   task that fills the screen would scroll by the height of the form. */
.task-screen .task-report__details:not([open]) > .task-report__form, .task-screen .task-report__details:not([open]) > .task-report__sent { display: none; }
/* Portrait iPad: the picture rows share the height with the question and the answers, so the pictures grow less. */
@media (orientation: portrait) and (min-width: 651px) {
  .task-screen .task-compact .task-image { height: clamp(110px, 26dvh, 280px); }
  .task-screen .task-compact .stimulus-panel-image, .task-screen .task-compact .guided-choice-image { max-height: min(20dvh, 220px); }
  .task-screen .task-compact > .task-body { gap: clamp(8px, 1.8dvh, 20px); }
}

/* Picture or text in a column of its own beside the question (R4): the right column keeps the ordinary type sizes,
   so a longer question and its answers never grow taller than the screen. The picture still grows. */
@media (orientation: landscape) and (min-width: 700px) {
  .task-screen .task-panel.task-compact:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):has(.answer-choices) .task-prompt { font-size: clamp(1.15rem, 1.1vw + .6rem + 1.3vh, 1.9rem); text-align: left; }
  .task-screen .task-panel.task-compact:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(> :is(.reading-passage, .task-image, .assessment-media-image, .chat-stimulus, .stimulus-panels, .task-stimulus:not(.task-stimulus-audio, .task-stimulus-none))):has(.answer-choices) .answer-choices[class*="answers-"]:not(.letter-choices) .choice > label {
    min-height: clamp(56px, 9dvh, 88px); --label-size: clamp(1.05rem, .6vw + .8rem + .8vh, 1.5rem); }
}

/* ---- Forklaring øverst (version A, 07.10.2026, standard; LUXI_EXPLANATION_TOP=0 slår det fra) ----
   After Godkend: result and explanation (text, listen button, picture) on top, the task text folded to one
   line, the chosen answer marked just below (the right one too after a wrong answer), »Næste opgave« at the
   bottom. Prototype: koordination/2026-10-07/forklaring-prototype/forklaring.html (v-a, a-*). */
.explanation-top .a-result { display: grid; gap: 8px; min-width: 0; margin-bottom: 8px; }
.task-screen .task-panel.explanation-top .task-feedback { height: auto; min-height: 54px; margin: 0; padding: 6px 12px; gap: 12px; border-radius: 18px; }
.explanation-top .task-feedback .feedback-result-mark { flex-basis: 40px; width: 40px; height: 40px; }
.explanation-top .task-feedback .feedback-result-mark .luxi-icon { width: 26px; height: 26px; }
.task-screen .task-panel.explanation-top .task-explanation { margin: 0; padding: 10px 14px; gap: 8px; }
.explanation-top .task-explanation > h2 { margin: 0; font-size: clamp(1.05rem, 1.6vw, 1.3rem); }
.explanation-top .task-explanation-image { max-height: min(26dvh, 230px); }
@media (orientation: portrait) and (min-width: 700px) { .explanation-top .task-explanation-image { max-height: min(32dvh, 320px); } }
.explanation-top .coord-expl svg { max-height: min(26dvh, 230px); }
/* The task text on one line, unfolded with the chevron. */
.explanation-top .a-prompt { display: flex; align-items: center; gap: 6px; min-width: 0; margin: 0 0 8px; padding: 2px 4px 2px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.task-screen .explanation-top .a-prompt .task-prompt, .explanation-top .a-prompt .task-prompt { flex: 1; min-width: 0; margin: 0; font-size: clamp(.95rem, .5vw + .8rem, 1.15rem); font-weight: 650; line-height: 1.3; }
.explanation-top:not(.a-open) .a-prompt .task-prompt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explanation-top .a-prompt .task-prompt > * { vertical-align: middle; }
.a-fold-toggle { flex: 0 0 44px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.a-fold-toggle .luxi-icon { width: 24px; height: 24px; transition: transform .2s; }
.a-fold-toggle[aria-expanded="true"] .luxi-icon { transform: rotate(180deg); }
/* Only the chosen answer, and the right one after a wrong answer. */
.explanation-top .answer-choices .choice:not(.correct):not(.incorrect) { display: none; }
.explanation-top .answer-choices { grid-template-columns: minmax(0, 1fr); }
.explanation-top .answer-choices.guided-choices:has(.guided-choice-image) { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 12rem)); justify-content: center; }
/* The picture or reading text: folded away on a narrow/portrait screen, a left column on a landscape iPad. */
.explanation-top:not(.a-open) .a-media { display: none; }
.explanation-top .a-media :is(.task-image, .stimulus-panel-image) { height: auto; max-height: min(28dvh, 220px); }
.explanation-top .a-media .reading-passage { max-height: 30dvh; overflow: auto; }
/* Result and explanation start at the top. With the picture folded away, a centred body left an empty space above the
   result where the picture was (prodtest 27.11.2026, M3); :not(.scratchpad-open) puts this above the centring of the
   compact workspace further down. */
.task-screen .task-panel.explanation-top.task-compact:not(.scratchpad-open) > .task-body { justify-content: flex-start; gap: 0; }
/* The left column only for a real picture or text (an empty »no stimulus« box left half the panel blank), and not
   while the video panel takes the right side: then the task has about half the width, and two columns made the
   answer cards one letter wide (prodtest 27.11.2026, M4). The picture is then folded as on a narrow screen. */
@media (min-width: 1000px) and (orientation: landscape) {
  .task-screen:not(:has(.video-help[open])) .task-panel.explanation-top > .task-body:has(> .a-media > :not(.task-stimulus-none)) { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); column-gap: 20px; align-items: start; align-content: start; }
  .task-screen:not(:has(.video-help[open])) .task-panel.explanation-top > .task-body:has(> .a-media > :not(.task-stimulus-none)) > * { grid-column: 2; min-width: 0; }
  .task-screen:not(:has(.video-help[open])) .task-panel.explanation-top > .task-body:has(> .a-media > :not(.task-stimulus-none)) > .a-media { display: block; grid-column: 1; grid-row: 1 / span 6; }
  .explanation-top .a-media :is(.task-image, .stimulus-panel-image) { width: 100%; max-height: min(56dvh, 340px); margin: 0; }
  .explanation-top .a-media .reading-passage { max-height: calc(100dvh - 190px); }
  .task-screen .task-panel.explanation-top > .task-body:not(:has(> .a-media > :not(.task-stimulus-none))) { max-width: 760px; margin-inline: auto; width: 100%; }
}

/* Fixed task workspace (APP-NOTER 13.10, note 1): changing task length must not
   move the dock. The viewport budget includes the 57px mobile header and main
   padding. Long content remains reachable inside the body; the dock stays out
   of that scroll area. Keep Kladde A's fullscreen/sidepanel layout in control. */
.task-screen .task-panel.task-workspace:not(.scratchpad-open) {
  display: flex; flex-direction: column; --task-answer-pad-top: 8px;
  height: calc(100dvh - 18px); min-height: 0;
}
@media (max-width: 999.98px) {
  .task-screen .task-panel.task-workspace:not(.scratchpad-open) { height: calc(100dvh - 75px); }
}
.task-screen .task-workspace:not(.scratchpad-open) > .task-topline,
.task-screen .task-workspace:not(.scratchpad-open) > .task-action-bar,
.task-screen .task-workspace:not(.scratchpad-open) > .task-feedback,
.task-screen .task-workspace:not(.scratchpad-open) > .save-status { flex: 0 0 auto; }
.task-screen .task-workspace:not(.scratchpad-open) > .task-body {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
}
.task-screen .task-workspace:not(.scratchpad-open) > .task-action-bar { position: relative; bottom: auto; }
/* A typed answer owns its submit button: keep the form out of the question's
   scroll area. In R4 the question scrolls in its left grid cell; on a phone it
   gives space to the answer below. A long prompt must never stretch that cell.
   R4 already gives the question a separate grid row: the form may use its
   complete row, without subtracting the phone question allowance a second time. */
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body {
  --task-grid-row-min: 0px; overflow: visible;
}
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > :is(.task-prompt, .reading-passage, .task-stimulus, .task-image, .assessment-media-image, .stimulus-panels, .chat-stimulus) {
  flex: 1 1 auto; min-height: 0; max-height: 100%; overflow: auto;
}
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .answer-form {
  min-height: 0; align-self: stretch; overflow-y: auto;
}
/* The cap leaves the question its line above the pad. Answered, the pad is gone and the form is only the answer:
   capped, it lost its last 44 px beside the question in landscape (inside its grid row the 100 % is the answer itself). */
.task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:not(.scratchpad-open) > .task-body > .answer-form {
  max-height: var(--task-answer-form-max, calc(100% - 44px));
}
/* Once answered the pad is gone (task_feedback.css, UI review 20.11.2026 H2 + M9): the answer stands right under the
   question instead of at the bottom, and the form no longer needs the height it kept for the pad. So the rules that
   are there for the pad are bound to the unanswered state ([data-task-state-value="unanswered"]): the form at the
   bottom (here), and below the question's cap above the tall forms and the form's 27rem (21rem on a phone)
   (forenkling D3, 21.11.2026; until then three rules last in this file undid them, and only won by coming last). */
.task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:not(.scratchpad-open) > .task-body > .answer-form { margin-top: auto; }
/* The question first (bruger 20.11.2026, UI review H1). The form used to take its full height and leave the
   question what was over, down to nothing: a fraction task on a 360 px phone showed no question at all, and
   a coordinate picture was a 60 px strip. Now, when it cannot all be there:
   1. the form gives way first: it scrolls inside itself, the pad and Godkend still docked at its bottom
      (position: sticky, answer_ui.css), but never below the height of its fields plus the pad;
   2. then the question: it always keeps a line, and above the tall forms (brøk, koordinatpar, tekst) a very
      long one scrolls inside itself so the fields stay in view (at most 30 % of the screen, less on a low one);
   3. a picture on top is smaller but whole, never a strip (the magnifier shows it large). */
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .task-prompt { flex: 0 1 auto; min-height: 1.3em; max-height: none; }
.task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:not(.scratchpad-open) > .task-body:has(> .answer-form .discrete-response) > .task-prompt { max-height: max(3.9em, min(30dvh, 100dvh - 37rem)); }
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .answer-form { flex: 0 1000 auto; }
/* A number or letter answer (one box and the pad) is low enough to keep its whole height, as it always has
   (one_screen_layout_test: the box must never slide behind the pad); there a long question scrolls instead. */
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .answer-form:has(.constructed-response) { flex-shrink: 0; }
/* Fields, their labels and the pad: 27rem (21rem on a phone, where the helper lines are hidden). */
.task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:not(.scratchpad-open) > .task-body > .answer-form:has(.discrete-response) { min-height: min(100%, 27rem); }
.task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > :is(.stimulus-panels, .reading-passage, .chat-stimulus) { min-height: min(30%, 11rem); }
/* Stacked (a phone, a tablet in portrait, and tasks that keep the picture on top). Beside the form in
   landscape the picture keeps its size. */
@media (max-width: 699.98px), (orientation: portrait) {
  .task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .task-stimulus-image { flex: 0 0 auto; overflow: visible; }
  .task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .task-stimulus-image .task-image { height: clamp(96px, 22dvh, 220px); }
}
.task-screen .task-workspace.with-answer-pad:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) > .task-body > .task-stimulus-image { flex: 0 0 auto; overflow: visible; }
.task-screen .task-workspace.with-answer-pad:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) > .task-body > .task-stimulus-image .task-image { height: clamp(96px, 22dvh, 220px); }
/* A phone has no room for both the helper lines and the fields above the docked pad: »Dit svar« and the
   line that says how to type are kept for screen readers only (the fields are labelled, and »?« shows how),
   and the picture is a little lower. Without this the fields lay behind the pad. */
@media (max-width: 699.98px) and (max-height: 820px) {
  .task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:not(.scratchpad-open) > .task-body > .answer-form:has(.discrete-response) { min-height: min(100%, 21rem); }
  .task-screen .task-workspace.with-answer-pad:not(.scratchpad-open) > .task-body > .task-stimulus-image .task-image,
  .task-screen .task-workspace.with-answer-pad:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) > .task-body > .task-stimulus-image .task-image { height: clamp(96px, 16dvh, 220px); }
}
/* The other answer forms that are built on the screen (ordbrikker, gitter, bogstavfelter, søjler …) have the
   same lines above them, and on a 360 px phone those pushed the last tiles or rows below the screen (H5):
   hidden there too, and the picture above them is lower. */
@media (max-width: 699.98px) and (max-height: 820px) {
  .task-screen .task-workspace:not(.scratchpad-open) .answer-form :is(.response-fields > legend, .response-hint) {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .task-screen .task-workspace:not(.scratchpad-open, .with-answer-pad) > .task-body:has(.answer-form :is(.discrete-response, .constructed-response)) > .task-stimulus-image .task-image { height: clamp(96px, 20dvh, 220px); }
  /* A picture above answers in long text: lower, so the last answer is not below the screen. */
  .task-screen .task-workspace:not(.scratchpad-open) > .task-body:has(.answer-choices:is(.answers-long, .answers-medium)) > .task-stimulus-image .task-image { height: clamp(96px, 22dvh, 220px); }
}
/* The same on a low wide screen (a laptop, a tablet on its side) for the tasks that keep the picture on top.
   The 21rem is for the pad, so it is bound to the unanswered state like the rest (UI review 20.11.2026 H2 + M9):
   once answered the short answer stands right under the question. Its specificity is above the unanswered 27rem rule's. */
@media (min-width: 700px) and (max-height: 820px) {
  .task-screen .task-workspace.with-answer-pad:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) .answer-form :is(.response-fields > legend, .response-hint) {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .task-screen .task-workspace.with-answer-pad[data-task-state-value="unanswered"]:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) > .task-body > .answer-form:has(.discrete-response) { min-height: min(100%, 21rem); }
  .task-screen .task-workspace.with-answer-pad:is(.task-media-stacked, .task-short-text):not(.scratchpad-open) > .task-body > .task-stimulus-image .task-image { height: clamp(96px, 16dvh, 220px); }
}
.task-screen .task-workspace:not(.scratchpad-open) > .task-explanation {
  flex: 0 1 auto; min-height: 0; max-height: 40%; overflow-y: auto;
}
.task-screen .task-workspace.task-compact:not(.scratchpad-open) > .task-body { justify-content: safe center; }

@media (orientation: landscape) and (min-width: 700px) {
  .task-screen .task-panel.task-workspace.with-answer-pad:not(.scratchpad-open, .task-media-stacked, .task-short-text) > .task-body:has(.uses-answer-pad) {
    --task-answer-form-max: 100%;
  }
}

/* Læsevisning (K9, user decision 17.10.2026; prototype dansk-4-9/svarformer, fane Læsesæt): »Læs hele teksten«
   over a long reading text opens it in full screen with »Tilbage til spørgsmålet«. The button stays at the top of
   the scroll box; the dialog uses the light reading surface in every theme. */
.reading-open { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0 0 8px auto; padding: 6px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.reading-open .luxi-icon { width: 20px; height: 20px; flex: none; }
.reading-open:focus-visible { outline: 3px solid #357eac; outline-offset: 2px; }
.task-stimulus > .reading-open { margin-left: auto; }
dialog.reading-dialog { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--panel); color: var(--ink); overflow: hidden; }
dialog.reading-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
dialog.reading-dialog::backdrop { background: #0008; }
html:has(dialog.reading-dialog[open]) { overflow: hidden; }
.reading-dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); background: var(--page); }
.reading-dialog-bar strong { font-size: 1.05rem; }
.reading-dialog-close { min-height: 48px; }
.reading-dialog-text { overflow: auto; padding: 20px max(16px, calc((100% - 40rem) / 2)) calc(40px + env(safe-area-inset-bottom)); font-size: clamp(1.1rem, 1rem + .6vw, 1.3rem); line-height: 1.75; overflow-wrap: anywhere; }
.reading-dialog-text p { margin: 0 0 .9em; }
/* A long reading text (with »Læs hele teksten«) reads in a smaller size with space between the paragraphs
   (»Mindre skrift ved lange tekster«), so more of it fits beside or above the answers. */
.reading-passage[data-controller~="reading-view"] p, .task-stimulus[data-controller~="reading-view"] .guided-reading { font-size: clamp(1.05rem, .95rem + .5vw, 1.25rem); line-height: 1.6; }
.task-stimulus[data-controller~="reading-view"] .guided-reading p + p { margin-top: .6em; }

/* Tabel i opgaveteksten (søgetekst, 17.10.2026; prototype dansk-4-9/svarformer, fane Tabel): the first column
   stays put while the rest scrolls sideways; tabular figures; zebra rows on the light reading surface. */
.table-stimulus { margin: 0 0 12px; max-width: 46rem; color: var(--ink); }
.table-stimulus-body { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; }
.table-stimulus-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
.table-stimulus-scroll:focus-visible { outline: 3px solid #357eac; outline-offset: -3px; }
.table-stimulus-scroll table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 1rem; line-height: 1.3; font-variant-numeric: tabular-nums; }
.table-stimulus-caption { margin: 0; padding: 10px 12px 6px; font-weight: 750; line-height: 1.3; }
.table-stimulus-swipe { margin: -2px 0 0; padding: 0 12px 6px; font-size: .85rem; color: var(--muted); }
.table-stimulus-swipe[hidden] { display: none; }
.table-stimulus-scroll :is(th, td) { padding: 9px 12px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table-stimulus-scroll thead th { background: color-mix(in srgb, var(--lavender) 70%, var(--panel)); font-weight: 750; }
.table-stimulus-scroll tbody th { text-align: left; font-weight: 650; white-space: normal; min-width: 7.5rem; max-width: 11rem; }
.table-stimulus-scroll :is(thead, tbody) th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: var(--panel); box-shadow: 1px 0 0 var(--line); }
.table-stimulus-scroll thead th:first-child { background: color-mix(in srgb, var(--lavender) 70%, var(--panel)); }
.table-stimulus-scroll tbody tr:nth-child(even) :is(td, th) { background: color-mix(in srgb, var(--lavender) 30%, var(--panel)); }
.table-stimulus-notes { list-style: none; margin: 0; padding: 6px 12px 10px; display: grid; gap: 2px; font-size: .9rem; color: var(--muted); }
/* In full screen every column shows: cells wrap instead of scrolling sideways. */
.reading-dialog-text .table-stimulus-scroll table { font-size: 1rem; }
.reading-dialog-text .table-stimulus-scroll :is(th, td) { white-space: normal; padding: 8px 6px; overflow-wrap: anywhere; hyphens: auto; }
.reading-dialog-text .table-stimulus-scroll tbody th { min-width: 0; }

/* Tryk for at forstørre (user 09.11.2026 »1 er fin«; prototype lancering-ux/prototype-forstoer): the task's and the
   explanation's picture are a button with a magnifier (image_zoom_controller.js). The button is as wide as the picture,
   so the picture keeps its own size and height cap (one screen); the picture's bottom gap moves to the button. */
.image-zoom { position: relative; display: block; width: fit-content; max-width: 100%; margin: 0 auto; padding: 0; border: 0; border-radius: 14px;
  background: none; color: inherit; font: inherit; cursor: zoom-in; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.task-screen .task-panel .image-zoom > .task-image { margin-bottom: 0; }
.task-screen .task-stimulus > .image-zoom { margin-bottom: 8px; }
@media (min-width: 700px) and (orientation: landscape) {
  .task-panel.scratchpad-open .task-stimulus > .image-zoom { margin-bottom: 10px; }
  .task-panel.scratchpad-open:has(.scratchpad-figure) .task-body .image-zoom:has(> .task-image) { display: none; }
}
@media (min-width: 1000px) and (orientation: landscape) { .explanation-top .a-media .task-stimulus > .image-zoom { width: 100%; margin: 0; } }
.image-zoom:focus-visible { outline: 3px solid #357eac; outline-offset: 3px; }
.image-zoom-badge { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--line); background: rgb(255 253 248 / .94); color: var(--purple-dark); box-shadow: 0 2px 8px #30274433; pointer-events: none; }
.image-zoom-badge .luxi-icon { width: 20px; height: 20px; }
.image-zoom:active .image-zoom-badge { transform: scale(.94); }
dialog.image-zoom-dialog { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgb(16 12 24 / .92); color: #fff; overflow: hidden; }
dialog.image-zoom-dialog[open] { display: flex; flex-direction: column; }
dialog.image-zoom-dialog::backdrop { background: rgb(0 0 0 / .3); }
html:has(dialog.image-zoom-dialog[open]) { overflow: hidden; }
.image-zoom-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(8px, env(safe-area-inset-top)) 8px 8px 16px; }
.image-zoom-bar h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0; color: #fff; opacity: .9; }
.image-zoom-close { flex: none; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 2px solid rgb(255 255 255 / .55);
  background: rgb(255 255 255 / .12); color: #fff; cursor: pointer; }
.image-zoom-close svg { width: 22px; height: 22px; }
.image-zoom-close:focus-visible, .image-zoom-stage:focus-visible { outline: 3px solid #9fd3f5; outline-offset: 3px; }
.image-zoom-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: safe center; justify-content: center; padding: 0 12px 12px; overflow: auto;
  overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; }
.image-zoom-picture { display: block; width: 100%; max-width: 900px; height: auto; margin: auto; border-radius: 10px; background: #fffdf8; }
.image-zoom-hint { flex: none; margin: 0; padding: 0 16px max(10px, env(safe-area-inset-bottom)); text-align: center; font-size: 13px; color: rgb(255 255 255 / .75); }
@media (min-width: 700px) { .image-zoom-picture { width: auto; max-width: min(100%, 900px); max-height: calc(100dvh - 120px); } }
@media (prefers-reduced-motion: no-preference) { dialog.image-zoom-dialog[open] { animation: image-zoom-in .16s ease-out; } }
@keyframes image-zoom-in { from { opacity: 0; transform: scale(.98); } }
