/* Custom variables and typography */
:root {
  --primary-color: #e92b40;
  --secondary-color: #ffd81f;
  --bg-dark: rgba(0, 0, 0, 0.75);
  --text-light: #ffffff;
  --font-fancy: 'Abril Fatface', cursive;
  --font-sans: 'Poppins', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: url("./assets/back.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Base layout */
.app-container {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

/* Header section */
.header-section {
  text-align: center;
  margin-top: 1rem;
  z-index: 5;
  flex-shrink: 0;
}

.logo-title {
  font-family: var(--font-fancy);
  color: var(--secondary-color);
  font-size: 2.5rem;
  margin: 0;
  text-shadow: 3px 3px 0px var(--primary-color), 5px 5px 15px rgba(0,0,0,0.6);
  letter-spacing: 1px;
}

.logo-subtitle {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
  margin: 0.5rem auto 0 auto;
  max-width: 600px;
  line-height: 1.4;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 0 0 10px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
}

@media (max-width: 767px) {
  .logo-title {
    font-size: 2rem;
  }
  .logo-subtitle {
    font-size: 0.85rem;
    padding: 0 1rem;
  }
}

/* Main content grid */
.game-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex-grow: 1;
  gap: 2rem;
}

@media (min-width: 768px) {
  .game-content {
    flex-direction: row;
    justify-content: space-evenly;
    gap: 3rem;
  }
}

/* Left panel: buttons and instructions */
.control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.spin-instructions {
  color: var(--secondary-color);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  margin-top: 1rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  letter-spacing: 0.5px;
  animation: pulse 2s infinite ease-in-out;
}

.arrow {
  width: 100px;
  height: auto;
  transform: rotate(90deg);
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

.float {
  animation: float 1s infinite ease-in-out;
}

#spin-btn {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #fcca1b 100%);
  color: #be1e30;
  border: 4px solid #ffffff;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.8rem;
  padding: 0.8rem 3.5rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(255, 216, 31, 0.45), inset 0 0 10px rgba(255, 255, 255, 0.5);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
  animation: pulse-button 1.8s infinite ease-in-out;
  outline: none;
}

#spin-btn:hover {
  transform: scale(1.06) translateY(-2px);
  background: #ffffff;
  color: #be1e30;
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.5);
}

#spin-btn:active {
  transform: scale(0.95) translateY(1px);
}

#spin-btn:disabled {
  background: #cccccc;
  color: #666666;
  border-color: #aaaaaa;
  cursor: not-allowed;
  transform: scale(0.98);
  box-shadow: none;
  animation: none;
}

@keyframes pulse-button {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

@media (max-width: 767px) {
  .wheel-panel {
    order: 1;
  }
  .control-panel {
    order: 2;
  }
  .arrow {
    display: none; /* Hide comic arrow on mobile to maximize wheel size */
  }
  .spin-instructions {
    font-size: 0.95rem;
    margin-top: 0.75rem;
  }
  #spin-btn {
    font-size: 1.5rem;
    padding: 0.6rem 2.8rem;
  }
}

/* Right panel: Wheel system */
.wheel-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.wheel-container {
  position: relative;
  width: 82vw;
  height: 82vw;
  max-width: 440px;
  max-height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .wheel-container {
    width: 40vw;
    height: 40vw;
    max-width: 460px;
    max-height: 460px;
  }
}

#spinner {
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
  /* Smooth CSS transform transition */
  transition: transform 5s cubic-bezier(0.1, 0.8, 0.1, 1);
}

.pin {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  height: 70px;
  width: auto;
  z-index: 10;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.wheel-stand {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  height: 140px;
  width: auto;
  z-index: 1;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

@media (max-width: 480px) {
  .pin {
    height: 55px;
    top: -10px;
  }
  .wheel-stand {
    height: 100px;
    bottom: -25px;
  }
}

/* Playful animations */
.shake {
  animation: idle-shake 4s infinite ease-in-out;
}

@keyframes idle-shake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(1deg); }
  75% { transform: rotate(-1deg); }
}

@keyframes float {
  0%, 100% { transform: rotate(90deg) translateY(0px); }
  50% { transform: rotate(90deg) translateY(-15px); }
}

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

/* Premium Win Modal Overlay */
.win-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.win-modal.active {
  display: flex;
  opacity: 1;
}

.win-card {
  position: relative;
  background: linear-gradient(135deg, #e92b40 0%, #be1e30 100%);
  border: 5px solid var(--secondary-color);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  color: #fff;
  width: 88%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 216, 31, 0.2);
  transform: scale(0.7);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.win-modal.active .win-card {
  transform: scale(1);
}

.win-card h2 {
  font-family: var(--font-fancy);
  font-size: 2.8rem;
  color: var(--secondary-color);
  margin: 0 0 0.5rem 0;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.4);
}

