/* =========================================================
   LUTINS — néo-brutalisme festif, façon papier cadeau
   ========================================================= */

@font-face { font-family: "Lexend Mega"; font-weight: 800; font-display: swap; src: url("fonts/lexend-mega-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend Mega"; font-weight: 900; font-display: swap; src: url("fonts/lexend-mega-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 800; font-display: swap; src: url("fonts/public-sans-latin-800-normal.woff2") format("woff2"); }

:root {
  --ink: #141414;
  --paper: #FFF6E6;
  --white: #FFFFFF;
  --red: #D62828;
  --red-dark: #B01E22;
  --red-lid: #E04545;
  --green: #1E6B4A;
  --green-dot: #2E8A60;
  --yellow: #FFD23F;
  --olive: #5A4A00;
  --pink: #FF9EC7;
  --pink-soft: #FFC4DD;
  --mint: #8FD9B0;
  --mint-soft: #D4F0E0;
  --sky: #A9DEF9;
  --sky-soft: #DCEFFB;
  --butter: #FFE9A8;
  --sand: #F3EEE4;
  --muted: #4A4A4A;
  --focus: #2B59C3;

  --display: "Lexend Mega", "Arial Black", system-ui, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --bw: 3px;
  --border: var(--bw) solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);

  color-scheme: light;
}

@view-transition { navigation: auto; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--green); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
img, svg { display: block; }
p { margin: 0; }
small { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
code { font-size: 13px; background: var(--sand); padding: 1px 4px; word-break: break-word; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--yellow); border: var(--border); padding: 8px 12px; font-weight: 800; }
.skip:focus { left: 8px; }

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 18px 40px;
}

/* ---------- Typo ---------- */

.h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(24px, 6.5vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.06em;
  overflow-wrap: anywhere;
}
.h1 small { margin-top: 6px; font-family: var(--body); font-size: 15px; letter-spacing: 0; color: var(--ink); }
.h1-light { color: var(--paper); }
.h2 { font-family: var(--display); font-weight: 900; font-size: 18px; letter-spacing: -0.05em; }
.label-display, legend.label-display {
  font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: -0.03em;
}
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }
.lead { font-size: 17px; font-weight: 600; }

.kicker {
  align-self: flex-start;
  display: inline-block;
  padding: 4px 10px;
  border: var(--border);
  font-family: var(--display); font-weight: 900; font-size: 11px; letter-spacing: -0.03em;
  transform: rotate(-3deg);
}
.kicker-yellow { background: var(--yellow); color: var(--ink); }

/* ---------- Layout utilitaires ---------- */

.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Barre du haut ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px;
  background: var(--white);
  border-bottom: var(--border);
}
.logo { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--display); font-weight: 900; font-size: 18px; letter-spacing: -0.06em; }
.logo:hover { color: var(--ink); }
.topbar-nav { display: flex; align-items: center; gap: 10px; }
.avatar, .pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 10px;
  border: var(--border); box-shadow: var(--shadow-sm);
  font-family: var(--display); font-weight: 900; font-size: 14px; text-decoration: none;
}
.avatar { background: var(--pink); }
.pill { background: var(--yellow); font-size: 11px; }
.avatar:hover, .pill:hover { color: var(--ink); transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }

/* ---------- Boutons ---------- */

.btn, .btn-back, .btn-dashed, .btn-mini, .btn-outline-light, .big-red, .radio-card, .linkish {
  font: inherit; color: inherit; cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 160ms ease;
}

