/* PromptCloak — quiet, precise, monochrome. Composer-first.
   Type does the branding: Geist Sans for voice, Geist Mono for machinery.
   Cyan appears only as functional state (● E2EE, restored underlines). */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --input: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #a1a1aa;
  --invert-bg: #18181b;
  --invert-text: #fafafa;
  --state: #0e9494;           /* functional cyan, light-mode legible */
  --state-soft: rgba(14, 148, 148, 0.1);
  --danger: #c2453a;
  --danger-soft: rgba(194, 69, 58, 0.09);
  --warn: #a3722a;
  --silver-hi: #2e2e33;
  --silver-lo: #6b6b74;
  --silver-mid: #6f6f78;
  --silver-dim: #a4a4ad;
  --pipe-pending: #b0b0b8;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Geist", "Inter", system-ui, -apple-system, sans-serif;
  --r-major: 14px;            /* composer, cards */
  --r-ctl: 8px;               /* normal controls */
  --r-send: 10px;             /* send button: near-square */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 40px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] {
  --bg: #080809;
  --surface: #111113;
  --input: #161618;
  --border: #29292d;
  --border-strong: #3a3a40;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #68686f;
  --silver-hi: #fafafb;
  --silver-lo: #b4b4bf;
  --silver-mid: #9d9da8;
  --silver-dim: #74747e;
  --pipe-pending: #62626b;
  --invert-bg: #f4f4f5;
  --invert-text: #0a0a0b;
  --state: #22c8c8;
  --state-soft: rgba(34, 200, 200, 0.12);
  --danger: #e0715c;
  --danger-soft: rgba(224, 113, 92, 0.12);
  --warn: #d9a03f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 16px 48px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080809;
    --surface: #111113;
    --input: #161618;
    --border: #29292d;
    --border-strong: #3a3a40;
    --text: #f4f4f5;
    --text-2: #a1a1aa;
    --text-3: #68686f;
    --silver-hi: #fafafb;
    --silver-lo: #b4b4bf;
    --silver-mid: #9d9da8;
    --silver-dim: #74747e;
    --pipe-pending: #62626b;
    --invert-bg: #f4f4f5;
    --invert-text: #0a0a0b;
    --state: #22c8c8;
    --state-soft: rgba(34, 200, 200, 0.12);
    --danger: #e0715c;
    --danger-soft: rgba(224, 113, 92, 0.12);
    --warn: #d9a03f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.6), 0 16px 48px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 720px; margin: 0 auto; padding: 0 24px 88px; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 0;
}
.logo {
  display: flex; align-items: center; gap: 9px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
}
.logo svg { color: var(--text); display: block; }
.header-right { display: flex; align-items: center; gap: 8px; }

.badge {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--state); flex: none;
}
.badge.warn { color: var(--danger); }
.badge.warn::before { background: var(--danger); }

.icon-btn {
  background: none; border: none; color: var(--text-3);
  border-radius: var(--r-ctl); width: 34px; height: 34px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }

/* ---------- hero: message, then the machine ----------
   Silver-gradient two-tone: line 1 bright metallic, line 2 quieter but
   instantly readable (~55%), revealed once on load — the cloak motif. */
