:root {
  --bg: #060a1a;
  --bg-alt: #111935;
  --panel: #131a38;
  --panel-border: #26305c;
  --text: #f4f5fb;
  --text-dim: #8d94bd;
  --accent: #33d6f0;
  --accent-2: #7c5cff;
  --accent-3: #33d6c0;
  --radius: 14px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background:
    url("assets/color feel 2.png") center center / cover no-repeat fixed,
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}

.bg-anim {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.bg-anim .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}

.blob-a {
  width: 560px;
  height: 560px;
  top: -10%;
  left: -8%;
  background: radial-gradient(circle, rgba(51, 214, 240, 0.32), transparent 70%);
  animation: floatA 22s ease-in-out infinite;
}

.blob-b {
  width: 640px;
  height: 640px;
  bottom: -15%;
  right: -10%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.3), transparent 70%);
  animation: floatB 26s ease-in-out infinite;
}

.blob-c {
  width: 460px;
  height: 460px;
  top: 35%;
  right: 20%;
  background: radial-gradient(circle, rgba(61, 94, 255, 0.24), transparent 70%);
  animation: floatC 30s ease-in-out infinite;
}

@keyframes floatA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, 60px) scale(1.15); }
}

@keyframes floatB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-90px, -50px) scale(1.1); }
}

@keyframes floatC {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, 70px) scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-anim .blob {
    animation: none;
  }
}

/* Topbar */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px 12px;
  padding-right: 552px;
  text-align: center;
}

.wheel-title {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  gap: 12px;
  color: var(--text);
  font-family: "Orbitron", "Space Grotesk", sans-serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.title-logo {
  height: 4.2em;
  width: auto;
  vertical-align: middle;
}

/* Layout */
.layout {
  flex: 1;
  display: flex;
  padding: 12px 32px 32px;
  padding-right: 552px;
  min-height: 0;
}

/* Wheel stage */
.wheel-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 0;
  width: 100%;
}

/* Name entries — persistent right-side drawer, always open */
.sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px 28px;
  overflow-y: auto;
  z-index: 15;
}

.sidebar::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 520px;
  background: var(--bg-alt);
  border-left: 1px solid var(--panel-border);
  z-index: -1;
}

.wheel-tabs-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
}

.wheel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  padding-bottom: 4px;
}

.wheel-tab {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  outline: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.wheel-tab:focus-visible {
  box-shadow: 0 0 0 2px var(--bg-alt), 0 0 0 4px var(--accent);
}

.wheel-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.wheel-tab.active {
  background: var(--accent-2);
  border-color: transparent;
  color: #fff;
}

.wheel-tab .tab-count {
  margin-left: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent-3);
  opacity: 1;
}

.tab-add-btn {
  flex: none;
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.tab-add-btn:hover {
  border-color: var(--accent);
  background: rgba(51, 214, 240, 0.12);
}

.spin-all-btn {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, rgba(51, 214, 240, 0.16), rgba(124, 92, 255, 0.16));
  border-color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  animation: spinBorderGlow 4s ease-in-out infinite;
}

@keyframes spinBorderGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(51, 214, 240, 0.5);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(51, 214, 240, 0);
  }
}

.spin-all-btn:hover {
  background: linear-gradient(135deg, rgba(51, 214, 240, 0.26), rgba(124, 92, 255, 0.26));
}

.wheel-tab-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.ghost-btn.small {
  padding: 6px 12px;
  font-size: 12px;
  flex: none;
}

.wheels-container {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.wheel-wrap {
  position: relative;
  width: min(560px, 90vw);
  height: min(560px, 90vw);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: var(--shadow), 0 0 0 6px var(--bg-alt), 0 0 0 9px #33e6ff, 0 0 24px rgba(51, 230, 255, 0.55);
}

.wheel-wrap.wheel-active .wheel-canvas {
  box-shadow: var(--shadow), 0 0 0 6px var(--bg-alt), 0 0 0 9px var(--accent-2), 0 0 28px rgba(124, 92, 255, 0.7);
}

.wheel-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wheel-slot .entry-count {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
  white-space: nowrap;
}

.wheel-slot .entry-count span {
  color: var(--text);
  font-weight: 700;
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 28px solid var(--accent-2);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
  z-index: 3;
}

.hub-spin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 112px;
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 4px solid #33e6ff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  z-index: 2;
  padding: 0;
  overflow: hidden;
}

.hub-mascot {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
}

.hub-spin:not(:disabled) {
  animation: hubPulse 1.3s ease-in-out infinite;
}

@keyframes hubPulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.5),
      0 0 0 0 rgba(51, 214, 240, 0.85),
      0 0 0 0 rgba(124, 92, 255, 0.5);
  }
  60% {
    transform: translate(-50%, -50%) scale(1.08);
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.5),
      0 0 0 26px rgba(51, 214, 240, 0),
      0 0 0 44px rgba(124, 92, 255, 0);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.5),
      0 0 0 0 rgba(51, 214, 240, 0),
      0 0 0 0 rgba(124, 92, 255, 0);
  }
}

.hub-spin:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.hub-spin:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.hub-spin:disabled {
  cursor: not-allowed;
  opacity: 1;
  transform: translate(-50%, -50%);
}

.empty-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  border-radius: 50%;
  background: rgba(6, 8, 20, 0.72);
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 5;
}

.wheel-wrap.is-empty .empty-hint {
  /* Sits above the (disabled) hub button so any click on the empty wheel
     — including dead-center over the hub — reaches this element and
     bubbles up to the wrap's click handler, instead of being swallowed
     by the disabled button underneath. */
  pointer-events: auto;
}

