/* Variables CSS globales */
:root {
  /* Couleurs UNO */
  --uno-red: #ff1a1a;
  --uno-blue: #0066cc;
  --uno-green: #00cc44;
  --uno-yellow: #ffcc00;
  --uno-black: #1a1a1a;
  
  /* Variables existantes */
  --card-width-desktop: 100px;
  --card-width-mobile: 60px;
  --spacing-large: 100px;
  --spacing-medium: 50px;
  --spacing-small: 10px;
  --border-radius: 10px;
}

html {
  font-size: 62.5%;
}

body {
  box-sizing: border-box;
  background: var(--uno-black);
  position: relative;
  overflow-x: hidden;
  padding: var(--spacing-medium) 0;
  font-family: 'Avenir Next', sans-serif;
  display: flex;
  flex-direction: column;
}

/* Effet de fond dynamique */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 20%, var(--uno-red) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, var(--uno-blue) 0%, transparent 40%),
    radial-gradient(circle at 80% 20%, var(--uno-yellow) 0%, transparent 40%),
    radial-gradient(circle at 20% 80%, var(--uno-green) 0%, transparent 40%);
  opacity: 0.15;
  z-index: -1;
}

/* Reset et base */
*,
*::after,
*::before {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

.play-area {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-medium);
  margin: var(--spacing-small) 0;
}

.cpu-box, .player-box {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: var(--spacing-small);
  gap: var(--spacing-small);
}

.score {
    display: flex;
    flex-direction: column;
    margin: auto 0;
    color: rgb(6, 37,62);
    font-size: x-large;
}

#seperator {
    margin: 10px 0;
    border: 2px solid rgb(8, 81, 140);
}

.player-box {
    display: flex;
    justify-content: center;
    margin-top: 100px;
}

/* Animation des cartes */
img {
  width: var(--card-width-desktop);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-hand img:hover {
  transform: scale(1.08) translateY(-12px) rotate(2deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  transition: all 0.1s ease-in-out;
  cursor: pointer;
}

.player-hand img {
    transition: all 0.1s ease-in-out;
}

.draw-pile img:hover {
    transform: scale(1.1);
    transition: all 0.1s ease-in-out;
    cursor: pointer;
}

.draw-pile img {
    transition: all 0.1s ease-in-out;
}

#draw-card {
    position: absolute;
    right: 19vw;
    z-index: 2;
}

.player-draw {
    transform: translateY(260px) translateX(-100px);
    transition: all 0.2s ease-in-out;
}

.cpu-draw {
    transform: translateY(-260px) translateX(-100px);
    transition: all 0.2s ease-in-out;
}

.player-animation {
    position: absolute;
    z-index: 2;
    left: 75vw;
    top: 600px;
}

.cpu-animation {
    position: absolute;
    z-index: 2;
    left: 75vw;
    top: 100px;
}

.play-card {
  animation: playCard 0.3s ease-out;
}

@keyframes playCard {
  0% { transform: translateY(0) rotate(0); }
  100% { transform: translateY(-260px) rotate(360deg); }
}

.hidden {
    display: none;
}

.shout img {
    transform: scale(3.5);
    transition: all 0.1s ease-in-out;
    border-radius: 0px;
    box-shadow: none;
}

.player-animation img {
    border-radius: 0px;
    box-shadow: none;
    transition: all 1s ease-in-out;
}

.cpu-animation img {
    border-radius: 0px;
    box-shadow: none;
    transition: all 1s ease-in-out;
}

.end-of-round {
    position: absolute;
    z-index: 2;
    top: 40vh;
    left: 35vw;
    width: 30vw;
    margin: auto;
    font-size: xx-large;
    padding: 100px;
    padding-top: 50px;
    border: 5px solid #00eaff;
    border-radius: 20px;
    padding: 10px;
    background-color: black;
    opacity: 0.9;
}

.end-of-game {
    position: absolute;
    z-index: 2;
    top: 37vh;
    left: 30vw;
    width: 40vw;
    margin: auto;
    font-size: xx-large;
    padding: 100px;
    padding-top: 50px;
    border: 5px solid #00eaff;
    border-radius: 20px;
    padding: 10px;
    background-color: black;
    opacity: 0.9;
}

.end-of-round p {
    color: #00eaff;
    text-align: center;
}

.end-of-game p {
    color: #00eaff;
    text-align: center;
}

.end-of-game button {
    background-color: greenyellow;
    color: black;
    margin-left: 14vw;
    margin-top: 10px;
    
}

.color-picker {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-content: center;
    width: 60vw;
    margin: auto;
    margin-top: 20px;
    text-align: center;
    opacity: 0;
    background: rgba(26, 26, 26, 0.95);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.color-picker p {
    color: rgb(134, 174, 204);
    font-size: large;
}

.color-picker button {
  height: 40px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

button {
    height: 3vh;
    width: 10vw;
    color: white;
    border-radius: 10px;
    transition: all 0.1s ease-in-out;
    background: linear-gradient(45deg, var(--uno-red), var(--uno-blue));
    border: none;
    font-weight: bold;
    text-transform: uppercase;
    padding: 10px 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: linear-gradient(45deg, var(--uno-blue), var(--uno-red));
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease-in-out;
    cursor: pointer;
}

.red {
    background-color: red;
}

.green {
    background-color: green;
}

.blue {
    background-color: blue;
}

.yellow {
    background-color: yellow;
    color: black;
}

.player-uno img {
    border-radius: 0px;
    box-shadow: none;
}

.cpu-uno img {
    border-radius: 0px;
    box-shadow: none;
}

.empty {
    width: 100px;
    margin-left: -28px;
    border-radius: 10px;
    box-shadow:  none;
}

@media (max-width: 1024px) {
  :root {
    --card-width-desktop: 80px;
    --spacing-large: 60px;
  }
}

@media (max-width: 812px) {
  :root {
    --card-width-desktop: var(--card-width-mobile);
    --spacing-large: 30px;
  }

  body {
    padding: var(--spacing-small);
  }

  .play-area {
    flex-direction: column;
  }

  .score {
    font-size: 1.6rem;
    text-align: center;
    margin: var(--spacing-small) 0;
  }

  .color-picker {
    width: 90vw;
  }

  button {
    width: 100%;
    max-width: 200px;
    margin: 5px auto;
  }
}

@media (max-width: 480px) {
  :root {
    --card-width-mobile: 50px;
  }

  .end-of-round, .end-of-game {
    width: 90vw;
    left: 5vw;
    padding: var(--spacing-small);
  }

  .player-animation, .cpu-animation {
    left: 50vw;
    transform: translateX(-50%);
  }
}

/* Optimisations tactiles */
@media (hover: none) {
  .player-hand img:hover {
    transform: none;
  }

  .player-hand img:active {
    transform: scale(1.05) translateY(-8px);
  }
}

/* Score et éléments UI */
.score {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  background: rgba(0, 0, 0, 0.6);
  padding: 15px;
  border-radius: var(--border-radius);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Écrans de fin */
.end-of-round, .end-of-game {
  background: rgba(0, 0, 0, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 3px solid var(--uno-yellow);
  box-shadow: 0 0 30px rgba(255, 204, 0, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.cpu-score-title, .player-score-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    margin: 0.5rem 0;
}

.rules {
    font-size: 1.4rem;
    font-style: italic;
    color: #cccccc;
    margin-top: 1rem;
    text-align: center;
}

#separator {
    margin: 1rem 0;
    border: 2px solid var(--uno-blue);
    border-radius: 2px;
}