*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial;
  background: radial-gradient(circle at top, #202020, #050505);
  color:#fff;
}

/* HEADER */
.header{ padding: 18px 14px 8px; display:flex; justify-content:center; }
.header-card{
  position:relative;
  width: 560px; max-width: 96vw;
  border-radius: 22px;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);
  overflow:hidden;
}
.title{
  margin: 10px 0 0;
  text-align:center;
  font-size: 36px;
  font-weight: 1000;
  letter-spacing: .6px;
  background: linear-gradient(90deg, #ff3b30, #ffd60a, #34c759);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle{
  margin-top: 6px;
  text-align:center;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: .80;
}
.candyline{
  width: 220px;
  height: 10px;
  border-radius: 999px;
  margin: 14px auto 0;
  background: repeating-linear-gradient(45deg,#fff 0px,#fff 7px,#ff3b30 7px,#ff3b30 14px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
  opacity: .95;
}
.lights{
  position:absolute; top: 10px; left: 10px; right: 10px;
  height: 26px; display:flex; justify-content: space-between; align-items:center;
  pointer-events:none; opacity:.95;
}
.lights span{
  width: 14px; height: 14px; border-radius: 50%;
  box-shadow: 0 0 10px rgba(255,255,255,0.18), 0 10px 18px rgba(0,0,0,0.35);
  animation: twinkle 1.9s ease-in-out infinite;
}
.lights span:nth-child(3n+1){ background: rgba(255,59,48,0.95); }
.lights span:nth-child(3n+2){ background: rgba(255,214,10,0.95); }
.lights span:nth-child(3n+3){ background: rgba(52,199,89,0.95); }
@keyframes twinkle{
  0%{transform: translateY(0) scale(1); opacity:.75}
  50%{transform: translateY(-2px) scale(1.06); opacity:1}
  100%{transform: translateY(0) scale(1); opacity:.75}
}
.snow{
  position:absolute; inset:0; pointer-events:none; opacity:.16;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 1px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.8) 1px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.7) 1px, transparent 2px);
  background-size: 120px 120px, 180px 180px, 240px 240px;
  background-position: 0 0, 40px 60px, 90px 30px;
  animation: snowfall 6s linear infinite;
}
@keyframes snowfall{ from{transform:translateY(-10px)} to{transform:translateY(30px)} }

/* TOPBAR */
.topbar{ width:100%; padding: 10px 14px 0; display:flex; justify-content:center; }
.who{
  display:inline-block; padding:10px 14px;
  border-radius:14px; background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
}
.who .label{opacity:.8;margin-right:8px}
.who .name{font-weight:900}

/* SCENE */
#scene{
  position:relative;
  width:420px;
  max-width:95vw;
  margin: 12px auto 20px;
}
#tree{
  width:100%;
  display:block;
  user-select:none;
  -webkit-user-select:none;
  pointer-events:none;
}
#ornaments{ position:absolute; inset:0; }

/* BOULES */
.boule{
  position:absolute;
  transform: translate(-50%, -50%);
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.45));
  transition: transform .2s ease, opacity .2s ease;
}
.boule:hover{ transform: translate(-50%, -50%) scale(1.10); }

/* MODAL */
.modal{
  position:fixed; inset:0;
  background: rgba(0,0,0,0.72);
  display:flex; align-items:center; justify-content:center;
  z-index:50; padding:18px;
}
.hidden{ display:none; }
.modal-card{
  width:440px; max-width:95vw;
  background: rgba(20,20,20,0.96);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius:18px;
  padding:18px 16px;
  text-align:center;
}
.modal-title{ margin: 6px 0 10px; font-size: 20px; font-weight: 1000; }
#nameForm{ display:flex; gap:10px; justify-content:center; margin-top:10px; flex-wrap:wrap; }
#nameInput{
  width:240px; max-width:100%;
  padding:12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
  color:#fff;
  outline:none;
}
#nameForm button{
  padding:12px 14px;
  border-radius:12px;
  border:0;
  background:#f2c14e;
  color:#111;
  font-weight:1000;
  cursor:pointer;
}
.error{ color:#ff7070; min-height:18px; }
.hint{ margin-top:10px; opacity:.75; font-size:12px; }
.admin-btn-wrap{ margin-top: 14px; }
.admin-btn{
  background:transparent;
  border:1px solid rgba(255,255,255,0.30);
  color: rgba(255,255,255,0.75);
  padding:6px 14px;
  border-radius:12px;
  font-size:12px;
  cursor:pointer;
}

/* RESULT */
.result{ display:flex; justify-content:center; padding: 8px 16px 30px; }
.result.hidden{ display:none; }
.result-card{
  width:440px; max-width:95vw;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding:16px;
  text-align:center;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.result-title{ opacity:.85; }
.result-name{ font-size:30px; font-weight:1000; margin-top:8px; }
.result-note{ opacity:.75; margin-top:6px; }

/* ===== ANIM CHUTE ===== */
:root{ --ground: 92%; }

@keyframes fallDown {
  0%   { transform: translate(-50%, -50%) scale(1.10); }
  100% { transform: translate(-50%, var(--ground)) scale(1) rotate(14deg); }
}

.boule.is-falling{
  z-index:999;
  pointer-events:none;
  animation: fallDown 720ms cubic-bezier(.2,.85,.2,1) forwards;
}

/* Papier (nom qui sort) */
@keyframes paperUp {
  0%   { transform: translate(-50%, 10px) scale(0.95); opacity: 0; }
  100% { transform: translate(-50%, -60px) scale(1); opacity: 1; }
}
.paper{
  position:absolute;
  left:50%;
  top: calc(var(--ground) + 6px);
  width:240px;
  max-width:80vw;
  background: rgba(255,255,255,0.95);
  color:#111;
  border-radius: 14px;
  padding: 14px;
  z-index:1000;
  opacity:0;
  pointer-events:none;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.paper.show{ animation: paperUp 420ms cubic-bezier(.2,.9,.2,1) forwards; }
.paper .big{ font-size:22px; font-weight:1000; text-align:center; }

/* ===== ADMIN PANEL ===== */
.admin-panel{
  position:fixed; inset:0;
  background: rgba(0,0,0,0.78);
  display:flex; align-items:center; justify-content:center;
  z-index:200; padding:18px;
}
.admin-card{
  width: 520px; max-width: 95vw;
  background: rgba(20,20,20,0.98);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.65);
}
.admin-card h2{ margin: 0 0 10px; font-size: 16px; opacity:.95; }
.admin-list{ margin: 0; padding: 0; list-style: none; max-height: 280px; overflow:auto; }
.admin-list li{
  padding: 10px 10px;
  border-radius: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}
.admin-del{
  border:0;
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  background: rgba(255,255,255,0.10);
  color:#fff;
  transition: .15s;
}
.admin-del:hover{ background: rgba(255,59,48,0.85); }
.admin-actions{
  display:flex; gap:10px; justify-content:center;
  margin-top: 12px; flex-wrap: wrap;
}
.admin-actions button{
  padding: 10px 12px;
  border-radius: 12px;
  border:0;
  background:#f2c14e;
  color:#111;
  font-weight:1000;
  cursor:pointer;
}
.admin-actions .danger{ background:#ff3b30; color:#fff; }

@media (max-width: 480px){
  .title{ font-size:30px; }
  .header-card{ padding:18px 14px 16px; }
}