/* Design tokens and the handful of components every screen shares. */
:root {
  --paper: #fbf7f0;
  --card: #ffffff;
  --ink: #221f1b;
  --muted: #6f685d;
  --line: #e7dfd1;
  --olive: #5b7a3f;
  --olive-dark: #46612f;
  --terra: #bd5733;
  --gold: #c1902c;
  --ok: #3c8a68;
  --warn: #cf9527;
  --bad: #bf4238;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(60, 44, 30, .06), 0 8px 24px -12px rgba(60, 44, 30, .18);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: inherit; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--olive); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .72em 1.1em; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--olive); color: #fff; font-weight: 600; text-decoration: none;
  transition: background .15s ease, transform .06s ease;
  min-height: 44px;
}
.btn:hover { background: var(--olive-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: rgba(0, 0, 0, .04); }
.btn-terra { background: var(--terra); }
.btn-terra:hover { background: #a34a2b; }
.btn-sm { padding: .45em .8em; min-height: 36px; font-size: .92rem; }

.badge {
  display: inline-flex; align-items: center; gap: .35em; padding: .2em .6em;
  border-radius: 999px; font-size: .76rem; font-weight: 600; letter-spacing: .01em;
  background: rgba(0, 0, 0, .05); color: var(--muted);
}
.badge-ok { background: rgba(60, 138, 104, .14); color: #2c6a4f; }
.badge-warn { background: rgba(207, 149, 39, .16); color: #8a6210; }
.badge-bad { background: rgba(191, 66, 56, .14); color: #9c332b; }
.badge-sim { background: rgba(93, 106, 168, .16); color: #46508a; }

.demo-strip {
  display: flex; align-items: center; gap: .55em; flex-wrap: wrap;
  padding: .5em .9em; font-size: .84rem; background: #2c2a26; color: #f4efe4;
}
.demo-strip a { color: #f4d99b; }
.demo-dot { width: .55em; height: .55em; border-radius: 50%; background: #7fd39b; box-shadow: 0 0 0 0 rgba(127, 211, 155, .7); animation: pulse 2.4s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(127, 211, 155, .6); }
  70% { box-shadow: 0 0 0 .5em rgba(127, 211, 155, 0); }
  100% { box-shadow: 0 0 0 0 rgba(127, 211, 155, 0); }
}

.page-error { display: grid; place-items: center; min-height: 100vh; padding: 2rem; text-align: center; }
.error-card { max-width: 30rem; }
.error-code { font-family: var(--font-mono); color: var(--muted); margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skeleton { background: linear-gradient(90deg, rgba(0,0,0,.05), rgba(0,0,0,.09), rgba(0,0,0,.05)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
