/* PéPi styling for the legacy practice library. This layer changes presentation
   only; app-runtime.js remains responsible for routing, progress and access. */
html.pepi-workspace-active .pepi-ws-app-slot #app {
  --surface-page:#fbf8f1;
  --surface-card:#fffdf8;
  --surface-raised:#f5f0e6;
  --border:#e3dccf;
  --border-strong:#b7aa8c;
  --fg:#28231d;
  --fg-dim:#746c60;
  --fg-faint:#81796d;
  --accent:#8d6c18;
  --accent-strong:#785a10;
  --accent-soft:#f3ead5;
  --raspberry:#8d6c18;
  --knowledge:#746c60;
  background:transparent;
  color:var(--fg);
}

html.pepi-workspace-active .pepi-ws-app-slot #app .screen {
  padding:clamp(18px,2.4vw,34px);
  border:1px solid var(--border);
  border-radius:24px;
  background:var(--surface-card);
  box-shadow:0 10px 34px rgba(73,58,30,.045);
}
html.pepi-workspace-active .pepi-ws-app-slot #app .screen > :is(.eyebrow,.screen-title,.screen-sub),
html.pepi-workspace-active .pepi-ws-app-slot #app .screen > header {
  max-width:76ch;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .screen > .eyebrow {
  color:var(--accent-strong);
  font-size:max(12px,var(--pepi-mobile-type-min,0px));
  letter-spacing:.1em;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .screen-title {
  font-size:clamp(25px,3vw,38px);
  line-height:1.22;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .screen-sub {
  font-size:max(15px,var(--pepi-mobile-type-min,0px));
  line-height:1.7;
}

/* The small global toolbar keeps its original actions and state handlers. */
html.pepi-workspace-active .pepi-ws-app-slot #app .fl-toolbar {
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin:0 0 18px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--surface-raised);
  box-shadow:none;
}
/* PéPi already has one clear return path through the brand/menu. Keep the
   practice save, review, saved-page and help actions in this strip, while
   removing the duplicated legacy return-to-learning control. */
