/* ============================================================
   Nascia — Studio

   Light, flat, no gradients. One stone-coloured ground, white
   panels with rounded corners, one green accent, and a single
   dark inset for the build log. Everything is sized in rem so
   Presentation mode (root 16px -> 20px) scales the Studio view.
   Device frames are the deliberate exception: they are in real
   CSS pixels so the generated app's responsive breakpoints fire.

   Two views share the page. html[data-view="landing"] shows the
   showcase (hero, video, gallery, "try your own idea") as full-height
   slides the page snaps between; html[data-view="studio"] shows the
   live build console.
   ============================================================ */

:root {
  --bg: #f6f5f0;
  --panel: #ffffff;
  --panel-2: #fbfbf9;
  --border: #e1e4df;
  --border-strong: #c9d3cd;
  --text: #1f2421;
  --muted: #4c5752;     /* 7.4:1 on white */
  --dim: #6b7570;       /* 4.9:1 on white, 4.6:1 on the ground */
  --accent: #0f6e56;    /* 6.3:1 on white */
  --accent-soft: #e3f1ec;
  --accent-ink: #ffffff;
  --warn: #b45309;      /* 5.0:1 on white */
  --warn-soft: #fdf1e6;
  --error: #b42318;     /* 6.1:1 on white */
  --error-soft: #fbeae8;

  /* the dark console inset */
  --console-bg: #1b1f1d;
  --console-toolbar: #232826;
  --console-border: #2c322f;
  --console-text: #d7ddd9;
  --console-muted: #9aa39e;   /* 6.6:1 on the console */
  --console-dim: #7d8783;     /* 4.6:1 */
  --console-accent: #7fd3b4;
  --console-warn: #f5c26b;
  --console-error: #ff8a80;

  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 1rem;
  --radius-sm: 0.75rem;
  --pill: 999px;

  /* the landing's sticky header; every slide is the viewport minus this */
  --header-h: 5.25rem;
  --slide-h: calc(100vh - var(--header-h));
}
@supports (height: 100svh) {
  :root { --slide-h: calc(100svh - var(--header-h)); }
}

html { font-size: 16px; }
html[data-presentation="on"] { font-size: 20px; }

* { box-sizing: border-box; }

/* several elements below are display:flex, which would beat the UA's
   [hidden] rule; make the attribute authoritative. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* the two views */
html[data-view="landing"] .app { display: none; }
html[data-view="studio"] .landing { display: none; }
html[data-view="studio"] body { overflow: hidden; }

/* The landing scrolls like a deck: each section is one slide, and the page
   settles on a slide's top edge, just under the sticky header. A slide taller
   than the viewport (a long gallery on a narrow window) still scrolls through. */
html[data-view="landing"] {
  scroll-snap-type: y mandatory;
  scroll-padding-top: var(--header-h);
}

button, textarea, input { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* These live inside overflow:hidden ancestors, which would clip an outside
   ring away entirely — draw it inside instead. */
.segmented button:focus-visible,
.tabs button:focus-visible {
  outline-offset: -2px;
  border-radius: var(--pill);
}
.console:focus-visible {
  outline: 2px solid var(--console-accent);
  outline-offset: -2px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.12em; }

/* ───────────────────────── shared pieces ───────────────────────── */

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
}

/* The lifted-lattice mark (studio/public/brand/). Inline so it needs no
   request; the standalone files are for favicons, icons and other uses. */
.brand-mark {
  width: 1.9rem;
  height: 1.9rem;
  display: block;
  flex: 0 0 auto;
}

.brand {
  margin: 0;
  font-size: 1.3125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
  border-radius: var(--pill);
  height: 2.75rem;
  padding: 0 1.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, opacity .15s ease;
}
.primary-button:hover:not(:disabled) { background: #0b5442; }
.primary-button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary-button.danger { background: var(--panel); color: var(--error); border-color: #f0c7c2; }
.primary-button.danger:hover:not(:disabled) { background: var(--error-soft); }
.primary-button.large { height: 3.5rem; padding: 0 1.9rem; font-size: 1.0625rem; }

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--pill);
  height: 2.75rem;
  padding: 0 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.secondary-button:hover { border-color: var(--text); }
.secondary-button.large { height: 3.5rem; padding: 0 1.7rem; font-size: 1.0625rem; }

.ghost-button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--pill);
  padding: 0.35rem 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.ghost-button:hover { color: var(--text); border-color: var(--text); }
