@import url('https://fonts.googleapis.com/css2?family=Anton&family=Barlow+Condensed:wght@400;700&family=Inter:wght@400;600&display=swap');

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #0a1628;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  min-height: 100vh;
}

header {
  text-align: center;
  width: 100%;
  margin-bottom: 0.75rem;
}

h1 {
  font-family: 'Anton', sans-serif;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  margin: 0.25rem 0;
}

h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.75);
  margin: 4px 0;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.dice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.die {
  width: 58px;
  height: 58px;
  background: white;
  color: #0a1628;
  font-size: 1.7rem;
  font-weight: bold;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(1, 56, 147, 0.25);
  transition: transform 0.1s, box-shadow 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.die.locked {
  background: #013893;
  color: white;
  box-shadow: 0 4px 16px rgba(1, 56, 147, 0.55);
}

.die:hover:not(.locked) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(1,56,147,0.35); }

#buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 1.75rem;
  background: #013893;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(1, 56, 147, 0.4);
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

button:hover { background: #0047ab; transform: translateY(-1px); }
button:active { transform: translateY(0); }

button.back {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  padding: 0.5rem 1.1rem;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: none;
}

button.back:hover { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); transform: none; }

#message {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.02em;
  max-width: 380px;
  line-height: 1.5;
  padding: 0.25rem 0.5rem;
}
#message strong { font-weight: 800; color: white; }

footer {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.3);
  width: 100%;
  text-align: center;
  margin-top: auto;
  padding: 1rem 0;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes spin {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.15) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes diceRoll {
  0%   { transform: rotate(0deg) scale(1) translateY(0); }
  15%  { transform: rotate(-22deg) scale(1.18) translateY(-10px); }
  30%  { transform: rotate(18deg) scale(1.22) translateY(-16px); }
  45%  { transform: rotate(-14deg) scale(1.15) translateY(-8px); }
  60%  { transform: rotate(9deg) scale(1.08) translateY(-4px); }
  75%  { transform: rotate(-4deg) scale(1.03) translateY(-1px); }
  90%  { transform: rotate(2deg) scale(1.01); }
  100% { transform: rotate(0deg) scale(1) translateY(0); }
}

@keyframes diceLand {
  0%   { transform: scale(1.3) translateY(-8px); }
  35%  { transform: scale(0.85) translateY(4px); }
  65%  { transform: scale(1.1) translateY(-2px); }
  85%  { transform: scale(0.97); }
  100% { transform: scale(1) translateY(0); }
}

.die.rolling {
  animation: diceRoll 0.35s ease-in-out infinite;
  opacity: 0.75;
  background: #e8eeff;
  color: #013893;
}

.die.landing {
  animation: diceLand 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  background: white;
  color: #0a1628;
}
