/* ───── Secret Santa ───── */
:root {
  --sapin: #0f2b22;
  --sapin-2: #17392e;
  --sapin-3: #24503f;
  --papier: #f5ecd9;
  --papier-2: #eadcc0;
  --encre: #231d17;
  --encre-2: #6b5d4c;
  --baie: #d42a3c;
  --baie-2: #b01e2f;
  --or: #e6b450;
  --givre: #e4ede8;
  --givre-2: #a9c2b6;
  --display: "Fraunces", Georgia, serif;
  --body: "Bricolage Grotesque", system-ui, sans-serif;
  --r: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, #1f4a3b 0%, transparent 60%),
    var(--sapin);
  color: var(--givre);
  font: 400 17px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.wrap {
  position: relative; z-index: 1;
  max-width: 460px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
}
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; border-radius: 6px; }

/* typo */
.title {
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 800;
  font-size: clamp(3rem, 15vw, 4.4rem);
  line-height: .92;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--papier);
}
.h1, .h2, .h3, .target-name, .reveal-name {
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "WONK" 0;
  margin: 0 0 .4em;
  line-height: 1.1;
}
.h1 { font-size: 2rem; font-weight: 750; color: var(--papier); }
.h2 { font-size: 1.6rem; font-weight: 700; }
.h3 { font-size: 1.3rem; font-weight: 650; color: var(--papier); }
.lede { font-size: 1.1rem; color: var(--givre-2); margin: 1rem 0 0; max-width: 30ch; }
.kicker { font-family: var(--display); font-style: italic; color: var(--or); font-size: 1.1rem; margin: 0 0 .4rem; }
.muted { color: var(--givre-2); }
.card .muted { color: var(--encre-2); }
.small { font-size: .88rem; }
.center { text-align: center; }
p { margin: 0 0 .8em; }

/* header */
.brand { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.4rem; }
.brand-name { font-family: var(--display); font-weight: 750; font-size: 1.15rem; text-decoration: none; color: var(--papier); white-space: nowrap; }
.brand-edition { color: var(--givre-2); font-size: .9rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* accueil */
.hero { padding: 8vh 0 2rem; }
.emoji { font-size: 2rem; margin: 0 0 .5rem; }
.hat { width: 1.35em; height: auto; vertical-align: -0.18em; margin-right: .15em; }
.hat-hero { width: 84px; height: auto; display: block; margin: 0 0 .6rem -4px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.35)); }

.countdown {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 18px 14px 12px; margin: 0 0 1.2rem;
  border-radius: var(--r);
  background: var(--sapin-2);
  border: 1px solid var(--sapin-3);
}
.cd { text-align: center; }
.cd-n { display: block; font-family: var(--display); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--papier); font-variant-numeric: tabular-nums; }
.cd-l { font-size: .8rem; color: var(--givre-2); }
.cd-caption { grid-column: 1 / -1; text-align: center; margin: 8px 0 0; font-family: var(--display); font-style: italic; color: var(--or); }

.info { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; gap: 1px; border-radius: var(--r); overflow: hidden; background: var(--sapin-3); }
.info li { display: flex; justify-content: space-between; gap: 1rem; padding: 12px 16px; background: var(--sapin-2); }
.info-k { color: var(--givre-2); }
.info-v { font-weight: 600; text-align: right; color: var(--papier); }
.note { color: var(--givre-2); border-left: 3px solid var(--or); padding-left: 12px; margin-bottom: 1.4rem; }

.actions { display: grid; gap: 12px; margin-top: 1rem; }

/* boutons */
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 22px;
  border: 0; border-radius: 999px;
  font-weight: 650; font-size: 1.02rem; text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--baie); color: #fff; box-shadow: 0 6px 0 var(--baie-2); margin-bottom: 6px; }
.btn-primary:active { box-shadow: 0 2px 0 var(--baie-2); transform: translateY(4px); }
.btn-lg { min-height: 60px; font-size: 1.12rem; }
.btn-ghost { background: transparent; color: var(--papier); border: 1.5px solid var(--sapin-3); }
.link { background: none; border: 0; padding: 0; color: var(--givre-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--encre-2); cursor: pointer; font-size: 1rem; }

/* cartes papier (étiquettes cadeau) */
.card {
  position: relative;
  background: var(--papier); color: var(--encre);
  border-radius: 18px; padding: 30px 22px 24px; margin-bottom: 1.2rem;
}
.card.tag::before {
  content: ""; position: absolute; top: 12px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--sapin); box-shadow: inset 0 0 0 2px var(--papier-2);
}
.card.tag { padding-top: 40px; }

/* formulaires */
.form { display: grid; gap: 16px; margin-top: 1rem; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .95rem; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--encre);
  background: #fffaf0; border: 1.5px solid var(--papier-2); border-radius: 12px;
  padding: 13px 14px;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--baie); box-shadow: 0 0 0 3px rgba(212,42,60,.15); }
.field input.pin { font-size: 1.6rem; letter-spacing: .6em; text-align: center; padding: 10px; font-variant-numeric: tabular-nums; }
.field.file input { padding: 10px; font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 10px 16px; border-radius: 999px;
  background: #fffaf0; border: 1.5px solid var(--papier-2); font-weight: 600; cursor: pointer;
}
.chip input:checked + span { background: var(--sapin); color: var(--papier); border-color: var(--sapin); }
.chip input:focus-visible + span { outline: 3px solid var(--or); outline-offset: 2px; }

