/* Constructor chrome — match Figma Master Constructor */
@font-face {
  font-family: "FGroup Mono";
  src: url("../fonts/FGroup-MonoMedium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --accent: #d16cff;
  --accent-soft: #d16cff;
  --chrome-bg: #161616;
  --chrome-bar: #161616;
  --chrome-tool: #161616;
  --chrome-ink: #f2f2f2;
  --chrome-muted: #d16cff;
  --chrome-line: #2a2a2a;
  --canvas-bg: #2a2a2a;
  /* 1px rhythm: window edges, between pills, pills ↔ artboard */
  --edge: 1px;
  --brand-icon: 14px;
  --brand-gap: 8px;
  --text-col: calc(var(--brand-icon) + var(--brand-gap));
  --artboard: 720px;
  --artboard-min: 480px;
  /* left gutter must fit New tab / Save / Open (+ pads) — stop shrinking here */
  --session-content-min: 268px;
  --session-rail: var(--session-content-min);
  /* right gutter must fit Preview + Export — stop shrinking here */
  --export-content-min: 220px;
  --export-w: var(--export-content-min);
  /* equal side tracks → center pill + artboard stay viewport-centered */
  --chrome-cols:
    minmax(var(--session-rail), 1fr)
    var(--artboard)
    minmax(var(--export-w), 1fr);
  /* left + artboard + right + 1px gaps + 1px edges */
  --chrome-min: 1220px;
  --tool-gap: clamp(8px, 1.4vw, 16px);
  --canvas-x: 1px;
  --export-inset: 1px;
  --pill-pad-x: 36px;
  --pill-pad-top: 12px;
  /* shared: bottom edge → bottom button text row (center pill is the reference) */
  --pill-pad-bottom: 10px;
  /* desired asym; actual used values are synced in JS so pills never overlap */
  --pill-asym-left: 112px;
  --pill-asym-right: 224px;
  --pill-asym-left-used: 0px;
  --pill-asym-right-used: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: var(--chrome-min);
  overflow-x: auto;
  overflow-y: hidden;
  font-family: "Suisse Intl", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--chrome-ink);
  background: var(--canvas-bg);
}

body.app[data-theme="dark"] {
  color-scheme: dark;
}

body.app[data-theme="light"] {
  color-scheme: light;
}

.app-chrome {
  position: relative;
  display: grid;
  /* equal side tracks → center pill always on screen center */
  grid-template-columns: var(--chrome-cols);
  column-gap: 1px;
  row-gap: 0;
  align-items: stretch;
  flex-shrink: 0;
  z-index: 50;
  /* 1px from window edges; bottom 1px = gap to artboard */
  padding: 1px;
  margin: 0;
  min-width: var(--chrome-min);
  min-height: 108px;
  height: calc(108px + 2px);
  box-sizing: border-box;
  background: transparent;
}

.chrome-pill {
  position: relative;
  isolation: isolate;
  background: transparent;
  border-radius: 999px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
}

/* Pill shape only — content stays on the grid */
.chrome-pill::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--chrome-bg);
  border-radius: 999px;
  pointer-events: none;
}

.chrome-pill > * {
  position: relative;
  z-index: 1;
}

.chrome-pill--session {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: var(--pill-pad-top) var(--pill-pad-x) var(--pill-pad-bottom);
  overflow: hidden;
  justify-self: start;
  box-sizing: border-box;
  /* shorten by synced amount; never below interface */
  min-width: max(var(--session-content-min), min-content);
  width: calc(100% - var(--pill-asym-left-used));
  max-width: 100%;
}

/* Shape matches the (already shortened) box */
.chrome-pill--session::before {
  inset: 0;
}

.chrome-pill--tools {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2px;
  padding: var(--pill-pad-top) var(--pill-pad-x) var(--pill-pad-bottom);
  overflow: visible;
}

