body {
  font-family: 'Segoe UI', Roboto, sans-serif;
  padding: 20px;
  min-height: 100vh;
  margin: 0;
  background-color: #121212;
  color: #e0e0e0;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* --- LOGO NÉON --- */
#neon-logo {
  position: absolute;
  top: 30px;
  left: 40px; 
  right: auto;
  font-family: 'Vibur', cursive;
  font-size: 3.5em;
  line-height: 0.8em;
  color: #fff;
  transform: rotate(-10deg);
  z-index: 100;
  pointer-events: none;
  text-align: center;
  animation: flicker 60s infinite;
  text-shadow: 0 0 2px #fff, 0 0 10px #fff, 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0;
}

#neon-logo span { display: block; }
#neon-logo .sub { font-size: 0.7em; margin-left: 15px; }

@keyframes flicker {
  0%, 96% { opacity: 1; text-shadow: 0 0 2px #fff, 0 0 10px #fff, 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0; }
  96.5%, 97.5%, 98.5% { opacity: 0.8; text-shadow: none; }
  97%, 98%, 99%, 100% { opacity: 1; text-shadow: 0 0 2px #fff, 0 0 10px #fff, 0 0 20px #0f0, 0 0 30px #0f0, 0 0 40px #0f0; }
}

/* --- ECRAN DE CHARGEMENT --- */
#loading-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(18, 18, 18, 0.9);
  z-index: 2000;
  display: flex; 
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #81c784;
  font-family: 'Segoe UI', sans-serif;
  font-weight: bold;
  font-size: 1.2em;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(129, 199, 132, 0.3);
  border-radius: 50%;
  border-top-color: #81c784;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- CONTENEUR BOUTONS --- */
.header-buttons {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px;
  z-index: 200;
  align-items: center;
}

#countdown, #winners-count {
  background: #1e1e1e;
  border: 1px solid #81c784;
  color: #81c784;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
  height: 22px;
  display: flex;
  align-items: center;
}

/* --- STYLE DES BOUTONS --- */
#share-btn, #giveup-btn, #leaderboard-btn {
  background-color: #1e1e1e;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Segoe UI', sans-serif;
  font-weight: bold;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px; 
  border: 1px solid;
}

#share-btn {
  color: #81c784;
  border-color: #81c784;
}
#share-btn:hover { background-color: #81c784; color: #121212; }

#giveup-btn {
  color: #ff6b6b;
  border-color: #ff6b6b;
}
#giveup-btn:hover { background-color: #ff6b6b; color: #121212; }

#leaderboard-btn {
  color: #81c784;
  border-color: #81c784;
}
#leaderboard-btn:hover { background-color: #81c784; color: #121212; }

/* MODAL */
.modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
}

