:root {
  --brown-950: #120b08;
  --brown-900: #1c100b;
  --brown-800: #29170e;
  --brown-700: #3a2114;
  --brown-600: #51301d;
  --brown-500: #6b4228;

  --pink: #ff6fae;
  --white: #ffffff;
  --blue: #54a9ff;
  --green: #62d98a;
  --yellow: #ffd84d;
  --red: #ff5d5d;

  --text: #ffffff;
  --muted: #a99b93;
  --muted-2: #74665e;

  --border: rgba(255, 255, 255, 0.09);
  --border-light: rgba(255, 255, 255, 0.16);

  --heading: "Space Grotesk", sans-serif;
  --display: "Chakra Petch", sans-serif;
  --mono: "JetBrains Mono", monospace;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background: var(--brown-950);
  color: var(--text);
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.1;
}

.ambient-one {
  top: -180px;
  left: 30%;
  background: var(--pink);
}

.ambient-two {
  top: 650px;
  right: -180px;
  background: var(--yellow);
}

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.app {
  width: min(1080px, calc(100% - 32px));
  margin: 30px auto 80px;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 35px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-button:hover {
  color: var(--white);
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  margin-bottom: 16px;
  color: var(--pink);
  background: rgba(255, 111, 174, 0.08);
  border: 1px solid rgba(255, 111, 174, 0.24);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(98, 217, 138, 0.7);
  animation: dotPulse 1.7s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.hero h1 {
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -1.5px;
}

.hero h1 span {
  color: var(--pink);
}

.subtitle {
  max-width: 520px;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* =========================
   WHEEL STAGE (STANDALONE)
========================= */

.wheel-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 48px;
  padding: 20px 0;
}

.wheel-canvas-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wheel-pointer {
  position: absolute;
  top: -16px;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.8));
}

.pointer-arrow {
  color: var(--pink);
  font-size: 28px;
  line-height: 1;
}

#wheelCanvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 50%;
  box-shadow:
    0 0 0 6px var(--brown-800),
    0 0 0 10px rgba(255, 111, 174, 0.25),
    0 20px 50px rgba(0, 0, 0, 0.7);
}

.wheel-center {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: var(--brown-950);
  background: var(--white);
  border: 4px solid var(--brown-800);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-family: var(--display);
  font-size: 0.65rem;
  font-weight: 800;
}

.center-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.center-ring span {
  font-size: 0.52rem;
  color: var(--muted-2);
}

.center-ring strong {
  color: var(--brown-950);
}

/* =========================
   WINNER SECTION
========================= */

.winner-section {
  margin-bottom: 38px;
}

.winner-section.hidden {
  display: none !important;
}

.winner-card {
  position: relative;
  overflow: hidden;
  padding: 30px 20px;
  text-align: center;
  background:
    radial-gradient(
      circle at 50% 0,
      rgba(255, 111, 174, 0.15),
      transparent 55%
    ),
    var(--brown-900);
  border: 1px solid rgba(255, 111, 174, 0.4);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: winnerIn 0.5s ease both;
}

@keyframes winnerIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.winner-tag {
  color: var(--pink);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 2px;
}

.winner-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 10px auto;
  color: var(--yellow);
  background: rgba(255, 216, 77, 0.1);
  border: 1px solid rgba(255, 216, 77, 0.25);
  border-radius: 50%;
  font-size: 1.3rem;
}

.winner-card h2 {
  margin: 4px 0 7px;
  font-family: var(--heading);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  overflow-wrap: anywhere;
}

.winner-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* =========================
   DASHBOARD PANELS
========================= */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 22px;
  background: rgba(41, 23, 14, 0.88);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(12px);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 23px;
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--pink);
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 1.3px;
}

.panel-header h2 {
  margin: 0 0 5px;
  font-family: var(--heading);
  font-size: 1.25rem;
}

.panel-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.field {
  margin-bottom: 17px;
}

.field label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 0.76rem;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  color: var(--white);
  background: var(--brown-950);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  font-size: 0.82rem;
  transition: 0.2s ease;
}

input:focus,
textarea:focus {
  border-color: rgba(255, 111, 174, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 111, 174, 0.06);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.field-help {
  margin: 7px 1px 0;
  color: var(--muted-2);
  font-size: 0.66rem;
  line-height: 1.5;
}

.source-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.source-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: 0.2s ease;
}

