/* Secret Santa pixel — Atelier 6dB */
@font-face { font-family: "PS2P"; src: url("fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "VT323"; src: url("fonts/VT323-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --nuit: #1B1E3C; --nuit2: #262A52; --nuit3: #4A4F7A;
  --or: #F2C14E; --or-sombre: #A9822C;
  --rouge: #D8344A; --rouge-sombre: #8E1F30;
  --vert: #1F7A4D; --vert-sombre: #0F4A2D; --vert-clair: #2E9E5B;
  --neige: #F4F1E8; --brume: #D6D9EE; --gris: #8F95BF;
  --px: "PS2P", monospace; --txt: "VT323", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0E1028; }
body { font-family: var(--txt); color: var(--neige); font-size: 22px; line-height: 1.15;
  -webkit-font-smoothing: none; image-rendering: pixelated; overflow: hidden; }
svg { shape-rendering: crispEdges; display: block; }
button, input, a { font: inherit; }
a { color: var(--or); } a:hover { color: #FFE08A; }
:focus-visible { outline: 3px dashed var(--or); outline-offset: 3px; }

#app { position: relative; max-width: 480px; height: 100dvh; margin: 0 auto; overflow: hidden;
  background: var(--nuit); box-shadow: 0 0 0 4px #000; }
#app.shake { animation: shake .45s steps(6) 2; }
@keyframes shake { 0%{transform:translate(0,0)} 20%{transform:translate(-6px,3px)} 40%{transform:translate(5px,-4px)}
  60%{transform:translate(-4px,-2px)} 80%{transform:translate(4px,4px)} 100%{transform:translate(0,0)} }

/* ---------- décor ---------- */
#sky, #fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#sky { z-index: 0; }
#fx { z-index: 30; }
.flake { position: absolute; top: -10px; background: var(--neige); opacity: .5; animation: fall linear infinite; }
@keyframes fall { to { transform: translate(var(--drift, 20px), 105dvh); } }
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; background: var(--neige); opacity: .9;
  box-shadow: 0 -6px 0 rgba(244,241,232,.45); z-index: 1; }

.convoy { position: absolute; top: 64px; left: 0; display: flex; align-items: flex-end; gap: 6px;
  animation: cross 9s linear forwards; z-index: 2; }
.convoy.rtl { animation-name: crossBack; }
@keyframes cross { from { transform: translateX(-420px); } to { transform: translateX(560px); } }
@keyframes crossBack { from { transform: translateX(560px) scaleX(-1); } to { transform: translateX(-420px) scaleX(-1); } }
.convoy .deer { animation: gallop .3s steps(2) infinite; }
.convoy .deer:nth-child(2) { animation-delay: .15s; }
@keyframes gallop { 50% { transform: translateY(-5px); } }
.rein { height: 3px; width: 22px; background: var(--or); margin-bottom: 30px; }

#snowman { position: absolute; left: 4px; bottom: 8px; z-index: 25; width: 60px; cursor: pointer;
  background: none; border: 0; padding: 0; }
#snowman .arm { position: absolute; left: 44px; top: 48px; width: 22px; height: 4px; background: #5E3A1A;
  transform-origin: 0 50%; transform: rotate(20deg); transition: transform .15s steps(2); }
#snowman.throw .arm { transform: rotate(-70deg); }
.snowball { position: absolute; width: 18px; height: 18px; z-index: 31; }
.splat { position: absolute; inset: 0; z-index: 32; display: flex; align-items: center; justify-content: center;
  animation: splatFade 1.8s steps(8) forwards; }
@keyframes splatFade { 0%,55% { opacity: .95; } 100% { opacity: 0; } }

/* ---------- écrans ---------- */
.screen { position: absolute; inset: 0; z-index: 10; display: none; flex-direction: column; gap: 18px;
  padding: 24px 22px 110px; overflow-y: auto; }
