/* Phone-first, one column, large tap targets. No external fonts, no external assets.
   KaTeX is vendored locally at vendor/katex/ — nothing here reaches the network at runtime. */
:root {
  --ink: #16181d; --muted: #5b616e; --line: #d9dde5; --bg: #f6f7f9; --card: #ffffff;
  --accent: #1b4dd8; --warn: #8a5300; --warnbg: #fff6e5; --bad: #a11; --badbg: #fdeaea; --okbg: #eaf6ee; --ok: #1d6b38;
  color-scheme: light;
}
* { box-sizing: border-box; }
/* author rules beat the UA sheet, so hidden must be stated here or .nav/.bar stay visible */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; }
#shell { max-width: 480px; margin: 0 auto;
  padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-left)) calc(48px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right)); }
h1 { font-size: 21px; margin: 14px 0 4px; }
h2 { font-size: 17px; margin: 18px 0 6px; }
h3 { font-size: 15px; margin: 0 0 4px; }
p { margin: 6px 0; }
.small { font-size: 13px; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.banner { position: sticky; top: 0; z-index: 5; background: var(--warnbg); color: var(--warn);
  border: 1px solid #f0d9a8; border-radius: 0 0 10px 10px; padding: 8px 10px; font-size: 13px; }
.banner b { display: block; font-size: 13px; }
.nav { display: flex; gap: 8px; padding: 10px 0; }
.nav a { flex: 1; text-align: center; min-height: 44px; line-height: 44px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; color: var(--accent); font-size: 15px; }
.error { background: var(--badbg); color: var(--bad); border: 1px solid #f0c0c0; border-radius: 10px;
  padding: 10px; margin: 10px 0; font-size: 14px; word-break: break-word; }

/* sticky status bars: a waiting service worker, and the connection */
.bar { position: sticky; top: 0; z-index: 6; padding: 10px 12px; font-size: 14px; border-radius: 0 0 10px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bar.update { background: var(--accent); color: #fff; }
.bar.update button { width: auto; min-height: 36px; margin: 0; padding: 6px 12px; font-size: 14px; font-weight: 600;
  background: #fff; color: var(--accent); border-color: #fff; text-align: center; }
.bar.offline { background: #eceef3; color: var(--muted); border: 1px solid var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 10px 0; }
.card.quiet { background: #fbfbfd; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.row .grow { flex: 1; min-width: 0; }
button, .btn { display: block; width: 100%; min-height: 52px; margin: 8px 0; padding: 12px 14px;
  font-size: 16px; text-align: left; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); text-align: center; font-weight: 600; }
button.link { min-height: 44px; background: transparent; border: none; color: var(--accent); padding: 10px 0; }
button[disabled] { opacity: .55; }
a.btn { text-decoration: none; text-align: center; font-weight: 600; color: var(--accent); border-color: var(--accent);
  line-height: 28px; }
input, select, textarea { width: 100%; min-height: 52px; padding: 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
textarea { min-height: 110px; resize: vertical; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; }
.pill { display: inline-block; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: #f1f3f7; color: var(--muted); }
.pill.open { background: var(--okbg); color: var(--ok); border-color: #bde0c8; }
.pill.locked { background: #eee; color: #555; }
.pill.free { background: #eef2ff; color: var(--accent); border-color: #c8d3f6; }
.stem { font-size: 17px; margin: 6px 0 10px; white-space: pre-wrap; }
.math { margin: 8px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.math .katex { font-size: 1.05em; }
.math.block { padding: 6px 0; }
button .math { overflow-x: auto; }
.scroll { max-height: 240px; overflow: auto; -webkit-overflow-scrolling: touch;
  background: #fbfbfd; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  white-space: pre-wrap; font-size: 14px; }
.panel { border-left: 4px solid var(--accent); }
.panel.correct { border-left-color: var(--ok); background: var(--okbg); }
.panel.incorrect { border-left-color: var(--bad); background: var(--badbg); }
ul.items { list-style: none; padding: 0; margin: 6px 0; }
ul.items li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.foot { margin-top: 24px; font-size: 12px; color: var(--muted); text-align: center; }

/* S9: feed filters, map tags */
.filters select { flex: 1 1 30%; min-width: 0; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pill.tag { background: #eef3ff; color: #234; }
.row.topic { margin-top: 6px; padding-top: 6px; border-top: 1px solid #eee; }
[data-feed-anchored="true"] { outline: 2px solid #4a72d9; }