/* Project stays top; tool rows pack at bottom with tight inter-row gap */
.chrome-pill--tools .topbar-project-rail {
  margin-bottom: auto;
}

/* Extend only by the same amount sides actually shortened — no overlap */
.chrome-pill--tools::before {
  left: calc(-1 * var(--pill-asym-left-used));
  right: calc(-1 * var(--pill-asym-right-used));
}

.chrome-pill--actions {
  grid-column: 3;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
  padding: 6px;
  overflow: hidden;
  justify-self: end;
  box-sizing: border-box;
  min-width: max(var(--export-content-min), min-content);
  width: calc(100% - var(--pill-asym-right-used));
  max-width: 100%;
}

/* Shape matches the (already shortened) box */
.chrome-pill--actions::before {
  inset: 0;
}

button,
input {
  font: inherit;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--brand-gap);
  height: auto;
  padding: 0;
  margin: 0;
  color: #d16cff;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  min-width: 0;
}

.topbar-emoji {
  flex-shrink: 0;
  width: var(--brand-icon);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-brand-name {
  display: inline-block;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.topbar-project-rail {
  width: 100%;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
}

.topbar-project {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #ffffff;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.toolbar {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}

.topbar-session {
  display: flex;
  align-items: center;
  gap: var(--tool-gap);
  margin-left: var(--text-col);
  margin-top: auto;
  height: 14px;
  max-width: calc(100% - var(--text-col));
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  width: 100%;
}

.topbar-session #btn-save {
  margin-left: auto;
}

.topbar-session #btn-open {
  margin-right: auto;
}

.topbar-newtab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 0;
  margin: 0;
  height: 14px;
  flex: 0 0 auto;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  transition: color 0.22s ease-out, transform 0.28s ease-out;
}

.topbar-newtab:focus,
.topbar-newtab:focus-visible,
.topbar-newtab:active {
  outline: none;
  box-shadow: none;
}

.topbar-newtab:hover {
  color: #00ff00;
  text-decoration: none;
  transform: scale(1.04);
  transition: color 0.02s ease-out, transform 0.02s ease-out;
}

.chrome-subrow-rail {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: 14px;
  margin-top: auto;
  padding: 0;
  box-sizing: border-box;
  overflow: visible;
}

.toolbar-tools--sub {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--tool-gap);
  height: 14px;
  min-width: 0;
  overflow: hidden;
}

.toolbar-tools--theme-color {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 0;
  height: 14px;
  overflow: visible;
  z-index: 80;
  flex: 0 0 auto;
}

#btn-theme-color,
#btn-theme-color:hover {
  color: var(--theme-pick-color, rgba(255, 255, 255, 0.6));
}

.theme-color-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  width: 244px;
  padding: 12px;
  box-sizing: border-box;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.85);
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.theme-color-popover[hidden] {
  display: none;
}

.theme-color-popover__label {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.2;
  text-transform: uppercase;
}

.theme-color-popover__sv,
.theme-color-popover__hue {
  position: relative;
  width: 220px;
  border-radius: 4px;
  overflow: visible;
  cursor: crosshair;
  touch-action: none;
}

.theme-color-popover__sv {
  height: 140px;
  margin-bottom: 10px;
}

.theme-color-popover__hue {
  height: 14px;
  margin-bottom: 10px;
  cursor: ew-resize;
}

.theme-color-popover__sv canvas,
.theme-color-popover__hue canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 4px;
}

.theme-color-popover__thumb {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  box-sizing: border-box;
}

.theme-color-popover__thumb--hue {
  top: 50%;
  width: 10px;
  height: 18px;
  margin: -9px 0 0 -5px;
  border-radius: 3px;
}

.theme-color-popover__meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-color-popover__swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.theme-color-popover__hex {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.75);
}

.topbar-export {
  position: relative;
  z-index: 2;
  appearance: none;
  border: 0;
  /* circle stays inside the pill — matches pill inner height */
  width: auto;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: stretch;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: none;
  overflow: hidden;
  container-type: size;
  opacity: 0.72;
  transition: opacity 0.18s ease, box-shadow 0.18s ease;
}

