* {
  box-sizing: border-box;
}

html {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 62.5%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 1.6rem;
  overflow-x: hidden;
}

.game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.wrapper {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  animation: slideIn 0.8s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 20px;
}

.player-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stats {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 1.2rem;
}

.stat i {
  color: #ffd700;
}

.board-container {
  position: relative;
  margin: 20px 0;
}

canvas {
  background-image: url("https://assets.codepen.io/215128/snakesAndLaddersBoard.jpg");
  border: 3px solid #ffd700;
  border-radius: 15px;
  height: 500px;
  width: 500px;
  object-fit: cover;
  display: block;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

canvas:hover {
  transform: scale(1.02);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.board-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 500px;
  height: 500px;
  pointer-events: none;
  border-radius: 15px;
}

.playerYou .wrapper {
  color: #8a0022;
}

.playerYou canvas {
  border-color: #f36;
}

.playerYou #diceThrow {
  background-color: #f361;
  background-blend-mode: multiply;
  border-color: #d60036;
}

.playerAutoBot .wrapper {
  color: #3a480e;
}

.playerAutoBot canvas {
  border-color: #8a2;
}

.playerAutoBot #diceThrow {
  background-color: #8a22;
  background-blend-mode: multiply;
  border-color: #556a15;
}

.dice-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#diceThrow {
  background-image: url("https://assets.codepen.io/215128/diceSpots.png");
  background-size: 50px;
  border: 3px solid #ffd700;
  border-radius: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  width: 120px;
  transition: all 0.3s ease;
  background-color: #2a2a2a;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#diceThrow:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 35px rgba(255, 215, 0, 0.4);
  border-color: #fff;
}

#diceThrow:active {
  transform: scale(0.95);
}

.dice-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 215, 0, 0.3) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

#diceThrow:hover .dice-glow {
  opacity: 1;
}

.dice-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: #ffd700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.dice-streak {
  background: rgba(255, 215, 0, 0.2);
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 1.2rem;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

#diceThrow.s6 {
  background-position: 0 0;
}

#diceThrow.s5 {
  background-position: 0 -50px;
}

#diceThrow.s4 {
  background-position: 0 -100px;
}

#diceThrow.s3 {
  background-position: 0 -150px;
}

#diceThrow.s2 {
  background-position: 0 -200px;
}

#diceThrow.s1 {
  background-position: 0 -250px;
}

/* Legacy buttonWrapper styles - enhanced version below */

/* Legacy button styles - will be overridden by enhanced styles below */

.hidden {
  display: none;
}

/* Legacy h1 and h2 styles - overridden by enhanced styles */

/* Legacy reset button styles - overridden by enhanced button styles */

#reset.hidden {
  display: none;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 30px;
  border: 2px solid #ffd700;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  min-width: 350px;
}

.settings-panel.show {
  display: block;
  animation: modalSlideIn 0.3s ease-out;
}

.settings-panel h3 {
  color: #ffd700;
  margin-bottom: 20px;
  text-align: center;
}

.setting-group {
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-group label {
  font-weight: bold;
  color: #fff;
}

.setting-group select,
.setting-group input[type="text"] {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #ffd700;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  min-width: 150px;
}

.setting-group input[type="color"] {
  width: 50px;
  height: 35px;
  border-radius: 8px;
  border: 1px solid #ffd700;
  cursor: pointer;
}

.setting-group input[type="checkbox"] {
  transform: scale(1.5);
  accent-color: #ffd700;
}

/* Power-ups Display */
.powerups-display {
  display: flex;
  gap: 15px;
  margin: 15px 0;
  justify-content: center;
}

.powerup {
  background: rgba(255, 215, 0, 0.2);
  border: 2px solid #ffd700;
  border-radius: 15px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  min-width: 60px;
  text-align: center;
}

.powerup:hover {
  background: rgba(255, 215, 0, 0.4);
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

.powerup i {
  font-size: 2rem;
  color: #ffd700;
  display: block;
  margin-bottom: 5px;
}

.powerup-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ff4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.powerup.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Buttons and Controls */
.buttonWrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin: 20px 0;
}

.game-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid #ffd700;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #ffd700;
  font-size: 1.8rem;
}

.icon-btn:hover {
  background: rgba(255, 215, 0, 0.2);
  transform: scale(1.1);
}

