:root {
  --bg: #222;
  --text: #eee;
  --btn-bg: #3498db;
  --btn-active: #1abc9c;
  --border: #3498db;
}

:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --btn-color: #e0e0e0;
  --btn-hover: #cccccc;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

button {
  background-color: var(--btn-color);
  color: var(--text-color);
  transition: background 0.3s;
}

button:hover {
  background-color: var(--btn-hover);
}

#shopModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#shopModal .modalContent {
  background: var(--bg);
  color: var(--text);
  padding: 20px;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  position: relative;
}


body.light {
  --bg: #f0f0f0;
  --text: #222;
  --btn-bg: #2980b9;
  --btn-hover: #3498db;
  --btn-active: #16a085;
  --border: #2980b9;
}

/* Styles de base */
body {
  margin: 0;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Orbitron', sans-serif;
  min-height: 100vh;
  box-sizing: border-box;
  background: var(--bg);
  color: var(--text);
}

h1 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  text-align: center;
  margin-bottom: 15px;
}

#controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 15px;
  width: 100%;
  max-width: 600px;
}

button, select {
  padding: 8px 12px;
  font-size: clamp(0.8rem, 3vw, 1rem);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--btn-bg);
  color: white;
  transition: background-color 0.3s ease;
  flex: 1 1 auto;
  min-width: 80px;
  max-width: 150px;
}

#targetBtn:hover {
  background: var(--btn-hover, #555); /* gris foncé par défaut si non défini */
}



#gameArea {
  position: relative;
  width: 90vw;
  height: 90vw;
  max-width: 500px;
  max-height: 500px;
  margin: 20px 0;
  border: 2px solid var(--border);
  border-radius: 15px;
  background: #111;
  overflow: hidden;
}

#gameArea.small {
  width: 80vw;
  height: 80vw;
  max-width: 200px;
  max-height: 200px;
}

#gameArea.medium {
  width: 90vw;
  height: 90vw;
  max-width: 300px;
  max-height: 300px;
}

#gameArea.large {
  width: 95vw;
  height: 60vh;
  max-width: 1500px;
  max-height: 800px;
}

body.light #gameArea {
  background: #ddd;
  border-color: var(--btn-bg);
}

#targetBtn {
  position: absolute;
  width: 70px;
  height: 70px;
  cursor: pointer;
}


