/* ==========================================================
   Secret Santa : styles
   Pour changer l'ambiance, modifie surtout les variables ci-dessous.
   ========================================================== */
:root {
  --pine: #1e5845;        /* fond sapin */
  --pine-deep: #154234;
  --berry: #e23d5b;       /* papier cadeau */
  --berry-deep: #b82944;
  --gold: #ffc23c;        /* ruban */
  --paper: #fff6e5;       /* étiquette */
  --ink: #2b1a2f;         /* texte foncé */
  --mint: #9fe6c8;
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--paper);
  background-color: var(--pine);
  background-image:
    radial-gradient(circle at 25% 30%, rgba(255, 255, 255, .17) 0 3px, transparent 4px),
    radial-gradient(circle at 75% 70%, rgba(255, 255, 255, .10) 0 2px, transparent 3px);
  background-size: 96px 96px, 64px 64px;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

/* ---------- Titre ---------- */
.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.2rem, 13vw, 6.8rem);
  line-height: .95;
  letter-spacing: .01em;
  margin: 0;
  color: var(--paper);
  transform: rotate(-4deg);
  text-shadow: .055em .055em 0 var(--berry), .11em .11em 0 var(--ink);
}
.title-sm { font-size: clamp(2.2rem, 7vw, 3.4rem); }

/* ---------- Boutons ---------- */
.btn {
  font: inherit;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: .6em 1.5em;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; box-shadow: 0 6px 0 var(--ink); }
.btn-small { font-size: 1.05rem; padding: .45em 1.2em; box-shadow: 0 4px 0 var(--ink); }
.btn-small:hover { box-shadow: 0 6px 0 var(--ink); }

/* ---------- Page participant ---------- */
.stage {
  max-width: 34rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) 1.25rem 3rem;
  text-align: center;
}
.hello { font-size: 1.35rem; margin: 2.6rem 0 0; }
.hello strong { font-family: var(--font-display); font-weight: 400; color: var(--gold); font-size: 1.15em; }
.lead { max-width: 28rem; margin: 0 auto 1.6rem; color: rgba(255, 246, 229, .88); }
.error { color: var(--ink); background: var(--gold); border-radius: 12px; padding: .7rem 1rem; margin-top: 1.5rem; font-weight: 700; }

/* Le cadeau (100 % CSS) */
.gift {
  position: relative;
  width: 190px;
  height: 180px;
  margin: 2.6rem auto 2rem;
}
.gift-box {
  position: absolute;
  left: 12px; bottom: 0;
  width: 166px; height: 124px;
  border-radius: 10px;
  background-color: var(--berry);
  background-image:
    linear-gradient(90deg, transparent 72px, var(--gold) 72px, var(--gold) 94px, transparent 94px),
    radial-gradient(circle, rgba(255, 255, 255, .35) 0 3px, transparent 4px);
  background-size: 100% 100%, 26px 26px;
  box-shadow: inset 0 -12px 0 rgba(0, 0, 0, .14), 0 10px 0 rgba(0, 0, 0, .18);
}
.gift-lid {
  position: absolute;
  left: 0; top: 26px;
  width: 190px; height: 40px;
  z-index: 2;
  border-radius: 9px;
  background-color: var(--berry-deep);
  background-image: linear-gradient(90deg, transparent 84px, var(--gold) 84px, var(--gold) 106px, transparent 106px);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15);
  transform-origin: 15% 100%;
  transition: transform .75s cubic-bezier(.3, 1.7, .5, 1), opacity .75s;
}
.gift-lid::before,
.gift-lid::after {
  content: "";
  position: absolute;
  bottom: calc(100% - 6px);
  width: 46px; height: 32px;
  border: 10px solid var(--gold);
  border-radius: 60% 40% 50% 50%;
}
.gift-lid::before { left: calc(50% - 50px); transform: rotate(-22deg); }
.gift-lid::after  { left: calc(50% + 4px);  transform: rotate(22deg) scaleX(-1); }

.gift.is-shaking { animation: shake .45s ease-in-out infinite; }
.gift.is-open .gift-lid { transform: translate(-62px, 44px) rotate(-26deg); }
.gift.instant .gift-lid { transition: none; }

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-7deg) translateY(-4px); }
  45% { transform: rotate(6deg); }
  70% { transform: rotate(-4deg) translateY(-2px); }
  85% { transform: rotate(3deg); }
}

