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

:root {
  --gold-primary: #f3d078;
  --gold-secondary: #9a7432;
  --gold-dark: #3a270a;
  --burgundy-bg: #1c060b;
  --burgundy-card: #3d0c17;
  --font-title: 'Cinzel', serif;
  --font-body: 'Playfair Display', serif;
  /*--font-handwritten: 'Indie Flower', cursive;*/
  --font-handwritten: 'Indie Flower', cursive;
}

body {
  width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-title);
  background-color: var(--burgundy-bg);
  background-image: 
    radial-gradient(circle at 50% 50%, rgba(61, 12, 23, 0.8) 0%, rgba(10, 2, 4, 0.98) 100%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.15) 0px, rgba(0,0,0,0.15) 2px, transparent 2px, transparent 8px);
  color: var(--gold-primary);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#app-container {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 15px;
}

.screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s ease;
}

.screen.hidden {
  display: none;
  opacity: 0;
}

.screen.active {
  display: flex;
  opacity: 1;
}

/* Accueil */
.top-bar {
  margin-bottom: 40px;
  background: #170408;
  border: 2px solid var(--gold-secondary);
  border-radius: 6px;
  padding: 4px;
}

.top-bar-border {
  border: 1px solid var(--gold-primary);
  padding: 8px 30px;
}

.domain-text {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: var(--gold-primary);
}

.cards-wrapper {
  display: flex;
  gap: 30px;
  width: 100%;
  max-width: 900px;
}

.choice-card {
  position: relative;
  flex: 1;
  min-height: 300px;
  background: radial-gradient(circle, #5a1223 0%, #2a070f 100%);
  border: 4px solid var(--gold-primary);
  box-shadow: 0 0 0 4px var(--gold-dark), 0 0 0 8px var(--gold-secondary), 0 15px 25px rgba(0,0,0,0.8);
  cursor: pointer;
  padding: 25px;
  border-radius: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.choice-card.card-emerald {
  background: radial-gradient(circle, #0d4632 0%, #041a12 100%);
}

.choice-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 0 4px var(--gold-dark), 0 0 0 8px var(--gold-primary), 0 0 25px rgba(243, 208, 120, 0.4);
}

.frame-ornament {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold-primary);
}
.corner-tl { top: -5px; left: -5px; border-right: none; border-bottom: none; }
.corner-tr { top: -5px; right: -5px; border-left: none; border-bottom: none; }
.corner-bl { bottom: -5px; left: -5px; border-right: none; border-top: none; }
.corner-br { bottom: -5px; right: -5px; border-left: none; border-top: none; }

.card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 15px;
}

.card-inner h2 {
  font-size: 1.25rem;
  color: #fff;
  line-height: 1.4;
}

.click-prompt {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--gold-primary);
}

.subtext {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  color: #ccc;
  opacity: 0.6;
}

/* Flemme */
.flemme-container {
  width: 100%;
  max-width: 850px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.btn-vintage-small {
  align-self: flex-start;
  background: #2a070f;
  color: var(--gold-primary);
  border: 1px solid var(--gold-secondary);
  padding: 8px 16px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 20px;
  margin-bottom: 25px;
  transition: all 0.2s ease;
}

.btn-vintage-small:hover {
  background: var(--gold-secondary);
  color: #000;
}

.event-title-banner {
  text-align: center;
  margin-bottom: 35px;
}

.event-title-banner h1 {
  font-size: 2.2rem;
  letter-spacing: 3px;
  color: var(--gold-primary);
  text-shadow: 0 3px 8px rgba(0,0,0,0.9);
}

.event-title-banner .hosts {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #d1b168;
  margin-top: 5px;
}

.event-meta {
  font-family: var(--font-body);
  font-size: 1.5rem;
  color: #e0d0b0;
  margin-top: 20px;
  letter-spacing: 1px;
}

.flemme-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 35px;
}