.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 0 16px;
  border: var(--border); box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--display); font-weight: 900; font-size: 14px; letter-spacing: -0.03em;
  text-decoration: none; text-align: center;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); color: inherit; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn-sm { min-height: 46px; font-size: 12px; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover { color: var(--white); }
.btn-ink { background: var(--ink); color: var(--paper); box-shadow: none; }
.btn-ink:hover { color: var(--paper); box-shadow: 3px 3px 0 var(--red); }
.btn-white { background: var(--white); }
.btn-danger { background: transparent; color: var(--red-dark); border-color: var(--red-dark); box-shadow: none; font-family: var(--body); font-weight: 800; font-size: 15px; letter-spacing: 0; min-height: 48px; }
.btn-danger:hover { color: var(--white); background: var(--red-dark); box-shadow: none; transform: none; }

.btn-back {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  background: var(--white); border: var(--border); box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 14px; text-decoration: none;
}
.btn-back:hover { color: var(--ink); transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }

.btn-dashed {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 64px;
  background: transparent; border: var(--bw) dashed var(--ink);
  font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: -0.03em;
}
.btn-dashed:hover { background: var(--white); }
.plus-box { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: var(--red); color: var(--white); border: var(--border); }

.btn-mini {
  min-height: 38px; padding: 0 10px;
  background: var(--paper); border: var(--border);
  font-weight: 800; font-size: 12px; white-space: nowrap;
}
.btn-mini:hover { background: var(--yellow); }
.btn-mini-on { background: var(--mint); }
.btn-mini-danger { color: var(--red-dark); border-color: var(--red-dark); }

.linkish { background: none; border: none; padding: 0; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; color: inherit; }

/* ---------- Messages ---------- */

.flash, .alert {
  margin: 0 0 18px; padding: 12px 14px;
  border: var(--border); font-weight: 700; font-size: 15px;
}
.flash { background: var(--mint); }
.alert { background: #FFE3E3; border-color: var(--red-dark); color: #6E1F1C; }
.stack > .flash, .stack > .alert { margin: 0; }
.note { padding: 10px 12px; background: var(--butter); border: 2px dashed var(--ink); font-size: 14px; }

.hazard {
  padding: 8px;
  background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, var(--ink) 12px 24px);
  border: var(--border);
}
.hazard > div { background: var(--white); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.hazard ul { margin: 0; padding-left: 18px; font-size: 15px; }

body:has(.devbar) { padding-bottom: 40px; }
.devbar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 6px 12px; background: var(--ink); color: var(--yellow); font-size: 12px; font-weight: 700; text-align: center; z-index: 40; }

/* ---------- Cartes & sections ---------- */

.card { background: var(--white); border: var(--border); box-shadow: 6px 6px 0 var(--ink); }

.section {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  padding: 28px 16px 18px;
  background: var(--white); border: var(--border); box-shadow: var(--shadow);
  scroll-margin-top: 24px;
}
.tab {
  position: absolute; top: -18px; left: 12px; margin: 0;
  padding: 4px 10px; border: var(--border);
  font-family: var(--display); font-weight: 900; font-size: 12px; letter-spacing: -0.03em;
}
.tone-yellow { background: var(--yellow); }
.tone-pink { background: var(--pink); }
.tone-mint { background: var(--mint); }
.tone-sky { background: var(--sky); }

/* ---------- Champs ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 800; font-size: 14px; }
.field label span { font-weight: 600; color: var(--muted); }
input[type=text], input[type=email], input[type=date], input[type=number], select {
  width: 100%; min-width: 0; height: 48px; padding: 0 12px;
  border: var(--border); border-radius: 0;
  background: var(--paper); color: var(--ink);
  font: inherit; font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
input[type=date] { padding-right: 8px; }
input::placeholder { color: #8A8174; }
input[type=text]:focus, input[type=email]:focus, input[type=date]:focus { outline: none; background-color: var(--white); box-shadow: 4px 4px 0 var(--focus); }
input[type=checkbox] { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--green); }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; }

.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; cursor: pointer; }
.check > span { display: flex; flex-direction: column; }
.check-top { align-items: flex-start; padding-top: 12px; border-top: var(--bw) dashed var(--ink); }
.check-top input { margin-top: 2px; }

/* ---------- Connexion ---------- */

.page-login .wrap { padding-top: 0; }
.candy {
  height: 22px; margin: 0 -18px 0;
  border-bottom: var(--border);
  background: repeating-linear-gradient(-45deg, var(--red) 0 14px, var(--paper) 14px 28px);
}
.login { position: relative; display: flex; flex-direction: column; gap: 26px; padding-top: 24px; min-height: calc(100dvh - 22px - 40px); }
.sticker {
  position: absolute; top: 8px; right: 0;
  width: 84px; height: 84px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--pink); border: var(--border); box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--display); font-weight: 900; font-size: 9.5px; line-height: 1.25; letter-spacing: -0.04em;
  transform: rotate(12deg);
  animation: wobble 6s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { transform: rotate(12deg); } 50% { transform: rotate(4deg) scale(1.04); } }