html.pepi-workspace-active .pepi-ws-app-slot #app .fl-toolbar [data-fkd-my-fke],
html.pepi-workspace-active .pepi-ws-app-slot #app .fl-toolbar [data-learning-go="learning"] { display:none!important; }
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.btn,.chip,.vmode-btn,.tense-about-link,.related-chip) {
  transition:background-color .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.btn-primary,#quickTestStart,#recallCheck,#practiceCheckAll,#dtDiscRandom) {
  min-height:44px;
  padding:10px 18px;
  border:1px solid #8d6c18;
  border-radius:999px;
  background:#8d6c18;
  color:#fffdf8;
  font-weight:700;
  box-shadow:0 3px 8px rgba(93,67,8,.12);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.btn-secondary,.chip,.vmode-btn,.tense-about-link) {
  border-color:var(--border-strong);
  border-radius:999px;
  background:var(--surface-card);
  color:var(--fg);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.chip-active,.chip[aria-pressed="true"],.vmode-btn.active) {
  border-color:var(--accent);
  background:var(--accent-soft);
  color:var(--accent-strong);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(input,select,textarea,.search-input,.retrieval-input,.cell-input,.cloze-input) {
  border-color:var(--border-strong);
  border-radius:13px;
  background:var(--surface-card);
  color:var(--fg);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(input,select,textarea)::placeholder { color:#8d8579; opacity:1; }

/* Practice and library surfaces */
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.fl-card,.oc-practice-panel,.session-summary,.peek-box,.color-key,.reading-card,.sentence-card,.fkd-membership,.practice-intro,.review-panel,.dt-scene,.dt-arc,.dt-message-card,.dt-notice-card,.dt-help-block,.dt-selfassess,.dt-intro-topic) {
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--surface-card);
  box-shadow:0 5px 20px rgba(73,58,30,.035);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.fl-card,.oc-practice-panel,.session-summary,.peek-box,.review-panel,.dt-scene,.dt-arc,.dt-message-card,.dt-notice-card,.dt-help-block,.dt-selfassess) { padding:clamp(16px,2vw,24px); }
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.connector-row,.dt-list-row,.sentence-card,.reading-card) {
  border-color:var(--border);
  border-radius:16px;
  background:var(--surface-card);
  color:var(--fg);
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.connector-row,.dt-list-row):hover {
  border-color:#c9b579;
  background:#fbf6e9;
}
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.connector-expr,.dt-list-title,.dt-scene-task,.dt-move-label,.dt-message-subject,.dt-notice-title) { color:var(--fg); }
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.connector-meaning,.dt-list-sub,.dt-scene-sub,.dt-move-desc,.dt-message-body,.dt-notice-body,.dt-selfassess-prompt) {
  color:var(--fg-dim);
  line-height:1.7;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-eyebrow,
html.pepi-workspace-active .pepi-ws-app-slot #app :is(.dt-kind-tag,.dt-move-tag,.tag) {
  color:var(--accent-strong);
  border-color:#e4d4aa;
  background:#f7f0df;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .related-group {
  margin:12px 0;
  padding:0 16px 12px;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--surface-card);
}
html.pepi-workspace-active .pepi-ws-app-slot #app .related-group > summary {
  padding:16px 2px;
  color:var(--fg);
  font-weight:700;
  cursor:pointer;
}
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-progress-track { overflow:hidden; border-radius:999px; background:#eee7d9; }
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-progress-fill { border-radius:inherit; background:#a98731; }
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-selfassess { display:flex; flex-wrap:wrap; gap:10px; }
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-selfassess-prompt { flex-basis:100%; font-weight:650; }
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-sa-btn {
  min-height:42px;
  padding:9px 14px;
  border:1px solid var(--border-strong);
  border-radius:999px;
  background:var(--surface-raised);
  color:var(--fg);
}
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-sa-btn.chosen { border-color:var(--accent); background:var(--accent-soft); color:var(--accent-strong); }
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-required-answers,
html.pepi-workspace-active .pepi-ws-app-slot #app .retrieval-row,
html.pepi-workspace-active .pepi-ws-app-slot #app .dt-move { border-color:var(--border); }

html.pepi-workspace-active .pepi-ws-app-slot #app :is(.matrix th,.matrix td) { border-color:var(--border); }
html.pepi-workspace-active .pepi-ws-app-slot #app .matrix thead th { background:var(--surface-raised); color:var(--fg-dim); }
html.pepi-workspace-active .pepi-ws-app-slot #app .matrix tbody td { color:var(--fg); }
html.pepi-workspace-active .pepi-ws-app-slot #app :is(a,button):focus-visible { outline:3px solid #d6b65c; outline-offset:3px; }
html.pepi-workspace-active .pepi-ws-app-slot #app .explorer-full-practice { display:inline-flex; align-items:center; justify-content:center; margin:10px 0 18px; border:1px solid var(--accent); border-radius:999px; padding:13px 20px; color:var(--accent-strong); background:var(--surface-raised); text-decoration:none; font-weight:650; }
html.pepi-workspace-active .pepi-ws-app-slot #app .explorer-full-practice-note { margin:24px 0 4px; color:var(--fg-dim); }
html.pepi-workspace-active .pepi-ws-sidebar .nav-group-label.practice { color:#785a10; }
html.pepi-workspace-active .pepi-ws-sidebar .nav-group-label.decide { color:#785a10; }
html.pepi-workspace-active .pepi-ws-sidebar :is(.nav-group.active,.nav-item.active) { border-color:#d5c08a!important; background:#f5ecd4!important; color:#76590f!important; box-shadow:inset 0 0 0 1px #d5c08a!important; }

html[data-theme="dark"].pepi-workspace-active .pepi-ws-app-slot #app {
  --surface-page:#f6f0e3;
  --surface-card:#fffaf0;
  --surface-raised:#efe6d3;
  --border:#d8cdb7;
  --border-strong:#a99a7a;
  --fg:#28231d;
  --fg-dim:#6f675b;
  --fg-faint:#7d756a;
  --accent:#806014;
  --accent-strong:#73550d;
  --accent-soft:#eee1c1;
  color-scheme:light;
}
html[data-theme="dark"].pepi-workspace-active .pepi-ws-app-slot #app :is(.screen,.fl-toolbar,.fl-card,.oc-practice-panel,.connector-row,.dt-list-row,.dt-scene,.dt-arc,.dt-message-card,.dt-notice-card,.dt-help-block,.dt-selfassess,.related-group) { background:#fffaf0; color:#28231d; }

@media(max-width:720px) {
  html.pepi-workspace-active .pepi-ws-app-slot #app .screen { padding:17px 14px; border-radius:18px; }
  html.pepi-workspace-active .pepi-ws-app-slot #app .fl-toolbar { gap:6px; padding:8px; }
  html.pepi-workspace-active .pepi-ws-app-slot #app :is(.dt-selfassess,.chip-row) { gap:8px; }
  html.pepi-workspace-active .pepi-ws-app-slot #app .dt-sa-btn { flex:1 1 100%; justify-content:center; }
  html.pepi-workspace-active .pepi-ws-app-slot #app .dt-intro-topic-grid { grid-template-columns:minmax(0,1fr); }
}

html.pepi-workspace-active #app #screen-discourse.pepi-discourse-lesson #discourseTitle {
  max-width:34ch;
  font-size:clamp(24px,3.4vw,36px);
  text-wrap:balance;
}
#screen-discourse.pepi-discourse-lesson #discourseSub:empty { display:none; }
html.pepi-workspace-active #app #discourseDetail [data-disc-back] {
  width:fit-content;
  min-height:36px;
  margin:0 0 12px;
  padding:4px 0;
  border:0;
  background:transparent;
  box-shadow:none;
  color:var(--fg-dim);
  text-decoration:underline;
  text-underline-offset:3px;
}
#discourseDetail .dt-response-plan {
  margin:16px 0;
  padding:12px clamp(12px,2vw,20px) 16px;
  border:1px solid #bed1c8;
  border-radius:16px;
  background:#eff5f0;
  color:#263f34;
}
#discourseDetail .dt-response-plan h2 {
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 0 6px;
  font-size:1.1rem;
  line-height:1.4;
}
#discourseDetail .dt-response-plan img { width:40px;height:40px;object-fit:contain; }
#discourseDetail .dt-response-plan ol { margin:0;padding-inline-start:1.6em;font-size:1rem;line-height:1.55; }
#discourseDetail .dt-response-plan li + li { margin-top:4px; }