.topbar-export-orb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 50%;
}

.topbar-export-label {
  position: relative;
  z-index: 1;
  color: #000000;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: clamp(12px, 3.2cqi, 14px);
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.topbar-export:hover {
  opacity: 1;
  box-shadow:
    0 0 24px 6px rgba(224, 80, 255, 0.02),
    0 0 56px 18px rgba(209, 108, 255, 0.02);
}

.topbar-export:disabled,
.topbar-export[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.1;
  box-shadow: none;
}

.topbar-export:disabled:hover,
.topbar-export[aria-disabled="true"]:hover {
  opacity: 0.1;
  box-shadow: none;
}

.topbar-preview {
  position: relative;
  z-index: 3;
  appearance: none;
  border: 0;
  background: transparent;
  color: #00ff00;
  padding: 0;
  /* parent pad 6px + 4px → same 10px as center/left bottom buttons */
  margin: 0 0 calc(var(--pill-pad-bottom) - 6px) 0;
  height: 14px;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 14px;
  text-align: right;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  outline: none;
  opacity: 0.6;
  flex: 0 0 auto;
  transform-origin: center center;
  transition: opacity 0.22s ease-out, transform 0.28s ease-out;
}

.topbar-preview:hover {
  color: #00ff00;
  opacity: 1;
  transform: scale(1.04);
  transition: opacity 0.02s ease-out, transform 0.02s ease-out;
}

.topbar-preview:disabled,
.topbar-preview[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.1;
  transform: none;
  pointer-events: none;
}

.topbar-preview:disabled:hover,
.topbar-preview[aria-disabled="true"]:hover {
  color: #00ff00;
  opacity: 0.1;
  transform: none;
}

/* Same slot as Preview — shown only in preview mode */
.preview-exit {
  position: relative;
  z-index: 3;
  appearance: none;
  border: 0;
  background: transparent;
  color: #00ff00;
  padding: 0;
  margin: 0 0 calc(var(--pill-pad-bottom) - 6px) 0;
  height: 14px;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 14px;
  text-align: right;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  outline: none;
  opacity: 0.6;
  flex: 0 0 auto;
  transform-origin: center center;
  transition: opacity 0.22s ease-out, transform 0.28s ease-out;
}

.preview-exit:hover {
  color: #00ff00;
  opacity: 1;
  transform: scale(1.04);
  transition: opacity 0.02s ease-out, transform 0.02s ease-out;
}

body.app[data-theme="light"] .preview-exit {
  color: #000000;
  opacity: 0.85;
}

body.app[data-theme="light"] .preview-exit:hover {
  color: #000000;
  opacity: 1;
}

body.app.is-preview {
  background: var(--page-bg);
}

/* Collapse chrome but keep Back + Export in place */
body.app.is-preview .app-chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  min-height: 108px;
  height: calc(108px + 2px);
  padding: 1px;
  background: transparent;
  pointer-events: none;
}

body.app.is-preview .chrome-pill--session,
body.app.is-preview .chrome-pill--tools {
  visibility: hidden;
  pointer-events: none;
}

body.app.is-preview .chrome-pill--actions {
  background: transparent;
  pointer-events: none;
}

body.app.is-preview .chrome-pill--actions::before {
  display: none;
}

body.app.is-preview .preview-exit,
body.app.is-preview .topbar-export {
  pointer-events: auto;
}

body.app.is-preview .topbar-preview {
  display: none !important;
}

body.app.is-preview .canvas {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--page-bg);
  padding: 0;
  overflow: auto;
}

body.app.is-preview .page.landing-wrap {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 40px 64px;
  border-radius: 0;
  min-height: 100%;
  box-shadow: none;
  background: var(--page-bg);
}

body.app.is-preview .node-shell,
body.app.is-preview .page > .node {
  outline: none;
}

