:root{
  --bg:#1a1a2e;
  --bg-light:#16213e;
  --fg:#eaeaea;
  --muted:#8892a0;
  --accent:#4a6fa5;
  --accent-hover:#5d8ac7;
  --gold:#ffc947;
  --shadow:0 4px 20px rgba(0,0,0,0.4);
}

*{box-sizing:border-box}

html,body{
  height:100%;
  margin:0;
  background:linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #1f2d4a 85%, #2a3a5c 100%);
  color:var(--fg);
  font-family:'Segoe UI',system-ui,-apple-system,Roboto,Ubuntu,Cantarell,'Noto Sans',Helvetica,Arial,sans-serif;
  line-height:1.6;
  position:relative;
}

/* Étoiles en CSS pur */
body::before{
  content:'';
  position:fixed;
  top:0; left:0; right:0;
  height:150px;
  background-image:
    radial-gradient(1px 1px at 50px 40px, white 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 120px 80px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 200px 30px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 280px 70px, white 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 350px 50px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 450px 35px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 520px 75px, white 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 600px 45px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 680px 60px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 750px 40px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 100px 20px, white 50%, transparent 100%),
    radial-gradient(1px 1px at 400px 90px, white 50%, transparent 100%);
  opacity:0.6;
  pointer-events:none;
  z-index:0;
}

