*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  --bg: #fbfbf9; --panel: #ffffff; --fg: #1c1c1e; --muted: #5d5d66; --line: #e3e3de;
  --accent: #1d5c8f; --accent-fg: #ffffff; --ok: #1a7f37; --warn: #b3261e; --cite-bg: #e8f0f7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151517; --panel: #1d1d20; --fg: #ececee; --muted: #a2a2ab; --line: #303035;
    --accent: #7db4e3; --accent-fg: #0f1720; --ok: #4ac26b; --warn: #ff7b72; --cite-bg: #1f2c38;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151517; --panel: #1d1d20; --fg: #ececee; --muted: #a2a2ab; --line: #303035;
  --accent: #7db4e3; --accent-fg: #0f1720; --ok: #4ac26b; --warn: #ff7b72; --cite-bg: #1f2c38;
  color-scheme: dark;
}

body { background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; max-width: 1180px; margin: 0 auto; padding: 24px 16px 40px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin-bottom: 0.4rem; }
h2 { font-size: 1.1rem; margin-bottom: 0.6rem; }
h3 { font-size: 0.9rem; margin: 1.1rem 0 0.4rem; color: var(--muted); font-weight: 600; }
a { color: var(--accent); }
.lede { color: var(--muted); max-width: 70ch; }
.meta { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
.net { color: var(--ok); font-weight: 600; }
.net.warn { color: var(--warn); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
@media (max-width: 820px) { main { grid-template-columns: minmax(0, 1fr); } }
.ask-pane, .prov-pane { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }

form { 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); }
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; cursor: pointer; }
#ask-btn { padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-fg); font-weight: 600; }
#ask-btn:disabled { opacity: 0.5; cursor: default; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.example { font-size: 0.82rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); }
.example:hover { color: var(--fg); border-color: var(--muted); }
.status { font-size: 0.85rem; color: var(--muted); margin-top: 10px; min-height: 1.3em; }

.cite-line { margin-top: 14px; font-size: 0.85rem; color: var(--muted); }
.cite { background: var(--cite-bg); color: var(--fg); font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.answer { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.disclaimer { font-size: 0.78rem; color: var(--muted); margin-top: 10px; }
.others { list-style: none; display: grid; gap: 4px; }
.others button { width: 100%; text-align: left; font-size: 0.85rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--fg); }
.others button:hover { border-color: var(--accent); }

.prov-path { font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.prov-title { font-weight: 400; color: var(--muted); }
.prov-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; max-height: 70vh; overflow-y: auto; margin-bottom: 10px; padding-right: 4px; }

footer { margin-top: 28px; font-size: 0.78rem; color: var(--muted); display: grid; gap: 6px; max-width: 90ch; }