.ghost-button[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.ghost-button.small { padding: 0.15rem 0.6rem; font-size: 0.75rem; }
.ghost-button.on-dark {
  background: transparent;
  color: var(--console-text);
  border-color: #4a524e;
}
.ghost-button.on-dark:hover { color: #ffffff; border-color: #ffffff; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.125rem;
  padding: 0 0.9rem;
  border-radius: var(--pill);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.pill::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.pill-building { background: var(--warn-soft);   color: var(--warn);   border-color: transparent; }
.pill-success  { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-partial  { background: var(--warn-soft);   color: var(--warn);   border-color: transparent; }
.pill-failed   { background: var(--error-soft);  color: var(--error);  border-color: transparent; }
.pill-building::before { animation: softPulse 1.6s ease-in-out infinite; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.75rem;
  padding: 0 0.7rem;
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip.ok   { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: var(--warn-soft);   color: var(--warn); }
.chip.bad  { background: var(--error-soft);  color: var(--error); }

/* ═══════════════════════════ landing ═══════════════════════════ */

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 4rem;
  background: var(--bg);
}

.slide {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: var(--slide-h);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  height: 2.75rem;
  padding: 0 1.25rem;
  background: var(--text);
  color: #ffffff;
  border: 0;
  border-radius: var(--pill);
  font-weight: 700;
  cursor: pointer;
}
.nav-cta:hover { background: #000000; }

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.5rem;
  padding: 2rem 4rem 6rem;
}

.scroll-cue {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: -1.375rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
  animation: nudge 2.2s ease-in-out infinite;
}
.scroll-cue svg { width: 1.25rem; height: 1.25rem; }
.scroll-cue:hover { color: var(--text); border-color: var(--text); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--pill);
  background: var(--panel);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
}

.hero-title {
  margin: 0;
  max-width: 56rem;
  font-size: clamp(2.25rem, 5vw, 4.125rem);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-copy {
  margin: 0;
  max-width: 44rem;
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin-top: 0.5rem; }

.video-section {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 4rem;
}

/* The player sits centred in its slide, no wider than the copy above it and
   never taller than the slide can hold. */
.video-frame {
  position: relative;
  width: min(100%, 56rem, calc((var(--slide-h) - 6rem) * 1.6));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  overflow: hidden;
}
#showcase-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;   /* the recording is 1440 by 900 */
  background: #1b1f1d;
}

.gallery-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 4rem;
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.section-title { margin: 0; font-size: 2.125rem; font-weight: 800; letter-spacing: -0.02em; }
.section-sub { font-size: 0.9375rem; color: var(--muted); }

/* Four featured builds in one row, so the gallery is one slide. */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.build-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
}

.build-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--panel-2);
}

.browser-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.browser-bar i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--border); }
.browser-bar span {
  margin-left: 0.6rem;
  font-size: 0.6875rem;
  color: var(--dim);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The generated app is rendered at a real desktop width and scaled down, so
   its own layout is what the visitor sees, not a phone breakpoint. */
.build-shot {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #ffffff;
}
.build-shot iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1024px;
  height: 640px;
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--shot-scale, 0.4));
  pointer-events: none;
  background: #ffffff;
}
.build-shot a {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.build-meta { display: flex; flex-direction: column; gap: 0.6rem; padding: 0 0.25rem; }
.build-title {
  color: var(--text);
  text-decoration: none;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}
.build-title:hover { color: var(--accent); }
.build-summary {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.build-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.gallery-note { grid-column: 1 / -1; color: var(--dim); font-size: 0.9375rem; }

/* the last slide: the try card centred, the footer at its foot */
.slide-try { display: flex; flex-direction: column; }

.try-section {
  margin: auto 4rem;
  padding: 2.5rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 2.5rem;
}
.try-copy { display: flex; flex-direction: column; gap: 0.75rem; }
.try-copy p { margin: 0; font-size: 0.9375rem; line-height: 1.55; color: var(--muted); }
.allowance {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
}
.allowance:empty { display: none; }
.allowance::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; }
.allowance.closed { color: var(--warn); }

/* the prompt panel, when it lives in the try section */
.try-slot .prompt-panel { padding: 0; border: 0; background: transparent; }
.try-slot #prompt { min-height: 7.5rem; }

.site-footer {
  margin-top: 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.5rem 4rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--dim);
}
.site-footer span:first-child { font-weight: 800; color: var(--text); }
.site-footer a { color: var(--text); font-weight: 700; text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }

/* ═══════════════════════════ studio ═══════════════════════════ */

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ───────────────────────── header ───────────────────────── */

