/* ═══════════════════════════════════════════════════════════════
   fooform — the form builder (builder.html)
   One centred column. Everything lines up on the same grid.
   ═══════════════════════════════════════════════════════════════ */

:root { --app-shell: min(1040px, 92vw); }

body.is-app { overflow: hidden; }

.app {
  height: 100svh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ── top bar ──────────────────────────────────────────────── */
.appbar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--veil);
  backdrop-filter: blur(20px) saturate(160%);
  z-index: 20;
}
.appbar__in {
  width: var(--app-shell); margin: 0 auto;
  height: 60px;
  display: flex; align-items: center; gap: 16px;
}
.appbar__back {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); color: var(--ink-2);
  font-size: 14px; font-weight: 600; letter-spacing: -.02em;
  transition: all .3s ease; flex-shrink: 0;
}
.appbar__back:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface); }
.appbar__back svg { width: 15px; height: 15px; }

.appbar__name {
  flex: 1; min-width: 0;
  padding: 9px 13px; border-radius: 10px;
  border: 1px solid transparent; background: transparent;
  font-size: 15px; font-weight: 600; letter-spacing: -.02em;
  transition: all .25s ease;
}
.appbar__name:hover { border-color: var(--line); }
.appbar__name:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.appbar__right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.appbar__save {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
  transition: color .3s ease;
}
.appbar__save.is-on { color: var(--accent-2); }

/* ── steps ────────────────────────────────────────────────── */
.srail {
  position: relative; flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.srail__line { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--line); }
.srail__fill {
  display: block; height: 100%; width: 25%;
  background: var(--grad);
  box-shadow: 0 0 14px color-mix(in oklab, var(--accent) 75%, transparent);
  transition: width .8s var(--ease-spring);
}
.srail__in {
  width: var(--app-shell); margin: 0 auto;
  display: flex; align-items: center; gap: 4px;
  padding: 11px 0;
  overflow-x: auto; scrollbar-width: none;
}
.srail__in::-webkit-scrollbar { display: none; }
.srail__gap { flex: 1; height: 1px; background: var(--line); min-width: 12px; }
.sstep {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 14px 6px 6px; border-radius: 999px;
  border: 1px solid transparent; opacity: .5;
  white-space: nowrap; flex-shrink: 0;
  transition: all .35s ease;
}
.sstep:hover { opacity: .85; }
.sstep.is-active { opacity: 1; background: var(--surface-2); border-color: var(--line-2); }
.sstep.is-done { opacity: .8; }
.sstep__dot {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  transition: all .45s var(--ease-spring);
}
.sstep.is-active .sstep__dot {
  background: var(--grad); border-color: transparent; color: var(--on-accent); font-weight: 700;
  box-shadow: 0 0 18px -4px color-mix(in oklab, var(--accent) 90%, transparent);
  transform: scale(1.08);
}
.sstep.is-done .sstep__dot {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  border-color: color-mix(in oklab, var(--accent) 50%, transparent); color: var(--ink);
}
.sstep.is-done .sstep__dot i { display: none; }
.sstep.is-done .sstep__dot::after { content: "✓"; font-size: 12px; }
.sstep__name { font-size: 13.4px; font-weight: 500; }

/* ── stage ────────────────────────────────────────────────── */
.stage {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  perspective: 1600px;
}
.shell { width: var(--app-shell); margin: 0 auto; padding: 34px 0 52px; }

.pane { display: none; }
.pane.is-active { display: block; }
.pane.warp-in-next  { animation: warpInNext .68s var(--ease-out) both; }
.pane.warp-in-prev  { animation: warpInPrev .68s var(--ease-out) both; }
.pane.warp-out-next { animation: warpOutNext .4s var(--ease-in-out) both; }
.pane.warp-out-prev { animation: warpOutPrev .4s var(--ease-in-out) both; }
@keyframes warpInNext  { 0%{opacity:0;transform:translate3d(70px,0,-260px) rotateY(-16deg);filter:blur(10px)} 60%{filter:blur(0)} 100%{opacity:1;transform:none;filter:blur(0)} }
@keyframes warpOutNext { 0%{opacity:1;transform:none} 100%{opacity:0;transform:translate3d(-70px,0,-260px) rotateY(16deg);filter:blur(10px)} }
@keyframes warpInPrev  { 0%{opacity:0;transform:translate3d(-70px,0,-260px) rotateY(16deg);filter:blur(10px)} 60%{filter:blur(0)} 100%{opacity:1;transform:none;filter:blur(0)} }
@keyframes warpOutPrev { 0%{opacity:1;transform:none} 100%{opacity:0;transform:translate3d(70px,0,-260px) rotateY(-16deg);filter:blur(10px)} }