.modal-content {
  background-color: #1e1e1e;
  margin: 10% auto;
  padding: 20px;
  border: 1px solid #81c784;
  width: 80%;
  max-width: 600px;
  border-radius: 8px;
  position: relative;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.leaderboard-header button {
  background: transparent;
  border: 1px solid #81c784;
  color: #81c784;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.leaderboard-header button:hover {
  background: #81c784;
  color: #1e1e1e;
}

.close {
  color: #aaa;
  position: absolute;
  right: 20px;
  top: 10px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover { color: #fff; }

#leaderboard-title { text-align: center; margin: 0 0 10px 0; }

.lb-action-btn {
  background-color: #1e1e1e;
  color: #81c784;
  border: 1px solid #81c784;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}
.lb-action-btn:hover { background-color: #81c784; color: #121212; }
.lb-play-btn { border-color: #81c784; }
.lb-giveup-btn { color: #ff6b6b; border-color: #ff6b6b; }
.lb-giveup-btn:hover { background-color: #ff6b6b; color: #121212; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.cal-weekday {
  text-align: center;
  font-weight: bold;
  color: #81c784;
  font-size: 0.85em;
  padding: 4px 0;
}
.cal-cell {
  background: #2c2c2c;
  border: 1px solid #444;
  border-radius: 6px;
  min-height: 58px;
  padding: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-cell.cal-today { border-color: #ffeb3b; box-shadow: 0 0 6px rgba(255, 235, 59, 0.5); }
.cal-cell.cal-future { opacity: 0.4; }
.cal-cell.cal-playable { cursor: pointer; border-color: #81c784; }
.cal-cell.cal-playable:hover { background: #3a3a3a; }
.cal-daynum { font-weight: bold; font-size: 1.05em; }
.cal-meta { font-size: 0.8em; color: #ccc; }

#leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

#leaderboard-table th, #leaderboard-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
}

#leaderboard-table th {
  color: #81c784;
}

.replay-btn {
  background-color: #1e1e1e;
  color: #81c784;
  border: 2px solid #81c784;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 1.1em;
  font-weight: bold;
  margin-top: 15px;
  display: inline-block;
}
.replay-btn:hover { background-color: #81c784; color: #121212; }

/* Zone de jeu */
#game-area {
  margin-bottom: 30px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  transition: padding-top 0.3s;
}

#victory-message {
  font-size: 1.4em;
  font-weight: bold;
  color: #81c784;
  margin-bottom: 8px;
  text-align: center;
  display: none;
}

/* --- TITRE EDITABLE --- */
#title {
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: baseline; 
}

.title-wrapper {
  position: relative;
  display: inline-block;
}

.length, .length-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #888;
  font-size: 0.7em;
  pointer-events: none;
  font-family: 'Segoe UI', Roboto, sans-serif;
  font-weight: normal; 
}
.length { top: -0.2em; }
.length-indicator { top: -0.6em; }

/* Style des inputs */
.game-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid #555;
  color: #ffeb3b; 
  font-size: 1.1em; 
  font-weight: bold;
  font-family: 'Segoe UI', Roboto, sans-serif;
  text-align: center;
  padding: 0;
  margin: 0 2px;
  transition: border-color 0.3s, color 0.3s, background-color 0.3s;
  border-radius: 0;
}

.game-input:focus {
  outline: none;
  border-bottom-color: #ffeb3b;
  background-color: rgba(255, 235, 59, 0.1);
}

.game-input.correct {
  border-bottom-color: #81c784;
  color: #81c784;
  background-color: transparent;
  border-bottom-style: solid; 
}

/* Style titre/texte */
#title .game-input { font-size: 1.5em; margin-bottom: 5px; }
#game .game-input { font-size: 1.1em; line-height: 1.1em; height: 1.4em; }

#wiki-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin: 0 auto 15px auto;
  display: block; 
  border: 2px solid transparent;
  transition: border-color 0.3s;
}

#wiki-img-link { 
  display: inline-block; 
  text-decoration: none; 
  pointer-events: none; 
  cursor: default;
}
#wiki-img-link.active {
  pointer-events: auto;
  cursor: pointer;
}
#wiki-img-link.active:hover #wiki-image { border-color: #81c784; }

.img-container { text-align: center; display: none; margin-bottom: 15px; }

#errors { margin-bottom: 15px; font-weight: bold; color: #ff6b6b; text-align: center; }

#game { 
  line-height: 2.5em; 
  user-select: none; 
  word-break: break-word; 
  font-size: 1.1em;
  text-align: justify;
}

/* Slots INVENTAIRE */
.word-slot {
  position: relative;
  display: inline-block;
  min-width: 30px;
  text-align: center;
  line-height: 1.1em; 
  padding: 3px 5px;   
  margin: 2px 1px;    
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  transition: background-color 0.2s;
  background-color: #1e1e1e;
  color: #e0e0e0;
  vertical-align: middle;
  border: 1px solid transparent;
}

.word-slot.correct { cursor: default; color: #81c784; font-weight: 500; }
.word-slot.selected { background-color: #333333; box-shadow: 0 0 6px #81c784; border-color: #81c784; }
.word-slot.drag-over { background-color: #444; border: 1px dashed #aaa; }

.error-badge {
  position: absolute;
  top: -0.6em; right: -0.4em; font-size: 0.6em; 
  color: #ff4444; font-weight: bold; cursor: help;
  display: none; z-index: 10; padding: 1px 3px;
  background-color: #121212; border-radius: 50%;
  box-shadow: 0 0 2px rgba(0,0,0,0.5); line-height: 1;
}

#custom-tooltip {
  position: fixed; display: none;
  background-color: #2c2c2c; border: 1px solid #ff4444;
  color: #ff6b6b; padding: 8px 12px; border-radius: 4px;
  font-size: 0.9em; box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  pointer-events: none; z-index: 1000; max-width: 250px;
  word-wrap: break-word; text-align: left; line-height: 1.4em;
}

.mask { letter-spacing: 2px; }

#inventory { max-width: 1500px; margin: 0 auto; border-top: 1px solid #333; padding-top: 20px; }
#inventory-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 15px; align-items: start; }
.inv-column { background-color: #1e1e1e; border-radius: 8px; overflow: hidden; border: 1px solid #333; }
.inv-header { background-color: #2c2c2c; padding: 8px; text-align: center; font-weight: bold; color: #81c784; border-bottom: 1px solid #333; font-size: 0.9em; }
.inventory-word { padding: 6px 10px; cursor: grab; font-size: 1.1em; border-bottom: 1px solid #252525; transition: background 0.2s; display: flex; justify-content: space-between; }
.inventory-word:active { cursor: grabbing; }
.inventory-word:last-child { border-bottom: none; }
.inventory-word:hover { background-color: #3a3a3a; }
.inventory-word.tried { text-decoration: line-through; text-decoration-color: #ff4444; text-decoration-thickness: 2px; opacity: 0.5; background-color: #251e1e; }
.count-badge { color: #aaa; font-size: 0.85em; margin-left: 5px; pointer-events: none; }

.error-flash { animation: flashRed 0.3s ease 2; }
@keyframes flashRed { 0%,100%{background:transparent;}50%{background:#ff4444;} }
.victory-flash { animation: victoryGreen 1s ease 4 alternate; }
@keyframes victoryGreen { from{background:transparent;} to{background:#4caf50;} }
.shake { animation: shake 0.3s ease-in-out; }
@keyframes shake { 0% { transform: translateX(0); } 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-4px); } 100% { transform: translateX(0); } }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 600px) {
  #neon-logo { font-size: 1.8em; top: 15px; left: 15px; }
  
  .header-buttons {
    top: 20px;
    right: 15px;
    gap: 6px; 
  }
  
  #share-btn, #giveup-btn {
    font-size: 1.2em;
    padding: 6px 10px;
  }
  
  .btn-text { display: none; }
  #game-area { padding-top: 80px; }
  .game-input { min-width: 40px; }
}
