/* A third companion mode, using the site's established controls and spacing. */
.tutor-modes #tutorModeHanyu[aria-pressed="true"] { color: var(--accent); }
.tutor [hidden] { display: none !important; }
.tutor[data-mode="hanyu"] { --tutor-green: var(--accent); --tutor-soft: var(--tutor-secondary); }
.tutor[data-mode="hanyu"] .tutor-sidebar { background: oklch(.984 .004 240); }
.tutor[data-mode="hanyu"] .tutor-scene[aria-pressed="true"] { border-color: var(--accent); }
.hanyu-settings p { color: var(--muted); font-size: 11px; line-height: 1.65; margin: 10px 0 5px; }
.hanyu-settings p span { display: block; margin-top: 4px; }
.hanyu-settings > a { display: inline-block; padding: 7px 0; color: var(--accent); font-size: 11px; line-height: 1.5; }
.hanyu-material { padding-top: 15px; margin-top: 12px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.7; }
.hanyu-material h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.hanyu-material p { margin: 5px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hanyu-level-note, .hanyu-report-disclaimer { color: var(--muted); font-size: 11px; }
.hanyu-reference-score { color: var(--accent); font-weight: 600; }
.hanyu-dimensions { margin: 12px 0 18px; }
.hanyu-dimensions > div { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hanyu-dimensions dt { flex: 0 0 96px; font-size: 12px; }
.hanyu-dimensions dd { margin: 0; min-width: 0; font-size: 12px; }
.hanyu-dimensions small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.hanyu-errors { padding-left: 20px; margin: 10px 0 15px; }
.hanyu-errors li { padding: 4px 0 12px 2px; }
.hanyu-errors strong { font-size: 12px; }
.hanyu-errors p { margin: 3px 0; font-size: 12px; }
.hanyu-attribution { display: inline-block; padding: 6px 0; font-size: 11px; color: var(--accent); overflow-wrap: anywhere; }
.tutor details.hanyu-sample { margin: 12px 0; padding-top: 12px; }
.hanyu-sample h4 { margin-top: 12px; }
.hanyu-sample p { font-size: 13px; line-height: 1.8; }
@media (max-width: 700px) {
  .tutor-modes button { padding: 9px 7px; }
  .tutor-modes button small { font-size: 10px; max-width: 15ch; }
  .tutor[data-mode="hanyu"] .tutor-scenarios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tutor[data-mode="hanyu"] .tutor-scene { min-width: 0; }
  .hanyu-settings { margin-top: 10px; }
  .hanyu-settings select { width: auto; min-width: 130px; }
  .hanyu-dimensions dt { flex-basis: 85px; }
}

/* Reading, authoring and assessment share one complete materials workspace. */
.tutor[data-mode="hanyu"] { --tutor-green: var(--primary); --tutor-soft: var(--tint); }
.hanyu-workbench { color: var(--ink); min-width: 0; }
.hwb-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 3px 0 20px; }
.hwb-intro h2 { font-size: 21px; font-weight: 600; line-height: 1.45; margin: 0 0 6px; }
.hwb-intro p { font-size: 13px; line-height: 1.7; color: var(--muted); margin: 0; max-width: 68ch; }
.hwb-intro > a { font-size: 11px; line-height: 1.6; color: var(--primary); padding: 6px 0; flex: 0 1 250px; text-align: right; }
.hwb-tasks { display: flex; border-bottom: 1px solid var(--line); gap: 8px; }
.hwb-tasks button { flex: 1; min-width: 0; min-height: 86px; padding: 15px 14px; margin-bottom: -1px; border: 1px solid transparent; border-radius: 8px 8px 0 0; background: transparent; color: var(--ink); text-align: left; }
.hwb-tasks button:hover { background: var(--surface); }
.hwb-tasks button[aria-pressed="true"] { border-color: var(--line); border-bottom-color: var(--tint); background: var(--tint); color: var(--primary); }
.hwb-tasks strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.6; }
.hwb-tasks span { display: block; font-size: 11px; line-height: 1.6; margin-top: 5px; }
.hwb-package-note { padding: 12px 0 15px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.75; }
.hwb-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; align-items: stretch; }
.hwb-library { background: var(--surface); border-right: 1px solid var(--line); padding: 22px 17px; min-width: 0; }
.hwb-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hwb-section-heading h3 { font-size: 14px; font-weight: 600; line-height: 1.6; margin: 0; }
.hwb-section-heading > span { font-size: 11px; line-height: 1.5; color: var(--muted); white-space: nowrap; }
.hanyu-workbench label { display: block; font-size: 11px; font-weight: 600; line-height: 1.6; margin: 14px 0 6px; }
.hanyu-workbench select, .hanyu-workbench input[type="search"], .hanyu-workbench input:not([type]), .hanyu-workbench textarea { width: 100%; max-width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; padding: 9px 11px; }
.hanyu-workbench input::placeholder, .hanyu-workbench textarea::placeholder { color: oklch(.46 .009 230); opacity: 1; }
.hanyu-workbench textarea { font-size: 14px; line-height: 1.8; min-height: 150px; max-height: 600px; resize: vertical; display: block; }
.hanyu-workbench select { padding-right: 25px; }
.hwb-helper { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 8px 0 11px; }
.hwb-resource-list { display: flex; flex-direction: column; gap: 0; margin: 17px -7px 0; max-height: 650px; overflow-y: auto; overscroll-behavior: contain; padding: 0 7px 6px; }
.hwb-resource { display: block; flex: 0 0 auto; width: 100%; text-align: left; padding: 13px 10px; color: var(--ink); background: transparent; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 0; }
.hwb-resource:hover { background: white; }
.hwb-resource[aria-pressed="true"] { background: var(--tint); border-color: var(--primary); border-radius: 6px; }
.hwb-resource strong { display: block; font-size: 13px; line-height: 1.7; font-weight: 600; overflow-wrap: anywhere; }
.hwb-resource-meta { display: block; font-size: 10px; line-height: 1.7; color: var(--primary); margin: 3px 0; }
.hwb-resource small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 11px; color: var(--muted); line-height: 1.7; }
.hwb-main { min-width: 0; background: white; }
.hwb-editor { padding: 22px 24px 16px; }
.hwb-task-description { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 7px 0 13px; max-width: 75ch; }
.hwb-editor-options { display: grid; grid-template-columns: minmax(85px, .7fr) minmax(130px, 1.4fr) minmax(95px, 1fr); gap: 12px; }
.hwb-editor-options label { margin-top: 2px; }
.hwb-draft-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hwb-draft-heading .hwb-upload { display: inline-flex; align-items: center; position: relative; cursor: pointer; min-height: 40px; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; font-weight: 400; margin-bottom: 0; }
.hwb-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.hwb-upload:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.hwb-editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 13px; }
.hwb-secondary { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-size: 12px; line-height: 1.5; padding: 9px 13px; border: 1px solid var(--primary); border-radius: 6px; background: white; color: var(--primary); }
.hwb-secondary:hover:enabled { background: var(--tint); }
.hwb-editor-actions .tutor-primary { font-size: 12px; padding: 10px 13px; }
.hwb-editor-actions .tutor-text-btn { font-size: 11px; }
.hwb-model-note { color: var(--primary); font-size: 11px; line-height: 1.75; margin: 7px 0 0; }
.hwb-notice { margin: 0 24px 16px; padding: 11px 13px; font-size: 12px; line-height: 1.7; color: var(--primary); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
.hwb-notice[data-kind="error"] { color: var(--error); background: oklch(.985 .008 28); border-color: oklch(.79 .05 28); }
.hwb-output { border-top: 1px solid var(--line); min-width: 0; }
.hwb-output[aria-busy="true"] .hwb-result-heading { background: var(--surface); }
.hwb-result-heading { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: space-between; gap: 13px; padding: 21px 24px 16px; }
.hwb-origin { display: block; color: var(--primary); font-size: 11px; line-height: 1.6; margin-bottom: 6px; }
.hwb-result-heading h3 { font-size: 17px; line-height: 1.65; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.hwb-result-heading p { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 5px 0 0; overflow-wrap: anywhere; }
.hwb-export-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hwb-export-actions button { color: var(--primary); background: white; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; min-height: 36px; padding: 7px 10px; }
.hwb-export-actions button:hover:enabled { background: var(--tint); border-color: var(--primary); }
.hwb-warnings { margin: 0 24px 16px; padding: 11px 15px 11px 30px; background: var(--tint); color: var(--primary); font-size: 11px; line-height: 1.8; border-radius: 6px; }
.hwb-result-empty { display: flex; flex-direction: column; justify-content: center; min-height: 350px; padding: 36px 25px; text-align: center; background: var(--surface); }
.hwb-result-empty > span { font-size: 23px; color: var(--primary); font-weight: 500; margin-bottom: 15px; }
.hwb-result-empty p { font-size: 12px; line-height: 1.8; color: var(--muted); max-width: 56ch; margin: 4px auto; }
#hwbFrame { display: block; border: 0; border-top: 1px solid var(--line); width: 100%; height: 1000px; background: white; }
.hwb-footnote { padding: 16px 24px 18px; margin: 0; font-size: 10px; line-height: 1.8; color: var(--muted); border-top: 1px solid var(--line); }
.hwb-online { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 17px; }
.hwb-online h4 { font-size: 13px; line-height: 1.6; margin: 0; font-weight: 600; }
.hwb-online-controls { display: flex; gap: 9px; align-items: flex-end; }
.hwb-online-controls > div { flex: 1; min-width: 0; }
.hwb-online-controls select { margin: 0; }
.hwb-online-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 0; max-height: 260px; overflow-y: auto; }
.hwb-online-list li { flex: 0 0 auto; }
.hwb-online-list button { width: 100%; padding: 10px 0; min-height: 42px; border: 0; border-bottom: 1px solid var(--line); background: white; text-align: left; color: var(--primary); font-size: 12px; line-height: 1.6; }
.hwb-online-source { font-size: 11px; line-height: 1.7; color: var(--muted); margin: 10px 0 0; overflow-wrap: anywhere; }
.hwb-online-source a { color: var(--primary); }
@media (max-width: 1100px) {
  .hwb-layout { grid-template-columns: 235px minmax(0,1fr); }
  .hwb-editor, .hwb-result-heading { padding-left: 19px; padding-right: 19px; }
  .hwb-tasks { gap: 2px; }
  .hwb-tasks button { padding: 12px 10px; }
  .hwb-tasks strong { font-size: 13px; }
}
@media (max-width: 800px) {
  .hwb-layout { grid-template-columns: 210px minmax(0,1fr); }
  .hwb-library { padding: 18px 13px; }
  .hwb-editor-options { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .hwb-kind-field { grid-column: 2; grid-row: span 1; }
  .hwb-tasks strong { font-size: 12px; }
  .hwb-tasks span { font-size: 10px; }
}
@media (max-width: 700px) {
  .hwb-intro { display: block; margin-bottom: 17px; }
  .hwb-intro h2 { font-size: 19px; }
  .hwb-intro > a { display: inline-block; text-align: left; margin-top: 7px; }
  .hwb-tasks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; border: 0; }
  .hwb-tasks button { min-height: 85px; border: 1px solid var(--line); border-radius: 7px; margin: 0; padding: 11px; }
  .hwb-tasks button[aria-pressed="true"] { border-color: var(--primary); }
  .hwb-tasks strong { font-size: 13px; }
  .hwb-tasks span { font-size: 10px; }
  .hwb-package-note { font-size: 10px; }
  .hwb-layout { display: block; border-radius: 9px; }
  .hwb-library { border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 16px; }
  .hwb-library > label { margin-top: 10px; }
  .hanyu-workbench select { width: 100%; max-width: 100%; font-size: 12px; min-height: 42px; }
  .hwb-resource-list { max-height: 290px; margin-top: 13px; }
  .hwb-resource { padding: 11px 9px; }
  .hwb-resource small { -webkit-line-clamp: 1; }
  .hwb-editor { padding: 20px 16px 15px; }
  .hwb-editor-options { grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); }
  .hanyu-workbench textarea, .hanyu-workbench input:not([type]), .hanyu-workbench input[type="search"] { font-size: 16px; }
  .hwb-editor-actions { align-items: stretch; }
  .hwb-editor-actions > .tutor-primary, .hwb-editor-actions > .hwb-secondary { flex: 1 0 100%; min-height: 44px; }
  .hwb-notice { margin-left: 16px; margin-right: 16px; }
  .hwb-result-heading { padding: 18px 16px 15px; }
  .hwb-export-actions { width: 100%; }
  .hwb-export-actions button { flex: 1 0 auto; min-height: 42px; font-size: 10px; padding: 7px; }
  .hwb-warnings { margin-left: 16px; margin-right: 16px; }
  .hwb-footnote { padding: 15px 16px; }
  #hwbFrame { height: 850px; }
  .hwb-online-controls { flex-wrap: wrap; align-items: stretch; }
  .hwb-online-controls > div { flex: 1 0 100%; }
}
