/* ============================================
   Prize Wheel - Trade Show Edition
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800;900&display=swap');

:root {
  --ci-blue: #338FA7;
  --ci-green: #02AD54;
  --bg-primary: #0a1a1f;
  --bg-secondary: #0f2428;
  --text-primary: #f0f6fc;
  --text-secondary: #8b9ca3;
  --gold: #ffd60a;
  --shadow-glow: 0 0 60px rgba(51, 143, 167, 0.3);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(51, 143, 167, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(2, 173, 84, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 90%, rgba(51, 143, 167, 0.1) 0%, transparent 35%);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 700px;
  height: 100%;
  max-height: 1000px;
  padding: 1.5rem 1rem;
  gap: 1rem;
}

/* Header */
.header {
  text-align: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  max-width: 400px;
  width: auto;
  height: auto;
  margin-bottom: 1.5rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.header h1 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 8vw, 4rem);
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--ci-blue) 0%, var(--ci-green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(51, 143, 167, 0.5);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  margin-bottom: 1rem;
}

.instructions-section {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1rem 0;
}

.instructions {
  list-style: none;
  counter-reset: step-counter;
  padding: 0;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--text-secondary);
  text-align: center;
  max-width: 500px;
}

.instructions li {
  counter-increment: step-counter;
  margin-bottom: 1rem;
  padding-left: 2.5rem;
  position: relative;
  line-height: 1.6;
  text-align: left;
}

.instructions li::before {
  content: counter(step-counter) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--ci-blue);
  font-size: 1.2em;
}

/* Wheel Area */
.wheel-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.wheel-container {
  position: relative;
  width: min(85vw, 85vh, 500px);
  height: min(85vw, 85vh, 500px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
  transition: filter 0.3s ease;
}

.wheel-container:has(#wheel.spinning) #wheel {
  filter: drop-shadow(0 10px 50px rgba(2, 173, 84, 0.4));
}

/* Pointer */
.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 50px solid var(--gold);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  z-index: 10;
}

.pointer::after {
  content: '';
  position: absolute;
  top: -48px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 38px solid #fff8dc;
}

/* Center Hub */
.center-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 18%;
  height: 18%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, var(--gold) 30%, #b8860b 100%);
  border-radius: 50%;
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.6),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
  z-index: 5;
}

.center-hub::after {
  content: '';
  position: absolute;
  top: 15%;
  left: 15%;
  width: 35%;
  height: 35%;
  background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 70%);
  border-radius: 50%;
}

/* Result Display */
.result-display {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

.result-display[hidden] {
  display: none !important;
}

.result-content {
  text-align: center;
  animation: resultPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes resultPop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.result-label {
  display: block;
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.result-prize {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: clamp(2.5rem, 10vw, 4.5rem);
  background: linear-gradient(135deg, var(--ci-blue) 0%, var(--ci-green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px rgba(2, 173, 84, 0.6);
  letter-spacing: 0.02em;
}

.tap-hint {
  display: block;
  margin-top: 2rem;
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Controls */
.controls {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  padding-bottom: 1rem;
}

.spin-button {
  position: relative;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: 0.08em;
  padding: 1rem 4rem;
  border: none;
  border-radius: 60px;
  background: linear-gradient(135deg, var(--ci-blue) 0%, var(--ci-green) 100%);
  color: white;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 
    0 8px 30px rgba(2, 173, 84, 0.4),
    0 2px 10px rgba(0, 0, 0, 0.3);
}

.spin-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.spin-button:hover:not(:disabled)::before {
  left: 100%;
}

.spin-button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 12px 40px rgba(2, 173, 84, 0.5),
    0 4px 15px rgba(0, 0, 0, 0.3);
}

.spin-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.spin-button:disabled {
  background: linear-gradient(135deg, #4a4a5a 0%, #2a2a3a 100%);
  cursor: not-allowed;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.spin-button:disabled .spin-text {
  opacity: 0.6;
}

/* Spinning state animation for button text */
.spin-button.spinning .spin-text::after {
  content: '...';
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Confetti particles (added via JS) */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 200;
  animation: confettiFall 3s ease-out forwards;
}

/* CI gradient colors for confetti will be set in JS */

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive adjustments */
@media (max-height: 700px) {
  .container {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .header h1 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }
  
  .logo {
    max-width: 250px;
    margin-bottom: 1rem;
  }
  
  .instructions {
    font-size: 1.8rem;
  }
  
  .instructions-section {
    padding: 0.5rem 0;
  }
  
  .instructions li {
    margin-bottom: 0.5rem;
  }
  
  .spin-button {
    padding: 0.75rem 3rem;
    font-size: 1.5rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .container {
    flex-direction: row;
    max-width: none;
    padding: 0.5rem 2rem;
  }
  
  .header {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }
  
  .wheel-container {
    width: min(70vh, 400px);
    height: min(70vh, 400px);
  }
  
  .controls {
    padding: 0;
  }
  
  .spin-button {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 3rem 1rem;
  }
}

/* ============================================
   iPad Landscape (1024×768 and similar)
   ============================================ */
@media (min-aspect-ratio: 1/1) and (min-width: 1024px) and (min-height: 600px) {
  .container {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 1fr auto 1fr;
    grid-template-areas:
      "wheel header"
      "wheel instructions"
      "wheel controls";
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    padding: 2rem 3rem;
    gap: 1.5rem;
  }

  .wheel-area {
    grid-area: wheel;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .wheel-container {
    width: min(72vh, 600px);
    height: min(72vh, 600px);
  }

  .header {
    grid-area: header;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    padding-bottom: 0;
  }

  .header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 0.75rem;
  }

  .logo {
    max-width: 300px;
    margin-bottom: 1.5rem;
  }

  .instructions-section {
    grid-area: instructions;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
  }

  .instructions {
    font-size: clamp(1.6rem, 3vw, 2.2rem);
  }

  .controls {
    grid-area: controls;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 0;
  }

  .spin-button {
    font-size: 1.75rem;
    padding: 1.25rem 3.5rem;
  }
}
