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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a1230;
  font-family: "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: block;
}

/* Tillbaka-till-menyn-knapp — alltid uppe i hörnet */
.back-btn {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 3px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  font-size: 32px;
  text-decoration: none;
  backdrop-filter: blur(4px);
}

.back-btn:active { transform: scale(0.92); }

/* Helskärms-överlägg för start / laddning / fel */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #4b2c8f 0%, #7e3ff2 45%, #f0793b 100%);
  z-index: 10;
}

.overlay.hidden { display: none; }

.card {
  text-align: center;
  padding: 48px 56px;
  background: rgba(255, 255, 255, 0.14);
  border: 4px solid rgba(255, 255, 255, 0.5);
  border-radius: 36px;
  backdrop-filter: blur(6px);
  max-width: 640px;
}

.title {
  font-size: clamp(40px, 8vw, 78px);
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  letter-spacing: 1px;
}

.bigfruits {
  font-size: clamp(60px, 14vw, 120px);
  margin: 18px 0;
  line-height: 1;
}

.howto {
  font-size: clamp(20px, 3.4vw, 28px);
  color: #fff;
  line-height: 1.5;
  white-space: pre-line;
}

.note {
  margin-top: 22px;
  font-size: 17px;
  color: rgba(255, 255, 255, 0.85);
}

/* "Hur många spelar?" — antal spelare-väljaren på startskärmen */
.player-pick { margin-top: 24px; }

.pick-label {
  font-size: clamp(17px, 2.6vw, 22px);
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
}

.pick-btns {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.pick-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-family: inherit;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.pick-btn:hover { transform: scale(1.08); }

/* ‹ ›-pilarna — glöder (via --glow) när man lutar sig åt det hållet */
.pick-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-family: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  align-self: center;
  transition: transform 0.08s ease;
  box-shadow: 0 0 calc(var(--glow, 0) * 22px)
    rgba(255, 216, 77, calc(var(--glow, 0) * 0.9));
}

.pick-arrow:hover { transform: scale(1.08); }

.pick-btn.selected {
  background: #ffd84d;
  border-color: #ffffff;
  color: #c2410c;
  box-shadow: 0 4px 0 #d9a400;
}

/* Stor rund spelknapp */
.play-btn {
  margin-top: 28px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  background: #ffd84d;
  color: #c2410c;
  font-size: 64px;
  cursor: pointer;
  box-shadow: 0 8px 0 #d9a400, 0 12px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease;
}

.play-btn.small {
  width: 96px;
  height: 96px;
  font-size: 44px;
  margin-top: 20px;
}

.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: translateY(6px) scale(1); box-shadow: 0 2px 0 #d9a400; }

/* Sammanfattning — fruktrutor med poäng */
.results-list {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 26px 0 10px;
}

.result-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 4px solid rgba(255, 255, 255, 0.4);
  border-radius: 26px;
  padding: 16px 22px;
  min-width: 104px;
}

.result-row.winner {
  background: rgba(255, 216, 77, 0.96);
  border-color: #ffffff;
}

.result-fruit { font-size: 58px; line-height: 1; }

.result-score {
  font-size: 46px;
  font-weight: bold;
  color: #ffffff;
  margin-top: 6px;
}

.result-row.winner .result-score { color: #c2410c; }

/* Laddningssnurra */
.spinner {
  width: 84px;
  height: 84px;
  margin: 10px auto 24px;
  border: 10px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffd84d;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