/* Barbelés en CSS pur */
body::after{
  content:'';
  position:fixed;
  bottom:60px; left:0; right:0;
  height:20px;
  background:
    linear-gradient(90deg, transparent 0px, #3d4a5c 0px, #3d4a5c 2px, transparent 2px) 0 0 / 100px 2px repeat-x,
    linear-gradient(90deg, transparent 0px, #3d4a5c 0px, #3d4a5c 2px, transparent 2px) 0 10px / 100px 2px repeat-x;
  opacity:0.5;
  pointer-events:none;
  z-index:0;
}

#app{
  position:relative;
  min-height:100%;
  overflow:hidden;
}

/* Dialogue box - layout 2 colonnes */
.dialogue{
  position:absolute;
  left:3%;
  right:3%;
  top:20px;
  bottom:20px;
  background:linear-gradient(180deg, rgba(22,33,62,0.95) 0%, rgba(26,26,46,0.98) 100%);
  border:1px solid rgba(74,111,165,0.3);
  border-radius:12px;
  padding:20px 24px;
  box-shadow:var(--shadow), 0 0 40px rgba(74,111,165,0.1);
  backdrop-filter:blur(10px);
  font-size:1rem;
  max-width:1200px;
  margin:0 auto;
  display:flex;
  flex-direction:row;
  gap:24px;
  overflow:hidden;
}

/* Colonne gauche : image */
.dialogue .scene-column{
  flex:0 0 40%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  padding-top:10px;
}

.dialogue .scene-column img{
  max-width:100%;
  max-height:300px;
  object-fit:contain;
  border-radius:8px;
  box-shadow:0 4px 20px rgba(0,0,0,0.4);
}

.dialogue .scene-column .image-credit{
  margin-top:8px;
  font-size:0.7rem;
  color:rgba(255,255,255,0.7);
  background:rgba(0,0,0,0.5);
  padding:3px 8px;
  border-radius:4px;
}

/* Colonne droite : texte */
.dialogue .text-column{
  flex:1;
  display:flex;
  flex-direction:column;
  overflow-y:auto;
}

.dialogue > div:first-child{
  color:var(--fg);
  text-shadow:0 1px 2px rgba(0,0,0,0.3);
}

/* Choice buttons */
.choices{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:16px;
}

/* Choix avec illustration */
.choice-card{
  display:flex;
  align-items:stretch;
  gap:12px;
  background:rgba(30,40,60,0.8);
  border:1px solid rgba(74,111,165,0.4);
  border-radius:10px;
  overflow:hidden;
  transition:all 0.2s ease;
  cursor:pointer;
}

.choice-card:hover{
  border-color:var(--gold);
  background:rgba(40,50,70,0.9);
  transform:translateX(4px);
}

.choice-card .choice-img{
  width:80px;
  height:60px;
  object-fit:cover;
  flex-shrink:0;
  border-right:1px solid rgba(74,111,165,0.3);
}

.choice-card .choice-content{
  flex:1;
  padding:10px 12px;
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.choice-card .choice-label{
  font-size:0.95rem;
  color:var(--fg);
  margin:0;
}

.choice-card .choice-impact{
  font-size:0.75rem;
  color:var(--gold);
  margin-top:4px;
}

/* Responsive choix */
@media (max-width:600px){
  .choice-card .choice-img{
    width:60px;
    height:50px;
  }
  
  .choice-card .choice-content{
    padding:8px 10px;
  }
  
  .choice-card .choice-label{
    font-size:0.85rem;
  }
}

/* Crédits images */
.image-credit{
  margin-top:6px;
  font-size:0.7rem;
  color:rgba(255,255,255,0.8);
  background:rgba(0,0,0,0.6);
  padding:4px 10px;
  border-radius:4px;
}

/* Liens sources historiques */
.source-link{
  display:inline-block;
  margin-top:8px;
  font-size:0.75rem;
  color:var(--gold);
  text-decoration:none;
  border-bottom:1px dotted var(--gold);
}

.source-link:hover{
  color:#fff;
  border-bottom-color:#fff;
}

/* Encadré historique avec source */
.historical-context{
  font-style:italic;
  color:#a0aec0;
  border-left:3px solid var(--gold);
  padding-left:12px;
  margin-bottom:12px;
}

.historical-context .source-badge{
  display:inline-block;
  margin-top:6px;
  font-size:0.7rem;
  color:var(--gold);
  background:rgba(255,201,71,0.1);
  padding:2px 8px;
  border-radius:10px;
}

button{
  font:inherit;
  font-size:1rem;
  font-weight:500;
  background:linear-gradient(135deg, var(--accent) 0%, #3a5a8a 100%);
  color:#fff;
  border:none;
  border-radius:8px;
  padding:12px 20px;
  cursor:pointer;
  transition:all 0.2s ease;
  box-shadow:0 2px 8px rgba(74,111,165,0.3);
}

button:hover{
  background:linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
  transform:translateY(-2px);
  box-shadow:0 4px 16px rgba(74,111,165,0.4);
}

button:active{
  transform:translateY(0);
}

button:focus{
  outline:2px solid var(--gold);
  outline-offset:2px;
}

/* HUD buttons - more subtle */
.hud button{
  background:rgba(255,255,255,0.1);
  border:1px solid rgba(255,255,255,0.2);
  font-size:0.85rem;
  padding:8px 14px;
  box-shadow:none;
}

.hud button:hover{
  background:rgba(255,255,255,0.2);
  transform:none;
}

/* Journal panel */
.journal{
  position:absolute;
  top:60px;
  right:16px;
  width:340px;
  max-height:60vh;
  overflow:auto;
  background:linear-gradient(180deg, rgba(22,33,62,0.95) 0%, rgba(26,26,46,0.98) 100%);
  border:1px solid rgba(255,201,71,0.3);
  border-radius:12px;
  padding:16px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(10px);
}

.journal strong{
  color:var(--gold);
  font-size:1.1rem;
  display:block;
  margin-bottom:12px;
  padding-bottom:8px;
  border-bottom:1px solid rgba(255,201,71,0.2);
}

.journal pre{
  background:rgba(0,0,0,0.2);
  padding:8px;
  border-radius:6px;
  font-size:0.85rem;
  overflow-x:auto;
}

/* Accessibility panel */
#acc{
  background:linear-gradient(180deg, rgba(22,33,62,0.95) 0%, rgba(26,26,46,0.98) 100%);
  border:1px solid rgba(255,255,255,0.2);
}

#acc strong{
  color:var(--fg);
}

#acc label{
  display:flex;
  align-items:center;
  gap:8px;
  margin:8px 0;
  cursor:pointer;
}

#acc input[type="checkbox"]{
  width:18px;
  height:18px;
  accent-color:var(--accent);
}

#acc input[type="range"]{
  flex:1;
  accent-color:var(--accent);
}

.subtitle{
  position:absolute;
  bottom:96px;
  left:50%;
  transform:translateX(-50%);
  background:rgba(0,0,0,.8);
  padding:6px 12px;
  border-radius:6px;
  font-size:14px;
}

.colorblind *{filter:saturate(.7) contrast(1.2)}

.hud{
  position:absolute;
  top:12px;
  left:12px;
  display:flex;
  gap:8px;
  z-index:100;
}

.canvas{
  position:absolute;
  inset:0;
  z-index:-1;
}

/* Media container - caché car intégré dans le dialogue */
.media{
  display:none;
}

/* Placeholder styling */
.ph{
  background:linear-gradient(135deg, rgba(30,40,60,0.8) 0%, rgba(20,30,50,0.9) 100%);
  border:2px dashed rgba(255,201,71,0.4);
  border-radius:12px;
  color:var(--muted);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:24px;
  width:min(800px,90%);
  height:min(400px,70%);
  box-shadow:inset 0 0 60px rgba(0,0,0,0.3);
}

