:root {
  --bg: #faf9f7;
  --panel: #ffffff;
  --ink: #1b1b19;
  --muted: #6c6c65;
  --line: #e4e2dd;
  --accent: #1f5f4f;
  --accent-ink: #ffffff;
  --before: #8a4b1a;
  --before-bg: #fdf4ec;
  --after: #1f5f4f;
  --after-bg: #eef6f2;
  --bad: #9b2226;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16161a;
    --panel: #1e1e23;
    --ink: #ededeb;
    --muted: #9a9a94;
    --line: #313139;
    --accent: #6fcfae;
    --accent-ink: #11231d;
    --before: #e0a06a;
    --before-bg: #2a2119;
    --after: #6fcfae;
    --after-bg: #16271f;
    --bad: #f08a86;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

main { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 24px 16px; }

footer {
  border-top: 1px solid var(--line);
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

footer a { color: inherit; }

section { display: none; }
section.on { display: block; }
.hidden { display: none; }

.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

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

h1 { font-size: 21px; line-height: 1.3; margin: 0 0 8px; font-weight: 600; letter-spacing: -0.015em; }
.lede { margin: 0 0 20px; color: var(--muted); }
.said { margin: 0 0 18px; }

label { display: block; font-size: 14px; font-weight: 500; margin: 0 0 6px; }
label.inline { display: inline; margin: 0 10px 0 0; color: var(--muted); font-weight: 400; font-size: 14px; }

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

textarea { resize: vertical; min-height: 56px; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#code, #stepCode {
  font-size: 24px;
  letter-spacing: 0.3em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.go {
  margin-top: 16px;
  padding: 11px 20px;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.go.secondary { background: transparent; color: var(--accent); }
.go[disabled] { opacity: 0.45; cursor: progress; }

.link {
  background: none; border: none; padding: 0;
  color: var(--muted); font: inherit; font-size: 14px;
  text-decoration: underline; cursor: pointer;
}

.link.spaced { display: block; margin-top: 14px; }

header .link { margin-left: auto; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions .go { margin-top: 16px; }

.msg { margin: 14px 0 0; font-size: 14.5px; min-height: 1px; }
.msg.bad { color: var(--bad); }

/* -- chat ----------------------------------------------------------------- */

.chatCard { display: flex; flex-direction: column; }

.siteBar {
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 0;
  min-height: 180px;
  max-height: 46vh;
  overflow-y: auto;
}

.turn { max-width: 85%; padding: 11px 14px; border-radius: var(--radius); white-space: pre-wrap; }
.turn.them { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.turn.you { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; align-self: flex-end; }
.turn.wait { color: var(--muted); font-style: italic; }

/* -- the confirmation card ------------------------------------------------ */

.where { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 20px; font-size: 14.5px; }
.where dt { color: var(--muted); }
.where dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

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

.diff > div { border-radius: 9px; padding: 12px 14px; border: 1px solid var(--line); }
.diff p { margin: 6px 0 0; overflow-wrap: anywhere; }

.before { background: var(--before-bg); border-color: var(--before) !important; }
.after { background: var(--after-bg); border-color: var(--after) !important; }

.tag { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; }
.before .tag { color: var(--before); }
.after .tag { color: var(--after); }

.allowance { margin: 18px 0 0; color: var(--muted); font-size: 14.5px; }

/* The one link inside a card. Browser default blue reads as an error on a
   page that is already telling someone something went wrong. */
.mailto { color: var(--accent); font-weight: 600; }

@media (max-width: 480px) {
  main { padding: 16px 12px; }
  .card { padding: 18px; }
  h1 { font-size: 19px; }
  .turn { max-width: 92%; }
}