.section-title {
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 2px;
  color: var(--gold-primary);
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  margin-bottom: 18px;
}

.presence-options {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.radio-card {
  cursor: pointer;
}

.radio-card input {
  display: none;
}

.radio-btn-label {
  display: block;
  padding: 12px 24px;
  background: #170408;
  border: 2px solid var(--gold-secondary);
  color: var(--gold-primary);
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.radio-card input:checked + .radio-btn-label {
  background: var(--gold-secondary);
  color: #000;
  border-color: var(--gold-primary);
  box-shadow: 0 0 15px rgba(243, 208, 120, 0.4);
}

.transport-cards-container {
  display: flex;
  gap: 25px;
  justify-content: center;
}

.gold-framed-card {
  flex: 1;
  max-width: 380px;
  background: #120306;
  border: 3px solid var(--gold-secondary);
  outline: 1px solid var(--gold-primary);
  outline-offset: -5px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.8);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.gold-framed-card.active-mode {
  border-color: var(--gold-primary);
  box-shadow: 0 0 20px rgba(243, 208, 120, 0.4), 0 8px 20px rgba(0,0,0,0.9);
}

.card-img-wrapper {
  width: 100%;
  height: 180px;
  overflow: hidden;
  border: 2px solid var(--gold-dark);
  margin-bottom: 12px;
}

.transport-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-title-box {
  text-align: center;
  margin-bottom: 15px;
}

.card-title-box h3 {
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 1px;
}

.card-subtitle {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--gold-primary);
  opacity: 0.4;
}

.btn-gold {
  background: linear-gradient(180deg, #3d2311 0%, #1c0e06 100%);
  color: var(--gold-primary);
  border: 1px solid var(--gold-secondary);
  padding: 10px 20px;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  border-radius: 4px;
  width: 100%;
  transition: all 0.2s ease;
}

.gold-framed-card.active-mode .btn-gold,
.btn-gold:hover {
  background: linear-gradient(180deg, #9a7432 0%, #533d17 100%);
  color: #fff;
  border-color: var(--gold-primary);
}

.parchment-scroll, .parchment-input-wrapper {
  width: 100%;
  background: #e8d3a7;
  background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.4) 0%, rgba(180, 140, 80, 0.3) 100%);
  border: 2px solid #8c6832;
  border-radius: 4px;
  padding: 15px 20px;
  box-shadow: inset 0 0 20px rgba(90, 60, 20, 0.4), 0 8px 20px rgba(0,0,0,0.6);
}

.parchment-content {
  font-family: var(--font-handwritten);
  font-size: 1.6rem;
  color: #2b1507;
  line-height: 1.4;
}

.parchment-content h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: #5a1223;
  margin-bottom: 8px;
}

.parchment-content p + h4 {
  margin-top: 15px;
}

.parchment-input, .parchment-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-handwritten);
  font-size: 1.6rem;
  color: #2b1507;
}

.parchment-input::placeholder, .parchment-textarea::placeholder {
  color: rgba(43, 21, 7, 0.5);
}

.submit-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.btn-gold-large {
  background: linear-gradient(180deg, #9a7432 0%, #4a3410 100%);
  color: #fff;
  border: 2px solid var(--gold-primary);
  padding: 15px 40px;
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 2px;
  cursor: pointer;
  border-radius: 4px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.7);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-gold-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(243, 208, 120, 0.4);
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  position: relative;
  background: radial-gradient(circle, #3d0c17 0%, #170408 100%);
  border: 3px solid var(--gold-secondary);
  outline: 1px solid var(--gold-primary);
  outline-offset: -5px;
  padding: 30px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.9);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-title {
  font-family: var(--font-title);
  color: var(--gold-primary);
  font-size: 1.25rem;
  letter-spacing: 2px;
  margin-bottom: 15px;
}

.modal-body {
  font-family: var(--font-body);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 25px;
  text-align: left;
}

.modal-box .btn-gold {
  max-width: 180px;
}

@media (max-width: 768px) {
  .cards-wrapper, .transport-cards-container, .presence-options {
    flex-direction: column;
  }
  .gold-framed-card {
    width: 100%;
  }
}

/* --- VISUAL NOVEL --- */
.vn-container {
  width: 100%;
  max-width: 900px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}

.vn-sprite-wrapper {
  position: absolute;
  bottom: 180px; /* Laisse de la place pour la boîte de dialogue */
  left: 50%;
  transform: translateX(-50%);
  height: 60%;
  z-index: 1;
}

.vn-sprite-wrapper img {
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.8));
}

