/* Toutes les couleurs et polices viennent du thème de l'événement (voir PRESETS dans badge.js). */
:root {
  --primary: #3d3b8e;
  --primary-text: #ffffff;
  --accent: #5ec2b7;
  --accent-text: #14123a;
  --hero-bg: linear-gradient(135deg, #2b2a6b 0%, #3d3b8e 55%, #2f6f8f 100%);
  --hero-text: #ffffff;
  --page-bg: #f4f4f8;
  --surface: #ffffff;
  --text: #1c1b33;
  --muted: #686781;
  --border: #e2e1ec;
  --radius: 14px;
  --font: Montserrat, system-ui, sans-serif;
  --heading-font: var(--font);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

[hidden] { display: none !important; }

h1, h2, .heading { font-family: var(--heading-font); }

/* ---------- En-tête de l'événement ---------- */

.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 32px 16px 28px;
  text-align: center;
}
.hero img { max-height: 64px; max-width: 70%; margin-bottom: 12px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 7vw, 2.3rem); line-height: 1.1; font-weight: 700; }
.hero .tagline { margin: 0 auto 12px; opacity: .85; max-width: 32ch; }
.hero .meta { margin: 0; font-weight: 600; font-size: .95rem; }
.hero .meta span:empty { display: none; }
.hero .meta span + span::before { content: " · "; }

.countdown {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 4px;
}
.countdown span {
  background: color-mix(in srgb, var(--hero-text) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--hero-text) 18%, transparent);
  border-radius: var(--radius);
  min-width: 60px;
  padding: 6px 4px;
  font-size: .72rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.countdown b { font-size: 1.4rem; line-height: 1.15; font-variant-numeric: tabular-nums; }

.ticket {
  display: inline-block;
  margin-top: 16px;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
}

/* ---------- Générateur ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}
.card h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-text);
  font-family: var(--font);
  font-size: .8rem;
  flex: none;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  font: inherit;
  font-size: .9rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}

.canvas-wrap {
  position: relative;
  border-radius: calc(var(--radius) * .7);
  overflow: hidden;
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}
#badge-canvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  touch-action: none;
  cursor: grab;
}
#badge-canvas:active { cursor: grabbing; }

.hint { font-size: .85rem; color: var(--muted); margin: 8px 0 0; text-align: center; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.btn {
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: calc(var(--radius) * .85);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.whatsapp { background: #25d366; border-color: #25d366; color: #fff; }
.btn.facebook { background: #1877f2; border-color: #1877f2; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }

.file-btn input { display: none; }

.tools { margin-top: 12px; display: grid; gap: 10px; }
.tools label { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.tools input[type="range"] { width: 100%; accent-color: var(--primary); }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; justify-self: start; padding: 4px 0; }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: .85rem; font-weight: 600; }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: 1rem;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * .7);
  background: var(--surface);
  color: var(--text);
}
.field input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.optional { font-weight: 400; color: var(--muted); }

.actions { display: grid; gap: 8px; }

.privacy { font-size: .8rem; color: var(--muted); text-align: center; margin-top: 20px; }
.privacy strong { color: var(--text); }

.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  margin-top: 16px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1d1d1f;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: .9rem;
  max-width: calc(100% - 32px);
  text-align: center;
  z-index: 10;
}

footer { text-align: center; font-size: .75rem; color: var(--muted); padding: 0 16px 24px; }
footer a { color: inherit; }