.ph strong{
  display:block;
  font-size:1rem;
  margin-bottom:8px;
  color:var(--gold);
}

.ph em{
  color:var(--muted);
  font-size:0.9rem;
}

/* Scene images */
.scene-img{
  max-width:100%;
  max-height:100%;
  width:auto;
  height:auto;
  border-radius:12px;
  box-shadow:0 8px 32px rgba(0,0,0,0.4);
  object-fit:contain;
}

/* Cover image on start screen */
.cover-img{
  max-width:100%;
  max-height:280px;
  border-radius:12px;
  box-shadow:0 4px 20px rgba(0,0,0,0.3);
}

/* Character selection cards */
#selPanel, #detailPanel{
  background:linear-gradient(180deg, rgba(22,33,62,0.98) 0%, rgba(26,26,46,0.99) 100%) !important;
  border:1px solid rgba(74,111,165,0.2) !important;
  box-shadow:var(--shadow) !important;
}

#startPanel{
  background:transparent !important;
  border:none !important;
  box-shadow:none !important;
}

#selPanel h2, #detailPanel h3, #startPanel h1{
  color:var(--gold);
  margin-bottom:16px;
}

#startPanel h1{
  font-size:2.5rem;
  text-align:center;
  text-shadow:0 2px 10px rgba(255,201,71,0.3);
}

#startPanel p{
  max-width:700px;
  margin:12px auto;
  text-align:justify;
  color:var(--muted);
}

#startPanel p:last-of-type{
  color:var(--gold);
  font-style:italic;
  text-align:center;
}

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

::-webkit-scrollbar-track{
  background:rgba(0,0,0,0.2);
  border-radius:4px;
}

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

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

/* ============================================
   RESPONSIVE - PANNEAU SÉLECTION PERSONNAGES
   ============================================ */

/* Layout du panneau de détail personnage */
#detailPanel .detail-layout{
  display:grid;
  grid-template-columns:1fr 320px;
  gap:12px;
  height:100%;
}

#detailPanel .detail-left{
  overflow-y:auto;
  max-height:calc(100vh - 140px);
  padding-right:8px;
}

#detailPanel .detail-right{
  position:sticky;
  top:0;
  align-self:start;
  max-height:calc(100vh - 140px);
  overflow-y:auto;
}

/* Vidéo en vignette */
#detailPanel .video-thumbnail{
  width:100%;
  border-radius:8px;
  margin-bottom:12px;
}

/* Responsive tablette */
@media (max-width:900px){
  #detailPanel .detail-layout{
    grid-template-columns:1fr 280px;
  }
}

/* Responsive mobile */
@media (max-width:768px){
  .dialogue{
    left:8px !important;
    right:8px !important;
    padding:14px 16px !important;
    font-size:0.95rem !important;
    flex-direction:column !important;
    gap:12px !important;
    overflow-y:auto !important;
  }
  
  .dialogue .scene-column{
    flex:0 0 auto !important;
    width:100% !important;
    max-height:180px !important;
    order:-1 !important;
  }
  
  .dialogue .scene-column img{
    max-height:140px !important;
    width:auto !important;
    margin:0 auto !important;
    display:block !important;
  }
  
  .dialogue .text-column{
    flex:1 !important;
    width:100% !important;
    overflow-y:auto !important;
  }
  
  .journal{
    width:calc(100% - 32px);
    right:16px;
    left:16px;
  }
  
  button{
    padding:10px 16px;
  }
  
  /* Panneau de détail en colonne sur mobile */
  #detailPanel .detail-layout{
    grid-template-columns:1fr;
    grid-template-rows:auto 1fr;
  }
  
  #detailPanel .detail-right{
    position:fixed;
    top:auto;
    bottom:0;
    left:0;
    right:0;
    max-height:180px;
    border-radius:12px 12px 0 0;
    background:rgba(22,33,62,0.98);
    border-top:2px solid var(--gold);
    padding:12px;
    z-index:1001;
    box-shadow:0 -4px 20px rgba(0,0,0,0.5);
  }
  
  #detailPanel .detail-left{
    max-height:none;
    padding-bottom:450px;
    overflow-y:auto;
  }
  
  /* Vidéo en petite vignette sur mobile */
  #detailPanel .video-thumbnail{
    width:80px;
    height:60px;
    object-fit:cover;
    float:left;
    margin-right:12px;
    margin-bottom:8px;
  }
  
  /* Jauges compactes sur mobile */
  #detailPanel .gauges-compact{
    display:flex;
    gap:8px;
  }
  
  #detailPanel .gauges-compact .gauge-item{
    flex:1;
    text-align:center;
  }
  
  #detailPanel .gauges-compact .gauge-bar{
    height:8px;
  }
  
  #detailPanel .gauges-compact .gauge-label{
    font-size:0.7rem;
  }
}

