/* ===== Color Theme: Blue-Teal (matching background) ===== */
:root {
  --c-deep: #06283D;
  --c-blue: #0A4D68;
  --c-mid: #088395;
  --c-teal: #05BFDB;
  --c-light: #00FFCA;
  --c-white: #ffffff;
  --c-glow: #05BFDB;
  --c-danger: #ff4d6d;
  --c-gold: #FFD700;
  --c-gold-deep: #B8860B;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}

html, body {
  min-height: 100vh;
}

body {
  /* Background foto terlihat SEMUA — pakai contain agar tidak terpotong */
  background-color: #041826;
  background-image: url('background.jpg');
  background-size: contain;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: scroll;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 40px;
  position: relative;
  min-height: 100vh;
}

/* Overlay biru tipis agar konten tetap terbaca TAPI foto tetap kelihatan */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(6,40,61,0.25) 0%, rgba(6,40,61,0.55) 100%);
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  background: rgba(6, 40, 61, 0.82);
  border: 2px solid var(--c-teal);
  border-radius: 20px;
  padding: 26px 26px 30px;
  box-shadow: 0 0 30px rgba(5,191,219,0.5), inset 0 0 20px rgba(5,191,219,0.15);
  backdrop-filter: blur(6px);
  margin-top: 10px;
}

/* ===== Header ===== */
.header {
  text-align: center;
  margin-bottom: 22px;
}

.header h1 {
  color: var(--c-white);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 0 14px var(--c-glow);
}

.header p {
  color: var(--c-light);
  font-size: 14px;
  margin-top: 6px;
  letter-spacing: 0.5px;
}

/* ===== User ID Section ===== */
.userid-section {
  background: rgba(10,77,104,0.6);
  border: 1px solid var(--c-mid);
  border-radius: 14px;
  padding: 18px;
  margin: 0 auto 20px;
  max-width: 520px;
}

.userid-section label {
  display: block;
  color: var(--c-light);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  text-align: center;
}

.userid-input-row {
  display: flex;
  gap: 8px;
}

.userid-input-row input {
  flex: 1;
  padding: 12px 14px;
  border: 2px solid var(--c-mid);
  border-radius: 10px;
  background: rgba(255,255,255,0.95);
  color: var(--c-deep);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: all 0.3s;
}

.userid-input-row input:focus {
  border-color: var(--c-teal);
  box-shadow: 0 0 10px var(--c-glow);
}

.userid-input-row input::placeholder {
  color: #5a7a8a;
  font-weight: 400;
}

.btn {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-mid), var(--c-teal));
  color: var(--c-white);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(5,191,219,0.55);
}

.btn:active { transform: translateY(0); }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.user-status {
  text-align: center;
  margin-top: 12px;
  font-size: 13px;
  min-height: 18px;
  font-weight: 600;
}

.status-ok { color: var(--c-light); }
.status-err { color: var(--c-danger); }
.status-info { color: var(--c-teal); }

/* ===== Game Area (wheel + jackpot side by side) ===== */
.game-area {
  display: none;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.game-area.active {
  display: flex;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-text {
  width: 100%;
  text-align: center;
  color: var(--c-light);
  font-size: 15px;
  margin-bottom: 6px;
  font-weight: 600;
}

.welcome-text span {
  color: var(--c-white);
  font-weight: 800;
}

/* ===== Wheel Column ===== */
.wheel-column {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrapper {
  position: relative;
  width: 420px;
  height: 420px;
  margin: 8px auto;
}

/* Pointer / Penunjuk */
.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 36px solid var(--c-white);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
  z-index: 5;
}

.pointer::after {
  content: "";
  position: absolute;
  top: -38px;
  left: -9px;
  width: 18px;
  height: 18px;
  background: var(--c-teal);
  border-radius: 50%;
  border: 2px solid var(--c-white);
  box-shadow: 0 0 8px var(--c-glow);
}

/* Canvas wheel */
#wheelCanvas {
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 7px solid var(--c-teal);
  box-shadow: 0 0 25px rgba(5,191,219,0.7), inset 0 0 15px rgba(6,40,61,0.4);
  background: var(--c-deep);
}

/* Center hub */
.center-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-light), var(--c-mid));
  border: 3px solid var(--c-white);
  box-shadow: 0 0 14px var(--c-glow);
  z-index: 4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-deep);
  font-weight: 800;
  font-size: 15px;
  text-align: center;
  line-height: 1.1;
  transition: all 0.2s;
  user-select: none;
}

.center-hub:hover:not(.disabled) {
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 0 22px var(--c-light);
}

.center-hub.disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.spin-info {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
  color: var(--c-light);
  min-height: 22px;
  max-width: 420px;
}

/* ===== Jackpot Column ===== */
.jackpot-column {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jackpot-panel {
  background: linear-gradient(160deg, #1a3a52 0%, #0a4d68 50%, #088395 100%);
  border: 2px solid var(--c-gold);
  border-radius: 18px;
  padding: 20px 18px;
  text-align: center;
  box-shadow: 0 0 24px rgba(255,215,0,0.35), inset 0 0 16px rgba(255,215,0,0.12);
  position: relative;
  overflow: hidden;
}

.jackpot-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,215,0,0.05) 0 10px, transparent 10px 20px);
  pointer-events: none;
}

