/* AI Chat Backup Guide — simple, quiet layout.
 * Design rules: one primary colour (--primary) + neutral greys; two font sizes only
 * (--fs-body, --fs-head); one narrow centred column (--col); one radius (--r) for buttons and cards;
 * no shadows, bands or decorative borders. Tables keep hairline row separators for readability. */
:root {
  --primary: #0f766e;
  --ink: #1f2328;
  --muted: #59636e;
  --hair: #e6e8eb;
  --surface: #f5f6f7;
  --bg: #ffffff;
  --fs-body: 17px;
  --fs-head: 26px;
  --col: 700px;
  --r: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; font-size: inherit; }
html { font-size: var(--fs-body); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
}
button, input, select, textarea { font: inherit; color: inherit; }
input[type="checkbox"] { accent-color: var(--primary); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; border: 0; border-radius: var(--r); background: var(--bg); color: var(--ink); padding: 0.45rem 0.9rem; margin-right: 0.75rem; cursor: pointer; }
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
code { font-family: var(--mono); }
b, strong { font-weight: 600; }

/* ---- Frame ---- */
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--bg); color: var(--primary); padding: 0.5rem 0.8rem; z-index: 10; }
.skip:focus { top: 1rem; }
.disclaimer-bar { width: min(var(--col), calc(100% - 2.5rem)); margin: 0 auto; padding: 1.25rem 0 0; color: var(--muted); }
.disclaimer-bar strong { font-weight: 600; color: var(--ink); }
.wrap { width: min(var(--col), calc(100% - 2.5rem)); margin: 0 auto; }
header.site { padding: 1.25rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; }
.brand { color: var(--ink); font-weight: 700; text-decoration: none; }
nav.toc { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
nav.toc a { color: var(--muted); text-decoration: none; }
nav.toc a:hover, nav.toc a[aria-current="page"] { color: var(--primary); }

/* ---- Type: two sizes. h1/h2 = heading size; h3 and small headings = body size, bold ---- */
h1, h2, h3 { line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: var(--fs-head); font-weight: 700; margin: 4rem 0 1rem; }
h2 { font-size: var(--fs-head); font-weight: 600; margin: 4.5rem 0 1rem; }
h3 { font-size: var(--fs-body); font-weight: 700; margin: 2rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1.25rem; }
ul, ol { padding-left: 1.25rem; }
li { margin: 0 0 0.5rem; }

.page { padding: 0 0 2rem; }
.page section { padding: 0; }
.checked, .byline { color: var(--muted); margin: 0; }
.byline { margin-bottom: 2.5rem; }
.answer { margin-bottom: 1.25rem; }
.cite, .src, .cd-note, .local, .sample-note, .tested-note, .chat-note, .updated, .meta { color: var(--muted); }

/* Plain asides: no tinted bands, just muted text with space around it. */
.note { color: var(--muted); }
.callout { background: var(--surface); border-radius: var(--r); padding: 1rem 1.25rem; font-weight: 600; }

/* ---- Cards and buttons share one radius ---- */
.card, .tool, .privacy-badge, .drop, .character, .chat-item { border-radius: var(--r); }
.card { background: var(--surface); padding: 1.5rem; }
.btn {
  font-weight: 600; border-radius: var(--r); border: 0; cursor: pointer;
  background: var(--primary); color: #fff; padding: 0.55rem 1.1rem; line-height: 1.4;
}
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.ghost:hover { color: var(--primary); }
.card .btn.ghost { background: var(--bg); }
.btn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }

/* ---- Home: countdowns, dates ---- */
.countdowns { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 1.5rem 0 2.5rem; }
@media (min-width: 640px) { .countdowns { grid-template-columns: 1fr 1fr; } }
.countdown p { margin: 0 0 0.75rem; }
.countdown .label { font-weight: 700; margin-bottom: 0.25rem; }
.countdown .target { color: var(--muted); }
.countdown .cd-state { font-weight: 600; color: var(--primary); }
.countdown .cd-state:empty { display: none; }
.ticks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0 0 0.75rem; }
.ticks:empty { display: none; }
.tick { text-align: left; }
.tick b { display: block; font-size: var(--fs-head); font-weight: 600; line-height: 1.2; color: var(--ink); }
.tick span { color: var(--muted); }
.countdown .src, .countdown .cd-note { margin: 0.75rem 0 0; }

.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
table { width: 100%; border-collapse: collapse; }
.table-wrap table { min-width: 40rem; }
table.dates { min-width: 30rem; }
th, td { text-align: left; vertical-align: top; padding: 0.75rem 1rem 0.75rem 0; border-bottom: 1px solid var(--hair); }
th { font-weight: 600; color: var(--ink); }
tr:last-child td { border-bottom: 0; }
table.dates tr.is-past td { color: var(--muted); }
table.dates tr.is-next td { font-weight: 600; color: var(--primary); }
.milestones dt { font-weight: 700; margin-top: 1.5rem; }
.milestones dd { margin: 0.25rem 0 0; }