@keyframes staggerIn { from { opacity: 0; transform: translateY(22px) } }
.pane.is-active .stagger { animation: staggerIn .6s var(--ease-out) both; animation-delay: calc(var(--si,0) * 50ms + 80ms); }

.pane__head { text-align: center; margin-bottom: 30px; }
.pane__head h1 { font-size: clamp(25px, 3vw, 36px); letter-spacing: -.04em; font-weight: 700; }
.pane__head p { color: var(--ink-2); font-size: 15px; margin-top: 8px; }

/* ── step 1: templates ────────────────────────────────────── */
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tpl {
  position: relative; text-align: left;
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--card); overflow: hidden;
  transition: transform .45s var(--ease-spring), border-color .35s ease, box-shadow .35s ease;
}
.tpl:hover { transform: translateY(-5px); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.tpl.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 20px 46px -24px color-mix(in oklab, var(--accent) 90%, transparent);
}
.tpl__art {
  display: grid; place-items: center;
  height: 112px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); overflow: hidden;
}
.tpl__art svg { height: 100%; width: auto; max-width: 100%; }
.tpl__body { display: block; padding: 16px 18px 18px; }
.tpl__name { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.tpl__desc { display: block; color: var(--ink-2); font-size: 13px; margin-top: 5px; line-height: 1.5; }
.tpl__count { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin-top: 11px; }
.tpl__check {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent); font-size: 12px; font-weight: 700;
  opacity: 0; transform: scale(.4);
  transition: opacity .3s ease, transform .45s var(--ease-spring);
}
.tpl.is-on .tpl__check { opacity: 1; transform: none; }

@media (max-width: 860px) { .tpl-grid { grid-template-columns: repeat(2, 1fr) } }
@media (max-width: 560px) { .tpl-grid { grid-template-columns: 1fr } }

/* ── step 2: questions ────────────────────────────────────── */
.build { width: min(680px, 100%); margin: 0 auto; }

.canvas-head { margin-bottom: 20px; }
.canvas-title, .canvas-desc {
  display: block; width: 100%;
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 7px 11px; margin-left: -11px;
  transition: border-color .25s ease, background .25s ease;
}
.canvas-title { font-size: 27px; font-weight: 700; letter-spacing: -.035em; }
.canvas-desc { font-size: 14.5px; color: var(--ink-2); margin-top: 2px; }
.canvas-title:hover, .canvas-desc:hover { border-color: var(--line); }
.canvas-title:focus, .canvas-desc:focus { border-color: var(--accent); background: var(--surface); outline: none; }

.canvas { display: flex; flex-direction: column; gap: 10px; }

.fcard {
  position: relative;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--card);
  padding: 15px 16px 16px 34px;
  cursor: pointer;
  transition: border-color .3s ease, box-shadow .3s ease, background .3s ease;
  animation: cardIn .45s var(--ease-spring) both;
  scroll-margin: 18px;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(-8px) scale(.99) } }
.fcard:hover { border-color: var(--line-2); background: var(--card-hi); }
.fcard.is-sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 18px 44px -26px color-mix(in oklab, var(--accent) 90%, transparent);
  cursor: default;
}
.fcard.is-drag { opacity: .4; }
.fcard.is-over::before,
.fcard.is-over-end::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px;
  border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.fcard.is-over::before { top: -6px; }
.fcard.is-over-end::after { bottom: -6px; }
.fcard__grip {
  position: absolute; left: 9px; top: 17px;
  width: 17px; height: 22px; cursor: grab;
  display: grid; place-items: center;
  color: var(--ink-3); opacity: .45;
  transition: opacity .25s ease;
}
.fcard:hover .fcard__grip, .fcard.is-sel .fcard__grip { opacity: 1; }
.fcard__grip:active { cursor: grabbing; }
.fcard__grip svg { width: 14px; height: 14px; }