.source-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-light);
}

.source-btn.active {
  background: rgba(255, 111, 174, 0.07);
  border-color: rgba(255, 111, 174, 0.28);
}

.source-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  color: var(--pink);
  background: rgba(255, 111, 174, 0.08);
  border-radius: 7px;
  font-size: 0.85rem;
}

.source-btn strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.73rem;
}

.source-btn small {
  display: block;
  color: var(--muted);
  font-size: 0.61rem;
}

.giveaway-source,
.manual-source {
  margin-top: 15px;
}

.id-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.giveaway-info {
  margin-top: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.giveaway-loading-empty {
  padding: 22px 10px;
  text-align: center;
}

.empty-giveaway-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  color: var(--pink);
  background: rgba(255, 111, 174, 0.08);
  border-radius: 50%;
}

.giveaway-loading-empty strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.giveaway-loading-empty p {
  max-width: 280px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.loaded-giveaway {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.loaded-giveaway-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.loaded-giveaway-header > div {
  min-width: 0;
}

.loaded-badge {
  display: inline-flex;
  padding: 3px 7px;
  margin-bottom: 5px;
  color: var(--green);
  background: rgba(98, 217, 138, 0.07);
  border: 1px solid rgba(98, 217, 138, 0.2);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 1px;
}

.loaded-giveaway-header strong {
  display: block;
  font-family: var(--heading);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.loaded-check {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  color: var(--green);
  background: rgba(98, 217, 138, 0.08);
  border-radius: 50%;
  font-size: 0.7rem;
}

.giveaway-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.giveaway-stat {
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 7px;
}

.stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.52rem;
  text-transform: uppercase;
}

.giveaway-stat strong {
  display: block;
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.loaded-description {
  padding: 10px;
  background: rgba(255, 111, 174, 0.03);
  border: 1px solid rgba(255, 111, 174, 0.09);
  border-radius: 7px;
}

.description-title {
  display: block;
  margin-bottom: 4px;
  color: var(--pink);
  font-size: 0.6rem;
  font-weight: 700;
}

.loaded-description p {
  margin: 0;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.5;
}

.participants-preview {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

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

.participants-header span {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
}

.participants-header small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 0.59rem;
}

.participant-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.participant-action {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--white);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

.participant-action:hover {
  border-color: var(--pink);
  background: rgba(255, 111, 174, 0.06);
}

.selected-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 0.6rem;
}

.participant-list,
.winner-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}

.counter-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.58rem;
  white-space: nowrap;
}

.draw-settings {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--border);
}

.settings-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 15px;
  margin-bottom: 13px;
}

.settings-heading h3 {
  margin: 0;
  font-family: var(--heading);
  font-size: 0.92rem;
}

.settings-note {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.54rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  margin-top: 20px;
}

.primary-btn,
.secondary-btn {
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--heading);
  font-weight: 700;
  transition: 0.2s ease;
}

.primary-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  color: var(--brown-950);
  background: linear-gradient(135deg, var(--pink), #ff9fc7);
  border: 0;
  font-size: 0.78rem;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 111, 174, 0.18);
}

.secondary-btn {
  padding: 10px 13px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border);
  font-size: 0.68rem;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-light);
}

.primary-btn:active,
.secondary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status {
  min-height: 17px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.67rem;
}

.progress-pill {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.58rem;
}

.winner-list {
  max-height: 380px;
}

.empty-state {
  padding: 35px 15px;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-2);
  font-size: 1.4rem;
}

.empty-state strong {
  display: block;
  margin-bottom: 4px;
  color: #d4d0d9;
  font-size: 0.75rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.66rem;
  line-height: 1.5;
}

.winner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  animation: rowIn 0.3s ease both;
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.winner-row .name {
  min-width: 0;
  font-size: 0.73rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.winner-row .prize-tag {
  flex: 0 0 auto;
  max-width: 45%;
  color: var(--pink);
  font-size: 0.6rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

/* =========================
   RESPONSIVE BREAKPOINTS
========================= */

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .wheel-canvas-container {
    max-width: 340px;
  }

  .wheel-center {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 480px) {
  .app {
    width: calc(100% - 24px);
    margin-top: 15px;
  }

  .wheel-canvas-container {
    max-width: 280px;
  }

  .wheel-center {
    width: 46px;
    height: 46px;
    border-width: 3px;
  }

  .source-buttons {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}