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

body {
  font-family: system-ui, sans-serif;
  background: #f5f2ea;
  color: #222;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 16px;
  width: 100%;
  max-width: 620px;
}

.hidden { display: none !important; }

h1 { font-size: 1.6rem; text-align: center; }
h2 { font-size: 1.3rem; }
.hint { color: #666; font-size: 0.9rem; }

input {
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #bbb;
  border-radius: 8px;
  width: 220px;
  text-align: center;
}
#code-input { text-transform: uppercase; width: 110px; }

button {
  padding: 10px 18px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #2e7d32;
  color: #fff;
  cursor: pointer;
}
button:disabled { background: #aaa; cursor: default; }
button.secondary {
  background: none;
  color: #b71c1c;
  border: 1px solid #d9a3a3;
}
.join-row { display: flex; gap: 8px; }

#player-list { list-style: none; width: 260px; }
#player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 6px;
}
#player-list .dot {
  width: 14px; height: 14px; border-radius: 50%;
  flex: none;
}
#player-list .offline { opacity: 0.45; }
#player-list .kick {
  margin-left: auto;
  background: none;
  color: #b71c1c;
  padding: 0 6px;
  font-size: 1.1rem;
}

#board {
  width: min(92vw, 520px);
  height: auto;
  background: #fbf8f1;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

#status { font-size: 1.05rem; min-height: 1.4em; text-align: center; }

#dice-row { display: flex; align-items: center; gap: 14px; }
#dice {
  font-size: 1.6rem;
  font-weight: bold;
  width: 52px; height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #333;
  border-radius: 10px;
}
#dice.rolling {
  color: #888;
  animation: dice-shake 0.12s linear infinite;
}
#dice.landed {
  animation: dice-pop 0.3s ease-out;
}
@keyframes dice-shake {
  0%   { transform: translateY(0)    rotate(-6deg); }
  50%  { transform: translateY(-3px) rotate(6deg); }
  100% { transform: translateY(0)    rotate(-6deg); }
}
@keyframes dice-pop {
  0%   { transform: scale(1.45); }
  60%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  #dice.rolling, #dice.landed { animation: none; }
}

#winner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;          /* hinter der Box */
  pointer-events: none; /* Klicks gehen zu den Buttons durch */
}
#winner-box {
  position: relative;
  z-index: 1;          /* Box + Buttons VOR dem Feuerwerk */
  background: #fff;
  color: #222;
  border-radius: 14px;
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
#winner-text {
  font-size: 1.35rem;
  margin-bottom: 22px;
}
#winner-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#winner-actions button { width: 100%; }

#error-toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #b71c1c;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
}
