:root {
  --blue: #12326b;
  --blue-light: #e8eef9;
  --grey: #5c6370;
  --border: #d7dce4;
  --red: #b42318;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1d2330;
  background: #f6f7f9;
}

* { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 760px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
}

header { padding: 1.25rem 0 0.5rem; }
h1 { margin: 0; font-size: 1.35rem; color: var(--blue); }
h1 span { display: block; font-size: 0.95rem; font-weight: 500; color: var(--grey); }
.subtitle { margin: 0.4rem 0 0; color: var(--grey); font-size: 0.9rem; }

main { flex: 1; }

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  background: var(--blue);
  color: white;
}
button:disabled { opacity: 0.55; cursor: wait; }
button.secondary { background: white; color: var(--blue); border: 1px solid var(--border); padding: 0.35rem 0.7rem; font-size: 0.85rem; }

input, textarea {
  font: inherit;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

#login-form { display: grid; gap: 0.6rem; max-width: 340px; margin-top: 1.5rem; }
#login-form input { text-transform: uppercase; letter-spacing: 0.05em; }
.error { color: var(--red); margin: 0; min-height: 1.2em; }
.note { color: var(--grey); font-size: 0.85rem; }

.toolbar { display: flex; gap: 0.5rem; align-items: center; margin: 0.75rem 0; flex-wrap: wrap; }
#index-date { flex: 1; color: var(--grey); font-size: 0.85rem; }

#messages { display: flex; flex-direction: column; gap: 0.8rem; padding-bottom: 1rem; }

.welcome { color: var(--grey); }
.examples { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.example { background: var(--blue-light); color: var(--blue); font-size: 0.85rem; padding: 0.4rem 0.7rem; }

.msg { padding: 0.75rem 0.9rem; border-radius: 10px; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--blue); color: white; max-width: 85%; white-space: pre-wrap; }
.msg.bot { background: white; border: 1px solid var(--border); }
.msg.bot.pending { color: var(--grey); font-style: italic; }
.msg.bot.error { border-color: var(--red); color: var(--red); }
.msg .text { white-space: pre-wrap; }
.msg sup a { text-decoration: none; font-weight: 600; color: var(--blue); padding: 0 1px; }
.msg .rewritten { color: var(--grey); font-size: 0.8rem; margin: 0 0 0.4rem; }
.msg .hint { color: var(--grey); font-size: 0.9rem; margin: 0.5rem 0 0; }

.sources { margin: 0.7rem 0 0; padding: 0.6rem 0 0 1.4rem; border-top: 1px solid var(--border); font-size: 0.85rem; }
.sources li { margin-bottom: 0.35rem; }
.sources .meta { color: var(--grey); }
.sources a { color: var(--blue); }

.meta-line { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.6rem; font-size: 0.8rem; color: var(--grey); flex-wrap: wrap; }
.meta-line .freshness { flex: 1; }
.vote { background: white; border: 1px solid var(--border); padding: 0.15rem 0.5rem; color: inherit; }
.vote.chosen { background: var(--blue-light); border-color: var(--blue); }

#ask-form {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 0;
  background: #f6f7f9;
}
#ask-form textarea { resize: vertical; }

footer { color: var(--grey); font-size: 0.75rem; border-top: 1px solid var(--border); padding: 0.5rem 0 1rem; }
footer p { margin: 0.35rem 0; }

/* Turnstile widget: invisible unless Cloudflare asks for a click. */
#turnstile { display: flex; justify-content: center; margin: 0.5rem 0; }
