/* AlcorPhoto Studio workspace: tool palette, options bar, viewport, dock panels. */

.ap-editor-page[data-studio] {
  --aps-pasteboard: #181b21;
  --aps-panel: #10151d;
  --aps-panel-2: #151b25;
  --aps-line: rgba(255, 255, 255, 0.1);
  --aps-text: #e8edf4;
  --aps-muted: #95a4b5;
  --aps-accent: #8ab8ff;
  --aps-accent-strong: #2f6fdd;
  --aps-danger: #ffb2b2;
}

/* ---------------------------------------------------------------- layout */

@media (min-width: 901px) {
  .ap-editor-page[data-studio] .ap-grid {
    grid-template-columns: 58px minmax(0, 1fr) 340px;
    grid-template-areas: "tools canvas side";
    align-items: start;
  }
  .ap-editor-page[data-studio] .ap-toolbar { grid-area: tools; position: sticky; top: 8px; }
  .ap-editor-page[data-studio] .ap-canvas-panel { grid-area: canvas; }
  .ap-editor-page[data-studio] .ap-sidebar {
    grid-area: side;
    position: sticky;
    top: 8px;
    max-height: calc(100vh - 16px);
    overflow: auto;
    overscroll-behavior: contain;
  }
  .ap-editor-page[data-studio] .ap-canvas-viewport { height: max(420px, calc(100vh - 330px)); }
}

/* Compact chrome on precise pointers so the canvas gets the room. */
@media (min-width: 901px) and (pointer: fine) {
  .ap-editor-page[data-studio] .aa-appbar { padding-top: 6px; padding-bottom: 6px; margin-bottom: 8px; }
  .ap-editor-page[data-studio] .aa-appbar button,
  .ap-editor-page[data-studio] .aa-appbar .aa-file-button,
  .ap-editor-page[data-studio] .aa-appbar input,
  .ap-editor-page[data-studio] .ap-editor-controls button,
  .ap-editor-page[data-studio] .ap-canvas-tools button,
  .ap-editor-page[data-studio] .ap-canvas-tools select,
  .ap-editor-page[data-studio] .ap-canvas-tools .aa-file-button,
  .ap-editor-page[data-studio] .ap-layer-actions button,
  .ap-editor-page[data-studio] .ap-add-tools button,
  .ap-editor-page[data-studio] .ap-layers-panel .aa-panel-heading button {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 12px;
  }
  .ap-editor-page[data-studio] .ap-editor-controls { padding: 4px 8px; margin-bottom: 8px; }
  .ap-editor-page[data-studio] .ap-canvas-tools { padding: 5px 10px; }
}

.ap-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}
.ap-editor-page[data-studio] .ap-sidebar .ap-inspector {
  grid-column: auto;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 901px) and (max-width: 1180px) {
  .ap-editor-page[data-studio] .ap-grid {
    grid-template-columns: 58px minmax(0, 1fr) 290px;
  }
}

/* ---------------------------------------------------------------- viewport */

.ap-editor-page[data-studio] .ap-canvas-viewport {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  min-height: 420px;
  background: var(--aps-pasteboard);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ap-editor-page[data-studio] #ap-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  box-shadow: none;
  background: transparent;
  cursor: default;
  z-index: 1;
}

.ap-editor-page[data-studio] #ap-canvas[data-missing-sources]:not([data-missing-sources="0"]) {
  outline: 2px dashed #e4aa6b;
  outline-offset: -4px;
}

.ap-doc-underlay {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background-color: #cfd3d8;
  background-image: linear-gradient(45deg, #9ea4ab 25%, transparent 25%), linear-gradient(-45deg, #9ea4ab 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #9ea4ab 75%), linear-gradient(-45deg, transparent 75%, #9ea4ab 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.6);
}

.ap-studio-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.ap-brush-cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.ap-canvas-viewport[data-tool="move"] { cursor: move; }
.ap-canvas-viewport[data-tool="marquee"],
.ap-canvas-viewport[data-tool="lasso"],
.ap-canvas-viewport[data-tool="wand"],
.ap-canvas-viewport[data-tool="crop"],
.ap-canvas-viewport[data-tool="eyedropper"],
.ap-canvas-viewport[data-tool="fill"],
.ap-canvas-viewport[data-tool="heal"] { cursor: crosshair; }
.ap-canvas-viewport[data-tool="brush"],
.ap-canvas-viewport[data-tool="eraser"],
.ap-canvas-viewport[data-tool="clone"] { cursor: none; }
.ap-canvas-viewport[data-tool="type"] { cursor: text; }
.ap-canvas-viewport[data-tool="zoom"] { cursor: zoom-in; }
.ap-canvas-viewport[data-tool="hand"],
.ap-canvas-viewport[data-hand="true"] { cursor: grab; }
.ap-canvas-viewport[data-panning="true"] { cursor: grabbing; }
.ap-canvas-viewport[data-tool] #ap-canvas { cursor: inherit; }

.ap-ruler {
  position: absolute;
  z-index: 4;
  cursor: copy;
}
.ap-ruler-top { top: 0; left: 0; width: 100%; height: 18px; }
.ap-ruler-left { top: 0; left: 0; width: 18px; height: 100%; }

.ap-text-editor {
  position: absolute;
  z-index: 5;
  min-width: 160px;
  min-height: 1.4em;
  transform: translate(-50%, -50%);
  padding: 4px 6px;
  border: 1px dashed rgba(138, 184, 255, 0.9);
  background: rgba(10, 14, 20, 0.35);
  resize: both;
  outline: none;
  field-sizing: content;
}

/* ---------------------------------------------------------------- tool palette */

.ap-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  padding: 6px 5px;
  border: 1px solid var(--aps-line);
  border-radius: 8px;
  background: var(--aps-panel);
  align-self: start;
}

