
/* Classroom chrome: the active page is the working surface. */
body[data-theme="day"] {
  color-scheme: light;
  --page:#eef1f3; --surface:#fff; --soft:#f2f5f8; --line:#d6dee5;
  --ink:#182632; --muted:#526878; --accent:#2a607d; --accent-strong:#194761;
  --desk-wall:#e5e9ed; --focus-ring:#1f719c;
}
body[data-theme="night"] {
  color-scheme: dark;
  --page:#182026; --surface:#202a32; --soft:#293740; --line:#3c4a54;
  --ink:#f2f4f5; --muted:#b7c8d3; --accent:#91cde6; --accent-strong:#bce7fa;
  --desk-wall:#151e25; --focus-ring:#a7d9ed;
}
body { background:var(--page); color:var(--ink); }
body:not([data-theme]) { --desk-wall:#e5e9ed; }
.shell .sidebar,.shell .topbar { background:var(--surface); }
body .shell .sidebar { border-color:var(--line); }
body .sidebar nav summary { font-size:.82rem; padding:9px 10px; }
body .sidebar .nav-item { font-size:.92rem; font-weight:500; min-height:37px; }
body .sidebar .nav-item.active { background:var(--soft); color:var(--accent-strong); }
body .brand-name { letter-spacing:-1.25px; }
body .main-content { animation:none; }
body .topbar .quick-find { font-size:.84rem; padding:6px 9px; color:var(--ink); }
body .theme-switch { display:flex; align-items:center; border:1px solid var(--line); border-radius:5px; padding:2px; gap:1px; }
.theme-switch .theme-control { height:29px;min-width:33px; padding:3px 7px; border:0; border-radius:3px;background:transparent;color:var(--muted);font-size:.87rem; }
.theme-switch .theme-control.selected { background:var(--soft); color:var(--accent-strong); font-weight:650; }
body[data-theme=night] :is(input:not([type=color]),textarea,select,dialog,.desk-titlebar,.desk-ribbon,.desk-status,.desk-outline,.desk-format,.desk-box-format,.desk-page-thumb,.desk-file,.desk-box-format button,.desk-box-format select,.precision-results button,.precise-results button,.comparison-scene,.word-detail-context,.bingo-grid button,.category-bin,.category-tile,.collection-paging button,.activity-directory button,.lab-word-pool,.lab-stage) {
  background:var(--surface); color:var(--ink); border-color:var(--line);
}
body[data-theme=night] :is(.pinyin,.knowledge-pinyin,.library-pinyin,.example-pinyin,.text-py,.story-py,.library-status,.source-note) { color:var(--muted); }
body[data-theme=night] :is(.btn.primary,.theme-switch .theme-control.selected,.desk-ribbon-tool.on) { background:#315364; color:#f2f8fa; border-color:#648998; }
body[data-theme=night] :is(.btn:not(.primary), .panel,.desk-icon,.desk-titlebar button,.desk-ribbon-tool,.desk-delete,.desk-status button) { color:var(--ink); border-color:var(--line); }
body[data-theme=night] :is(.desk-surface,.desk-writing,.desk-sample,.desk-ppt,.desk-thumb-preview,.paper-puzzle) { color-scheme:light; color:#192936; background:#fff; }
body[data-theme=night] :is(.desk-floating, .desk-window,.desk-scroll){border-color:var(--line)}
body[data-view=studio] .main-content { padding:8px !important; }
.desk-window { display:flex; flex-direction:column; height:calc(100dvh - 73px); min-height:395px; border-radius:5px; }
.desk-titlebar { flex:0 0 auto; min-height:41px; gap:6px; }
.desk-file-actions {display:flex;align-items:center;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.desk-document-name>span { font-size:14px; }
.desk-document-name>small {color:var(--muted)}
.desk-ribbon { min-height:38px; padding:3px 6px; }
.desk-ribbon-tool { min-height:31px; flex-direction:row; white-space:nowrap; border-radius:4px; }
.desk-ribbon-tool span { font-size:12px; }
.desk-ribbon-end .btn { min-height:30px; }
.desk-window .desk-body {
  height:auto !important;flex:1; min-height:0!important;display:grid;grid-template-columns:136px minmax(0,1fr)!important;
}
.desk-window .desk-body.desk-outline-hidden,.desk-window.desk-focus .desk-body,.desk-window:fullscreen .desk-body {grid-template-columns:minmax(0,1fr)!important;}
.desk-outline-hidden>.desk-outline {display:none}
.desk-center { display:flex; flex-direction:column; min-width:0; min-height:0; }
.desk-canvas { flex:1; min-height:0; position:relative; isolation:isolate; overflow:hidden; background:var(--desk-wall); }
.desk-canvas .desk-scroll { position:absolute;inset:0;display:block;padding:8px!important;background:var(--desk-wall); }
.desk-canvas .desk-stage { margin-inline:auto; }
.desk-status { flex:0 0 auto; min-height:32px; }
.desk-status>span {max-width:60%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:12px}
.desk-window:fullscreen,.desk-window.desk-focus { height:100dvh; border-radius:0; }
.desk-floating {right:12px;top:72px;max-height:calc(100% - 85px);max-width:calc(100% - 24px);z-index:34}
.desk-floating:has(#deskStroke){right:12px;top:72px;max-width:calc(100% - 24px);max-height:calc(100% - 85px)}
.desk-activity-float { width:min(830px,calc(100% - 24px)); }
.desk-tool-ring { position:absolute; width:0; height:0; z-index:22; color:#eef7fc; }
.desk-tool-handle,.desk-tool-orbit>button {
  position:absolute; display:grid; place-items:center; transform:translate(-50%,-50%);
  width:50px;height:50px;border-radius:50%;border:1px solid #9bb6c388;
  box-shadow:0 2px 8px #0e25334a;background:rgba(31,60,76,.86);color:#f6fafc;
}
.desk-tool-handle {cursor:grab;touch-action:none;z-index:2;width:48px;height:48px}
.desk-tool-handle:active {cursor:grabbing}
.desk-tool-handle:hover,.desk-tool-handle[aria-expanded=true],.desk-tool-orbit>button:hover {background:#234c60}
.desk-tool-handle svg {width:25px;height:25px;stroke-width:3.1}
.desk-tool-orbit[hidden] {display:none}
.desk-tool-orbit:before {content:""; position:absolute; width:264px;height:264px; transform:translate(-50%,-50%); border-radius:50%; background:#1e2f3e35; outline:1px solid #f5faff50;pointer-events:none;}
.desk-tool-orbit>button {left:var(--orbit-x);top:var(--orbit-y);font-size:11px;grid-template-rows:18px 14px;align-content:center;gap:0;line-height:1.1;}
.desk-tool-orbit svg {width:18px;height:18px}
.desk-tool-ring.compact-orbit .desk-tool-orbit {position:absolute;right:25px;bottom:-24px;display:grid;grid-template-columns:repeat(4,44px);gap:4px;padding:8px;background:#243844;border-radius:8px}
.desk-tool-ring.compact-orbit .desk-tool-orbit:before {display:none}
.desk-tool-ring.compact-orbit .desk-tool-orbit>button {position:static;transform:none;width:44px;height:39px;border-radius:4px;}
.word-detail {display:grid;gap:14px}
.word-detail-top{display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between;gap:14px}
.word-detail-top h3{margin:0;font-size:clamp(32px,5vw,52px);font-weight:600}
.word-detail-controls,.word-detail-footer {display:flex;gap:8px;flex-wrap:wrap}
.word-detail-image { width:min(100%,370px);max-height:220px;object-fit:contain;display:block;margin:0; }
.word-detail article { border-top:1px solid var(--line);padding:12px 0; }
.word-detail article h4 {margin:0 0 7px;font-size:17px}
.word-detail-context {padding:12px 14px;background:var(--soft);border-left:3px solid var(--accent);margin-top:10px;overflow-wrap:anywhere}
.word-detail-context p {margin:4px 0}
.word-detail .source-note {margin:5px 0}
@media(max-width:900px){
  .desk-window .desk-body{grid-template-columns:minmax(0,1fr)!important}
  .desk-window .desk-body:not(.desk-outline-hidden) .desk-outline{display:none}
  .desk-window .desk-body.mobile-outline-visible:not(.desk-outline-hidden) .desk-outline{display:block;position:absolute;z-index:32;inset:80px auto 32px 0;width:142px;box-shadow:2px 2px 14px #22364544}
  .desk-canvas .desk-scroll{padding:5px!important}
}
@media(max-width:620px){
  body .topbar{min-height:46px;padding:0 7px}
  body .topbar .quick-find{font-size:.72rem;padding:4px 5px}
  body .topbar .theme-switch {display:flex;gap:0}
  .theme-switch .theme-control{font-size:.72rem;min-width:25px;padding:3px}
  body[data-view=studio] .main-content{padding:3px!important}
  .desk-window{height:calc(100dvh - 53px)}
  .desk-titlebar{flex-wrap:wrap}
  .desk-file-actions {justify-content:flex-start}
  .desk-ribbon-tool span {font-size:11px;}
  .desk-ribbon-end .btn{font-size:11px;min-height:26px}
  .desk-ribbon-end [data-desk=printPage]{display:none}
  .desk-status>span { display:none; }
  .desk-status>div{margin:auto}
  .desk-floating,.desk-floating:has(#deskStroke){right:6px;max-width:calc(100% - 12px)}
}


@media(max-width:620px){
  .desk-ribbon .desk-tool-group:first-child{flex-wrap:wrap;justify-content:flex-start}
  .desk-ribbon-tool svg{max-width:15px;max-height:15px}
  .desk-ribbon-tool{min-height:27px}
  .desk-status{min-height:30px}
}
.theme-swatch.night{background:linear-gradient(145deg,#202a32 70%,#6b9cb3 70%)}
.desk-random-settings {margin-top:14px}
