/* LU-PRODUCT-03 — presentation only; load after the existing Maths styles. */
:root{color-scheme:light;background:#f8f5ed;color:#203e3a;font-family:system-ui,sans-serif;--math-ink:#203e3a;--math-teal:#14685b;--math-mint:#e7f3eb;--math-line:#cdded3}
body{background:radial-gradient(ellipse at top right,#dceee5 0,transparent 55%),#f8f5ed;min-height:100vh}
main{max-width:800px;margin:12px auto 28px}
a,.back{color:#205e53}.back{padding:8px 14px;border-radius:14px;background:#ffffffb8}
.hero{margin:20px auto 24px}.hero h1{color:var(--math-ink);letter-spacing:-.035em}.hero p{color:#4c625b;font-size:.95rem;max-width:38em}
.flag{background:#e2eee5;color:#285b4d;border:1px solid #c7daca}
.steps{gap:10px;grid-template-columns:repeat(auto-fit,minmax(100px,1fr))}
.step{border-color:var(--math-line);color:#52665e;background:#ffffffa6;border-radius:16px;padding:10px 6px}
.step.current{border-color:var(--math-teal);background:var(--math-mint);color:#174d42;box-shadow:0 3px 0 #b2d3c3}
.step.done{background:#eef5e5;border-color:#9bbf85;color:#355326}
.card{border:1px solid var(--math-line);border-radius:26px;background:#fffefa;box-shadow:0 12px 32px #234c3910;padding:clamp(18px,4vw,32px)}
.card h2{color:var(--math-ink)}.subtle{color:#53665f}
.progress{height:10px;background:#e4ece5;margin-top:18px}.progress span{background:#32816a}
.question-count{font-size:.85rem;color:#476457;margin-bottom:8px}
#prompt{line-height:1.35;margin:14px 0 20px}
#cue{background:#f1f6ef;border:1px solid #dce7d8;border-radius:20px;padding:12px;margin:0 auto 16px;max-width:520px}
#cue svg{display:block;max-width:100%;height:auto}
#choices{gap:12px}#choices button{min-height:58px;background:#fff;border:2px solid #afc9bb;color:var(--math-ink);border-radius:16px;box-shadow:0 3px 0 #dce7df;font-size:1.25rem}
#choices button:hover:not(:disabled){background:#eef6ef;border-color:#26735e}
#choices button.wrong{background:#fff3d9;border-color:#b88122;color:#66470e;box-shadow:none}
#choices button.correct{background:#dff0e1;border-color:#347947;color:#204e2d;box-shadow:0 3px 0 #b2cfb7}
#choices button:disabled{opacity:1}
.help-btn,.resume-secondary{border-color:#a9c3b5;color:#315b4c;background:#f7faf4;border-radius:14px}
.help-box{background:#fff2d6;border-left-color:#ba8b32;color:#58441e;line-height:1.6}
#feedback{color:#315b4c;margin:18px 0;line-height:1.5}
.next,.resume-primary{background:var(--math-teal);border:2px solid transparent;border-radius:16px;box-shadow:0 4px 0 #0d4c42;min-height:56px;color:#fff}
.next:hover:not(:disabled),.resume-primary:hover{background:#0e584c}
.next:disabled{background:#e1e8e1;color:#59695f;box-shadow:none;border-color:#d2dcd3}
.finish-list p{background:#edf4e7;color:#365329}.finish-actions a{background:#edf3eb;color:#315b4c;border:1px solid #bdcfbd}
button:focus-visible,a:focus-visible,#finish:focus-visible{outline:3px solid #203e3a;outline-offset:5px}
button,a{touch-action:manipulation}button{overflow-wrap:anywhere}footer{color:#59675e}
/* Explicit future presentation hooks; PRO supplies true mathematical groups. */
.math-collections{display:flex;flex-wrap:wrap;gap:12px;align-items:center;justify-content:center}
.math-collection{border:2px solid #abc8b6;border-radius:16px;padding:12px;background:#eff7eb}
.math-collection--removed{border-style:dashed;background:#fff1dd}
.math-collection--removed .math-token{text-decoration:line-through;text-decoration-thickness:3px}
/* Supports a host Aa+ class; native browser text enlargement remains usable. */
body.large-text{font-size:1.2rem}.large-text .subtle,.large-text .hero p,.large-text .step{font-size:1rem}
@media(max-width:420px){.hero{margin:14px auto 18px}.hero h1{font-size:1.65rem}.card{padding:18px 14px;border-radius:20px}#choices{grid-template-columns:repeat(2,minmax(0,1fr))}#choices button{padding:10px 6px}.steps{gap:6px}.step{padding:8px 4px}.resume-actions{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}

/* PRO contract #6600604838: native workshop controls, no state mutation. */
#workshops{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:20px 0}
#workshops button{min-height:60px;padding:14px;border:2px solid #afc9bb;background:#fffefa;color:#203e3a;border-radius:16px;font-weight:750}
#workshops button[aria-pressed="true"]{border-color:#14685b;background:#e7f3eb;box-shadow:0 3px 0 #b2d3c3}
#workshopTitle{color:#203e3a;line-height:1.25}#workshopDescription{color:#4c625b}
@media(max-width:420px){#workshops{grid-template-columns:1fr;gap:8px}}


/* PRO integration: retain the .61 160-CSS-px resume/zoom envelope. */
.card h2,#workshopTitle{overflow-wrap:anywhere}
@media(max-width:200px){.card{padding:10px}.hero #workshopTitle{font-size:1.35rem}.steps{grid-template-columns:minmax(0,1fr)}}

/* LU-UX-04: condense only while a question is visible. The DOM, tab order,
   workshop choices, progress, help and reading return remain available.
   Resume, workshop-selection and finish screens keep their generous layout. */
@supports selector(body:has(#journey:not([hidden]))) {
  body:has(#journey:not([hidden])) .hero{margin:6px auto 8px}
  body:has(#journey:not([hidden])) .hero .flag,
  body:has(#journey:not([hidden])) .hero > p:not(#workshopDescription){display:none}
  body:has(#journey:not([hidden])) .hero h1{font-size:clamp(1.2rem,3.3vw,1.55rem);margin:2px 0 4px}
  body:has(#journey:not([hidden])) .hero #workshopDescription{font-size:.88rem;line-height:1.3;margin:2px auto 6px}
  body:has(#journey:not([hidden])) #workshops{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:7px 0 10px}
  body:has(#journey:not([hidden])) #workshops button{min-width:0;min-height:48px;padding:6px 4px;font-size:.82rem;line-height:1.2;overflow-wrap:anywhere}
  body.large-text:has(#journey:not([hidden])) #workshops button{font-size:1rem}
  body:has(#journey:not([hidden])) .steps{gap:6px;margin:8px 0}
  body:has(#journey:not([hidden])) .step{padding:6px 3px}
  body:has(#journey:not([hidden])) .progress{margin-top:10px}
  body:has(#journey:not([hidden])) #prompt{margin:8px 0 10px}
  body:has(#journey:not([hidden])) #cue{margin:0 auto 9px;padding:9px}
  body:has(#journey:not([hidden])) #choices{margin:10px 0}
  @media(max-width:420px){
    body:has(#journey:not([hidden])) .card{padding:14px 12px}
    body:has(#journey:not([hidden])) #workshops{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
    body:has(#journey:not([hidden])) #workshops button{padding:6px 4px}
    body:has(#journey:not([hidden])) #workshops button[data-workshop="subtraction"]{grid-column:1/-1}
  }
  /* Keep the existing 160-CSS-px stress envelope: no tiny three-column grid. */
  @media(max-width:260px){
    body:has(#journey:not([hidden])) #workshops{grid-template-columns:minmax(0,1fr);gap:4px}
    body:has(#journey:not([hidden])) #workshops button{min-height:44px}
  }
  @media(max-width:200px){body:has(#journey:not([hidden])) .card{padding:10px}}
}

/* LU-UX-05 — #329 adds a fourth workshop. Compact questions must not leave
   an orphan button or preserve the full-width third button for a 3-item grid.
   This rule is inert for the three existing .63 workshops. */
@supports selector(body:has(#journey:not([hidden]))) {
  body:has(#journey:not([hidden])) #workshops:has([data-workshop="problems"]) {
    grid-template-columns:repeat(4,minmax(0,1fr));
  }
  @media(max-width:620px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="problems"]) {
      grid-template-columns:repeat(2,minmax(0,1fr));
    }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="problems"]) button[data-workshop="subtraction"] {
      grid-column:auto;
    }
  }
  /* Preserve the 160 CSS-px stress layout already supported by .63. */
  @media(max-width:260px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="problems"]) {
      grid-template-columns:minmax(0,1fr);
    }
  }
}

/* AP-MATH-TENS-05 — five native workshop controls. The dedicated tens
   practice stays readable without changing question DOM or tab order. */
@supports selector(body:has(#journey:not([hidden]))) {
  body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) {
    grid-template-columns:repeat(5,minmax(0,1fr));
  }
  @media(max-width:720px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) {
      grid-template-columns:repeat(2,minmax(0,1fr));
    }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button[data-workshop="problems"] {
      grid-column:1/-1;
    }
  }
  @media(max-width:260px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) {
      grid-template-columns:minmax(0,1fr);
    }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button[data-workshop="problems"] {
      grid-column:auto;
    }
  }
}

/* LU-UX-TENS-07 — active question only: five ateliers in compact 3+2 rows.
   Keep the native DOM/tab sequence and existing 160px / Aa+ fallbacks. */
@supports selector(body:has(#journey:not([hidden]))) {
  @media (min-width:261px) and (max-width:720px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) {
      grid-template-columns:repeat(6,minmax(0,1fr));
    }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button {
      grid-column:span 2;
    }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button[data-workshop="subtraction"],
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button[data-workshop="problems"] {
      grid-column:span 3;
    }
  }
  @media (min-width:261px) and (max-width:420px) {
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) { gap:4px; }
    body:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button { padding:4px 2px; }
  }
  @media (min-width:261px) and (max-width:359px) {
    body.large-text:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) {
      grid-template-columns:repeat(2,minmax(0,1fr));
    }
    body.large-text:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button { grid-column:auto; }
    body.large-text:has(#journey:not([hidden])) #workshops:has([data-workshop="tens"]) button[data-workshop="problems"] {
      grid-column:1/-1;
    }
  }
}

/* LU-UX-FEEDBACK-08 — visually distinguish retry from success without changing
   the live message, answer logic, or focus. In cp-preview.html, #next follows
   #feedback; #next remains disabled on retry and is enabled on success.
   Keep the initial empty status free of decorative boxes. */
/* Neutral fallback for engines without :has; never imply success for a retry. */
#feedback:not(:empty){
  padding:10px 14px;
  border:1px solid #c7cdd0;
  border-left:5px solid #687780;
  border-radius:14px;
  background:#f2f4f4;
  color:#29383e;
}
@supports selector(:has(*)) {
  #feedback:not(:empty):has(+ #next:not(:disabled)){
    border-color:#b7d2c0;
    border-left-color:#347947;
    background:#eaf6ec;
    color:#245537;
  }
  #feedback:not(:empty):has(+ #next:disabled){
    border-color:#dfc58c;
    border-left-color:#b88122;
    background:#fff3dc;
    color:#694a15;
  }
}
