:root {
  --night: #0b1f3a;
  --night-2: #132e52;
  --red: #c8102e;
  --red-dark: #9b0c23;
  --green: #1d6b3a;
  --gold: #e8b43a;
  --snow: #fffaf2;
  --ink: #2b2b2b;
  --muted: #7d7166;
  --line: #eadfcd;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(ellipse at top, var(--night-2), var(--night) 70%) fixed;
  background-color: var(--night);
}
#snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.top, main, footer { position: relative; z-index: 1; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; color: #fff;
}
.brand { color: #fff; text-decoration: none; font-family: 'Mountains of Christmas', cursive; font-size: 30px; }
.top nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.top nav a, .top nav .link { color: #ffe7b0; font-weight: 700; text-decoration: none; }
.top form { margin: 0; }

main { max-width: 980px; margin: 0 auto; padding: 8px 16px 60px; }
footer { text-align: center; color: #9fb3cf; padding: 24px 16px 70px; font-size: 14px; }

.garland {
  position: fixed; left: 0; right: 0; top: 0; height: 10px; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--red) 0 18px, var(--gold) 18px 36px, var(--green) 36px 54px);
  box-shadow: 0 2px 12px rgba(232, 180, 58, .5);
}

.card {
  background: var(--snow); border-radius: var(--radius); padding: 24px; margin: 18px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); border-top: 6px solid var(--red);
}
.card:nth-of-type(even) { border-top-color: var(--green); }
.hero { text-align: center; max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
h1, h2 { font-family: 'Mountains of Christmas', cursive; color: var(--red); margin: 0 0 10px; line-height: 1.1; }
h1 { font-size: 44px; }
h2 { font-size: 30px; }
.lead { font-size: 18px; }
.muted { color: var(--muted); }
.big-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }

.flash { border-radius: 12px; padding: 12px 16px; margin: 16px 0; font-weight: 700; }
.flash.ok { background: #e3f4e8; color: #134d29; border: 2px solid #9fd5b0; }
.flash.err { background: #fde4e4; color: #7d0b1d; border: 2px solid #f2a7b0; }
.flash ul { margin: 6px 0 0; }

label { display: block; font-weight: 700; font-size: 14px; color: #4a4038; }
input, select, textarea {
  font: inherit; width: 100%; margin-top: 6px; padding: 11px 13px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 180, 58, .3); }
.code-input { text-align: center; font-size: 30px; letter-spacing: 10px; font-weight: 800; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; margin: 0; }
.stack { display: grid; gap: 14px; margin-top: 16px; text-align: left; }
.grid-form { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid-form .full { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; margin-top: 12px; }
.row.wrap select { width: auto; flex: 1 1 160px; margin: 0; }
.between { justify-content: space-between; flex-wrap: wrap; }
.inline-form { display: inline; margin: 0; }
.inline-form + .inline-form { margin-left: 4px; }

.btn {
  display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 800; text-decoration: none;
  background: var(--red); color: #fff; padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 4px 0 var(--red-dark); transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 #11461f; }
.btn.ghost { background: #fff; color: var(--red); border: 2px solid var(--red); box-shadow: none; }
.btn.danger { background: #7d0b1d; }
.btn.small { padding: 8px 16px; font-size: 14px; }
.btn.big { font-size: 20px; padding: 16px 30px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--green); font-weight: 700; cursor: pointer; text-decoration: underline; }
.danger, .link.danger { color: var(--red); }

.countdown { display: flex; justify-content: center; gap: 10px; margin: 18px 0; }
.countdown div { background: var(--night); color: #fff; border-radius: 12px; padding: 10px 6px; min-width: 70px; }
.countdown b { display: block; font-size: 28px; color: var(--gold); }
.countdown span { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }

.infos { list-style: none; padding: 0; margin: 14px 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.infos li { background: #f3ead9; border-radius: 999px; padding: 6px 14px; }
.infos span { color: var(--muted); margin-right: 4px; }
.notes { background: #f3ead9; border-radius: 12px; padding: 12px 16px; text-align: left; }

.reveal { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; color: var(--muted); font-weight: 800; }
.gift {
  font-size: 90px; background: none; border: 0; cursor: pointer; display: inline-flex; flex-direction: column;
  align-items: center; animation: wiggle 1.6s ease-in-out infinite; font-family: inherit;
}
.gift span { font-size: 14px; color: var(--muted); font-weight: 700; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.receiver { font-family: 'Mountains of Christmas', cursive; font-size: 56px; color: var(--red); margin: 6px 0 18px; animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.hidden { display: none; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.thread { list-style: none; padding: 0; margin: 14px 0; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.bubble { display: inline-block; text-align: left; padding: 10px 14px; border-radius: 16px; background: #f3ead9; white-space: normal; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .bubble { border-bottom-left-radius: 4px; }
.empty { color: var(--muted); font-style: italic; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.stats div { background: #f3ead9; border-radius: 12px; padding: 10px 14px; }
.stats b { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tabs a { background: var(--night); color: #fff; padding: 6px 14px; border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px; }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { width: auto; margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; margin-left: 8px; }
.assign select { margin: 0; padding: 6px 10px; width: auto; min-width: 180px; }
.mono { font-family: ui-monospace, monospace; font-size: 13px; }
.tag { font-size: 18px; }
.pairs { padding-left: 20px; }
.pairs li { margin: 4px 0; }
code { background: #f3ead9; padding: 1px 6px; border-radius: 6px; }

.danger-zone { margin-top: 16px; border: 2px dashed var(--red); border-radius: 12px; padding: 10px 16px; }
.danger-zone summary { cursor: pointer; font-weight: 800; color: var(--red); }

/* Mode discret : les attributions sont floutées tant qu'on ne les survole pas. */
body.discreet .secret { filter: blur(7px); transition: filter .15s; }
body.discreet .secret:hover, body.discreet .secret:focus-within { filter: none; }

@media (max-width: 720px) {
  h1 { font-size: 36px; }
  .grid2, .grid-form { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .countdown div { min-width: 58px; }
  .receiver { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .big-emoji, .gift, .receiver { animation: none; }
}