/* Animation shake pour alertes de danger */
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: translate(-52%, -50%) rotate(-1deg); }
  20%, 40%, 60%, 80% { transform: translate(-48%, -50%) rotate(1deg); }
}

/* Alerte de danger */
.danger-alert {
  animation: shake 0.5s ease;
}

.danger-alert strong {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.danger-alert p {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Modal de confirmation pour points de non-retour */
.irreversible-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

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

.irreversible-modal {
  background: linear-gradient(180deg, rgba(40,20,20,0.98) 0%, rgba(30,15,15,0.98) 100%);
  border: 2px solid #ff6b6b;
  border-radius: 16px;
  padding: 30px 40px;
  max-width: 450px;
  text-align: center;
  box-shadow: 0 0 60px rgba(255,100,100,0.3);
  animation: modalPulse 2s ease infinite;
}

@keyframes modalPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(255,100,100,0.3); }
  50% { box-shadow: 0 0 60px rgba(255,100,100,0.5); }
}

.irreversible-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.irreversible-modal h3 {
  color: #ff6b6b;
  margin: 0 0 16px 0;
  font-size: 1.5rem;
}

.irreversible-modal p {
  color: #eaeaea;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.irreversible-modal .choice-preview {
  color: var(--gold);
  font-style: italic;
  padding: 12px;
  background: rgba(255,201,71,0.1);
  border-radius: 8px;
  margin: 16px 0;
}

.irreversible-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.irreversible-buttons button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}

.irreversible-buttons .btn-cancel {
  background: rgba(100,100,100,0.5);
  border: 1px solid #666;
  color: #ccc;
}

.irreversible-buttons .btn-cancel:hover {
  background: rgba(100,100,100,0.7);
}

.irreversible-buttons .btn-confirm {
  background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
  border: none;
  color: #fff;
}

.irreversible-buttons .btn-confirm:hover {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  transform: scale(1.02);
}

/* Compte à rebours (étape 9.3) */
.countdown-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgba(59,130,246,0.3) 0%, rgba(37,99,235,0.4) 100%);
  border: 2px solid #3b82f6;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #60a5fa;
  animation: pulse 1s ease infinite;
}

.countdown-timer.countdown-urgent {
  background: linear-gradient(135deg, rgba(239,68,68,0.3) 0%, rgba(220,38,38,0.4) 100%);
  border-color: #ef4444;
  color: #f87171;
  animation: urgentPulse 0.5s ease infinite;
}

.countdown-icon {
  font-size: 1.3rem;
}

.countdown-value {
  font-size: 1.5rem;
  min-width: 30px;
  text-align: center;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes urgentPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

/* ========== P4b — Feedback pédagogique (mascotte) ========== */

.feedback-overlay {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: feedbackSlideIn 0.35s ease-out;
  pointer-events: auto;
  margin: 12px 0;
  max-width: 100%;
}

.feedback-mascotte {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gold, #ffc947);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  box-shadow: 0 3px 16px rgba(255,201,71,0.5);
  cursor: pointer;
}

.feedback-bubble {
  background: rgba(22,33,62,0.96);
  border: 1px solid rgba(74,111,165,0.5);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--fg, #eaeaea);
  font-size: 0.85rem;
  line-height: 1.5;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  cursor: pointer;
  position: relative;
  max-width: 340px;
}

.feedback-bubble::after {
  content: '';
  position: absolute;
  top: 14px;
  left: -8px;
  width: 0; height: 0;
  border-right: 8px solid rgba(22,33,62,0.96);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.feedback-impact {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-weight: bold;
  font-size: 0.8rem;
}

.feedback-impact span {
  white-space: nowrap;
}

.impact-pos { color: #4ade80; }
.impact-neg { color: #f87171; }
.impact-zero { color: #8892a0; }

.feedback-text {
  color: #c9d1d9;
  font-style: italic;
}

.feedback-dismiss {
  display: block;
  text-align: right;
  margin-top: 6px;
  font-size: 0.7rem;
  color: var(--muted, #8892a0);
}

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

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

@media (max-width: 600px) {
  .feedback-overlay { flex-direction: column; align-items: flex-start; }
  .feedback-bubble { max-width: none; }
  .feedback-bubble::after { display: none; }
  .feedback-mascotte { width: 40px; height: 40px; font-size: 1.2rem; }
}
