:root {
  --bg: #14161a;
  --card: #1d2027;
  --fg: #e8eaed;
  --muted: #9aa0aa;
  --accent: #4a9eff;
  --border: #2c3038;
  --radius: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --fg: #1a1c20;
    --muted: #6b7280;
    --accent: #1a73e8;
    --border: #e2e4e8;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.topbar h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--muted);
  text-transform: lowercase;
}
.counter { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question {
  font-size: 1.5rem;
  line-height: 1.35;
  font-weight: 500;
  margin: 0;
}
@media (max-width: 480px) { .question { font-size: 1.3rem; } }

.meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.source, .fp-toggle {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}
.source { text-decoration: underline dotted; text-underline-offset: 3px; }
.source.live { color: var(--accent); text-decoration: underline; }
.fp-toggle::before { content: "▸ "; }
.fp-toggle.open::before { content: "▾ "; }

.fineprint {
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 2px solid var(--border);
  padding: 4px 0 4px 14px;
  white-space: pre-wrap;
}

.answer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.answer-readable {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.answer-exact {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.answer-details {
  font-size: 0.95rem;
  color: var(--fg);
  margin-top: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.actions button {
  flex: 1;
  padding: 14px;
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
  transition: filter 0.12s ease;
}
.actions button:hover { filter: brightness(1.15); }
.actions button:active { filter: brightness(0.9); }
.actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.status { text-align: center; color: var(--muted); font-size: 0.9rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  animation: toast-in 0.15s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