body.app.is-preview .node-shell::after,
body.app.is-preview .page > .node::after,
body.app.is-preview .node-cell::after,
body.app.is-preview .node-btn-wrap--cell::after {
  content: none !important;
  display: none !important;
}

body.app.is-preview .node-drag-handle,
body.app.is-preview .page-continue,
body.app.is-preview .node-btn-meta {
  display: none !important;
}

body.app.is-preview .node-cell,
body.app.is-preview .node-btn-wrap--cell {
  outline: none !important;
}

body.app.is-preview .landing-image,
body.app.is-preview .landing-video,
body.app.is-preview .landing-image:focus,
body.app.is-preview .landing-image:focus-visible,
body.app.is-preview .landing-video:focus,
body.app.is-preview .landing-video:focus-visible,
body.app.is-preview .node-cell:focus,
body.app.is-preview .node-cell:focus-visible,
body.app.is-preview .node-shell:focus,
body.app.is-preview .node-shell:focus-visible,
body.app.is-preview .node:focus,
body.app.is-preview .node:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

body.app.is-preview .landing-row--2 > .node-cell:not(.node-cell--text):not(.node-cell--button),
body.app.is-preview
  .node-shell.is-selected
  > .landing-row--2
  > .node-cell:not(.node-cell--text):not(.node-cell--button),
body.app.is-preview
  .landing-row--2
  > .node-cell:not(.node-cell--text):not(.node-cell--button).is-selected {
  outline: none !important;
  box-shadow: none !important;
}

body.app.is-preview [contenteditable="true"] {
  pointer-events: none;
  user-select: text;
  caret-color: transparent;
}

/* Artboard buttons: hover like export (opacity + scale) */
body.app.is-preview .node-btn-wrap .landing-btn,
body.app.is-preview .landing-btn {
  pointer-events: auto !important;
  cursor: pointer;
  transform-origin: center center;
  transition: opacity 0.22s ease-out, transform 0.28s ease-out;
}

body.app.is-preview .node-btn-wrap .landing-btn:hover,
body.app.is-preview .landing-btn:hover {
  opacity: 1;
  transform: scale(1.04);
  transition: opacity 0.01s ease-out, transform 0.01s ease-out;
}

body.app.is-preview .landing-image {
  pointer-events: auto;
  cursor: zoom-in;
}

body.app.is-preview .landing-video {
  pointer-events: auto;
  cursor: zoom-in;
}

/* Empty media — constructor only; hide in preview (not a layout spacer) */
body.app.is-preview .node-cell.is-empty {
  display: none !important;
}

body.app.is-preview .node-shell:has(> .node-row):not(:has(.node-cell:not(.is-empty))) {
  display: none !important;
}

body.app.is-preview .landing-row--2:has(> .node-cell.is-empty) {
  grid-template-columns: minmax(0, 1fr);
}

/* Empty text keeps one line of space; hide edit placeholders */
body.app.is-preview .landing-title:empty::before,
body.app.is-preview .landing-heading:empty::before,
body.app.is-preview .landing-body:empty::before,
body.app.is-preview .landing-description:empty::before,
body.app.is-preview .node-cell--text .landing-title:empty::before,
body.app.is-preview .node-cell--text .landing-heading:empty::before,
body.app.is-preview .node-cell--text .landing-body:empty::before,
body.app.is-preview .node-cell--text .landing-description:empty::before {
  content: none !important;
  display: none !important;
}

body.app.is-preview .landing-title:empty,
body.app.is-preview .landing-heading:empty {
  min-height: 1.1em;
}

body.app.is-preview .landing-body:empty,
body.app.is-preview .landing-description:empty {
  min-height: 1.45em;
}