.screen.active { display: flex; animation: appear .25s steps(3); }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 30px; }
.logo { font-family: var(--px); font-size: 11px; color: var(--or); }
.chip { font-family: var(--px); font-size: 9px; color: var(--nuit); background: var(--or); padding: 6px 8px; }
h1, h2 { margin: 0; font-family: var(--px); font-weight: normal; line-height: 1.5; color: #fff; }
h1 { font-size: 17px; } h2 { font-size: 13px; color: var(--or); }
p { margin: 0; color: var(--brume); }
.big { font-size: 26px; color: #fff; }
.center { text-align: center; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row > * { flex: 1; }
.push { margin-top: auto; }
.sprite { display: flex; justify-content: center; }

.btn { display: block; width: 100%; min-height: 52px; padding: 17px 14px; border: 0; cursor: pointer;
  font-family: var(--px); font-size: 12px; line-height: 1.4; text-align: center; text-decoration: none;
  color: #fff; background: var(--rouge); box-shadow: 0 5px 0 var(--rouge-sombre); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rouge-sombre); }
.btn.green { background: var(--vert); box-shadow: 0 5px 0 var(--vert-sombre); }
.btn.grey { background: var(--nuit3); box-shadow: 0 5px 0 #2B2F55; }
.btn.ghost { background: transparent; color: var(--or); border: 3px solid var(--or); box-shadow: none; font-size: 11px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.link { background: none; border: 0; color: var(--or); text-decoration: underline; cursor: pointer;
  font-size: 21px; padding: 10px 0; min-height: 44px; text-align: left; }
.icon-btn { min-width: 44px; min-height: 44px; background: transparent; border: 2px solid var(--or); color: var(--or);
  font-family: var(--px); font-size: 9px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; cursor: pointer; }

label.lbl { font-family: var(--px); font-size: 9px; color: var(--or); display: block; margin-bottom: 6px; }
input.field { width: 100%; min-height: 48px; padding: 8px 12px; border: 3px solid var(--neige); background: var(--neige);
  color: var(--nuit); font-family: var(--txt); font-size: 24px; border-radius: 0; }
input.field::placeholder { color: #6E739C; }
.name-row { display: flex; gap: 8px; }
.name-row input { flex: 1; }
.x { width: 48px; min-height: 48px; background: var(--nuit2); border: 2px solid var(--gris); color: var(--neige);
  font-family: var(--px); font-size: 12px; cursor: pointer; }
.add { min-height: 46px; background: transparent; border: 2px dashed var(--or); color: var(--or);
  font-family: var(--px); font-size: 10px; cursor: pointer; }

.card { background: var(--nuit2); border: 3px solid var(--or); padding: 14px 16px; }
.card.muted { border-color: var(--nuit3); }
.card.green { border-color: var(--vert-clair); }
.salon-code { font-family: var(--px); font-size: 34px; color: var(--or); letter-spacing: 4px; text-align: center; padding: 6px 0; }
.url { color: #fff; font-size: 23px; word-break: break-all; }
.qr { background: #fff; padding: 10px; align-self: center; }
.qr svg { width: 168px; height: 168px; }

.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.names button { min-height: 64px; background: var(--neige); border: 3px solid var(--neige); color: var(--nuit);
  font-size: 27px; cursor: pointer; box-shadow: 0 5px 0 var(--gris); padding: 4px; word-break: break-word; }
.names button:disabled { background: var(--nuit2); border-color: var(--nuit3); color: var(--gris); box-shadow: none;
  font-size: 22px; cursor: not-allowed; }

ol.rules { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 13px; }
ol.rules li { display: flex; gap: 12px; align-items: flex-start; color: var(--neige); }
ol.rules li span.n { flex: none; width: 28px; height: 28px; background: var(--rouge); color: #fff; font-family: var(--px);
  font-size: 10px; display: flex; align-items: center; justify-content: center; }
.gold { color: var(--or); }

.progress { display: flex; gap: 5px; }
.progress div { flex: 1; height: 18px; border: 2px solid var(--vert-clair); background: var(--nuit2); }
.progress div.on { background: var(--vert-clair); }

.ticket { background: var(--or); color: var(--nuit); padding: 14px 16px; box-shadow: 0 5px 0 var(--or-sombre);
  display: flex; flex-direction: column; gap: 6px; }
.ticket .t { font-family: var(--px); font-size: 10px; }
.ticket .r { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket .r span:first-child { font-family: var(--px); font-size: 8px; color: #5A4A2A; }
.ticket .r span:last-child { font-size: 24px; text-align: right; }

.target-name { font-family: var(--px); font-size: 28px; color: var(--or); text-shadow: 4px 4px 0 var(--rouge);
  text-align: center; word-break: break-word; line-height: 1.4; }

.admin-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 2px dashed var(--nuit3); }
.admin-row .st { font-size: 18px; color: var(--gris); }
.admin-row button { flex: none; }

/* intro */
#s-start { justify-content: center; align-items: center; text-align: center; }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.title-big { font-family: var(--px); font-size: 26px; line-height: 1.5; color: var(--or); text-shadow: 4px 4px 0 var(--rouge); }
.stage { position: relative; height: 330px; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; }
.diva { position: absolute; bottom: 70px; transform: translateY(260px); transition: transform 1.6s steps(16); }
.diva.up { transform: translateY(0); }
.diva.dance { animation: dance .5s steps(2) infinite; }
@keyframes dance { 50% { transform: translateY(-6px) rotate(-3deg); } }
.chimney { position: relative; z-index: 2; width: 190px; height: 90px; background-color: #9E3B2E;
  background-image: linear-gradient(#D9B8A0 3px, transparent 3px), linear-gradient(90deg, #D9B8A0 3px, transparent 3px);
  background-size: 100% 22px, 44px 22px; border-top: 14px solid #7A2A20; }
.bubble { min-height: 62px; background: #fff; color: var(--nuit); font-family: var(--px); font-size: 11px; line-height: 1.6;
  padding: 12px 14px; text-align: center; box-shadow: 4px 4px 0 var(--rouge); visibility: hidden; }
.bubble.on { visibility: visible; }

/* animations ponctuelles */
.wobble { animation: wobble .25s steps(2) 6; }
@keyframes wobble { 50% { transform: rotate(-8deg); } }
.pop { animation: pop .6s steps(4); }
@keyframes pop { 0% { transform: scale(.2); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.confetti { position: absolute; width: 8px; height: 8px; z-index: 33; animation: conf 1.6s steps(12) forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* modale et messages */
.overlay { position: absolute; inset: 0; z-index: 40; background: rgba(10,12,30,.8); display: none;
  align-items: center; justify-content: center; padding: 22px; }
.overlay.on { display: flex; }
.modal { background: var(--neige); color: var(--nuit); border: 4px solid var(--or); box-shadow: 8px 8px 0 var(--rouge);
  padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 400px; }
.modal p { color: var(--nuit); font-size: 23px; }
.modal h2 { color: #B0263A; text-align: center; font-size: 15px; }
#toast { position: absolute; left: 16px; right: 16px; bottom: 22px; z-index: 50; background: var(--rouge); color: #fff;
  padding: 12px 14px; font-size: 21px; box-shadow: 0 4px 0 var(--rouge-sombre); display: none; }
#toast.on { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

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