/* Spin-o-Rama styles — extracted verbatim from the design prototype
   (Spin the Wheel.html <style> block). Depends on the design-system tokens in
   colors_and_type.css (var(--gray-150), --yellow-60, --font-display, etc.). */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--gray-150);
  color: #fff;
  overflow: hidden;
  font-family: var(--font-sans);
}
#root { height: 100vh; display: flex; flex-direction: column; }

/* =================== STAGE =================== */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* spotlight + curtain */
  background:
    radial-gradient(120% 85% at 50% 18%, rgba(251,236,42,0.20), rgba(251,236,42,0.04) 38%, transparent 60%),
    radial-gradient(140% 120% at 50% 120%, rgba(119,167,255,0.16), transparent 55%),
    linear-gradient(180deg, #161b25 0%, #0c1016 60%, #05070b 100%);
}
.stage::after {
  /* vignette */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(80% 75% at 50% 42%, transparent 55%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
}

/* =================== TOP BAR =================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(8, 11, 17, 0.7);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  backdrop-filter: blur(8px);
  z-index: 30;
}
.brandlock { display: flex; align-items: center; gap: 14px; }
.kusty-chip {
  width: 46px; height: 46px; border-radius: 30% / 30%;
  background: var(--yellow-60);
  display: grid; place-items: center;
  box-shadow: 0 4px 16px rgba(251,236,42,0.35);
}
.kusty-chip img { width: 40px; height: 40px; display: block; }
.titles .k-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #fff;
}
.titles .k-sub {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--yellow-50); font-weight: 600; margin-top: 3px;
}

.controls { display: flex; align-items: center; gap: 10px; }
.iconbtn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: #fff; font-size: 18px; cursor: pointer;
  display: grid; place-items: center;
  transition: background var(--dur-2), transform var(--dur-1);
}
.iconbtn:hover { background: rgba(255,255,255,0.13); transform: translateY(-1px); }
.iconbtn.active { box-shadow: inset 0 0 0 1px rgba(251,236,42,0.4); }
.btn-names {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 16px; border-radius: 12px;
  border: none; cursor: pointer;
  background: var(--yellow-60); color: var(--gray-120);
  font-weight: 700; font-size: 14px; font-family: var(--font-sans);
  transition: transform var(--dur-1), box-shadow var(--dur-2);
}
.btn-names:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(251,236,42,0.3); }
.count-pill {
  background: var(--gray-120); color: var(--yellow-50);
  min-width: 26px; height: 24px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

/* =================== HOST KUSTY =================== */
.host {
  position: absolute; left: 30px; bottom: 26px;
  display: flex; align-items: flex-end; gap: 12px;
  z-index: 20;
}
.host-kusty {
  width: 96px; height: 96px;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
  animation: hostbob 3.2s var(--ease-standard) infinite;
}
@keyframes hostbob { 0%,100% { transform: translateY(0) rotate(-2deg);} 50% { transform: translateY(-7px) rotate(2deg);} }
.bubble {
  position: relative;
  background: #fff; color: var(--gray-120);
  padding: 12px 16px; border-radius: 16px;
  font-weight: 600; font-size: 15px; max-width: 230px;
  margin-bottom: 38px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.bubble::after {
  content: ""; position: absolute; bottom: -9px; left: 26px;
  border: 9px solid transparent; border-top-color: #fff; border-bottom: 0;
}

/* =================== WHEEL =================== */
.wheel-zone {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
}
.wheel-wrap {
  --wheel: min(74vmin, 70vh, 660px);
  position: relative;
  width: var(--wheel); height: var(--wheel);
}
.wheel {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border-radius: 50%;
  will-change: transform;
  filter: drop-shadow(0 22px 50px rgba(0,0,0,0.55));
}

/* marquee bulbs around the rim */
.bulb-ring { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.bulb {
  position: absolute; top: 50%; left: 50%;
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffbe0, var(--yellow-60) 60%, #d4a90f);
  box-shadow: 0 0 9px 2px rgba(251,236,42,0.7);
  animation: twinkle 1.6s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: 1; } 50% { opacity: 0.32; box-shadow: 0 0 4px 1px rgba(251,236,42,0.4);} }

/* pointer */
.pointer {
  position: absolute; top: -14px; left: 50%;
  transform: translateX(-50%);
  z-index: 12; transition: transform 60ms ease-out;
  transform-origin: 50% 18%;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5));
}
.pointer-tri {
  width: 0; height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 52px solid var(--yellow-60);
}
.pointer::before {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--yellow-60); border: 4px solid var(--gray-120);
}
.pointer::after {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 22px solid transparent; border-right: 22px solid transparent;
  border-top: 52px solid transparent;
  box-shadow: 0 0 0 3px var(--gray-120);
}

/* center hub / SPIN button */
.hub {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 24%; height: 24%;
  border-radius: 50%;
  border: none; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, #fff7c4, var(--yellow-60) 55%, #e3b80c);
  color: var(--gray-120);
  box-shadow: 0 0 0 7px #fff, 0 0 0 12px var(--gray-120), 0 14px 34px rgba(0,0,0,0.5);
  display: grid; place-items: center;
  z-index: 11;
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2);
}
.hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.hub:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.97); }
.hub:disabled { cursor: default; }
.hub:not(:disabled)::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(251,236,42,0.35);
  animation: hubpulse 1.8s ease-out infinite;
}
@keyframes hubpulse { 0% { transform: scale(0.92); opacity: 0.8; } 100% { transform: scale(1.25); opacity: 0; } }
.hub-label {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(20px, 3.4vmin, 38px); letter-spacing: 0.02em;
}
.hub.is-spinning .hub-label { font-family: var(--font-sans); letter-spacing: 0.2em; }