.hero { margin: 72px 0 22px; text-align: left; }
.hero .glyph { display: none; }
.hero h1 {
  font-weight: 600; font-size: 34px; letter-spacing: -0.03em;
  margin: 0 0 10px; line-height: 1.12;
  background: linear-gradient(135deg, var(--silver-hi) 20%, var(--silver-lo) 90%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero h1 .quiet {
  background: linear-gradient(135deg, var(--silver-mid) 10%, var(--silver-dim) 90%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  display: inline-block;
  animation: unveil 0.9s cubic-bezier(0.25, 1, 0.4, 1) 0.15s both;
}
@keyframes unveil {
  from { clip-path: inset(0 100% 0 0); opacity: 0.4; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .hero h1 .quiet { animation: none; }
}
.hero p {
  color: var(--text-2); margin: 0; font-size: 14.5px; max-width: 48ch;
  line-height: 1.55;
}
.hero.compact { margin: 30px 0 16px; }
.hero.compact h1 { font-size: 17px; letter-spacing: -0.015em; margin-bottom: 0; }
.hero.compact p { display: none; }

/* ---------- pipeline: typography only ---------- */
.stepper {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 14px; padding: 0; flex-wrap: wrap;
}
.step {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--pipe-pending);
  transition: color 0.25s ease;
  position: relative;
}
.step + .step::before {
  content: "→"; color: var(--pipe-pending); opacity: 0.6;
  margin-right: 10px; letter-spacing: 0;
}
.step.done { color: var(--text-2); }
.step.active { color: var(--text); font-weight: 600; }
.step.active.working { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-major);
  margin-bottom: 18px; overflow: hidden;
  display: none;
}
.card.enabled { display: block; animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 0;
}
.card-title {
  font-family: var(--mono); font-weight: 500; font-size: 10.5px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.14em;
}
.card-title .num { display: none; }
.card-title .hint { font-family: var(--sans); text-transform: none; letter-spacing: 0; font-weight: 400; }
.card-body { padding: 12px 20px 18px; }
.card-actions { display: flex; align-items: center; gap: 6px; }

/* ---------- composer: the hero object ---------- */
#card-1 {
  background: var(--input);
  background: linear-gradient(180deg, var(--input), color-mix(in srgb, var(--input) 82%, var(--bg)));
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow);
}
#card-1 .card-head { display: none; }
#card-1 .card-body { padding: 0; }

textarea {
  width: 100%; min-height: 132px; resize: vertical;
  background: transparent; color: var(--text);
  border: none;
  padding: 18px 18px 10px; font-family: var(--sans); font-size: 15.5px; line-height: 1.6;
  display: block;
}
textarea::placeholder { color: var(--text-3); }
textarea:focus { outline: none; }

/* distinct lower control bar */
#card-1 .chips { padding: 0 14px 8px; }
#card-1 .row {
  margin: 0; padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 12px; align-items: center;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.spacer { flex: 1; }
.hint { color: var(--text-3); font-size: 12.5px; }
#char-count { font-family: var(--mono); font-size: 11px; }

.scrub-status {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.scrub-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--state); flex: none;
}
.scrub-status.warn::before { background: var(--danger); }

select {
  background: transparent; color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--r-ctl); padding: 7px 26px 7px 10px;
  min-width: 138px;   /* the selected frontier model must stay legible */
  font-size: 12px; font-weight: 500;
  font-family: var(--mono); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 10px) 55%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
select:hover { border-color: var(--border-strong); }
select:focus { outline: 1px solid var(--text-3); }

button.primary {
  background: linear-gradient(180deg, var(--silver-hi), var(--silver-lo));
  color: var(--invert-text);
  border: none; border-radius: var(--r-ctl);
  padding: 9px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: var(--sans);
  display: inline-flex; align-items: center; gap: 7px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
button.primary:hover { opacity: 0.85; }
button.primary:active { transform: scale(0.98); }
button.primary:disabled { opacity: 0.4; cursor: default; }

button.circle {
  /* send: near-square, not a capsule */
  width: 38px; height: 38px; padding: 0; border-radius: var(--r-send);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; line-height: 1;
}

button.ghost {
  background: none; border: none; color: var(--text-3);
  border-radius: var(--r-ctl); padding: 6px 11px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; font-family: var(--sans);
}
button.ghost:hover { color: var(--text); background: var(--input); }
#card-1 button.ghost:hover { background: var(--surface); }

/* ---------- lower nav: about / privacy accordions ---------- */
.nowrap { white-space: nowrap; }
.lower-nav { margin-top: 40px; }
.lower-nav .about { margin-top: 0; }
.lower-nav .about + .about { border-top: 1px solid var(--border); }
.lower-nav { border-bottom: 1px solid var(--border); }
.privacy-body .assurance p { font-family: inherit; }
.about {
  border-top: 1px solid var(--border);
  padding-top: 2px;
}
.about summary {
  cursor: pointer; list-style: none;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2); padding: 12px 2px;
  display: flex; align-items: center; justify-content: space-between;
  user-select: none;
}
.about summary::-webkit-details-marker { display: none; }
.about summary::after {
  content: "+"; font-size: 13px; letter-spacing: 0;
  transition: transform 0.2s ease;
}
.about[open] summary::after { content: "–"; }
.about summary:hover { color: var(--text); }
.about-body {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
  padding: 8px 2px 14px;
  animation: rise 0.25s ease;
}
/* camera capture is a mobile affordance; desktop uses Attach */
#camera-btn { display: none; align-items: center; }
@media (max-width: 640px) {
  #camera-btn { display: inline-flex; padding: 7px 8px; }
}