.ap-editor-page .ap-app .ap-tool {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--aps-text);
  font-size: 18px;
  line-height: 1;
}

.ap-tool .ap-tool-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ap-editor-page .ap-app .ap-tool:hover { background: var(--aps-panel-2); }
.ap-editor-page .ap-app .ap-tool[aria-pressed="true"] {
  border-color: rgba(138, 184, 255, 0.55);
  background: #20304a;
  box-shadow: inset 2px 0 var(--aps-accent);
}

.ap-swatches {
  position: relative;
  height: 56px;
  margin-top: 8px;
}

.ap-editor-page .ap-app .ap-swatch {
  position: absolute;
  width: 26px;
  height: 26px;
  min-height: 0;
  padding: 0;
  border: 2px solid #e8edf4;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #000;
}
.ap-editor-page .ap-app .ap-swatch-fg { top: 2px; left: 4px; z-index: 1; }
.ap-editor-page .ap-app .ap-swatch-bg { top: 16px; left: 18px; }
.ap-editor-page .ap-app .ap-swatch-swap,
.ap-editor-page .ap-app .ap-swatch-reset {
  position: absolute;
  min-height: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--aps-muted);
  font-size: 11px;
}
.ap-editor-page .ap-app .ap-swatch-swap { top: 0; right: 0; }
.ap-editor-page .ap-app .ap-swatch-reset { bottom: 0; left: 0; }

/* ---------------------------------------------------------------- options bar */

.ap-options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  min-height: 40px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--aps-line);
  background: var(--aps-panel);
  font-size: 12px;
}

.ap-options-title {
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.ap-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--aps-muted);
  font-size: 11px;
  white-space: nowrap;
}

.ap-opt-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ap-opt-range input[type="range"] { width: 92px; }
.ap-editor-page .ap-app .ap-opt-number,
.ap-editor-page .ap-app .ap-opt input[type="number"] {
  width: 64px;
  min-height: 30px;
  padding: 3px 5px;
  border: 1px solid var(--aps-line);
  border-radius: 4px;
  background: #080b10;
  color: #fff;
}
.ap-editor-page .ap-app .ap-opt select {
  min-height: 30px;
  padding: 3px 6px;
  border: 1px solid var(--aps-line);
  border-radius: 4px;
  background: #080b10;
  color: #fff;
}

.ap-opt-group { display: inline-flex; gap: 2px; }
.ap-editor-page .ap-app .ap-options-bar button,
.ap-editor-page .ap-app .ap-layer-buttons button,
.ap-editor-page .ap-app .ap-dock button,
.ap-editor-page .ap-app .ap-legacy-masks button {
  min-height: 30px;
  padding: 3px 9px;
  font-size: 11px;
}
.ap-editor-page .ap-app .ap-options-bar button[aria-pressed="true"],
.ap-editor-page .ap-app .ap-dock button[aria-pressed="true"] {
  border-color: rgba(138, 184, 255, 0.55);
  background: #20304a;
}
.ap-opt-note { color: var(--aps-muted); font-size: 11px; }

/* ---------------------------------------------------------------- dock */

.ap-dock {
  border: 1px solid var(--aps-line);
  border-radius: 8px;
  background: var(--aps-panel);
  overflow: hidden;
}

