/* 黑板外框收口（docs/UI-GAP-20261027.md F1–F10、M1–M7）。
   最后加载，只管深色 chrome 的颜色与手机外框；颜色取 PRODUCT-UX-ARCH 第五节 tokens：
   --chrome-bg #202124 · --chrome-raised #303134 · --chrome-line #5F6368 · --chrome-ink #E8EAED · --chrome-muted #9AA0A6 · --g-blue #4285F4。
   浅色主题（用户在设置里显式选「明亮」）不受影响。 */

/* ---------- 顶栏 ---------- */
html.dark body:not(.theme-light) #topNavbar{background:#202124!important;border-bottom:1px solid rgb(255 255 255 / .08)!important;color:#E8EAED}
html.dark body:not(.theme-light) #topNavbar button:hover{background:#303134!important}
/* 一键成课是本屏唯一主按钮：Google 蓝（十二节第 2 条） */
html.dark body:not(.theme-light) #topNavbar #r4LessonToolbar{background:#4285F4!important;border:1px solid #4285F4!important;color:#FFFFFF!important}
html.dark body:not(.theme-light) #topNavbar #r4LessonToolbar:hover{background:#3B78E7!important}
/* 导出、录制、演示降为次按钮：透明底 + 1px 描边 */
html.dark body:not(.theme-light) #topNavbar :is(#btnExport,#btnRecordLesson,#redesignPresent){background:transparent!important;border:1px solid #5F6368!important;color:#E8EAED!important}
html.dark body:not(.theme-light) #topNavbar :is(#btnExport,#btnRecordLesson,#redesignPresent):hover{background:#303134!important}
html.dark body:not(.theme-light) #topNavbar #btnExport *{color:inherit!important;opacity:1!important}

