/* ========== Global & background ========== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-deep: #020617;
  --bg-surface: #020617;
  --bg-card: rgba(15, 23, 42, 0.96);
  --border-soft: #1f2937;
  --accent-gold: #facc15;
  --accent-gold-soft: rgba(250, 204, 21, 0.16);
  --accent-blue: #38bdf8;
  --accent-red: #ef4444;
  --accent-green: #22c55e;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.9);
}

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(249, 115, 22, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(34, 197, 94, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(56, 189, 248, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #020617 0%, #0f172a 50%, #020617 100%);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
  animation: bodyGlow 15s ease-in-out infinite;
}

@keyframes bodyGlow {
  0%, 100% {
    background-position: 0% 0%, 100% 100%, 50% 50%, 0% 0%;
  }
  50% {
    background-position: 100% 0%, 0% 100%, 50% 100%, 100% 100%;
  }
}

/* ========== Trophy Button ========== */

.trophy-button {
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  margin: 10px auto 0;
  border-radius: 50%;
  transition: transform 0.2s ease, filter 0.2s ease;
  animation: trophyIdle 4s ease-in-out infinite;
}

.trophy-button:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 0 15px rgba(250, 204, 21, 0.6));
}

.trophy-button:active {
  transform: scale(0.95);
}

@keyframes trophyIdle {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-3px);
  }
}

/* ========== Winner History Modal ========== */

.history-modal-content {
  max-width: 600px;
  padding: 30px;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-radius: 16px;
  border: 3px solid #facc15;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: modalFadeIn 0.4s ease-out;
  width: 90%;
}

.winner-history-modal {
  max-height: 400px;
  overflow-y: auto;
  background: rgba(2, 6, 23, 0.8);
  border-radius: 10px;
  padding: 15px;
  border: 1px solid rgba(250, 204, 21, 0.2);
  margin-top: 10px;
}

.winner-history-modal .no-winners {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  margin: 20px 0;
}

.winner-history-modal .winner-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: rgba(250, 204, 21, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--accent-gold);
  animation: winnerSlideIn 0.5s ease-out;
  transition: transform 0.2s ease;
}

.winner-history-modal .winner-item:hover {
  transform: translateX(5px);
  background: rgba(250, 204, 21, 0.15);
}

.winner-history-modal .winner-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 16px;
}

