:root {
  --bg: #f0edf2;
  --ink: #1e1b26;
  --muted: #5d5768;
  --card: #fdfcfe;
  --line: #dcd6e2;
  --accent: #2b2649;
  --mine: #3b3564;
  /* Reserved for anything that qualifies a claim — never decoration. */
  --warn: #8a5426;
  --warn-bg: #fbf2e9;
  --warn-line: #ecd7c2;
  --ui: "Montserrat", "Segoe UI", sans-serif;
  --font: "Merriweather", "Iowan Old Style", Palatino, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  /* Montserrat at 400 reads thin on the light background; 500 is its mid weight. */
  font-weight: 500;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.chat-app {
  max-width: 42rem;
  margin: 0 auto;
  height: 100vh;
  /* dvh tracks the collapsing browser chrome on mobile, so the composer
     stays on screen instead of sitting below the fold. */
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.75rem 0;
}
/* Splash — shown once per session, swapped for the chat when Enter is pressed. */
.splash-open .chat-app { display: none; }
html.entered .splash { display: none; }
html.entered .chat-app { display: flex; }
.splash {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  text-align: center;
}
/* A dawn glow behind the title, rather than a photograph to download. */
.splash::before {
  content: "";
  position: absolute;
  top: -30vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(160vw, 1100px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 178, 133, 0.45) 0%, rgba(199, 186, 214, 0.22) 45%, rgba(240, 237, 242, 0) 68%);
  pointer-events: none;
}
.splash-inner {
  position: relative;
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(1rem, 3.5vh, 2rem) 1.25rem calc(1.2rem + env(safe-area-inset-bottom));
}
.splash-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--warn);
  margin: 0 0 0.6rem;
}
.splash-title {
  font-family: var(--font);
  font-size: clamp(1.75rem, 7.5vw, 2.6rem);
  line-height: 1.15;
  color: var(--accent);
  margin: 0;
}
.splash-sub {
  font-size: clamp(0.82rem, 3.4vw, 0.95rem);
  color: var(--muted);
  margin: 0.5rem 0 0;
}
.splash-copy {
  margin: clamp(1.4rem, 5vh, 2.2rem) 0 0;
  text-align: left;
}
.splash-copy p {
  font-size: clamp(0.88rem, 3.7vw, 0.98rem);
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 0.95rem;
}
.splash-lead {
  font-weight: 700;
  color: var(--accent);
  border-left: 3px solid var(--line);
  padding-left: 0.85rem;
}
.enter {
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 3.2rem;
  margin: 0.6rem 0 1.4rem;
  cursor: pointer;
  min-width: 11rem;
}
.enter:hover { background: var(--mine); }
.enter:focus-visible { outline: 3px solid #b7aecd; outline-offset: 3px; }
.splash-note {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
.splash-note a { color: var(--warn); }
/* On a phone the copy runs past the fold, so keep Enter within thumb reach.
   The band fades into the page so it reads as a bar, not as a blob on the text. */
@media (max-width: 640px) {
  .enter-wrap {
    position: sticky;
    bottom: 0;
    padding: 1.1rem 0 calc(0.6rem + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 62%, rgba(240, 237, 242, 0));
  }
  .enter { margin: 0; }
}

.chat-top { text-align: center; }
.chat-top h1 { font-family: var(--font); font-size: 1.65rem; margin: 0.15rem 0 0.1rem; }
.chat-top a { color: inherit; text-decoration: none; }
.chat-top a:hover { color: var(--accent); }
.kicker {
  font-family: var(--ui);
  text-transform: uppercase;
  letter-spacing: 0.04rem;
  font-size: 1.8rem;
  line-height: 1.2;
  color: var(--accent);
  margin: 0;
  font-weight: 700;
}
.according { font-size: 0.95rem; color: var(--muted); margin: 0.15rem 0 0; }
.byline { font-family: var(--font); font-size: 0.95rem; font-weight: 600; color: var(--muted); margin: 0 0 0.4rem; }
.lede { color: var(--muted); font-size: 0.7rem; line-height: 1.4; margin: 0 0 0.7rem; }
.attrib {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted);
  margin: 0.55rem 0 0;
}
/* The disclaimer accordion in the page header, outside a message bubble. */
.top-note { margin: 0.35rem 0 0.7rem; }
.top-note summary { justify-content: center; }
.top-note p { text-align: left; max-width: 34rem; margin-inline: auto; }
.log {
  flex: 1;
  min-height: 0; /* without this the log grows instead of scrolling */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none; /* the log still scrolls; the desktop bar just sat oddly inside the card */
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-bottom: 0.8rem;
}
.log::-webkit-scrollbar { width: 0; height: 0; }
.bubble {
  max-width: 92%;
  padding: 0.75rem 0.9rem;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 1rem;
}
.bubble.user {
  align-self: flex-end;
  background: var(--mine);
  color: #fff;
  border-color: transparent;
}
.bubble.assistant { align-self: flex-start; }
.bubble p { margin: 0.4rem 0; }
.bubble p:first-child { margin-top: 0; }
.note { margin: 0.5rem 0 0; }
.note summary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--mine);
  cursor: pointer;
  list-style: none;
}
.note summary::-webkit-details-marker { display: none; }
.note summary::after {
  content: "▾";
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.note[open] summary::after { transform: rotate(180deg); }
.note summary:hover { color: var(--accent); }
.note p {
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0.4rem 0 0;
  padding-left: 0.6rem;
  border-left: 2px solid var(--line);
}
.choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }
.choices button, .radio-row label {
  font: inherit;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  text-align: left;
}
.choices button:hover, .radio-row label:hover { border-color: var(--accent); }
.choices.stack { flex-direction: column; align-items: stretch; }
.choices.stack button { width: 100%; border-radius: 12px; }
.radio-row { display: flex; gap: 0.5rem; margin-top: 0.65rem; }
.radio-row label { display: flex; align-items: center; gap: 0.35rem; }
.composer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0 calc(0.7rem + env(safe-area-inset-bottom));
  background: var(--bg);
}
.composer input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 0.8rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}
/* The browser's default focus ring lands almost black on this palette. */
.composer input:focus {
  outline: none;
  border-color: #b7aecd;
}
.composer button {
  flex: none;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1.35rem;
  cursor: pointer;
}
.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}
.reading { margin-top: 0.8rem; }
.reading h2 { font-family: var(--font); font-size: 1.3rem; margin: 0.2rem 0 0.45rem; }
.reading h3 {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mine);
  margin: 1rem 0 0.25rem;
}
.organ { color: var(--muted); margin: 0; }
.source { margin: 0.3rem 0 0.2rem; }
.source a { color: var(--mine); }
.typing { color: var(--muted); font-style: italic; align-self: flex-start; }
.hint { font-size: 0.78rem; color: var(--muted); display: block; margin-top: 0.25rem; }
