/* ===== RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette Noël Premium */
  --color-primary: #1a5f3f;
  --color-secondary: #8b2635;
  --color-gold: #d4af37;
  --color-cream: #faf8f3;
  --color-white: #ffffff;
  --color-dark: #1a1a1a;

  /* Gradients */
  --gradient-bg: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  --gradient-card: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.05)
  );
  --gradient-gold: linear-gradient(135deg, #d4af37, #f4e5a1);

  /* Shadows */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.2);
  --shadow-button: 0 4px 15px rgba(212, 175, 55, 0.3);

  /* Fonts */
  --font-title: "Playfair Display", serif;
  --font-body: "Poppins", sans-serif;
}

body {
  font-family: var(--font-body);
  background: var(--gradient-bg);
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--color-cream);
  position: relative;
}

/* ===== CANVAS NEIGE ===== */
#snowCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ===== CONTENEUR PRINCIPAL ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== ÉCRANS ===== */
.screen {
  display: none;
  width: 100%;
  animation: fadeIn 0.6s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== ÉCRAN D'ACCUEIL ===== */
#welcomeScreen {
  text-align: center;
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 3rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-card);
}

.title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: var(--color-gold);
  margin-bottom: 1rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 2px 2px 8px rgba(212, 175, 55, 0.5);
  }
  to {
    text-shadow: 2px 2px 20px rgba(212, 175, 55, 0.9);
  }
}

.subtitle {
  font-size: 1.1rem;
  color: var(--color-cream);
  margin-bottom: 2.5rem;
  font-weight: 300;
  opacity: 0.9;
}

/* ===== BOUTONS ===== */
.btn-primary {
  background: var(--gradient-gold);
  color: var(--color-dark);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.5);
}

.btn-primary:active {
  transform: translateY(0) scale(1);
}

.btn-primary:focus {
  outline: 2px solid var(--color-gold);
  outline-offset: 4px;
}

/* ===== ÉCRAN DE JEU ===== */
#gameScreen {
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-card);
}

.game-title {
  font-family: var(--font-title);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  color: var(--color-gold);
  text-align: center;
  margin-bottom: 2rem;
}

/* ===== JAUGE DE PROGRESSION ===== */
.progress-container {
  margin-bottom: 2.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-cream);
  opacity: 0.9;
}

.progress-percent {
  font-weight: 600;
  color: var(--color-gold);
}

.progress-bar {
  height: 24px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-gold);
  border-radius: 50px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shine 2s infinite;
}

@keyframes shine {
  to {
    left: 100%;
  }
}

/* ===== ACTIONS GRID ===== */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.action-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-family: var(--font-body);
  color: var(--color-cream);
  position: relative;
  overflow: hidden;
}

.action-card:hover:not(.completed) {
  transform: translateY(-5px) scale(1.03);
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--color-gold);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.2);
}

.action-card:active:not(.completed) {
  transform: translateY(-2px) scale(1.01);
}

.action-card.completed {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.2);
}

.action-card.completed::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: white;
}

.action-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.action-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--color-gold);
}

.action-desc {
  font-size: 0.85rem;
  opacity: 0.8;
  font-weight: 300;
}

/* ===== MODAL MINI-JEUX ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  animation: modalFadeIn 0.3s ease-out;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: modalSlideIn 0.3s ease-out;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--color-gold);
}

.close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--color-cream);
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.modal-body {
  color: var(--color-cream);
}

/* ===== MINI-JEUX SPÉCIFIQUES ===== */

/* 1. Brancher le sapin (drag & drop) */
.plug-game {
  position: relative;
  height: 300px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  overflow: hidden;
}