.win-card p.subtitle {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #f7a4a4;
  margin: 0 0 1.5rem 0;
  font-weight: 600;
}

.win-card .prize-display {
  background: rgba(255, 255, 255, 0.12);
  border: 3px dashed var(--secondary-color);
  border-radius: 16px;
  padding: 1.5rem 1.2rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--secondary-color);
  margin-bottom: 2rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.win-card .claim-btn {
  background: var(--secondary-color);
  color: #be1e30;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.8rem 2.5rem;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(255, 216, 31, 0.4);
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.win-card .claim-btn:hover {
  background: #ffffff;
  color: #be1e30;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.4);
}

.win-card .claim-btn:active {
  transform: translateY(1px);
}

/* Confetti particles */
.confetti-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 10000;
  pointer-events: none;
  animation: fall linear forwards;
}

@keyframes fall {
  0% {
    transform: translateY(-10px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0.3;
  }
}

/* Calibration Panel Styling */
.cal-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  border: 2px solid var(--secondary-color);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  z-index: 99999;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.cal-toggle-btn:hover {
  background: var(--secondary-color);
  color: #000;
  transform: scale(1.05);
}

.calibration-panel {
  display: none; /* Flex when active */
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 280px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--secondary-color);
  border-radius: 12px;
  padding: 1.25rem;
  color: #fff;
  z-index: 99998;
  flex-direction: column;
  gap: 1rem;
  font-family: var(--font-sans);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease-out;
}

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

.calibration-panel h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--secondary-color);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 0.5rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
}

.control-group.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.control-group label {
  font-size: 0.8rem;
  color: #ccc;
}

.control-group select {
  background: #333;
  color: #fff;
  border: 1px solid #555;
  padding: 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
}

.control-group input[type="range"] {
  width: 100%;
  accent-color: var(--secondary-color);
}

.config-output {
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.8rem;
  text-align: left;
}

.config-output p {
  margin: 0 0 6px 0;
  color: #888;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.config-output pre {
  margin: 0;
  font-family: monospace;
  color: var(--secondary-color);
  line-height: 1.4;
}

.close-cal-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s;
  text-transform: uppercase;
}

.close-cal-btn:hover {
  background: #ff5a79;
}

/* Multi-step Modal Styles */
.modal-step {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.modal-step.active {
  display: flex;
  animation: modalStepFadeIn 0.35s ease-out forwards;
}

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

/* Close 'X' Button on Modal Card */
.modal-close-x {
  position: absolute;
  top: 12px;
  right: 18px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.8rem;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
  padding: 0;
  z-index: 10;
}

.modal-close-x:hover {
  color: var(--secondary-color);
  transform: scale(1.1);
}

/* Small Badge Showing Won Prize */
.prize-badge-small {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed var(--secondary-color);
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 1.2rem;
  text-align: center;
  max-width: 90%;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Form Styles */
#claim-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-group {
  width: 100%;
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 16px; /* 16px prevents iOS zoom-in */
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  border-color: var(--secondary-color);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 8px rgba(255, 216, 31, 0.25);
  outline: none;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.win-card .submit-btn {
  background: var(--secondary-color);
  color: #be1e30;
  border: none;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(255, 216, 31, 0.35);
  transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 0.4rem;
  width: 100%;
}

.win-card .submit-btn:hover {
  background: #ffffff;
  color: #be1e30;
  transform: translateY(-2px);
  box-shadow: 0 7px 20px rgba(255, 255, 255, 0.4);
}

.win-card .submit-btn:active {
  transform: translateY(1px);
}

/* Success Step Styles */
.success-icon {
  width: 60px;
  height: 60px;
  background: var(--secondary-color);
  color: #be1e30;
  font-size: 2.2rem;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 12px rgba(255, 216, 31, 0.4);
  animation: successPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.success-desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #fcebeb;
  margin: 0 0 1.8rem 0;
  padding: 0 0.5rem;
}

.win-card .close-btn {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.65rem 2rem;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.win-card .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}

/* Calibration Panel Leads Section */
.calibration-leads-section {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 0.5rem;
  padding-top: 0.8rem;
  text-align: left;
}

.calibration-leads-section h3 {
  border-bottom: none !important;
  margin: 0 0 0.6rem 0 !important;
  font-size: 0.95rem !important;
  color: var(--secondary-color) !important;
  padding-bottom: 0 !important;
}

.leads-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.leads-actions button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: background 0.2s, transform 0.1s;
}

#download-leads-btn {
  background: var(--secondary-color);
  color: #000000;
}

#download-leads-btn:hover {
  background: #ffffff;
}

#clear-leads-btn {
  background: var(--primary-color);
  color: #ffffff;
}

#clear-leads-btn:hover {
  background: #ff5a79;
}

.leads-actions button:active {
  transform: scale(0.96);
}
