:root {
  color-scheme: light dark; /* native scrollbars and form controls follow the theme */
  --bg: #fbfaf7;
  --fg: #232f3e;
  --muted: #687078;
  --line: #d5d9de;
  --card: #ffffff;
  --accent: #e07000;
  --user: #2a6fb0;
  --font: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --fg: #e6e8eb;
    --muted: #8d959e;
    --line: #2c333b;
    --card: #181c21;
    --accent: #ff9900;
    --user: #6cb4ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.55 var(--font); }
a { color: var(--accent); }

/* Banner on top, the conversation scrolls, the composer stays at the bottom */
main { max-width: 760px; height: 100vh; height: 100dvh; margin: 0 auto; padding: 16px 16px 0; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); gap: 12px; }
/* long suggestion chips scroll sideways instead of widening the page */
.banner, #log, .composer, .suggestions { min-width: 0; }

.banner { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; background: var(--card); }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.title { font-size: 1.1rem; }
.star { color: var(--accent); }
.banner dl { display: grid; grid-template-columns: max-content 1fr; gap: 0 16px; margin: 0; font-size: 0.9rem; }
.banner dt { color: var(--muted); }
.banner dd { margin: 0; }

.modes { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.modes button { font: inherit; font-size: 0.82rem; color: var(--muted); background: transparent; border: 0; padding: 3px 12px; cursor: pointer; }
.modes button[aria-checked='true'] { color: var(--bg); background: var(--accent); }

#log { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 18px; padding: 4px 2px 8px; overscroll-behavior: contain; }
/* A thin scrollbar in the page's colours, only visible while hovering the conversation */
#log { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s; }
#log:hover, #log:focus-within { scrollbar-color: var(--line) transparent; }
#log::-webkit-scrollbar { width: 6px; }
#log::-webkit-scrollbar-track { background: transparent; }
#log::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
#log:hover::-webkit-scrollbar-thumb { background: var(--line); }
/* the oldest turns fade out under the banner instead of being cut by a hard edge */
#log { mask-image: linear-gradient(to bottom, transparent 0, #000 24px); }
#log:empty::before { content: 'Ask something below.'; color: var(--muted); margin: auto; }
.turn .q { color: var(--user); font-weight: 600; white-space: pre-wrap; }
.turn .q::before { content: '› '; }
.turn .a { color: var(--accent); font-weight: 600; margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn .a::before { content: '● '; }
.turn .a .prefix { color: var(--muted); font-weight: 400; }
.turn .a.refused { color: var(--muted); }
.turn .a.error { color: var(--muted); font-weight: 400; }
.turn .meta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.turn .meta span + span::before { content: ' · '; }
.cursor { display: inline-block; width: 0.6em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.composer { background: var(--bg); border-top: 1px solid var(--line); padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.suggestions { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.suggestions button, #ask button { font: inherit; font-size: 0.82rem; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer; white-space: nowrap; }
.suggestions button:hover, #ask button:hover { border-color: var(--accent); }

#ask { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 8px 10px; }
#ask:focus-within { border-color: var(--accent); }
#ask .prompt { color: var(--user); font-weight: 700; }
#ask input { flex: 1; min-width: 0; font: inherit; color: var(--fg); background: transparent; border: 0; outline: none; }
#ask button { border-radius: 6px; }
#ask button:disabled { opacity: 0.5; cursor: wait; }

footer { color: var(--muted); font-size: 0.78rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 560px) { .banner dl { display: none; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
