/* Design tokens, reset, buttons and shared bits. Mobile-first: layout switches on
   width, touch/mouse details on the input device (pointer/hover), never on the user agent. */

:root {
  --brand: #2563eb;        /* header and primary buttons, same in both themes */
  --accent: #2563eb;       /* links, outlines, secondary buttons */
  --bg: #f8fafc;
  --card: #ffffff;
  --surface: #f1f5f9;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --hover: rgb(15 23 42 / 0.06);
  --ok: #16a34a;
  --danger: #dc2626;
  --info-bg: #dbeafe;
  --info-fg: #1e3a8a;
  --warn-bg: #fef3c7;
  --warn-fg: #78350f;
  --skel: #e2e8f0;
  --skel-hi: #f1f5f9;
  --toast-bg: #1e293b;
  --toast-fg: #f8fafc;
  --toast-action: #93c5fd;
  --radius: 12px;
  --composer-h: 4.25rem;   /* updated from JS, used to keep the toast above the composer */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #60a5fa;
    --bg: #0b1120;
    --card: #111827;
    --surface: #0f172a;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --border: #1f2937;
    --hover: rgb(241 245 249 / 0.08);
    --info-bg: #1e3a8a;
    --info-fg: #dbeafe;
    --warn-bg: #713f12;
    --warn-fg: #fef3c7;
    --skel: #1f2937;
    --skel-hi: #273449;
    --toast-bg: #f1f5f9;
    --toast-fg: #0f172a;
    --toast-action: #1d4ed8;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { width: 1.25rem; height: 1.25rem; flex: none; }

/* ---------- Buttons ---------- */

button {
  font: inherit;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.secondary { background: transparent; color: var(--accent); border-color: currentColor; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
}
.icon-btn:hover { background: rgb(255 255 255 / 0.15); }

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 0.75rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  background: var(--card);
  color: var(--fg);
}

.hint { color: var(--muted); font-size: 0.85rem; }

button.danger { background: transparent; color: var(--danger); border-color: currentColor; }

/* Touch: bigger targets everywhere */
@media (pointer: coarse) {
  button { min-height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