/* messages */
.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #d9efe2; color: #12422f; }
.flash-err { background: #fbdcdc; color: #7d1420; }
.flash-info { background: #fbefcf; color: #5b4310; }

/* espace perso */
.hello { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.hello p { margin: 0; font-size: 1.1rem; }
.waiting { text-align: center; }
.block { margin: 2rem 0; }

.target { text-align: center; padding: 34px 22px; }
.target-name { font-size: clamp(2.6rem, 13vw, 3.6rem); font-weight: 800; color: var(--baie); margin: .1em 0; font-variation-settings: "SOFT" 100, "WONK" 1; }

.wishes { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 10px; }
.wish { display: flex; gap: 12px; align-items: flex-start; background: var(--papier); color: var(--encre); border-radius: 14px; padding: 12px; }
.wish-img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; display: block; }
.wish-body { flex: 1; min-width: 0; padding-top: 2px; }
.wish-body p { margin: 0 0 4px; overflow-wrap: anywhere; }
.wish-link { color: var(--baie-2); font-weight: 600; overflow-wrap: anywhere; }
.empty { color: var(--givre-2); font-style: italic; }
.add-wish summary { list-style: none; }
.add-wish summary::-webkit-details-marker { display: none; }
.add-wish[open] summary { display: none; }
.add-wish .form { background: var(--papier); color: var(--encre); padding: 20px; border-radius: 18px; margin-top: 0; }

/* roue */
.spin-zone { text-align: center; }
.wheel-box { position: relative; width: min(88vw, 360px); aspect-ratio: 1; margin: 1.6rem auto 1rem; }
#wheel { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 0 0 8px var(--or), 0 0 0 12px var(--sapin-2), 0 18px 50px rgba(0,0,0,.45); }
.pointer {
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 18px solid transparent; border-right: 18px solid transparent; border-top: 34px solid var(--papier);
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.4));
}
.hub {
  position: absolute; top: 50%; left: 50%; width: 31%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 5px solid var(--or); background: var(--baie); color: #fff;
  font-family: var(--display); font-weight: 750; font-size: clamp(1rem, 4.6vw, 1.25rem); cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .15s;
}
.hub:active { transform: translate(-50%, -50%) scale(.95); }
.hub:disabled { cursor: default; opacity: 1; }

.reveal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(8, 24, 18, .78); backdrop-filter: blur(4px); }
.reveal[hidden] { display: none; }
.reveal-card { background: var(--papier); color: var(--encre); border-radius: 22px; padding: 34px 24px 26px; text-align: center; width: 100%; max-width: 380px; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1); }
.reveal-card .muted { color: var(--encre-2); }
.reveal-name { font-size: clamp(2.6rem, 13vw, 3.4rem); font-weight: 800; color: var(--baie); margin: .1em 0 .3em; font-variation-settings: "SOFT" 100, "WONK" 1; overflow-wrap: anywhere; }
.reveal-card .btn { margin-top: 1rem; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .reveal-card { animation: none; }
  .btn, .hub { transition: none; }
}

/* ───── admin ───── */
.admin .wrap { max-width: 640px; }
.admin h1 { font-family: var(--display); color: var(--papier); font-size: 1.8rem; margin: 0 0 1rem; }
.admin .card h2 { font-family: var(--display); font-size: 1.25rem; margin: 0 0 .8rem; }
.admin .card { padding: 22px 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.btn-sm { min-height: 42px; padding: 0 16px; font-size: .95rem; }
.btn-dark { background: var(--sapin); color: var(--papier); }
.btn-danger { background: transparent; color: var(--baie-2); border: 1.5px solid #e9b9be; }
.btn-gold { background: var(--or); color: var(--encre); }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 1rem; }
.tabs a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--sapin-3); text-decoration: none; font-size: .92rem; }
.tabs a.on { background: var(--papier); color: var(--encre); border-color: var(--papier); }
.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; font: inherit; font-size: .9rem; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--papier-2); background: #fffaf0; color: var(--encre); }
.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.status-open { background: #d9efe2; color: #12422f; }
.status-drawn { background: #fbefcf; color: #5b4310; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist > li { border-top: 1px solid var(--papier-2); padding: 12px 0; }
.plist > li:first-child { border-top: 0; }
.p-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-name { font-weight: 650; }
.p-meta { font-size: .85rem; color: var(--encre-2); }
.p-pin { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .1em; background: var(--papier-2); padding: 2px 8px; border-radius: 6px; }
.p-edit { margin-top: 10px; display: grid; gap: 8px; }
.p-edit .row input { font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 10px; border: 1.5px solid var(--papier-2); background: #fffaf0; min-width: 0; }
.pairs { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: 6px; }
.pairs li { background: #fffaf0; border-radius: 10px; padding: 10px 12px; }
.pairs b { color: var(--baie-2); }
details.spoiler summary { list-style: none; }
details.spoiler summary::-webkit-details-marker { display: none; }
details.spoiler[open] summary .lbl-open { display: none; }
details.spoiler:not([open]) summary .lbl-close { display: none; }
.admin .card details > summary.btn { width: 100%; }
.hint { font-size: .88rem; color: var(--encre-2); margin: .4rem 0 0; }
