@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%; /* 1rem = 10px */
}

body {
  font-family: 'Nunito', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  color: #e0e6ed;
  background: linear-gradient(
    135deg,
    #0f0f23 0%,
    #1a1a2e 25%,
    #16213e 50%,
    #0f3460 75%,
    #533483 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

main {
  position: relative;
  width: 100%;
  max-width: 42rem;
  background: rgba(15, 15, 35, 0.9);
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  gap: 2rem;
}

.player {
  width: 100%;
  background: rgba(26, 26, 46, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 2rem;
  border-radius: 1.5rem;
  text-align: center;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.player::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.player:hover::before {
  left: 100%;
}

.name {
  font-size: 2.8rem;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #00d4ff;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
  letter-spacing: 0.1rem;
}

.score {
  font-size: 5rem;
  font-weight: 300;
  color: #ff6b35;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.6);
}

.player--active {
  background: rgba(0, 212, 255, 0.15);
  border: 2px solid #00d4ff;
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.player--active .name {
  font-weight: 700;
  color: #00f5ff;
  text-shadow: 0 0 15px rgba(0, 245, 255, 0.8);
}

.player--active .score {
  font-weight: 500;
  color: #ff4500;
  text-shadow: 0 0 25px rgba(255, 69, 0, 0.8);
}

.current {
  background: linear-gradient(135deg, #ff6b35, #ff4500);
  opacity: 0.9;
  border-radius: 1.2rem;
  color: #fff;
  width: 100%;
  padding: 1.5rem;
  transition: all 0.4s ease;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.current-label {
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.05rem;
}

.current-score {
  font-size: 2.8rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chances-left {
  margin-top: 1rem;
  font-size: 1.4rem;
  color: #00d4ff;
  font-weight: 500;
  text-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  margin-top: 2rem;
}

.btn {
  color: #0f0f23;
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  border: none;
  font-family: inherit;
  font-size: 1.6rem;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 1.2rem 2.4rem;
  border-radius: 3rem;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  letter-spacing: 0.05rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  background: linear-gradient(135deg, #00f5ff, #00bfff);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.4);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.btn--setchances {
  background: linear-gradient(135deg, #ff6b35, #ff4500);
  color: #fff;
}

.btn--setchances:hover {
  background: linear-gradient(135deg, #ff8c42, #ff6b35);
}

.dice {
  display: block;
  margin: 1.5rem auto;
  height: 8rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 212, 255, 0.2);
  transition: transform 0.3s ease;
  border-radius: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.dice.roll {
  transform: rotate(10deg) scale(1.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 212, 255, 0.4);
}

.player--winner {
  background: linear-gradient(
    135deg,
    rgba(255, 107, 53, 0.2),
    rgba(255, 69, 0, 0.2)
  );
  border: 2px solid #ff6b35;
  box-shadow: 0 0 40px rgba(255, 107, 53, 0.5);
}

.player--winner .name {
  font-weight: 700;
  color: #ff6b35;
  text-shadow: 0 0 20px rgba(255, 107, 53, 0.8);
}

.modal,
.game-over {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 40rem;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 3rem 2rem;
  border-radius: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.2);
  z-index: 10;
  text-align: center;
  overflow-y: auto;
  max-height: 90vh;
  color: #e0e6ed;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  z-index: 5;
}

.close-modal,
.close-gameover {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 3rem;
  color: #00d4ff;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 0.3s ease;
}

.close-modal:hover,
.close-gameover:hover {
  color: #00f5ff;
  text-shadow: 0 0 10px rgba(0, 245, 255, 0.8);
}

.winner-text {
  font-size: 2.2rem;
  color: #ff6b35;
  margin-top: 1.5rem;
  text-shadow: 0 0 15px rgba(255, 107, 53, 0.6);
  font-weight: 600;
}

p {
  font-size: 1.6rem;
  line-height: 1.6;
  color: #b8bcc5;
}

.modal h1,
.game-over h1 {
  color: #00d4ff;
  text-shadow: 0 0 15px rgba(0, 212, 255, 0.6);
  margin-bottom: 2rem;
  font-weight: 600;
}

.btn--roll:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(135deg, #666, #444);
}

.hidden {
  display: none;
}

/* Responsive for tablets and up */
@media (min-width: 600px) {
  main {
    max-width: 70rem;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 2.5rem;
    gap: 2rem;
  }

  .player {
    flex: 1 1 45%;
    padding: 3rem 2rem;
  }

  .name {
    font-size: 3.2rem;
  }

  .score {
    font-size: 6rem;
  }

  .current {
    padding: 2rem;
  }

  .current-score {
    font-size: 3rem;
  }

  .btn {
    font-size: 1.8rem;
    width: fit-content;
    margin: 0 auto;
  }

  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .dice {
    height: 10rem;
  }

  .modal,
  .game-over {
    width: 70%;
  }

  .close-modal,
  .close-gameover {
    font-size: 4rem;
  }
}

/* Additional responsive tweaks for smaller screens */
@media (max-width: 480px) {
  .btn {
    font-size: 1.4rem;
    padding: 1rem;
  }
  .dice {
    height: 6rem;
  }
  .current-score {
    font-size: 2.4rem;
  }
  .winner-text {
    font-size: 1.8rem;
  }
  .modal,
  .game-over {
    padding: 2rem 1.5rem;
  }
}

/* Custom input styling */
#chance-input {
  background: rgba(26, 26, 46, 0.8) !important;
  color: #e0e6ed !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

#chance-input::placeholder {
  color: #888 !important;
}

#chance-input:focus {
  outline: none !important;
  border-color: #00d4ff !important;
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.3) !important;
}