/* =================== FOOTER =================== */
.stage-foot {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 22px;
  z-index: 15; color: rgba(255,255,255,0.7); font-size: 13px;
}
.toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .track {
  width: 38px; height: 22px; border-radius: 999px; background: rgba(255,255,255,0.22);
  position: relative; transition: background var(--dur-2);
}
.toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform var(--dur-2) var(--ease-out);
}
.toggle input:checked + .track { background: var(--yellow-60); }
.toggle input:checked + .track .knob { transform: translateX(16px); }
.hint { opacity: 0.7; }
.hint kbd {
  background: rgba(255,255,255,0.12); border-radius: 5px; padding: 2px 7px;
  font-family: var(--font-mono); font-size: 11px; border: 1px solid rgba(255,255,255,0.16);
}
.linkbtn { background: none; border: none; color: var(--yellow-50); cursor: pointer; font-size: 13px; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }

/* =================== WINNER OVERLAY =================== */
.winner-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(60% 60% at 50% 45%, rgba(20,24,33,0.55), rgba(5,7,11,0.92));
  backdrop-filter: blur(3px);
  animation: fadein var(--dur-3) ease-out;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.winner-inner { display: flex; flex-direction: column; align-items: center; gap: 0; }
.win-bubble {
  position: relative; background: #fff; color: var(--gray-120);
  border-radius: 28px; padding: 30px 56px 34px;
  text-align: center; max-width: min(86vw, 760px);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  animation: pop 520ms var(--ease-out) both;
}
@keyframes pop { 0% { transform: scale(0.4) translateY(40px); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1) translateY(0); opacity: 1; } }
.win-eyebrow { display: block; font-size: 16px; font-weight: 700; color: var(--blue-70); letter-spacing: 0.02em; margin-bottom: 8px; }
.win-name {
  display: block; font-family: var(--font-display); font-weight: 600;
  font-size: clamp(40px, 8vmin, 96px); line-height: 1.02; color: var(--gray-120);
  text-wrap: balance;
}
.win-tail {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  border: 16px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.win-kusty {
  width: 130px; height: 130px; margin-top: 26px;
  filter: drop-shadow(0 12px 26px rgba(0,0,0,0.5));
  animation: hostbob 2.6s var(--ease-standard) infinite;
}
.win-actions { display: flex; gap: 14px; margin-top: 24px; }
.win-actions button {
  height: 50px; padding: 0 28px; border-radius: 14px; cursor: pointer;
  font-weight: 700; font-size: 16px; font-family: var(--font-sans); border: none;
  transition: transform var(--dur-1), box-shadow var(--dur-2);
}
.win-actions .again { background: var(--yellow-60); color: var(--gray-120); box-shadow: 0 8px 22px rgba(251,236,42,0.35); }
.win-actions .again:hover { transform: translateY(-2px); }
.win-actions .close { background: rgba(255,255,255,0.14); color: #fff; }
.win-actions .close:hover { background: rgba(255,255,255,0.24); }

.confetti-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }

/* =================== NAMES DRAWER =================== */
.drawer-scrim { position: fixed; inset: 0; background: rgba(5,7,11,0.55); z-index: 80; display: flex; justify-content: flex-end; }
.drawer {
  width: min(440px, 92vw); height: 100%;
  background: #fff; color: var(--gray-120);
  display: flex; flex-direction: column; padding: 24px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.4);
  animation: slidein var(--dur-4) var(--ease-out);
}
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-size: 22px; }
.drawer .x { border: none; background: var(--gray-20); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.drawer .x:hover { background: var(--gray-30); }
.drawer-note { color: var(--gray-100); font-size: 13px; margin: 10px 0 12px; }
.names-area {
  flex: 1; min-height: 0; resize: none; width: 100%;
  border: 1px solid var(--gray-40); border-radius: 12px; padding: 14px;
  font-family: var(--font-sans); font-size: 14px; line-height: 1.7; color: var(--gray-120);
}
.names-area:focus { outline: none; border-color: var(--blue-70); box-shadow: 0 0 0 3px var(--blue-10); }
.drawer-actions { margin-top: 14px; }
.apply { width: 100%; height: 48px; border: none; border-radius: 12px; background: var(--gray-120); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.apply:hover { background: var(--gray-110); }
.history { margin-top: 18px; border-top: 1px solid var(--gray-30); padding-top: 14px; }
.history-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-90); font-weight: 700; margin-bottom: 8px; }
.history ol { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow: auto; }
.history li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; font-weight: 600; }
.h-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow-60); flex: none; }

@media (max-width: 720px) {
  .host { display: none; }
  .titles .k-title { font-size: 22px; }
  .btn-names span:first-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .host-kusty, .win-kusty, .bulb, .hub:not(:disabled)::after { animation: none !important; }
}