.fcard__top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.fcard__label {
  flex: 1; min-width: 0;
  font-size: 14.8px; font-weight: 600; letter-spacing: -.01em;
  border-radius: 6px; padding: 1px 4px; margin: -1px -4px;
  transition: background .25s ease;
}
.fcard__label:hover { background: var(--surface-2); }
.fcard__label:focus { outline: none; background: var(--surface-2); box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 35%, transparent); }
.fcard__req { color: var(--pink); margin-left: 3px; }
.fcard__num {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  width: 18px; flex-shrink: 0; padding-top: 3px;
}
.fcard__acts { display: flex; gap: 3px; opacity: 0; transition: opacity .25s ease; flex-shrink: 0; }
.fcard:hover .fcard__acts, .fcard.is-sel .fcard__acts { opacity: 1; }
.fcard__help { font-size: 12.6px; color: var(--ink-3); margin: -4px 0 10px; }
.fcard__body { pointer-events: none; user-select: none; }

.iconbtn {
  width: 27px; height: 27px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-3); border: 1px solid transparent;
  transition: all .25s ease;
}
.iconbtn svg { width: 14px; height: 14px; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.iconbtn.is-danger:hover { color: var(--pink); border-color: color-mix(in oklab, var(--pink) 50%, transparent); }

/* question previews inside a card */
.fp-input {
  height: 38px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2);
  display: flex; align-items: center; padding: 0 12px;
  color: var(--ink-3); font-size: 13.4px;
}
.fp-input--area { height: 64px; align-items: flex-start; padding-top: 10px; }
.fp-input--select { justify-content: space-between; }
.fp-input--select svg { width: 12px; height: 12px; opacity: .6; }
.fp-opts { display: flex; flex-direction: column; gap: 6px; }
.fp-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: 13px; color: var(--ink-2);
}
.fp-mark { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-2); flex-shrink: 0; }
.fp-mark--sq { border-radius: 5px; }
.fp-more { font-size: 12px; color: var(--ink-3); padding: 6px 0 0 4px; }
.fp-stars { display: flex; gap: 6px; }
.fp-stars svg { width: 24px; height: 24px; color: var(--accent); opacity: .45; }
.fp-switch { display: flex; align-items: center; gap: 10px; font-size: 13.2px; color: var(--ink-2); }
.fp-track { width: 40px; height: 23px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--bg-2); padding: 2px; }
.fp-knob { width: 17px; height: 17px; border-radius: 50%; background: var(--line-2); }
.fp-range { display: flex; align-items: center; gap: 12px; }
.fp-track2 { flex: 1; height: 5px; border-radius: 999px; background: var(--line-2); position: relative; }
.fp-track2::after { content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); }
.fp-scale { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.fp-file {
  border: 1.5px dashed var(--line-2); border-radius: 11px;
  padding: 14px; text-align: center; color: var(--ink-3); font-size: 12.6px;
  background: var(--bg-2);
}

/* inline editor — opens inside the selected card */
.fedit {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .42s var(--ease-out), opacity .3s ease;
  opacity: 0;
}
.fedit.is-open { grid-template-rows: 1fr; opacity: 1; }
.fedit__in { overflow: hidden; min-height: 0; }
.fedit__pad { padding-top: 16px; margin-top: 14px; border-top: 1px dashed var(--line-2); }
.fedit__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fedit__grid .field--wide { grid-column: 1 / -1; }
.fedit__foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--line-2);
}
.fedit__foot .spacer { flex: 1; }
.minibtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 12.8px; font-weight: 500; color: var(--ink-2);
  transition: all .25s ease;
}
.minibtn svg { width: 13px; height: 13px; }
.minibtn:hover { color: var(--ink); border-color: var(--accent); }
.minibtn.is-danger:hover { color: var(--pink); border-color: color-mix(in oklab, var(--pink) 55%, transparent); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .ctrl__label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between;
}
.ctrl__label b { color: var(--accent); font-weight: 500; }
.field input[type="text"], .field textarea, .field select, .ctrl__text {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--ink); font-size: 13.6px;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.field textarea { resize: vertical; min-height: 76px; font-family: var(--mono); font-size: 12.3px; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus, .ctrl__text:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.field select {
  appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.2px; color: var(--ink-2); }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
  width: 38px; height: 22px; border-radius: 999px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line-2);
  display: flex; align-items: center; padding: 2px;
  transition: background .3s ease, border-color .3s ease;
}
.toggle__knob { width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform .38s var(--ease-spring), background .3s ease; }
.toggle input:checked + .toggle__track { background: color-mix(in oklab, var(--accent) 55%, transparent); border-color: color-mix(in oklab, var(--accent) 70%, transparent); }
.toggle input:checked + .toggle__track .toggle__knob { transform: translateX(16px); background: #fff; }
.toggle input:focus-visible + .toggle__track { box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent); }

