/* Presentation controls use the shared design tokens. */
html body #workbenchWrapper {
  min-height: 0;
  overflow-anchor: none;
  overscroll-behavior: none;
  scroll-margin-top: var(--space-14);
  touch-action: none;
}
#mainCanvas,
#threeLayer,
#canvasCard {
  touch-action: none;
  overflow-anchor: none;
}
html body #t1021ToolOpts {
  left: var(--brush-options-left, calc(var(--redesign-offset, 0px) + 80px)) !important;
  right: auto !important;
  top: var(--brush-options-top, 136px) !important;
  transform: none !important;
  width: var(--brush-options-width, 216px);
  max-height: var(--brush-options-height, 220px) !important;
  overflow: auto;
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: var(--space-2);
  box-shadow: var(--shadow-panel);
}
html body #t1021OptsBody {
  font-size: 12px;
  line-height: 1.25;
}
html body #t1021OptsBody > * + * {
  margin-top: var(--space-1);
}
.color-dot {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px;
  padding: 0 !important;
  border: 1px solid var(--n-400) !important;
  border-radius: 50%;
  cursor: pointer;
}
.color-dot:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.followup-popover {
  position: fixed;
  z-index: var(--layer-stack-1001);
  box-sizing: border-box;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-panel);
  padding: var(--space-3);
  width: 280px;
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 128px);
  overflow: auto;
  font: 13px/1.5 var(--font-ui);
}
.followup-popover [hidden] {
  display: none !important;
}
.followup-popover h4 {
  font-size: 12px;
  color: var(--muted);
  margin: var(--space-2) 0;
}
.color-grid {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.followup-popover button:not(.color-dot) {
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--ink);
  margin: var(--space-1);
}
.followup-popover label {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  justify-content: space-between;
  margin: var(--space-2) 0;
  cursor: ew-resize;
}
.followup-popover input[type="number"] {
  width: 120px;
  background: var(--surface-hover);
  color: var(--ink);
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.followup-popover input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  padding: var(--space-1);
  color: var(--ink);
  background: var(--surface-hover);
}
.object-popover {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.object-context {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-1);
}
#redesignContext .object-context button {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: transparent;
  padding: var(--space-1) var(--space-2);
  font-size: 13px;
}
#redesignContext .object-context svg {
  width: 18px;
  height: 18px;
}
#redesignContext .object-context button:first-child svg {
  fill: var(--object-color);
}
#redesignContext .object-context button:hover,
#redesignContext .object-context button[aria-pressed="true"] {
  background: var(--state-active-bg);
  color: var(--state-active-fg);
}
html body #redesignContext:has(.object-context) {
  background: var(--n-0);
  color: var(--n-900);
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  overflow-x: auto;
  overflow-y: hidden;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  box-sizing: border-box;
}
html body #redesignContext:has(.object-context) button {
  color: var(--n-900);
}
html body:not(.theme-light) #redesignContext:has(.object-context) {
  background: var(--surface);
  color: var(--ink);
}
html body:not(.theme-light) #redesignContext:has(.object-context) button {
  color: var(--ink) !important;
}
html body:not(.theme-light) #redesignContext:has(.object-context) button:hover,
html body:not(.theme-light) #redesignContext:has(.object-context) button[aria-pressed="true"] {
  background: var(--state-active-bg);
  color: var(--state-active-fg) !important;
}
.object-size-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border: 1px solid var(--selection-border);
  background: var(--handle-white);
  border-radius: 50%;
  pointer-events: auto;
  cursor: nwse-resize;
  touch-action: none;
}
.object-rotate-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--handle-white);
  color: var(--n-900);
  display: grid;
  place-items: center;
  cursor: grab;
  z-index: var(--layer-stack-32);
  touch-action: none;
  user-select: none;
}
#ai-assistant-bar [hidden] {
  display: none !important;
}
#ai-listening {
  font-size: 12px;
  color: var(--state-active-fg);
  white-space: nowrap;
}
#ai-voice-stop {
  width: auto !important;
  font-size: 12px !important;
}
html body #pageManagerDock {
  position: fixed !important;
  bottom: 12px !important;
  left: calc(
    var(--app-shell-offset, 0px) + (100vw - var(--app-shell-offset, 0px)) / 2
  ) !important;
  transform: translateX(-50%) !important;
  max-width: calc(100vw - var(--app-shell-offset, 0px) - 168px);
  border-radius: var(--radius-card) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-panel);
  padding: var(--space-2) !important;
  overflow: visible;
  gap: var(--space-2);
  border: 1px solid var(--line) !important;
  z-index: var(--layer-stack-41);
}
.page-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  max-width: 100%;
  padding: var(--space-1);
  overscroll-behavior: contain;
}
.page-thumb-wrap {
  position: relative;
  flex: none;
}
.page-thumb {
  width: 100px;
  height: 68px;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: var(--space-1);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 11px;
  background: var(--surface-hover);
  color: var(--ink);
}
.page-thumb[aria-current="true"] {
  border-color: var(--state-active-border);
  background: var(--state-active-bg);
}
.page-thumb canvas,
.page-thumb .page-thumb-placeholder {
  width: 90px;
  height: 46px;
  object-fit: contain;
  border-radius: 3px;
}
/* 当前页 ±1 以外的页：滚进视野前只放占位（assets/platform/page-window.js） */
.page-thumb .page-thumb-placeholder { display: block; background: var(--surface-hover); }
.page-thumb-menu {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 12px;
  width: 20px;
  height: 18px;
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-radius: 4px;
}
#pageManagerDock.collapsed .page-strip,
#pageManagerDock.collapsed #btnAddPage {
  display: none !important;
}
#pageManagerDock #pageIndicator {
  color: var(--ink) !important;
  white-space: nowrap;
  min-width: 42px;
  text-align: center;
}
#pageManagerDock #btnAddPage {
  flex: none;
  width: 32px;
  height: 40px;
  border-radius: 6px;
  background: var(--btn-secondary-bg) !important;
  color: var(--btn-secondary-fg) !important;
  border: 1px solid var(--btn-secondary-border) !important;
  font-size: 24px;
  padding: 0 !important;
}
#pageManagerDock #btnPrevPage,
#pageManagerDock #btnNextPage,
#pageStripToggle {
  min-width: 24px;
  min-height: 28px;
  background: transparent !important;
  color: var(--ink) !important;
}
.page-undo {
  position: fixed;
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  transform: translateX(-50%);
  z-index: var(--layer-stack-40);
  display: flex;
  align-items: center;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  white-space: nowrap;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-panel);
  border-radius: var(--radius-md);
  pointer-events: auto;
}
.page-undo button {
  color: var(--state-active-fg);
  margin-left: var(--space-3);
}
@keyframes page-next {
  from {
    opacity: 0.75;
    transform: translateX(calc(var(--page-direction, 1) * 12px));
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
#mainCanvas.page-transition,
#threeLayer.page-transition {
  animation: page-next 0.16s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  #mainCanvas.page-transition,
  #threeLayer.page-transition {
    animation: none;
  }
}
@media (max-width: 640px) {
  html body #pageManagerDock {
    left: calc(50vw + 34px) !important;
    max-width: calc(100vw - 100px);
  }
  .page-thumb {
    width: 76px;
    height: 58px;
  }
  .page-thumb canvas,
  .page-thumb .page-thumb-placeholder {
    width: 68px;
    height: 38px;
  }
  html body #t1021ToolOpts {
    top: var(--brush-options-top, 122px) !important;
  }
  #ai-listening {
    max-width: 50px;
    overflow: hidden;
  }
}

