:root { --chinese-ink:#2e0b17; --chinese-red:#a51c35; --chinese-gold:#ffd36c; }
body[data-course="chinese"], body.chinese-course-page { background:#5c1425 url('/racs/img/chinese/summer-palace-v1.png') center/cover fixed; color:var(--chinese-ink); }
body[data-course="chinese"]:has([data-page="chinese-course"]) { height:100dvh; min-height:0; overflow:hidden; isolation:isolate; }
body[data-course="chinese"] > .teacher-brand { background:rgba(80,14,31,.92); color:#ffdd8e; border-color:#dba54a; }
body[data-course="chinese"] > .teacher-brand .button { color:#61152b; background:#ffda7f; border-color:#ce873e; }
[data-chinese-course-host] { font-family:'Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; background:transparent; position:relative; z-index:1; }
.chinese-scene-cycle { position:fixed; inset:0; pointer-events:none; z-index:0; overflow:hidden; }
.chinese-scene-layer { position:absolute; inset:0; opacity:0; transition-property:opacity; transition-timing-function:ease-in-out; }
.chinese-scene-layer.visible { opacity:1; }
.chinese-scene-image { width:100%; height:100%; object-fit:cover; image-rendering:pixelated; }
body[data-course="chinese"] > .teacher-brand { position:relative; z-index:2; }
body[data-course="chinese"]:has([data-page="chinese-course"]) > .teacher-brand { height:46px; min-height:46px; gap:12px; padding-inline:16px; }
body[data-course="chinese"] > .teacher-brand .language-course-back { min-height:44px; display:inline-flex; align-items:center; font:700 16px/1.15 'Brainpower Pixel',system-ui,sans-serif; color:#ffdd8e; padding-inline:4px; }
body[data-course="chinese"] > .teacher-brand #logout { min-height:44px; border-radius:0; font-family:'Brainpower Pixel',system-ui,sans-serif; font-size:14px; }
#chinese-student-mode { background:#b72539; color:#ffdc69; border-color:#ffd36c; box-shadow:3px 3px 0 #651127; font-family:'Brainpower Pixel',system-ui,sans-serif; }
@media(prefers-reduced-motion:reduce) { .chinese-scene-layer { transition:none; } }
.chinese-shell { height:calc(100dvh - 46px); min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr); gap:10px; padding:12px 12px 16px; max-width:1440px; margin:auto; }
.chinese-header { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:12px 16px; border:3px solid #ffdb82; background:rgba(93,13,35,.91); box-shadow:5px 5px 0 #320c1f; color:#fff7dc; }
.chinese-header h1 { margin:0; font:700 clamp(1.2rem,2.5vw,1.85rem)/1.15 'Brainpower Pixel','Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; color:#fff7dc; overflow-wrap:anywhere; }
.chinese-scene-picker { color:#fff7dc; font-size:.72rem!important; gap:1px!important; }
.chinese-shell .chinese-scene-picker select { min-height:32px; padding:3px 5px; font-size:.8rem; max-width:160px; width:160px; }
.chinese-header .chinese-actions { justify-content:flex-end; }
.chinese-header > div:first-child { min-width:0; }
.chinese-voice-dock.teacher-review-voice-floating { position:relative; inset:auto; max-width:100%; --teacher-deep:#54162a; --teacher-accent:#ffd36c; }
.chinese-voice-dock.teacher-review-voice-floating > section { position:fixed; z-index:120; bottom:12px; right:12px; width:min(580px,calc(100vw - 24px)); max-height:65dvh; }
.chinese-voice-dock.teacher-review-voice-floating > button { width:100%; }
.chinese-kicker { font-weight:800; font-size:.78rem; letter-spacing:.04em; color:inherit; }
.chinese-actions, .chinese-editor-tabs { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.chinese-button { min-height:44px; display:inline-flex; justify-content:center; align-items:center; border:2px solid #54162a; padding:7px 12px; background:#fff1c1; color:#3a1220; text-decoration:none; font:700 1.03rem/1.15 'Brainpower Pixel','Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; box-shadow:inset 2px 2px 0 #fff8dc,3px 3px 0 #54162a; border-radius:0; cursor:pointer; }
.chinese-button.primary { background:#ffd36c; }
.chinese-project-heading { display:grid; gap:7px; }
.chinese-project-heading label { display:grid; gap:4px; font-weight:700; }
.chinese-project-heading select { width:100%; max-width:100%; min-height:44px; border:2px solid #742039; padding:6px; font:16px/1.3 system-ui,sans-serif; color:#3a1220; background:#fff8e4; }
.chinese-project-nav { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; }
.chinese-project-check { display:grid; gap:8px; padding:12px; background:#fff0c4; border-left:4px solid #ba7854; }
.chinese-button:active { transform:translate(2px,2px); box-shadow:1px 1px 0 #54162a; }
.chinese-button:disabled { opacity:.6; cursor:default; }
.chinese-button:focus-visible, .chinese-lesson-tile:focus-visible, .chinese-shell input:focus-visible, .chinese-shell textarea:focus-visible, .chinese-shell select:focus-visible, body[data-course="chinese"] > .teacher-brand :is(a,button):focus-visible { outline:3px solid #1260c9; outline-offset:3px; }
.chinese-status { margin:0; min-height:24px; padding:3px 10px; background:rgba(255,246,218,.97); font-size:.85rem; line-height:1.35; font-weight:700; overflow-wrap:anywhere; }
/* Keep the live region rendered before its first message, without a blank row. */
.chinese-status:empty { position:absolute; width:1px; height:1px; min-height:0; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.chinese-shell:has(.chinese-status:empty) { grid-template-rows:auto minmax(0,1fr); }
.chinese-layout { display:grid; grid-template-columns:minmax(180px,25%) minmax(0,1fr); gap:14px; min-height:0; }
.chinese-list { display:flex; flex-direction:column; gap:10px; min-width:0; min-height:0; overflow:auto; padding:0 4px 6px 0; scrollbar-color:#ba7854 #fff0c4; overscroll-behavior:contain; }
.chinese-list > * { flex-shrink:0; }
.chinese-lesson-tile { display:flex; text-align:left; flex-direction:column; gap:6px; color:#3c1322; padding:14px; background:rgba(255,239,187,.96); border:3px solid #742039; box-shadow:4px 4px 0 #38112c; font-family:inherit; cursor:pointer; border-radius:0; }
.chinese-lesson-tile.selected { border-color:#fff3b3; background:#ffd16e; }
.chinese-lesson-tile strong { font-size:1.05rem; overflow-wrap:anywhere; }
.chinese-lesson-tile span { font-size:.78rem; font-weight:800; }
.chinese-main { display:flex; flex-direction:column; gap:12px; padding:18px; background:rgba(255,248,223,.96); border:3px solid #a72440; box-shadow:5px 5px 0 #41102a; min-width:0; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-color:#ba7854 #fff0c4; scroll-padding:12px; }
.chinese-main > * { flex-shrink:0; min-width:0; }
.chinese-main:has(.chinese-lesson-page) { overflow:hidden; }
.chinese-main > .chinese-lesson-page { display:flex; flex-direction:column; gap:12px; flex:1 1 auto; min-height:0; overflow:auto; overscroll-behavior:contain; padding:2px 4px 5px 0; scrollbar-color:#ba7854 #fff0c4; }
.chinese-lesson-page > * { flex-shrink:0; min-width:0; }
.chinese-main h2, .chinese-main h3 { margin:0; color:#691830; font-family:'Brainpower Pixel','Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; line-height:1.25; overflow-wrap:anywhere; }
.chinese-main h2 { font-size:clamp(1.25rem,2vw,1.75rem); }
.chinese-main p { margin:0; line-height:1.7; white-space:pre-line; overflow-wrap:anywhere; }
.chinese-detail-heading { display:flex; gap:12px; }
.chinese-preview { display:flex; flex-direction:column; gap:10px; padding:12px; background:#fff0c4; border-left:6px solid #bc2644; }
.chinese-preview p { line-height:1.45; }
.chinese-word-strip, .chinese-vocabulary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.chinese-word-strip .chinese-word { background:none; border:0; border-left:2px solid #c9954b; box-shadow:none; }
.chinese-word { display:flex; flex-direction:column; gap:4px; padding:10px; background:#fff9e4; border:2px solid #c9954b; box-shadow:2px 2px 0 #925235; }
.chinese-word strong { color:#a61c39; font-size:1.65rem; font-weight:800; }
.chinese-word span { font-size:1rem; color:#52262b; overflow-wrap:anywhere; }
.chinese-word small { font-size:.9rem; overflow-wrap:anywhere; }
.chinese-reading { font-size:clamp(1.05rem,2.2vw,1.55rem); line-height:1.95!important; white-space:pre-line; padding:20px; border-left:7px solid #d54036; background:rgba(255,233,178,.65); }
.chinese-step-nav { display:flex; justify-content:space-between; align-items:center; margin-top:auto; gap:14px; padding-top:12px; }
.chinese-step-nav > span { font:800 1rem/1.2 system-ui,sans-serif; font-variant-numeric:tabular-nums; white-space:nowrap; }
.chinese-step-nav:has([data-chinese-action="save"]) { display:grid; grid-template-columns:auto auto minmax(0,1fr) auto; gap:8px; }
.chinese-step-nav:has([data-chinese-action="save"]) .chinese-button { font-size:15px; padding-inline:8px; }
.chinese-empty { margin:auto; text-align:center; display:flex; flex-direction:column; gap:14px; align-items:center; max-width:100%; }
.chinese-denied,.chinese-loading { height:calc(100dvh - 46px); min-height:0; padding:24px; justify-content:center; overflow:auto; background:rgba(255,248,223,.96); }
.chinese-empty > span { font-size:5rem; font-weight:800; color:#b31b36; }
.chinese-editor, .chinese-question, .chinese-attempt form { display:flex; flex-direction:column; gap:10px; }
.chinese-shell label { display:flex; flex-direction:column; gap:5px; font-weight:700; font-size:.9rem; }
.chinese-shell input, .chinese-shell textarea, .chinese-shell select { font:1rem/1.5 'Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; border:2px solid #ba7854; background:#fffdf3; color:#351321; border-radius:0; padding:7px; max-width:100%; min-width:0; }
.chinese-shell :is(input:not([type="radio"]),select) { min-height:44px; width:100%; }
.chinese-shell textarea { resize:vertical; width:100%; box-sizing:border-box; }
.chinese-question { border:0; margin:0; padding:0 0 12px; }
.chinese-question legend { font-weight:800; padding:0 0 10px; font-size:1.05rem; }
.chinese-choices { display:flex; gap:10px; }
.chinese-choices label { flex:1; flex-direction:row; align-items:center; padding:12px; border:2px solid #aa633f; box-shadow:3px 3px 0 #542638; background:#fff6cf; cursor:pointer; }
.chinese-choices label.selected { background:#ffce6b; border-color:#a6223b; }
.chinese-choices input { accent-color:#a71c3a; width:18px; height:18px; flex-shrink:0; }
.chinese-results { display:grid; gap:16px; }
.chinese-result-heading { display:flex; justify-content:space-between; gap:12px; align-items:center; }
.chinese-result-heading h2 { font-size:1.2rem; }
.chinese-result-toolbar { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.chinese-result-toolbar select { min-width:160px; flex:1; }
.chinese-attempt { display:flex; flex-direction:column; gap:10px; padding:12px; background:#fff2ce; border:2px solid #c59a55; }
.chinese-attempt > div { border-bottom:1px solid #d9b584; padding-bottom:8px; }
.chinese-attempt p { font-size:1rem; }
.chinese-feedback { padding:12px; border-left:5px solid #a4213f; background:#ffedb6; }
.chinese-feedback-controls { display:flex; align-items:flex-end; gap:12px; }
.chinese-feedback-controls label { max-width:160px; }
.chinese-feedback-controls button { flex:1; }
.chinese-stamp { padding:12px; color:#175734; border:3px solid #287749; font-weight:800; }
@media (max-height:650px) and (min-width:700px) { .chinese-shell { gap:7px; padding:8px 8px 12px; } .chinese-header { padding:7px 12px; gap:8px; } .chinese-header .chinese-button { padding-inline:9px; font-size:1rem; } .chinese-main { padding:12px; gap:8px; } .chinese-preview { padding:8px; } .chinese-word-strip .chinese-word { padding:6px; } .chinese-word-strip .chinese-word strong { font-size:1.25rem; } .chinese-word-strip .chinese-word span,.chinese-word-strip .chinese-word small { font-size:.8rem; } .chinese-reading { font-size:1.15rem; padding:14px; } .chinese-shell textarea { max-height:130px; } .chinese-attempt { padding:6px; gap:6px; } .chinese-attempt form { gap:6px; } }
@media (max-height:650px) and (min-width:700px) { .chinese-preview { gap:6px; } .chinese-preview p { line-height:1.4; } .chinese-word-strip .chinese-word { gap:2px; padding:5px; } }
@media (max-width:699px) { body[data-course="chinese"]:has([data-page="chinese-course"]) > .teacher-brand { padding-inline:8px; gap:8px; } body[data-course="chinese"] > .teacher-brand .brainpower-wordmark { width:156px; } body[data-course="chinese"] > .teacher-brand .language-course-back { font-size:15px; } body[data-course="chinese"] > .teacher-brand #logout { padding-inline:8px; } .chinese-shell { padding:8px 8px 12px; gap:7px; } .chinese-header { align-items:stretch; flex-direction:column; padding:9px 12px; gap:8px; } .chinese-header .chinese-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; } .chinese-header .chinese-button { font-size:15px; padding-inline:6px; } .chinese-layout { grid-template-columns:1fr; grid-template-rows:auto minmax(0,1fr); gap:8px; } .chinese-list { flex-direction:row; overflow-x:auto; padding:0 4px 7px 0; } .chinese-list:empty { display:none; } .chinese-layout:has(.chinese-list:empty) { grid-template-rows:minmax(0,1fr); } .chinese-lesson-tile { min-width:165px; max-width:210px; flex-shrink:0; padding:8px 10px; gap:4px; } .chinese-lesson-tile strong { font-size:.95rem; } .chinese-list > .chinese-button { min-width:110px; flex-shrink:0; } .chinese-main { padding:12px; } .chinese-vocabulary,.chinese-word-strip { grid-template-columns:repeat(2,minmax(0,1fr)); } .chinese-choices { flex-direction:column; } .chinese-reading { padding:12px; font-size:1.1rem; } .chinese-shell .chinese-scene-picker select { max-width:100%; width:100%; } .chinese-scene-picker { width:100%; } .chinese-editor-tabs { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; } .chinese-editor-tabs .chinese-button { padding-inline:4px; font-size:14px; } }
@media (max-height:450px) and (min-width:700px) { .chinese-header h1 { font-size:21px; } .chinese-header .chinese-button { font-size:15px; padding-inline:7px; } .chinese-layout { grid-template-columns:170px minmax(0,1fr); gap:10px; } .chinese-reading { font-size:1.05rem; padding:12px; } .chinese-choices { flex-wrap:wrap; } .chinese-choices label { min-width:140px; } }
@media (prefers-reduced-motion:reduce) { .chinese-button { transform:none!important; } }
/* Held-project review has one measured frame, not a scrollable reading window.
   These rules deliberately do not select learner pages, saved lessons or editors. */
.chinese-project-mode { overflow:hidden; }
.chinese-project-mode .chinese-project-heading { grid-template-columns:minmax(0,1.35fr) minmax(0,1fr); gap:8px; }
.chinese-project-mode .chinese-project-heading label { font-size:13px; gap:3px; }
.chinese-project-mode .chinese-project-heading select { font-size:16px; padding:6px; }
.chinese-project-mode > .chinese-project-page { overflow:hidden; padding:0; gap:0; }
.chinese-project-page > [data-chinese-project-frame] { min-width:0; width:100%; }
.chinese-project-frame { display:grid; gap:4px; padding:4px 8px; border-left:4px solid #bc2644; background:#fff0c4; min-width:0; }
.chinese-project-caption { font:700 13px/1.25 system-ui,sans-serif; color:#691830; overflow-wrap:anywhere; }
.chinese-project-frame p { white-space:pre-wrap; font-size:17px; line-height:1.45; overflow-wrap:anywhere; }
.chinese-project-mode .chinese-project-nav { display:grid; grid-template-columns:auto minmax(44px,1fr) auto auto auto; gap:7px; }
.chinese-project-mode .chinese-project-nav > span { text-align:center; font:700 13px/1.25 system-ui,sans-serif; font-variant-numeric:tabular-nums; white-space:nowrap; }
.chinese-project-mode .chinese-project-nav .chinese-button { font-size:15px; padding-inline:7px; }
.chinese-project-shell .chinese-layout { display:block; }
.chinese-project-shell .chinese-main { height:100%; padding:8px; gap:4px; }
.chinese-project-header { padding:3px 8px; min-height:56px; }
.chinese-project-header[hidden] { display:none; }
.chinese-project-toolbar { width:100%; display:flex; justify-content:space-between; flex-wrap:nowrap; gap:8px; }
.chinese-project-toolbar .chinese-button { min-height:44px; font-size:15px; white-space:nowrap; }
.chinese-project-toolbar .chinese-voice-dock { width:auto; flex:0 1 auto; }
.chinese-visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:0!important; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.chinese-workshop-drawer { width:min(660px,calc(100vw - 24px)); max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); margin:auto; padding:12px; border:3px solid #ffdb82; box-shadow:6px 6px 0 #320c1f; border-radius:0; color:#fff7dc; background:#61152b; font-family:'Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; overflow:auto; overscroll-behavior:contain; }
.chinese-workshop-drawer::backdrop { background:#220918b8; }
.chinese-drawer-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.chinese-project-brand { min-width:0; }
.chinese-project-brand h1 { margin:3px 0 0; color:#fff7dc; font:700 18px/1.15 'Brainpower Pixel',system-ui,sans-serif; overflow-wrap:anywhere; }
.chinese-drawer-body { display:grid; gap:12px; }
.chinese-drawer-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:8px; }
.chinese-workshop-drawer .chinese-button { min-height:44px; font-size:15px; }
.chinese-workshop-drawer .chinese-button:focus-visible,.chinese-workshop-drawer select:focus-visible { outline:3px solid #83c8ff; outline-offset:3px; }
.chinese-workshop-drawer .chinese-project-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; overflow:visible; padding:0; }
.chinese-workshop-drawer .chinese-project-list > label { grid-column:1/-1; display:grid; gap:4px; font-weight:700; }
.chinese-workshop-drawer select { width:100%; min-height:44px; max-width:100%; min-width:0; border:2px solid #ba7854; border-radius:0; padding:6px; font:16px/1.3 system-ui,sans-serif; background:#fff8e4; color:#3a1220; }
@media (max-height:450px) and (min-width:700px) {
  .chinese-project-shell:has(.chinese-project-header[hidden]) { grid-template-rows:auto minmax(0,1fr); }
  .chinese-project-shell:has(.chinese-project-header[hidden]):has(.chinese-status:empty) { grid-template-rows:minmax(0,1fr); }
  body[data-course="chinese"] > .teacher-brand:has(.chinese-project-toolbar) { gap:8px; padding-inline:8px; }
  body[data-course="chinese"] > .teacher-brand .chinese-project-toolbar { width:auto; margin-left:auto; }
  .chinese-workshop-drawer { padding:8px 12px; }
  .chinese-drawer-heading { margin-bottom:8px; }
  .chinese-drawer-body { gap:8px; }
}
@media (max-width:699px) {
  .chinese-project-header { flex-direction:row; padding:3px 8px; }
  .chinese-project-mode .chinese-project-heading { grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:6px; }
  .chinese-project-mode .chinese-project-nav { grid-template-columns:auto minmax(44px,1fr) auto auto; }
  .chinese-project-mode .chinese-project-nav .chinese-button { padding-inline:5px; }
}

/* Chinese sign-in keeps the approved pixel lettering and logo, but has its own world. */
body.auth-shell.chinese-login-shell { --entry-deep:#4c1127; --entry-blue:#ae253c; --entry-orange:#ffcb66; --entry-green:#ffd97d; --teacher-deep:#64162a; --teacher-accent:#ffc864; --teacher-accent-text:#fff1ba; background:#66152a url('/racs/img/chinese/summer-palace-v1.png') center/cover; }
body.auth-shell.chinese-login-shell .auth-entry-hero .auth-entry-motto { color:#fff0be; text-shadow:2px 2px 0 #7a2336,4px 4px 0 #3c0d21; }
body.auth-shell.chinese-login-shell .auth-entry-motto .entry-belief { color:#fff4d5; font-family:'Brainpower Pixel','Noto Sans SC','Microsoft YaHei','PingFang SC',system-ui,sans-serif; }
body.auth-shell.chinese-login-shell .auth-entry-motto .entry-rally { color:#ffd277; text-shadow:2px 2px 0 #a1283d,4px 4px 0 #3f0f24; }
body.auth-shell.chinese-login-shell .auth-entry-brand .brainpower-logo { filter:drop-shadow(0 6px 0 #5d1725b3); }
body.auth-shell.chinese-login-shell .auth-card { background:rgba(255,247,219,.92); color:#59162a; border-color:#ffdd84; box-shadow:inset 3px 3px 0 #fff8de,inset -3px -3px 0 #d7a461,7px 8px 0 #4c132b; }
body.auth-shell.chinese-login-shell #auth-status,body.auth-shell.chinese-login-shell .teacher-invite p { color:#59162a; }
body.auth-shell.chinese-login-shell .teacher-login { border-color:#c98d4d; }
body.auth-shell.chinese-login-shell .auth-card #google-login,body.auth-shell.chinese-login-shell .auth-card #accept-teacher-invite { color:#621529; background:#ffd379; border-color:#ffecb7 #a75e35 #a75e35 #ffecb7; box-shadow:inset 0 -4px 0 #e6ad50,3px 3px 0 #55162c; }
body.auth-shell.chinese-login-shell .auth-card #google-login:hover { background:#ffe49e; }
body.auth-shell.chinese-login-shell .auth-card .button:focus-visible { outline-color:#9d173b; }