.jackpot-label {
  position: relative;
  color: var(--c-gold);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255,215,0,0.6);
  margin-bottom: 4px;
}

.jackpot-crown {
  position: relative;
  font-size: 38px;
  margin-bottom: 4px;
  animation: floaty 2.5s ease-in-out infinite;
}

@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-6px) rotate(3deg); }
}

.jackpot-amount {
  position: relative;
  color: var(--c-white);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 0 14px rgba(255,215,0,0.8), 0 2px 4px rgba(0,0,0,0.5);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 6px 0;
  word-break: keep-all;
}

.jackpot-amount .currency {
  color: var(--c-gold);
  font-size: 22px;
  vertical-align: super;
  margin-right: 2px;
}

.jackpot-sub {
  position: relative;
  color: var(--c-light);
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  opacity: 0.9;
}

.jackpot-update-bar {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.jackpot-update-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-gold), var(--c-light));
  width: 0%;
  transition: width 60s linear;
}

/* ===== Info / Winners panel ===== */
.side-info {
  background: rgba(10,77,104,0.55);
  border: 1px solid var(--c-mid);
  border-radius: 14px;
  padding: 14px;
}

.side-info h3 {
  color: var(--c-light);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  text-align: center;
}

.winners-mini {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.winners-mini::-webkit-scrollbar { width: 5px; }
.winners-mini::-webkit-scrollbar-thumb { background: var(--c-mid); border-radius: 3px; }

.winner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(6,40,61,0.5);
  border-left: 3px solid var(--c-teal);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 11px;
  color: var(--c-white);
}

.winner-row .w-user { font-weight: 700; color: var(--c-light); }
.winner-row .w-prize { color: var(--c-white); font-weight: 600; }

.empty-mini {
  text-align: center;
  color: var(--c-mid);
  font-size: 11px;
  padding: 10px;
  font-style: italic;
}

/* ===== History full section (below) ===== */
.history-section {
  margin-top: 24px;
  display: none;
}

.history-section.active { display: block; }

.history-title {
  color: var(--c-light);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.history-list {
  max-height: 200px;
  overflow-y: auto;
  background: rgba(6,40,61,0.5);
  border: 1px solid var(--c-mid);
  border-radius: 10px;
  padding: 8px;
}

.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-thumb { background: var(--c-mid); border-radius: 3px; }

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 5px;
  background: rgba(10,77,104,0.5);
  border-radius: 8px;
  font-size: 12px;
  color: var(--c-white);
  border-left: 3px solid var(--c-teal);
}

.history-item .h-user { font-weight: 700; color: var(--c-light); }
.history-item .h-prize { color: var(--c-white); font-weight: 600; }

.empty-history {
  text-align: center;
  color: var(--c-mid);
  font-size: 12px;
  padding: 15px;
  font-style: italic;
}

/* ===== Reset btn ===== */
.reset-btn {
  display: block;
  margin: 20px auto 0;
  background: transparent;
  border: 1px solid var(--c-danger);
  color: var(--c-danger);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.reset-btn:hover {
  background: var(--c-danger);
  color: var(--c-white);
}

.footer-note {
  text-align: center;
  margin-top: 18px;
  font-size: 11px;
  color: var(--c-mid);
  letter-spacing: 0.5px;
}

/* ===== Result Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6,40,61,0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.4s ease;
}

.modal {
  background: linear-gradient(135deg, var(--c-blue), var(--c-mid));
  border: 2px solid var(--c-teal);
  border-radius: 20px;
  padding: 30px 25px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 0 40px rgba(5,191,219,0.6);
  animation: popIn 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-trophy {
  font-size: 60px;
  margin-bottom: 12px;
  animation: bounce 1.2s infinite;
}

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

.modal h2 {
  color: var(--c-white);
  font-size: 22px;
  margin-bottom: 8px;
  text-shadow: 0 0 10px var(--c-glow);
}

.modal .prize-name {
  color: var(--c-light);
  font-size: 28px;
  font-weight: 800;
  margin: 14px 0;
  padding: 12px;
  background: rgba(6,40,61,0.5);
  border-radius: 12px;
  border: 1px solid var(--c-teal);
  text-shadow: 0 0 8px var(--c-glow);
}

.modal .desc {
  color: var(--c-white);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 22px;
  opacity: 0.9;
}

.modal .btn { width: 100%; }

/* ===== Responsive ===== */
@media (max-width: 920px) {
  .game-area { flex-direction: column; align-items: center; }
  .jackpot-column { flex: 0 0 auto; width: 100%; max-width: 420px; }
  .jackpot-panel { padding: 18px; }
}

@media (max-width: 480px) {
  .container { padding: 18px 14px; }
  .header h1 { font-size: 24px; }
  .wheel-wrapper, #wheelCanvas { width: 320px; height: 320px; }
  .jackpot-amount { font-size: 28px; }
}
