:root {
  --bg: #fbfaf7; --fg: #1d2330; --muted: #4b5568; --card: #ffffff; --line: #d6d9e0;
  --accent: #1f5f4a; --accent-fg: #ffffff; --me: #e3efe9; --bot: #eef0f6; --err: #8a1c1c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171f; --fg: #eceef4; --muted: #b4bbcb; --card: #1c2029; --line: #353b4a; --accent: #6cc3a0; --accent-fg: #0d1511; --me: #1f3a30; --bot: #262b38; --err: #ff9d9d; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
.top, main, footer { max-width: 42rem; margin: 0 auto; padding: 0 16px; }
.top { padding-top: 28px; }
h1 { margin: 0; font-size: 1.9rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.tag { color: var(--muted); margin: .25rem 0 1rem; }
section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
ul { margin: 0; padding-left: 1.2rem; } li { margin: .3rem 0; }
label { display: block; font-weight: 600; margin-bottom: .35rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.row { display: flex; gap: 8px; }
input[type=text] { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #e0a100; outline-offset: 2px; }
.banner { background: #fff4d6; color: #4a3600; border: 1px solid #e0b84a; border-radius: 8px; padding: 10px 14px; }
@media (prefers-color-scheme: dark) { .banner { background: #3a3014; color: #ffe9a8; border-color: #8a7330; } }
.msg { color: var(--err); font-weight: 600; margin: .5rem 0 0; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meta { color: var(--muted); font-size: .9rem; margin: .25rem 0 .5rem; }
.log { border: 1px solid var(--line); border-radius: 8px; padding: 10px; height: 22rem; overflow-y: auto; background: var(--bg); }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 12px; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { background: var(--me); margin-left: auto; }
.bubble.bot { background: var(--bot); }
.bubble.note { background: transparent; color: var(--muted); font-style: italic; max-width: 100%; }
.who { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
#msg-form { margin-top: 10px; }
footer { color: var(--muted); font-size: .85rem; padding-bottom: 28px; }
@media (max-width: 480px) { .row { flex-direction: column; } button { width: 100%; } .log { height: 18rem; } }

/* replay page */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: .25rem 0 .5rem; }
button.tab { background: transparent; color: var(--accent); }
button.tab[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
h3.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.turn { margin: 8px 0; }
.turn.volunteer { text-align: right; }
.turn.volunteer .bubble { display: inline-block; text-align: left; }
.behind { margin: 4px 0 4px 4px; font-size: .85rem; color: var(--muted); }
.behind-h { font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .72rem; }
.behind ul { margin: 2px 0 0; padding-left: 1.1rem; }
.behind li { margin: 1px 0; }
.small { font-size: .8rem; margin: 2px 0 4px 4px; }
.note-box { background: #fff4d6; color: #4a3600; border: 1px solid #e0b84a; border-radius: 8px; padding: 8px 12px; margin: 6px 0; font-size: .92rem; }
@media (prefers-color-scheme: dark) { .note-box { background: #3a3014; color: #ffe9a8; border-color: #8a7330; } }
.cta { text-align: center; }
a.button { display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); font-weight: 600; text-decoration: none; }
.log { height: 26rem; }
@media (max-width: 480px) { .log { height: 22rem; } .controls button { flex: 1 1 45%; } }

figure { margin: 1rem 0; }
figure img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; display: block; }
figcaption { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* feedback */
details.feedback { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
details.feedback summary { cursor: pointer; font-weight: 600; }
fieldset { border: 0; padding: 0; margin: 8px 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
label.inline { display: inline-block; font-weight: 400; margin-right: 16px; }
textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); margin: 4px 0 8px; }

/* help center */
a.plain { color: inherit; text-decoration: none; }
.access-note { margin: 0 0 .5rem; }
.notice-line { color: var(--muted); font-size: .9rem; margin: 0; }

/* article pages */
.brand { margin: 0; font-size: 1.9rem; font-weight: 700; }
.lead-card h1 { margin: 0 0 .5rem; font-size: 1.6rem; line-height: 1.25; }
.lead { font-size: 1.08rem; margin: .25rem 0 .75rem; }
article section ol, article section ul { padding-left: 1.3rem; }
article section li { margin: .45rem 0; }
.example { border-left: 4px solid var(--accent); background: var(--bg); padding: 10px 14px; border-radius: 0 8px 8px 0; margin: 0; }

/* site bar (every page): the logo goes home, links to the other pages on the right */
.site-bar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px; background: #1f5f4a; color: #ffffff; }
.site-bar .home { display: flex; align-items: center; gap: 10px; color: #ffffff; text-decoration: none; font-weight: 700; font-size: 1.35rem; }
.site-bar .home img { border-radius: 9px; width: 38px; height: 38px; }
.topnav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: flex-end; }
.topnav a { color: #ffffff; font-size: 16px; font-weight: 600; text-decoration: none; padding: 8px 0; }
.topnav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.site-bar a:hover { text-decoration: underline; }
.site-bar a:focus-visible { outline: 3px solid #ffffff; outline-offset: 3px; }
@media (max-width: 420px) { .site-bar { gap: 8px; padding: 12px; } .topnav { gap: 4px 10px; } .topnav a { font-size: 15px; } .site-bar .home { font-size: 1.15rem; gap: 8px; } .site-bar .home img { width: 30px; height: 30px; } }
@media (max-width: 400px) { .site-bar { gap: 6px; } .topnav { gap: 4px 8px; } .topnav a { font-size: 14px; } .site-bar .home { font-size: 1.05rem; gap: 6px; } .site-bar .home img { width: 28px; height: 28px; } }

/* messages page: copies of the texts and emails the demo would have sent */
.messages-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: 12px; }
.messages-list li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--card); }
.messages-list h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.messages-list p { margin: .35rem 0; overflow-wrap: anywhere; }

/* replay: a bigger box, notes that stay inside it, and controls that stay in view while the box scrolls */
.log.tall { height: min(72vh, 40rem); height: min(72dvh, 40rem); min-height: 18rem; }
.player-bar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 6px 0 2px; }
.turn, .behind, .note-box { max-width: 100%; box-sizing: border-box; overflow-wrap: anywhere; }
.note-box, .behind { font-size: .95rem; }

/* replay pacing control */
.log { position: relative; scroll-behavior: auto; }
label.pace { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; }
select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.typing .bubble { font-style: italic; }
