:root {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: light dark;
  color: #ffffffde;
  background-color: #242424;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  font-weight: 500;
  color: #646cff;
  text-decoration: none;
}

a:hover {
  color: #535bf2;
}

body {
  margin: 0;
  display: flex;
  place-items: center;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 320px;
  min-height: 96.5vh;
  background-color: #000;
  padding: 1rem;
 }

h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  text-align: center;
}

button {
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0.6em 1.2em;
  font-size: 1em;
  font-weight: 500;
  font-family: inherit;
  background-color: #1a1a1a;
  cursor: pointer;
  transition: all 0.25s ease;
}

button:hover {
  border-color: #646cff;
}

button:focus,
button:focus-visible {
  outline: 4px auto -webkit-focus-ring-color;
}

@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #fff;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}

body > div {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.main-container {
  background-color: #f5f5f5;
  color: #2b283a;
  width: 90%;
  max-width: 800px;
  padding: 2rem 1rem;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

header {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* 5×2 layout for wider screens */
.dice-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 350px;
  margin-bottom: 2rem;
}

/* Adaptive dice layout for narrow screens (below 435px) */
@media screen and (max-width: 435px) {
  .dice-container {
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    grid-template-rows: auto;
    gap: 0.8rem;
    max-width: 100%;
  }
}

.dice-container > button {
  background-color: #fff;
  color: #2b283a;
  width: 100%;
  aspect-ratio: 1 / 1;
  box-shadow: 0 2px 2px #00000026;
  font-weight: 700;
  font-size: 1.2rem;
}

button {
  background-color: #59e391;
  min-height: 50px;
  border: none;
  color: #2b283a;
  padding: 0.5rem 1rem;
  font-size: 1rem;
}

button:hover {
  background-color: #3fbd71;
  transform: translateY(-2px);
  box-shadow: 0 2px 2px #00000040;
}

footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
}

@media screen and (max-width: 600px) {
  h1 {
    font-size: 2rem;
  }

  .main-container {
    padding: 1.5rem 1rem;
  }

  .dice-container > button {
    font-size: 1rem;
  }

  button {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
  }
}