/* Étiquette du résultat */
.result {
  position: relative;
  max-width: 24rem;
  margin: 0 auto;
  padding: 1.6rem 1.5rem 1.4rem;
  color: var(--ink);
  background: var(--paper);
  border-radius: 14px 14px 14px 14px;
  transform: rotate(1.5deg);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .2);
}
.result::before { /* le trou de l'étiquette */
  content: "";
  position: absolute;
  top: 12px; left: 50%;
  width: 14px; height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--pine);
}
.result-kicker { margin: .6rem 0 .2rem; font-weight: 700; }
.result-name {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  line-height: 1.05;
  color: var(--berry);
  margin: .2rem 0;
  min-height: 1.1em;
  overflow-wrap: anywhere;
}
.result-name.is-final { animation: pop .5s cubic-bezier(.3, 1.8, .5, 1); }
.result-note { margin: .6rem 0 0; font-size: .95rem; color: rgba(43, 26, 47, .75); }

@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }

/* Confettis */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px; height: 16px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); }
}

/* ---------- Administration ---------- */
.admin { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.admin-head { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem 1.5rem; margin-bottom: 2.4rem; }
.admin-head p { margin: .4rem 0 0; font-weight: 700; color: var(--mint); }
.admin-head .spacer { flex: 1; }

.panel {
  color: var(--ink);
  background: var(--paper);
  border-radius: 18px;
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: 0 8px 0 rgba(0, 0, 0, .2);
}
.panel-login { max-width: 24rem; }
.panel label { display: block; font-weight: 700; margin-bottom: .4rem; }

.input, .select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 2px solid rgba(43, 26, 47, .25);
  border-radius: 10px;
  padding: .5rem .7rem;
}
.input { width: 100%; }
.input:focus, .select:focus { border-color: var(--ink); outline: none; }
.panel .btn { margin-top: 1rem; }

.summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.progress { margin: 0; font-size: 1.2rem; }
.progress strong { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; color: var(--berry); }
.switch { display: inline-flex !important; align-items: center; gap: .5rem; cursor: pointer; margin: 0 !important; }
.switch input { width: 1.2rem; height: 1.2rem; accent-color: var(--berry); }

.warn { background: var(--gold); border-radius: 10px; padding: .7rem 1rem; font-weight: 700; margin: 0 0 1.2rem; }

.add { display: flex; gap: .6rem; margin-bottom: 1.4rem; }
.add .input { max-width: 20rem; }
.add .btn { margin-top: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 46rem; }
th { text-align: left; font-size: .9rem; color: rgba(43, 26, 47, .65); padding: .5rem .6rem; border-bottom: 2px solid rgba(43, 26, 47, .15); }
td { padding: .7rem .6rem; border-bottom: 1px solid rgba(43, 26, 47, .1); vertical-align: middle; }
td.name { font-weight: 800; }
.badge { display: inline-block; font-size: .85rem; font-weight: 700; border-radius: 999px; padding: .15rem .65rem; white-space: nowrap; }
.badge-done { background: var(--mint); }
.badge-wait { background: rgba(43, 26, 47, .08); }
.muted { color: rgba(43, 26, 47, .55); font-size: .9rem; }
.hidden-result { letter-spacing: .1em; color: rgba(43, 26, 47, .4); }
.forced-on { border-color: var(--berry); background: #ffe9ee; }

.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  border: 2px solid rgba(43, 26, 47, .2);
  border-radius: 999px;
  padding: .2rem .7rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink); }
.chip-danger:hover { border-color: var(--berry); color: var(--berry-deep); }

.empty { text-align: center; padding: 1.5rem 0 .5rem; color: rgba(43, 26, 47, .65); }
.footer-actions { margin-top: 1.6rem; display: flex; justify-content: flex-end; }

.link-btn {
  font: inherit; font-weight: 700;
  color: var(--paper);
  background: none; border: 0;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%; bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: .7rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  z-index: 20;
  max-width: calc(100% - 2rem);
}
.toast.is-error { background: var(--berry-deep); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
