/* ==========================================================================
   Exercise Workspace 3.0 — dedicated 4e exercise shell
   This stylesheet intentionally REPLACES the previous patch stack.
   Scope: #/exercise/4e-niveau1, 4e-niveau2, 4e-niveau3 only.
   ========================================================================== */

#app:has(.learning-workspace[data-learning-workspace="unified"]){
  --ew3-bg:#f4f7f9;
  --ew3-surface:#ffffff;
  --ew3-surface-2:#f8fafc;
  --ew3-navy:#163b5d;
  --ew3-navy-2:#0f2f4b;
  --ew3-blue:#2f6fed;
  --ew3-teal:#0a8b83;
  --ew3-teal-soft:#e8f7f5;
  --ew3-ink:#102f4d;
  --ew3-muted:#66798c;
  --ew3-line:#dce6ec;
  --ew3-line-2:#c8d7e1;
  --ew3-warn:#a86b00;
  --ew3-warn-soft:#fff8e9;
  --ew3-danger:#c94646;
  --ew3-radius:16px;
  --ew3-shadow:0 10px 30px rgba(16,47,77,.065);
  --ew3-shadow-lg:0 18px 50px rgba(16,47,77,.10);
}

/* ---------- Shell ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .s17{
  min-height:100dvh;
  background:var(--ew3-bg);
  color:var(--ew3-ink);
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-main{
  min-width:0;
  min-height:100dvh;
  background:var(--ew3-bg);
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-content{
  width:100%;
  max-width:1500px;
  margin:0 auto;
  padding:20px 24px 28px;
  gap:14px;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-workspace{
  width:100%;
  max-width:none;
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* ---------- Fixed left navigation ---------- */
@media(min-width:768px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17{
    display:block;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav{
    position:fixed!important;
    inset:0 auto 0 0!important;
    z-index:80;
    width:76px!important;
    height:100dvh!important;
    min-height:100dvh!important;
    padding:14px 10px!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    gap:8px!important;
    overflow:visible;
    background:linear-gradient(180deg,var(--ew3-navy) 0%,var(--ew3-navy-2) 100%)!important;
    color:#fff!important;
    border:0!important;
    box-shadow:8px 0 28px rgba(10,32,51,.10)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-main{
    width:calc(100% - 76px);
    margin-left:76px;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav .s17-brand{
    width:48px!important;
    height:48px!important;
    padding:0!important;
    margin:0 0 8px!important;
    display:grid!important;
    place-items:center!important;
    border-radius:14px!important;
    background:rgba(255,255,255,.10)!important;
    color:#fff!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-brand-mark{
    width:36px;height:36px;display:grid;place-items:center;
    border-radius:11px;background:linear-gradient(145deg,#20b8ad,#2f6fed);
    color:white;font-size:12px;font-weight:900;letter-spacing:.04em;
    box-shadow:0 7px 16px rgba(0,0,0,.17);
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-brand-copy,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-nav-caption{
    display:none;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav{
    width:100%!important;
    display:flex!important;
    flex-direction:column!important;
    gap:6px!important;
    flex:0 0 auto!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a{
    width:100%!important;
    height:48px!important;
    min-height:48px!important;
    padding:0!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:0!important;
    border-radius:12px!important;
    color:rgba(255,255,255,.74)!important;
    background:transparent!important;
    text-decoration:none!important;
    transition:background .16s ease,color .16s ease,transform .16s ease;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a:hover{
    color:#fff!important;background:rgba(255,255,255,.09)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a[aria-current="page"]{
    color:#fff!important;background:var(--ew3-blue)!important;
    box-shadow:0 8px 20px rgba(0,0,0,.16)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a span{
    position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a svg{
    width:21px!important;height:21px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-state{
    margin-top:auto!important;
    width:48px!important;min-width:48px!important;height:40px!important;
    padding:0!important;justify-content:center!important;
    border:1px solid rgba(167,255,242,.17)!important;
    background:rgba(25,186,163,.18)!important;color:#bafff5!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-state>span{
    position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account{
    width:48px!important;margin-top:2px!important;padding-top:10px!important;
    border-top:1px solid rgba(255,255,255,.15)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account .s17-account{
    width:48px!important;height:44px!important;padding:0!important;justify-content:center!important;
    border-radius:12px!important;background:rgba(255,255,255,.07)!important;color:#fff!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account .s17-account-label{display:none!important}
}
@media(min-width:1180px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav{
    width:224px!important;
    padding:18px 12px 14px!important;
    align-items:stretch!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-main{
    width:calc(100% - 224px);
    margin-left:224px;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav .s17-brand{
    width:auto!important;height:auto!important;min-height:58px!important;
    display:flex!important;align-items:center!important;justify-content:flex-start!important;
    gap:11px!important;padding:7px 8px 15px!important;margin:0!important;
    border-radius:0!important;background:transparent!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-brand-copy{
    display:flex;min-width:0;flex-direction:column;line-height:1.05;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-brand-copy b{
    font-size:11px;font-weight:650;color:rgba(255,255,255,.68);
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-brand-copy strong{
    margin-top:3px;font-size:15px;font-weight:850;color:#fff;white-space:nowrap;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-nav-caption{
    display:block;margin:10px 10px 4px;color:rgba(255,255,255,.48);
    font-size:10px;font-weight:850;letter-spacing:.10em;text-transform:uppercase;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a{
    height:47px!important;padding:0 12px!important;justify-content:flex-start!important;gap:11px!important;
    font-size:14px!important;font-weight:700!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav nav a span{
    position:static;width:auto;height:auto;overflow:visible;clip-path:none;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-state{
    width:auto!important;min-width:0!important;height:38px!important;
    justify-content:flex-start!important;gap:7px!important;padding:0 10px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-state>span{
    position:static;width:auto;height:auto;overflow:visible;clip-path:none;
    font-size:11px;font-weight:800;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account{width:auto!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account .s17-account{
    width:100%!important;justify-content:flex-start!important;gap:9px!important;padding:0 10px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-account .s17-account-label{
    display:inline!important;max-width:145px!important;color:#fff!important;font-size:12px!important;
  }
}

@media(max-width:767px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar{
    position:sticky!important;
    top:0!important;
    z-index:75!important;
    height:54px!important;
    background:#fff!important;
    color:var(--ew3-ink)!important;
    border-bottom:1px solid var(--ew3-line)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-back{color:var(--ew3-navy)!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-title{color:var(--ew3-ink)!important;font-weight:800!important}
}
/* ---------- Main question ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-card{
  margin:0!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-card>.ex-head{display:none!important}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ex-body{
  display:flex!important;flex-direction:column!important;gap:14px!important;padding:0!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard:not(.is-current){display:none!important}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard{
  margin:0!important;background:transparent!important;border:0!important;box-shadow:none!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-main{
  min-width:0!important;display:flex!important;flex-direction:column!important;gap:12px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-statement,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer{
  border:1px solid var(--ew3-line)!important;border-radius:var(--ew3-radius)!important;
  background:var(--ew3-surface)!important;box-shadow:var(--ew3-shadow)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-statement{
  padding:20px 22px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-label{
  margin:0 0 9px!important;display:flex!important;align-items:center!important;gap:8px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-meta{
  order:1!important;flex:1 1 auto!important;min-width:0!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-eyebrow{
  color:var(--ew3-muted)!important;font-size:11px!important;font-weight:900!important;
  letter-spacing:.07em!important;text-transform:uppercase!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-kind{
  order:2!important;padding:5px 9px!important;border-radius:999px!important;
  background:var(--ew3-teal-soft)!important;color:var(--ew3-teal)!important;
  font-size:10px!important;font-weight:850!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-prompt{
  margin:0 0 5px!important;color:var(--ew3-ink)!important;
  font-size:clamp(24px,2.1vw,31px)!important;line-height:1.16!important;font-weight:850!important;
  letter-spacing:-.025em!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-intro{
  margin:4px 0 0!important;color:var(--ew3-muted)!important;font-size:14px!important;line-height:1.5!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-problem{
  margin:13px 0 0!important;padding:11px 13px!important;border-radius:10px!important;
  background:#f5f8fa!important;color:var(--ew3-ink)!important;font-size:13px!important;line-height:1.55!important;
  white-space:pre-wrap!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .exercise-program.ew2-program{
  margin:15px 0 0!important;border:1px solid var(--ew3-line)!important;border-radius:12px!important;
  background:#f7f9fb!important;overflow:hidden!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .exercise-program.ew2-program small{
  display:block!important;padding:8px 12px!important;border-bottom:1px solid var(--ew3-line)!important;
  color:var(--ew3-ink)!important;font-size:11px!important;font-weight:850!important;text-transform:none!important;letter-spacing:0!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .exercise-program.ew2-program pre{
  margin:0!important;padding:13px 15px!important;border:0!important;border-radius:0!important;
  background:#fbfcfd!important;font-size:14px!important;line-height:1.62!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-data{
  margin-top:12px!important;border-radius:10px!important;
}

/* ---------- Answer surface ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer{
  padding:16px 18px 0!important;overflow:hidden!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer-label{
  margin:0 0 7px!important;color:var(--ew3-muted)!important;font-size:10px!important;
  font-weight:850!important;letter-spacing:.07em!important;text-transform:uppercase!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .qc-choice,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .ic-order>li,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .qc-order>li{
  min-height:48px!important;border:1px solid var(--ew3-line)!important;border-radius:11px!important;background:#fff!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .qc-choice:hover{
  background:#fbfefe!important;border-color:#a8c9cf!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .ic-tools{
  margin:10px 0 0!important;display:flex!important;gap:7px!important;flex-wrap:wrap!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .ic-tools .btn,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer .ic-tools button{
  min-height:44px!important;border-radius:9px!important;border-color:var(--ew3-line)!important;background:#fff!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-feedback{
  margin:8px 0 0!important;min-height:26px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions{
  margin:14px -18px 0!important;padding:11px 18px!important;
  display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;
  border-top:1px solid var(--ew3-line)!important;background:#fbfcfd!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions [data-verify]{
  flex:0 0 auto!important;width:auto!important;min-width:170px!important;min-height:46px!important;padding:0 22px!important;
  border:0!important;border-radius:11px!important;
  background:linear-gradient(135deg,var(--ew3-navy),#0e4c70)!important;color:#fff!important;
  font-weight:850!important;box-shadow:0 8px 18px rgba(22,59,93,.17)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions [data-verify]::after{
  content:"→";margin-inline-start:9px;font-size:16px;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions [data-verify]:hover{
  transform:translateY(-1px);box-shadow:0 11px 23px rgba(22,59,93,.22)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions .qcard-more{
  min-height:44px!important;border-radius:10px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ic-algolab [data-algolab-open]{
  min-height:50px!important;border-radius:11px!important;font-weight:850!important;
  box-shadow:0 8px 18px rgba(10,139,131,.14)!important;
}

/* ---------- Context rail: tabs, one surface at a time ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail{
  min-width:0!important;overflow:hidden!important;border:1px solid var(--ew3-line)!important;
  border-radius:var(--ew3-radius)!important;background:#fff!important;box-shadow:var(--ew3-shadow)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-tabs{
  display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:4px!important;
  padding:7px!important;border-bottom:1px solid var(--ew3-line)!important;background:#f7f9fb!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-tabs button{
  min-width:0!important;min-height:44px!important;padding:0 7px!important;border:0!important;border-radius:9px!important;
  background:transparent!important;color:var(--ew3-muted)!important;font:inherit!important;font-size:11px!important;font-weight:800!important;
  cursor:pointer!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-tabs button[aria-selected="true"]{
  background:#fff!important;color:var(--ew3-ink)!important;box-shadow:0 2px 8px rgba(16,47,77,.08)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail>[data-ew3-panel]{
  padding:16px!important;margin:0!important;border:0!important;background:#fff!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail>[data-ew3-panel][hidden]{display:none!important}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-relay-label,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .confidence-title{
  color:var(--ew3-ink)!important;font-size:12px!important;font-weight:850!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-how p:last-child,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .confidence-hint,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .confidence-wait{
  color:var(--ew3-muted)!important;font-size:12px!important;line-height:1.45!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .confidence-options{
  gap:6px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .confidence-options button{
  min-height:40px!important;border-radius:9px!important;border:1px solid var(--ew3-line)!important;background:#fff!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-help{
  width:100%!important;min-height:46px!important;justify-content:center!important;
  border:1px solid #c8e7e3!important;border-radius:10px!important;background:var(--ew3-teal-soft)!important;
  color:var(--ew3-teal)!important;font-weight:800!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail>[data-ew3-panel="aid"]:has(.s17-help-sheet)>.qcard-relay-list{
  display:none!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail>[data-ew3-panel="aid"]>.s17-help-sheet{
  margin:0!important;padding:0!important;background:#fff!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help{
  padding:0!important;gap:9px!important;border:0!important;background:transparent!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-head{
  min-height:42px!important;padding:0 2px 7px!important;border-bottom:1px solid var(--ew3-line)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-head h2{
  font-size:14px!important;color:var(--ew3-ink)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-head [data-help-close]{
  width:36px!important;height:36px!important;min-height:36px!important;padding:0!important;border-radius:9px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-item{
  padding:11px!important;gap:6px!important;border-radius:10px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-item p{
  font-size:12px!important;line-height:1.45!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-item.is-solution{
  min-height:45px!important;display:grid!important;grid-template-columns:20px minmax(0,1fr)!important;align-items:center!important;
  border:1px solid var(--ew3-line)!important;background:#f8fafb!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail .s17-help-item.is-solution>svg{
  width:20px!important;height:20px!important;
}

/* Desktop: true main + rail composition. */
@media(min-width:1180px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard:has(>.qcard-secondary){
    display:grid!important;grid-template-columns:minmax(0,1fr) 300px!important;grid-template-areas:"main rail"!important;
    gap:18px!important;align-items:start!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard:has(>.qcard-secondary)>.qcard-main{
    grid-area:main!important;min-width:0!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard:has(>.qcard-secondary)>.ew3-context-rail{
    grid-area:rail!important;display:block!important;position:sticky!important;top:172px!important;
    max-height:calc(100dvh - 190px)!important;overflow:auto!important;scrollbar-width:thin!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions .qcard-more{display:none!important}
}
/* Tablet: support becomes a compact tabbed panel below the answer. */
@media(min-width:768px) and (max-width:1179px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard:has(>.qcard-secondary){
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-areas:"main" "rail"!important;gap:12px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard:has(>.qcard-secondary)>.qcard-main{grid-area:main!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard:has(>.qcard-secondary)>.ew3-context-rail{
    grid-area:rail!important;display:block!important;position:static!important;max-height:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions .qcard-more{display:none!important}
}

/* ---------- Navigation dock ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-mode{display:none!important}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-bar{
  position:relative!important;bottom:auto!important;width:min(650px,100%)!important;max-width:none!important;
  align-self:center!important;margin:2px auto 0!important;padding:6px!important;
  border:1px solid var(--ew3-line)!important;border-radius:15px!important;background:#fff!important;
  box-shadow:0 10px 26px rgba(16,47,77,.055)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav{
  grid-template-columns:minmax(145px,1fr) 72px minmax(145px,1fr)!important;gap:7px!important;align-items:center!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav .btn{
  min-height:46px!important;padding:0 14px!important;border:1px solid var(--ew3-line)!important;border-radius:10px!important;
  background:#fff!important;color:var(--ew3-ink)!important;font-weight:800!important;box-shadow:none!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav .btn:hover{
  background:#f8fafb!important;border-color:#b9cad5!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav [data-stepper-next]{
  background:var(--ew3-navy)!important;color:#fff!important;border-color:var(--ew3-navy)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-position{
  min-height:38px!important;display:grid!important;place-items:center!important;padding:0 8px!important;border-radius:999px!important;
  background:var(--ew3-teal-soft)!important;color:var(--ew3-teal)!important;font-size:13px!important;font-weight:900!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-all{
  width:min(650px,100%)!important;max-width:none!important;align-self:center!important;margin:0 auto!important;
  border:1px solid var(--ew3-line)!important;border-radius:12px!important;background:#fff!important;box-shadow:none!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-all>summary{
  min-height:44px!important;padding:8px 12px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actprog-host{display:none!important}

/* ---------- Removed from the active exercise surface ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-all,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary{
  display:none!important;
}
/* ---------- Secondary resources: one compact closed hub ---------- */
#app:has(.learning-workspace[data-learning-workspace="unified"]) .recall-route-context{
  width:min(980px,100%);align-self:center;margin:8px auto;display:grid;gap:8px;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .recall-route-context .recall-prescription,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .recall-route-context .recall-scope{
  margin:0;padding:9px 11px;border-radius:9px;border:1px solid #cceae6;background:var(--ew3-teal-soft);
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .recall-route-context>p{margin:0}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary{
  width:min(980px,100%)!important;align-self:center!important;margin:6px auto 0!important;
  border:1px solid var(--ew3-line)!important;border-radius:13px!important;background:#fff!important;
  box-shadow:0 6px 18px rgba(16,47,77,.035)!important;overflow:hidden!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary>summary{
  min-height:52px!important;padding:8px 13px!important;display:flex!important;align-items:center!important;gap:12px!important;
  list-style:none!important;cursor:pointer!important;color:var(--ew3-ink)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary>summary::-webkit-details-marker{display:none!important}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary-title{
  display:inline-flex!important;align-items:center!important;gap:8px!important;font-size:13px!important;font-weight:850!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary-title svg{
  width:17px!important;height:17px!important;color:var(--ew3-teal)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary>summary small{
  margin-left:auto!important;color:var(--ew3-muted)!important;font-size:11px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary>summary::after{
  content:"⌄";color:var(--ew3-muted);font-size:17px;transition:transform .16s ease;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary[open]>summary::after{transform:rotate(180deg)}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary-body{
  display:grid!important;gap:9px!important;padding:10px 12px 12px!important;border-top:1px solid var(--ew3-line)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .s17-qhead-sync{
  margin:0!important;padding:0!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .learning-context,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .learning-extras{
  margin:0!important;gap:8px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .recall-prescription,
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .recall-scope{
  margin:0!important;padding:9px 11px!important;border-radius:9px!important;border:1px solid #cceae6!important;background:var(--ew3-teal-soft)!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary .learning-identity{
  margin:0!important;color:var(--ew3-muted)!important;font-size:11px!important;
}
#app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-footer{
  display:none!important;
}

/* ---------- Desktop/tablet task action bar is not duplicated ---------- */
@media(min-width:768px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar{display:none!important}
}

/* ---------- Mobile ---------- */
@media(max-width:767px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-content{
    padding:8px 8px 88px!important;gap:8px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-header-dock{
    position:sticky!important;top:0!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-header-dock .s17-task-header{display:none!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar{
    position:sticky!important;top:0!important;z-index:75!important;
    height:54px!important;background:#fff!important;color:var(--ew3-ink)!important;border-bottom:1px solid var(--ew3-line)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-back{color:var(--ew3-navy)!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-title{color:var(--ew3-ink)!important;font-weight:800!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-header-dock .ux-session-bar{
    margin:7px 8px 0!important;padding:7px 9px!important;min-height:42px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-session-bar .ux-session-timer{display:none!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-header-dock .s17-qhead{
    padding:6px 10px 8px!important;min-height:44px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-statement{
    padding:15px!important;border-radius:14px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer{
    padding:14px 14px 0!important;border-radius:14px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-prompt{
    font-size:22px!important;line-height:1.18!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions{
    margin:12px -14px 0!important;padding:10px 14px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions [data-verify]{
    width:100%!important;min-width:0!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-bar{
    width:100%!important;padding:5px!important;border-radius:13px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav{
    grid-template-columns:minmax(44px,1fr) 60px minmax(44px,1fr)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav .btn{
    min-height:44px!important;padding:0 7px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-all{width:100%!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary{width:100%!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary>summary small{display:none!important}
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar{
    position:fixed!important;left:0!important;right:0!important;bottom:0!important;z-index:90!important;
    display:flex!important;gap:6px!important;padding:7px 8px calc(7px + env(safe-area-inset-bottom,0px))!important;
    background:rgba(255,255,255,.98)!important;border-top:1px solid var(--ew3-line)!important;
    box-shadow:0 -8px 24px rgba(16,47,77,.08)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec{
    flex:0 0 76px!important;height:50px!important;min-height:50px!important;border-radius:11px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec[data-bar-help]{
    background:var(--ew3-warn-soft)!important;color:var(--ew3-warn)!important;border-color:#f0dfba!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec[data-bar-confidence]{
    background:var(--ew3-teal-soft)!important;color:var(--ew3-teal)!important;border-color:#cceae6!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-primary{
    height:50px!important;min-height:50px!important;border-radius:11px!important;background:var(--ew3-navy)!important;
  }
}

#app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary{display:none!important}


/* ==========================================================================
   Unified Mobile Workspace 1.0
   A genuine mobile layout for every supported 3e/4e recall and exercise series.
   ========================================================================== */
@media(max-width:767px){
  body:has(#app .learning-workspace[data-learning-workspace="unified"]){
    overflow-x:hidden!important;
    background:var(--ew3-bg,#f4f7f9)!important;
  }

  #app:has(.learning-workspace[data-learning-workspace="unified"]),
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-main,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-content,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-workspace,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-card,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ex-body,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-main,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-statement,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
  }

  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17{
    display:block!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-main{
    margin:0!important;
    width:100%!important;
    min-height:100dvh!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-wide-nav{
    display:none!important;
  }

  /* Mobile app bar: one compact row, always readable. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar{
    position:sticky!important;
    top:0!important;
    z-index:120!important;
    display:flex!important;
    height:54px!important;
    min-height:54px!important;
    padding:5px 8px!important;
    gap:6px!important;
    background:rgba(255,255,255,.98)!important;
    color:var(--ew3-ink)!important;
    border-bottom:1px solid var(--ew3-line)!important;
    box-shadow:0 3px 14px rgba(16,47,77,.06)!important;
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
    overflow:hidden!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-back{
    flex:0 0 42px!important;
    width:42px!important;
    height:42px!important;
    min-height:42px!important;
    margin:0!important;
    border-radius:10px!important;
    color:var(--ew3-navy)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-title{
    flex:1 1 auto!important;
    min-width:0!important;
    margin:0!important;
    color:var(--ew3-ink)!important;
    font-size:13px!important;
    line-height:17px!important;
    font-weight:850!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-state{
    display:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-account{
    flex:0 0 auto!important;
  }

  /* Content starts naturally below the two sticky bars; no desktop compensation. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-content{
    padding:10px 8px calc(86px + env(safe-area-inset-bottom,0px))!important;
    margin:0!important;
    gap:9px!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .learning-workspace{
    gap:9px!important;
    overflow:visible!important;
  }

  /* One current question only. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard:not(.is-current){
    display:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .answer-card.qcard.is-current{
    display:block!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-main{
    display:flex!important;
    flex-direction:column!important;
    gap:8px!important;
  }

  /* Statement card */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-statement{
    padding:13px!important;
    border-radius:13px!important;
    box-shadow:0 4px 16px rgba(16,47,77,.045)!important;
    overflow:hidden!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-label{
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    gap:6px!important;
    margin:0 0 8px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-meta{
    flex:1 1 180px!important;
    min-width:0!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-eyebrow{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:9px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-kind{
    flex:0 1 auto!important;
    max-width:100%!important;
    font-size:9px!important;
    line-height:15px!important;
    white-space:normal!important;
    text-align:center!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-prompt{
    margin:0 0 6px!important;
    font-size:20px!important;
    line-height:1.2!important;
    letter-spacing:-.018em!important;
    overflow-wrap:anywhere!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-intro,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-problem{
    font-size:12px!important;
    line-height:1.48!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew2-problem{
    margin-top:9px!important;
    padding:9px 10px!important;
  }

  /* Code and long statements scroll locally, never the whole page. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) pre,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) code,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ic-expression,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ic-code-scroll{
    max-width:100%!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .exercise-program.ew2-program{
    margin-top:10px!important;
    max-width:100%!important;
    overflow:hidden!important;
    border-radius:10px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .exercise-program.ew2-program pre,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-data{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    white-space:pre!important;
    padding:11px!important;
    font-size:12px!important;
    line-height:1.55!important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-inline:contain;
  }

  /* Answer card */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer{
    padding:12px 12px 0!important;
    border-radius:13px!important;
    overflow:hidden!important;
    box-shadow:0 4px 16px rgba(16,47,77,.04)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-answer-label{
    margin-bottom:7px!important;
    font-size:9px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction{
    margin:8px 0!important;
    font-size:15px!important;
    line-height:1.45!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .qc-choices{
    gap:7px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .qc-choice.ic-choice{
    min-height:50px!important;
    padding:9px 10px!important;
    gap:8px!important;
    border-radius:11px!important;
    font-size:15px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .ic-choice-content{
    overflow-wrap:anywhere!important;
  }

  /* Complex controls are contained. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .qc-sort-zones{
    grid-template-columns:minmax(0,1fr)!important;
    gap:8px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .ic-sort-group{
    padding:9px!important;
    border-radius:11px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .ic-order-line{
    gap:7px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction .ic-row-tools{
    flex-wrap:wrap!important;
    gap:6px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-interaction :is(table,.ic-table,.study-table){
    max-width:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) :is(.study-table-wrap,.table-wrap,.ic-table-wrap,.trace-table-wrap){
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
    overscroll-behavior-inline:contain;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) input,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) textarea,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) select{
    max-width:100%!important;
    box-sizing:border-box!important;
  }

  /* Inline desktop verify/footer is removed on mobile: the bottom action dock is the only primary action. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions{
    margin:10px -12px 0!important;
    padding:9px 12px!important;
    min-height:0!important;
    background:#fbfcfd!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions [data-verify]{
    display:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions .qcard-more{
    width:100%!important;
    min-height:42px!important;
    display:flex!important;
    justify-content:center!important;
  }

  /* Desktop contextual rail never sits beside the content on mobile. It is opened as a drawer. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-context-rail{
    display:none!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs){
    z-index:150!important;
    background:rgba(9,28,45,.42)!important;
    align-items:flex-end!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs) .ux-qdrawer{
    width:100%!important;
    max-width:none!important;
    max-height:min(78dvh,640px)!important;
    border-radius:18px 18px 0 0!important;
    box-shadow:0 -16px 40px rgba(9,28,45,.18)!important;
    animation:none!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs) .ux-drawer-head{
    min-height:52px!important;
    padding:8px 12px!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs) .ux-drawer-body{
    padding:0 10px calc(12px + env(safe-area-inset-bottom,0px))!important;
    overflow:auto!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs) .ew3-context-rail{
    display:block!important;
    border:0!important;
    box-shadow:none!important;
    border-radius:0!important;
  }
  .ux-qdrawer-backdrop:has(.ew3-context-tabs) .ew3-context-tabs{
    position:sticky!important;
    top:0!important;
    z-index:2!important;
    background:#f7f9fb!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-bar{
    position:static!important;
    width:100%!important;
    margin:0!important;
    padding:4px!important;
    border-radius:12px!important;
    box-shadow:0 4px 14px rgba(16,47,77,.04)!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav{
    grid-template-columns:minmax(44px,1fr) 54px minmax(44px,1fr)!important;
    gap:5px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-nav .btn{
    min-width:0!important;
    min-height:42px!important;
    padding:0 6px!important;
    border-radius:9px!important;
    font-size:12px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-position{
    min-width:0!important;
    min-height:36px!important;
    padding:0 5px!important;
    font-size:12px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ux-stepper-all,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-secondary{
    display:none!important;
  }

  /* One fixed bottom action dock, sized for thumb use. */
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar{
    position:fixed!important;
    left:0!important;
    right:0!important;
    bottom:0!important;
    z-index:140!important;
    display:grid!important;
    grid-template-columns:66px 82px minmax(0,1fr)!important;
    gap:6px!important;
    min-height:66px!important;
    padding:7px 8px calc(7px + env(safe-area-inset-bottom,0px))!important;
    background:rgba(255,255,255,.985)!important;
    border-top:1px solid var(--ew3-line)!important;
    box-shadow:0 -10px 28px rgba(16,47,77,.10)!important;
    backdrop-filter:blur(12px);
    -webkit-backdrop-filter:blur(12px);
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-primary{
    width:100%!important;
    min-width:0!important;
    height:50px!important;
    min-height:50px!important;
    margin:0!important;
    padding:0 5px!important;
    border-radius:11px!important;
    font-size:11px!important;
    line-height:1.1!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec{
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:2px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec svg{
    width:17px!important;
    height:17px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec[data-bar-help]{
    background:var(--ew3-warn-soft)!important;
    color:var(--ew3-warn)!important;
    border-color:#f0dfba!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-sec[data-bar-confidence]{
    background:var(--ew3-teal-soft)!important;
    color:var(--ew3-teal)!important;
    border-color:#cceae6!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar-primary{
    background:var(--ew3-navy)!important;
    color:#fff!important;
    font-weight:850!important;
    border:0!important;
  }

  #app:has(.learning-workspace[data-learning-workspace="unified"]) .pki-footer{
    display:none!important;
  }
}

@media(max-width:359px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .qcard-prompt{
    font-size:19px!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-actionbar{
    grid-template-columns:60px 74px minmax(0,1fr)!important;
  }
}
@media(max-width:767px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .ew3-answer-actions{
    display:none!important;
  }
}


@media(max-width:767px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    height:54px!important;
    min-height:54px!important;
    padding:5px 8px!important;
    overflow:visible!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-title,
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-state{
    display:none!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-back{
    flex:0 0 42px!important;
    width:42px!important;
    height:42px!important;
    min-height:42px!important;
    margin:0!important;
  }
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-account{
    flex:0 0 42px!important;
    width:42px!important;
  }
}

/* ==========================================================================
   Mobile contextual sheets 2.0 — unified 3e/4e recalls and exercise series
   Dedicated, compact surfaces for Aide and Confiance.
   ========================================================================== */
@media(max-width:767px){
  /* Generic question drawer becomes a true bottom sheet instead of a full-height panel. */
  .ew3-mobile-context-sheet.ux-qdrawer-backdrop{
    z-index:170!important;
    align-items:flex-end!important;
    justify-content:center!important;
    padding:0!important;
    background:rgba(11,31,49,.48)!important;
  }
  .ew3-mobile-context-sheet .ux-qdrawer{
    position:relative!important;
    width:100%!important;
    max-width:none!important;
    height:auto!important;
    min-height:0!important;
    max-height:min(74dvh,620px)!important;
    margin:0!important;
    overflow:hidden!important;
    border-radius:22px 22px 0 0!important;
    background:#fff!important;
    box-shadow:0 -18px 48px rgba(8,28,45,.20)!important;
    animation:none!important;
  }
  .ew3-mobile-context-sheet .ux-qdrawer::before{
    content:""!important;
    position:absolute!important;
    top:7px!important;
    left:50%!important;
    width:40px!important;
    height:4px!important;
    transform:translateX(-50%)!important;
    border-radius:999px!important;
    background:#d6e0e7!important;
    z-index:3!important;
  }
  .ew3-mobile-context-sheet .ux-drawer-head{
    position:sticky!important;
    top:0!important;
    z-index:4!important;
    min-height:58px!important;
    padding:17px 14px 10px!important;
    gap:10px!important;
    background:rgba(255,255,255,.985)!important;
    border-bottom:1px solid var(--ew3-line)!important;
  }
  .ew3-mobile-context-sheet .ux-drawer-head h2{
    margin:0!important;
    color:var(--ew3-ink)!important;
    font-size:18px!important;
    line-height:1.25!important;
    font-weight:850!important;
    letter-spacing:-.01em!important;
  }
  .ew3-mobile-context-sheet .ux-drawer-head [data-ux-drawer-close]{
    width:40px!important;
    min-width:40px!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    border-radius:10px!important;
    color:var(--ew3-muted)!important;
    background:transparent!important;
    border-color:transparent!important;
  }
  .ew3-mobile-context-sheet .ux-drawer-body{
    flex:0 1 auto!important;
    min-height:0!important;
    max-height:calc(min(74dvh,620px) - 58px)!important;
    padding:12px 14px calc(18px + env(safe-area-inset-bottom,0px))!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    overscroll-behavior:contain!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* No unrelated response tools or all-purpose tabs inside focused sheets. */
  .ew3-mobile-context-sheet .qcard-relay,
  .ew3-mobile-context-sheet .ew3-context-tabs{
    display:none!important;
  }
  .ew3-mobile-context-sheet .ew3-context-rail{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:visible!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="guide"] [data-ew3-panel]:not([data-ew3-panel="guide"]),
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] [data-ew3-panel]:not([data-ew3-panel="confidence"]),
  .ew3-mobile-context-sheet[data-ew3-focus="aid"] [data-ew3-panel]:not([data-ew3-panel="aid"]){
    display:none!important;
  }
  .ew3-mobile-context-sheet .ew3-context-rail>[data-ew3-panel]{
    display:block!important;
    padding:0!important;
    margin:0!important;
    border:0!important;
    background:transparent!important;
  }

  /* Confidence = one focused form, no Guide/Aide content mixed in. */
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-box{
    display:grid!important;
    gap:12px!important;
    margin:0!important;
    padding:0!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-head{
    display:grid!important;
    gap:5px!important;
    margin:0!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-label{
    display:grid!important;
    gap:3px!important;
    margin:0!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-title{
    color:var(--ew3-ink)!important;
    font-size:15px!important;
    line-height:1.3!important;
    font-weight:850!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-hint{
    margin:0!important;
    color:var(--ew3-muted)!important;
    font-size:11px!important;
    line-height:1.35!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-wait{
    margin:2px 0 0!important;
    padding:9px 10px!important;
    border-radius:10px!important;
    background:#f4f7f9!important;
    color:var(--ew3-muted)!important;
    font-size:12px!important;
    line-height:1.4!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-options{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-options button{
    width:100%!important;
    min-width:0!important;
    min-height:48px!important;
    padding:7px 8px!important;
    border:1px solid var(--ew3-line)!important;
    border-radius:11px!important;
    background:#fff!important;
    color:var(--ew3-ink)!important;
    font-size:13px!important;
    line-height:1.2!important;
    font-weight:750!important;
    box-shadow:none!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-options button[aria-pressed="true"]{
    border-color:#69bdb6!important;
    background:var(--ew3-teal-soft)!important;
    color:var(--ew3-teal)!important;
    box-shadow:inset 0 0 0 1px rgba(10,139,131,.15)!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-options button:disabled{
    opacity:.58!important;
    background:#f8fafb!important;
    color:#758596!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-strategy-open{
    display:grid!important;
    gap:8px!important;
    margin-top:2px!important;
    padding-top:12px!important;
    border-top:1px solid var(--ew3-line)!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="confidence"] .confidence-subtitle{
    margin:0!important;
    color:var(--ew3-ink)!important;
    font-size:14px!important;
    line-height:1.3!important;
    font-weight:850!important;
  }

  /* Aide = help cards only. Trigger button disappears once the help content is mounted. */
  .ew3-mobile-context-sheet[data-ew3-focus="aid"] [data-ew3-panel="aid"]>.qcard-relay-list{
    display:none!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="aid"] [data-ew3-panel="aid"]>.s17-help-sheet{
    position:static!important;
    inset:auto!important;
    z-index:auto!important;
    display:block!important;
    width:100%!important;
    margin:0!important;
    padding:0!important;
    background:transparent!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="aid"] .s17-help-sheet>.s17-help{
    width:100%!important;
    max-width:none!important;
    max-height:none!important;
    overflow:visible!important;
    margin:0!important;
    padding:0!important;
    gap:10px!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }
  .ew3-mobile-context-sheet[data-ew3-focus="aid"] .s17-help-head{
    display:none!important;
  }

  /* Shared compact Help cards, also used by fallback standalone help sheets. */
  .ew3-mobile-context-sheet .s17-help-item,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item{
    gap:5px!important;
    padding:12px!important;
    border-radius:12px!important;
  }
  .ew3-mobile-context-sheet .s17-help-title,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-title{
    gap:7px!important;
    font-size:14px!important;
    line-height:20px!important;
    font-weight:850!important;
  }
  .ew3-mobile-context-sheet .s17-help-title svg,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-title svg{
    width:18px!important;
    height:18px!important;
    flex:0 0 18px!important;
  }
  .ew3-mobile-context-sheet .s17-help-item p,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item p{
    margin:0!important;
    font-size:13px!important;
    line-height:1.42!important;
  }
  .ew3-mobile-context-sheet .s17-help-cost,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-cost{
    color:var(--ew3-muted)!important;
    font-size:11px!important;
    line-height:1.35!important;
  }
  .ew3-mobile-context-sheet .s17-help-item .s17-btn,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item .s17-btn{
    width:auto!important;
    min-height:42px!important;
    padding:7px 12px!important;
    border-radius:10px!important;
    font-size:13px!important;
    font-weight:800!important;
  }
  .ew3-mobile-context-sheet .s17-help-item.is-solution,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item.is-solution{
    display:grid!important;
    grid-template-columns:20px minmax(0,1fr)!important;
    align-items:center!important;
    gap:8px!important;
    min-height:46px!important;
    padding:10px 12px!important;
    background:#f8fafb!important;
  }
  .ew3-mobile-context-sheet .s17-help-item.is-solution>svg,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item.is-solution>svg{
    width:20px!important;
    height:20px!important;
    min-width:20px!important;
    max-width:20px!important;
    flex:0 0 20px!important;
  }
  .ew3-mobile-context-sheet .s17-help-item.is-solution .s17-help-cost,
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-item.is-solution .s17-help-cost{
    grid-column:2!important;
    align-self:center!important;
    font-size:12px!important;
  }

  /* Fallback direct help overlay: professional bottom sheet, never a giant full-height panel. */
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet{
    z-index:175!important;
    display:flex!important;
    align-items:flex-end!important;
    justify-content:center!important;
    padding:0!important;
    background:rgba(11,31,49,.48)!important;
  }
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet>.s17-help{
    width:100%!important;
    max-width:none!important;
    max-height:min(74dvh,620px)!important;
    margin:0!important;
    padding:16px 14px calc(18px + env(safe-area-inset-bottom,0px))!important;
    gap:10px!important;
    overflow-y:auto!important;
    border:0!important;
    border-radius:22px 22px 0 0!important;
    background:#fff!important;
    box-shadow:0 -18px 48px rgba(8,28,45,.20)!important;
  }
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-head{
    position:sticky!important;
    top:-16px!important;
    z-index:3!important;
    min-height:48px!important;
    margin:-4px 0 2px!important;
    padding:4px 0 10px!important;
    background:#fff!important;
    border-bottom:1px solid var(--ew3-line)!important;
  }
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-head h2{
    font-size:18px!important;
    line-height:1.25!important;
    font-weight:850!important;
  }
  body:has(.learning-workspace[data-learning-workspace="unified"])>.s17-help-sheet .s17-help-head [data-help-close]{
    width:40px!important;
    height:40px!important;
    min-height:40px!important;
    padding:0!important;
    border-radius:10px!important;
  }
}

/* The mobile account control remains available when the shared header takes its slot. */
@media(max-width:767px){
  #app:has(.learning-workspace[data-learning-workspace="unified"]) .s17-appbar-account{
    flex:0 0 36px!important;
    width:36px!important;
    min-width:36px!important;
  }
}
