:root {
  --bg: #fcf8f4;
  --ink: #2b2522;
  --muted: #7a6f69;
  --soft: #f1e9e2;
  --accent: #b4532a;
  --error: #a3341f;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 420px;
  margin: 0 auto;
  padding: max(48px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}

[hidden] { display: none !important; }

h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 20px; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }

.lead { font-size: 22px; font-weight: 500; line-height: 1.5; letter-spacing: -0.01em; margin: 0 0 18px; }
.muted { color: var(--muted); font-size: 17px; line-height: 1.45; margin: 0; }

/* Blanks */
.blank {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.editable { outline: none; padding: 0 1px; word-break: break-word; caret-color: var(--accent); cursor: text; }
.editable:empty::before { content: attr(data-placeholder); color: #dcab92; color: color-mix(in srgb, var(--accent) 45%, var(--bg)); }
.editable:focus { background: rgba(180, 83, 42, 0.07); background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 3px 3px 0 0; }

/* Name picker: a styled label with the native select laid invisibly on top */
.picker { position: relative; display: inline-block; white-space: nowrap; }
.picker-label { font-weight: 600; }
.picker-label::after, .chevron-only::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(45deg) translate(-2px, -3px);
  margin-left: 8px;
}
.picker select {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; font-size: 16px; cursor: pointer; appearance: none; border: 0;
}
.picker.is-other { white-space: normal; }
.picker.is-other select { left: auto; width: 28px; }
.other-wrap .editable { font-weight: 600; }
.date-hidden { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; pointer-events: none; }

/* Inputs & buttons */
input[type="password"] {
  width: 100%;
  font: inherit; font-size: 18px;
  padding: 14px 16px;
  border: 2px solid var(--soft);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input[type="password"]:focus { border-color: var(--accent); }

button {
  display: block; width: 100%; height: 52px;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 17px; font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  -webkit-tap-highlight-color: transparent;
}
button.primary { background: var(--ink); color: var(--bg); }
button.secondary { background: var(--soft); color: var(--ink); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, select:focus-visible + * { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

.error { color: var(--error); font-size: 15px; min-height: 1.2em; margin: 8px 0 0; }

/* Sent */
.sent { text-align: center; padding-top: 18vh; }
.check {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent);
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
}
.check svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.sent .secondary { margin-top: 28px; }

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

@media (prefers-reduced-motion: no-preference) {
  .view { animation: fade 180ms ease-out; }
  @keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
