/* news — phone first (375 px), readable on a Mac. Colour tokens in :root,
   dark mode overrides them. The bottom tab bar is fixed; only the middle scrolls. */
:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --fg: #1c1f24;
  --muted: #6b7078;
  --border: #e2e0d9;
  --accent: #1f5fbf;
  --accent-fg: #ffffff;
  --chip: #ecebe6;
  --good: #2e7d4f;
  --warn: #a86a00;
  --bad: #b3261e;
  --warn-bg: #fff4dc;
  --bad-bg: #fde8e6;
  --info-bg: #e8f0fc;
  --statement: #7a5bbf;
  --radius: 12px;
  --tabs-h: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131518;
    --card: #1c1f23;
    --fg: #e8e6e1;
    --muted: #9aa0a8;
    --border: #2d3137;
    --accent: #7aa7ff;
    --accent-fg: #0d1422;
    --chip: #262a30;
    --good: #6fcf97;
    --warn: #e0a94a;
    --bad: #ff8a80;
    --warn-bg: #3a2e14;
    --bad-bg: #3d1d1b;
    --info-bg: #1b2a40;
    --statement: #b9a3ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px) env(safe-area-inset-left);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0 6px; }
h2 { font-size: 1.15rem; margin: 22px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }
code { font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.bad { color: var(--bad); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

header.top { display: flex; justify-content: space-between; align-items: center; max-width: 760px; margin: 0 auto; padding: 10px 16px 0; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--fg); letter-spacing: 0.01em; }
.head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.crumbs { margin: 6px 0 0; font-size: 0.9rem; }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
nav.tabs a { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.85rem; min-height: 44px; }
nav.tabs a.on { color: var(--accent); font-weight: 600; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.chips a { padding: 6px 12px; border-radius: 999px; background: var(--chip); color: var(--fg); font-size: 0.9rem; min-height: 32px; }
.chips a.on { background: var(--accent); color: var(--accent-fg); }
.chips.small a { font-size: 0.8rem; padding: 4px 10px; }
.chip { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.chip-statement, .chip-prediction { color: var(--statement); }

.cta { display: block; padding: 14px 16px; margin: 8px 0 14px; border-radius: var(--radius); background: var(--accent); color: var(--accent-fg); font-weight: 600; text-align: center; }
.cta:hover { text-decoration: none; filter: brightness(1.05); }

ul.topics { list-style: none; margin: 0; padding: 0; }
.topic a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; margin: 0 0 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--fg); min-height: 56px; }
.topic a:hover { text-decoration: none; border-color: var(--accent); }
.topic .label { font-weight: 600; }
.topic .meta { grid-column: 1 / -1; color: var(--muted); font-size: 0.82rem; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: 0.8rem; font-weight: 700; }
details.quiet > summary, details.fresh > summary, details.more > summary, details.fb > summary { cursor: pointer; color: var(--muted); padding: 10px 0; min-height: 44px; }

.sum, .sum-slot, .sum-none { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.sum-slot .sum { border: 0; padding: 0; margin: 0; background: transparent; }
.since { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: none; }
ul.sentences { margin: 0; padding: 0 0 0 18px; }
ul.sentences li { margin: 0 0 10px; }
ul.sentences li.s-statement::marker { color: var(--statement); }
ul.sentences li.s-conflict::marker { color: var(--warn); }
ul.sentences.old { color: var(--muted); }
.src { white-space: nowrap; }
.src a, a.ref { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--chip); color: var(--muted); font-size: 0.75rem; line-height: 1.6; vertical-align: 1px; }
.followups { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip-btn { border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.9rem; min-height: 36px; cursor: pointer; }
.chip-btn:disabled { opacity: 0.55; }
.answer { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 12px 0; }
.answer h3 { margin: 0 0 4px; font-size: 0.95rem; }
.answer p { margin: 4px 0; }

.skeleton { height: 14px; border-radius: 6px; margin: 10px 0; background: linear-gradient(90deg, var(--chip), var(--border), var(--chip)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

ul.items { list-style: none; padding: 0; margin: 0; }
.item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.item-title { font-weight: 600; color: var(--fg); }
.orig { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.meta { font-size: 0.82rem; color: var(--muted); }
.small-buttons button { font-size: 0.8rem; padding: 4px 10px; min-height: 32px; }

.timeline ul { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 0.95rem; }
.timeline .clock { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.82rem; }
.timeline h3 { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-top: 16px; }

.brief { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.brief h2 { display: flex; gap: 8px; align-items: center; }
.brief h2 a { color: var(--fg); }

button { font: inherit; font-size: 0.92rem; padding: 8px 14px; min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; color: var(--accent); }
button.small { font-size: 0.8rem; padding: 2px 10px; min-height: 30px; }
button.linkish { border: 0; padding: 0; min-height: 0; background: none; color: var(--accent); font-size: inherit; }
button[aria-busy="true"] { opacity: 0.6; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.actions { margin: 8px 0; }

input, textarea, select { font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; max-width: 100%; }
textarea { width: 100%; }
input[type="number"] { width: 5.5em; }
input[type="checkbox"] { width: 20px; height: 20px; vertical-align: -4px; }
label { display: block; margin: 6px 0; }
.settings section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 14px 12px; }
.sticky-save { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 8px); display: flex; justify-content: flex-end; }
.sticky-save button { box-shadow: 0 4px 16px rgb(0 0 0 / 0.15); }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.grid td, table.grid th { padding: 6px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.grid th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
ul.feeds, ul.plain { list-style: none; padding: 0; }
ul.feeds li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.feeds .switch { margin-left: auto; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-ok { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-bad { background: var(--bad); }
.dot-off { background: transparent; border: 1px solid var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 10px 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.card h3 { margin: 0; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.card .big { font-size: 1.4rem; font-weight: 700; margin: 4px 0 0; }
/* <progress>, not a styled span: the CSP allows no inline style attributes. */
progress.meter { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 4px; overflow: hidden; margin: 10px 0 6px; background: var(--chip); color: var(--good); }
progress.meter::-webkit-progress-bar { background: var(--chip); }
progress.meter::-webkit-progress-value { background: var(--good); }
progress.meter::-moz-progress-bar { background: var(--good); }
progress.meter.warn::-webkit-progress-value { background: var(--warn); }
progress.meter.warn::-moz-progress-bar { background: var(--warn); }
progress.meter.bad::-webkit-progress-value { background: var(--bad); }
progress.meter.bad::-moz-progress-bar { background: var(--bad); }
ul.log { list-style: none; padding: 0; font-size: 0.88rem; }
ul.log li { padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.log li.log-error { border-left: 3px solid var(--bad); padding-left: 8px; }
ul.log li.log-warn { border-left: 3px solid var(--warn); padding-left: 8px; }
ul.feedback { list-style: none; padding: 0; }
ul.feedback li { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
ul.feedback li.fb-done { opacity: 0.6; }
ul.feedback p { margin: 4px 0; white-space: pre-wrap; }

.banner { max-width: 760px; margin: 8px auto; padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; }
main .banner { margin: 8px 0; }
.banner a { color: inherit; text-decoration: underline; }
.banner-error { background: var(--bad-bg); color: var(--bad); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-info { background: var(--info-bg); color: var(--accent); }
body > .banner { margin-left: 16px; margin-right: 16px; }
@media (min-width: 792px) { body > .banner { margin-left: auto; margin-right: auto; } }

dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--card); color: var(--fg); width: min(560px, calc(100vw - 24px)); padding: 16px; }
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
dialog h2 { margin-top: 0; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%) translateY(20px); opacity: 0; transition: 0.2s; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 0.9rem; pointer-events: none; max-width: calc(100vw - 32px); z-index: 20; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); color: #fff; }

.login { max-width: 360px; margin: 18vh auto 0; }
.login input { width: 100%; }
.foot { margin-top: 24px; text-align: center; }

.speak-page { padding-bottom: 32px; }
.speak { font-size: 1.15rem; line-height: 1.7; }
.speak h2 { margin-top: 28px; }
@media print { .noprint { display: none; } }
