:root {
  --bg: #0b1020;
  --panel: rgba(15, 23, 42, 0.82);
  --panel-2: rgba(30, 41, 59, 0.76);
  --line: rgba(148, 163, 184, 0.22);
  --text: #f8fafc;
  --muted: #a8b3c7;
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --cyan: #22d3ee;
  --danger: #facc15;
  --shadow: 0 24px 80px rgba(2, 6, 23, 0.52);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(34, 211, 238, 0.18), transparent 18rem),
    radial-gradient(circle at 86% 24%, rgba(225, 29, 72, 0.5), transparent 21rem),
    radial-gradient(circle at 50% 70%, rgba(59, 130, 246, 0.24), transparent 23rem),
    linear-gradient(145deg, #101827 0%, #0b1020 50%, #180914 100%);
}

button,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 28, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #fff, #93c5fd 56%, #fda4af);
  background-clip: text;
  color: transparent;
}

.menu-button,
.edit-button {
  border: 0;
  color: white;
  background: transparent;
}

.menu-button {
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 15px;
  font-weight: 800;
  background: rgba(51, 65, 85, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.app {
  width: min(620px, 100%);
  margin: 0 auto;
  padding: 18px 12px 32px;
}

.admin-badge {
  display: none;
  width: fit-content;
  margin: 0 auto 10px;
  border: 1px solid rgba(250, 204, 21, 0.34);
  border-radius: 999px;
  padding: 9px 16px;
  color: #fde68a;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(113, 63, 18, 0.38);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

.admin-badge.show {
  display: block;
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 432px;
  overflow: hidden;
}

.edit-button {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  min-width: 82px;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.38);
}

.pointer {
  position: absolute;
  left: 0;
  z-index: 3;
  width: 0;
  height: 0;
  border-top: 19px solid transparent;
  border-bottom: 19px solid transparent;
  border-left: 40px solid #e5e7eb;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.46));
}

.wheel-button {
  position: relative;
  display: grid;
  place-items: center;
  width: min(90vw, 510px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wheel-button:disabled {
  cursor: wait;
}

.wheel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.1),
    inset 0 0 48px rgba(255, 255, 255, 0.12),
    inset 0 -34px 80px rgba(15, 23, 42, 0.22),
    0 28px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.wheel-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.wheel-hint {
  position: absolute;
  top: 22%;
  z-index: 2;
  max-width: 60%;
  color: #fff;
  font-size: clamp(24px, 6vw, 36px);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: rotate(-8deg);
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.78);
}

.tab {
  border: 0;
  border-radius: 16px;
  padding: 14px 8px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  background: transparent;
}

.tab.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.38), rgba(34, 211, 238, 0.18));
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.22);
}

.tab span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: 5px;
  border-radius: 999px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  background: #e0f2fe;
}

.tab-panel {
  display: none;
  padding: 24px;
}

.tab-panel.active {
  display: block;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar button {
  border: 0;
  border-radius: 16px;
  padding: 13px 12px;
  color: white;
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.toolbar button:first-child {
  grid-column: 1 / -1;
}

.toolbar button:active,
.toolbar button:hover {
  background: linear-gradient(135deg, var(--blue-dark), #2563eb);
}

.advanced {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 28px;
  color: #e2e8f0;
  font-size: 18px;
}

.advanced input {
  width: 24px;
  height: 24px;
  accent-color: var(--blue);
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 18px;
  padding: 16px;
  color: #fff;
  font-size: 20px;
  line-height: 1.45;
  background: rgba(2, 6, 23, 0.42);
  outline: none;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 114, 255, 0.22);
}

.status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.winner-box {
  border: 1px solid rgba(250, 204, 21, 0.26);
  border-radius: 18px;
  padding: 18px;
  color: var(--danger);
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(30, 41, 59, 0.72));
}

.results-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 26px;
}

.results-list li {
  border-radius: 14px;
  padding: 12px;
  background: var(--panel-2);
}

.results-list li.winner {
  color: #131313;
  font-weight: 900;
  background: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  max-width: calc(100% - 28px);
  padding: 13px 18px;
  border-radius: 999px;
  color: #111;
  font-weight: 900;
  background: #fff;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

.winner-overlay,
.selected-overlay {
  position: fixed;
  inset: 0;
  z-index: 31;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.94);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
}

.selected-overlay {
  background: rgba(2, 6, 23, 0.32);
  pointer-events: none;
}

.winner-overlay.show,
.selected-overlay.show {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.winner-card,
.selected-card {
  width: min(360px, 92vw);
  border: 1px solid rgba(250, 204, 21, 0.42);
  border-radius: 30px;
  padding: 30px 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(250, 204, 21, 0.38), transparent 12rem),
    rgba(15, 23, 42, 0.94);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.56);
  animation: winner-pop 0.72s cubic-bezier(0.17, 0.84, 0.44, 1);
}

.selected-overlay.show {
  pointer-events: auto;
}

.selected-card {
  border-color: rgba(96, 165, 250, 0.48);
  background:
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.34), transparent 12rem),
    rgba(15, 23, 42, 0.96);
}

.winner-card p,
.selected-card p {
  margin: 0 0 8px;
  color: #fde68a;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.selected-card p {
  color: #bfdbfe;
}

.winner-card strong,
.selected-card strong {
  display: block;
  margin-bottom: 10px;
  color: #ffffff;
  font-size: clamp(34px, 10vw, 58px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.winner-card span,
.selected-card span {
  display: block;
  color: #bfdbfe;
  font-size: 20px;
  font-weight: 800;
}

.selected-card button {
  width: 100%;
  margin-top: 22px;
  border: 0;
  border-radius: 18px;
  padding: 15px 18px;
  color: white;
  font-size: 18px;
  font-weight: 900;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 14px 32px rgba(37, 99, 235, 0.35);
}

@keyframes winner-pop {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.78) rotate(-4deg);
  }

  65% {
    transform: translateY(-8px) scale(1.05) rotate(1deg);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@media (max-width: 560px) {
  .app {
    padding-inline: 0;
  }

  .wheel-stage {
    min-height: 390px;
  }

  .panel {
    border-inline: 0;
  }

  .tab-panel {
    padding: 24px;
  }
}
