:root {
  color-scheme: light;
  --paper: #f4efe6;
  --ink: #1c1915;
  --muted: #5c5348;
  --rule: #d9cfc0;
  --stitch: #8f3d2c;
  --field: #fffdf8;
  --ok: #3d6b35;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font: 1.05rem/1.55 Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
}
main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1rem 3rem;
  border-top: 8px solid var(--stitch);
}
[hidden] { display: none !important; }
.kicker {
  margin: 0 0 0.75rem;
  color: var(--stitch);
  font: 0.75rem/1.2 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1 { margin: 0 0 1rem; font-size: 2rem; font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
h2 { margin: 2.25rem 0 0.6rem; font-size: 1.25rem; font-weight: 500; }
h3 { margin: 1.5rem 0 0.4rem; font-size: 1.05rem; font-weight: 500; }
p { margin: 0 0 1rem; }
a, .link { color: var(--stitch); }
.muted, footer { color: var(--muted); }
footer { max-width: 42rem; margin: 0 auto; padding: 0 1rem 3rem; font: 0.8rem/1.4 ui-sans-serif, system-ui, sans-serif; }

input, select, button {
  font: 0.95rem/1.3 ui-sans-serif, system-ui, sans-serif;
  max-width: 100%;
}
input, select {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--field);
  color: var(--ink);
}
button {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--stitch);
  border-radius: 4px;
  background: var(--stitch);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button.link { background: none; border: 0; padding: 0.2rem 0; color: var(--stitch); text-decoration: underline; }
button.danger { color: #9b1c1c; }
label { display: block; font: 0.9rem/1.4 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
label input, label select { display: block; width: 100%; margin-top: 0.2rem; color: var(--ink); }
label.check { display: flex; gap: 0.5rem; align-items: center; color: var(--ink); }
label.check input { display: inline; width: auto; margin: 0; }
.stack { display: grid; gap: 0.75rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.row label { flex: 1 1 12rem; }
.row.small { gap: 1.2rem; margin-top: 0.4rem; }
.topline { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
ul, ol { margin: 0 0 1rem; padding: 0; list-style: none; }
li { padding: 0.85rem 0; border-top: 1px solid var(--rule); }
li:last-child { border-bottom: 1px solid var(--rule); }
.badge { font: 0.8rem/1.2 ui-sans-serif, system-ui, sans-serif; color: var(--muted); }
.badge.on { color: var(--ok); font-weight: 600; }
.msg { min-height: 1.4em; font: 0.9rem/1.4 ui-sans-serif, system-ui, sans-serif; color: var(--stitch); }
.msg.ok { color: var(--ok); }
.token, .panel { margin: 1rem 0; padding: 1rem; border: 1px solid var(--stitch); border-radius: 6px; background: var(--field); }
.token input { flex: 1 1 20rem; font-family: ui-monospace, monospace; }
#conv-messages li { font-size: 0.95rem; }
#conv-messages .role { display: block; font: 0.75rem/1.2 ui-sans-serif, system-ui, sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
audio { width: 100%; }
code { font-size: 0.9em; }