.winner-history-modal .winner-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Glow di belakang */
.bg-layer {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% -10%, #f97316 0, transparent 55%),
    radial-gradient(circle at 90% 110%, #22c55e 0, transparent 55%),
    radial-gradient(circle at 50% 35%, #38bdf8 0, transparent 60%);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
  animation: bgShift 20s ease-in-out infinite;
}

@keyframes bgShift {
  0%, 100% {
    background-position: 0% 0%, 100% 100%, 50% 50%;
  }
  25% {
    background-position: 100% 0%, 0% 100%, 50% 100%;
  }
  50% {
    background-position: 100% 100%, 0% 0%, 100% 50%;
  }
  75% {
    background-position: 0% 100%, 100% 0%, 0% 50%;
  }
}

/* ========== Container utama ========== */

.app-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: transparent;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.app-title {
  font-size: 48px;
  font-weight: 700;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 0.1em;
  margin-bottom: 15px;
  text-align: center;
  position: relative;
  animation: titleContainer 8s ease-in-out infinite;
}

.app-title span {
  display: inline-block;
  animation: letterBounce 2s ease-in-out infinite;
  text-shadow: 0 0 10px currentColor;
}

.app-title span:nth-child(1) { color: #b91c1c; animation-delay: 0s; } /* dark red */
.app-title span:nth-child(2) { color: #14532d; animation-delay: 0.1s; } /* dark green */
.app-title span:nth-child(3) { color: #eab308; animation-delay: 0.2s; } /* gold */
.app-title span:nth-child(4) { color: #1e3a8a; animation-delay: 0.3s; } /* dark blue */
.app-title span:nth-child(5) { color: #7c2d12; animation-delay: 0.4s; } /* brown */
.app-title span:nth-child(6) { color: #9d174d; animation-delay: 0.5s; } /* wine */
.app-title span:nth-child(7) { color: #b91c1c; animation-delay: 0.6s; } /* dark red */
.app-title span:nth-child(8) { color: #14532d; animation-delay: 0.7s; } /* dark green */
.app-title span:nth-child(9) { color: #eab308; animation-delay: 0.8s; } /* gold */
.app-title span:nth-child(10) { color: #1e3a8a; animation-delay: 0.9s; } /* dark blue */

.app-title .space {
  display: inline-block;
  width: 20px;
}

.app-title::before {
  content: '';
  position: absolute;
  top: -15px;
  left: -15px;
  right: -15px;
  bottom: -15px;
  background: linear-gradient(45deg, rgba(250, 204, 21, 0.2), rgba(56, 189, 248, 0.2), rgba(250, 204, 21, 0.2));
  border-radius: 25px;
  z-index: -1;
  animation: titleBackground 6s ease-in-out infinite;
}

@keyframes titleGlow {
  from {
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
  }
  to {
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.8), 0 0 30px rgba(250, 204, 21, 0.6);
  }
}

@keyframes titleContainer {
  0%, 100% {
    transform: translateY(0px) rotateX(0deg);
  }
  25% {
    transform: translateY(-3px) rotateX(2deg);
  }
  50% {
    transform: translateY(-6px) rotateX(0deg);
  }
  75% {
    transform: translateY(-3px) rotateX(-2deg);
  }
}

@keyframes letterBounce {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.1);
  }
}

@keyframes titleBackground {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1) rotate(0deg);
  }
  33% {
    opacity: 0.6;
    transform: scale(1.02) rotate(1deg);
  }
  66% {
    opacity: 0.4;
    transform: scale(0.98) rotate(-1deg);
  }
}

.app-header p {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== Layout utama (wheel di tengah) ========== */

.main-layout {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.main-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

/* Card umum */

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px 16px;
}

/* Wheel card */

.wheel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-container {
  position: relative;
  display: inline-block;   /* container ngikut ukuran canvas */
  margin-bottom: 15px;
  animation: wheelFloat 6s ease-in-out infinite;
}

@keyframes wheelFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

#wheelCanvas {
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #1f2937 0, #020617 60%);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(15, 23, 42, 0.95);
  transition: box-shadow 0.3s ease;
  animation: idleGlow 4s ease-in-out infinite alternate;
}

@keyframes idleGlow {
  from {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(15, 23, 42, 0.95);
  }
  to {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(15, 23, 42, 0.95),
      0 0 10px rgba(250, 204, 21, 0.2);
  }
}

#wheelCanvas.spinning {
  animation: spinGlow 0.5s ease-in-out infinite alternate;
}

@keyframes spinGlow {
  from {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(15, 23, 42, 0.95),
      0 0 20px rgba(250, 204, 21, 0.3);
  }
  to {
    box-shadow:
      0 24px 80px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(15, 23, 42, 0.95),
      0 0 40px rgba(250, 204, 21, 0.6),
      0 0 60px rgba(250, 204, 21, 0.4);
  }
}

/* Pointer SPIN di sisi kanan, mengarah ke wheel */

.pointer-button {
  position: absolute;
  top: 50%;
  right: -100px;
  width: 120px;
  height: 120px;
  padding: 0;
  background: none;
  border: none;
  transform: translateY(-50%);
  box-shadow: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.pointer-button svg {
  width: 100%;
  height: 100%;
  /* Putar pointer supaya ujungnya mengarah ke wheel (ke kiri) */
  transform: rotate(-90deg);
}

.pointer-button svg path {
  stroke: #facc15;
  stroke-width: 1;
}

.pointer-button:hover {
  transform: translateY(-50%) scale(1.05);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.9));
}

.pointer-button::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(circle at 20% 20%, rgba(250, 204, 21, 0.8), transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(56, 189, 248, 0.6), transparent 50%),
              radial-gradient(circle at 50% 50%, rgba(34, 197, 94, 0.7), transparent 50%);
  border-radius: 50%;
  animation: sparkle 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.pointer-button:active {
  transform: translateY(-50%) scale(0.98);
}

.pointer-button.spinning,
.pointer-button:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

/* Hasil & bantuan */

.result-box {
  min-height: 28px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.result-box.show {
  opacity: 1;
  transform: translateY(0);
}

.result-box span {
  color: var(--accent-gold);
}

.help-text {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  animation: textFade 4s ease-in-out infinite;
}

@keyframes textFade {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* ========== Buttons umum ========== */

button {
  font-family: inherit;
}

.btn-primary,
.btn-danger,
.btn-ghost {
  border-radius: 999px;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.09s ease,
    opacity 0.15s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #f9fafb;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #22c55e);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: 0 6px 12px rgba(37, 99, 235, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #7f1d1d, #ef4444);
  color: #fee2e2;
  margin-top: 8px;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #f97316);
  box-shadow: 0 12px 24px rgba(185, 28, 28, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: radial-gradient(circle at top, #111827 0, #020617 70%);
  color: var(--text-main);
  border: 1px solid #334155;
  margin-top: 10px;
}

.btn-ghost:hover {
  background: radial-gradient(circle at top, #1f2937 0, #020617 70%);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.7);
  transform: translateY(-1px);
}

.btn-primary.full,
.btn-danger.full,
.btn-ghost.full {
  width: 100%;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ========== Input & textarea ========== */

.field-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

input[type="text"],
textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid #1f2937;
  background: radial-gradient(circle at top left, #020617 0, #020617 70%);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  transition: border 0.16s ease, box-shadow 0.16s ease,
    background 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: #6b7280;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.55);
  background: radial-gradient(circle at top left, #020617 0, #020617 82%);
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ========== Daftar peserta (di sidebar) ========== */

.list-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #1f2937;
}

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

.list-header h3 {
  font-size: 13px;
}

.badge-count {
  min-width: 26px;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  text-align: center;
}

#participantsList {
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 2px;
  padding-right: 4px;
}

#participantsList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed #1f2937;
  font-size: 13px;
}

#participantsList li:last-child {
  border-bottom: none;
}

.participant-name {
  flex: 1;
  margin-right: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-btn {
  background: transparent;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.09s ease;
}

.remove-btn:hover {
  background: var(--accent-gold);
  color: #111827;
  transform: translateY(-1px);
}

/* ========== Sidebar pengaturan kanan ========== */

.settings-fab {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: radial-gradient(circle at top, #111827 0, #020617 70%);
  color: var(--accent-gold);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.9);
  transition:
    background 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-fab:hover {
  background: radial-gradient(circle at top, #1f2937 0, #020617 70%);
  transform: translateY(-50%) translateX(-2px);
  animation: fabShimmer 1.5s ease-in-out infinite;
}

@keyframes fabShimmer {
  0%, 100% { box-shadow: 0 12px 30px rgba(15, 23, 42, 0.9); }
  50% { box-shadow: 0 12px 30px rgba(250, 204, 21, 0.6), 0 0 20px rgba(250, 204, 21, 0.4); }
}

.settings-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 330px;
  max-width: 88vw;
  height: 100vh;
  background: radial-gradient(circle at top, #020617 0, #020617 70%);
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: -24px 0 60px rgba(15, 23, 42, 0.95);
  transform: translateX(100%);
  transition: transform 0.23s ease-in-out;
  z-index: 40;
  display: flex;
  flex-direction: column;
}

.settings-sidebar.open {
  transform: translateX(0);
}

.settings-inner {
  padding: 16px 16px 18px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideIn 0.4s ease-out;
}

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

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.settings-header h2 {
  font-size: 18px;
  color: var(--accent-gold);
}

.settings-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: radial-gradient(circle at top, #111827 0, #020617 70%);
  color: #e5e7eb;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icon-btn:hover {
  background: radial-gradient(circle at top, #1f2937 0, #020617 70%);
}

/* Bagian dalam sidebar */

.settings-section {
  padding: 10px 0;
  border-top: 1px dashed #1f2937;
}

.settings-section:first-of-type {
  border-top: none;
}

.settings-section h3 {
  font-size: 13px;
  margin-bottom: 6px;
  color: #f9fafb;
}

.settings-value {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-main);
}

/* Slider */

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: #1f2937;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #facc15);
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.9);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #facc15);
  border: 2px solid #0f172a;
  cursor: pointer;
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ========== Winner Modal ========== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.winner-modal-content {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-radius: 24px;
  border: 2px solid rgba(250, 204, 21, 0.3);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(250, 204, 21, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 32px;
  max-width: 450px;
  width: 90%;
  text-align: center;
  animation: winnerModalAppear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
  overflow: hidden;
}

.winner-modal-content::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(250, 204, 21, 0.1), transparent);
  animation: rotate 4s linear infinite;
  pointer-events: none;
}

@keyframes winnerModalAppear {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(100px) rotate(-10deg);
  }
  40% {
    opacity: 0.9;
    transform: scale(1.1) translateY(-20px) rotate(5deg);
  }
  70% {
    opacity: 1;
    transform: scale(0.95) translateY(5px) rotate(-1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0deg);
  }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 20px;
  background: rgba(239, 68, 68, 0.8);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: white;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

.winner-celebration {
  margin-bottom: 24px;
}

.winner-trophy {
  font-size: 64px;
  animation: trophyCelebration 2s ease-in-out infinite, trophyEntrance 1s ease-out;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 20px rgba(250, 204, 21, 0.5));
}

@keyframes trophyCelebration {
  0%, 100% {
    transform: scale(1) rotate(-2deg);
  }
  25% {
    transform: scale(1.1) rotate(2deg);
  }
  50% {
    transform: scale(1.2) rotate(0deg);
  }
  75% {
    transform: scale(1.1) rotate(-2deg);
  }
}

@keyframes trophyEntrance {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-180deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.2) rotate(-90deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.winner-title {
  font-size: 32px;
  font-weight: bold;
  color: var(--accent-gold);
  margin: 0;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.5);
  animation: titlePulse 1.5s ease-in-out infinite, titleEntrance 0.8s ease-out 0.2s both;
}

@keyframes titlePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes titleEntrance {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes subtitleFade {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.winner-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  animation: subtitleFade 0.6s ease-out 0.4s both;
}

.winner-display {
  margin: 24px 0;
}

.winner-name-container {
  position: relative;
  display: inline-block;
  overflow: hidden;
}

.winner-name-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: winnerRing 2s ease-out infinite;
}

.winner-name {
  font-size: 36px;
  font-weight: bold;
  color: var(--accent-gold);
  text-shadow:
    0 0 10px rgba(250, 204, 21, 0.8),
    0 0 20px rgba(250, 204, 21, 0.6),
    0 0 30px rgba(250, 204, 21, 0.4);
  animation: winnerGlow 2s ease-in-out infinite alternate, winnerNameSlide 1s ease-out 0.5s both;
  padding: 16px 24px;
  border-radius: 16px;
  background: rgba(250, 204, 21, 0.1);
  border: 2px solid rgba(250, 204, 21, 0.3);
  min-width: 200px;
  position: relative;
  overflow: hidden;
}

.winner-name::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shine 2s ease-in-out infinite 1s;
}

@keyframes winnerGlow {
  from {
    text-shadow:
      0 0 10px rgba(250, 204, 21, 0.8),
      0 0 20px rgba(250, 204, 21, 0.6),
      0 0 30px rgba(250, 204, 21, 0.4);
    border-color: rgba(250, 204, 21, 0.3);
  }
  to {
    text-shadow:
      0 0 15px rgba(250, 204, 21, 1),
      0 0 30px rgba(250, 204, 21, 0.8),
      0 0 45px rgba(250, 204, 21, 0.6);
    border-color: rgba(250, 204, 21, 0.6);
  }
}

@keyframes winnerNameSlide {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shine {
  0% { left: -100%; }
  100% { left: 100%; }
}

@keyframes winnerRing {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 200px;
    height: 200px;
    opacity: 0;
  }
}

.winner-sparkles {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  pointer-events: none;
  animation: sparklesFloat 3s ease-in-out infinite;
  font-size: 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.winner-sparkles::before,
.winner-sparkles::after {
  content: '✨';
  position: absolute;
  animation: sparkleIndividual 2s ease-in-out infinite;
}

.winner-sparkles::before {
  top: 10%;
  left: 20%;
  animation-delay: 0.5s;
}

.winner-sparkles::after {
  bottom: 10%;
  right: 20%;
  animation-delay: 1s;
}

@keyframes sparklesFloat {
  0%, 100% {
    transform: translateY(0px) rotate(0deg) scale(1);
    opacity: 0.8;
  }
  25% {
    transform: translateY(-5px) rotate(90deg) scale(1.1);
    opacity: 1;
  }
  50% {
    transform: translateY(5px) rotate(180deg) scale(0.9);
    opacity: 0.6;
  }
  75% {
    transform: translateY(-3px) rotate(270deg) scale(1.05);
    opacity: 0.9;
  }
}

@keyframes sparkleIndividual {
  0%, 100% {
    transform: translateY(0px) scale(1) rotate(0deg);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-10px) scale(1.2) rotate(180deg);
    opacity: 1;
  }
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.btn-secondary {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.8));
  color: #fee2e2;
  border: 1px solid rgba(239, 68, 68, 0.5);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 1), rgba(220, 38, 38, 1));
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

.modal-header h2 {
  color: var(--accent-gold);
  font-size: 24px;
  margin-bottom: 16px;
  animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}

/* ========== Message Modal ========== */

.message-modal-content {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
  border-radius: 16px;
  border: 2px solid rgba(250, 204, 21, 0.3);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(250, 204, 21, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: messageModalAppear 0.4s ease-out;
  backdrop-filter: blur(20px);
}

@keyframes messageModalAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.message-modal-content p {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 20px;
  line-height: 1.5;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
    opacity: 1;
  }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

#floating-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, #facc15, transparent);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite, twinkle 2s ease-in-out infinite;
}

.particle:nth-child(odd) {
  animation-delay: -3s;
  animation-duration: 8s;
}

.particle:nth-child(even) {
  animation-delay: -5s;
  animation-duration: 7s;
}

.modal-actions {
  margin-top: 16px;
}

/* ========== Custom Scrollbar ========== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #facc15, #f97316);
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.3);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #eab308, #ea580c);
}

@media (max-width: 960px) {
  body {
    padding: 10px;
  }

  .app-container {
    padding: 14px 12px 16px;
  }

  /* canvas saja yang dikecilkan, container auto ngikut */
  #wheelCanvas {
    width: 500px !important;
    height: 500px !important;
  }

  .settings-fab {
    right: 18px;
  }
}


@media (max-width: 640px) {
  /* canvas mengecil, center tetap 50% */
  #wheelCanvas {
    width: 400px !important;
    height: 400px !important;
  }

  .app-header h1 {
    font-size: 20px;
  }
}

/* ========== Social Section ========== */

.social-section {
  margin-top: 20px;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 10px;
}

.social-links a {
  color: var(--accent-gold);
  transition: color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-links a:hover {
  color: var(--accent-gold-soft);
  transform: scale(1.1);
}

.social-links svg {
  width: 24px;
  height: 24px;
}

.copyright {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.footer a {
  color: var(--accent-gold);
  transition: color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer a:hover {
  color: var(--accent-gold-soft);
  transform: scale(1.1);
}

.footer svg {
  width: 24px;
  height: 24px;
}
