/* =========================================================================
   DA — Calendrier de l'Avent pixel vintage
   Rouge / vert / brun, papier crème, typos pixel.
   ========================================================================= */
:root {
  --ink: #1c110b;
  --cream: #f3e3c3; --cream2: #d9c29a; --white: #fff7ea;
  --red0: #3f0d12; --red1: #6e1a1f; --red2: #a3282b; --red3: #d4493a;
  --grn0: #0e2219; --grn1: #183a28; --grn2: #2a5a3a; --grn3: #477d4b; --grn4: #7ba65c;
  --wood0: #24140c; --wood1: #3f2415; --wood2: #62391f; --wood3: #8c5830; --wood4: #b67d48;
  --gold: #e0a63e; --gold2: #ffd879;
  --f-title: 'Press Start 2P', ui-monospace, 'Courier New', monospace;
  --f-body: 'VT323', ui-monospace, 'Courier New', monospace;
  --px: 4px; /* taille d'un "pixel" d'interface */
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { overflow-x: hidden; }
body {
  background: var(--wood0);
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(224,166,62,.12), transparent 60%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 4px, transparent 4px 8px),
    repeating-linear-gradient(90deg, var(--wood0) 0 32px, #2a170e 32px 64px);
  color: var(--cream);
  font-family: var(--f-body);
  font-size: 22px;
  line-height: 1.25;
  -webkit-font-smoothing: none;
  min-height: 100dvh;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(10,5,2,.55) 100%);
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px dashed var(--gold2); outline-offset: 3px; }

/* Bordure pixel réutilisable (coins coupés en escalier) */
.pxbox {
  box-shadow:
    0 calc(-1 * var(--px)) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    calc(-1 * var(--px)) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}

