/*AI used (codex on VS studio) to complete and enhance the code for Dicee Challenge. Please see html file for details*/
/* Theme colors */
:root {
  --bg-start: #ffe7b2;
  --bg-end: #b7f1ff;
  --card: #ffffff;
  --text-dark: #1f2933;
  --accent: #ff7a59;
  --accent-dark: #e55b3c;
  --soft: #fef4dd;
}

/* Basic reset */
* {
  box-sizing: border-box;
}

/* Page background and base text */
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-start), var(--bg-end));
  font-family: "Fredoka", sans-serif;
  color: var(--text-dark);
}

/* Centered content wrapper */
.container {
  width: min(1000px, 92%);
  margin: 0 auto;
  text-align: center;
  padding: 32px 16px 48px;
}

/* Title styling */
.title {
  margin: 8px 0 4px;
  font-family: "Bubblegum Sans", cursive;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  letter-spacing: 1px;
  text-shadow: 0 6px 0 rgba(255, 122, 89, 0.25);
}

.title-sparkle {
  display: inline-block;
  padding: 6px 18px 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe08a, #ffd1f0, #b7f1ff);
  border: 3px solid #ffffff;
  box-shadow: 0 14px 26px rgba(31, 41, 51, 0.18);
}

.title-sparkle::before,
.title-sparkle::after {
  content: "★";
  display: inline-block;
  margin: 0 10px;
  color: #ff7a59;
  font-size: 1.4rem;
  transform: translateY(-2px);
}

/* Highlighted rules box */
.instructions {
  margin: 10px auto 18px;
  padding: 12px 18px;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  max-width: 720px;
  background: #fff1c1;
  border-radius: 16px;
  border: 2px dashed #f3b94d;
  box-shadow: 0 10px 20px rgba(31, 41, 51, 0.12);
}

.instructions p {
  margin: 6px 0;
}

/* Big "click to start" callout */
.instruction-cta {
  margin: 12px auto 8px;
  padding: 16px 18px;
  max-width: 520px;
  background: #fff;
  border-radius: 18px;
  border: 3px solid #ffd06a;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 600;
  box-shadow: 0 14px 26px rgba(31, 41, 51, 0.15);
}

.instruction-cta p {
  margin: 0;
}

/* Button and status area */
.controls {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-bottom: 18px;
}

/* Roll button */
#rollBtn {
  border: none;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 0 var(--accent-dark);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#rollBtn:hover {
  transform: translateY(-2px);
}

#rollBtn:active {
  transform: translateY(6px);
  box-shadow: 0 4px 0 var(--accent-dark);
}

#rollBtn:focus-visible {
  outline: 3px solid #0a6cff;
  outline-offset: 3px;
}

#status {
  margin: 0;
  font-size: 1rem;
}

/* Result message bubble */
#result {
  margin: 18px 0 24px;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--soft);
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
}

/* Grid for the three dice cards */
.dice-row {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* Individual dice card */
.dice {
  background: var(--card);
  border-radius: 20px;
  padding: 16px 10px 20px;
  box-shadow: 0 14px 28px rgba(31, 41, 51, 0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dice:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 18px 34px rgba(31, 41, 51, 0.2);
}

.dice p {
  margin: 4px 0 10px;
  font-size: 1.3rem;
}

img {
  width: 80%;
  max-width: 140px;
  transition: transform 0.2s ease;
}

.dice:hover img {
  transform: rotate(-6deg) scale(1.05);
}

/* Rolling animation on click */
.dice.rolling {
  animation: wobble 0.4s ease-in-out;
}

.dice.rolling img {
  animation: spin 0.4s ease-in-out;
}

/* Winner highlight */
.dice.winner {
  border: 3px solid #5dd39e;
  box-shadow: 0 20px 36px rgba(93, 211, 158, 0.35);
  transform: translateY(-10px) scale(1.04);
}

.dice.winner img {
  transform: rotate(6deg) scale(1.08);
}

/* Result celebration effect */
#result.winner-effect {
  background: #d6ffe7;
  animation: celebrate 0.6s ease-in-out;
}

@keyframes celebrate {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

/* Wiggle for roll cue */
@keyframes wobble {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  30% {
    transform: translateY(-8px) rotate(-2deg);
  }
  60% {
    transform: translateY(4px) rotate(2deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Small spin for roll cue */
@keyframes spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(10deg) scale(1.06);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

footer {
  margin: 0 0 28px;
  color: #2b3a42;
  text-align: center;
  font-family: "Fredoka", sans-serif;
}