.wheel-wrap.is-empty:hover .empty-hint {
  opacity: 1;
}

.entry-count {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0;
}

.entry-count span {
  color: var(--text);
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-header-actions {
  display: flex;
  gap: 6px;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.count-pill {
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  color: var(--text-dim);
}

#entriesInput {
  width: 100%;
  min-height: 375px;
  resize: vertical;
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
}

#entriesInput:focus {
  outline: none;
  border-color: var(--accent);
}

#entriesInput.entries-glow {
  animation: entriesGlow 0.65s ease-in-out 2;
}

@keyframes entriesGlow {
  0%,
  100% {
    box-shadow: none;
    border-color: var(--panel-border);
  }
  50% {
    box-shadow: 0 0 22px 4px rgba(51, 214, 240, 0.55);
    border-color: var(--accent);
  }
}

.upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.upload-btn,
.ghost-btn {
  flex: 1;
  min-width: 90px;
  text-align: center;
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.upload-btn:hover,
.ghost-btn:hover {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.12);
}

.file-status {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  min-height: 14px;
}

.weight-info {
  color: var(--accent-3);
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.volume-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.small-btn {
  flex: none !important;
  padding: 6px 12px !important;
  font-size: 12px !important;
}

.history-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  font-size: 13px;
}

.history-item .history-name {
  color: var(--text);
  font-weight: 700;
}

.history-item .history-wheel {
  color: var(--text-dim);
  font-size: 11px;
}

.options-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Winner modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 7, 14, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  max-height: 92vh;
  max-width: 1200px;
  width: 94vw;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}

.modal-overlay:not(.hidden) .modal-content-wrap {
  transform: scale(1);
}

.modal-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 40px 70px 56px;
  text-align: center;
  box-shadow: var(--shadow);
  width: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}

.modal-card::-webkit-scrollbar {
  display: none;
}

.modal-mascot {
  flex: none;
  width: 360px;
  height: auto;
  margin-right: -70px;
  position: relative;
  z-index: 2;
  display: block;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.45));
}

.modal-eyebrow {
  margin: 0 0 14px;
  color: var(--accent-3);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 26px;
  font-weight: 700;
}

#winnerName {
  margin: 0 0 44px;
  font-size: 84px;
  line-height: 1.1;
  word-break: break-word;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-hidden,
.winners-grid.result-hidden {
  display: none;
}

.winners-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto 36px;
}

.winner-chip {
  flex: 0 0 190px;
  background: var(--bg-alt);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  min-width: 0;
}

.winner-chip .chip-name {
  display: block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  word-break: break-word;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.winners-grid.count-2 {
  max-width: 480px;
  gap: 22px;
}

.winners-grid.count-2 .winner-chip {
  flex: 1 1 0;
  padding: 26px 20px;
}

.winners-grid.count-2 .chip-name {
  font-size: 40px;
}

.winners-grid.count-3 {
  max-width: 640px;
  gap: 16px;
}

.winners-grid.count-3 .winner-chip {
  flex: 1 1 0;
  padding: 18px 14px;
}

.winners-grid.count-3 .chip-name {
  font-size: 32px;
}

@media (max-width: 640px) {
  .winners-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal-actions {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-actions .primary-btn,
.modal-actions .ghost-btn {
  flex: 0 0 300px;
  padding: 18px 20px;
  font-size: 19px;
  white-space: nowrap;
  border-radius: 10px;
}

@media (max-width: 640px) {
  .modal-card {
    padding: 76px 28px 44px;
  }

  .modal-mascot {
    width: 190px;
    margin-top: -150px;
  }

  #winnerName {
    font-size: 52px;
  }
}

/* Confirmation modal */
.confirm-overlay {
  align-items: center;
  padding-top: 0;
  z-index: 40;
}

.confirm-card {
  max-width: 400px;
  padding: 32px 36px;
}

.confirm-message {
  margin: 0 0 22px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.primary-btn:hover {
  filter: brightness(1.08);
}

.score-pop {
  position: fixed;
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.02em;
  color: var(--accent-3);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 50;
  will-change: transform, opacity;
  animation: scorePop 3s ease-out forwards;
}

@keyframes scorePop {
  0% {
    transform: translateY(0) scale(0.2);
    opacity: 0;
  }
  25% {
    transform: translateY(-20px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-160px) scale(1);
    opacity: 0;
  }
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

@media (max-width: 1300px) {
  .wheel-title {
    display: block;
    min-width: 0;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
  }

  .title-logo {
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 16px 20px 8px;
  }

  .wheel-title {
    display: block;
    min-width: 0;
    white-space: normal;
    text-align: center;
    font-size: 22px;
    line-height: 1.2;
  }

  .title-logo {
    height: 3.5em;
    display: inline-block;
    vertical-align: middle;
    margin: 0 4px;
  }

  .layout {
    flex-direction: column;
    padding: 16px;
    gap: 0;
  }

  .wheel-stage {
    flex: none;
    min-height: 60vh;
    padding-bottom: 16px;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0;
    gap: 16px;
  }

  .sidebar::before {
    display: none;
  }

  .wheel-tabs-row {
    flex-direction: row;
  }

  #entriesInput {
    min-height: 260px;
  }

  .wheel-tab-actions,
  .upload-row {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .wheel-title {
    font-size: 18px;
  }

  .title-logo {
    height: 3em;
  }

  .wheel-stage {
    min-height: 50vh;
  }
}