/* empty state */
.empty {
  text-align: center; padding: 34px 20px 38px;
  border: 1.5px dashed var(--line-2); border-radius: 18px;
  background: var(--surface);
}
.empty svg { width: 160px; height: 104px; margin: 0 auto 14px; }
.empty h3 { font-size: 18px; letter-spacing: -.02em; margin-bottom: 5px; }
.empty p { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* add a question */
.addbar { margin-top: 14px; }
.addbtn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px; border-radius: 14px;
  border: 1.5px dashed var(--line-2); background: transparent;
  color: var(--ink-2); font-size: 14.5px; font-weight: 600;
  transition: all .3s ease;
}
.addbtn svg { width: 17px; height: 17px; transition: transform .4s var(--ease-spring); }
.addbtn:hover {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in oklab, var(--accent) 7%, transparent);
}
.addbtn[aria-expanded="true"] { border-style: solid; border-color: var(--accent); color: var(--accent); }
.addbtn[aria-expanded="true"] svg { transform: rotate(135deg); }

.picker {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .42s var(--ease-out), opacity .3s ease;
  opacity: 0;
}
.picker.is-open { grid-template-rows: 1fr; opacity: 1; }
.picker__in { overflow: hidden; min-height: 0; }
.picker__grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 10px; padding: 14px;
  border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.picker__group {
  grid-column: 1 / -1;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 6px 2px 0;
}
.picker__grid > .picker__group:first-child { padding-top: 0; }
.ptype {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 13px 8px 11px; border-radius: 12px;
  border: 1px solid transparent; background: var(--bg-2);
  color: var(--ink-2); font-size: 12.2px; text-align: center; line-height: 1.25;
  transition: all .28s var(--ease-out);
}
.ptype__ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--accent);
  transition: all .28s var(--ease-out);
}
.ptype__ico svg { width: 16px; height: 16px; }
.ptype:hover {
  border-color: var(--accent); color: var(--ink);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  transform: translateY(-3px);
}
.ptype:hover .ptype__ico { background: var(--accent); color: var(--on-accent); border-color: transparent; }

.quick .ptype { flex-direction: row; padding: 9px 14px 9px 9px; background: var(--bg-2); }
.quick .ptype__ico { width: 26px; height: 26px; border-radius: 8px; }
.quick .ptype__ico svg { width: 14px; height: 14px; }

@media (max-width: 560px) { .picker__grid { grid-template-columns: repeat(3, 1fr) } }

/* ── step 3: look ─────────────────────────────────────────── */
.look { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; align-items: start; }
.look__controls {
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--card); padding: 20px;
  position: sticky; top: 0;
}
.ctrl { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.ctrl:last-child { margin-bottom: 0; }
.ctrl--row { flex-direction: row; gap: 18px; flex-wrap: wrap; }

.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); padding: 10px; text-align: left;
  transition: transform .4s var(--ease-spring), border-color .3s ease, box-shadow .3s ease;
}
.swatch:hover { transform: translateY(-3px); }
.swatch.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 26px -16px var(--accent); }
.swatch__dots { display: flex; gap: 4px; margin-bottom: 8px; }
.swatch__dots i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(128,128,128,.3); }
.swatch__name { font-size: 11.6px; font-weight: 500; }

.accents { display: flex; gap: 7px; flex-wrap: wrap; }
.accent-dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line-2) inset;
  transition: transform .4s var(--ease-spring), border-color .3s ease;
}
.accent-dot:hover { transform: scale(1.14); }
.accent-dot.is-on { border-color: var(--ink); transform: scale(1.14); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 999px;
  background: var(--line-2); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent);
  transition: transform .25s var(--ease-spring);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.18); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); }

