/* View > Layouts: the saved layouts on the left, the square to draw one in on the right. */
#card.layouts-card { height: min(760px, calc(100vh - 32px)); }
.lay-cols { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; flex: 1; min-height: 0; }
.lay-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; border-right: 1px solid var(--border); padding-right: 20px; }
.lay-left .lay-list { flex: 1; max-height: none; }
.lay-list li { cursor: pointer; border: 1px solid transparent; }
.lay-list li.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.lay-list li:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* ✕ deletes a saved layout; it shows while the pointer is over its row. */
.lay-list .del { padding: 4px 8px; font-size: 12px; opacity: 0; }
.lay-list li:hover .del, .lay-list li.sel .del, .lay-list .del:focus-visible { opacity: 0.75; }
.lay-thumb { flex: none; width: 44px; height: 44px; display: flex; }
.lay-thumb .lay-pane { border-width: 1px; border-radius: 3px; margin: 1px; }
.lay-thumb .lay-num { display: none; }
.lay-files { justify-content: flex-start; }
.lay-left .lay-empty { flex: 1; }
.lay-right { display: flex; flex-direction: column; gap: 16px; min-height: 0; min-width: 0; container-type: size; }
.lay-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
/* As large a square as fits, with room for the outer + buttons. */
.lay-square { width: min(calc(100cqw - 56px), calc(100cqh - 120px)); aspect-ratio: 1; display: flex; }
.lay-square > *, .lay-thumb > * { flex: 1; min-width: 0; min-height: 0; }
.lay-split { display: flex; min-width: 0; min-height: 0; }
.lay-split.right { flex-direction: row; }
.lay-split.down { flex-direction: column; }
.lay-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 3px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
  display: grid;
  place-items: center;
}
.lay-num { font-size: 15px; font-weight: 600; color: var(--muted); }
.lay-outer, .lay-add {
  position: absolute;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--accent);
  font: 600 18px/1 var(--font);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.lay-outer:hover, .lay-add:hover, .lay-outer:focus-visible, .lay-add:focus-visible { background: var(--accent); color: var(--accent-fg); }
/* The outer buttons sit at the middle of each side of the square. */
.lay-outer.left { left: calc(50% - min(calc(50cqw - 28px), calc(50cqh - 60px)) - 14px); top: calc(50% - 14px); }
.lay-outer.right { right: calc(50% - min(calc(50cqw - 28px), calc(50cqh - 60px)) - 14px); top: calc(50% - 14px); }
.lay-outer.above { top: calc(50% - min(calc(50cqw - 28px), calc(50cqh - 60px)) - 14px); left: calc(50% - 14px); }
.lay-outer.below { bottom: calc(50% - min(calc(50cqw - 28px), calc(50cqh - 60px)) - 14px); left: calc(50% - 14px); }
/* A window's own buttons split that window; they show while the pointer is over it. One window alone has only the outer ones. */
.lay-add { width: 24px; height: 24px; font-size: 16px; opacity: 0; transition: opacity 0.12s; }
.lay-add.left { left: 4px; top: calc(50% - 12px); }
.lay-add.right { right: 4px; top: calc(50% - 12px); }
.lay-add.above { top: 4px; left: calc(50% - 12px); }
.lay-add.below { bottom: 4px; left: calc(50% - 12px); }
.lay-close {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
}
.lay-close:hover { color: var(--danger); background: var(--surface); }
.lay-pane:hover > .lay-add, .lay-pane:hover > .lay-close, .lay-pane > :focus-visible { opacity: 1; }
.lay-stage.single .lay-add, .lay-stage.single .lay-close { display: none; }
.lay-edit { justify-content: center; }
.lay-edit button:disabled { opacity: 0.5; cursor: default; }
@media (max-width: 720px) {
  .lay-cols { grid-template-columns: 1fr; }
  .lay-left { border-right: 0; padding-right: 0; max-height: 30vh; }
}