.landing-sticky-title {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 280;
  max-width: min(420px, calc(100vw - 180px));
  margin: 0;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.02em;
  /* Exclusion inverts against whatever scrolls under it — white is the neutral base */
  color: #ffffff;
  mix-blend-mode: exclusion;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.landing-sticky-title.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Tools — Edit/Layout on artboard column */
.toolbar-rail {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 20px);
  width: 100%;
  min-height: 14px;
  min-width: 0;
  overflow: hidden;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.toolbar-group--edit {
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.toolbar-group--layout {
  align-items: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}

.toolbar-label {
  display: block;
  height: 14px;
  margin: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.48);
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 14px;
  user-select: none;
  pointer-events: none;
}

.toolbar-group--edit .toolbar-label {
  transform: translateX(124px);
}

.toolbar-group--layout .toolbar-label {
  transform: translateX(-90px);
}

.toolbar-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  column-gap: var(--tool-gap);
  row-gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.toolbar-tools--main {
  flex-wrap: nowrap;
  padding-left: 0;
}

.toolbar-group--layout .toolbar-tools {
  justify-content: flex-end;
}

.tool {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  padding: 0;
  margin: 0;
  height: 14px;
  flex: 0 0 auto;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  transition: color 0.22s ease-out, transform 0.28s ease-out;
}

.tool:focus,
.tool:focus-visible,
.tool:active {
  outline: none;
  box-shadow: none;
}

.tool:hover {
  color: #d16cff;
  text-decoration: none;
  transform: scale(1.04);
  transition: color 0.02s ease-out, transform 0.02s ease-out;
}

.tool.is-active {
  color: #d16cff;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.tool.is-active:hover {
  color: #d16cff;
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: none;
}

/* Canvas + constructor page block — flat, no shadows */
.canvas {
  flex: 1 1 auto;
  min-height: 0;
  min-width: var(--chrome-min);
  overflow: auto;
  /* top 0 — chrome already leaves 1px under pills; sides/bottom 1px */
  padding: 0 1px 1px;
  background: var(--canvas-bg);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.page {
  background: var(--page-bg);
  color: var(--page-ink);
  outline: none;
  width: 100%;
  max-width: var(--artboard);
  min-width: var(--artboard-min);
  flex: 1 0 auto;
  min-height: 100%;
  margin: 0;
  box-shadow: none;
  border: 0;
  border-radius: 40px;
  filter: none;
}

.page.landing-wrap {
  /* keep inner padding from landing.css; kill outer “card” feel */
  box-shadow: none;
  padding-left: clamp(16px, 4vw, 40px);
  padding-right: clamp(16px, 4vw, 40px);
}

.node {
  position: relative;
  border-radius: 1px;
  width: 100%;
  max-width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
}

.node-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* constructor-only bounds — drawn via ::after (outline can't mix-blend) */
  outline: none;
}

/*
 * Frame ring + interaction glyphs: Exclusion vs page (dark/light + theme bg).
 * Idle = purple, selected = green.
 */
.node-shell::after,
.page > .node::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 4;
  box-sizing: border-box;
  border: 1px solid rgba(209, 108, 255, 0.2);
  border-radius: 1px;
  pointer-events: none;
  mix-blend-mode: exclusion;
}

/* media rows — hug content (offset looks like a white frame on dark media) */
.node-shell:has(> .node-row) {
  margin-bottom: 24px;
}

.node-shell:has(> .node-row)::after {
  inset: 0;
}

.node-shell:has(> .node-row) > .node-row.landing-row,
.node-shell:has(> .node-row) > .node-row {
  margin-bottom: 0;
}

/*
 * 2-col media: one drag handle on the shell, but each column is its own frame.
 * Hide the shared shell ring; draw idle/selected borders on the cells.
 */
.node-shell:has(> .landing-row--2 > .node-cell:not(.node-cell--text):not(.node-cell--button))::after {
  content: none;
  display: none;
}

.landing-row--2 > .node-cell:not(.node-cell--text):not(.node-cell--button)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  box-sizing: border-box;
  border: 1px solid rgba(209, 108, 255, 0.2);
  border-radius: 1px;
  pointer-events: none;
  mix-blend-mode: exclusion;
}

