/* Rail presentation only; existing AI and Gallery nodes keep their handlers. */
.editor-page #editor-additional-launchers { display: grid; flex: none; gap: 6px; width: 100%; }
.editor-page .editor-additional-launcher {
  display: grid; grid-template-columns: minmax(0,1fr); place-items: center; align-content: center; gap: 2px;
  width: 100%; height: 52px; min-height: 52px; padding: 4px; border: 1px solid #555; border-radius: 6px;
  background: #111; color: #ddd; font: 8px/1.25 system-ui,sans-serif; cursor: pointer;
}
.editor-page .editor-additional-launcher svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.editor-page .editor-additional-launcher span { width: 100%; text-align: center; pointer-events: none; }
.editor-page .editor-additional-launcher:hover:not(:disabled) { background: #191919; border-color: #888; color: #fff; box-shadow: 0 0 10px #ffffff2b; }
.editor-page .editor-additional-launcher[aria-pressed=true] { border-color: #aaa; color: #fff; box-shadow: 0 0 9px 1px #ffffff70,0 0 17px 2px #ffffff48,0 0 25px #ffffff25; }
.editor-page .editor-additional-launcher:disabled { cursor: default; opacity: .45; }
.editor-page :is(.editor-additional-launcher,#editor-smart-preview-navigation button):focus-visible { outline: 2px solid #ddd; outline-offset: 2px; }
.editor-page #editor-smart-preview-navigation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; width: 60px; margin-inline: auto; }
.editor-page #editor-smart-preview-navigation button { display: grid; place-items: center; min-width: 28px; height: 32px; padding: 0; border: 1px solid #444; border-radius: 5px; background: #141414; color: #f5f5f5; font: 27px/1 system-ui,sans-serif; cursor: pointer; }
.editor-page #editor-smart-preview-navigation button[aria-disabled=true] { color: #666; border-color: #303030; background: #111; cursor: default; }
.editor-page #editor-smart-preview-navigation button[aria-disabled=false]:hover { color: #fff; border-color: #999; box-shadow: 0 0 9px #ffffff45; }
@media (max-height: 640px) {
  .editor-page[data-editor-presentation=standard] .tool-rail { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: none; }
  /* Keep the established tool grid usable, with the lower shortcuts reachable
     by rail scrolling instead of squeezing the toolbar down to one row. */
  .editor-page[data-editor-presentation=standard] #editor-toolbar-content { min-height: 440px; flex-shrink: 0; }
}
.editor-page[data-editor-interaction-owner=tools]:is([data-editor-specific-tool-launcher=elemental],[data-editor-specific-tool-launcher=smart]) #editor-modern-tools { box-shadow: none; }

.editor-page[data-editor-presentation=modern] {
  --editor-launcher-size: 52px;
  --editor-launcher-start: 54px;
  /* Reserve the Smart label/arrows and a clear 24px gap before Gallery. */
  --editor-launcher-step: clamp(84px, calc((100dvh - var(--editor-topbar-height) - var(--editor-launcher-start) - var(--editor-launcher-size) - var(--editor-gallery-rail-height) - 85px) / 4), 112px);
  --editor-launcher-left: calc((var(--editor-rail-width) - var(--editor-launcher-size)) / 2);
  --editor-gallery-rail-height: 148px;
}
.editor-page[data-editor-presentation=modern] #editor-additional-launchers { display: contents; }
.editor-page[data-editor-presentation=modern] :is(#editor-modern-tools,#prometheus-trigger,#ai-region-panel,.editor-additional-launcher) {
  position: fixed; left: var(--editor-launcher-left) !important; right: auto !important; bottom: auto !important;
  width: var(--editor-launcher-size); height: var(--editor-launcher-size); min-width: var(--editor-launcher-size); min-height: var(--editor-launcher-size);
  margin: 0; padding: 0; border-radius: 50%;
}
.editor-page[data-editor-presentation=modern] #editor-modern-tools { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start)); }
.editor-page[data-editor-presentation=modern] #prometheus-trigger { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + var(--editor-launcher-step)) !important; }
.editor-page[data-editor-presentation=modern] #ai-region-panel { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 2 * var(--editor-launcher-step)) !important; }
.editor-page[data-editor-presentation=modern] #editor-elemental-launcher { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 3 * var(--editor-launcher-step)); }
.editor-page[data-editor-presentation=modern] #editor-smart-launcher { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 4 * var(--editor-launcher-step)); }
.editor-page[data-editor-presentation=modern] .editor-additional-launcher { display: grid; grid-template-columns: 1fr; place-items: center; z-index: 40; }
.editor-page[data-editor-presentation=modern] .editor-additional-launcher svg { width: 31px; height: 31px; }
.editor-page[data-editor-presentation=modern] :is(#editor-modern-tools span,.editor-additional-launcher span,#ai-region-title) {
  position: absolute; top: calc(var(--editor-launcher-size) + 5px); left: -10px; width: calc(var(--editor-launcher-size) + 20px);
  color: #ddd; font: 8px/1.2 system-ui,sans-serif; letter-spacing: .025em; text-align: center; white-space: nowrap;
}
.editor-page[data-editor-presentation=modern] #prometheus-trigger::after { top: calc(var(--editor-launcher-size) + 5px); left: -10px; width: calc(var(--editor-launcher-size) + 20px); font-size: 8px; }
.editor-page[data-editor-presentation=modern] :is(#prometheus-trigger,#ai-region-expand) .modern-widget-icon { width: calc(var(--editor-launcher-size) - 6px); height: calc(var(--editor-launcher-size) - 6px); }
.editor-page[data-editor-presentation=modern] #editor-smart-preview-navigation {
  position: fixed; z-index: 40; left: calc((var(--editor-rail-width) - 60px) / 2);
  top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 4 * var(--editor-launcher-step) + var(--editor-launcher-size) + 19px);
  width: 60px; gap: 4px;
}
.editor-page[data-editor-presentation=modern] #toggle-session-gallery {
  top: auto; bottom: 15px; left: calc((var(--editor-rail-width) - 46px) / 2);
  height: var(--editor-gallery-rail-height); max-height: var(--editor-gallery-rail-height); padding: 6px 4px; gap: 6px;
}
.editor-page[data-editor-presentation=modern] #toggle-session-gallery .gallery-tab-label { font-size: 12px; }

@media (max-height: 760px) {
  .editor-page[data-editor-presentation=modern] {
    --editor-launcher-size: 48px; --editor-launcher-start: 48px; --editor-gallery-rail-height: 124px;
    --editor-launcher-step: clamp(70px, calc((100dvh - var(--editor-topbar-height) - var(--editor-launcher-start) - var(--editor-launcher-size) - var(--editor-gallery-rail-height) - 81px) / 4), 100px);
  }
  .editor-page[data-editor-presentation=modern] #toggle-session-gallery { bottom: 11px; }
  .editor-page[data-editor-presentation=modern] #toggle-session-gallery .modern-widget-icon { display: none; }
}
@media (max-height: 640px) {
  .editor-page[data-editor-presentation=modern] {
    --editor-launcher-start: 44px; --editor-gallery-rail-height: 104px;
    --editor-launcher-step: clamp(64px, calc((100dvh - var(--editor-topbar-height) - var(--editor-launcher-start) - var(--editor-launcher-size) - var(--editor-gallery-rail-height) - 69px) / 4), 84px);
  }
  .editor-page[data-editor-presentation=modern] #toggle-session-gallery .gallery-tab-label { font-size: 11px; }
}
/* Short landscape viewports get two comfortable columns, not tiny launchers. */
@media (max-height: 560px), (max-width: 600px) and (max-height: 592px) {
  .editor-page[data-editor-presentation=modern] { --editor-rail-width: 128px; --editor-launcher-start: 44px; --editor-launcher-step: 64px; --editor-launcher-left: 8px; }
  .editor-page[data-editor-presentation=modern] #prometheus-trigger { left: 72px !important; top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start)) !important; }
  .editor-page[data-editor-presentation=modern] #ai-region-panel { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + var(--editor-launcher-step)) !important; }
  .editor-page[data-editor-presentation=modern] #editor-elemental-launcher { left: 72px !important; top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + var(--editor-launcher-step)); }
  .editor-page[data-editor-presentation=modern] #editor-smart-launcher { top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 2 * var(--editor-launcher-step)); }
  .editor-page[data-editor-presentation=modern] #editor-smart-preview-navigation { left: 2px; top: calc(var(--editor-topbar-height) + var(--editor-widget-offset,0px) + var(--editor-launcher-start) + 2 * var(--editor-launcher-step) + var(--editor-launcher-size) + 19px); }
  .editor-page[data-editor-presentation=modern] #toggle-session-gallery { left: 68px; bottom: 13px; width: 56px; height: 56px; max-height: 56px; padding: 6px 4px; }
  .editor-page[data-editor-presentation=modern] #toggle-session-gallery .gallery-tab-label { writing-mode: horizontal-tb; white-space: normal; font-size: 10px; line-height: 1.2; text-align: center; }
}

/* Center the chevron strokes; launcher placement stays unchanged. */
.editor-page #editor-smart-preview-navigation button { font-size:0; position:relative; }
.editor-page #editor-smart-preview-navigation button::before {
 content:""; display:block; position:absolute; inset:0; margin:auto; box-sizing:border-box; width:10px; height:10px;
 border-left:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:translateX(3px) rotate(45deg);
}
.editor-page #editor-smart-preview-navigation #editor-smart-preview-next::before { transform:translateX(-3px) rotate(225deg); }