.socket {
  position: absolute;
  bottom: 20px;
  right: 50px;
  width: 80px;
  height: 60px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 3px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.plug {
  position: absolute;
  top: 50%;
  left: 50px;
  transform: translateY(-50%);
  width: 60px;
  height: 40px;
  background: var(--gradient-gold);
  border-radius: 8px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.1s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.plug:active {
  cursor: grabbing;
}

.cable {
  position: absolute;
  top: 50%;
  left: 50px;
  width: 100px;
  height: 3px;
  background: #666;
  transform-origin: left center;
}

/* 2. Décorer le sapin */
.tree-game {
  text-align: center;
  padding: 1rem;
}

.tree-display {
  font-size: 6rem;
  margin: 1rem 0;
  position: relative;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ornaments-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.ornament-btn {
  font-size: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--color-gold);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ornament-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.2);
}

.placed-ornament {
  position: absolute;
  font-size: 2rem;
  animation: placeOrnament 0.5s ease-out;
}

@keyframes placeOrnament {
  from {
    transform: translateY(-50px) scale(0);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* 3. Emballer le cadeau */
.gift-game {
  text-align: center;
  padding: 1rem;
}

.gift-display {
  font-size: 6rem;
  margin: 2rem 0;
}

.gift-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gift-step {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.gift-step.active {
  border-color: var(--color-gold);
  background: rgba(212, 175, 55, 0.1);
}

.gift-step.completed {
  opacity: 0.5;
  background: rgba(0, 255, 0, 0.1);
}

.gift-step button {
  background: var(--gradient-gold);
  color: var(--color-dark);
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.gift-step button:hover {
  transform: scale(1.05);
}

.gift-step button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 4. Chocolat chaud (shake) */
.cocoa-game {
  text-align: center;
  padding: 1rem;
}

.mug {
  font-size: 8rem;
  margin: 2rem 0;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
}

.shake-counter {
  font-size: 1.5rem;
  color: var(--color-gold);
  margin-top: 1rem;
}

/* 5. Carte de vœux */
.message-game {
  text-align: center;
}

.card-display {
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-dark);
  padding: 2rem;
  border-radius: 16px;
  margin: 1rem 0;
  min-height: 150px;
  font-family: "Courier New", monospace;
  font-size: 1.2rem;
  line-height: 1.6;
}

.message-input {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: 2px solid var(--color-gold);
  font-family: var(--font-body);
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-cream);
}

.message-input::placeholder {
  color: rgba(250, 248, 243, 0.5);
}

/* 6. Clochettes (rythme) */
.bell-game {
  text-align: center;
  padding: 1rem;
}

.bells-display {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 2rem 0;
}

.bell-btn {
  font-size: 4rem;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.1s;
  filter: grayscale(100%);
}

.bell-btn.active {
  animation: ringBell 0.3s ease;
  filter: grayscale(0%);
}

@keyframes ringBell {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-15deg);
  }
  75% {
    transform: rotate(15deg);
  }
}

.rhythm-instruction {
  font-size: 1.2rem;
  color: var(--color-gold);
  margin-bottom: 1rem;
}

/* ===== ÉCRAN FINAL ===== */
#finalScreen {
  text-align: center;
  background: var(--gradient-card);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 3rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-card);
}

.final-content {
  animation: finalAppear 0.8s ease-out;
}

@keyframes finalAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.final-title {
  font-family: var(--font-title);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--color-gold);
  margin-bottom: 1.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.final-message {
  font-size: 1.2rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: var(--color-cream);
}

.magic-count {
  color: var(--color-gold);
  font-weight: 600;
  font-size: 1.3em;
}

/* ===== SONDAGE ===== */
.survey-container {
  margin: 2.5rem 0;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.survey-question {
  font-size: 1.3rem;
  color: var(--color-gold);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.survey-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.survey-btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem 2rem;
  border: 2px solid;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: transparent;
}

.survey-yes {
  color: var(--color-white);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.survey-yes:hover {
  background: transparent;
  color: var(--color-primary);
  transform: translateY(-2px);
}

.survey-no {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.survey-no:hover {
  background: var(--color-secondary);
  color: var(--color-white);
  transform: translateY(-2px);
}

.survey-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.survey-feedback {
  margin-top: 1.5rem;
  font-size: 1.5rem;
  color: var(--color-gold);
  font-weight: 600;
  min-height: 2rem;
  animation: feedbackAppear 0.5s ease-out;
}

@keyframes feedbackAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== SPARKLES/CONFETTIS ===== */
#sparklesContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.sparkle {
  position: absolute;
  pointer-events: none;
  animation: sparkleFloat 1s ease-out forwards;
}

@keyframes sparkleFloat {
  0% {
    transform: translateY(0) scale(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-50px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(0);
    opacity: 0;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container {
    padding: 1rem 0.5rem;
  }

  #welcomeScreen,
  #gameScreen,
  #finalScreen {
    padding: 2rem 1.5rem;
  }

  .actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
  }

  .action-card {
    padding: 1.2rem 0.8rem;
  }

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

  .survey-buttons {
    flex-direction: column;
  }

  .survey-btn {
    width: 100%;
  }

  .modal-content {
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .title {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .actions-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== ACCESSIBILITÉ ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