.hero {
  margin: 12px 0 0;
  font-family: var(--display); font-weight: 900;
  font-size: clamp(30px, 9vw, 40px); line-height: 1.12; letter-spacing: -0.07em;
}
.hl {
  display: inline-block; margin-top: 8px; padding: 2px 10px 4px;
  background: var(--yellow); border: var(--border); box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-2deg);
}
.perks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: 15px; }
.perks li { display: flex; align-items: center; gap: 10px; }
.sq { width: 14px; height: 14px; flex-shrink: 0; border: var(--border); }
.sq-green { background: var(--green); } .sq-pink { background: var(--pink); } .sq-yellow { background: var(--yellow); }
.login-card { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.login-card input { height: 52px; font-size: 17px; }
.hint { font-size: 13px; color: var(--muted); }
.foot { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 600; }
.danger-link { color: var(--red-dark); }

/* ---------- Code (calendrier de l'Avent) ---------- */

.page-code { background: var(--green); }
.page-code .alert, .page-code .flash { margin-bottom: 0; }
.code-page { display: flex; flex-direction: column; gap: 26px; min-height: calc(100dvh - 64px); }
.advent { display: flex; flex-direction: column; gap: 14px; padding: 22px 18px 24px; background: var(--paper); }
.code-form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.code-form .btn { margin-top: 10px; }
.doors-nums { --cell: min(52px, calc((100vw - 96px) / 6)); display: grid; grid-template-columns: repeat(6, var(--cell)); padding-left: 3px; font-family: var(--display); font-weight: 900; font-size: 11px; }
.doors-nums span { padding-left: 6px; }
input.doors {
  --cell: min(52px, calc((100vw - 96px) / 6));
  width: calc(var(--cell) * 6 + 6px); max-width: 100%;
  height: 70px;
  padding: 0 0 0 calc((var(--cell) - 1ch) / 2);
  background-color: var(--white);
  background-image: linear-gradient(to right, transparent calc(var(--cell) - 3px), var(--ink) calc(var(--cell) - 3px));
  background-size: var(--cell) 100%;
  background-repeat: repeat-x;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 32px; font-weight: 800;
  letter-spacing: calc(var(--cell) - 1ch);
  overflow: hidden;
  caret-color: var(--red);
}
input.doors:focus { background-color: var(--white); box-shadow: 4px 4px 0 var(--yellow); }
.code-help { margin-top: auto; display: flex; flex-direction: column; gap: 10px; color: var(--paper); font-size: 14px; }
.code-help a, .code-help .linkish { color: var(--yellow); }
.dashed-top { padding-top: 10px; border-top: 2px dashed var(--mint); }

/* ---------- Hotte : étiquettes cadeau ---------- */

.tags { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 18px; }
.tag-item.rot-0 { transform: rotate(-1.2deg); }
.tag-item.rot-1 { transform: rotate(1deg); }
.tag-item.rot-2 { transform: rotate(-0.5deg); }
.tag {
  position: relative; display: flex; align-items: stretch;
  border: var(--border); box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.tag:hover { color: var(--ink); transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.tag-yellow { background: var(--yellow); }
.tag-white { background: var(--white); }
.tag-hole { width: 46px; flex-shrink: 0; border-right: var(--bw) dashed var(--ink); display: flex; align-items: center; justify-content: center; }
.tag-hole > span { width: 14px; height: 14px; border-radius: 50%; border: var(--border); background: var(--paper); }
.tag-body { flex: 1; min-width: 0; padding: 14px 14px 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.tag-title { font-weight: 800; font-size: 17px; line-height: 1.25; padding-right: 92px; overflow-wrap: anywhere; }
.tag-meta { font-size: 14px; font-weight: 600; }
.tag-note { font-size: 13px; }
.stamp {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 8px; border: 3px solid currentColor;
  font-family: var(--display); font-weight: 900; font-size: 10.5px; letter-spacing: -0.03em;
  transform: rotate(8deg);
  background: rgba(255, 255, 255, .55);
}
.stamp-red { color: var(--red-dark); }
.stamp-olive { color: var(--olive); }
.empty { padding: 20px; border: var(--bw) dashed var(--ink); display: flex; flex-direction: column; gap: 8px; }
.archive-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.archive-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 2px dashed var(--ink); }

/* ---------- Éditeur ---------- */

.radio-cards { margin: 0; padding: 0; border: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.radio-card {
  min-height: 92px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--paper); border: var(--border);
  font-family: var(--display); font-weight: 900; font-size: 12px; letter-spacing: -0.03em;
}
.radio-card:hover { background: var(--white); }
input:checked + .radio-card { background: var(--green); color: var(--white); box-shadow: 4px 4px 0 var(--ink); }
input:focus-visible + .radio-card { outline: 3px solid var(--focus); outline-offset: 3px; }
input:disabled + .radio-card { opacity: .45; cursor: not-allowed; }
.section:has(#m-mail:checked) .only-links, .section:has(#m-links:checked) .only-mail { display: none; }
form:has(#m-links:checked) #lutins .only-mail, form:has(#m-mail:checked) #lutins .only-links { display: none; }
.dark-toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--ink); color: var(--paper); cursor: pointer; }
.dark-toggle input { accent-color: var(--yellow); margin-top: 1px; }
.dark-toggle > span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.dark-toggle .label-display { font-size: 12px; }

.add-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--paper); border: 2px dashed var(--ink); }
.pack { border: var(--border); background: var(--sand); }
.pack-1 { background: var(--mint-soft); }
.pack-2 { background: var(--butter); }
.pack-3 { background: var(--sky-soft); }
.pack-4 { background: var(--pink-soft); }
.pack-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: var(--border); font-family: var(--display); font-weight: 900; font-size: 11px; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.chips { margin: 0; padding: 10px; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; background: var(--white); border: var(--border); font-weight: 800; font-size: 14px; animation: pop-in 220ms ease-out; max-width: 100%; }
.chip > span { display: flex; flex-direction: column; padding: 4px 0; min-width: 0; }
.chip small { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.chip button { width: 36px; height: 36px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: transparent; border: none; cursor: pointer; color: var(--ink); }
.chip button:hover { color: var(--red-dark); }
.chip-warn { border-color: var(--red-dark); }
.chip-warn small { color: var(--red-dark); }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.import summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.import[open] summary { margin-bottom: 8px; }

.draw-zone { display: flex; flex-direction: column; align-items: center; gap: 22px; margin-top: 4px; }
.big-red {
  width: 168px; height: 168px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--red); color: var(--white);
  border: 4px solid var(--ink); box-shadow: 0 10px 0 var(--ink);
  font-family: var(--display); font-weight: 900; font-size: 18px; letter-spacing: -0.05em;
}
.big-red:hover { transform: translateY(-2px); box-shadow: 0 12px 0 var(--ink); }
.big-red:active { transform: translateY(8px); box-shadow: 0 2px 0 var(--ink); }
.draw-zone .btn { max-width: 320px; }

/* ---------- Après tirage ---------- */

.page-drawn { background: var(--yellow); }
.drawn-head { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 2px; }
.stamp-big {
  align-self: flex-start;
  margin-bottom: 14px; padding: 8px 14px;
  border: 5px solid var(--red-dark); color: var(--red-dark);
  font-family: var(--display); font-weight: 900; font-size: 22px; line-height: 1.1; letter-spacing: -0.07em;
  transform: rotate(-6deg);
  background: rgba(255, 255, 255, .35);
}
.just-drawn .stamp-big { animation: stamp 520ms cubic-bezier(.2, 1.6, .4, 1) 1.5s both; }
@keyframes stamp { from { transform: rotate(-20deg) scale(2.6); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }

.ledger { margin: 0; padding: 0; list-style: none; background: var(--white); border: var(--border); box-shadow: var(--shadow); }
.ledger li { padding: 10px 12px; border-bottom: 2px dashed var(--ink); display: flex; flex-direction: column; gap: 8px; }
.ledger li:last-child { border-bottom: none; }
.ledger-main { display: flex; align-items: center; gap: 10px; }
.ledger-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ledger-text strong { font-size: 15px; overflow-wrap: anywhere; }
.ledger-text small { overflow-wrap: anywhere; }
.arrow { color: var(--red-dark); }
.txt-red { color: var(--red-dark) !important; }
.box { width: 24px; height: 24px; flex-shrink: 0; border: var(--border); display: flex; align-items: center; justify-content: center; }
.box-green { background: var(--green); } .box-red { background: var(--red-dark); } .box-yellow { background: var(--yellow); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { height: 40px; font-size: 13px; background: var(--paper); }
.copy-row .btn-mini { min-height: 40px; }
.copy-row .btn-mini.copied { background: var(--mint); }
.ink-bar { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--ink); color: var(--paper); font-size: 13px; }
.ink-bar strong { color: var(--yellow); }
.ink-bar > span { flex: 1; }
.btn-outline-light { min-height: 44px; padding: 0 12px; background: transparent; color: var(--paper); border: 3px solid var(--paper); font-weight: 800; font-size: 13px; }
.btn-outline-light:hover { background: var(--red-dark); }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti i { position: absolute; top: -30px; width: 14px; height: 14px; border: var(--border); opacity: 0; }
.confetti i:nth-child(1) { left: 12%; background: var(--red); }
.confetti i:nth-child(2) { left: 30%; background: var(--mint); border-radius: 50%; }
.confetti i:nth-child(3) { left: 48%; background: var(--pink); width: 22px; height: 9px; }
.confetti i:nth-child(4) { left: 66%; background: var(--sky); }
.confetti i:nth-child(5) { left: 80%; background: var(--green); border-radius: 50%; }
.confetti i:nth-child(6) { left: 92%; background: var(--red); width: 9px; height: 20px; }
.just-drawn .confetti i { animation: fall 2.6s ease-in 1.6s both; }
.just-drawn .confetti i:nth-child(2n) { animation-duration: 3.1s; animation-delay: 1.75s; }
.just-drawn .confetti i:nth-child(3n) { animation-duration: 2.3s; animation-delay: 1.9s; }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 100% { opacity: 1; transform: translateY(110vh) rotate(540deg); } }
.page-drawn .stack { position: relative; z-index: 1; }

.slot {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--green); color: var(--paper);
  font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: -0.03em;
  animation: slot-out 300ms ease-in 1.4s both;
}
.slot-window { width: min(80vw, 300px); height: 96px; display: flex; align-items: center; justify-content: center; background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); overflow: hidden; }
.slot-name { font-size: 30px; letter-spacing: -0.07em; animation: slot-spin 120ms linear infinite; }
@keyframes slot-spin { from { transform: translateY(-30%); } to { transform: translateY(30%); } }
@keyframes slot-out { to { opacity: 0; visibility: hidden; } }