.vn-dialogue-box {
  position: relative;
  z-index: 10;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

#vn-speaker-name {
  font-family: var(--font-title);
  color: #5a1223;
  font-size: 1.4rem;
  border-bottom: 2px solid #8c6832;
  padding-bottom: 5px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

#vn-dialogue-text {
  font-family: var(--font-body);
  font-size: 1.2rem;
  color: #2b1507;
  font-weight: 600;
  line-height: 1.5;
  min-height: 60px; /* Évite les sauts de layout pendant le typewriter */
}

#vn-choices-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

#vn-choices-container.hidden {
  display: none;
}

.vn-choice-btn {
  background: rgba(232, 211, 167, 0.5);
  border: 1px solid #8c6832;
  padding: 12px;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 800;
  color: #2b1507;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.vn-choice-btn:hover {
  background: var(--gold-secondary);
  color: #fff;
  border-color: var(--gold-dark);
}

/* --- TRANSITION OVERLAY JEU VIDÉO --- */
.transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #050102; /* Noir très profond, légèrement bordeaux */
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none; /* Laisse passer les clics quand invisible */
  transition: opacity 0.8s ease-in-out;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: all; /* Bloque les clics pendant la transition */
}

.transition-text {
  font-family: var(--font-title);
  color: var(--gold-primary);
  font-size: 1.5rem;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(243, 208, 120, 0.5);
  animation: pulseText 1.2s infinite alternate;
}

@keyframes pulseText {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.vn-choice-btn {
  /* Garde tes propriétés existantes et ajoute ça : */
  opacity: 0;
  transform: translateY(10px);
  animation: fadeSlideUp 0.4s ease forwards;
}

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

select.parchment-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 45px;
  font-family: var(--font-handwritten);
  font-size: 1.4rem;
  color: #2b1507;
  padding: 5px 30px 5px 15px; /* Laisse la place au texte et à la flèche */
  background-color: transparent;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232b1507' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

/* On s'assure que le contenu du wrapper est bien centré verticalement */
.parchment-input-wrapper {
  display: flex;
  align-items: center;
}

/* --- ÉNIGME 2 : PUZZLE CARTE POSTALE --- */
.puzzle-board-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.puzzle-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  aspect-ratio: 4 / 3;
  gap: 2px;
  background: var(--gold-dark);
  border: 4px solid var(--gold-secondary);
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  touch-action: none; /* Bloque le scroll natif pendant le drag */
}

.puzzle-slot {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  position: relative;
}

.puzzle-piece {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../assets/images/carte-postale-2.jpg');
  background-size: 400% 300%;
  cursor: grab;
  z-index: 10;
  transition: transform 0.1s ease;
}

.puzzle-piece:active {
  cursor: grabbing;
}

.puzzle-piece.dragging {
  z-index: 1000;
  opacity: 0.9;
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.7);
  transition: none;
}

.puzzle-success-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(23, 4, 8, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 1;
  transition: opacity 0.5s ease;
}

.puzzle-success-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.success-title {
  font-family: var(--font-title);
  color: var(--gold-primary);
  font-size: 2.2rem;
  letter-spacing: 3px;
  text-shadow: 0 0 15px rgba(243, 208, 120, 0.5);
  margin-bottom: 10px;
  animation: scaleUp 0.5s ease backwards;
}

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