/* Tirage au sort - theme festif clair/sombre, sans dependance externe */
:root {
  --bg: #fbf6ef;
  --bg-accent: #f4e9dc;
  --surface: #ffffff;
  --surface-2: #fdf9f4;
  --text: #2a2320;
  --muted: #6f6259;
  --border: #eadfd2;
  --primary: #c8323b;
  --primary-hover: #a8262f;
  --primary-text: #ffffff;
  --secondary: #1f7a52;
  --secondary-hover: #186343;
  --gold: #e0a92e;
  --danger: #b42318;
  --ok-bg: #e3f4ea; --ok-text: #17603f;
  --wait-bg: #fdf0d5; --wait-text: #7a5208;
  --admin-bg: #e8e6fb; --admin-text: #3f3a9c;
  --heart-bg: #fde4e6; --heart-text: #9b1c26;
  --info-bg: #e5eefb; --info-text: #1d4c8f;
  --error-bg: #fde4e2; --error-text: #8f1d14;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .07);
  --radius: 16px;
  --radius-sm: 10px;
  --focus: 0 0 0 3px rgba(200, 50, 59, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171f;
    --bg-accent: #1a1f2b;
    --surface: #1e2430;
    --surface-2: #232a38;
    --text: #f1ece6;
    --muted: #a99f97;
    --border: #2f3747;
    --primary: #e5535b;
    --primary-hover: #f06b72;
    --primary-text: #1a0d0e;
    --secondary: #3fb07c;
    --secondary-hover: #57c592;
    --gold: #f2c14e;
    --danger: #f2675c;
    --ok-bg: #173a2a; --ok-text: #8fe0b6;
    --wait-bg: #3a2f14; --wait-text: #f5d58a;
    --admin-bg: #2a2950; --admin-text: #c4c1ff;
    --heart-bg: #45202a; --heart-text: #ffb3ba;
    --info-bg: #1b2d4a; --info-text: #a9c8f5;
    --error-bg: #4a1f1c; --error-text: #ffb4ab;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --focus: 0 0 0 3px rgba(229, 83, 91, .45);
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, var(--bg-accent) 0, transparent 40%),
    radial-gradient(circle at 110% 10%, var(--bg-accent) 0, transparent 35%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-hover); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
code.big { font-size: 1.35rem; letter-spacing: .04em; padding: 6px 12px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
.h3, h3 { font-size: 1.05rem; margin-top: 1.5rem; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 40px; }

/* Barre du haut */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar::after { content: ""; display: block; height: 4px; background: repeating-linear-gradient(90deg, var(--primary) 0 24px, var(--secondary) 24px 48px, var(--gold) 48px 72px); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .link-button { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 550; font-size: .95rem; }
.nav a:hover, .link-button:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--heart-bg); color: var(--heart-text); }
.link-button { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 550; font-size: .95rem; }

.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.subnav a { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .93rem; font-weight: 550; }
.subnav a[aria-current="page"] { background: var(--secondary); border-color: var(--secondary); color: #fff; }

.footer { color: var(--muted); font-size: .85rem; padding-top: 16px; padding-bottom: 24px; text-align: center; }

/* Mise en page */
.page-head { margin-bottom: 20px; }
.crumbs { margin: 0 0 8px; font-size: .93rem; }
.crumbs a { text-decoration: none; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.layout-2 { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .layout-2 { grid-template-columns: 1.4fr 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.card.empty { text-align: center; color: var(--muted); }
.card.highlight { border-color: var(--gold); background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.list-card { text-decoration: none; color: var(--text); transition: transform .15s ease, box-shadow .15s ease; display: block; }
.list-card:hover { color: var(--text); transform: translateY(-2px); }

.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--secondary); margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.hint { color: var(--muted); font-size: .85rem; margin: -4px 0 4px; }
.description { white-space: pre-line; }
.notice { background: var(--wait-bg); color: var(--wait-text); padding: 10px 14px; border-radius: var(--radius-sm); }

/* Cartes d'evenement */
.event-card { display: flex; flex-direction: column; gap: 8px; border-top: 5px solid var(--gold); }
.event-card.is-drawn { border-top-color: var(--primary); }
.event-card .btn, .event-card .badge { align-self: flex-start; margin-top: auto; }

/* Revelation */
.reveal-card { max-width: 640px; margin: 0 auto; }
.reveal { text-align: center; margin: 24px 0; padding: 32px 16px; border-radius: var(--radius); background:
  radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--gold) 25%, transparent) 0, transparent 45%),
  radial-gradient(circle at 80% 80%, color-mix(in srgb, var(--primary) 18%, transparent) 0, transparent 50%),
  var(--surface-2); border: 2px dashed var(--gold); }
.reveal-label { margin: 0; font-weight: 600; color: var(--muted); }
.reveal-name { font-size: clamp(2rem, 8vw, 3.2rem); font-weight: 800; margin: 6px 0; color: var(--primary); animation: pop .6s ease-out both; overflow-wrap: anywhere; }
.reveal-wait { border-style: dotted; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reveal-name { animation: none; } .list-card { transition: none; } }

.chips { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: .92rem; }

/* Statistiques */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.stat:hover { color: var(--text); }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { color: var(--muted); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.form label { font-weight: 600; font-size: .93rem; }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-row > div { display: flex; flex-direction: column; gap: 6px; flex: 1 1 140px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none; box-shadow: var(--focus); border-color: var(--primary);
}
.check { display: flex; align-items: center; gap: 10px; font-weight: 500 !important; cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 12px; padding: 8px 0; }
.is-inactive { opacity: .6; }
.inline { display: inline; margin: 0; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 650; border-radius: 999px;
  padding: 10px 20px; min-height: 44px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color .15s ease, transform .1s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-text); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; min-height: 36px; font-size: .9rem; }
.btn-lg { padding: 14px 28px; font-size: 1.1rem; }
.btn-block { width: 100%; margin-top: 8px; }
.form .btn { align-self: flex-start; }
.form .btn-block { align-self: stretch; }

/* Badges */
.badge { display: inline-block; font-size: .78rem; font-weight: 650; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-wait { background: var(--wait-bg); color: var(--wait-text); border-color: transparent; }
.badge-admin { background: var(--admin-bg); color: var(--admin-text); border-color: transparent; }
.badge-heart { background: var(--heart-bg); color: var(--heart-text); border-color: transparent; }
h1 .badge { font-size: .8rem; letter-spacing: 0; }

/* Messages */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { margin: 0; padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 550; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }
.flash-info { background: var(--info-bg); color: var(--info-text); }

/* Tableaux et listes */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.list-rows { list-style: none; padding: 0; margin: 8px 0; }
.list-rows li { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-rows li:last-child { border-bottom: 0; }
.report { margin: 0 0 12px; padding-left: 20px; }
.spoiler summary { cursor: pointer; font-weight: 650; color: var(--primary); padding: 8px 0; }
.credentials { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin: 20px 0; }
.credentials dt { font-weight: 600; color: var(--muted); }
.credentials dd { margin: 0; }

/* Connexion */
.auth-card { max-width: 440px; margin: 24px auto; }
.auth-hero { font-size: 3rem; line-height: 1; margin-bottom: 8px; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .topbar-inner { justify-content: center; }
  .credentials { grid-template-columns: 1fr; gap: 4px; }
}