.assurance h4 {
  margin: 0 0 3px; font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em;
}
.assurance p { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ---------- mapping table ---------- */
table.mapping { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.mapping th {
  text-align: left; color: var(--text-3); font-family: var(--mono);
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  padding: 8px 8px 9px 0; font-weight: 500;
  border-bottom: 1px solid var(--border);
}
table.mapping td {
  padding: 2px 8px 2px 0; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
table.mapping tr:last-child td { border-bottom: none; }
table.mapping input {
  width: 100%; background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: var(--r-ctl);
  padding: 7px 10px; font-family: var(--mono); font-size: 12px;
}
table.mapping input:hover { background: var(--input); }
table.mapping input:focus { outline: none; background: var(--input); border-color: var(--border-strong); }
.chip {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 99px;
  border: 1px solid var(--border); color: var(--text-3);
  white-space: nowrap; text-transform: uppercase; letter-spacing: 0.08em;
}
.arrow { color: var(--text-3); font-size: 12px; }
.del-btn {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 12px; padding: 5px 8px; border-radius: var(--r-ctl); opacity: 0.35;
}
tr:hover .del-btn { opacity: 1; }
.del-btn:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- output panes ---------- */
.pane {
  background: var(--input); border: 1px solid var(--border);
  border-radius: var(--r-ctl); padding: 15px 17px;
  font-size: 14.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  min-height: 52px; max-height: 440px; overflow-y: auto;
}
#scrambled-pane { font-family: var(--mono); font-size: 12.5px; }
.pane mark, .bubble mark {
  background: var(--border); color: var(--text);
  border-radius: 4px; padding: 0.5px 5px; font-family: var(--mono);
  font-size: 0.92em;
}
.pane mark.restored, .bubble mark.restored {
  background: transparent; color: var(--text); font-family: inherit;
  font-size: inherit; border-bottom: 1.5px solid var(--state);
  border-radius: 0; padding: 0 1px; font-weight: 550;
}

.cursor {
  display: inline-block; width: 7px; height: 15px; background: var(--text-2);
  vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite;
  border-radius: 1px; margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- toggle ---------- */
.toggle {
  display: inline-flex; background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl); padding: 2px; gap: 2px;
}
.toggle button {
  background: none; border: none; padding: 4px 11px; font-size: 11px;
  font-family: var(--mono); font-weight: 500; color: var(--text-3); cursor: pointer;
  border-radius: 6px;
}
.toggle button.on { background: var(--invert-bg); color: var(--invert-text); }

/* ---------- toast + modal ---------- */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(6px);
  background: var(--invert-bg); color: var(--invert-text);
  padding: 11px 20px; border-radius: var(--r-ctl);
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease; max-width: 80vw; z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.ok { background: var(--invert-bg); color: var(--invert-text); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 40;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-major); padding: 28px;
  width: min(380px, 90vw); box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.modal p { color: var(--text-2); font-size: 13px; margin: 0 0 16px; }
.modal input {
  width: 100%; background: var(--input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-ctl); padding: 10px 14px;
  font-size: 13px; margin-bottom: 12px; font-family: var(--mono);
}
.modal input:focus { outline: 1px solid var(--text-3); }
.modal button.primary { width: 100%; justify-content: center; }

/* ---------- settings ---------- */
.settings-wrap { position: relative; }
.settings-panel {
  position: absolute; top: 42px; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-major); box-shadow: var(--shadow);
  padding: 8px; width: 250px; display: none;
}
.settings-panel.open { display: block; animation: rise 0.2s ease; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 12px; border-radius: var(--r-ctl);
  font-size: 13px; font-weight: 500;
}
.setting-row:hover { background: var(--input); }
.setting-row span { display: flex; flex-direction: column; gap: 1px; }
.setting-row small {
  font-weight: 400; font-size: 11px; color: var(--text-3);
}
.switch {
  width: 34px; height: 20px; border-radius: 99px; flex: none;
  background: var(--border-strong); border: none; cursor: pointer;
  position: relative; transition: background 0.15s ease;
  padding: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.switch.on { background: var(--state); }
.switch.on::after { transform: translateX(14px); }

/* ---------- chat mode ---------- */
#chat-log { display: none; }
#chat-log.active { display: block; margin-bottom: 18px; }
.msg { margin: 0 0 18px; animation: rise 0.3s ease; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  background: var(--input); border: 1px solid var(--border);
  border-radius: var(--r-major); border-bottom-right-radius: 4px;
  padding: 10px 15px; max-width: 85%;
  font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.msg.assistant .bubble {
  font-size: 14.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  padding: 2px 1px;
}
.msg .msg-meta {
  font-family: var(--mono); font-size: 10px; color: var(--text-3);
  letter-spacing: 0.05em; margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.msg.user .msg-meta { justify-content: flex-end; }
.msg .msg-meta .cloaked-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--state);
  display: inline-block;
}
.msg .msg-status {
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 7px;
}
.msg .msg-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--state); animation: pulse 1.2s ease-in-out infinite;
}
.msg .msg-thumbs { display: flex; gap: 8px; margin-top: 6px; justify-content: flex-end; }
.msg .msg-thumbs img { height: 72px; border-radius: var(--r-ctl); border: 1px solid var(--border); }

body.chat-mode .stepper { display: none; }
body.chat-mode #card-2, body.chat-mode #card-3,
body.chat-mode #card-4, body.chat-mode #card-5 { display: none !important; }

footer {
  text-align: center; color: var(--text-2); font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.04em; margin-top: 48px; opacity: 0.85;
}
footer a { color: inherit; }
footer .dot { margin: 0 8px; opacity: 0.5; }

/* ---------- attachments ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 6px; }
.chips:empty { display: none; }
.chip-file {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 5px 10px; font-size: 12px; font-weight: 500;
  background: var(--surface); max-width: 100%;
}
.chip-file .kind { font-size: 12px; }
.chip-file .fname {
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-file .meta { color: var(--text-3); font-family: var(--mono); font-size: 10.5px; }
.chip-file .warn-ic { color: var(--warn); font-size: 12px; }
.chip-file .chip-x {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 11px; padding: 2px 3px; border-radius: 4px;
}
.chip-file .chip-x:hover { color: var(--danger); }
.chip-file.loading { opacity: 0.55; }

.warn-banner {
  border: 1px solid var(--border); border-left: 3px solid var(--warn);
  background: var(--input);
  color: var(--text-2); border-radius: var(--r-ctl); padding: 9px 13px;
  font-size: 12.5px; margin-bottom: 12px;
}

/* image region review */
.img-review { margin-bottom: 16px; }
.img-review .review-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  font-size: 12px; color: var(--text-3); flex-wrap: wrap;
}
.img-stage { position: relative; display: inline-block; max-width: 100%; }
.img-stage img { max-width: 100%; display: block; border-radius: var(--r-ctl); }
.img-stage .draw-layer { position: absolute; inset: 0; cursor: crosshair; display: none; }
.img-stage.drawing .draw-layer { display: block; }
.region-box {
  position: absolute; border: 1.5px solid var(--invert-bg); border-radius: 3px;
  cursor: pointer; background: rgba(127, 127, 127, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.region-box.off { opacity: 0.35; border-style: dashed; background: transparent; }
.region-box .tag {
  position: absolute; top: -20px; left: -1px;
  background: var(--invert-bg); color: var(--invert-text);
  font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.05em;
  padding: 1px 7px; border-radius: 4px; white-space: nowrap;
}
.region-names { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.region-name-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.region-name-row .alias-lbl {
  min-width: 84px; color: var(--text-2); font-family: var(--mono);
  font-size: 11px; font-weight: 500;
}
.region-name-row input {
  background: var(--input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 5px 11px; font-size: 12px; width: 230px; font-family: var(--sans);
}
.region-name-row input:focus { outline: 1px solid var(--text-3); }

#blurred-thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
#blurred-thumbs:empty { display: none; }
#blurred-thumbs img {
  height: 104px; border-radius: var(--r-ctl); border: 1px solid var(--border);
}

/* ---------- mobile: denser, flatter, one strict gutter ---------- */
@media (max-width: 640px) {
  /* one page gutter; composer interior aligns to its own consistent inset */
  .wrap { padding: 0 18px calc(20px + env(safe-area-inset-bottom)); }
  header { padding-top: calc(12px + env(safe-area-inset-top)); }

  /* header: infrastructure chrome, not a hero */
  .logo { font-size: 13px; gap: 7px; }
  .logo svg { width: 16px; height: 16px; }
  .badge { padding: 3px 8px; font-size: 9.5px; gap: 5px; }
  .icon-btn { width: 34px; height: 34px; color: var(--text-3); }
  #settings-btn svg { width: 14px; height: 14px; stroke-width: 1.5; }

  /* hero: compact rhythm — headline → body → breathing room → composer */
  .hero { margin: 26px 0 20px; }
  .hero h1 { font-size: 23px; line-height: 1.14; margin-bottom: 9px; }
  .hero p { font-size: 12.5px; line-height: 1.5; max-width: none; }
  .hero.compact { margin: 16px 0 14px; }
  .stepper { gap: 6px; margin: 0 0 12px; }
  .step { font-size: 9px; letter-spacing: 0.09em; }
  .step + .step::before { margin-right: 6px; }

  /* chat mode: composer pinned to the bottom like a native chat app */
  body.chat-mode #card-1 {
    position: sticky;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
  }
  body.chat-mode #chat-log.active { margin-bottom: 12px; }
  .msg { margin-bottom: 14px; }
  .msg.user .bubble { max-width: 90%; font-size: 14.5px; padding: 8px 13px; }
  .msg.assistant .bubble { font-size: 14.5px; }

  /* composer: an instrument, not a card */
  #card-1 { border-radius: 12px; }
  textarea {
    min-height: 64px; padding: 12px 14px 4px;
    font-size: 16px; /* 16px minimum or iOS zoom-jumps on focus */
  }
  #card-1 .chips { padding: 0 12px 6px; }
  #card-1 .row { padding: 6px 8px 6px 10px; gap: 7px; flex-wrap: nowrap; }
  /* short functional label on the cyan dot */
  .scrub-status { font-size: 0; gap: 5px; flex: none; }
  .scrub-status::after {
    content: attr(data-short); font-family: var(--mono);
    font-size: 10px; color: var(--text-2); letter-spacing: 0.02em;
  }
  #new-chat-btn { white-space: nowrap; font-size: 11.5px; padding: 7px 8px; flex: none; }
  .attach-txt { display: none; }
  #char-count { display: none; }
  select { min-width: 108px; font-size: 11.5px; padding: 6px 22px 6px 8px; }
  /* send: flat, decisive, modest radius */
  button.circle { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; }
  button.primary { background: var(--invert-bg); }
  button.ghost { padding: 7px 9px; }

  /* lower nav sits close under the composer — no dead space */
  .lower-nav { margin-top: 22px; }
  .about summary { padding: 11px 0; font-size: 10px; }
  .about-body { grid-template-columns: 1fr; gap: 11px; padding-bottom: 12px; }
  .assurance p { font-size: 11.5px; }

  .card-head { flex-wrap: wrap; gap: 8px; padding: 12px 14px 0; }
  .card-body { padding: 10px 14px 14px; }
  /* mapping table scrolls sideways instead of breaking the page */
  #card-2 .card-body { overflow-x: auto; }
  table.mapping { min-width: 480px; }
  .region-name-row input { width: 100%; }
  .settings-panel { width: 228px; }
}
