* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-primary: #1a472a;
  --color-secondary: #c41e3a;
  --color-gold: #ffd700;
  --color-cream: #fff8dc;
  --color-snow: #fffafa;
  --color-night: #0f1419;
  --color-door: #8b4513;
  --color-door-light: #a0522d;
  --font-festive: 'Georgia', serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--color-cream);
  background: linear-gradient(180deg, var(--color-night) 0%, var(--color-primary) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Snowfall effect */
.snowfall {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Ccircle fill='%23fff' cx='512' cy='512' r='3' opacity='0.8'/%3E%3Ccircle fill='%23fff' cx='200' cy='300' r='2' opacity='0.6'/%3E%3Ccircle fill='%23fff' cx='800' cy='150' r='2.5' opacity='0.7'/%3E%3Ccircle fill='%23fff' cx='100' cy='700' r='2' opacity='0.5'/%3E%3Ccircle fill='%23fff' cx='900' cy='600' r='3' opacity='0.6'/%3E%3Ccircle fill='%23fff' cx='400' cy='800' r='2' opacity='0.7'/%3E%3Ccircle fill='%23fff' cx='650' cy='400' r='2.5' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: snowfall 15s linear infinite;
}

@keyframes snowfall {
  from { background-position: 0 0; }
  to { background-position: 200px 400px; }
}

/* Header */
.header {
  text-align: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 2;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.title {
  font-family: var(--font-festive);
  font-size: clamp(1.8rem, 5vw, 3rem);
  color: var(--color-gold);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.5rem;
}

.title-icon {
  display: inline-block;
  animation: twinkle 2s ease-in-out infinite;
}

.title-icon:last-child {
  animation-delay: 1s;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.subtitle {
  font-size: 1.1rem;
  color: var(--color-snow);
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

/* Test Mode Toggle */
.mode-toggle {
  display: inline-block;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  display: none;
}

.toggle-switch {
  width: 48px;
  height: 24px;
  background: #555;
  border-radius: 12px;
  position: relative;
  transition: background 0.3s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-input:checked + .toggle-switch {
  background: var(--color-secondary);
}

.toggle-input:checked + .toggle-switch::after {
  transform: translateX(24px);
}

.toggle-text {
  font-size: 0.9rem;
  color: var(--color-cream);
}

/* Calendar Grid */
.calendar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  z-index: 2;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  padding: 1rem;
}

@media (max-width: 768px) {
  .calendar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .calendar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
}

/* Calendar Door */
.calendar-door {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--color-door) 0%, var(--color-door-light) 100%);
  border: 3px solid var(--color-gold);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.calendar-door::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  pointer-events: none;
}

.calendar-door:hover:not(.locked) {
  transform: scale(1.05) rotate(-2deg);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.calendar-door.locked {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.calendar-door.opened {
  background: linear-gradient(135deg, var(--color-primary) 0%, #2d5a3d 100%);
}

.calendar-door.opened::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 0.8rem;
  color: var(--color-gold);
}

.door-number {
  font-family: var(--font-festive);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: bold;
  color: var(--color-gold);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.door-decoration {
  position: absolute;
  bottom: 4px;
  font-size: 0.8rem;
}

.lock-icon {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.7rem;
}

/* Today highlight */
.calendar-door.today {
  animation: todayPulse 2s ease-in-out infinite;
  border-color: var(--color-secondary);
}

@keyframes todayPulse {
  0%, 100% { box-shadow: 0 0 10px var(--color-secondary); }
  50% { box-shadow: 0 0 25px var(--color-secondary), 0 0 40px var(--color-gold); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: linear-gradient(180deg, var(--color-primary) 0%, #0f2918 100%);
  border: 4px solid var(--color-gold);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--color-cream);
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 10;
}

.modal-close:hover {
  opacity: 1;
}

.modal-content {
  padding: 2rem;
  text-align: center;
}

.day-badge {
  display: inline-block;
  background: var(--color-secondary);
  color: white;
  font-family: var(--font-festive);
  font-size: 1.2rem;
  padding: 0.5rem 1.5rem;
  border-radius: 2rem;
  margin-bottom: 1.5rem;
}

/* Chompie Illustration */
.chompie-illustration {
  width: 180px;
  height: 180px;
  margin: 0 auto 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  border: 3px dashed var(--color-gold);
}

/* Poem Section */
.poem-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  border-left: 4px solid var(--color-gold);
}

.poem {
  font-family: var(--font-festive);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--color-cream);
  font-style: italic;
  white-space: pre-line;
}

/* Treat Section */
.treat-section {
  margin-top: 1.5rem;
}

.reveal-treat-btn {
  background: linear-gradient(135deg, var(--color-secondary) 0%, #a01830 100%);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  border-radius: 2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.4);
}

.reveal-treat-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(196, 30, 58, 0.6);
}

.gift-icon {
  font-size: 1.5rem;
  animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.treat-content {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
  border: 2px solid var(--color-gold);
  border-radius: 12px;
  padding: 1.5rem;
  animation: revealTreat 0.5s ease-out;
}

@keyframes revealTreat {
  from {
    opacity: 0;
    transform: scale(0.8) rotateX(-10deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateX(0);
  }
}

.treat-content.hidden {
  display: none;
}

.treat-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.treat-icon {
  font-size: 2rem;
}

.treat-title {
  font-family: var(--font-festive);
  font-size: 1.3rem;
  color: var(--color-gold);
}

.treat-description {
  color: var(--color-cream);
  margin-bottom: 1rem;
}

.sponsor-badge {
  font-size: 0.85rem;
  color: var(--color-cream);
  opacity: 0.7;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sponsor-badge:empty {
  display: none;
}

.sponsor-badge a {
  color: var(--color-gold);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 2;
  color: var(--color-cream);
  opacity: 0.8;
}

.footer a {
  color: var(--color-gold);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.sponsor-cta {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.sponsor-cta a {
  color: var(--color-secondary);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-night);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-secondary);
}