/* ---------- Page participant ---------- */

.page-reveal {
  background-color: var(--green);
  background-image: radial-gradient(var(--green-dot) 2px, transparent 2.5px);
  background-size: 26px 26px;
  color: var(--paper);
}
.page-reveal a { color: var(--yellow); }
.reveal { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; min-height: calc(100dvh - 64px); }
.reveal .kicker { align-self: center; transform: rotate(-2deg); }
.reveal .h1 { margin-top: 20px; font-size: clamp(28px, 8vw, 34px); }
.reveal-sub { margin-top: 8px; font-size: 16px; font-weight: 600; }

.gift { position: relative; display: block; margin-top: 60px; width: 230px; height: 230px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gift-box { position: absolute; left: 22px; right: 22px; bottom: 6px; height: 140px; background: var(--red); border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.gift-ribbon { position: absolute; left: 97px; width: 36px; bottom: 10px; height: 136px; background: var(--yellow); border-left: 4px solid var(--ink); border-right: 4px solid var(--ink); }
.gift-lid {
  position: absolute; left: 8px; right: 8px; top: 56px; height: 40px;
  background: var(--red-lid); border: 4px solid var(--ink);
  transition: transform 650ms cubic-bezier(.3, 1.3, .5, 1), opacity 300ms ease 350ms;
  transform-origin: 80% 100%;
}
.gift-lid-ribbon { position: absolute; left: 85px; width: 36px; top: -4px; bottom: -4px; background: var(--yellow); border-left: 4px solid var(--ink); border-right: 4px solid var(--ink); }
.bow { position: absolute; top: -40px; width: 52px; height: 42px; background: var(--yellow); border: 4px solid var(--ink); }
.bow-l { left: 50px; border-radius: 50% 50% 8px 50%; }
.bow-r { left: 104px; border-radius: 50% 50% 50% 8px; }
.gift:hover .gift-lid { transform: rotate(-3deg) translateY(-4px); }
.reveal:has(#open-gift:focus-visible) .gift { outline: 3px solid var(--yellow); outline-offset: 6px; }
.reveal:has(#open-gift:checked) .gift-lid { transform: translate(190px, -170px) rotate(48deg); opacity: 0; }

.hint-pill { margin-top: 30px; padding: 10px 16px; background: var(--ink); color: var(--yellow); font-family: var(--display); font-weight: 900; font-size: 12px; letter-spacing: -0.03em; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

.ticket {
  position: absolute; top: 230px; left: 50%;
  width: min(290px, 88vw);
  display: flex; text-align: left;
  background: var(--paper); color: var(--ink);
  border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink);
  transform: translateX(-50%) rotate(-4deg) translateY(40px) scale(.6);
  opacity: 0; visibility: hidden;
  transition: transform 520ms cubic-bezier(.2, 1.5, .4, 1) 180ms, opacity 200ms ease 180ms, visibility 0s 180ms;
}
.ticket .tag-hole > span { background: var(--green); }
.ticket-body { flex: 1; min-width: 0; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.ticket-kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.ticket-name { font-family: var(--display); font-weight: 900; font-size: clamp(24px, 8vw, 32px); line-height: 1.1; letter-spacing: -0.07em; color: var(--red-dark); overflow-wrap: anywhere; }
.ticket-meta { font-size: 13px; font-weight: 600; }
.shh { margin-top: 40px; font-family: var(--display); font-weight: 900; font-size: 13px; letter-spacing: -0.03em; color: var(--yellow); }
.reveal-foot { margin-top: auto; padding-top: 30px; font-size: 13px; }

.when-open { display: none; }
.reveal:has(#open-gift:checked) .when-closed { display: none; }
.reveal:has(#open-gift:checked) span.when-open, .reveal:has(#open-gift:checked) p.when-open { display: inline; }
.reveal:has(#open-gift:checked) p.when-open { display: block; }
.reveal .ticket.when-open { display: flex; }
.reveal:has(#open-gift:checked) .ticket { opacity: 1; visibility: visible; transform: translateX(-50%) rotate(-4deg); transition-delay: 180ms, 180ms, 0s; }

/* ---------- Pages diverses ---------- */

.message { display: flex; flex-direction: column; gap: 16px; padding-top: 30px; }
.page-reveal .message .h1 { color: var(--paper); }
.page-reveal .message .logo { color: var(--paper); }
.prose ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.kv dt { font-weight: 800; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.users { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.user { padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.user strong { overflow-wrap: anywhere; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 1px 6px; background: var(--yellow); border: 2px solid var(--ink); font-family: var(--display); font-weight: 900; font-size: 10px; }

/* ---------- Écrans larges ---------- */

@media (min-width: 720px) {
  .wrap { padding-top: 36px; }
  .page-app .wrap, .page-drawn .wrap { max-width: 640px; }
  .sticker { right: -40px; }
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .slot { display: none; }
  @view-transition { navigation: none; }
}