/* ---------- 右侧浮条、页码条、缩放条 ---------- */
html.dark body:not(.theme-light) :is(#gbAppRail,#geoToolsDock){background:#202124!important;border:1px solid rgb(255 255 255 / .10)!important;box-shadow:0 2px 6px rgb(0 0 0 / .3)!important;color:#E8EAED!important}
html.dark body:not(.theme-light) :is(#gbAppRail,#geoToolsDock) button{background:transparent!important;color:#E8EAED!important}
html.dark body:not(.theme-light) :is(#gbAppRail,#geoToolsDock) button:hover{background:#303134!important}
html.dark body:not(.theme-light) #s1BottomBar{background:#202124!important;border-top:1px solid rgb(255 255 255 / .08)!important}

/* ---------- 空白引导卡：1px 浅描边，不抢眼 ---------- */
html.dark body:not(.theme-light) .roles-quick-item{border-width:1px!important;border-color:rgb(255 255 255 / .16)!important}
html.dark body:not(.theme-light) .roles-quick-item:hover{border-color:rgb(255 255 255 / .32)!important}

/* ---------- 桌面顶栏只放整份作品的事（3.1）：录制、课堂互动、语言进「⋯」 ---------- */
html.s1.s1.s1 body #topNavbar#topNavbar :is(#btnRecordLesson,#r4Classroom,#btnLangDropdown){display:none!important}

/* ---------- 「⋯」菜单：手机专用项桌面不显示 ---------- */
@media (min-width:768px){#s1TopMenu [data-s1-mobile-only]{display:none!important}#s1TopMenu#s1TopMenu :is([data-for=btnRecordLesson],[data-for=r4Classroom],[data-for=btnLangDropdown],[data-for=lecture-toolbar-btn]){display:flex}}

/* ---------- 手机外框（PRODUCT-UX-ARCH 3.2）---------- */
@media (max-width:767.98px){
  /* 没有工具底栏：工具全在圆盘（选择·画笔·橡皮·3D·学科·全部），撤销/重做在页码条左侧 */
  html.s1 body #leftSidebar{display:none!important}
  :root:root:root{--s1-tools:0px}
  /* 撤销/重做贴页码条左侧：页码按钮整体右移，两者不重叠（否则防遮挡会把撤销条藏掉） */
  html.s1.s1 body #pageManagerDock{padding-left:100px!important}
  /* 顶栏只留 ☰ · 作品名 · 一键成课 · ⋯ · 账户；其余进「⋯」 */
  html.s1.s1.s1.s1.s1 body #topNavbar#topNavbar .redesign-end > :not(#r4LessonToolbar):not(#s1TopMore):not(#topAccountButton){display:none!important}
  html.s1.s1.s1.s1.s1 body #topNavbar#topNavbar .redesign-start > #btnLangDropdown{display:none!important}
  html.s1.s1.s1.s1.s1 body #topNavbar#topNavbar #r4LessonToolbar{display:inline-flex!important;height:36px;min-height:36px!important;padding:0 14px!important;border-radius:8px!important;white-space:nowrap;font-size:14px}
  html.s1.s1.s1.s1.s1 body #topNavbar#topNavbar #redesignWorkName{display:block!important;flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  /* 欢迎区法律页脚在黑板上要看得清（M6） */
  html.dark body:not(.theme-light) .workspace-legal-footer,html.dark body:not(.theme-light) .workspace-legal-footer a{color:#9AA0A6!important}
}

/* ---------- 桌面左侧模块栏 64px（PRODUCT-UX-ARCH v2 §2.7） ---------- */
#leftSidebar {
  position: fixed !important;
  left: 0 !important;
  top: 52px !important;
  bottom: 0 !important;
  width: 64px !important;
  background: var(--chrome-bg-dark, #18181b) !important;
  border-right: 1px solid var(--chrome-line-dark, #2f3033) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  z-index: var(--layer-stack-45, 450) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  padding: 8px 0 !important;
  gap: 4px !important;
  box-sizing: border-box !important;
}
@media (max-width: 767.98px) {
  #leftSidebar {
    display: none !important;
  }
}
.rail-module-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 52px;
  height: 52px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--chrome-ink-light, #e8eaed);
  font: 500 11px/1.2 var(--font-ui, system-ui);
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.rail-module-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.rail-module-btn:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 1px;
}
.rail-module-btn svg {
  color: #9aa0a6;
}
.rail-module-btn:hover svg {
  color: #4285f4;
}

/* 删掉侧栏未展开时的外壳按钮与 app-shell 模块重复 */
.as-modules { display: none !important; }
html.app-shell-ready:not(.app-shell-open) .app-shell { display: none !important; }

@media (min-width:768px){
  :root:root:root{--s1-rail-w:64px}
  /* 顶栏不放品牌（设计稿 ⑤），官方横版 logo 在侧栏左上角 */
  html.app-shell-ready body #topNavbar #redesignSidebar{display:none!important}
}
@media (max-width:767.98px){
  .as-modules{display:none!important}
  /* 浮层互相避让，圆盘完整可见：Cookie 条移到顶栏下方；「尺规/三视图」浮条不在手机常驻（UX-ARCH 2.1 删 #geoToolsDock，尺规在学科面板、三视图在对象圆弧）；
     欢迎区法律页脚不压在黑板上（侧栏抽屉底部仍有完整页脚） */
  html.s1.s1 body #cookieBanner#cookieBanner.cookie-banner:not(.is-dot){top:calc(var(--s1-top) + 8px)!important;bottom:auto!important;left:12px!important;right:12px!important;width:auto!important;max-width:none!important;transform:none!important}
  html.s1 body #geoToolsDock{display:none!important}
  #rolesQuickStart .workspace-legal-footer,.roles-quick .workspace-legal-footer{display:none!important}
}

/* ---------- 「从这里开始」不挡第一笔：容器不接事件，只有卡片和链接接；卡片上起笔仍由 quick-start.js 转交画板 ---------- */
.roles-quick{pointer-events:none!important}
.roles-quick :is(.roles-quick-item,a,button){pointer-events:auto}

/* ---------- 侧栏始终是设计稿 ⑤ 的暖米白（黑板深色不带上侧栏）；官方横版 logo 的深色字才看得清 ---------- */
html body .app-shell.app-shell{--surface:#FFFFFF;--surface-soft:#F7F7F8;--surface-hover:#ECECEE;--surface-raised:#FFFFFF;--ink:#1F1E1D;--muted:#6B6B70;--line:#E5E5E7;--state-active-bg:#ECECEE;--state-active-fg:#1F1E1D;background:#FFFFFF!important;color:#1F1E1D!important;border-color:#E5E5E7!important}

/* ---------- 桌面 Cookie 卡放左下角（贴侧栏右边），不和居中的圆盘、右侧浮条撞 ---------- */
@media (min-width:768px){
  html.s1.s1 body #cookieBanner#cookieBanner.cookie-banner:not(.is-dot){left:calc(var(--s1-shell, 52px) + 16px)!important;right:auto!important;transform:none!important}
  html.s1.s1.app-shell-open body #cookieBanner#cookieBanner.cookie-banner:not(.is-dot){left:calc(var(--app-shell-w, 260px) + 16px)!important}
}

/* ---------- 库面板（模型库 / 公式库 / 插入，同一 UILibrary 组件）在黑板上走深色（设计稿 ⑨） ---------- */
html.dark body:not(.theme-light) :is(#geometry-model-dialog,#formulaModal,#mediaMenu,.ui-library).ui-library.ui-library.ui-library.ui-library.ui-library{--lib-bg:#202124;--lib-card:#303134;--lib-ink:#E8EAED;--lib-muted:#9AA0A6;--lib-line:rgb(255 255 255 / .10);--lib-soft:#303134;border-radius:16px!important;box-shadow:0 2px 6px rgb(0 0 0 / .3)!important}
html.dark body:not(.theme-light) :is(#geometry-model-dialog,#formulaModal,#mediaMenu,.ui-library).ui-library.ui-library.ui-library.ui-library.ui-library button:is([aria-pressed=true],[aria-selected=true]){color:#202124!important}

/* ---------- 桌面顶栏左上角：官方横版 logo（白字版，深色顶栏） ---------- */
#topbarLogo{display:none}
@media (min-width:768px){
  html body #topNavbar #topbarLogo{display:flex;align-items:center;flex:none;height:36px;padding:0 8px 0 4px;margin-right:4px}
  html body #topNavbar #topbarLogo img{display:block;height:22px;width:auto}
}

/* 工具懒加载超过 300ms：按钮右上角小转圈（assets/features/startup/index.js 设 data-tool-loading） */
[data-tool-loading]{position:relative}
[data-tool-loading]::after{content:"";position:absolute;top:2px;right:2px;width:10px;height:10px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;opacity:.75;animation:startup-tool-spin .7s linear infinite;pointer-events:none}
@keyframes startup-tool-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){[data-tool-loading]::after{animation:none}}
