@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,800&family=Nunito:wght@400;600;700&display=swap');

:root {
  --night: #0f1c2e;
  --night-2: #172a44;
  --paper: #fbf5ea;
  --ink: #2a1f1a;
  --red: #b3262f;
  --red-dark: #8a1a22;
  --green: #1f5a43;
  --gold: #e2b25a;
  --gold-soft: #f3dca5;
  --muted: #8a99ad;
  --radius: 14px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--paper);
  background:
    radial-gradient(ellipse at 50% -10%, #2b4a72 0%, transparent 60%),
    linear-gradient(180deg, var(--night-2) 0%, var(--night) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

#snow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}

.page {
  position: relative; z-index: 1;
  max-width: 1080px; margin: 0 auto; padding: 48px 20px 80px;
}

/* ---------- Header ---------- */
.hero { text-align: center; margin-bottom: 40px; }
.hero .eyebrow {
  font-size: 13px; letter-spacing: .25em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 7vw, 72px); line-height: 1; margin: 12px 0 14px;
  color: var(--paper);
}
.hero p { color: var(--muted); margin: 0; font-size: 17px; }

/* ---------- Calendar grid ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}
@media (max-width: 820px) { .calendar { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .calendar { grid-template-columns: repeat(3, 1fr); gap: 10px; } }

.door {
  position: relative;
  aspect-ratio: 1 / 1.1;
  perspective: 900px;
  cursor: pointer;
  border: 0; padding: 0; background: none;
  font: inherit; color: inherit;
}

.door .inside {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 40%, #3b2a1f, #1c130d);
  display: grid; place-items: center;
  font-size: 34px;
  box-shadow: inset 0 4px 18px rgba(0,0,0,.6);
}

.door .panel {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transform-origin: left center;
  transition: transform .7s cubic-bezier(.3,.7,.2,1), box-shadow .2s;
  backface-visibility: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.08);
  background: var(--red);
  overflow: hidden;
}
.door .panel::before {
  /* subtle pattern */
  content: ''; position: absolute; inset: 8px;
  border: 1.5px dashed rgba(255,255,255,.22);
  border-radius: calc(var(--radius) - 6px);
}
.door:nth-child(3n+2) .panel { background: var(--green); }
.door:nth-child(4n+3) .panel { background: #284a73; }
.door:nth-child(6n+5) .panel { background: #7c3a5a; }

.door .num {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(30px, 5vw, 46px); line-height: 1;
  color: var(--paper);
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
}
.door .badge {
  margin-top: 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em;
  color: rgba(255,255,255,.75);
}

.door:hover:not(.locked) .panel { transform: rotateY(-14deg); box-shadow: 0 10px 26px rgba(0,0,0,.45), inset 0 0 0 2px var(--gold); }
.door.opening .panel { transform: rotateY(-105deg); }

.door.locked { cursor: not-allowed; }
.door.locked .panel { filter: saturate(.55) brightness(.75); }
.door.locked .num { opacity: .8; }

.door.today .panel { box-shadow: 0 0 0 3px var(--gold), 0 0 28px rgba(226,178,90,.55); }
.door.today .badge { color: var(--gold-soft); }

.door.opened .panel { background: var(--paper) !important; }
.door.opened .panel::before { border-color: rgba(42,31,26,.2); }
.door.opened .num { color: var(--ink); text-shadow: none; }
.door.opened .badge { color: #7a6a5c; }
.door.completed .panel { background: var(--gold-soft) !important; }
.door.completed .badge { color: var(--green); }

.door.shake { animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 20;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--paper); color: var(--ink);
  padding: 12px 20px; border-radius: 999px; font-weight: 700;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transition: .3s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Day page ---------- */
.day-card {
  background: var(--paper); color: var(--ink);
  border-radius: 22px; padding: 40px clamp(20px, 5vw, 52px);
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  max-width: 720px; margin: 0 auto;
  position: relative;
}
.day-card .day-num {
  position: absolute; top: -34px; left: 50%; transform: translateX(-50%);
  width: 68px; height: 68px; border-radius: 50%;
  background: var(--red); color: var(--paper);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 30px;
  box-shadow: 0 0 0 5px var(--paper);
}
.day-card h2 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(28px, 5vw, 40px); text-align: center; margin: 16px 0 10px;
}
.day-card .desc { white-space: pre-wrap; font-size: 17px; line-height: 1.6; text-align: center; color: #4a3d34; }
.day-card .day-image { width: 100%; border-radius: 14px; margin: 22px 0 6px; display: block; }
.day-card .empty { text-align: center; padding: 30px 0 10px; }
.day-card .empty .icon { font-size: 54px; }
.day-card .empty p { color: #6b5c50; font-size: 17px; }
.challenge-area { margin-top: 26px; }
.done-banner {
  margin-top: 24px; text-align: center; padding: 14px;
  background: #e6f0e9; color: var(--green); border-radius: 12px; font-weight: 700;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  padding: 13px 24px; font: 700 16px var(--font-body);
  background: var(--red); color: var(--paper);
  transition: transform .15s, background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn.secondary { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.btn.secondary:hover { background: rgba(255,255,255,.08); }
.btn.green { background: var(--green); }
.center { text-align: center; }
.back { margin-bottom: 54px; }

/* ---------- Fart coins ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-bottom: 36px;
}
.topbar.right { justify-content: flex-end; }
.coin-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px 7px 7px; border-radius: 999px;
  background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1.5px rgba(226,178,90,.45);
  font-weight: 800; font-size: 17px; color: var(--gold-soft);
  text-decoration: none; transition: background .15s;
}
a.coin-pill:hover { background: rgba(255,255,255,.14); }
.coin-pill small { font-weight: 600; font-size: 13px; color: var(--muted); }
.coin {
  display: inline-grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe7a3, var(--gold) 60%, #b98328);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.25);
  font-size: 15px; line-height: 1;
}
.coin.sm { width: 22px; height: 22px; font-size: 11px; }
.coin.lg { width: 64px; height: 64px; font-size: 32px; }
.coin.bump { animation: bump .6s; }
@keyframes bump { 30% { transform: scale(1.35) rotate(-12deg); } 60% { transform: scale(.95) rotate(6deg); } }

.reward-chip {
  display: flex; width: fit-content; margin: 0 auto 14px; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  background: #fbefd2; color: #8a5d12; font-weight: 800; font-size: 14px;
}
.done-banner .earned { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 8px; font-size: 18px; color: #8a5d12; }

/* Floating coins when earning */
.coin-burst { position: fixed; z-index: 30; pointer-events: none; animation: burst 1.3s ease-out forwards; }
@keyframes burst {
  0% { transform: translate(0, 0) scale(.4); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; }
}

/* ---------- Gift shop ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.gift {
  background: var(--paper); color: var(--ink); border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 14px 34px rgba(0,0,0,.3);
}
.gift .pic { aspect-ratio: 4 / 3; background: #efe4d2; display: grid; place-items: center; font-size: 56px; position: relative; }
.gift .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gift .body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gift h3 { font-family: var(--font-display); font-size: 22px; margin: 0; }
.gift p { margin: 0; color: #5e4f44; line-height: 1.5; white-space: pre-wrap; }
.gift .reveal { background: #e6f0e9; color: var(--green); padding: 12px; border-radius: 10px; font-weight: 700; white-space: pre-wrap; }
.gift .foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gift .price { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; color: #8a5d12; }
.gift .btn { padding: 10px 18px; font-size: 15px; }
.gift .btn:disabled { background: #d9cfc1; color: #8a7a6c; cursor: not-allowed; transform: none; }
.gift .need { font-size: 13px; color: #8a7a6c; font-weight: 700; }
.gift.unlocked { box-shadow: 0 0 0 3px var(--gold), 0 14px 34px rgba(0,0,0,.3); }
.gift .tag {
  position: absolute; top: 12px; right: 12px; background: var(--green); color: #fff;
  font: 800 12px var(--font-body); padding: 5px 10px; border-radius: 999px; letter-spacing: .04em;
}
.shop-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.shop-empty .icon { font-size: 60px; }
.shop-empty h2 { font-family: var(--font-display); color: var(--paper); margin: 10px 0 6px; }

.modal-back {
  position: fixed; inset: 0; z-index: 40; background: rgba(8,14,24,.7);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--paper); color: var(--ink); border-radius: 20px; padding: 30px;
  max-width: 420px; width: 100%; text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.modal h2 { font-family: var(--font-display); margin: 12px 0 8px; }
.modal p { color: #5e4f44; margin: 0 0 20px; white-space: pre-wrap; }
.modal .row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.modal .btn.plain { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #e3d9cb; }

.topbar.back { margin-bottom: 54px; }

/* Gift goal progress */
.gift .progress { height: 8px; border-radius: 999px; background: #eadfcd; overflow: hidden; margin-top: 4px; }
.gift .progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #d68a1c); border-radius: inherit; }
.gift .tag.ready { background: var(--red); animation: pulse 1.6s infinite; }
.gift.ready { box-shadow: 0 0 0 3px var(--red), 0 0 30px rgba(179,38,47,.45); }
.gift.ready .pic { font-size: 72px; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- Challenge player ---------- */
.ch-step, .ch-summary { display: flex; flex-direction: column; gap: 16px; }
.ch-count { text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: #a1876b; }
.ch-q { font-family: var(--font-display); font-size: 24px; text-align: center; margin: 0; }
.ch-text {
  margin: 0; padding: 16px 20px; border-left: 4px solid var(--gold); border-radius: 10px;
  background: #f5ecdc; font-size: 18px; font-style: italic; line-height: 1.55; white-space: pre-wrap;
}
.ch-media { width: 100%; border-radius: 14px; display: block; background: #efe4d2; }
.ch-media.audio { background: none; }
video.ch-media { max-height: 70vh; background: #000; }
.ch-media.pop { animation: pop .6s cubic-bezier(.2,.9,.3,1.3); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.ch-row { display: flex; gap: 10px; }
.ch-field {
  flex: 1; min-width: 0; padding: 13px 16px; border-radius: 999px; border: 2px solid #e3d5c0;
  font: 600 16px var(--font-body); background: #fff; color: var(--ink);
}
.ch-field:focus { outline: none; border-color: var(--red); }

.ch-flash { text-align: center; font-weight: 700; min-height: 1px; }
.ch-flash.bad { color: var(--red); }
.ch-flash:empty { display: none; }
.ch-meta { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 13.5px; color: #8a7a6c; font-weight: 700; }
.btn.small { padding: 8px 14px; font-size: 13.5px; }
.btn.ghost-dark { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px #dccbb3; }
.btn.ghost-dark:hover { background: #f3e9da; }
.ch-hint { background: #fff4d6; color: #7a5a12; padding: 12px 16px; border-radius: 12px; font-weight: 600; }

.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.chip { background: #f6e2df; color: var(--red-dark); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-btn {
  padding: 15px 14px; border-radius: 14px; border: 2px solid #e3d5c0; background: #fff; color: var(--ink);
  font: 700 16px var(--font-body); cursor: pointer; transition: .15s; text-align: center;
}
.choice-btn:hover:not(:disabled) { border-color: var(--red); transform: translateY(-1px); }
.choice-btn:disabled { cursor: default; }
.choice-btn.wrong { background: #f6e2df; border-color: #e9b5ae; color: #a0605a; text-decoration: line-through; }
.choice-btn.right { background: #dcefe2; border-color: #3c8d5a; color: var(--green); }

.ch-result { text-align: center; font-size: 19px; font-weight: 700; padding: 14px; border-radius: 14px; }
.ch-result.good { background: #e3f0e7; color: var(--green); }
.ch-result.meh { background: #f3ece2; color: #6b5c50; }
.ch-sol { display: block; font-size: 15px; font-weight: 600; opacity: .8; margin-top: 4px; }
.ch-bonus { background: var(--gold); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 14px; margin-left: 6px; }
.ch-reveal { display: flex; flex-direction: column; gap: 10px; }
.ch-reveal p { margin: 0; text-align: center; font-size: 17px; white-space: pre-wrap; }
.ch-reveal.final { border-top: 1.5px dashed #e0d0b8; padding-top: 16px; }
.ch-score { text-align: center; font-size: 18px; font-weight: 700; }
.ch-sum-item { padding-bottom: 16px; border-bottom: 1.5px dashed #e0d0b8; display: flex; flex-direction: column; gap: 10px; }
.ch-sum-q { text-align: center; font-weight: 700; }

/* Wordle */
.wordle { display: grid; grid-template-columns: repeat(var(--len), minmax(0, 54px)); gap: 6px; justify-content: center; }
.tile {
  aspect-ratio: 1; display: grid; place-items: center; border: 2px solid #e0d2bd; border-radius: 8px;
  font: 800 clamp(18px, 5vw, 26px) var(--font-body); text-transform: uppercase; background: #fff;
}
.tile.filled { border-color: #a1876b; }
.tile.correct { background: #3c8d5a; border-color: #3c8d5a; color: #fff; }
.tile.present { background: #d9a53c; border-color: #d9a53c; color: #fff; }
.tile.absent { background: #8f8780; border-color: #8f8780; color: #fff; }
.kb { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1; max-width: 42px; padding: 13px 0; border: 0; border-radius: 7px; background: #e9dfd0; color: var(--ink);
  font: 800 14px var(--font-body); cursor: pointer;
}
.key.wide { max-width: 66px; flex: 1.5; font-size: 12px; }
.key.correct { background: #3c8d5a; color: #fff; }
.key.present { background: #d9a53c; color: #fff; }
.key.absent { background: #8f8780; color: #fff; }

/* Wheel */
.wheel { position: relative; width: min(320px, 100%); margin: 0 auto 16px; aspect-ratio: 1; }
.wheel-rot { width: 100%; height: 100%; }
.wheel-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 18px rgba(0,0,0,.25)); }
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 28px solid var(--ink);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.3));
}

/* Map pin */
.ch-map { height: min(60vh, 380px); border-radius: 14px; overflow: hidden; background: #dfe7ea; position: relative; z-index: 0; }
.ch-map-loading { height: 100%; display: grid; place-items: center; color: #6b5c50; font-weight: 700; }
.ch-map-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.ch-map-tip { color: #6b5c50; font-weight: 700; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* Put in order */
.order-list { list-style: none; counter-reset: ord; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.order-item {
  counter-increment: ord; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 2px solid #e3d5c0; border-radius: 14px; padding: 8px 10px; font-weight: 700;
  transition: border-color .15s, background .15s;
}
.order-item::before { content: counter(ord); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #f3e9da; font-size: 13px; color: #8a5d12; }
.order-item.ok { border-color: #3c8d5a; background: #eef7f1; }
.order-item.ok::before { background: #3c8d5a; color: #fff; }
.order-item.dragging { border-color: var(--red); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.order-handle { cursor: grab; touch-action: none; font-size: 20px; color: #a1876b; padding: 4px 2px; user-select: none; }
.order-img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.order-label { flex: 1; min-width: 0; }
.order-btns { display: flex; flex-direction: column; gap: 2px; }
.order-move { border: 0; background: #f3e9da; color: #8a5d12; border-radius: 6px; width: 30px; height: 22px; font-size: 11px; cursor: pointer; }
.order-move:hover { background: #ead9bf; }

/* Several media in a reveal / hint / final surprise */
.ch-gallery { display: grid; gap: 10px; }
.ch-gallery.multi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.ch-gallery.multi img.ch-media { height: 100%; object-fit: cover; }
.ch-gallery .ch-media.audio, .ch-gallery video.ch-media { grid-column: 1 / -1; }
.ch-hint .ch-gallery { margin-top: 10px; }
.ch-hint { white-space: pre-wrap; }

/* ---------- Keep pictures and videos in their own shape (never stretched or cropped) ---------- */
img.ch-media, video.ch-media, .day-card .day-image {
  width: 100%; height: auto; max-height: 70vh;
  object-fit: contain; background: none;
}
.ch-gallery { align-items: start; }
.ch-gallery.multi img.ch-media { height: auto; object-fit: contain; }
.gift .pic:has(img) { aspect-ratio: auto; background: #efe4d2; }
.gift .pic img { height: auto; max-height: 340px; object-fit: contain; }
.order-img { object-fit: contain; background: #f3e9da; }

/* Popups for hints and rewards */
.ch-modal { max-height: 90vh; overflow-y: auto; }
.ch-modal.wide { max-width: 640px; }
.ch-modal .ch-gallery { margin: 6px 0 16px; }
.ch-modal img.ch-media, .ch-modal video.ch-media { max-height: 60vh; }
.ch-modal p { font-size: 17px; }
.modal-back { animation: fadein .2s; }
.ch-modal { animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
@keyframes fadein { from { opacity: 0; } }