.header {
  flex: 0 0 auto;
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand-block { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }

.brand-sub {
  display: inline-flex;
  align-items: center;
  height: 1.5rem;
  padding: 0 0.6rem;
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.status-block { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.status-reason { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.counters { display: flex; align-items: center; gap: 0.5rem; }

.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  height: 2.125rem;
  padding: 0 0.8rem;
  border-radius: var(--pill);
  background: var(--bg);
  white-space: nowrap;
}
.counter-label { font-size: 0.75rem; font-weight: 600; color: var(--dim); }
.counter-value {
  font-size: 0.9375rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.counter-points { background: var(--accent-soft); }
.counter-points .counter-label, .counter-points .counter-value { color: var(--accent); }

/* ───────────────────────── columns ───────────────────────── */

.columns {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  gap: 1rem;
  padding: 1rem;
}

.col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ───────────────────────── stepper ───────────────────────── */

.stepper-panel { flex: 0 0 auto; padding: 0.9rem 1rem 0.8rem; }

.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
}

.step {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

/* connector from the previous step's circle to this one's */
.step::before {
  content: "";
  position: absolute;
  top: 0.75rem;
  left: calc(-50% + 1.1rem);
  width: calc(100% - 2.2rem);
  height: 2px;
  background: var(--border);
  transition: background .3s ease;
}
.step:first-child::before { display: none; }
.step.link-done::before { background: var(--accent); }

.step-marker {
  position: relative;
  z-index: 1;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--dim);
  font-size: 0.6875rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: border-color .25s ease, color .25s ease, background .25s ease;
}
.step-marker .icon { width: 0.8rem; height: 0.8rem; }

.step[data-state="active"] .step-marker {
  border-color: var(--warn);
  border-width: 3px;
  color: var(--warn);
  animation: softPulse 1.6s ease-in-out infinite;
}
.step[data-state="done"] .step-marker {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.step[data-state="failed"] .step-marker {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-soft);
}
.step[data-state="skipped"] .step-marker {
  border-style: dashed;
  color: var(--dim);
}

.step-body { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; min-width: 0; }

.step-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--dim);
  white-space: nowrap;
}
.step[data-state="active"] .step-label { color: var(--text); font-weight: 800; }
.step[data-state="done"]   .step-label { color: var(--accent); }
.step[data-state="failed"] .step-label { color: var(--error); }
.step[data-state="skipped"] .step-label { text-decoration: line-through; }

.step-tag, .step-chip {
  font-size: 0.6875rem;
  line-height: 1.3;
  padding: 0.1rem 0.5rem;
  border-radius: var(--pill);
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.step-tag { color: var(--warn); background: var(--warn-soft); }
.step-chip.ok   { color: var(--accent); background: var(--accent-soft); }
.step-chip.warn { color: var(--warn);   background: var(--warn-soft); }

/* ───────────────────────── console (the dark inset) ───────────────────────── */

.console-panel {
  flex: 1 1 auto;
  /* never let a short viewport collapse the log to nothing */
  min-height: 6rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--console-bg);
  border-color: var(--console-bg);
}

.console-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--console-border);
  background: var(--console-toolbar);
  border-radius: var(--radius) var(--radius) 0 0;
}

.toolbar-spacer { flex: 1 1 auto; }

.segmented {
  display: inline-flex;
  padding: 0.15rem;
  border-radius: var(--pill);
  background: var(--console-border);
}
.segmented button {
  background: transparent;
  border: 0;
  border-radius: var(--pill);
  color: var(--console-muted);
  padding: 0.2rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.segmented button:hover { color: #ffffff; }
.segmented button[aria-pressed="true"] { background: var(--bg); color: var(--text); }

.line-count { font-size: 0.75rem; font-weight: 600; color: var(--console-muted); font-variant-numeric: tabular-nums; }

.reconnect-note { font-size: 0.75rem; color: var(--console-warn); font-style: italic; }

.console {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 1rem 1.25rem;
  font-family: var(--mono);
  font-size: 0.8125rem;   /* 13px at base, 16.25px in Presentation mode */
  line-height: 1.6;
  color: var(--console-text);
  scrollbar-color: #3a423e var(--console-bg);
}

.console:empty::before {
  content: "The build log will appear here.";
  color: var(--console-dim);
  font-style: italic;
}

.ln {
  white-space: pre-wrap;
  word-break: break-word;
  /* hanging indent: wrapped continuations sit under the line body */
  padding-left: 1.6em;
  text-indent: -1.6em;
}
.ln:first-child { margin-top: 0; }

.ln-narration {
  color: var(--console-accent);
  font-weight: 500;
  margin-top: 0.85em;
}
.ln-role   { color: var(--console-muted); }
.ln-role .role-name { color: #e6ebe8; font-weight: 500; }
.ln-pi     { color: var(--console-dim); }
.ln-error  { color: var(--console-error); }
.ln-warn   { color: var(--console-warn); }
.ln-studio { color: var(--console-warn); font-style: italic; }
.ln-runner { color: var(--console-muted); }
.ln-plain  { color: var(--console-text); }
.ln-noise  { color: var(--console-dim); }

/* ───────────────────────── prompt ───────────────────────── */

.prompt-panel {
  flex: 0 0 auto;
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

#prompt {
  width: 100%;
  resize: vertical;
  min-height: 6rem;
  max-height: 40vh;
  padding: 0.75rem 0.9rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}
#prompt::placeholder { color: var(--dim); }
#prompt:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.prompt-row { display: flex; align-items: center; gap: 0.75rem; }

.char-count { font-size: 0.75rem; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--error); }

.build-error {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--error);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-row .primary-button { margin-left: auto; }

/* ───────────────────────── right column ───────────────────────── */

.tabbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
}

.tabs {
  display: inline-flex;
  gap: 0.15rem;
  padding: 0.2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--pill);
}
.tabs button {
  background: transparent;
  border: 0;
  border-radius: var(--pill);
  color: var(--muted);
  padding: 0.3rem 1rem;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--text); color: #ffffff; }

