/* =========================================================
   Quiz Convention — Maître CoQ
   Design tokens & shared styles
   ========================================================= */

:root {
  /* Brand */
  --mc-red: #e2231a;
  --mc-red-glow: rgba(226, 35, 26, 0.55);
  --mc-red-soft: rgba(226, 35, 26, 0.12);
  --mc-gold: #ffc629;

  /* Surface */
  --bg-0: #0a0f1f;
  --bg-1: #11172b;
  --bg-2: #1b2340;
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --text: #f5f7ff;
  --text-dim: #a8b0c8;
  --text-mute: #6c7591;

  /* States */
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  /* Radius / shadow */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 60px var(--mc-red-glow);

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(226, 35, 26, 0.20), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(255, 198, 41, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

/* Decorative noise/grid overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 75%);
}

/* ===================== Logo / brand ===================== */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 14px;
}
.brand .logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--mc-red), #8b0f0a);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px -8px var(--mc-red-glow);
}
.brand .logo svg { width: 22px; height: 22px; fill: white; }
.brand small { color: var(--text-dim); font-weight: 500; }

/* ===================== Buttons ===================== */
.btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:hover { background: var(--glass-strong); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--mc-red) 0%, #b3140d 100%);
  border-color: transparent;
  box-shadow: 0 16px 40px -12px var(--mc-red-glow);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-block { width: 100%; padding: 18px; font-size: 16px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===================== Glass card ===================== */
.card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: var(--shadow-lg);
}

/* ===================== Forms ===================== */
label.field {
  display: block;
  margin-bottom: 16px;
}
label.field span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.input, .select {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus {
  border-color: var(--mc-red);
  box-shadow: 0 0 0 4px var(--mc-red-soft);
}
.input.code {
  text-align: center;
  font-size: 28px;
  letter-spacing: 12px;
  font-weight: 700;
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23a8b0c8' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

/* ===================== Chips / badges ===================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 12px var(--success); }
.chip.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ===================== Demo nav (visible only with ?demo=1) ===================== */
.demo-nav {
  position: fixed; bottom: 14px; left: 14px; right: 14px;
  z-index: 999;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px;
  display: none;
  gap: 8px;
  overflow-x: auto;
  backdrop-filter: blur(16px);
}
.demo-nav.show { display: flex; }
.demo-nav button {
  flex: 0 0 auto;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.demo-nav button.active { background: var(--mc-red); border-color: var(--mc-red); }
.demo-nav .label { color: var(--text-mute); font-size: 11px; align-self: center; padding: 0 8px; }

/* ===================== Utility ===================== */
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--text-dim); }
.tiny { font-size: 12px; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ===================== Animations ===================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp .35s ease both; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
