/* Compact freeform ideas dock with the existing navigation glass, 2026-10-08.
   VisualViewport geometry remains owned by positionScriptSelectionDock(). */
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-head {
  display:grid;
  grid-template-columns:max-content 64px minmax(0,1fr);
  align-items:center;
  gap:8px;
  min-height:44px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-head>span {
  min-width:0;
  justify-self:end;
  text-align:right;
  white-space:normal;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-optimize {
  width:64px;
  min-height:44px;
  margin:0;
  padding:0 12px;
  border:0;
  border-radius:999px!important;
  background:var(--minimal-soft)!important;
  color:var(--minimal-dark)!important;
  font-family:inherit;
  font-size:14px!important;
  font-weight:600;
  line-height:1.5;
  white-space:nowrap;
  box-shadow:none!important;
  cursor:pointer;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-optimize:focus-visible {
  outline:2px solid var(--minimal-dark)!important;
  outline-offset:2px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-optimize:disabled {
  opacity:.5;
  cursor:wait;
}
@media (hover:hover) {
  html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-optimize:not(:disabled):hover {
    background:var(--minimal-canvas)!important;
  }
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-editor-page .script-part-optimize:not(:disabled):active {
  background:var(--ui-line,#e7e8eb)!important;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock {
  display:grid;
  align-items:stretch;
  gap:4px;
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  padding:8px 12px;
  border:0;
  border-radius:24px;
  background:rgba(255,255,255,.40)!important;
  background-image:none!important;
  color:var(--minimal-ink)!important;
  box-shadow:0 8px 24px rgba(17,19,21,.10),inset 0 1px 0 rgba(255,255,255,.72),0 0 0 1px rgba(17,19,21,.05)!important;
  backdrop-filter:blur(3px) saturate(160%);
  -webkit-backdrop-filter:blur(3px) saturate(160%);
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  min-width:0;
  min-height:36px;
  gap:4px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-head>div:first-child {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  flex:1;
  min-width:0;
  gap:0 6px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-head :is(b,strong) {
  margin:0;
  color:var(--minimal-ink);
  font-size:14px!important;
  font-weight:600;
  line-height:1.5;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-head small {
  color:var(--minimal-ink);
  font-size:11px!important;
  font-weight:400;
  line-height:1.5;
  white-space:nowrap;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button {
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:44px;
  min-height:44px;
  padding:0 10px;
  border:0;
  border-radius:22px;
  background:transparent!important;
  color:var(--minimal-ink)!important;
  font-family:inherit;
  font-size:14px!important;
  font-weight:600;
  line-height:1.5;
  white-space:normal;
  overflow-wrap:anywhere;
  box-shadow:none!important;
  cursor:pointer;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button::before {
  content:none!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock .script-selection-close {
  flex:none;
  width:44px;
  height:44px;
  padding:0;
  background:transparent!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button:focus-visible {
  outline:2px solid var(--minimal-dark)!important;
  outline-offset:-2px;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock textarea.script-selection-instruction {
  box-sizing:border-box;
  display:block;
  width:100%;
  min-width:0;
  max-width:100%;
  min-height:44px;
  max-height:44px;
  height:44px;
  margin:0;
  padding:10px 52px 10px 12px;
  border:0!important;
  border-radius:22px!important;
  background:var(--minimal-paper)!important;
  color:var(--minimal-ink)!important;
  font-family:inherit!important;
  font-size:16px!important;
  font-weight:400;
  line-height:1.5;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  resize:none;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  box-shadow:inset 0 0 0 1px rgba(100,105,112,.35)!important;
  outline:none!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock textarea.script-selection-instruction:is(:focus,:focus-visible) {
  outline:none!important;
  box-shadow:inset 0 0 0 1px rgba(100,105,112,.35)!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock textarea.script-selection-instruction::placeholder {
  color:var(--minimal-dark);
  opacity:1;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock textarea.script-selection-instruction:disabled {
  color:var(--minimal-muted)!important;
  opacity:1;
  cursor:wait;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-head-actions {
  display:flex;
  align-items:center;
  flex-wrap:nowrap;
  flex:none;
  min-width:0;
  gap:0;
  margin-block:-4px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-compose {
  position:relative;
  display:block;
  min-width:0;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"] {
  position:absolute;
  top:0;
  right:0;
  z-index:1;
  width:44px;
  min-width:44px;
  height:44px;
  padding:0;
  border-radius:50%;
  background:transparent!important;
  color:var(--minimal-paper)!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]::after {
  content:"";
  position:absolute;
  inset:5px;
  z-index:0;
  border-radius:50%;
  background:var(--minimal-dark);
  pointer-events:none;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"] svg {
  position:relative;
  z-index:1;
  width:20px;
  height:20px;
  stroke-width:2.25;
  pointer-events:none;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:focus-visible {
  outline-color:var(--minimal-paper)!important;
  outline-offset:-7px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button:disabled {
  background:var(--minimal-paper)!important;
  color:var(--minimal-muted)!important;
  opacity:1;
  cursor:not-allowed;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:disabled {
  background:transparent!important;
  color:rgba(255,255,255,.55)!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock[aria-busy="true"] button:disabled {
  cursor:wait;
}

html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock .script-selection-input-hint {
  min-width:0;
  margin:0;
  color:var(--minimal-ink);
  font-size:11px!important;
  font-weight:400;
  line-height:1.3;
  overflow-wrap:anywhere;
}

/* Keep input and actions visible when the keyboard leaves a short visual viewport. */
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock[data-compact="true"] {
  gap:4px;
  padding:8px 12px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock[data-compact="true"] textarea.script-selection-instruction {
  height:44px;
  min-height:44px;
  max-height:44px;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock[data-compact="true"] .script-selection-input-hint {
  display:block;
}

@media (hover:hover) {
  html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button:not(:disabled):hover {
    background:rgba(255,255,255,.34)!important;
  }
  html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:not(:disabled):hover {
    background:transparent!important;
  }
  html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:not(:disabled):hover::after {
    background:var(--minimal-ink);
  }
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button:not(:disabled):active {
  background:rgba(255,255,255,.50)!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:not(:disabled):active {
  background:transparent!important;
}
html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock button[data-action="script-selection-ai"]:not(:disabled):active::after {
  background:var(--dark-card-floor);
}

@media (prefers-reduced-transparency:reduce), (prefers-contrast:more) {
  html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock {
    background:var(--minimal-paper)!important;
    backdrop-filter:none;
    -webkit-backdrop-filter:none;
  }
}

@supports not ((backdrop-filter:blur(3px)) or (-webkit-backdrop-filter:blur(3px))) {
  html[data-visual-mode="minimal"] body.theme-liquid #appView .selection-command.script-selection-dock {
    background:var(--minimal-paper)!important;
  }
}

/* One reversible surface; the shared spring only scales it, never offsets the keyboard. */
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock{transform-origin:50% 100%}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-selection-dock[data-exiting]{pointer-events:none!important}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-part-optimize{transition:transform 500ms var(--calendar-switch-spring,cubic-bezier(.23,1,.32,1))}
html[data-visual-mode="minimal"] body.theme-liquid #appView .script-part-optimize:not(:disabled):active{transform:scale(.95)}
@media(hover:hover){html[data-visual-mode="minimal"] body.theme-liquid #appView .script-part-optimize:not(:disabled):hover{background:var(--minimal-soft)!important}}
@media(prefers-reduced-motion:reduce){html[data-visual-mode="minimal"] body.theme-liquid #appView .script-part-optimize{transition:none;transform:none!important}}

/* Manual editing also needs enough scroll range below the last line. */
html[data-visual-mode="minimal"] body.theme-liquid #appView:not(.script-selection-active) .script-editor-page:has([data-script-block]:focus){padding-bottom:calc(var(--script-selection-height,0px) + 24px + env(safe-area-inset-bottom,0px))}
