/* ==========================================================================
   Loremaster Trivia - design tokens shared by the panel, overlay, mobile and
   config views.

   One accent (purple) for interactive things, gold only for points and
   rank 1, green/red only for correct/wrong. Two fonts, both self-hosted so the
   extension makes no third-party requests: Cinzel for headings and numbers,
   Inter for everything else. Dark by default; the light theme is switched on
   with data-theme="light" on <html> from the Twitch context.
   ========================================================================== */

@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/cinzel-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}

:root {
  /* Surfaces */
  --bg: #15101f;
  --surface: #1f182c;
  --surface-2: #2a2139;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --text: #ece6f7;
  --text-2: #b5acc9;
  --text-3: #7f7596;

  /* Accent (interactive) */
  --accent: #7c5cff;
  --accent-hover: #916fff;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --on-accent: #ffffff;

  /* Meaning */
  --gold: #e6b84a;
  --gold-soft: rgba(230, 184, 74, 0.16);
  --ok: #3ccf7a;
  --ok-soft: rgba(60, 207, 122, 0.16);
  --bad: #ff5d6c;
  --bad-soft: rgba(255, 93, 108, 0.16);
  --warn: #ffb14a;

  /* Type */
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;

  /* Space + shape */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.35);

  /* Motion */
  --t-fast: 120ms;
  --t-med: 220ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f1fa;
  --surface: #ffffff;
  --surface-2: #efeaf8;
  --line: rgba(20, 10, 40, 0.08);
  --line-strong: rgba(20, 10, 40, 0.18);
  --text: #1d1530;
  --text-2: #534a6b;
  --text-3: #837a9b;
  --accent: #6a46f0;
  --accent-hover: #5a38dc;
  --accent-soft: rgba(106, 70, 240, 0.12);
  --gold: #a8780e;
  --gold-soft: rgba(168, 120, 14, 0.14);
  --ok: #1f9d55;
  --ok-soft: rgba(31, 157, 85, 0.14);
  --bad: #d63a4a;
  --bad-soft: rgba(214, 58, 74, 0.12);
  --shadow-1: 0 1px 2px rgba(20, 10, 40, 0.08);
  --shadow-2: 0 8px 24px rgba(20, 10, 40, 0.12);
  color-scheme: light;
}

/* --- base ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--text);
}

p { margin: 0; }
button { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }

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

/* --- shared components ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), opacity var(--t-fast);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); border-color: var(--accent); }
.btn.danger { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn.ghost:hover { color: var(--text); background: var(--accent-soft); }
.btn.sm { min-height: 28px; padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill.live { background: var(--ok-soft); color: var(--ok); }
.pill.soon, .pill.running { background: var(--accent-soft); color: var(--accent); }
.pill.paused { background: var(--gold-soft); color: var(--gold); }
.pill.off { color: var(--text-3); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  color: var(--text-2);
}
.tag.easy { background: var(--ok-soft); color: var(--ok); }
.tag.medium { background: var(--gold-soft); color: var(--gold); }
.tag.hard { background: var(--bad-soft); color: var(--bad); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.gold { color: var(--gold); }

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

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