/* ========================= ÉCRAN MOT DE PASSE ========================= */
.gate {
  min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px;
}
.gate { position: relative; overflow: hidden; }
.gate-bg {
  position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover;
  image-rendering: pixelated; opacity: .32; filter: saturate(.8); z-index: 0;
}
.eph {
  position: relative; z-index: 1; width: min(360px, 92vw);
  transform-origin: 50% 0;
}
.eph-rings { display: flex; justify-content: space-around; padding: 0 36px; height: 22px; position: relative; z-index: 2; }
.eph-rings i {
  width: 12px; height: 26px; background: var(--cream2);
  box-shadow: inset -4px 0 0 #9a8460, 0 0 0 4px var(--ink);
}
.eph-page {
  margin-top: -8px;
  background: var(--cream);
  color: var(--ink);
  text-align: center;
  padding: 0 0 22px;
  box-shadow:
    0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink),
    0 10px 0 0 var(--cream2), 0 14px 0 0 var(--ink), 0 18px 0 0 var(--cream2), 0 22px 0 0 var(--ink),
    10px 18px 0 6px rgba(0,0,0,.45),
    inset 0 -8px 0 var(--cream2);
  background-image: repeating-linear-gradient(0deg, transparent 0 27px, rgba(110,26,31,.08) 27px 28px);
}
.eph-kicker {
  margin: 0; padding: 16px 12px 0; background: var(--red2); color: var(--gold2);
  font-family: var(--f-title); font-size: 9px; letter-spacing: 3px; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.holly { width: 30px; height: 18px; image-rendering: pixelated; }
.holly.flip { transform: scaleX(-1); }
.eph-title {
  margin: 0; padding: 10px 12px 14px;
  font-family: var(--f-title); font-size: 13px; letter-spacing: 1px; line-height: 1.5;
  background: var(--red2); color: var(--cream);
  border-bottom: 4px solid var(--ink);
  text-shadow: 2px 2px 0 var(--red0);
}
.eph-hint { margin: 12px 16px 6px; font-size: 22px; color: var(--red1); }
.eph-month, .eph-day, .eph-year {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; margin: 0 14px;
}
.eph-month output {
  font-family: var(--f-title); font-size: 15px; text-transform: uppercase;
  background: var(--grn2); color: var(--cream); padding: 12px 4px;
  box-shadow: 0 0 0 4px var(--ink);
}
.eph-day output {
  font-family: var(--f-title); font-size: 72px; line-height: 1; color: var(--red2);
  padding: 18px 0 8px; text-shadow: 5px 5px 0 var(--cream2);
}
.eph-weekday { margin: 0 0 8px; font-size: 24px; color: var(--wood2); }
.eph-year output { font-family: var(--f-title); font-size: 18px; color: var(--grn1); padding: 8px 0; }
.arw {
  width: 44px; height: 44px; border: 0; padding: 0;
  background: var(--wood3); color: var(--cream);
  box-shadow: inset -4px -4px 0 var(--wood1), inset 4px 4px 0 var(--wood4), 0 0 0 4px var(--ink);
  font-size: 16px;
}
.arw:active { box-shadow: inset 4px 4px 0 var(--wood1), 0 0 0 4px var(--ink); }
.eph-day .arw { align-self: center; }
.btn-go {
  margin: 18px auto 0; display: inline-block;
  font-family: var(--f-title); font-size: 13px; letter-spacing: 1px;
  padding: 14px 22px; border: 0;
  background: var(--red2); color: var(--cream);
  box-shadow: inset -4px -4px 0 var(--red0), inset 4px 4px 0 var(--red3), 0 0 0 4px var(--ink), 6px 6px 0 4px rgba(0,0,0,.35);
}
.btn-go:hover { background: var(--red3); }
.btn-go:active { transform: translate(2px, 2px); }
.btn-go.small { font-size: 11px; padding: 10px 16px; margin: 0; }
.eph-msg { min-height: 1.3em; margin: 12px 16px 0; color: var(--red1); font-size: 22px; }

.eph.shake { animation: shake .45s steps(6) both; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-10px)} 40%{transform:translateX(10px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.eph.tear { animation: tear .9s steps(9) forwards; }
@keyframes tear { 0%{transform:none;opacity:1} 30%{transform:rotate(-3deg) translateY(-6px)} 100%{transform:rotate(14deg) translate(40px, 110vh);opacity:.9} }

/* ============================== LE SALON ============================== */
.app { min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--wood0); }
.app[hidden] { display: none; }

.stage { position: relative; line-height: 0; }
#scene { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.hotspots { position: absolute; inset: 0; }
.hs {
  position: absolute; padding: 0; border: 0; background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.hs:hover, .hs:focus-visible { outline: 2px dashed var(--gold2); outline-offset: 1px; }
.hs::after {
  content: attr(data-label);
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  white-space: nowrap; pointer-events: none;
  font-family: var(--f-body); font-size: 20px; line-height: 1; color: var(--cream);
  background: var(--ink); padding: 6px 8px; box-shadow: 0 0 0 2px var(--gold);
  display: none; z-index: 5;
}
.hs:hover::after, .hs:focus-visible::after { display: block; }
@media (hover: none) { .hs::after { display: none; } }


/* ============================ BOÎTE DE TEXTE ============================ */
.box {
  width: min(620px, calc(100vw - 32px)); max-height: min(80dvh, 720px);
  padding: 0; border: 0; background: var(--cream); color: var(--ink);
  box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink), 12px 12px 0 4px rgba(0,0,0,.5);
  overflow: visible;
}
.box[open] { display: flex; flex-direction: column; animation: pop .25s steps(4) both; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
.box::backdrop { background: rgba(14, 8, 4, .72); }
.box-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  background: var(--red2); color: var(--cream); border-bottom: 4px solid var(--ink);
}
.box.locked .box-bar { background: var(--grn2); }
.box-num {
  font-family: var(--f-title); font-size: 12px; padding: 7px 6px 5px; background: var(--gold2); color: var(--red0);
  box-shadow: 0 0 0 3px var(--ink); flex: none;
}
.box-title { margin: 0; flex: 1; font-family: var(--f-title); font-weight: 400; font-size: 12px; line-height: 1.5; text-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.box-x {
  flex: none; width: 36px; height: 36px; border: 0; background: var(--cream); color: var(--ink); font-size: 18px; line-height: 1;
  box-shadow: inset -3px -3px 0 var(--cream2), 0 0 0 3px var(--ink);
}
.box-body {
  overflow: auto; padding: 18px 22px 8px; font-size: 24px; line-height: 1.3; white-space: pre-line;
  background-image: repeating-linear-gradient(0deg, transparent 0 30px, rgba(110,26,31,.10) 30px 31px);
  background-attachment: local;
  scrollbar-color: var(--wood3) var(--cream2);
}
.box-body .when { display: block; color: var(--red1); font-size: 20px; margin-bottom: 10px; }
.box-body .big { display: block; font-family: var(--f-title); font-size: 14px; line-height: 1.6; color: var(--red2); margin: 6px 0 12px; }
.box-foot { display: flex; justify-content: flex-end; padding: 10px 16px 16px; }

@media (max-width: 599px) {
  body { font-size: 20px; }
  .box-body { font-size: 22px; padding: 14px 16px 6px; }
  .box-title { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