/* Skins styles */
.skin-1 { background: #3498db; box-shadow: 0 0 10px #3498db; border-radius: 50%; }
.skin-2 { background: #e74c3c; box-shadow: 0 0 10px #e74c3c; border-radius: 50%; }
.skin-3 { background: #2ecc71; box-shadow: 0 0 10px #2ecc71; border-radius: 20%; }
.skin-4 { background: linear-gradient(45deg, #f1c40f, #e67e22); box-shadow: 0 0 15px #f39c12; border-radius: 50%; }
.skin-5 { background: #9b59b6; box-shadow: 0 0 15px #8e44ad; border-radius: 0%; }
.skin-6 { background: #34495e; box-shadow: 0 0 15px #2c3e50; border-radius: 10%; }
.skin-7 { background: #1abc9c; box-shadow: 0 0 15px #16a085; border-radius: 50%; }
.skin-8 { background: #FF1178; box-shadow: 0 0 15px pink; border-radius: 50%; }
.skin-9 { background: #FFF205; box-shadow: 0 0 15px goldenrod; border-radius: 50%; }
.skin-10 {
  background: linear-gradient(270deg, #ff0080, #ff8c00, #40e0d0, #8a2be2, #ff0080);
  background-size: 600% 600%;
  animation: rainbowShift 5s ease infinite;
  box-shadow: 0 0 15px white;
  border-radius: 50%;
}

#status {
  font-size: clamp(1rem, 3vw, 1.2rem);
  min-height: 1.5em;
  text-align: center;
  margin: 10px 0;
}

#goldDisplay {
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  margin: 10px 0;
  font-weight: bold;
  text-align: center;
}

#scoreboard {
  margin-top: 15px;
  width: 90vw;
  max-width: 500px;
  text-align: left;
}

#scoreboard h3 {
  margin-bottom: 5px;
  font-size: clamp(1rem, 3vw, 1.2rem);
}

#scoreboard ol {
  padding-left: 20px;
}

.default.green { background-color: #2ecc71; }
.default.red { background-color: #e74c3c; }

.pixels.green { background-image: url(...); }

/* Boutique */
#shopModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--text);
  border-radius: 15px;
  padding: 20px;
  width: 90vw;
  max-width: 350px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
  display: none;
  flex-direction: column;
  z-index: 10;
}

.shopItem.locked::after,
.colorItem.locked::after,
.emojiItem.locked::after {
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  font-size: 0.9rem;
  color: #f39c12;
  bottom: -22px;
}

@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.colorItem:last-child {
  background: linear-gradient(270deg, #ff0080, #ff8c00, #40e0d0, #8a2be2, #ff0080);
  background-size: 600% 600%;
  animation: rainbowShift 5s ease infinite;
  color: white;
  box-shadow: 0 0 20px #fff;
  border: 3px solid black;
}

.skin-animated {
  background: linear-gradient(270deg, #ff0080, #ff8c00, #40e0d0, #8a2be2, #ff0080);
  background-size: 600% 600%;
  animation: rainbowShift 5s ease infinite;
  box-shadow: 0 0 20px white;
  border-radius: 50%;
}

#shopModal.light {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

#shopModal h2 {
  margin-top: 0;
}

#shopItems {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.shopItem {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: 0 0 10px #999;
  transition: border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 0.8rem;
  color: white;
  user-select: none;
}



#shopTabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}

.tabBtn {
  padding: 8px 15px;
  font-size: 1rem;
  background: var(--btn-bg);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.tabBtn.active {
  background: var(--btn-active);
  box-shadow: 0 0 10px var(--btn-active);
}

.shopTab {
  display: none;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.shopTab.active {
  display: flex;
}


.shopItem.selected {
  border-color: #f39c12;
  box-shadow: 0 0 20px #f39c12;
}

.shopItem.skin-1 { background: #3498db; box-shadow: 0 0 10px #3498db; }
.shopItem.skin-2 { background: #e74c3c; box-shadow: 0 0 10px #e74c3c; }
.shopItem.skin-3 { background: #2ecc71; box-shadow: 0 0 10px #2ecc71; border-radius: 20%; }
.shopItem.skin-4 { background: linear-gradient(45deg, #f1c40f, #e67e22); box-shadow: 0 0 15px #f39c12; }
.shopItem.skin-5 { background: #9b59b6; box-shadow: 0 0 15px #8e44ad; border-radius: 0%; }

#closeShop {
  margin-top: 15px;
  background: #c0392b;
}

/* Modaux pour Couleurs et Émojis */
#colorsModal, #emojisModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--text);
  border-radius: 15px;
  padding: 15px;
  width: 90vw;
  max-width: 350px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 15px rgba(0,0,0,0.7);
  display: none;
  flex-direction: column;
  z-index: 10;
}

#colorsModal.light, #emojisModal.light {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

#colorItems, #emojiItems {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.colorItem, .emojiItem {
  width: calc(33% - 10px);
  max-width: 90px;
  height: 0;
  padding-bottom: calc(33% - 10px);
  max-padding-bottom: 90px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  box-shadow: 0 0 10px #999;
  transition: border-color 0.3s ease;
  position: relative;
  font-size: 1.8rem;
  color: white;
  user-select: none;
}

.colorItem > *, .emojiItem > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emojiItem {
  background: #444;
}

.colorItem.selected, .emojiItem.selected {
  border-color: #f39c12;
  box-shadow: 0 0 20px #f39c12;
}

#closeColors, #closeEmojis {
  margin-top: 15px;
  background: #c0392b;
}

/* Media queries pour les ajustements selon les tailles d'écran */
@media (max-width: 480px) {
  button, select {
    padding: 8px;
    min-width: 70px;
  }

  .shopItem {
    width: 45px;
    height: 45px;
  }

  .colorItem, .emojiItem {
    width: calc(50% - 10px);
    padding-bottom: calc(50% - 10px);
  }

  #targetBtn {
    width: 60px;
    height: 60px;
  }
}

@media (min-width: 768px) {
  #controls {
    gap: 12px;
  }

  button, select {
    flex: 0 1 auto;
  }

  .colorItem, .emojiItem {
    width: 90px;
    height: 90px;
    padding-bottom: 0;
  }
}