.open-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 2.125rem;
  padding: 0 0.9rem;
  border-radius: var(--pill);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}
.open-link:hover { border-color: var(--text); }
.open-link.disabled { color: var(--dim); border-color: var(--border); pointer-events: none; }

.result-strip {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.rs-badge {
  display: inline-flex;
  align-items: center;
  height: 1.75rem;
  padding: 0 0.7rem;
  border-radius: var(--pill);
  font-size: 0.75rem;
  font-weight: 800;
}
.rs-badge.success { background: var(--accent-soft); color: var(--accent); }
.rs-badge.partial { background: var(--warn-soft);   color: var(--warn); }
.rs-badge.failed  { background: var(--error-soft);  color: var(--error); }
.rs-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 1.75rem;
  padding: 0 0.7rem;
  border-radius: var(--pill);
  background: var(--panel);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.rs-item b { color: var(--text); font-weight: 800; }
.rs-run {
  display: inline-flex;
  align-items: center;
  height: 1.75rem;
  padding: 0 0.7rem;
  border-radius: var(--pill);
  background: var(--panel);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--dim);
  white-space: nowrap;
}

/* ───────────────────────── device frames ───────────────────────── */

.frame-area {
  flex: 1 1 auto;
  /* never let a short viewport collapse the device frame to nothing */
  min-height: 10rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.device-wrap { position: relative; }
.device-wrap.wrap-fill { width: 100%; height: 100%; }

.device {
  transform-origin: top left;
  background: #1b1f1d;
  overflow: hidden;
}
.device[data-device="web"] {
  width: 100%;
  height: 100%;
  border-radius: 0;
  padding: 0;
  background: #ffffff;
}
.device[data-device="tablet"],
.device[data-device="phone"] {
  border: 1px solid #2c322f;
}

#app-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding: 2rem;
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.ph-spinner {
  display: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  margin-bottom: 0.4rem;
}
.ph-title { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.ph-sub   { font-size: 0.9375rem; color: var(--muted); }
.placeholder.building .ph-spinner { display: block; }
.placeholder.failed .ph-title { color: var(--error); }
.placeholder.failed { border-color: #f0c7c2; }

/* ───────────────────────── misc ───────────────────────── */

@keyframes softPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(0.35rem); }
}

@media (max-width: 1100px) {
  .columns { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); overflow-y: auto; }
  .header { flex-wrap: wrap; }
  .try-section { grid-template-columns: minmax(0, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  /* a phone scrolls the page as one column: no slides, no sticky header */
  html[data-view="landing"] { scroll-snap-type: none; }
  .slide { min-height: 0; scroll-snap-align: none; }
  .site-header { position: static; height: auto; flex-wrap: wrap; padding-top: 1rem; padding-bottom: 1rem; }
  .site-header, .hero, .video-section, .gallery-section, .site-footer { padding-left: 1rem; padding-right: 1rem; }
  .site-nav { gap: 1rem; flex-wrap: wrap; }
  .hero { padding: 3rem 1rem 3.5rem; }
  .scroll-cue { display: none; }
  .hero-copy { font-size: 1.0625rem; }
  .video-section, .gallery-section { padding-top: 0; padding-bottom: 3rem; }
  .try-section { margin: 0 1rem; padding: 1.5rem; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .section-title { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
