/* Light is the base palette; the two blocks below re-declare only what the
   dark theme changes — once for the system setting, once for an explicit
   choice from the toggle, so the toggle wins in both directions. */
:root {
  --bg: #fbfaf8;
  --panel: #ffffff;
  --ink: #1b1a17;
  --muted: #6b675f;
  --line: #e3ded4;
  --accent: #b4391f;
  --accent-soft: #fdf0ec;
  --shadow: 0 1px 2px rgba(27, 26, 23, .05);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17161a;
    --panel: #201f24;
    --ink: #ece8e1;
    --muted: #a09a93;
    --line: #343238;
    --accent: #e2725a;
    --accent-soft: #2b2020;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17161a;
  --panel: #201f24;
  --ink: #ece8e1;
  --muted: #a09a93;
  --line: #343238;
  --accent: #e2725a;
  --accent-soft: #2b2020;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
main { max-width: 760px; margin: 0 auto; padding: 0 20px 64px; }
header.site { max-width: 760px; margin: 0 auto; padding: 24px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
footer.site { max-width: 760px; margin: 0 auto; padding: 24px 20px; }
.theme-toggle {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 15px;
  line-height: 1; padding: 0; display: grid; place-items: center;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle span { grid-area: 1 / 1; }
[data-theme-icon="dark"] { display: none; }
:root[data-theme="dark"] [data-theme-icon="light"] { display: none; }
:root[data-theme="dark"] [data-theme-icon="dark"] { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-theme-icon="light"] { display: none; }
  :root:not([data-theme="light"]) [data-theme-icon="dark"] { display: inline; }
}
footer.site { border-top: 1px solid var(--line); margin-top: 56px; color: var(--muted); font-size: 13px; }
.brand { text-decoration: none; color: var(--ink); font-weight: 600; letter-spacing: .01em; }
.brand span { border-bottom: 2px solid var(--accent); }

h1 { font-size: 34px; line-height: 1.2; margin: 12px 0; letter-spacing: -.02em; }
h2 { font-size: 21px; margin: 28px 0 8px; letter-spacing: -.01em; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 12px; }
.meta { color: var(--muted); font-size: 13px; }
.back { display: inline-block; margin: 8px 0 16px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--accent); }
.hero { padding: 24px 0 8px; }
.badge {
  display: inline-block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 4px 9px; border-radius: 999px;
}

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 28px; }
.card {
  display: block; padding: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: var(--radius); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h2 { font-size: 19px; margin: 12px 0 6px; }
.card p { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.go { color: var(--accent); font-size: 14px; font-weight: 500; }

.form { margin-top: 28px; }
.field { margin-bottom: 22px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.req { color: var(--accent); }
.hint { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
input, textarea, select {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.has-error input, .has-error textarea { border-color: var(--accent); }
.error { color: var(--accent); font-size: 14px; margin: 6px 0 0; }
.error:empty { display: none; }
.notice {
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink);
  padding: 14px 16px; border-radius: var(--radius); margin: 20px 0;
}
.actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
button {
  font: inherit; font-weight: 600; padding: 12px 22px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer;
}
button:hover { filter: brightness(1.08); }

.inputs { margin: 24px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.inputs summary { padding: 12px 16px; cursor: pointer; color: var(--muted); font-size: 14px; }
.inputs dl { margin: 0; padding: 0 16px 16px; }
.inputs dt { font-weight: 600; font-size: 14px; margin-top: 12px; }
.inputs dd { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.result { margin-top: 8px; }
.result.streaming { white-space: pre-wrap; font-size: 15px; color: var(--muted); }
.result h2 { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.result h3 { font-size: 17px; margin: 20px 0 6px; }
.result ul, .result ol { padding-left: 22px; }
.result li { margin: 6px 0; }
.result blockquote { margin: 16px 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.result table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.result th, .result td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; font-size: 15px; }
.status { color: var(--muted); font-size: 14px; min-height: 22px; }

/* Step-by-step questionnaire. Without JavaScript every step stays visible and
   the form still submits as one plain POST. */
.steps { margin-top: 28px; }
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.progress-bar { flex: 1; height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.progress-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.stepped .field { display: none; }
.stepped .field.is-current { display: block; animation: rise .2s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stepped .field label { font-size: 21px; letter-spacing: -.01em; }
.stepped .actions { justify-content: space-between; }
.ghost { background: none; color: var(--muted); border: 1px solid var(--line); }
.ghost:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.stepped .optional-note { color: var(--muted); font-size: 13px; }
.summary { margin: 0 0 18px; }
.summary li { color: var(--muted); font-size: 14px; margin: 6px 0; }
.summary a { color: var(--accent); font-size: 13px; }
.summary b { color: var(--ink); font-weight: 600; }