.ap-dock-tabs {
  display: flex;
  border-bottom: 1px solid var(--aps-line);
}
.ap-editor-page .ap-app .ap-dock-tabs button {
  flex: 1;
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--aps-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.ap-editor-page .ap-app .ap-dock-tabs button[aria-selected="true"] {
  color: #fff;
  box-shadow: inset 0 -2px var(--aps-accent);
}

.ap-dock-panel {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
  padding: 10px;
}
.ap-dock-panel[hidden] { display: none; }
.ap-dock-note { margin: 0; color: var(--aps-muted); font-size: 11px; }

.ap-prop-heading { margin: 0; color: #fff; font-size: 13px; }
.ap-prop-sub { margin: 4px 0 0; color: var(--aps-muted); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.ap-prop-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ap-adjust { display: grid; gap: 7px; }
.ap-adjust .ap-opt { justify-content: space-between; }
.ap-adjust .ap-opt-range input[type="range"] { width: 120px; }
.ap-histogram,
.ap-curves-canvas {
  width: 100%;
  max-width: 256px;
  border: 1px solid var(--aps-line);
  border-radius: 4px;
  background: #07090e;
}
.ap-curves-canvas { aspect-ratio: 1; touch-action: none; cursor: crosshair; }

.ap-color-targets { display: flex; gap: 4px; }
.ap-color-picker { display: flex; gap: 8px; }
.ap-sb { width: calc(100% - 30px); max-width: 260px; height: 150px; border-radius: 4px; touch-action: none; cursor: crosshair; }
.ap-hue { width: 22px; height: 150px; border-radius: 4px; touch-action: none; cursor: ns-resize; }
.ap-color-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.ap-color-fields label { display: grid; gap: 3px; color: var(--aps-muted); font-size: 10px; }
.ap-color-fields label:first-child,
.ap-native-color { grid-column: 1 / -1; }
.ap-editor-page .ap-app .ap-color-fields input {
  min-height: 30px;
  width: 100%;
  padding: 3px 6px;
  border: 1px solid var(--aps-line);
  border-radius: 4px;
  background: #080b10;
  color: #fff;
  box-sizing: border-box;
}
.ap-recent { display: flex; flex-wrap: wrap; gap: 4px; }
.ap-editor-page .ap-app .ap-recent-swatch {
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 3px;
}

.ap-history { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ap-editor-page .ap-app .ap-history button {
  width: 100%;
  min-height: 28px;
  justify-content: flex-start;
  text-align: left;
  border-color: transparent;
  background: transparent;
}
.ap-editor-page .ap-app .ap-history button[aria-current="step"] { background: #20304a; border-color: rgba(138, 184, 255, 0.5); }
.ap-editor-page .ap-app .ap-history .ap-history-future { opacity: 0.5; }

/* ---------------------------------------------------------------- layers */

.ap-layer-controls {
  display: flex;
  gap: 8px;
  padding: 8px 8px 0;
}
.ap-layer-controls .ap-opt { flex: 1; }
.ap-editor-page .ap-app .ap-layer-controls select { flex: 1; min-width: 0; }

.ap-layer-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.ap-layer-row > .ap-layer { flex: 1; min-width: 0; }
.ap-layer-row.ap-layer-clipped { padding-left: 16px; }
.ap-layer-row.ap-layer-hidden > .ap-layer { opacity: 0.55; }
.ap-editor-page .ap-app .ap-layer-eye {
  width: 28px;
  min-height: 36px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--aps-muted);
  font-size: 13px;
}
.ap-layer-flag {
  flex: none;
  color: var(--aps-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.ap-editor-page .ap-app .ap-layer-mask {
  min-height: 26px;
  padding: 2px 5px;
  border: 1px solid var(--aps-line);
  border-radius: 3px;
  background: #fff;
  color: #000;
}
.ap-editor-page .ap-app .ap-layer-mask[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--aps-accent); }
.ap-editor-page .ap-app .ap-layer-mask.ap-mask-off { background: #555; color: #ddd; text-decoration: line-through; }
.ap-editor-page .ap-app .ap-layer-mask:has(.ap-mask-thumb) { padding: 2px; background: #0b0f15; line-height: 0; }
.ap-mask-thumb { display: block; border-radius: 2px; }
.ap-editor-page .ap-app .ap-layer-mask.ap-mask-off .ap-mask-thumb { opacity: 0.35; }
.ap-layer[data-kind="adjustment"] b { color: #c7a8ff; }

.ap-layer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px 8px;
}
.ap-editor-page .ap-app .ap-layer-buttons select {
  min-height: 30px;
  flex: 1;
  min-width: 0;
  border: 1px solid var(--aps-line);
  border-radius: 4px;
  background: #080b10;
  color: #fff;
  font-size: 11px;
}

/* ---------------------------------------------------------------- menus, dialogs, banners */

.ap-studio-menubar {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  margin-bottom: 8px;
  border: 1px solid var(--aps-line);
  border-radius: 8px;
  background: var(--aps-panel);
}
.ap-studio-menu .aa-menu-panel { max-height: 70vh; overflow: auto; }
.ap-menu-sep { margin: 4px 0; border: 0; border-top: 1px solid var(--aps-line); }

.ap-dialog {
  min-width: min(420px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 1px solid var(--aps-line);
  border-radius: 10px;
  background: var(--aps-panel);
  color: var(--aps-text);
}
.ap-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.ap-dialog form { display: grid; gap: 12px; padding: 16px; }
.ap-dialog h2 { margin: 0; font-size: 15px; }
.ap-dialog-body { display: grid; gap: 10px; }
.ap-dialog-body .ap-opt { justify-content: space-between; }
.ap-dialog-note { margin: 0; color: var(--aps-muted); font-size: 11px; }
.ap-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.ap-anchor-grid { display: grid; grid-template-columns: repeat(3, 28px); gap: 3px; }
.ap-editor-page .ap-anchor-grid button { min-height: 28px; padding: 0; }
.ap-editor-page .ap-anchor-grid button[aria-pressed="true"] { background: var(--aps-accent-strong); }
.ap-shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; max-height: 60vh; overflow: auto; font-size: 12px; }
.ap-shortcuts dt { color: #fff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.ap-shortcuts dd { margin: 0; color: var(--aps-muted); }

.ap-recovery-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(138, 184, 255, 0.45);
  border-radius: 8px;
  background: #13213a;
  color: #fff;
  font-size: 13px;
}
.ap-recovery-banner span { flex: 1 1 280px; }
.ap-recovery-state { color: var(--aps-muted); }
.ap-editor-page .ap-app .ap-recovery-toggle { min-height: 26px; padding: 2px 8px; font-size: 11px; }
.ap-zoom-readout { color: #fff; font-variant-numeric: tabular-nums; }

.ap-legacy-masks {
  border: 1px solid var(--aps-line);
  border-radius: 8px;
  background: var(--aps-panel);
  padding: 8px 10px;
}
.ap-legacy-masks summary { cursor: pointer; color: var(--aps-muted); font-size: 12px; }
.ap-legacy-masks .ap-mask-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------------------------------------------------------------- focus and motion */

.ap-editor-page[data-studio] button:focus-visible,
.ap-editor-page[data-studio] select:focus-visible,
.ap-editor-page[data-studio] input:focus-visible,
.ap-editor-page[data-studio] canvas:focus-visible,
.ap-editor-page[data-studio] summary:focus-visible {
  outline: 2px solid var(--aps-accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- phones and small tablets (lite path) */

@media (max-width: 900px) {
  .ap-editor-page[data-studio] .ap-toolbar {
    order: -3;
    flex-direction: row;
    overflow-x: auto;
    align-self: stretch;
  }
  .ap-editor-page[data-studio] .ap-app .ap-tool { min-width: 44px; min-height: 44px; }
  .ap-editor-page[data-studio] .ap-swatches { flex: none; width: 48px; height: 44px; margin: 0 0 0 6px; }
  .ap-editor-page[data-studio] .ap-canvas-viewport { height: 62vh; min-height: 300px; }
  .ap-options-bar { overflow-x: auto; flex-wrap: nowrap; }
  .ap-dock-panel { max-height: none; }
}

/* The eye button replaces the passive visibility glyph inside each row. */
.ap-editor-page[data-studio] .ap-layer-row > .ap-layer { grid-template-columns: minmax(0, 1fr) auto; }
.ap-editor-page[data-studio] .ap-layer-row > .ap-layer > span:first-child { display: none; }

.ap-layer-thumb {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: #cfd3d8;
  background-image: linear-gradient(45deg, #9ea4ab 25%, transparent 25%), linear-gradient(-45deg, #9ea4ab 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #9ea4ab 75%), linear-gradient(-45deg, transparent 75%, #9ea4ab 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
.ap-layer-row[data-kind="adjustment"] .ap-layer-thumb { background: #2a2140; }

/* Layer groups */
.ap-group-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border-top: 1px solid var(--aps-line);
  padding-top: 4px;
}
.ap-group-row.ap-layer-hidden { opacity: 0.55; }
.ap-editor-page .ap-app .ap-group-twisty {
  width: 24px;
  min-height: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--aps-muted);
}
.ap-editor-page .ap-app .ap-group-name {
  flex: 1;
  display: grid;
  min-width: 0;
  min-height: 34px;
  justify-items: start;
  padding: 4px 8px;
  text-align: left;
  background: #151c28;
}
.ap-group-name strong, .ap-group-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ap-group-name small { color: var(--aps-muted); font-size: 10px; }
.ap-group-row.ap-group-selected .ap-group-name { background: #243044; box-shadow: inset 2px 0 var(--aps-accent); }
.ap-layer-row.ap-layer-in-group { padding-left: 18px; }
.ap-layer-row[hidden] { display: none; }

/* Filter dialogs sit to the side without dimming, so the live preview stays visible. */
.ap-dialog.ap-dialog-side { margin: 96px 24px auto auto; }
.ap-dialog.ap-dialog-side::backdrop { background: transparent; }

@media (min-width: 901px) and (pointer: fine) {
  .ap-editor-page .ap-app .ap-tool { min-height: 32px; font-size: 16px; }
  .ap-toolbar { gap: 2px; }
}

.ap-editor-page[data-studio] .ap-canvas-viewport:focus { outline: none; }
.ap-editor-page[data-studio] .ap-canvas-viewport:focus-visible { outline: 2px solid var(--aps-accent); outline-offset: -2px; }

/* Containment: canvas, overlay, cursor and readout updates never re-lay out the page. */
.ap-editor-page[data-studio] .ap-canvas-viewport { contain: strict; }
.ap-editor-page[data-studio] .aa-statusbar { contain: layout paint; }
.ap-editor-page[data-studio] .ap-zoom-readout { display: inline-block; min-width: 5ch; }
.ap-editor-page[data-studio] .ap-sidebar { contain: layout paint; }
.ap-editor-page[data-studio] .ap-sidebar > .ap-inspector,
.ap-editor-page[data-studio] .ap-sidebar > .ap-legacy-masks { content-visibility: auto; contain-intrinsic-size: auto 600px; }

/* Tool icons, keycap hints, active glow */
.ap-editor-page .ap-app .ap-tool svg { width: 18px; height: 18px; }
.ap-tool .ap-tool-key {
  position: absolute; right: 2px; bottom: 1px;
  font: 700 8px/1 "Segoe UI", system-ui, sans-serif; color: rgba(232, 237, 244, 0.45);
  border: 0; background: none; padding: 0;
}
.ap-editor-page .ap-app .ap-tool { transition: background-color 140ms ease, box-shadow 160ms ease, color 140ms ease, transform 140ms ease; }
.ap-editor-page .ap-app .ap-tool[aria-pressed="true"] {
  color: #53d9d4; border-color: rgba(83, 217, 212, 0.55); background: rgba(83, 217, 212, 0.12);
  box-shadow: inset 2px 0 #53d9d4, 0 0 14px rgba(83, 217, 212, 0.25);
}
.ap-editor-page .ap-app .ap-tool:active { transform: scale(0.94); }
.ap-editor-page .ap-app .ap-swatch-swap svg, .ap-editor-page .ap-app .ap-swatch-reset svg { display: block; margin: auto; }
.ap-group-twisty svg { display: block; margin: auto; }
.ap-layer-clip svg { display: block; }
@media (prefers-reduced-motion: reduce) { .ap-editor-page .ap-app .ap-tool { transition: none; } .ap-editor-page .ap-app .ap-tool:active { transform: none; } }

/* ================================================================ sweep: chrome, empty state, flair */
.ap-editor-page[data-studio] {
  --aps-cyan: #53d9d4;
  --aps-violet: #9b7bff;
  --aps-gold: #f2c46d;
  --aps-ease: cubic-bezier(.2, .7, .2, 1);
}
.ap-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* One row of chrome on desktop: the project row and workspace row fold into the shell and canvas bar. */
@media (min-width: 901px) {
  .ap-editor-page[data-studio] .aa-appbar,
  .ap-editor-page[data-studio] .ap-editor-controls { display: none; }
  .ap-editor-page[data-studio] .ap-canvas-tools > div:not(.ap-actionbar):not(.ap-export-tools) { display: none; }
  .ap-editor-page[data-studio] .ap-canvas-viewport { height: max(440px, calc(100vh - 232px)); }
  .ap-editor-page[data-studio] .ap-layers-panel .ap-add-tools { display: none; }
}
.ap-shell-doc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ap-shell-doc [data-document] { display: none; }
.ap-editor-page .ap-title-input {
  min-width: 8ch; max-width: 36ch; width: auto; min-height: 0 !important;
  padding: 3px 7px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: #fff; font: 700 13px/1.3 "Segoe UI", system-ui, sans-serif;
  field-sizing: content; transition: border-color 140ms ease, background-color 140ms ease;
}
.ap-editor-page .ap-title-input:hover { border-color: rgba(255, 255, 255, 0.14); }
.ap-editor-page .ap-title-input:focus { border-color: var(--aps-cyan, #53d9d4); background: #0b0f15; outline: none; }

.ap-actionbar { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.ap-actionbar .ap-history-actions { display: flex; gap: 2px; margin: 0; }
.ap-editor-page .ap-app .ap-actionbar .ap-history-actions button {
  min-height: 32px; width: 34px; padding: 0; display: grid; place-items: center;
  border-color: transparent; background: transparent; color: var(--aps-text);
}
.ap-editor-page .ap-app .ap-actionbar .ap-history-actions button:not(:disabled):hover { background: var(--aps-panel-2); }
.ap-mode-compact { gap: 0 !important; padding: 2px; border: 1px solid var(--aps-line); border-radius: 6px; }
.ap-mode-compact > span { display: none; }
.ap-editor-page .ap-app .ap-mode-compact button { min-height: 26px; padding: 2px 10px; border: 0; border-radius: 4px; background: transparent; font-size: 11px; box-shadow: none; }
.ap-editor-page .ap-app .ap-mode-compact button[aria-pressed="true"] { background: rgba(83, 217, 212, 0.14); color: var(--aps-cyan, #53d9d4); box-shadow: none; }
.ap-editor-page .ap-app .ap-export-primary {
  background: var(--aps-cyan, #53d9d4) !important; color: #041314 !important; border-color: transparent !important;
  font-weight: 700; transition: filter 140ms ease, transform 140ms ease;
}
.ap-editor-page .ap-app .ap-export-primary:hover { filter: brightness(1.08); }
.ap-editor-page .ap-app .ap-export-primary:active { transform: scale(0.97); }

/* Tooltips with the shortcut (from data-tip; the tool also shows its keycap). */
[data-tip] { position: relative; }
.ap-toolbar .ap-tool[data-tip]::after,
.ap-actionbar [data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 30; pointer-events: none; white-space: nowrap;
  padding: 5px 8px; border-radius: 6px; background: #05070b; color: #e8edf4; border: 1px solid rgba(83, 217, 212, 0.35);
  font: 400 11px/1 "Segoe UI", system-ui, sans-serif; letter-spacing: 0;
  opacity: 0; transform: translateX(-4px); transition: opacity 120ms ease, transform 120ms ease;
}
.ap-toolbar .ap-tool[data-tip]::after { left: calc(100% + 10px); top: 50%; margin-top: -11px; }
.ap-actionbar [data-tip]::after { left: 50%; top: calc(100% + 6px); transform: translate(-50%, -4px); }
.ap-toolbar .ap-tool[data-tip]:hover::after, .ap-toolbar .ap-tool[data-tip]:focus-visible::after { opacity: 1; transform: none; transition-delay: 350ms; }
.ap-actionbar [data-tip]:hover::after, .ap-actionbar [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 350ms; }
@media (max-width: 900px) { .ap-toolbar .ap-tool[data-tip]::after, .ap-actionbar [data-tip]::after { display: none; } }

/* Empty state: an inviting drop zone with samples. */
.ap-empty {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; overflow: auto;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(83, 217, 212, 0.08), transparent 70%),
    radial-gradient(40% 40% at 70% 70%, rgba(155, 123, 255, 0.07), transparent 70%),
    var(--aps-pasteboard);
}
.ap-empty[hidden] { display: none; }
.ap-empty-card {
  width: min(520px, 100%); padding: 28px 28px 22px; text-align: center; color: var(--aps-text);
  border: 1.5px dashed rgba(83, 217, 212, 0.35); border-radius: 6px; background: rgba(8, 11, 16, 0.72);
}
.ap-empty-mark { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--aps-cyan, #53d9d4); background: rgba(83, 217, 212, 0.1); box-shadow: 0 0 30px rgba(83, 217, 212, 0.18); }
.ap-empty h2 { margin: 12px 0 6px; font: 700 20px/1.2 "Segoe UI", system-ui, sans-serif; }
.ap-empty p { margin: 0 auto 16px; max-width: 40ch; color: var(--aps-muted); font-size: 13px; line-height: 1.5; }
.ap-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 18px; }
.ap-editor-page .ap-app .ap-empty-actions button { min-height: 36px; padding: 6px 14px; border-radius: 6px; }
.ap-editor-page .ap-app .ap-empty-open { background: var(--aps-cyan, #53d9d4); color: #041314; border-color: transparent; font-weight: 700; }
.ap-samples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-height: 118px; }
.ap-editor-page .ap-app .ap-sample {
  display: grid; gap: 6px; padding: 6px; min-height: 0; border: 1px solid var(--aps-line); border-radius: 6px;
  background: #0b0f15; color: var(--aps-muted); font-size: 11px; cursor: pointer;
  transition: border-color 150ms ease, transform 150ms var(--aps-ease), box-shadow 150ms ease;
}
.ap-editor-page .ap-app .ap-sample:hover, .ap-editor-page .ap-app .ap-sample:focus-visible { border-color: rgba(83, 217, 212, 0.6); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); color: #fff; }
.ap-sample canvas { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: 4px; display: block; }

/* Whole-window drag highlight. */
.ap-drop-hint { position: absolute; inset: 10px; z-index: 6; display: none; place-items: center; border: 2px dashed var(--aps-cyan, #53d9d4); border-radius: 6px; background: rgba(83, 217, 212, 0.08); color: #fff; pointer-events: none; }
.ap-drop-hint div { display: grid; justify-items: center; gap: 6px; text-align: center; }
.ap-drop-hint svg { color: var(--aps-cyan, #53d9d4); }
.ap-drop-hint span { color: var(--aps-muted); font-size: 12px; }
.ap-drop-active .ap-drop-hint { display: grid; animation: ap-pulse 1.4s ease-in-out infinite; }
@keyframes ap-pulse { 50% { background: rgba(83, 217, 212, 0.14); } }

/* First picture arrives with a short scale-in. */
#ap-canvas.ap-canvas-enter { animation: ap-canvas-in 220ms var(--aps-ease, ease-out); }
@keyframes ap-canvas-in { from { opacity: 0; } to { opacity: 1; } }

/* Toasts. */
.ap-toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.ap-toast {
  display: flex; align-items: center; gap: 8px; max-width: min(460px, calc(100vw - 36px)); padding: 10px 14px;
  border: 1px solid rgba(83, 217, 212, 0.4); border-radius: 6px; background: #0a0f15; color: #e8edf4;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); font: 400 13px/1.3 "Segoe UI", system-ui, sans-serif;
  opacity: 0; transform: translateY(8px); transition: opacity 180ms ease, transform 180ms var(--aps-ease, ease-out);
}
.ap-toast svg { flex: none; color: var(--aps-cyan, #53d9d4); }
.ap-toast-error svg { color: #ff9b9b; }
.ap-toast.ap-toast-in { opacity: 1; transform: none; }

/* Busy: a thin progress sweep over the canvas panel for imports, filters and exports. */
.ap-progress { height: 2px; margin-bottom: -2px; position: relative; z-index: 5; opacity: 0; transition: opacity 150ms ease; background: linear-gradient(90deg, transparent, var(--aps-cyan, #53d9d4), var(--aps-violet, #9b7bff), transparent); background-size: 40% 100%; background-repeat: no-repeat; }
.ap-editor-page[aria-busy="true"] .ap-progress { opacity: 1; animation: ap-progress 1s linear infinite; }
@keyframes ap-progress { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* Panel and tab transitions. */
.ap-editor-page .ap-app .ap-dock-tabs button { transition: color 140ms ease, box-shadow 160ms ease; }
.ap-dock-panel:not([hidden]) { animation: ap-fade 150ms ease; }
.ap-studio-menu .aa-menu-panel { animation: ap-drop 140ms var(--aps-ease, ease-out); }
@keyframes ap-fade { from { opacity: 0; } }
@keyframes ap-drop { from { opacity: 0; transform: translateY(-4px); } }

/* Compact layer actions. */
.ap-editor-page[data-studio] .ap-layer-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.ap-editor-page[data-studio] .ap-app .ap-layer-actions button { min-height: 30px; padding: 3px 4px; font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
  .ap-editor-page[data-studio] *, .ap-editor-page[data-studio] *::after, .ap-toast { animation: none !important; transition: none !important; }
}

.ap-editor-page[data-studio] .ap-canvas-tools > .ap-actionbar { display: flex; flex-direction: row; align-items: center; gap: 12px; }
.ap-editor-page[data-studio] .ap-canvas-tools { padding-top: 4px; padding-bottom: 4px; }
.ap-editor-page[data-studio] .ap-app .ap-export-tools .aa-file-button { background: transparent; border-color: transparent; color: var(--aps-muted); font-size: 11px; }
.ap-editor-page[data-studio] .ap-app .ap-export-tools .aa-file-button:hover { color: #fff; border-color: var(--aps-line); }

/* The viewport's height comes from the rule above, not from flex-basis (it is size-contained). */
.ap-editor-page[data-studio] .ap-canvas-viewport { flex: none; }

/* Phone frame (AlcorFrame, html.af-on): parts it hides with visibility are still laid out.
   Skip their layout until they are shown: closed sheets, the closed menu drawer, and the
   desktop-only project and canvas bars (their buttons stay clickable through the frame's proxies). */
html.af-on .ap-editor-page [data-af-panel]:not(.af-open),
html.af-on:not(.af-drawer-open) .ap-editor-page .aa-shell-menubar,
html.af-on .ap-editor-page .ap-canvas-tools,
html.af-on .ap-editor-page .aa-appbar,
html.af-on .ap-editor-page .aa-shell-titlebar { content-visibility: hidden; }

/* ------------------------------------------------------------------------------------------------
   Flair round (owner 2026-09-29: "give it some flair"). Static finishes plus short press/hover
   feedback. Budget: Segoe UI 400/700 only, SVG only, no animation on idle screens, transitions
   of 180 ms or less on transform/opacity, nothing animated on backdrop-filter/blur/box-shadow,
   and prefers-reduced-motion turns every transition off.
   ------------------------------------------------------------------------------------------------ */
.ap-editor-page .ap-app {
  --apf-sig: linear-gradient(135deg, #53d9d4, #b38cff 60%, #d7b56d);
  --apf-line: rgba(246, 240, 228, .08);
  --apf-ink: #f1f3f7;
}

/* Tool rail: the active tool gets a lit pill and a signature bar; presses give a small squeeze. */
.ap-editor-page .ap-app .ap-tool { position: relative; border-radius: 10px; transition: transform .12s ease, opacity .12s ease; }
.ap-editor-page .ap-app .ap-tool:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, .06); color: var(--apf-ink); }
.ap-editor-page .ap-app .ap-tool[aria-pressed="true"] { background: rgba(83, 217, 212, .13); color: #fff; box-shadow: inset 0 0 0 1px rgba(83, 217, 212, .35); }
.ap-editor-page .ap-app .ap-tool[aria-pressed="true"] svg { color: #7ee8e3; }
.ap-editor-page .ap-app .ap-tool[aria-pressed="true"]::before { content: ""; position: absolute; left: -6px; top: 22%; bottom: 22%; width: 3px; border-radius: 2px; background: var(--apf-sig); }
.ap-editor-page .ap-app .ap-tool:active { transform: scale(.92); }

/* Stage: a quiet vignette and a faint dot field behind the artboard, which floats on a soft shadow. */
.ap-editor-page .ap-app .ap-canvas-viewport {
  background-color: #07090e;
  background-image: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(179, 140, 255, .07), transparent 70%);
}
.ap-editor-page .ap-app .ap-doc-underlay { box-shadow: 0 0 0 1px rgba(246, 240, 228, .09), 0 18px 40px -24px rgba(0, 0, 0, .9); border-radius: 2px; }
/* The dot field and the deep float shadow are desktop-only: on a throttled phone they cost ~120 ms of
   first-load paint (measured 215 -> 335 ms TBT at 390/4x, back to 211 without them). */
@media (min-width: 761px) and (hover: hover) {
  .ap-editor-page .ap-app .ap-canvas-viewport { background-image: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(179, 140, 255, .07), transparent 70%), radial-gradient(rgba(246, 240, 228, .06) 1px, transparent 1.2px); background-size: 100% 100%, 22px 22px; }
  .ap-editor-page .ap-app .ap-doc-underlay { box-shadow: 0 36px 90px -36px rgba(0, 0, 0, .95), 0 0 0 1px rgba(246, 240, 228, .09); }
}

/* Primary action: the signature gradient, bold type, a clean press. */
.ap-editor-page .ap-app .ap-export-primary { background: linear-gradient(135deg, #53d9d4, #8fe3df) !important; color: #04252a !important; font-weight: 700; border-color: transparent !important; transition: transform .12s ease, opacity .12s ease; }

/* Dock tabs: one lit underline in the signature colours instead of boxed buttons. */
.ap-editor-page .ap-app .ap-dock-tabs { border-bottom: 1px solid var(--apf-line); }
.ap-editor-page .ap-app .ap-dock-tabs button { position: relative; background: transparent; border-color: transparent; color: rgba(241, 243, 247, .6); font-weight: 700; }
.ap-editor-page .ap-app .ap-dock-tabs button:hover { color: var(--apf-ink); }
.ap-editor-page .ap-app .ap-dock-tabs button[aria-selected="true"] { background: transparent; color: #fff; }
.ap-editor-page .ap-app .ap-dock-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--apf-sig); }

/* Layers: the selected row carries the signature bar. */
.ap-editor-page .ap-app .ap-layer[aria-pressed="true"], .ap-editor-page .ap-app .ap-layer.is-selected, .ap-editor-page .ap-app .ap-layer[aria-selected="true"] { position: relative; box-shadow: inset 3px 0 0 #53d9d4, inset 0 0 0 1px rgba(83, 217, 212, .28); }

/* Empty state: a gradient hairline around the card, a signature mark, sample cards that lift. */
.ap-editor-page .ap-app .ap-empty-card { border: 1px solid transparent; background: linear-gradient(#0d1018, #0d1018) padding-box, linear-gradient(135deg, rgba(83, 217, 212, .55), rgba(179, 140, 255, .45) 55%, rgba(215, 181, 109, .45)) border-box; box-shadow: 0 40px 100px -50px rgba(0, 0, 0, .95); }
.ap-editor-page .ap-app .ap-empty-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--apf-sig); color: #07090e; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.ap-editor-page .ap-app .ap-sample { transition: transform .16s ease, opacity .16s ease; }
.ap-editor-page .ap-app .ap-sample img { border-radius: 8px; }
.ap-editor-page .ap-app .ap-sample:active { transform: scale(.97); }

/* Toasts: a crisp pill with a cyan edge (the existing slide-in stays). */
.ap-toast { border-radius: 12px; border: 1px solid rgba(83, 217, 212, .28); background: rgba(13, 16, 24, .96); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .9), inset 3px 0 0 #53d9d4; font-weight: 700; }
.ap-toast-error { border-color: rgba(255, 155, 155, .35); box-shadow: 0 18px 44px -18px rgba(0, 0, 0, .9), inset 3px 0 0 #ff9b9b; }

/* Status bar: the zoom reads as a small pill; the rest stays quiet. */
.ap-editor-page .ap-app .ap-zoom-readout { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: var(--apf-ink); font-weight: 700; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .ap-editor-page .ap-app :is(.ap-tool, .ap-export-primary, .ap-sample) { transition: none; }
  .ap-editor-page .ap-app :is(.ap-tool, .ap-sample):active { transform: none; }
}