/* A selected curriculum lesson occupies its own page from every catalogue entry. */
#screen-learning.pepi-path-preview > :not(.fkd-root),
#screen-learning.pepi-path-preview .fkd-root > :not(.fkd-view):not([data-fkd-warning]) {display:none!important}
html:has(#screen-learning.pepi-path-preview.active) #pepiConnectedReturn {display:none!important}
html #app #screen-learning.pepi-path-preview {
  width:100%;max-width:810px;margin:0 auto;padding:clamp(8px,2.5vw,28px);
  border:none;box-shadow:none;background:transparent;
}
#screen-learning.pepi-path-preview .fkd-root,
#screen-learning.pepi-path-preview .fkd-view {width:100%;max-width:none;padding:0;margin:0;border:0;background:none;box-shadow:none}
#screen-learning.pepi-path-preview .fkd-lesson-preview {
  width:100%;max-width:100%;margin:0;padding:clamp(18px,4vw,40px);box-sizing:border-box;
  border:1px solid #ddd6c9;border-radius:22px;background:#fffcf5;color:#29291f;
}
#screen-learning.pepi-path-preview dialog.fkd-lesson-preview {max-width:min(650px,calc(100% - 28px));max-height:90dvh;margin:auto}
#screen-learning.pepi-path-preview .pepi-path-heading {display:block;margin:0 0 clamp(24px,4vw,38px)}
.pepi-path-byline {display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:6px 16px;padding-bottom:14px;border-bottom:1px solid var(--border,#ded8cb);color:#52624f;font-size:.85rem;font-weight:600}
#screen-learning .pepi-path-location {font-size:inherit;font-weight:500}
.pepi-path-intro {position:relative;padding-top:clamp(24px,5vw,42px)}
#screen-learning .pepi-path-intro h1 {display:block;margin:0;padding:0;color:inherit;font:650 clamp(1.65rem,4.2vw,2.65rem)/1.35 var(--sans,system-ui);text-wrap:balance;overflow-wrap:break-word}
.pepi-path-intro h1:focus {outline:0}
#screen-learning .pepi-path-subtitle {margin:9px 0 0;color:#52614e;font-size:clamp(1.04rem,2.1vw,1.24rem);font-weight:500;line-height:1.62;text-wrap:pretty}
.pepi-path-cover {
 display:grid;place-items:center;justify-self:end;width:76px;aspect-ratio:3/4;
 border-inline-start:5px solid #394039;border-radius:3px 8px 5px 2px;
 background:var(--cover-paper,#f0cc72);box-shadow:2px 3px 0 #302b261c;
}
.pepi-path-cover-1 {--cover-paper:#dba8bd}.pepi-path-cover-2 {--cover-paper:#96c4c3}
.pepi-path-cover-3 {--cover-paper:#d0df9f}.pepi-path-cover-4 {--cover-paper:#e7a17a}.pepi-path-cover-5 {--cover-paper:#a8b8da}
.pepi-path-intro img {display:block;width:88%;max-width:100%;height:auto;object-fit:contain}
@media(min-width:550px) {
 .pepi-path-intro {display:grid;grid-template-columns:minmax(0,1fr) 86px;align-items:center;gap:26px}
}
@media(max-width:549px) {
 .pepi-path-heading {position:relative}
 .pepi-path-cover {position:absolute;right:0;top:-42px;width:33px;border-inline-start-width:3px;border-radius:2px 4px 3px 1px}
 .pepi-path-byline {min-height:44px;align-items:center;justify-content:flex-start;padding-inline-end:39px}
}
#screen-learning.pepi-path-preview .pepi-path-outcome {margin:0 0 23px;padding:clamp(17px,3vw,24px);background:#eaf0e6;color:#2b402f;border-radius:14px}
#screen-learning .pepi-path-outcome h2 {margin:0;font-size:1.02rem;font-weight:700;line-height:1.5;color:inherit}
#screen-learning .pepi-path-outcome p {margin:6px 0 0;font-size:1rem;line-height:1.75;color:inherit}
#screen-learning.pepi-path-preview .pepi-path-access-note {margin:0;max-width:58ch;font-size:.94rem;line-height:1.75;color:#645e50}
#screen-learning.pepi-path-preview .fkd-actions {display:grid;justify-items:start;gap:7px;margin:22px 0 0}
#screen-learning.pepi-path-preview .fkd-actions button {min-height:44px;margin:0;border-radius:12px;padding:10px 17px}
#screen-learning.pepi-path-preview .fkd-actions button[data-fkd-preview-cancel] {border:0;padding-inline:0;background:transparent;color:#554f40;text-align:start;text-decoration:underline;text-underline-offset:4px}
#screen-learning.pepi-path-preview .fkd-primary {background:#bd9a41;color:#211c12;border-color:#aa852c}
#screen-learning.pepi-path-preview .fkd-free-knowledge {margin:25px 0 0;padding:16px 0 0;border:0;border-top:1px solid var(--border,#ded8cb)}
#screen-learning .pepi-lesson-links {display:grid;gap:8px}
#screen-learning .pepi-lesson-links a {
 display:flex;align-items:center;justify-content:space-between;gap:16px;
 padding:10px 4px 10px 0;min-height:44px;color:inherit;
 font-size:1rem;font-weight:600;line-height:1.55;text-decoration:none;
}
#screen-learning .pepi-lesson-links a:is(:hover,:focus-visible) span:first-child {text-decoration:underline;text-underline-offset:4px}
#screen-learning .pepi-access-arrow {flex:none;color:var(--accent,currentColor)}
.pepi-action-arrow {display:inline-block;margin-inline-start:.65em}
[data-theme=dark] #screen-learning.pepi-path-preview .fkd-lesson-preview {background:#252923;color:#ede9de;border-color:#474b41}
[data-theme=dark] #screen-learning.pepi-path-preview :is(.pepi-path-subtitle,.pepi-path-byline,.pepi-path-access-note,[data-fkd-preview-cancel]) {color:#c3cebb}
[data-theme=dark] #screen-learning.pepi-path-preview .pepi-path-outcome {background:#303d34;color:#dce8d8}

html:has(:is(#screen-learning.pepi-path-preview.active,#screen-companion.active #guidedSession.pepi-guided-active:not([hidden]))) .pepi-ws-layout {display:block}
html:has(:is(#screen-learning.pepi-path-preview.active,#screen-companion.active #guidedSession.pepi-guided-active:not([hidden]))) :is(.pepi-ws-sidebar,.pepi-ws-controls,.pepi-ws-finder,.pepi-ws-return-slot) {display:none!important}
html:has(:is(#screen-learning.pepi-path-preview.active,#screen-companion.active #guidedSession.pepi-guided-active:not([hidden]))) .pepi-ws-header {display:flex;align-items:center;justify-content:space-between;min-height:58px;background:var(--pws-bg,#fffcf5)}
html:has(:is(#screen-learning.pepi-path-preview.active,#screen-companion.active #guidedSession.pepi-guided-active:not([hidden]))) .pepi-ws-menu {display:inline-flex;margin-inline-start:auto}