.node-shell.is-selected > .landing-row--2 > .node-cell:not(.node-cell--text):not(.node-cell--button)::after,
.landing-row--2 > .node-cell:not(.node-cell--text):not(.node-cell--button).is-selected::after {
  border-color: rgba(0, 255, 0, 0.7);
}

body.app[data-theme="light"]
  .landing-row--2
  > .node-cell:not(.node-cell--text):not(.node-cell--button)::after {
  border-color: rgba(209, 108, 255, 0.35);
}

body.app[data-theme="light"]
  .node-shell.is-selected
  > .landing-row--2
  > .node-cell:not(.node-cell--text):not(.node-cell--button)::after,
body.app[data-theme="light"]
  .landing-row--2
  > .node-cell:not(.node-cell--text):not(.node-cell--button).is-selected::after {
  border-color: rgba(0, 255, 0, 0.75);
}

/* block selected — medium green */
.node-shell.is-selected::after,
.page > .node.is-selected::after {
  border-color: rgba(0, 255, 0, 0.35);
}

/* cell active inside block — soften the outer frame so one language of opacity */
.node-shell.is-selected:has(.node-cell.is-selected)::after,
.node-shell.is-selected:has(.node-btn-wrap--cell.is-selected)::after {
  border-color: rgba(0, 255, 0, 0.2);
}

/* direct page nodes without shell (e.g. footer) */
.page > .node {
  outline: none;
}

/* cells — only the active column/cell gets a stronger green (same hue, higher alpha) */
.page .node-cell {
  outline: none;
}

.page .node-cell.is-selected::after,
.page .node-btn-wrap--cell.is-selected::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 4;
  box-sizing: border-box;
  border: 1px solid rgba(0, 255, 0, 0.7);
  border-radius: 1px;
  pointer-events: none;
  mix-blend-mode: exclusion;
}

/* button cell: ring only on the cell, not a second frame on the inner wrap */
.page .node-cell.is-selected .node-btn-wrap--cell.is-selected::after {
  content: none;
  display: none;
}

/* light page */
body.app[data-theme="light"] .node-shell.is-selected::after,
body.app[data-theme="light"] .page > .node.is-selected::after {
  border-color: rgba(0, 255, 0, 0.4);
}

body.app[data-theme="light"] .node-shell.is-selected:has(.node-cell.is-selected)::after,
body.app[data-theme="light"] .node-shell.is-selected:has(.node-btn-wrap--cell.is-selected)::after {
  border-color: rgba(0, 255, 0, 0.22);
}

body.app[data-theme="light"] .page .node-cell.is-selected::after,
body.app[data-theme="light"] .page .node-btn-wrap--cell.is-selected::after {
  border-color: rgba(0, 255, 0, 0.75);
}

body.app[data-theme="light"] .node-draggable.is-selected .node-drag-handle,
body.app[data-theme="light"] .node-draggable.is-selected:hover .node-drag-handle,
body.app[data-theme="light"] .node-draggable.is-selected .node-drag-handle:hover {
  color: #00be00;
  opacity: 1;
}

/* light theme — inactive frame handles fully opaque purple */
body.app[data-theme="light"] .node-drag-handle {
  color: #d16cff;
  opacity: 1;
}

body.app[data-theme="light"] .node-draggable:not(.is-selected):hover .node-drag-handle,
body.app[data-theme="light"] .node-draggable:not(.is-selected).is-dragging .node-drag-handle,
body.app[data-theme="light"] .node-draggable:not(.is-selected) .node-drag-handle:hover {
  color: #d16cff;
  opacity: 1;
}

