/* V1 document: compact reading controls and clear saved learning states. */
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .tabs .tab.completed {
 background:#253a56;color:#fff;border-color:#253a56;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .tabs .tab.completed.active {background:#162a44;box-shadow:inset 0 -3px #edb26b;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .tabs .tab.completed .tab-complete {display:inline-flex;align-items:center;justify-content:center;background:#fff;color:#253a56;width:24px;height:24px;flex:0 0 24px;border-radius:50%;margin-left:6px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .tabs .tab-complete .icon {width:19px;height:19px;stroke-width:2.8;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-end {display:flex;flex-direction:column;align-items:stretch;gap:14px;padding-top:28px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-end-label {align-self:center;order:0;font-size:13px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-actions {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;width:100%;order:1;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-actions>.chapter-previous,
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-actions>.btn.secondary.chapter-previous {justify-self:start;grid-column:1;grid-row:1;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-actions>.btn:not(.secondary) {justify-self:end;grid-column:2;margin:0;max-width:100%;white-space:normal;text-align:center;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .v1-writing-grid {display:block;max-width:900px;margin:auto;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .v1-writing-grid .writing-work {padding:0;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-task {margin:12px 0 20px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-secondary {border-top:1px solid #e6ebf1;margin-top:26px;padding-top:22px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .question-actions {display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-feedback-help {position:relative;margin:0;padding:0;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-feedback-help>summary {list-style:none;display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:0;background:#f2f5fa;border-radius:50%;cursor:pointer;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-feedback-help>summary::-webkit-details-marker {display:none;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-feedback-help>div {position:fixed;z-index:110;inset:12vh max(18px,calc((100vw - 820px)/2)) auto;max-height:72vh;overflow:auto;background:white;box-shadow:0 16px 65px #14274326;border:1px solid #e5eaf1;border-radius:12px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .lesson-speech-inline {display:inline-flex;vertical-align:middle;margin-left:5px;padding:0;min-width:44px;min-height:44px;color:#536a8f;background:transparent;border:0;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap {position:sticky;top:var(--lesson-scroll-top,140px);margin:0 0 20px auto;padding:10px 0 10px 14px;width:fit-content;max-width:100%;height:auto;min-height:60px;box-sizing:border-box;z-index:5;background:#fff;border:0;overflow:visible;box-shadow:none;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap ol {flex-wrap:wrap;justify-content:flex-end;padding:2px;gap:8px;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap button {width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px!important;max-height:44px!important;aspect-ratio:1;border-radius:50%;padding:0;display:flex;align-items:center;justify-content:center;flex:0 0 44px;line-height:1;transform:none;animation:none;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap button.right {background:#ba7737;border-color:#ba7737;color:#fff;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap button.wrong {background:#f1f3f6;border-color:#c5ccd6;color:#536174;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson details.feedback {padding:0;margin:14px 0;border-radius:8px;border:1px solid #eddac5;background:#fff8ef;color:#83572f;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson details.feedback.wrong {border-color:#dce2e9;background:#f5f6f8;color:#556070;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson details.feedback>summary {padding:14px 16px;cursor:pointer;list-style:none;display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .feedback-expand {font-size:12px;margin-left:auto;}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .feedback-detail {padding:0 16px 16px;}
html body details.af-report {padding:0;}
html body details.af-report>.af-feedback-summary {padding:18px 20px;list-style:none;display:flex;align-items:center;gap:14px;flex-wrap:wrap;cursor:pointer;}
html body details.af-report.af-positive>.af-feedback-summary {background:#fff7ed;color:#89572d;}
html body details.af-report.af-review>.af-feedback-summary {background:#f3f5f8;color:#566273;}
html body .af-feedback-summary small {margin-left:auto;}
html body .af-feedback-body {padding:22px;}
.lesson-outcome {text-align:center;padding:20px 10px;}
.lesson-outcome-mark {display:flex;margin:0 auto 16px;align-items:center;justify-content:center;width:62px;height:62px;border-radius:50%;background:#253a56;color:#fff;}
.lesson-outcome-mark .icon {width:30px;height:30px;}
.lesson-outcome h2 {font-size:24px;margin:10px 0;}
.lesson-outcome>p {color:#6b778a;line-height:1.8;}
.lesson-outcome-stats {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:24px 0;text-align:left;}
.lesson-outcome-stats>div {padding:16px;background:#f5f7fa;border-radius:9px;}
.lesson-outcome-stats dt {font-size:12px;color:#7a8697;line-height:1.6;}
.lesson-outcome-stats dd {font-size:21px;font-weight:650;margin:8px 0 0;color:#253a56;}
.lesson-outcome-note {font-size:12px;}
.lesson-outcome-actions {display:flex;justify-content:center;gap:12px;flex-wrap:wrap;}
@media(max-width:600px){
 .lesson-outcome-stats {grid-template-columns:repeat(2,minmax(0,1fr));}
 html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .chapter-actions .btn {font-size:12px!important;min-height:44px;padding:10px!important;}
 html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson .writing-feedback-help>div {inset:15vh 14px auto;max-height:65vh;}
 html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .st-qmap {width:100%;padding-left:0;}
 html body .af-feedback-body {padding:16px;}
}

/* Restore the original roomy composer; focus never changes its appearance.
   These scoped overrides win over the older theme's forced glow and compact field. */
html.atelier-theme body #app .shell .main[class].page-home .generation-composer,
html.atelier-theme body #app .shell .main[class].page-home .generation-composer:focus-within {
 padding:20px!important;border:1px solid #e2e8f0!important;border-radius:12px!important;background:#fff!important;
 box-shadow:none!important;outline:none!important;outline-offset:0;transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body #app .shell .main[class].page-home .generation-composer::before,
html.atelier-theme body #app .shell .main[class].page-home .generation-composer:focus-within::before {
 display:none!important;box-shadow:none!important;transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body #app .shell .main[class].page-home .generation-composer #generation-prompt {
 min-height:106px!important;max-height:260px!important;padding:0 0 16px!important;line-height:28px!important;
 border:0!important;background:transparent!important;box-shadow:none!important;outline:none!important;outline-offset:0;
 transform:none!important;transition:none!important;animation:none!important;resize:none;overflow-y:hidden;
}
@media(max-width:640px){
 html.atelier-theme body #app .shell .main[class].page-home .generation-composer,
 html.atelier-theme body #app .shell .main[class].page-home .generation-composer:focus-within {padding:16px!important;}
 html.atelier-theme body #app .shell .main[class].page-home .generation-composer #generation-prompt {min-height:116px!important;}
}
html body .flow-navigation>[data-action="close-modal"] .icon {transform:rotate(180deg);}

/* Icon-only reading actions use a small visual surface, never a stretched link.
   Labelled Listen actions and word-web nodes keep their own button layouts. */
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]) {
 position:relative;isolation:isolate;display:inline-flex!important;align-items:center!important;justify-content:center!important;
 width:28px!important;height:28px!important;min-width:28px!important;min-height:28px!important;max-width:28px!important;max-height:28px!important;
 inline-size:28px!important;block-size:28px!important;min-inline-size:28px!important;min-block-size:28px!important;
 flex:0 0 28px!important;align-self:center;justify-self:start;gap:0!important;vertical-align:-.18em;
 margin-block:0!important;margin-inline:4px 0;padding:0!important;border:0!important;border-radius:6px!important;
 color:#536a8f!important;background:transparent!important;background-image:none!important;box-shadow:none!important;
 line-height:1!important;text-decoration:none!important;transform:none!important;transition:none!important;animation:none!important;opacity:1;
}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak])::before {
 content:"";position:absolute;z-index:-1;left:50%;top:50%;width:26px;height:26px;border-radius:6px;
 background:transparent;pointer-events:none;transform:translate(-50%,-50%);box-shadow:none;transition:none;animation:none;
}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]) > .icon {
 display:block;width:16px!important;height:16px!important;flex:0 0 16px;stroke-width:1.8;transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body :is(#app, #modal-root) .vocab-card > button.lesson-speech-button {align-self:flex-start!important;margin-inline-start:0!important;}
@media (hover:hover) {
 html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):hover:not(:disabled) {color:#334c7a!important;}
 html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):hover:not(:disabled)::before {background:#edf1f7;}
}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):focus-visible {
 outline:2px solid #536a8f!important;outline-offset:1px;
}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):is(:focus-visible, :active, .st-speaking)::before {background:#e8eef7;}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]).st-speaking {color:#334c7a!important;}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):disabled {opacity:.45!important;cursor:default;}
html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]):disabled::before {background:transparent;}
@media (pointer:coarse) {
 html.atelier-theme body :is(#app, #modal-root) button:is(.lesson-speech-button, .st-icon-btn[data-speak], .grammar-example > button[data-speak]) {
  width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px!important;max-height:44px!important;
  inline-size:44px!important;block-size:44px!important;min-inline-size:44px!important;min-block-size:44px!important;flex-basis:44px!important;
 }
}

/* Home course level menu: clear guidance, compact trigger, steady selection. */
html.atelier-theme body #app .shell .main[class].page-home .composer-level:has(select[data-select-variant="home-level"]) {
 display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 12px!important;
 border:1px solid #e3e9f0!important;border-radius:8px!important;background:#f6f8fb!important;
 color:#738096;font-size:12px;font-weight:500;line-height:20px;box-shadow:none!important;
 transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body #app .shell .main[class].page-home .composer-level:has(select[data-select-variant="home-level"]) .hb-select-trigger {
 min-height:38px!important;min-width:42px;padding:0!important;gap:8px;
 border:0!important;background:transparent!important;border-radius:0!important;
 color:#3c5278;font-size:13px;font-weight:600;line-height:20px;
 box-shadow:none!important;outline:none!important;transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body #app .shell .main[class].page-home .composer-level:has(select[data-select-variant="home-level"]) .hb-select-chevron {
 width:12px;height:12px;color:#8b98ab;transition:none!important;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] {
 padding:6px;border:1px solid #e0e6ef;border-radius:12px;background:#fff;color:#283b55;
 box-shadow:0 10px 24px #24344d0c,0 2px 6px #24344d04;scrollbar-color:#d2dae5 transparent;
 overscroll-behavior:contain;animation:none!important;transition:none!important;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option {
 gap:14px;min-height:56px;padding:10px 12px;border-radius:8px;
 color:#34475f;background:transparent;font-size:13px;line-height:1.45;
 transform:none!important;transition:none!important;animation:none!important;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option-content {
 display:flex;flex:1;min-width:0;flex-direction:column;gap:4px;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option-title {
 display:block;color:inherit;font-size:13px;font-weight:600;line-height:1.4;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option-description {
 display:block;color:#8190a2;font-size:11px;font-weight:400;line-height:1.5;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option.is-active {
 background:#f5f7fb;color:#344d70;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option[aria-selected="true"] {
 background:#edf2f9;color:#345687;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option[aria-selected="true"] .hb-select-option-description {
 color:#6b809e;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-check {
 width:16px;height:16px;color:#476b9a;
}
html.atelier-theme body .hb-select-menu[data-variant="home-level"] .hb-select-option[aria-disabled="true"] {
 color:#a0abba;background:transparent;cursor:not-allowed;
}

/* Keep inline Listen beside the sentence ending, without a separate action row. */
html.atelier-theme body :is(#app, #modal-root) .lesson-speech-tail {
 display:inline!important;white-space:nowrap!important;
}
html.atelier-theme body :is(#app, #modal-root) .lesson-speech-tail > .lesson-speech-button {
 vertical-align:-.18em;margin-block:0!important;
}

/* A paragraph's Listen control has its own column beside the first text line.
   Keeping it in normal flow also leaves room for ruby and touch targets. */
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph:has(> .st-para-tools) {
 display:grid;grid-template-columns:minmax(0,1fr) max-content;column-gap:12px;row-gap:0;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph > .st-para-tools {
 position:static;inset:auto;grid-column:2;grid-row:1;align-self:start;
 display:flex;align-items:center;justify-content:flex-end;gap:6px;
 width:max-content;max-width:100%;margin:0;padding:0;opacity:1;
 transform:none;transition:none;animation:none;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph > .zh-text {
 grid-column:1;grid-row:1;min-inline-size:0;margin-block:0;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph > :is(.pinyin-line, .translation, .st-speech-actions) {
 grid-column:1 / -1;min-inline-size:0;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph > .st-para-tools > button[data-speak] {
 margin-inline:0!important;
}
@media(max-width:767px) {
 html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content[data-chapter="article"] .article-paragraph:has(> .st-para-tools) {
  column-gap:8px;
 }
}

/* Keep playback feedback above a single, left-aligned set of controls. */
html.atelier-theme body :is(#app, #modal-root) .st-speech-actions {
 display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:8px;
 min-inline-size:0;margin:12px 0 0;padding:12px 0 0;border-top:1px solid #e6ebf2;
 background:transparent;box-shadow:none;font-size:12px;line-height:1.6;
}
html.atelier-theme body :is(#app, #modal-root) .st-speech-actions > [role="status"] {
 flex:0 0 100%;min-inline-size:0;max-inline-size:100%;margin:0;
 color:#748197;font-size:12px;line-height:1.6;overflow-wrap:anywhere;
}
html.atelier-theme body:has(#app) :is(#app, #modal-root) .st-speech-actions > :is(button.btn, a.btn) {
 display:inline-flex!important;align-items:center;justify-content:center;flex:0 1 auto;
 min-height:36px!important;max-inline-size:100%;min-inline-size:0;margin:0!important;padding:6px 12px!important;
 border:1px solid #dfe6ef!important;border-radius:6px!important;box-shadow:none!important;
 font-size:12px!important;line-height:1.5!important;white-space:normal;text-align:center;
 transform:none!important;transition:none!important;animation:none!important;
}
@media(pointer:coarse) {
 html.atelier-theme body:has(#app) :is(#app, #modal-root) .st-speech-actions > :is(button.btn, a.btn) {
  min-height:44px!important;
 }
}

/* Grammar drafts keep a quiet field edge while the text caret marks editing. */
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .grammar-try textarea[data-grammar-draft] {
 display:block;width:100%;min-inline-size:0;min-height:120px;margin:0;padding:14px 16px!important;
 border:1px solid #e1e6ee!important;border-radius:8px!important;background:#fff!important;
 color:var(--hb-ink);font-size:14px!important;line-height:1.85!important;resize:vertical;
 outline:0!important;outline-offset:0!important;box-shadow:none!important;transition:none!important;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .grammar-try textarea[data-grammar-draft][aria-invalid="true"] {
 border-color:var(--hb-bad)!important;
}
@media(max-width:767px) {
 html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content .grammar-try textarea[data-grammar-draft] {
  padding:12px 14px!important;font-size:16px!important;line-height:1.75!important;
 }
}

/* Article and reading pictures follow the same centered measure as the copy. */
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content:is([data-chapter="article"], [data-chapter="reading"]) .lesson-body {
 --hb-lesson-reading-measure:48rem;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content:is([data-chapter="article"], [data-chapter="reading"]) .lesson-body > :is(.article-figure, .article-paragraph, .zh-text, .pinyin-line, .translation) {
 inline-size:min(100%,var(--hb-lesson-reading-measure))!important;max-inline-size:var(--hb-lesson-reading-measure)!important;
 min-inline-size:0;box-sizing:border-box;margin-inline:auto!important;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content:is([data-chapter="article"], [data-chapter="reading"]) .article-figure .lesson-visual.large.course-image-frame {
 inline-size:100%;max-height:none!important;
}
html.atelier-theme body #app .shell.workspace-shell .main[class].page-lesson #lesson-content:is([data-chapter="article"], [data-chapter="reading"]) .article-figure img[data-course-image] {
 width:100%!important;height:auto!important;max-height:none!important;
}
