/* Spin view: full-screen party look. Deliberately contains nothing that
   hints at rigging, setup, or remaining scripted spins. */
:root {
  --bg-deep: #0d1024;
  --bg-glow: #1d2a55;
  --text: #f4f6ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 50% 12%, var(--bg-glow), transparent 70%),
    radial-gradient(900px 900px at 85% 90%, #14224a, transparent 65%),
    var(--bg-deep);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
}

body.setup-mode { overflow: auto; }

.view-hidden { display: none !important; }

#spinView {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Bottom padding reserves the banner zone so the wheel stays clear of
     it at any zoom level. */
  padding: clamp(12px, 3vh, 28px) 16px calc(clamp(14px, 3.5vh, 26px) + 190px);
  overflow: hidden;
  user-select: none;
}

/* Tiny operator aid: bare spin count under the window title bar.
   Deliberately vague ("N spins", never "N of M") so it reveals nothing. */
#spinCounter {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #4d5a92;
  user-select: none;
}

#title {
  flex: 0 0 auto;
  margin: 0;
  font-size: clamp(22px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffd166, #ff5d8f 55%, #4cc9f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-align: center;
  padding: 0 16px;
}

#wheelWrap {
  position: relative;
  /* Auto margins center the wheel in the space left below the title. */
  margin: auto 0;
  width: max(150px, min(90vw, calc(100vh - 300px), 620px));
  aspect-ratio: 1 / 1;
}

#wheel {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 22px 45px rgba(0, 0, 0, 0.55));
  transition: opacity 0.3s ease;
}

#pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translate(-50%, -100%);
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 36px solid #ffffff;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.55));
  z-index: 3;
}

#spinBtn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 27%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffffff, #dfe4f6 55%, #aab3d6 100%);
  color: #1c2447;
  font-weight: 800;
  font-size: clamp(14px, 2.6vw, 24px);
  letter-spacing: 0.14em;
  cursor: pointer;
  z-index: 2;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.45),
    inset 0 2px 3px rgba(255, 255, 255, 0.9),
    inset 0 -4px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.12s ease, opacity 0.2s ease;
}

#spinBtn:hover { transform: translate(-50%, -50%) scale(1.05); }
#spinBtn:active { transform: translate(-50%, -50%) scale(0.94); }
#spinBtn:disabled { opacity: 0.5; cursor: default; }
#spinBtn:disabled:hover { transform: translate(-50%, -50%); }

#banner {
  position: fixed;
  left: 50%;
  bottom: clamp(14px, 3.5vh, 26px);
  transform: translateX(-50%);
  z-index: 5;
  min-width: min(520px, 88vw);
  max-width: min(640px, 92vw);
  padding: 18px 34px 14px;
  border-radius: 18px;
  text-align: center;
  background: rgba(13, 17, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  cursor: pointer;
}

#banner.hidden { display: none; }

@keyframes pop {
  from { transform: translateX(-50%) translateY(24px) scale(0.9); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

.banner-kicker {
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #9fb0e8;
}

.banner-name {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800;
  margin: 6px 0 4px;
  background: linear-gradient(90deg, #ffd166, #ff8fab);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.banner-hint {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6f7cab;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 6;
}

/* Last-one prank: full-screen "YOU LOSE!" flash. */
#loseBanner {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(900px 620px at 50% 44%, rgba(126, 8, 26, 0.93), rgba(9, 3, 9, 0.97));
  backdrop-filter: blur(6px);
  cursor: pointer;
  animation: loseIn 0.3s ease-out;
}

#loseBanner.hidden { display: none; }

.lose-text {
  font-size: clamp(56px, 16vw, 210px);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 0 4vw;
  background: linear-gradient(180deg, #fff2f0, #ff5d5d 52%, #a80f23);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 12px 34px rgba(255, 40, 60, 0.45));
  animation: loseShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

#loseBanner .banner-hint { color: #d98f9b; }

@keyframes loseIn {
  from { opacity: 0; transform: scale(1.12); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes loseShake {
  0%   { transform: translateX(0) rotate(0); }
  15%  { transform: translateX(-10px) rotate(-1deg); }
  30%  { transform: translateX(9px) rotate(0.9deg); }
  45%  { transform: translateX(-7px) rotate(-0.7deg); }
  60%  { transform: translateX(5px) rotate(0.5deg); }
  75%  { transform: translateX(-3px) rotate(-0.3deg); }
  100% { transform: translateX(0) rotate(0); }
}
