:root {
  --bg: #14291f;
  --bg2: #0d1c15;
  --paper: #fbf3e4;
  --ink: #3b2a22;
  --red: #b3262e;
  --red-d: #8a1c23;
  --green: #2f6b4f;
  --gold: #e3b45b;
  --gold-d: #b98a2e;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --serif: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--paper); font-family: var(--serif);
  background:
    radial-gradient(ellipse at 50% -10%, #2a5a43 0%, transparent 60%),
    radial-gradient(ellipse at 50% 120%, #3a1018 0%, transparent 55%),
    linear-gradient(var(--bg), var(--bg2));
  background-attachment: fixed;
}
#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.lights {
  position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 3; pointer-events: none;
  background:
    radial-gradient(circle 6px at 20px 18px, #ff5a5f 0 60%, transparent 70%) 0 0 / 120px 34px repeat-x,
    radial-gradient(circle 6px at 50px 22px, #ffd166 0 60%, transparent 70%) 0 0 / 120px 34px repeat-x,
    radial-gradient(circle 6px at 80px 18px, #8fe388 0 60%, transparent 70%) 0 0 / 120px 34px repeat-x,
    radial-gradient(circle 6px at 110px 22px, #7cc6ff 0 60%, transparent 70%) 0 0 / 120px 34px repeat-x;
  animation: twinkle 2.4s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(255,220,150,.7));
}
@keyframes twinkle { from { opacity: .55; } to { opacity: 1; } }

main { position: relative; z-index: 2; max-width: 980px; margin: 0 auto; padding: 56px 16px 40px; }

.title { font-size: clamp(2rem, 6vw, 3.4rem); margin: .2em 0 0; color: var(--gold); letter-spacing: .02em; text-shadow: 0 2px 0 #00000055; font-weight: 700; }
.names { margin: .2em 0 1em; font-style: italic; font-size: 1.25rem; opacity: .9; }
.intro { max-width: 560px; margin: 0 auto 1.2em; opacity: .85; line-height: 1.5; }
.small { font-size: .9rem; opacity: .75; margin: .4em 0 0; }

.card { background: var(--paper); color: var(--ink); border-radius: 22px; box-shadow: var(--shadow); padding: 32px 26px; border: 3px solid var(--gold); }
.login { max-width: 420px; margin: 8vh auto 0; text-align: center; }
.login .title { color: var(--red); text-shadow: none; }
.login .names { color: var(--green); }
.wreath { font-size: 3.2rem; }
label { display: block; margin: 1.2em 0 .5em; }
input[type=password] {
  width: 100%; padding: 14px 16px; font: inherit; font-size: 1.1rem; border-radius: 12px; text-align: center;
  border: 2px solid #d9c9a8; background: #fffaf0; color: var(--ink);
}
input:focus { outline: 3px solid var(--gold); border-color: var(--gold-d); }
.btn {
  margin-top: 1em; width: 100%; padding: 14px 18px; font: inherit; font-size: 1.1rem; font-weight: 700; cursor: pointer;
  color: #fff; background: linear-gradient(var(--red), var(--red-d)); border: 0; border-radius: 12px;
  box-shadow: 0 4px 0 #5e1217; transition: transform .1s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #5e1217; }
.error { color: var(--red); min-height: 1.4em; margin: .8em 0 0; }
.link { background: none; border: 0; color: var(--paper); opacity: .6; font: inherit; text-decoration: underline; cursor: pointer; }

.hero { text-align: center; margin-bottom: 26px; }
.today {
  display: inline-block; background: rgba(0,0,0,.28); border: 2px dashed var(--gold); border-radius: 16px;
  padding: 12px 20px; font-size: 1.15rem; line-height: 1.4;
}
.today strong { color: var(--gold); }
.progress { width: min(320px, 80%); height: 10px; margin: 18px auto 0; background: #00000055; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-d), var(--gold)); transition: width .6s; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px; }
.door {
  position: relative; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; font: inherit; color: #fff;
  border-radius: 16px; overflow: hidden; box-shadow: 0 6px 14px rgba(0,0,0,.35), inset 0 0 0 3px rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; transition: transform .15s;
  background:
    repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.06) 10px 20px),
    linear-gradient(145deg, #c23a43, var(--red-d));
}
.door:nth-child(3n+2) { background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.06) 10px 20px), linear-gradient(145deg, #3c8663, #1f4a37); }
.door:nth-child(3n) { background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.06) 10px 20px), linear-gradient(145deg, #c9972f, #8f6a1b); }
.door .num { font-size: 2.3rem; font-weight: 700; text-shadow: 0 2px 4px rgba(0,0,0,.45); }
.door .cat { display: none; }
.door::after { content: ""; position: absolute; inset: 8px; border: 2px dashed rgba(255,255,255,.35); border-radius: 10px; pointer-events: none; }
.door.open:hover { transform: translateY(-4px) rotate(-1.5deg); }
.door.open { animation: glow 2.2s ease-in-out infinite alternate; }
.door.today-door { outline: 4px solid var(--gold); outline-offset: 2px; }
@keyframes glow { from { box-shadow: 0 6px 14px rgba(0,0,0,.35), 0 0 0 rgba(255,220,150,0); } to { box-shadow: 0 6px 14px rgba(0,0,0,.35), 0 0 22px rgba(255,220,150,.75); } }
.door.locked { cursor: not-allowed; filter: grayscale(.65) brightness(.6); }
.door.locked::before { content: "🔒"; position: absolute; right: 10px; bottom: 8px; font-size: 1rem; z-index: 1; }
.door.solved { background: linear-gradient(145deg, #f7ecd0, #e3cf9d); color: var(--ink); }
.door.solved .num { text-shadow: none; opacity: .55; }
.door.solved::before { content: "⭐"; position: absolute; font-size: 1.5rem; right: 9px; top: 7px; z-index: 1; }
.door.solved::after { border-color: rgba(120,80,20,.35); }
.door.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

footer { text-align: center; margin-top: 34px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 10; background: rgba(5,12,8,.78); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 44px 14px; backdrop-filter: blur(3px); }
.sheet { position: relative; width: 100%; max-width: 560px; background: var(--paper); color: var(--ink); border-radius: 22px; border: 3px solid var(--gold); box-shadow: var(--shadow); padding: 34px 22px 26px; animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.9) translateY(20px); opacity: 0; } }
.close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 2rem; line-height: 1; color: var(--ink); cursor: pointer; opacity: .6; }
.badge { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); width: 56px; height: 56px; border-radius: 50%; background: var(--red); color: #fff; font-size: 1.7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 3px solid var(--gold); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.sheet .cat { text-align: center; color: var(--green); text-transform: uppercase; letter-spacing: .15em; font-size: .78rem; margin: 6px 0 4px; }
.sheet h2 { text-align: center; margin: 0 0 16px; font-size: 1.4rem; line-height: 1.3; }
.photo { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: 10px; margin: 0 auto 18px; background: #fff; padding: 8px 8px 12px; box-shadow: 0 6px 16px rgba(0,0,0,.3); transform: rotate(-1deg); }
.options { display: grid; gap: 10px; }
.opt {
  font: inherit; font-size: 1.05rem; text-align: left; padding: 13px 16px; cursor: pointer; color: var(--ink);
  background: #fffaf0; border: 2px solid #d9c9a8; border-radius: 12px; transition: background .15s, transform .1s;
  display: flex; gap: 12px; align-items: center;
}
.opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; font-size: .9rem; }
.opt:hover:not(:disabled) { background: #fff3d6; transform: translateX(3px); }
.opt:disabled { cursor: default; }
.opt.wrong { background: #f4d5d5; border-color: var(--red); text-decoration: line-through; opacity: .7; animation: shake .4s; }
.opt.right { background: #d6ecd9; border-color: var(--green); font-weight: 700; }
.feedback { min-height: 1.5em; text-align: center; margin: 14px 0 0; color: var(--red); }
.feedback.good { color: var(--green); }
.reward { margin-top: 12px; text-align: center; padding: 16px; border-radius: 14px; background: linear-gradient(145deg, #fff3d0, #f4dc9c); border: 2px dashed var(--gold-d); }
.reward .sack { font-size: 2.6rem; display: block; animation: bounce 1.2s ease-in-out infinite; }
.reward strong { display: block; font-size: 1.25rem; color: var(--red-d); }
.reward p { margin: .6em 0 0; line-height: 1.45; }
@keyframes bounce { 50% { transform: translateY(-6px) rotate(4deg); } }

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .door .num { font-size: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