/* Numbered steps: plain list with the number in the primary colour. */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.25rem; margin: 0 0 1.5rem; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; font-weight: 700; color: var(--primary); }
.steps h3 { margin: 0 0 0.25rem; }
.steps p { margin: 0; }

.two-col, .three-col, .tool-grid { display: grid; gap: 0 2rem; grid-template-columns: 1fr; }
.tool { margin: 0 0 1.5rem; }
.tool h3 { margin: 0 0 0.25rem; }
.tool .tag { color: var(--muted); margin: 0 0 0.25rem; }
.tool p:last-child { margin-bottom: 0; }
.checklist li, .changelog li { margin-bottom: 0.5rem; }

.faq details { margin: 0 0 1.25rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 0.5rem 0 0; color: var(--ink); }

.reminder { margin: 1.5rem 0; }
.reminder h3 { margin-top: 0; }
.reminder label { display: block; }
.reminder input[type="date"] { display: block; margin: 0.5rem 0 1rem; padding: 0.45rem 0.6rem; border: 0; border-radius: var(--r); background: var(--bg); }
.reminder-out { font-weight: 600; }
.shot { margin: 1.5rem 0; }
.shot img { border-radius: var(--r); background: var(--surface); }
.shot figcaption { color: var(--muted); margin-top: 0.5rem; }

footer.site { margin-top: 3rem; padding: 2.5rem 0 4rem; color: var(--muted); }
.footer-grid { display: grid; gap: 0; grid-template-columns: 1fr; }
footer.site h2 { font-size: var(--fs-body); font-weight: 700; color: var(--ink); margin: 0 0 0.5rem; }
footer.site section { margin-bottom: 1.5rem; }
.sources { padding-left: 1.25rem; }
.sources li { margin: 0 0 0.25rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Export viewer ---- */
.viewer { margin: 1.5rem 0 2.5rem; }
.privacy-badge { color: var(--muted); padding: 0; margin: 0 0 1.25rem; }
.drop { display: block; background: var(--surface); padding: 2.5rem 1.5rem; text-align: center; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; }
.drop.over, .drop:hover { outline-color: var(--primary); }
.drop-title { display: block; font-weight: 600; }
.drop-sub { display: block; color: var(--muted); margin-top: 0.25rem; }
.drop input { margin-top: 1rem; max-width: 100%; }
.sample-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1rem 0 0.5rem; }
.sample-note, .tested-note { margin: 0; }
.tested-note { margin: 0.5rem 0 1rem; }
.viewer-status { font-weight: 600; min-height: 1.5em; margin: 1rem 0; }
.viewer-status.error, .viewer-status.warn { color: var(--primary); }
.viewer-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin: 0 0 1.25rem; }
.viewer-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 680px) { .viewer-grid { grid-template-columns: 11.5rem 1fr; } }
.chat-list { display: flex; flex-direction: column; gap: 0.25rem; max-height: 70vh; overflow: auto; }
.chat-item { text-align: left; background: transparent; border: 0; padding: 0.5rem 0.75rem; cursor: pointer; }
.chat-item:hover { background: var(--surface); }
.chat-item[aria-current="true"] { background: var(--surface); color: var(--primary); }
.chat-item-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.chat-item-meta { display: block; color: var(--muted); }
.chat-pane { min-width: 0; }
.chat-title { margin-top: 0; overflow-wrap: anywhere; }
.messages { display: flex; flex-direction: column; gap: 0.75rem; }
.msg { max-width: 85%; border-radius: var(--r); padding: 0.6rem 0.9rem; }
.msg.char { align-self: flex-start; background: var(--surface); }
.msg.user { align-self: flex-end; background: var(--surface); border-right: 3px solid var(--primary); }
.msg-head { color: var(--muted); margin: 0 0 0.15rem; }
.msg-head b { color: var(--ink); }
.msg-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.more { margin-top: 1rem; }
.characters-pane, .raw-pane { margin-top: 2rem; }
.character { background: var(--surface); padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.char-field-label { color: var(--muted); margin: 0.5rem 0 0; }
.char-field { white-space: pre-wrap; margin: 0; }
.tree { margin-left: 1rem; }
.raw-pane > .tree { margin-left: 0; }
.tree summary { cursor: pointer; font-family: var(--mono); }
.tree-leaf { margin-left: 1rem; font-family: var(--mono); overflow-wrap: anywhere; }
.tree-key { color: var(--primary); }

@media print {
  body.viewer-page .disclaimer-bar, body.viewer-page header.site, body.viewer-page footer.site,
  body.viewer-page .page > *:not(.viewer), body.viewer-page .viewer > *:not(#viewer-app),
  body.viewer-page #viewer-app > *:not(#viewer-results), body.viewer-page #viewer-tools,
  body.viewer-page #chat-list, body.viewer-page .more, body.viewer-page .characters-pane, body.viewer-page .raw-pane { display: none !important; }
  body.viewer-page .viewer-grid { display: block; }
  body.viewer-page .msg { break-inside: avoid; max-width: 100%; }
  body.viewer-page .msg.user { border-right-color: #000; }
}
table.dates td:nth-child(-n+2) { white-space: nowrap; }
