:root {
  --bg1: #0f1f17; --bg2: #1d3a2a;
  --card: #fffaf2; --ink: #2b1d14; --muted: #7a6a5c;
  --red: #b3262e; --red-d: #8c1c23; --gold: #e0b154; --green: #2f6b45;
  --radius: 16px;
  --serif: "Georgia", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg1); }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans); color: var(--ink);
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg1) 70%) fixed;
  min-height: 100vh;
}
a { color: var(--red); }
h1, h2 { font-family: var(--serif); font-weight: 700; margin: .2em 0 .4em; }

/* --- śnieg --- */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.flake { position: absolute; top: -10px; color: #fff; opacity: .8; user-select: none;
  animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(105vh) translateX(var(--drift, 20px)); } }
@media (prefers-reduced-motion: reduce) { .flake { display: none; } }

/* --- layout --- */
.topbar { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  padding: .8rem 1.2rem; color: #f5ecd9; }
.topbar a { color: #f5ecd9; text-decoration: none; }
.brand { font-family: var(--serif); font-size: 1.15rem; }
.nav-links { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav-links a:hover { color: var(--gold); }
main { position: relative; z-index: 1; }
.wrap { max-width: 900px; margin: 0 auto; padding: 1rem 1rem 4rem; }
.wrap.wide { max-width: 1200px; }
.center { min-height: 90vh; display: grid; place-items: center; padding: 1rem; }
.inline { display: inline; }

.hero { text-align: center; color: #f5ecd9; margin: 1rem 0 1.8rem; }
.hero.left { text-align: left; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.hero p { margin: 0; opacity: .9; }
.hero .muted { color: #cbbfa8; }
.countdown { color: var(--gold); font-variant-numeric: tabular-nums; }

.card { background: var(--card); border-radius: var(--radius); padding: 1.6rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.muted { color: var(--muted); }
.login-card { max-width: 380px; width: 100%; text-align: center; }
.login-card form { display: grid; gap: .7rem; margin-top: 1rem; }
.big-emoji { font-size: 3.2rem; }

/* --- przyciski / formularze --- */
.btn { display: inline-block; border: 0; cursor: pointer; text-decoration: none; font: inherit;
  background: var(--red); color: #fff; padding: .7rem 1.2rem; border-radius: 999px;
  font-weight: 600; transition: transform .1s, background .2s; }
.btn:hover { background: var(--red-d); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.btn-ghost:hover { background: var(--red); color: #fff; }
.btn-small { padding: .35rem .8rem; font-size: .85rem; }
.link-btn { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.link-btn.small { font-size: 1rem; text-decoration: none; color: var(--red); }
input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; padding: .7rem .9rem; border-radius: 10px;
  border: 1.5px solid #d9cbb6; background: #fff; color: var(--ink); }
input:focus, textarea:focus { outline: 2px solid var(--gold); border-color: transparent; }
textarea { resize: vertical; }

.flash { position: relative; z-index: 2; padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: #e3f3e7; color: #1d5130; }
.flash-error { background: #fbe3e3; color: #7d1a1f; }
.flash-info { background: #fff3d6; color: #6b4e0f; }

/* --- siatka okienek --- */
/* 5 kolumn: 23 okienka + podwójne 24 = 25 pól, równe 5 rzędów */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; grid-auto-flow: dense; max-width: 760px; margin: 0 auto; }
.door { position: relative; aspect-ratio: 1; border-radius: 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-decoration: none; color: #fff;
  transition: transform .2s, box-shadow .2s; overflow: hidden; }
.door .num { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.door.big { grid-column: span 2; aspect-ratio: auto; }
.door.big .num { font-size: 3.4rem; }
.door.locked { background: linear-gradient(145deg, #2a4a38, #1b3326); color: rgba(255,255,255,.55);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.08); }
.door.locked .lock { font-size: .9rem; margin-top: .3rem; opacity: .6; }
a.door.locked { cursor: zoom-in; }
.door.unlocked { background: linear-gradient(145deg, var(--red), var(--red-d));
  box-shadow: 0 8px 20px rgba(0,0,0,.3), inset 0 0 0 2px var(--gold); }
.door.unlocked::before { content: ""; position: absolute; inset: 6px; border: 1.5px dashed rgba(224,177,84,.55); border-radius: 10px; }
.door.unlocked:hover { transform: translateY(-3px) rotate(-1deg); }
.door.opened { background: linear-gradient(145deg, #f7efe1, #ebdcc4); color: var(--red); box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.door.opened::before { border-color: rgba(179,38,46,.25); }
.door.today { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(224,177,84,.35), 0 8px 20px rgba(0,0,0,.3), inset 0 0 0 2px var(--gold); } }
.badge { margin-top: .4rem; font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.2); }
.door.opened .badge { background: rgba(179,38,46,.1); }
.badge.glow { background: var(--gold); color: var(--ink); }

/* --- dzień --- */
.day-card { max-width: 640px; margin: 1rem auto; text-align: center; }
.reveal { animation: reveal .6s cubic-bezier(.2,.8,.2,1.2); }
@keyframes reveal { from { opacity: 0; transform: scale(.85) rotateX(25deg); } }
.day-num { display: inline-block; background: var(--red); color: #fff; font-weight: 700; letter-spacing: .05em;
  padding: .3rem .9rem; border-radius: 999px; font-size: .85rem; text-transform: uppercase; }
.day-img { max-width: 100%; border-radius: 12px; margin: 1rem 0; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.message { white-space: pre-wrap; font-family: var(--serif); font-size: 1.15rem; line-height: 1.6; text-align: left; margin: 1rem 0; }
.back { margin-top: 1.5rem; }

/* --- voucher --- */
.voucher { position: relative; margin: 1.5rem auto 0; max-width: 460px; padding: 1.4rem 1.2rem;
  background: linear-gradient(135deg, #fff6df, #f6e2b5); border: 2px dashed var(--gold);
  border-radius: 14px; text-align: center; overflow: hidden; display: block; text-decoration: none; color: var(--ink); }
.voucher-label { font-size: .75rem; font-weight: 800; letter-spacing: .3em; color: var(--red); }
.voucher-text { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; margin: .4rem 0; }
.voucher-from { font-size: .8rem; color: var(--muted); margin-bottom: .9rem; }
.voucher.redeemed { filter: grayscale(.6); }
.voucher.redeemed .voucher-text { text-decoration: line-through; text-decoration-color: rgba(179,38,46,.5); }
.stamp { display: inline-block; margin-top: .4rem; transform: rotate(-8deg); border: 3px solid var(--red);
  color: var(--red); font-weight: 900; letter-spacing: .15em; padding: .3rem .9rem; border-radius: 8px; }
.stamp small { font-weight: 500; letter-spacing: 0; font-size: .7rem; }
.voucher-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.voucher.small { margin: 0; }
.voucher.small:hover { transform: translateY(-2px); }

/* --- admin --- */
.table-card { overflow-x: auto; padding: .6rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th { text-align: left; color: var(--muted); font-weight: 600; padding: .6rem; border-bottom: 2px solid #eadcc6; }
.admin-table td { padding: .55rem .6rem; border-bottom: 1px solid #f0e5d4; vertical-align: middle; }
.admin-table tr.empty td { background: #fff3f0; }
.admin-table .n { font-family: var(--serif); font-weight: 700; font-size: 1.2rem; color: var(--red); }
.admin-table .actions { white-space: nowrap; }
.admin-table .icons span { margin-right: .2rem; }
.warn { color: var(--red); font-weight: 600; font-size: .8rem; }
.pill { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #eee3d2; color: var(--muted); white-space: nowrap; }
.pill.ok { background: #dcefe1; color: #1d5130; }

.form { display: grid; gap: 1.1rem; }
.form label, .field { display: grid; gap: .35rem; font-weight: 600; font-size: .92rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form .check { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.voucher-box { border: 2px dashed var(--gold); border-radius: 12px; padding: 1rem; display: grid; gap: .8rem; margin: 0; }
.thumb { max-width: 220px; border-radius: 10px; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 700px) {
  /* 4 lub 3 kolumny: 24 dzieli się równo, więc 24-ka jest zwykłym okienkiem */
  .grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .door.big { grid-column: auto; aspect-ratio: 1; }
  .door.big .num { font-size: 2rem; }
  .door .num { font-size: 2rem; }
}
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .topbar { flex-direction: column; gap: .4rem; }
  .nav-links { gap: .8rem; font-size: .92rem; }
  .form .row { grid-template-columns: 1fr; }
  .card { padding: 1.2rem; }
}
