:root {
  --green: #0d3b2e;
  --green-d: #06201a;
  --red: #b3202a;
  --red-d: #8a141d;
  --gold: #e8c26a;
  --gold-d: #b8923a;
  --paper: #f5ead3;
  --ink: #2b1d14;
  --title: "Mountains of Christmas", "Georgia", cursive;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 500;
  background:
    radial-gradient(ellipse at 50% 8%, rgba(52, 112, 78, .72), transparent 50%),
    radial-gradient(ellipse at 8% 72%, rgba(184, 146, 58, .12), transparent 32%),
    radial-gradient(ellipse at 92% 38%, rgba(179, 32, 42, .14), transparent 34%),
    linear-gradient(145deg, #0b3025, #06201a 72%) fixed;
  overflow-x: hidden;
}

/* neige au sol */
body::after {
  content: "";
  position: fixed;
  left: -10%; right: -10%; bottom: -130px;
  height: 200px;
  background:
    radial-gradient(ellipse at 25% 0, #f4f8fb 0 52%, transparent 53%),
    radial-gradient(ellipse at 70% 12%, #dfeaf1 0 52%, transparent 53%);
  pointer-events: none;
  z-index: 1;
}

canvas { position: fixed; inset: 0; pointer-events: none; }
#snow { z-index: 1; }
#confetti { z-index: 20; }

/* guirlande */
.lights {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
  z-index: 10;
}
.lights::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 6px;
  height: 3px;
  background: #0b0b0b;
}
.lights i {
  display: block;
  width: 12px; height: 19px;
  margin-top: 8px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: var(--c);
  box-shadow: 0 0 16px 4px var(--c);
  animation: glow 2.4s ease-in-out infinite;
}
.lights i:nth-child(even) { margin-top: 16px; }

@keyframes glow {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 90px 16px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

/* papier */
.ticket {
  position: relative;
  width: min(92vw, 400px);
  padding: 38px 32px 34px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  border-radius: 6px;
  transform: rotate(-1deg);
  box-shadow: 0 22px 44px rgba(0, 0, 0, .5);
  animation: rise .7s cubic-bezier(.2, .9, .3, 1.1) both;
}
.ticket::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px dashed var(--gold-d);
  border-radius: 4px;
  pointer-events: none;
}
.ticket.wide { width: min(96vw, 780px); transform: none; }

h1 {
  margin: 0 0 22px;
  font-family: var(--title);
  font-size: 2.8rem;
  line-height: 1;
  color: var(--red);
}

label { display: block; font-style: italic; }

input {
  width: 100%;
  margin: 6px 0 22px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.4rem;
  text-align: center;
}
input:focus { outline: none; border-bottom-color: var(--red); }

.btn {
  padding: 10px 28px;
  border: 2px solid var(--gold);
  border-radius: 40px;
  background: var(--red);
  color: var(--paper);
  font-family: var(--title);
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--red-d);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--red-d); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-d); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--red); border-color: var(--red); box-shadow: none; font-size: 1.1rem; padding: 6px 18px; }

.link {
  background: none; border: 0;
  color: var(--gold);
  font: inherit; font-style: italic;
  text-decoration: underline;
  cursor: pointer;
}

.msg { min-height: 1.4em; margin: 0; color: #ffc2c2; text-align: center; }
[hidden] { display: none !important; }
.center { display: flex; flex-direction: column; align-items: center; }

/* cadeau */
#salut {
  margin: 0 0 6px;
  font-family: var(--title);
  font-size: 2.4rem;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
#gift {
  width: min(66vw, 270px);
  overflow: visible;
  cursor: pointer;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .45));
  animation: bob 3s ease-in-out infinite;
}
#gift:focus-visible { outline: 2px dashed var(--gold); outline-offset: 8px; }
#gift #lid {
  transform-box: fill-box;
  transform-origin: left bottom;
  transition: transform .8s cubic-bezier(.3, 1.5, .5, 1);
}
#gift #glow { opacity: 0; transition: opacity .6s; }
#gift.shake { animation: shake .45s infinite; }
#gift.open { animation: none; }
#gift.open #lid { transform: translate(40px, -80px) rotate(24deg); }
#gift.open #glow { opacity: 1; }
.hint { margin: 4px 0 0; font-style: italic; color: var(--gold); }

/* étiquette */
.tag-wrap {
  position: relative;
  margin-top: 50px;
  transform-origin: 50% 0;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .5));
  animation: dropin .9s cubic-bezier(.2, .9, .3, 1.15) both, swing 5s ease-in-out .9s infinite;
}
.tag-wrap::before {
  content: "";
  position: absolute;
  left: 50%; top: -80px;
  width: 2px; height: 104px;
  background: var(--gold);
}
.tag {
  position: relative;
  width: min(84vw, 320px);
  padding: 58px 22px 34px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
  clip-path: polygon(16% 0, 84% 0, 100% 13%, 100% 100%, 0 100%, 0 13%);
}
.tag::before {
  content: "";
  position: absolute;
  top: 17px; left: 50%;
  width: 16px; height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .6);
}
.tag small { display: block; font-style: italic; font-size: 1.15rem; }
#cible {
  margin: 10px 0 14px;
  font-family: var(--title);
  font-size: 2.8rem;
  line-height: 1.05;
  color: var(--red);
  word-break: break-word;
}
.tag em { color: var(--gold-d); }

