:root {
  --bg: #EEF2F5; --surface: #FFFFFF; --ink: #172433; --muted: #4A5868;
  --line: #C9D3DC; --green: #22704F; --green-soft: #E2F0E8;
  --amber-soft: #FBF0D9; --amber-ink: #6B4A0B; --field: #F8FAFB; --danger: #A3322A;
  --font: "Atkinson Hyperlegible", Verdana, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E151C; --surface: #19232E; --ink: #EAF0F5; --muted: #A9B6C3;
    --line: #344250; --green: #7FD1A6; --green-soft: #1B3328;
    --amber-soft: #3A2E15; --amber-ink: #F2D79A; --field: #131C25; --danger: #F2A49C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E151C; --surface: #19232E; --ink: #EAF0F5; --muted: #A9B6C3;
  --line: #344250; --green: #7FD1A6; --green-soft: #1B3328;
  --amber-soft: #3A2E15; --amber-ink: #F2D79A; --field: #131C25; --danger: #F2A49C;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 1.0625rem; line-height: 1.5;
}
a { color: var(--green); }
.wrap {
  max-width: 78rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 1.5rem 3rem;
}
.wrap.narrow { max-width: 44rem; }

nav.site { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
nav.site .brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
nav.site .brand span { color: var(--green); }

header.top { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; justify-content: space-between; margin-bottom: 1.5rem; }
header.top h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.05; margin: 0; text-wrap: balance; }
header.top p { margin: 0.4rem 0 0; color: var(--muted); max-width: 40rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

button, .btn {
  font: inherit; font-weight: 700; font-size: 0.98rem; cursor: pointer; text-decoration: none;
  border-radius: 0.6rem; padding: 0.55rem 0.95rem; display: inline-block;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
}
button.primary, .btn.primary { background: var(--green); border-color: var(--green); color: var(--bg); }
.btn.big, button.big { font-size: 1.25rem; padding: 0.9rem 1.6rem; border-radius: 0.8rem; }
button.link { border: 0; background: none; padding: 0.25rem 0; color: var(--green); text-decoration: underline; }
button.remove { border: 0; background: none; color: var(--danger); padding: 0.25rem 0.4rem; font-size: 0.9rem; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, label.upload:focus-within { outline: 3px solid var(--green); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; }

/* landing */
.hero-copy { max-width: 40rem; margin: 2rem 0 2.5rem; }
.hero-copy h1 { font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: 1.02; margin: 0 0 1rem; text-wrap: balance; }
.hero-copy p { font-size: 1.2rem; margin: 0 0 1.5rem; color: var(--muted); }
.steps3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 0 0 2.5rem; padding: 0; list-style: none; counter-reset: n; }
.steps3 li { counter-increment: n; background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; padding: 1rem 1.1rem 1.1rem; }
.steps3 li::before { content: counter(n); display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: var(--bg); font-weight: 700; margin-bottom: 0.6rem; }
.steps3 h2 { font-size: 1.15rem; margin: 0 0 0.3rem; }
.steps3 p { margin: 0; color: var(--muted); font-size: 0.98rem; }
.callout { background: var(--amber-soft); color: var(--amber-ink); border-radius: 0.8rem; padding: 0.9rem 1.1rem; max-width: 40rem; }
.callout b { color: inherit; }
.sample { margin: 2.5rem 0 0; }
.sample h2 { font-size: 1.4rem; margin: 0 0 0.75rem; }

/* builder */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: 2rem; align-items: start; }
.switch { display: none; }
@media (max-width: 860px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .switch { display: flex; gap: 0.4rem; margin-bottom: 1rem; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); padding-block: 0.5rem; }
  .switch button { flex: 1; }
  .switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  body[data-view="edit"] .preview-col { display: none; }
  body[data-view="preview"] .form-col { display: none; }
}
form { display: flex; flex-direction: column; gap: 1.25rem; }
fieldset {
  margin: 0; border: 1px solid var(--line); border-radius: 0.9rem;
  background: var(--surface); padding: 1rem 1.1rem 1.15rem;
  display: flex; flex-direction: column; gap: 0.9rem; min-width: 0;
}
legend { font-weight: 700; font-size: 1.15rem; padding: 0 0.35rem; }
.why { margin: -0.4rem 0 0; color: var(--muted); font-size: 0.95rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > label, .field > .lbl { font-weight: 700; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.88rem; font-style: italic; }
input[type="text"], textarea {
  font: inherit; color: var(--ink); background: var(--field);
  border: 1.5px solid var(--line); border-radius: 0.55rem; padding: 0.55rem 0.7rem; width: 100%;
}
textarea { min-height: 4.2rem; resize: vertical; }
::placeholder { color: var(--muted); opacity: 0.75; }
.repeat { display: flex; flex-direction: column; gap: 0.75rem; }
.item {
  border: 1px dashed var(--line); border-radius: 0.7rem; padding: 0.8rem;
  display: flex; flex-direction: column; gap: 0.6rem; background: var(--field);
}
.item input[type="text"], .item textarea { background: var(--surface); }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.item-head span { font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.step-row { display: flex; gap: 0.5rem; align-items: center; }
.step-row .num {
  flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 0.9rem;
}
.photo-pick { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.thumb {
  width: 4.5rem; height: 4.5rem; border-radius: 0.6rem; flex: none;
  border: 2px dashed var(--line); background: var(--field) center / cover no-repeat;
  display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; text-align: center;
}
.thumb.has { border-style: solid; }
label.upload { display: inline-block; cursor: pointer; position: relative; }
label.upload input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.upload span { display: inline-block; font-weight: 700; font-size: 0.95rem; border: 1.5px solid var(--line); border-radius: 0.6rem; padding: 0.45rem 0.8rem; background: var(--surface); }
label.upload.off { cursor: default; }
label.upload.off span { opacity: 0.5; }
.photo-count { font-size: 0.9rem; color: var(--muted); font-weight: 700; }
.photo-count.full { color: var(--amber-ink); }

.preview-col { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.preview-col .cap { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 0.9rem; }
.phone {
  border: 1px solid var(--line); border-radius: 1.6rem; background: var(--surface);
  padding: 0.6rem; box-shadow: 0 10px 30px -18px rgba(10, 20, 30, 0.45);
}
.phone iframe { display: block; width: 100%; height: min(78vh, 46rem); border: 0; border-radius: 1.1rem; background: var(--bg); }
@media (max-width: 860px) { .preview-col { position: static; } .phone iframe { height: 75vh; } }

.finish { background: var(--green-soft); border: 0; }
.finish legend { background: var(--green-soft); border-radius: 0.4rem; }
.status { min-height: 1.5em; font-weight: 700; color: var(--green); margin: 0; }
.status.err { color: var(--danger); }
.privacy { font-size: 0.92rem; color: var(--muted); margin: 0; }
.confirm { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; background: var(--amber-soft); color: var(--amber-ink); border-radius: 0.6rem; padding: 0.6rem 0.8rem; font-weight: 700; }
progress { width: 100%; height: 0.6rem; accent-color: var(--green); }

/* done page */
.done-grid { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 700px) { .done-grid { grid-template-columns: minmax(0, 1fr); } }
#cardCanvas { width: 100%; max-width: 18rem; height: auto; border: 1px solid var(--line); border-radius: 0.6rem; background: #fff; display: block; }
#qrCanvas { width: 12rem; height: 12rem; display: block; background: #fff; border-radius: 0.5rem; border: 1px solid var(--line); }
.linkbox { display: flex; gap: 0.5rem; align-items: stretch; }
.linkbox input { flex: 1; min-width: 0; font-size: 0.95rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 0.9rem; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.card h2 { margin: 0; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
footer.site { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
