:root {
  --night: #0b1a33;
  --night-2: #132a4f;
  --red: #c8242f;
  --red-dark: #8e1520;
  --green: #1f7a4d;
  --green-dark: #0f4a2d;
  --gold: #f4c95d;
  --gold-2: #e8a93a;
  --snow: #fdfcf8;
  --ink: #2a1d16;
  --paper: #fff8ec;
  --muted: #7a6a5c;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --font-title: "Mountains of Christmas", "Comic Sans MS", cursive;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { background: #0a1528; }
body {
  font-family: var(--font-body);
  color: var(--snow);
  background:
    radial-gradient(1200px 600px at 80% -10%, #2b4c86 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #3a1f4f 0%, transparent 55%),
    linear-gradient(180deg, var(--night) 0%, #0a1528 100%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; padding: 0 18px 80px; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 700; margin: 0 0 .4em; line-height: 1.1; }
h2 { font-size: clamp(30px, 4vw, 42px); color: var(--gold); text-shadow: 0 2px 0 rgba(0,0,0,.3); }
a { color: var(--gold); }
button { font-family: inherit; }

/* ---------- Guirlande ---------- */
.garland { display: flex; justify-content: space-around; height: 34px; position: relative; z-index: 2; }
.garland::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 28px; border-bottom: 2px solid #23402e; border-radius: 0 0 50% 50%/0 0 100% 100%; }
.garland span { width: 12px; height: 18px; border-radius: 50%; margin-top: 10px; animation: blink 2.4s infinite; box-shadow: 0 0 12px currentColor; background: currentColor; }
.garland span:nth-child(4n+1) { color: #ff4d4d; }
.garland span:nth-child(4n+2) { color: #ffd84d; animation-delay: .6s; }
.garland span:nth-child(4n+3) { color: #4dff88; animation-delay: 1.2s; }
.garland span:nth-child(4n+4) { color: #4dc3ff; animation-delay: 1.8s; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; box-shadow: none; } }

/* ---------- Barre démo ---------- */
.demobar { position: relative; z-index: 3; background: repeating-linear-gradient(45deg, #f4c95d, #f4c95d 12px, #e8a93a 12px, #e8a93a 24px); color: var(--ink); font-weight: 800; font-size: 13px; padding: 6px 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.demobar label { font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.demobar button { border: 0; background: var(--ink); color: var(--gold); border-radius: 8px; padding: 3px 10px; cursor: pointer; font-weight: 700; }

/* ---------- En-tête ---------- */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--snow); }
.brand svg { width: 46px; height: 46px; }
.brand b { font-family: var(--font-title); font-size: 28px; color: var(--snow); }
.brand small { display: block; font-size: 12px; color: var(--gold); letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
.userchip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); padding: 6px 8px 6px 12px; border-radius: 999px; font-size: 14px; }
.userchip .site { background: var(--red); padding: 2px 10px; border-radius: 999px; font-weight: 800; font-size: 12px; }
.userchip button { background: transparent; border: 0; color: #cfd8ea; cursor: pointer; font-size: 12px; text-decoration: underline; }

nav.tabs { display: flex; gap: 6px; margin: 10px 0 24px; flex-wrap: wrap; }
nav.tabs a { text-decoration: none; color: var(--snow); padding: 9px 16px; border-radius: 999px; background: rgba(255,255,255,.07); font-weight: 800; font-size: 15px; border: 1px solid transparent; }
nav.tabs a:hover { background: rgba(255,255,255,.14); }
nav.tabs a.on { background: var(--red); border-color: #ff8a8a55; box-shadow: 0 4px 14px rgba(200,36,47,.45); }
nav.tabs a .count { background: var(--gold); color: var(--ink); border-radius: 999px; padding: 0 7px; margin-left: 6px; font-size: 12px; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 28px; align-items: center; padding: 30px 0 20px; }
.hero h1 { font-size: clamp(44px, 7vw, 80px); color: var(--snow); text-shadow: 0 4px 0 var(--red-dark), 0 8px 24px rgba(0,0,0,.4); }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .lead { font-size: 19px; line-height: 1.55; color: #e5ebf6; max-width: 560px; }
.hero .dates { display: inline-flex; gap: 8px; align-items: center; background: rgba(244,201,93,.12); border: 1px dashed var(--gold); color: var(--gold); padding: 6px 14px; border-radius: 999px; font-weight: 800; margin-bottom: 14px; }
.hero-art { position: relative; display: flex; justify-content: center; }
.hero-art svg.lutin { width: min(320px, 80%); filter: drop-shadow(0 18px 30px rgba(0,0,0,.45)); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-12px) rotate(2deg); } }
.bubble { position: absolute; top: -4%; right: 0; z-index: 2; background: var(--snow); color: var(--ink); padding: 10px 14px; border-radius: 16px; font-weight: 800; font-size: 15px; max-width: 190px; box-shadow: var(--shadow); transform: rotate(4deg); }
.bubble::after { content: ""; position: absolute; left: 18px; bottom: -10px; border: 10px solid transparent; border-top-color: var(--snow); border-bottom: 0; }

.countdown { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.countdown div { background: var(--paper); color: var(--ink); border-radius: 14px; min-width: 76px; text-align: center; padding: 8px 6px; box-shadow: 0 6px 0 var(--red-dark); }
.countdown b { display: block; font-size: 30px; font-family: var(--font-title); color: var(--red); }
.countdown span { font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: .06em; }
.cd-label { font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-size: 13px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; font-weight: 800; font-size: 16px; padding: 13px 22px; border-radius: 14px; color: #fff; background: linear-gradient(180deg, #e0333f, var(--red)); box-shadow: 0 5px 0 var(--red-dark), 0 10px 20px rgba(0,0,0,.25); transition: transform .08s; text-decoration: none; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--red-dark); }
.btn.green { background: linear-gradient(180deg, #2a9a63, var(--green)); box-shadow: 0 5px 0 var(--green-dark), 0 10px 20px rgba(0,0,0,.25); }
.btn.gold { background: linear-gradient(180deg, #ffd978, var(--gold-2)); color: var(--ink); box-shadow: 0 5px 0 #a8731f, 0 10px 20px rgba(0,0,0,.25); }
.btn.ghost { background: rgba(255,255,255,.1); box-shadow: none; border: 1px solid rgba(255,255,255,.25); }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: 10px; box-shadow: 0 3px 0 var(--red-dark); }
.btn.green.small { box-shadow: 0 3px 0 var(--green-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ms { background: #fff; color: #2b2b2b; box-shadow: 0 5px 0 #b9b9b9, 0 10px 20px rgba(0,0,0,.25); }
.btn-ms svg { width: 20px; height: 20px; }

/* ---------- Cartes papier ---------- */
.paper { background: var(--paper); color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; position: relative; }
.paper h3 { color: var(--red); font-size: 28px; }
.paper.ribbon::before { content: ""; position: absolute; top: 0; bottom: 0; left: 34px; width: 14px; background: linear-gradient(90deg, var(--red-dark), var(--red), var(--red-dark)); opacity: .9; }
.section { margin: 38px 0; }
.muted { color: var(--muted); }

/* Règles */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.rule { background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.rule .ico { font-size: 38px; }
.rule h4 { font-family: var(--font-title); font-size: 26px; margin: 6px 0; color: var(--green); }
.rule p { margin: 0; line-height: 1.5; }
.rule .num { position: absolute; right: 12px; top: 4px; font-family: var(--font-title); font-size: 64px; color: rgba(200,36,47,.12); font-weight: 700; }

/* ---------- Jauges ---------- */
.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.gauge { background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.15); border-radius: 22px; padding: 18px 14px; text-align: center; position: relative; }
.gauge.mine { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(244,201,93,.35), 0 0 30px rgba(244,201,93,.2); }
.gauge .mine-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 900; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.gauge h3 { font-size: 30px; color: var(--snow); margin-bottom: 8px; }
.tube { margin: 0 auto; width: 74px; height: 210px; border-radius: 37px; background: rgba(0,0,0,.35); border: 4px solid; border-image: none; position: relative; overflow: hidden; box-shadow: inset 0 0 18px rgba(0,0,0,.6); border-color: #e9e4da; }
.tube::before { content: ""; position: absolute; inset: -4px; border-radius: 37px; background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(200,36,47,.0) 10px 20px); }
.tube .fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(0deg, #e8a93a, #ffe08a 70%, #fff6cf); transition: height 1.4s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 25px rgba(255,214,102,.8); }
.tube .fill::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle, #fff 1.5px, transparent 2px); background-size: 16px 22px; animation: rise 3s linear infinite; opacity: .8; }
@keyframes rise { from { background-position: 0 0; } to { background-position: 0 -88px; } }
.tube .shine { position: absolute; top: 10px; left: 12px; width: 10px; height: 70%; border-radius: 10px; background: rgba(255,255,255,.35); }
.tube-wrap { position: relative; display: inline-block; padding: 0 10px; }
.tube-wrap::before, .tube-wrap::after { content: ""; position: absolute; top: -2px; bottom: -2px; width: 10px; border-radius: 6px; background: repeating-linear-gradient(180deg, var(--red) 0 12px, #fff 12px 24px); }
.tube-wrap::before { left: -6px; } .tube-wrap::after { right: -6px; }
.gauge .pct { font-family: var(--font-title); font-size: 40px; color: var(--gold); margin-top: 10px; }
.gauge .pts { font-size: 14px; color: #cfd8ea; font-weight: 700; }
.gauge .full { color: var(--gold); font-weight: 900; margin-top: 4px; animation: blink 1.2s infinite; }

/* Stats perso */
.mystats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: rgba(255,255,255,.08); border-radius: 16px; padding: 14px; text-align: center; border: 1px solid rgba(255,255,255,.12); }
.stat b { display: block; font-size: 32px; font-family: var(--font-title); color: var(--gold); }
.stat span { font-size: 13px; color: #cfd8ea; font-weight: 700; }
.quick { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- Galerie ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid rgba(255,255,255,.25); background: transparent; color: var(--snow); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; }
.chip.on { background: var(--snow); color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.polaroid { background: #fff; color: var(--ink); padding: 10px 10px 14px; border-radius: 6px; box-shadow: var(--shadow); transform: rotate(var(--r, 0deg)); transition: transform .2s; cursor: pointer; position: relative; }
.polaroid:hover { transform: rotate(0) scale(1.03); z-index: 2; }
.polaroid .ph { aspect-ratio: 1; background: #ddd center/cover no-repeat; border-radius: 3px; }
.polaroid .cap { font-family: "Caveat", "Segoe Print", cursive; font-size: 20px; line-height: 1.15; margin-top: 8px; min-height: 46px; }
.polaroid .meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; font-weight: 700; }
.polaroid .tape { position: absolute; top: -10px; left: 50%; width: 80px; height: 22px; transform: translateX(-50%) rotate(-3deg); background: rgba(244,201,93,.75); }
.badge { display: inline-block; font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge.ok { background: #d8f3e3; color: var(--green-dark); }
.badge.wait { background: #fff0c9; color: #8a5a00; }
.badge.ko { background: #ffd9d9; color: var(--red-dark); }
.polaroid .badge { position: absolute; top: 16px; right: 16px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }

.empty { text-align: center; padding: 50px 20px; color: #cfd8ea; }
.empty .big { font-size: 60px; }

/* ---------- Énigmes ---------- */
.riddles { display: grid; gap: 18px; }
.riddle { display: grid; grid-template-columns: 90px 1fr; gap: 18px; }
.riddle .tag { width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff6b6b, var(--red) 55%, var(--red-dark)); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; box-shadow: inset -6px -8px 0 rgba(0,0,0,.15), 0 8px 18px rgba(0,0,0,.3); position: relative; }
.riddle .tag::before { content: ""; position: absolute; top: -10px; width: 18px; height: 14px; background: var(--gold); border-radius: 4px 4px 0 0; }
.riddle .tag b { font-family: var(--font-title); font-size: 30px; line-height: 1; }
.riddle .tag small { font-weight: 800; font-size: 11px; }
.riddle.solved .tag { background: radial-gradient(circle at 35% 30%, #5fe39d, var(--green) 55%, var(--green-dark)); }
.riddle .q { white-space: pre-line; font-size: 17px; line-height: 1.5; }
.riddle form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.riddle input { flex: 1; min-width: 200px; }
.hint { margin-top: 8px; font-size: 14px; }
.hint summary { cursor: pointer; color: var(--green); font-weight: 800; }
.riddle .foot { font-size: 13px; color: var(--muted); margin-top: 8px; font-weight: 700; }

/* ---------- Formulaires ---------- */
input[type=text], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 2px solid #e6dccb; font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 3px rgba(244,201,93,.35); }
label.f { display: block; font-weight: 800; font-size: 14px; margin: 12px 0 6px; color: var(--ink); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Modale ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5, 12, 26, .75); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--paper); color: var(--ink); border-radius: 22px; width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.5); position: relative; border-top: 10px solid var(--red); }
.modal h2 { color: var(--red); text-shadow: none; }
.modal .close { position: absolute; top: 10px; right: 14px; background: none; border: 0; font-size: 28px; cursor: pointer; color: var(--muted); }
.drop { border: 3px dashed #e0cfa9; border-radius: 16px; padding: 24px; text-align: center; cursor: pointer; background: #fffdf7; }
.drop img { max-width: 100%; max-height: 260px; border-radius: 10px; }
.sites-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.sites-pick button { border: 3px solid #eadfcb; background: #fff; border-radius: 18px; padding: 18px 8px; cursor: pointer; font-weight: 900; font-size: 18px; color: var(--ink); transition: all .15s; }
.sites-pick button span { display: block; font-size: 40px; margin-bottom: 6px; }
.sites-pick button:hover, .sites-pick button.on { border-color: var(--red); background: #fff1ef; transform: translateY(-3px); }
.lightbox img { width: 100%; border-radius: 12px; }

/* ---------- Modération / admin ---------- */
.mod-list { display: grid; gap: 16px; }
.mod-item { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.mod-item .ph { aspect-ratio: 1; border-radius: 12px; background: #ddd center/cover; cursor: zoom-in; }
.mod-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #eadfcb; vertical-align: top; }
table.t th { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ---------- Toast & divers ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--paper); color: var(--ink); padding: 14px 20px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); z-index: 60; border-left: 8px solid var(--green); animation: up .3s; max-width: 92vw; }
.toast.err { border-left-color: var(--red); }
@keyframes up { from { transform: translate(-50%, 20px); opacity: 0; } }
.loader { text-align: center; padding: 80px 0; font-family: var(--font-title); font-size: 30px; color: var(--gold); }
.loader .spin { display: inline-block; animation: spin 1.5s linear infinite; font-size: 50px; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { background: rgba(244,201,93,.12); border: 1px solid var(--gold); color: var(--gold); padding: 12px 16px; border-radius: 14px; font-weight: 700; margin-bottom: 18px; }
footer { text-align: center; color: #8696b5; font-size: 13px; margin-top: 50px; }
.confetti { position: fixed; top: -20px; z-index: 70; pointer-events: none; font-size: 24px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 10px; }
  .hero .lead { margin: 0 auto; }
  .countdown, .hero .cta { justify-content: center; }
  .hero-art { order: -1; }
  .hero-art svg.lutin { width: 200px; }
  .gauges { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tube { width: 52px; height: 160px; }
  .gauge h3 { font-size: 22px; }
  .gauge .pct { font-size: 28px; }
  .admin-grid, .row2 { grid-template-columns: 1fr; }
  .mod-item { grid-template-columns: 1fr; }
  .riddle { grid-template-columns: 1fr; }
  .riddle .tag { width: 70px; height: 70px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .polaroid .cap { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