.node-drag-handle {
  position: absolute;
  left: -1.55rem;
  /* match frame ring inset (-2px) so dots sit on the top border */
  top: -2px;
  z-index: 5;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(209, 108, 255, 0.75);
  width: 1.35rem;
  height: 1.1rem;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  cursor: grab;
  font-size: 15px;
  line-height: 1;
  letter-spacing: -0.08em;
  opacity: 0.4;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: element;
  touch-action: none;
  mix-blend-mode: exclusion;
}

/* media shells hug content — ring inset 0 */
.node-shell:has(> .node-row) .node-drag-handle {
  top: 0;
}

.node-draggable:not(.is-selected):hover .node-drag-handle,
.node-draggable:not(.is-selected).is-dragging .node-drag-handle {
  opacity: 1;
  color: #d16cff;
}

.node-draggable.is-selected .node-drag-handle,
.node-draggable.is-selected:hover .node-drag-handle,
.node-draggable.is-selected .node-drag-handle:hover {
  opacity: 1;
  color: #00ff00;
}

.node-draggable:not(.is-selected) .node-drag-handle:hover {
  opacity: 1;
  color: #d16cff;
}

.node-drag-handle:active {
  cursor: grabbing;
}

.node-drag-handle:focus,
.node-drag-handle:focus-visible {
  outline: none;
}

.node-shell.is-dragging,
.node.is-dragging {
  opacity: 0.45;
}

.node-shell.is-drop-before,
.node.is-drop-before {
  box-shadow: inset 0 2px 0 #d16cff;
}

.node-shell.is-drop-after,
.node.is-drop-after {
  box-shadow: inset 0 -2px 0 #d16cff;
}

.node[contenteditable="true"] {
  outline: none;
  min-height: 1.15em;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.node[contenteditable="true"]::selection,
.node-cell--text [contenteditable="true"]::selection,
.landing-caption[contenteditable="true"]::selection,
.landing-btn[contenteditable="true"]::selection {
  background: rgba(209, 108, 255, 0.45);
  color: inherit;
}

/* Empty text — placeholder matches the block style */
.landing-title[contenteditable="true"]:empty::before,
.landing-heading[contenteditable="true"]:empty::before,
.landing-body[contenteditable="true"]:empty::before,
.landing-description[contenteditable="true"]:empty::before,
.node-cell--text .landing-title:empty::before,
.node-cell--text .landing-heading:empty::before,
.node-cell--text .landing-body:empty::before,
.node-cell--text .landing-description:empty::before {
  content: attr(data-placeholder);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  color: inherit;
  opacity: 0.28;
  pointer-events: none;
}

.node-row {
  position: relative;
  margin: 0 0 1.5rem;
}

.node-cell {
  position: relative;
  min-width: 0;
  background: var(--page-media-bg);
  overflow: hidden;
}

.node-cell--text,
.node-cell--button {
  overflow: visible;
  pointer-events: auto;
}

/* empty caption must not create a light strip under media — keep editable */
.page .node-cell .landing-caption:empty {
  display: block;
  min-height: 1.15em;
  margin: 0.35rem 0 0;
  opacity: 0.35;
}

/* filled media — transparent so PNG alpha shows against page bg */
.node-cell:not(.is-empty):not(.node-cell--text):not(.node-cell--button) {
  background: transparent;
}

.node-cell:not(.is-empty):not(.node-cell--text):not(.node-cell--button) .landing-image {
  background: transparent;
  vertical-align: top;
}

.node-cell:not(.is-empty):not(.node-cell--text):not(.node-cell--button) .landing-video {
  background: #000000;
}

.node-cell--text {
  background: transparent;
  aspect-ratio: auto;
  min-height: 0;
  display: block;
  cursor: text;
}

/* 2-col text: keep each column clickable — left must not paint over right */
.landing-row--2 > .node-cell--text {
  overflow: hidden;
  min-width: 0;
  align-self: stretch;
}

.landing-row--2 > .node-cell--text [contenteditable="true"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 3em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.node-cell--button {
  background: transparent;
  aspect-ratio: auto;
  min-height: 0;
  display: block;
}

.node-btn-wrap--cell {
  margin: 0;
  position: relative;
}

.node-cell--text [contenteditable="true"] {
  outline: none;
  min-height: 1.15em;
  margin-top: 0;
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}

.node-cell.is-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 12rem;
  color: var(--page-ink);
  font-size: 0.8rem;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.node-cell.is-empty .cell-ph-link {
  width: min(320px, 82%);
  cursor: auto;
}

.node-cell.is-empty .cell-ph-link input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 4px;
  background: transparent;
  color: var(--page-ink);
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  opacity: 0.75;
  outline: none;
}

.node-cell.is-empty .cell-ph-link input:focus {
  opacity: 1;
  border-color: rgba(0, 255, 0, 0.55);
}

.node-cell.is-empty .cell-ph-label {
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--page-ink);
  opacity: 0.35;
}

