/* Canvas Ambient editor (js/ambient/ambient-canvas-editor.js): toolbar, selection box,
   options panel and add menu drawn over the scene while it is edited. The scene
   underneath is the real renderer (components/AmbientCanvas). */

.ambient-canvas-overlay.is-editing { animation: none; }
.ambient-canvas-overlay.is-editing .ambient-canvas-exit { display: none; }
.ambient-canvas-overlay.is-editing .ambient-canvas-stage { touch-action: none; }
.ambient-canvas-overlay.is-editing .ac-item:not(.ac-off) { cursor: grab; }
.ambient-canvas-overlay.is-editing .ac-item * { pointer-events: none; }

.ace-layer, .ace-bar, .ace-panel, .ace-add {
  --ace-bg: rgba(14, 16, 20, 0.92);
  --ace-line: rgba(255, 255, 255, 0.1);
  --ace-soft: rgba(255, 255, 255, 0.06);
  --ace-text: #eef1f6;
  --ace-dim: rgba(238, 241, 246, 0.62);
  color: var(--ace-text);
  font-family: var(--ui-font, 'Sofia Sans', Inter, system-ui, sans-serif);
  font-size: 13px;
}
.ace-bar [hidden], .ace-panel[hidden], .ace-add[hidden], .ace-sel[hidden] { display: none !important; }

/* Selection: a box over the element, corner handles to resize it. The box lets
   taps through so an element under it can still be picked. */
.ace-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.ace-sel {
  position: absolute;
  outline: 2px solid rgb(var(--accent-rgb, 30, 215, 96));
  outline-offset: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.ace-handle {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: -22px;
  pointer-events: auto;
  touch-action: none;
}
.ace-handle::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-radius: 3px;
  background: #fff;
  border: 2px solid rgb(var(--accent-rgb, 30, 215, 96));
}
.ace-handle-nw { left: 0; top: 0; cursor: nwse-resize; }
.ace-handle-ne { right: 0; top: 0; cursor: nesw-resize; }
.ace-handle-sw { left: 0; bottom: 0; cursor: nesw-resize; }
.ace-handle-se { right: 0; bottom: 0; cursor: nwse-resize; }

/* Toolbar: one row at the bottom (the top when the element is down there). */
.ace-bar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 8;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 6px;
  border: 1px solid var(--ace-line);
  border-radius: 14px;
  background: var(--ace-bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}
.ace-bar.is-top { bottom: auto; top: 12px; }
.ace-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ace-line);
  border-radius: 10px;
  background: var(--ace-soft);
  color: inherit;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.ace-btn svg { width: 18px; height: 18px; flex: none; }
.ace-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.11); }
.ace-btn:focus-visible, .ace-seg-btn:focus-visible, .ace-switch:focus-visible, .ace-day:focus-visible,
.ace-add-item:focus-visible { outline: 2px solid rgb(var(--accent-rgb, 30, 215, 96)); outline-offset: 2px; }
.ace-btn:disabled { opacity: 0.4; cursor: default; }
.ace-btn-icon { padding: 0; }
.ace-btn-save {
  border-color: transparent;
  background: rgb(var(--accent-rgb, 30, 215, 96));
  color: #0b0d10;
}
.ace-btn-save:hover:not(:disabled) { background: rgb(var(--accent-rgb, 30, 215, 96)); filter: brightness(1.08); }
.ace-btn-save { min-width: 72px; }
.ace-btn.is-danger { border-color: rgba(255, 90, 90, 0.45); background: rgba(255, 90, 90, 0.16); }
.ace-btn-quiet { min-height: 36px; background: transparent; }
.ace-pager { display: flex; align-items: center; gap: 2px; }
.ace-page-label { min-width: 84px; text-align: center; color: var(--ace-dim); font-variant-numeric: tabular-nums; }
.ace-status { color: #ff9a9a; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ace-status:empty { display: none; }
/* Narrow toolbars keep the icons and drop the words (Cancel keeps its text: it
   is the one that changes meaning). */
@media (max-width: 760px) {
  .ace-btn-label { display: none; }
  .ace-btn.is-danger .ace-btn-label { display: inline; }
  .ace-btn { padding: 0 10px; }
  .ace-page-label { min-width: 0; font-size: 12px; }
}