/* admin */
.count { margin: -8px 0 16px; font-style: italic; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-family: var(--title); font-size: 1.3rem; color: var(--red); padding: 4px 8px; }
td { padding: 8px; border-top: 1px dotted var(--gold-d); }
td.del { text-align: right; }
td button { background: none; border: 0; color: var(--red); font-size: 1.2rem; cursor: pointer; }
.pending { color: #8a7a68; font-style: italic; }
.add { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 12px; align-items: end; }
.add input { flex: 1 1 160px; margin: 0; text-align: left; font-size: 1.15rem; }
.actions { margin-top: 14px; }
.ticket a { display: inline-block; margin-top: 18px; color: var(--ink); }

/* Connexion festive */
.login-ticket {
  width: min(94vw, 470px);
  padding: 36px 34px 26px;
  overflow: hidden;
  isolation: isolate;
  transform: none;
  border: 1px solid rgba(232, 194, 106, .8);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% -10%, #fffdf2, transparent 56%),
    linear-gradient(155deg, #f8efd9, #eee0c2);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .48), 0 0 45px rgba(232, 194, 106, .12);
}
.login-ticket::before {
  inset: 10px;
  border: 1px solid rgba(184, 146, 58, .5);
  border-radius: 11px;
}
.ticket-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
  color: #94722d;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .2em;
}
.ticket-ribbon span { color: var(--red); font-size: .9rem; }
.holiday-seal {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 10px;
  place-items: center;
  border: 1px solid rgba(184, 146, 58, .55);
  border-radius: 50%;
  background: radial-gradient(circle, #fff8df 0 48%, #ead29a 100%);
  color: var(--red);
  font-size: 1.7rem;
  box-shadow: 0 3px 12px rgba(120, 74, 25, .16), inset 0 0 0 4px rgba(255,255,255,.55);
}
.login-ticket h1 {
  margin-bottom: 5px;
  font-size: clamp(2.6rem, 11vw, 3.25rem);
  text-shadow: 0 2px 0 #fff8e9;
}
.login-ticket h1 span { display: block; color: #174b37; }
.intro {
  margin: 0 0 22px;
  color: #75634b;
  font-size: 1.15rem;
  font-style: italic;
}
.auth-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin: 0 0 22px;
}
.auth-mode {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid rgba(126, 104, 67, .28);
  border-radius: 11px;
  background: rgba(255, 255, 255, .4);
  color: #554633;
  text-align: left;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.auth-mode:hover { transform: translateY(-2px); border-color: var(--gold-d); }
.auth-mode.selected {
  border: 2px solid #a7252c;
  background: linear-gradient(145deg, #fff8e8, #f4e5c7);
  box-shadow: 0 3px 10px rgba(120, 35, 29, .12), inset 0 0 0 1px rgba(255,255,255,.65);
}
.auth-mode:focus-visible, .auth-submit:focus-visible {
  outline: 3px solid #34704e;
  outline-offset: 3px;
}
.mode-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  background: #e9dcc0;
  color: var(--red);
  font-size: 1.15rem;
}
.selected .mode-icon { background: var(--red); color: #fff5dc; }
.mode-copy { display: grid; gap: 2px; }
.mode-copy strong { font-size: .98rem; line-height: 1.1; }
.mode-copy small { color: #796c57; font-size: .82rem; line-height: 1.15; }
.auth-fields { text-align: left; }
.login-ticket .auth-fields label {
  margin: 0 0 2px 2px;
  color: #5b4935;
  font-size: 1rem;
  font-style: normal;
  font-weight: 700;
}
.login-ticket input {
  margin: 0 0 14px;
  padding: 7px 10px;
  border: 1px solid #d5c6a9;
  border-radius: 8px;
  background: rgba(255, 255, 255, .56);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.2rem;
  text-align: left;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.login-ticket input::placeholder { color: #a39782; }
.login-ticket input:focus {
  border-color: #34704e;
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(52, 112, 78, .12);
}
.auth-help {
  min-height: 1.25em;
  margin: -2px 0 15px;
  color: #75634b;
  font-size: .95rem;
  font-style: italic;
  line-height: 1.25;
}
.auth-submit {
  width: 100%;
  padding: 12px 20px;
  border: 2px solid #f1d78f;
  background: linear-gradient(180deg, #c8323a, #a71925);
  box-shadow: 0 5px 0 #74141b, 0 9px 18px rgba(104, 20, 23, .2);
  font-size: 1.45rem;
  letter-spacing: .02em;
}
.auth-submit:hover { box-shadow: 0 7px 0 #74141b, 0 12px 20px rgba(104, 20, 23, .25); }
.auth-submit:active { box-shadow: 0 2px 0 #74141b; }
.login-footnote {
  margin: 16px 0 0;
  color: #89744c;
  font-size: .9rem;
  font-style: italic;
}
.login-footnote span { padding: 0 5px; color: var(--red); }

@keyframes rise { from { opacity: 0; transform: translateY(30px) rotate(-3deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-5deg) translateX(-4px); }
  75% { transform: rotate(5deg) translateX(4px); }
}
@keyframes dropin { from { transform: translateY(-140%) rotate(-8deg); opacity: 0; } }
@keyframes swing { 0%, 100% { transform: rotate(3deg); } 50% { transform: rotate(-3deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media (max-width: 380px) {
  .login-ticket { padding: 32px 24px 23px; }
  .auth-modes { gap: 6px; }
  .auth-mode { gap: 6px; padding: 9px 7px; }
  .mode-copy strong { font-size: .9rem; }
  .mode-copy small { font-size: .75rem; }
}

@media (max-width: 600px) {
  .stage { padding: 68px 16px 20px; }
}