/*
  FILE: style.css
  GROUP: Styling / Theme

  Notes:
  - SAFE TO EDIT: color variables in :root (change --bg1, --bg2, --accent), spacing and font-size values,
    sizes for #gameImage, .click-btn styles, and responsive breakpoints.
  - SAFE TO ADD: new classes for skins/themes and small animations.
  - CAUTION: don't remove or rename classes/IDs used by script (eg: .sound-controls, #gameImage, #particlesCanvas,
    #clickZone, .cps-indicator) unless you also update `script.js`.
*/

:root {
  --bg1: #707070;
  --bg2: #a877e375;
  --accent: #ffcc00;
  --text: #ffffff;
  --panel: rgba(255,255,255,0.12);
}

body {
  margin: 0;
  font-size: 20px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: auto;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toggle {
  display: inline-flex;
  gap: 6px;
  background: var(--panel);
  padding: 6px 10px;
  border-radius: 8px;
  align-items: center;
}

select, button, input[type="text"] {
  font-size: 1rem;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
}

.butt {
  color: white;
  background-color: rgb(62, 57, 57);
  transition: all 0.3s ease; 
}

.butt:hover {
  background-color: rgb(62, 57, 57);
  transform: scale(1.2);
}

.butt:active {
  transform: scale(1.1); 
}


button {
  cursor: pointer;
}

#pseudoForm {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 100px;
}

#gameArea {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 12px;
}

.hud {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
}

#score {
  font-size: 1.6rem;
  font-weight: 700;
}

#stats {
  display: flex;
  gap: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.play {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

#clickZone {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;
}

#particlesCanvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.click-btn {
  background-color: #fff;
  color: #6e8efb;
  font-size: 1.6rem;
  padding: 16px 28px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  transition: transform 0.08s ease;
  margin-top: 8px;
}
.click-btn:active { transform: scale(0.96); }

/* Hide the visible click button to avoid hold-to-spam exploit; image is clickable instead */
.click-btn { opacity: 0; height: 0; padding: 0; margin: 0; pointer-events: none; }

.press-hint {
  margin-top: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
}

.shop {
  display: grid;
  gap: 8px;
}

.upgrade-btn {
  padding: 12px;
  background: var(--accent);
  color: #333;
  border-radius: 10px;
  font-weight: 700;
  transition: filter 0.2s;
}
.upgrade-btn:hover { filter: brightness(1.1); }
.upgrade-btn.prestige { background: var(--accent); }

#modes {
  display: grid;
  gap: 12px;
}

.mode-timed, .daily {
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
}

#events {
  position: relative;
}

.bonus {
  position: absolute;
  right: 12px;
  top: -8px;
  background: #00d48f;
  color: #203;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(0,0,0,0.25);
}

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #111a;
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.25);
  z-index: 1000;
}

#achievements, #scoreboard {
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
}

#achievementList, #scoreList {
  margin: 0;
  padding-left: 18px;
}

/* Scoreboard entries: name left, score right */
#scoreList li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

/* Export/import controls layout */
.save-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

#gameImage {
  width: 150px;
  height: 150px;
  object-fit: contain;
  user-select: none;
  transition: transform 160ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
}

/* CPS indicator */
.cps-indicator {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.4);
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 800;
}

.volume-controls { display:none; }

/* small confetti placeholder */
.confetti { position: absolute; pointer-events:none; }

/* Thèmes */
.theme-normal { --bg1: #707070; --bg2: #a877e375; --accent: #ff00ea; }
.theme-feu { --bg1: #ff512f; --bg2: #dd2476; --accent: linear-gradient(234deg,rgba(255, 217, 0, 1) 0%, rgba(255, 149, 0, 1) 23%, rgba(191, 0, 0, 1) 68%, rgba(255, 0, 0, 1) 87%); }
.theme-glace  { --bg1: #00c6ff; --bg2: #0072ff; --accent: linear-gradient(234deg,rgba(62, 152, 156, 1) 0%, rgba(69, 161, 150, 1) 17%, rgba(0, 255, 229, 1) 54%, rgb(255, 255, 255)); }
.theme-BW { --bg1: #272727; --bg2: #d4d4d4; --bg3: #ffffff; --accent: linear-gradient(234deg,rgb(255, 255, 255) 24%, rgb(176, 176, 176) 40%, rgba(0, 0, 0, 1) 69%);}

.custom-select {
  position: relative;
  width: max-content;
  user-select: none;
  font-family: sans-serif;
  margin-right: 10px;
}

.custom-select .selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel, #eee);
  cursor: pointer;
}

.custom-select img {
  width: 70px;
  height: 15px;
}

.custom-select .options {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--panel, #eee);
  border-radius: 8px;
  margin: 4px 0 0;
  padding: 10px;
  list-style: none;
  z-index: 10;

  /* Animation des thèmes */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.custom-select.open .options {
  max-height: 500px; 
  opacity: 1;
}

.custom-select .options li {
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.custom-select.open .options {
  display: block;
}

#keySelect {
  padding: 8px 12px;
  color: rgb(255, 255, 255);
  font-weight: 900;
  border-radius: 8px;
  border: none;
  background: var(--panel, rgba(255,255,255,0.1)); 
  font-family: inherit;    
  font-size: 1rem;
  cursor: pointer;
  width: max-content;     
  margin-right: 10px; 
}

@media (max-width: 900px) {
  #gameArea {
    grid-template-columns: 1fr;
  }
}

.bonus-popup {
  position: fixed;
  top: 20px;
  left: 20px;
  background: #00d48f;
  color: #203;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: bold;
  box-shadow: 0 8px 16px rgba(0,0,0,0.25);
  z-index: 1000;
  display: none;
  animation: fadeInOut 3s ease forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-10px); }
  10% { opacity: 1; transform: translateY(0); }
  90% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Style pour les switch*/
.toggle-switch {
  display: flex;
  align-items: center;
  position: relative;
  margin-right: 15px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  width: 50px;
  height: 24px;
  background-color: #ccc;
  border-radius: 24px;
  transition: background-color 0.4s;
  margin-right: 8px;
}

.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background-color: white;
  border-radius: 50%;
  bottom: 3px;
  left: 3px;
  transition: transform 0.4s;
}

input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.container {
  width: 90%;   /* instead of 1200px */
  font-size: 1rem; /* scales better */
}

.wrapper {
  display: flex;
  flex-wrap: wrap;
}

.card {
  flex: 1 1 300px; /* grows/shrinks, min width 300px */
  margin: 10px;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* Hide touch controls by default */
#touchControls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
}

/* Style the buttons */
#touchControls button {
  font-size: 24px;
  margin: 5px;
  padding: 15px 20px;
  border-radius: 10px;
  border: none;
  background: #333;
  color: white;
}

/* Show controls only on tablets/phones */
@media (max-width: 1024px) {
  #touchControls {
    display: block;
  }
}
@media screen and (min-width: 80rem) {
  .container {
    margin: 1em 2em;
  }
}