/* ============================================================
   TRIGGER — base commune (menu, admin, éditeur, viewers, classement)
   ------------------------------------------------------------
   Identité : aux couleurs de la DA de la chaîne (anthracite,
   bleu électrique, titres condensés), avec l'étincelle ambre du
   jeu pour les points et les bonnes réponses.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Oswald:wght@500;600;700&display=swap');

:root {
  /* palette */
  --ink: #141414;          /* fond : anthracite de la DA */
  --ink-2: #1e1e1e;        /* surfaces */
  --ink-3: #2a2a2a;        /* surfaces relevées, survol */
  --line: #313131;
  --line-strong: #454545;
  --text: #ffffff;
  --muted: #a3a3a3;
  --brand: #0055ff;        /* bleu de la DA : actions principales, onglets, focus */
  --brand-2: #1f6aff;
  --spark: #ffb547;        /* l'étincelle : points, bonne réponse */
  --spark-ink: #2a1a00;
  --danger: #ff5a6e;
  --ok: #7cf2b5;

  /* couleurs des réponses */
  --a: #d9737e;           /* mêmes couleurs désaturées que l'overlay */
  --b: #5aa7d9;
  --c: #86c06a;
  --d: #a48ad6;

  /* typo */
  --font-display: 'Oswald', 'Arial Narrow', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* échelle (ratio ~1,25) */
  --fs-xs: 0.8rem;
  --fs-sm: 0.9rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.56rem;
  --fs-2xl: 1.95rem;
  --fs-3xl: 2.44rem;

  --r-sm: 3px;
  --r-md: 5px;
  --r-lg: 8px;
  --shadow: 0 18px 50px -20px rgba(5, 2, 20, 0.8);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(0, 85, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(0, 85, 255, 0.05), transparent 60%),
    var(--ink);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-3xl); font-weight: 800; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0 0 1em; }
a { color: #5c94ff; text-underline-offset: 3px; }
small, .muted { color: var(--muted); }
.muted { font-size: var(--fs-sm); }
code, kbd {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.9em;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}
img { max-width: 100%; }
[hidden] { display: none !important; }

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

/* ---------- marque ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-lg);
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 1.4em;
  height: 1.4em;
  flex: none;
}

/* ---------- boutons ---------- */
.btn {
  --btn-bg: var(--ink-3);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 42px;
  padding: 0.55em 1.1em;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 700 var(--fs-sm) / 1 var(--font-body);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s var(--ease-out), background 0.15s, border-color 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; border-color: transparent; }
.btn-primary:hover { border-color: transparent; filter: brightness(1.08); }
.btn-ghost { --btn-bg: transparent; }
.btn-danger { --btn-fg: var(--danger); border-color: rgba(255, 90, 110, 0.4); --btn-bg: transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0.35em 0.8em; font-size: var(--fs-xs); }
.btn-lg { min-height: 54px; padding: 0.7em 1.5em; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn kbd { background: rgba(0, 0, 0, 0.18); border-color: transparent; color: inherit; }

/* ---------- formulaires ---------- */
.field { display: grid; gap: 0.35rem; margin-bottom: 0.9rem; }
.field > span, .label {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
}
.field .hint { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
input[type='text'], input[type='password'], input[type='number'], input[type='url'], input[type='datetime-local'], input[type='search'],
select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 0.55em 0.8em;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(10, 8, 26, 0.45);
  color: var(--text);
  font: inherit;
  color-scheme: dark;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(0, 85, 255, 0.25); }
input[type='color'] { width: 48px; height: 42px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: none; }

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 200px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* interrupteur */
.switch { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; font-size: var(--fs-sm); margin: 0.2rem 0 0.8rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: 99px;
  background: var(--ink-3);
  border: 1px solid var(--line-strong);
  transition: background 0.2s;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s var(--ease-spring), background 0.2s;
}
.switch input:checked + .track { background: rgba(0, 85, 255, 0.35); border-color: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { outline: 3px solid var(--spark); outline-offset: 2px; }

/* ---------- surfaces ---------- */
.panel {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel + .panel { margin-top: 1rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.65em;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}
.chip-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-ok { color: var(--ok); border-color: rgba(124, 242, 181, 0.4); }
.chip-warn { color: var(--spark); border-color: rgba(255, 181, 71, 0.45); }
.chip-bad { color: var(--danger); border-color: rgba(255, 90, 110, 0.45); }

/* lettres de réponse */
.letter {
  display: inline-grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  flex: none;
  border-radius: 3px;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  background: var(--choice, var(--muted));
}
.ch-0 { --choice: var(--a); }
.ch-1 { --choice: var(--b); }
.ch-2 { --choice: var(--c); }
.ch-3 { --choice: var(--d); }

/* onglets */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; }
.tabs button {
  padding: 0.7em 1em;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font: 700 var(--fs-sm) var(--font-body);
  cursor: pointer;
  white-space: nowrap;
}
.tabs button[aria-selected='true'] { color: var(--text); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--text); }

/* tableaux */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  padding: 0.6em 0.7em;
  border-bottom: 1px solid var(--line-strong);
}
.table td { padding: 0.65em 0.7em; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.me td { background: rgba(255, 181, 71, 0.1); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* toast */
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: grid; gap: 0.5rem; z-index: 1000; width: min(92vw, 420px); }
.toast {
  padding: 0.75em 1em;
  border-radius: var(--r-sm);
  background: var(--ink-3);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm);
  animation: toast-in 0.35s var(--ease-spring);
}
.toast.err { border-color: var(--danger); }
.toast.ok { border-color: var(--ok); }
@keyframes toast-in { from { transform: translateY(12px) scale(0.96); opacity: 0; } }

/* écran de connexion admin */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.gate form { width: min(420px, 100%); }
.gate-note { color: var(--spark); margin: 0.6rem 0 0; }
.gate-or { display: flex; align-items: center; gap: 0.8rem; margin: 1.1rem 0 0.4rem; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.gate-or::before, .gate-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

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

/* ---------- habillage DA : titres condensés en capitales ---------- */
h1, h2, h3, .brand { text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; }
.tabs button { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.panel { border-radius: var(--r-md); }

input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