button {
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  color: #333;
  border: none;
  border-radius: 25px;
  padding: 12px 25px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1.4rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

button:active {
  transform: translateY(0);
}

/* Achievements */
.achievements {
  width: 100%;
  margin-top: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  padding: 15px;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.achievements h4 {
  color: #ffd700;
  margin-bottom: 10px;
  text-align: center;
}

.achievement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.achievement {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid #ffd700;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.achievement.unlocked {
  background: rgba(255, 215, 0, 0.3);
  color: #ffd700;
  animation: achievementUnlock 0.5s ease-out;
}

@keyframes achievementUnlock {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  border: 3px solid #ffd700;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 500px;
  width: 90%;
}

.modal-content h2 {
  color: #ffd700;
  margin-bottom: 20px;
  font-size: 3rem;
}

.winner-info {
  margin: 20px 0;
}

.winner-text {
  font-size: 2rem;
  margin-bottom: 20px;
  color: #fff;
}

.final-stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  flex-wrap: wrap;
  gap: 15px;
}

.final-stat {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 15px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.final-stat i {
  color: #ffd700;
  font-size: 1.5rem;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 30px;
}

/* Animations */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes diceRoll {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(90deg) scale(1.1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  75% {
    transform: rotate(270deg) scale(1.1);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

.dice-rolling {
  animation: diceRoll 0.5s ease-in-out;
}

/* Player-specific styles */
.playerYou .wrapper {
  border-color: #ff3366;
}

.playerYou canvas {
  border-color: #ff3366;
}

.playerYou #diceThrow {
  border-color: #ff3366;
}

.playerAutoBot .wrapper {
  border-color: #33ff66;
}

.playerAutoBot canvas {
  border-color: #33ff66;
}

.playerAutoBot #diceThrow {
  border-color: #33ff66;
}

/* Responsive Design */
@media (max-width: 768px) {
  .wrapper {
    padding: 20px;
    margin: 10px;
  }

  canvas {
    width: 400px;
    height: 400px;
  }

  .board-overlay {
    width: 400px;
    height: 400px;
  }

  .stats {
    flex-direction: column;
    gap: 8px;
  }

  .game-header {
    flex-direction: column;
    gap: 15px;
  }

  .buttonWrapper {
    flex-direction: column;
    gap: 20px;
  }

  .powerups-display {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  canvas {
    width: 300px;
    height: 300px;
  }

  .board-overlay {
    width: 300px;
    height: 300px;
  }

  #diceThrow {
    width: 100px;
    height: 100px;
  }

  .modal-content {
    padding: 20px;
  }

  .final-stats {
    flex-direction: column;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.pulse {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Special Effects */
.special-square {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  animation: specialGlow 2s infinite;
  pointer-events: none;
}

.special-square.powerup {
  background: radial-gradient(
    circle,
    rgba(255, 215, 0, 0.6) 0%,
    transparent 70%
  );
}

.special-square.bonus {
  background: radial-gradient(
    circle,
    rgba(0, 255, 127, 0.6) 0%,
    transparent 70%
  );
}

@keyframes specialGlow {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
  }
}

/* Additional animations for notifications */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Notification styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  color: #333;
  padding: 15px 25px;
  border-radius: 25px;
  font-weight: bold;
  z-index: 3000;
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Enhanced dice states with better visual feedback */
#diceThrow.s1 .dice-number::after {
  content: "⚀";
}
#diceThrow.s2 .dice-number::after {
  content: "⚁";
}
#diceThrow.s3 .dice-number::after {
  content: "⚂";
}
#diceThrow.s4 .dice-number::after {
  content: "⚃";
}
#diceThrow.s5 .dice-number::after {
  content: "⚄";
}
#diceThrow.s6 .dice-number::after {
  content: "⚅";
}

.dice-number::after {
  font-size: 3rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.7;
}

/* Player indicator enhancements */
.player-stats h1 {
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 2.5rem;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Enhanced message display */
.message {
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  margin: 15px 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.4rem;
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Improved focus states for accessibility */
button:focus,
.icon-btn:focus,
#diceThrow:focus {
  outline: 3px solid #ffd700;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .wrapper {
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid #fff;
  }

  canvas {
    border-color: #fff;
  }

  .stat {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid #fff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .dice-rolling {
    animation: none;
  }

  .pulse {
    animation: none;
  }
}

/* Print styles */
@media print {
  .settings-panel,
  .modal,
  .notification {
    display: none !important;
  }

  .wrapper {
    background: white;
    color: black;
    box-shadow: none;
  }

  canvas {
    border: 2px solid black;
  }
}
/* Footer Styles */
.game-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  text-align: center;
  border-top: 1px solid rgba(255, 215, 0, 0.3);
  z-index: 100;
}

.game-footer p {
  margin: 2px 0;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
}

.game-footer strong {
  color: #ffd700;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Adjust wrapper to account for footer */
.wrapper {
  margin-bottom: 80px;
}

/* Hide footer in modal view */
.modal.show ~ .game-container .game-footer {
  display: none;
}

@media (max-width: 768px) {
  .game-footer {
    padding: 8px 15px;
  }
  
  .game-footer p {
    font-size: 1rem;
  }
  
  .wrapper {
    margin-bottom: 70px;
  }
}