.node-cell[data-aspect="16/9"],
.node-cell[data-aspect="16/9"].is-empty {
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.node-cell[data-aspect="1/1"],
.node-cell[data-aspect="1/1"].is-empty {
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.node-cell[data-aspect="16/9"] .landing-image,
.node-cell[data-aspect="1/1"] .landing-image {
  aspect-ratio: inherit;
  object-fit: cover;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.node-cell .landing-video {
  cursor: default;
  background: #000000;
}

.landing-dash {
  margin: 1.75rem 0;
  border: 0;
  border-top: 1px solid var(--page-line);
}

body.app[data-theme="light"] .landing-dash {
  mix-blend-mode: multiply;
}

body.app[data-theme="dark"] .landing-dash {
  mix-blend-mode: screen;
}

.node-btn-wrap {
  margin: 1rem 0 1.4rem;
}

.node-btn-wrap .landing-btn {
  pointer-events: none;
  min-width: 2rem;
}

.node-btn-wrap .landing-btn[contenteditable="true"] {
  pointer-events: auto;
  cursor: text;
  outline: none;
}

.node-btn-meta {
  display: none;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.node-btn-wrap.is-selected .node-btn-meta {
  display: flex;
}

.node-btn-meta label {
  font-size: 0.72rem;
  color: #00ff00;
  font-family: "Helvetica Mono", ui-monospace, monospace;
}

.node-btn-meta input[type="text"] {
  flex: 1;
  min-width: 14rem;
  border: 1px solid #333;
  background: #111;
  color: #eee;
  padding: 0.4rem 0.55rem;
  font-size: 0.8rem;
  font-family: "Helvetica Mono", ui-monospace, monospace;
}

body.app[data-theme="light"] .node-btn-meta input[type="text"] {
  border-color: #ccc;
  background: #fff;
  color: #111;
}

.node-btn-color {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 10rem;
}

.node-btn-color-hex {
  flex: 1;
  min-width: 7rem !important;
  max-width: 9rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.node-btn-color-pick {
  appearance: none;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid #333;
  border-radius: 0.3rem;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.node-btn-color-pick::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.node-btn-color-pick::-webkit-color-swatch {
  border: 0;
  border-radius: 0.2rem;
}

body.app[data-theme="light"] .node-btn-color-pick {
  border-color: #ccc;
}

.node-btn-meta .meta-btn {
  appearance: none;
  border: 0;
  border-radius: 0.3rem;
  background: #d16cff;
  color: #111;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: "Helvetica Mono", ui-monospace, monospace;
}

body.app[data-theme="light"] .node-btn-meta .meta-btn {
  background: #d16cff;
  color: #111;
}

.node-btn-meta .meta-hint {
  width: 100%;
  font-size: 0.72rem;
  color: #777;
  font-family: "Helvetica Mono", ui-monospace, monospace;
}

.page-continue {
  margin-top: 1.25rem;
  padding: 0.75rem 0.25rem;
  font-family: "FGroup Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--page-ink);
  opacity: 0.28;
  cursor: text;
}