.segmented {
  display: flex; gap: 4px; padding: 4px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.segmented button {
  flex: 1; padding: 9px 8px; border-radius: 9px;
  font-size: 12.4px; font-weight: 500; color: var(--ink-3);
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color .3s ease, background .35s var(--ease-out);
}
.segmented button svg { width: 14px; height: 14px; flex-shrink: 0; }
.segmented button.is-on { color: var(--ink); background: var(--surface-2); box-shadow: var(--shadow-sm); }

/* collapsible extras */
.more { margin-top: 4px; }
.more summary {
  list-style: none; cursor: pointer;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
  padding: 10px 0 2px;
  display: flex; align-items: center; gap: 8px;
  transition: color .25s ease;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before {
  content: ""; width: 6px; height: 6px; flex-shrink: 0;
  border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor;
  transform: rotate(-45deg); transition: transform .3s var(--ease-out);
}
.more[open] summary::before { transform: rotate(45deg); }
.more summary:hover { color: var(--accent); }
.more__in { padding-top: 14px; animation: staggerIn .4s var(--ease-out) both; }

/* preview */
.device {
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg-2);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  margin: 0 auto; width: 100%;
  transition: max-width .5s var(--ease-out);
}
.device--phone { max-width: 400px; }
.device__bar {
  display: flex; align-items: center; gap: 7px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface); flex-shrink: 0;
}
.device__bar i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.device__bar span { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
/* flex:1 would set flex-basis:0 and beat this height, so opt out explicitly */
.device__screen { flex: 0 0 auto; height: clamp(380px, calc(100svh - 340px), 720px); background: #fff; }
.device__screen iframe { width: 100%; height: 100%; border: 0; }

.ptools { display: flex; align-items: center; justify-content: center; gap: 9px; flex-wrap: wrap; margin-top: 13px; }
.ptool {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  transition: all .3s ease;
}
.ptool svg { width: 13px; height: 13px; }
.ptool:hover, .ptool.is-on { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 55%, transparent); }

@media (max-width: 880px) {
  .look { grid-template-columns: 1fr; }
  .look__controls { position: static; }
}

/* ── step 4: download ─────────────────────────────────────── */
.done { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 26px; align-items: start; }
.done__side { position: sticky; top: 0; display: flex; flex-direction: column; gap: 12px; }
.done__title { font-size: 24px; letter-spacing: -.035em; font-weight: 700; }
.summary {
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); padding: 14px 18px;
}
.summary__row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; font-size: 13.4px; border-bottom: 1px dashed var(--line); }
.summary__row:last-child { border-bottom: 0; }
.summary__row span { color: var(--ink-3); font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.summary__row b { font-weight: 500; }
.done__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.done__row .btn { padding: 12px 12px; font-size: 13px; }
.done__note { color: var(--ink-3); font-size: 12.4px; line-height: 1.6; margin-bottom: 12px; }
.done__note code {
  font-family: var(--mono); font-size: 11.5px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-2);
}

@media (max-width: 880px) {
  .done { grid-template-columns: 1fr; }
  .done__side { position: static; }
}

/* ── bottom bar ───────────────────────────────────────────── */
.appfoot {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--veil); backdrop-filter: blur(20px);
}
.appfoot__in {
  width: var(--app-shell); margin: 0 auto;
  height: 66px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.appfoot__hint { flex: 1; text-align: center; font-size: 13px; color: var(--ink-3); }
.navbtn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14.5px; font-weight: 600;
  transition: transform .35s var(--ease-spring), border-color .3s ease, opacity .3s ease, background .3s ease;
}
.navbtn svg { width: 16px; height: 16px; }
.navbtn:hover:not(:disabled) { border-color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.navbtn:disabled { opacity: .3; cursor: not-allowed; }
.navbtn:active:not(:disabled) { transform: scale(.96); }
.navbtn--primary {
  background: var(--grad); border-color: transparent; color: var(--on-accent);
  padding: 13px 30px;
  box-shadow: 0 12px 34px -14px color-mix(in oklab, var(--accent) 95%, transparent);
}
.navbtn--primary:hover:not(:disabled) {
  background: var(--grad); transform: translateY(-2px);
  box-shadow: 0 18px 46px -14px color-mix(in oklab, var(--accent) 100%, transparent);
}

/* ── small screens ────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --app-shell: calc(100vw - 32px); }
  .app { height: auto; min-height: 100svh; }
  body.is-app { overflow: auto; }
  .stage { overflow: visible; }
  .shell { padding: 24px 0 36px; }
  .appfoot { position: sticky; bottom: 0; z-index: 15; }
  .appfoot__hint { display: none; }
  .sstep__name { display: none; }
  .sstep { padding: 6px; }
  .srail__gap { min-width: 6px; }
  .fedit__grid { grid-template-columns: 1fr; }
  .device__screen { height: min(70svh, 520px); }
  .navbtn { padding: 12px 18px; }
  .canvas-title { font-size: 23px; }
}
@media (max-width: 560px) {
  .appbar__save { display: none; }
  .appbar__in { gap: 10px; }
  .appbar__back span { display: none; }
  .appbar__back { padding: 8px 10px; }
}