html body #formula-actions,
html body #formula-suggest {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
html body #formula-actions button,
html body #formula-suggest button {
  background: var(--btn-secondary-bg) !important;
  color: var(--ink) !important;
  border-color: var(--btn-secondary-border) !important;
}
html body #formula-actions p,
html body #formula-suggest p {
  color: var(--state-active-fg) !important;
}

html[data-page-presentation] #canvasCard {
  cursor: pointer;
}

/* Leave the zoom controls their own lane when the page strip grows. */
@media (min-width:1025px) {
  html body #pageManagerDock { max-width:calc(100vw - var(--app-shell-offset,0px) - 520px); }
}
@media (max-width:1024px) {
  html body #zoomDock { bottom:calc(var(--command-bottom,108px) + 64px)!important; }
}

/* Review followups: shared safe anchors and keyboard focus, without chrome overlap. */
html.app-shell-mobile.app-shell-open #t1021ToolOpts {visibility:hidden;pointer-events:none}
#redesignContext .brush-width-control {display:inline-flex;align-items:center;gap:var(--space-1);margin:0;padding:var(--space-1) var(--space-2);border-radius:var(--radius-sm);background:var(--surface-hover);font-size:13px;white-space:nowrap}
html body #redesignContext #contextBrushWidth {width:46px;min-width:0;padding:0 var(--space-1);border:0;background:transparent;color:var(--ink);outline:none!important;box-shadow:none!important;font:inherit}
html[data-input-modality="keyboard"] body #redesignContext #contextBrushWidth:focus-visible {outline:2px solid var(--focus-ring)!important;outline-offset:2px}
html body #workspaceFiles #sb-wall-btn {position:static;display:flex;z-index:auto;margin:0;border-radius:var(--radius-sm)}
html body #workspaceFiles #redesignPresent {position:static;box-shadow:none;margin:0;z-index:auto}
#redesignFile svg {flex:none}
.mobile-view-controls {display:none}
.page-thumb.is-dragging {opacity:.5}
.page-thumb.is-drop-target {border-color:var(--snap-guide);box-shadow:0 0 0 2px var(--state-active-bg)}
@media(max-width:640px){
 html body #topNavbar .redesign-start {gap:var(--space-1);min-width:0}
 html body #topNavbar .redesign-end {gap:var(--space-1)}
 html body #topNavbar #redesignWorkName {flex:1;width:auto;min-width:0;max-width:140px}
 html body #topNavbar #redesignFile .nav-file-label,html body #topNavbar #btnExport span {display:none!important}
 html body #topNavbar #redesignFile,html body #topNavbar #btnExport {flex:none;width:32px;padding:var(--space-2)!important}
 html body #pageManagerDock .page-thumb-menu {width:20px!important;height:20px!important;min-width:20px!important;min-height:20px!important;max-width:20px!important;padding:0!important;right:3px;top:3px;bottom:auto;line-height:20px;visibility:hidden;pointer-events:none}
 html body #pageManagerDock .page-thumb-wrap:has(.page-thumb[aria-current="true"]) .page-thumb-menu,html body #pageManagerDock .page-options-visible .page-thumb-menu {visibility:visible;pointer-events:auto}
 html body #workspaceTools #zoomDock {position:static!important;inset:auto!important;transform:none!important;scale:1;box-shadow:none!important;width:100%;display:flex;flex-wrap:wrap;justify-content:center;margin:0;padding:var(--space-2)!important;z-index:auto}
 .mobile-view-controls {display:block;border-bottom:1px solid var(--line);padding-bottom:var(--space-2);margin-bottom:var(--space-2)}
}
#ttsCaption:not([hidden]){position:fixed;left:50%;bottom:calc(164px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:var(--layer-stack-90);display:flex;align-items:center;gap:var(--space-2);width:max-content;max-width:min(640px,calc(100vw - 32px));padding:var(--space-2) var(--space-3);border-radius:12px;background:var(--surface-soft);color:var(--ink);box-shadow:0 8px 24px var(--shadow-ink)}
html.s1 #ttsCaption:not([hidden]){bottom:calc(var(--s1-bottom) + 116px)}
html.s1.s1-has-sel #ttsCaption:not([hidden]){bottom:calc(var(--s1-bottom) + 160px)}
@media (min-width:768px){html.s1.s1-has-sel #ttsCaption:not([hidden]){bottom:calc(var(--s1-bottom) + 160px)}}
@media (max-width:767.98px){
  #ttsCaption:not([hidden]){bottom:calc(188px + env(safe-area-inset-bottom))}
  html.s1 #ttsCaption:not([hidden]){left:12px;right:72px;width:auto;max-width:none;transform:none;bottom:calc(var(--s1-bottom) + 104px)!important}
  html.s1.s1-has-sel #ttsCaption:not([hidden]){bottom:calc(var(--s1-bottom) + 152px)!important}
}
#ttsCaption .tts-ai,#ttsCaption [data-tts-badge]{white-space:nowrap!important;flex:none!important;flex-shrink:0!important;max-width:86px;overflow:hidden;text-overflow:ellipsis;line-height:1.2}
#ttsCaption [data-tts-line]{margin:0;font-size:16px;line-height:1.45;flex:1 1 auto;min-width:0}
#ttsCaption [data-tts-stop]{flex:none;border:0;border-radius:8px;background:transparent;color:inherit;padding:var(--space-1) var(--space-2);white-space:nowrap}
html[data-input-modality="keyboard"] #ttsCaption [data-tts-stop]:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}

/* Keep status/actions together; the script and service explanation each get a
   full-width row instead of five flex items competing on a narrow phone. */
@media (max-width:767.98px), (hover:none) and (pointer:coarse) {
  html.s1 body #ttsCaption:not([hidden]) {
    display:grid;grid-template-columns:minmax(0,1fr) auto auto;
    width:auto;max-width:640px;box-sizing:border-box;
    left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));
    margin-inline:auto;transform:none;gap:8px;
    max-height:calc(100dvh - var(--s1-top) - var(--s1-bottom) - 24px);overflow:auto;
  }
  html.s1 body #ttsCaption [data-tts-badge] { grid-column:1;grid-row:1;max-width:none;min-width:0;font-size:13px; }
  html.s1 body #ttsCaption [data-tts-retry] { grid-column:2;grid-row:1; }
  html.s1 body #ttsCaption [data-tts-stop] { grid-column:3;grid-row:1; }
  html.s1 body #ttsCaption :is([data-tts-retry],[data-tts-stop]) {
    min-width:44px;min-height:44px;padding:6px 8px;border:1px solid var(--line);
    border-radius:8px;background:transparent;color:inherit;font:inherit;white-space:nowrap;
  }
  html.s1 body #ttsCaption [data-tts-line] { grid-column:1/-1;grid-row:2;overflow-wrap:anywhere; }
  html.s1 body #ttsCaption [data-tts-reason] { grid-column:1/-1;grid-row:3;min-width:0;overflow-wrap:anywhere;font-size:13px;line-height:1.5; }
}
