/**
 * CIM Spin Wheel - Kiosk CSS Stylesheet
 * Strict adherence to CIM Brand Manual Edited.pdf guidelines.
 * Target: Vertical Portrait Touchscreen Kiosk (1080 x 1920) & responsive displays.
 * Theme: Clean Luxury White Brand Experience.
 */

/* ==========================================================================
   1. TYPOGRAPHY & BRAND TOKENS
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&display=swap');

/* Offline Local Fallback for Ubuntu Font */
@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ubuntu-regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ubuntu-medium.woff2') format('woff2');
}

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/ubuntu-bold.woff2') format('woff2');
}

:root {
  /* CIM Primary Palette (From Brand Manual Page 9) */
  --cim-magenta: #ED0677;
  /* Pantone 213 C (R237 G6 B119, C0 M100 Y20 K0) */
  --cim-magenta-dark: #C0035E;
  --cim-magenta-glow: rgba(237, 6, 119, 0.35);
  --cim-black: #231F20;
  /* Pantone Process Black C (R35 G31 B32) */
  --cim-white: #FFFFFF;

  /* CIM Secondary Accents (From Brand Manual Page 9) */
  --cim-blue: #00B7E7;
  /* Pantone 306 C (R0 G183 B231) */
  --cim-green: #B2D235;
  /* Pantone 382 C (R178 G210 B53) */
  --cim-gold: #F5B041;
  /* Metallic gold for outer studs & flapper */

  /* White Kiosk Canvas Theme */
  --bg-primary: #FFFFFF;
  --bg-subtle: #F9F8FA;
  --bg-card: #FFFFFF;
  --border-subtle: rgba(35, 31, 32, 0.1);
  --border-active: rgba(237, 6, 119, 0.45);
  --text-primary: #231F20;
  --text-muted: rgba(35, 31, 32, 0.65);

  --font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   2. GLOBAL RESET & KIOSK SAFEGUARDS
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-family);
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* Luxury Ambient Background */
body {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EFEAF0;
  background:
    radial-gradient(circle at 50% 25%, rgba(237, 6, 119, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #F5EEF5 0%, #E6DFE6 100%);
  overflow: hidden;
}

/* Strict 9:16 Aspect Ratio Kiosk Viewport (1080x1920 Optimized) */
.kiosk-viewport {
  height: 100vh;
  width: min(100vw, calc(100vh * (9 / 16)));
  aspect-ratio: 9 / 16;
  max-width: 1080px;
  max-height: 1920px;
  background: #FFFFFF;
  background:
    radial-gradient(circle at 50% 12%, rgba(237, 6, 119, 0.05) 0%, transparent 60%),
    radial-gradient(circle at 50% 88%, rgba(0, 183, 231, 0.04) 0%, transparent 65%),
    linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 45%, #F4F2F6 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  position: relative;
  padding: clamp(6px, 1.4vh, 20px) clamp(4px, 1vw, 14px);
  z-index: 10;
  box-shadow: 0 12px 48px rgba(35, 31, 32, 0.15);
  overflow: hidden;
}

/* On Native 9:16 or Narrower Screens (Mobile / Fullscreen Portrait Kiosk) */
@media (max-aspect-ratio: 9/16) {
  .kiosk-viewport {
    width: 100vw;
    height: 100vh;
    box-shadow: none;
  }
}

/* Ambient Background Circular Geometry */
.ambient-decorations {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.decor-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(237, 6, 119, 0.08);
}

.decor-circle-1 {
  width: 900px;
  height: 900px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 80px rgba(237, 6, 119, 0.03) inset;
}

.decor-circle-2 {
  width: 1250px;
  height: 1250px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-color: rgba(35, 31, 32, 0.03);
}

/* ==========================================================================
   3. HEADER & BRANDING (TOP SECTION)
   ========================================================================== */
.kiosk-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 20;
  position: relative;
  flex-shrink: 0;
  margin-bottom: clamp(4px, 1vh, 14px);
}

/* HUD Utility Bar - Placed neatly on top row, preventing title collisions */
.hud-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: clamp(2px, 0.6vh, 8px);
}

.hud-btn {
  background: #FFFFFF;
  border: 1px solid rgba(35, 31, 32, 0.12);
  color: var(--cim-black);
  border-radius: 50%;
  width: clamp(38px, 4.6vh, 46px);
  height: clamp(38px, 4.6vh, 46px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.95rem, 1.8vh, 1.2rem);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.hud-btn:active {
  transform: scale(0.92);
  background: rgba(237, 6, 119, 0.1);
  border-color: var(--cim-magenta);
  color: var(--cim-magenta);
}

.campaign-title {
  font-size: clamp(1.75rem, 3.6vh, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--cim-black);
  line-height: 1.2;
  margin-top: 2px;
  text-align: center;
}

.campaign-highlight {
  color: var(--cim-magenta);
}

.header-tagline {
  font-size: clamp(0.82rem, 1.5vh, 1rem);
  letter-spacing: 0.01em;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 4px;
  max-width: 480px;
  text-align: center;
  line-height: 1.35;
}

/* ==========================================================================
   4. HERO SPIN WHEEL AREA (MAXIMIZED FULL KIOSK SECTION)
   ========================================================================== */
.wheel-hero-container {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 15;
  min-height: 0;
  padding: 2px 0;
}

.wheel-assembly {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  max-width: 1050px;
  max-height: 1050px;
}

/* Canvas Wheel */
#wheel-canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  filter: drop-shadow(0 20px 48px rgba(35, 31, 32, 0.18));
  cursor: grab;
  touch-action: none;
  position: relative;
  z-index: 10;
}

#wheel-canvas:active {
  cursor: grabbing;
}

/* Precision Teardrop Pointer at 12 o'clock - Sized exactly proportional to wheel */
.wheel-pointer {
  position: absolute;
  top: -3%;
  left: 50%;
  transform: translateX(-50%);
  width: 10%;
  height: 15%;
  z-index: 35;
  pointer-events: none;
  transform-origin: 50% 34%;
  transition: transform 0.04s ease-out;
  filter: drop-shadow(0 6px 14px rgba(35, 31, 32, 0.35));
}

.pointer-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   6. CELEBRATION & RESULT MODALS (CLEAN 9:16 KIOSK UI)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(35, 31, 32, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay.modal-visible {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.modal-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Clean Luxury Kiosk Card - Perfectly proportioned for 9:16 Portrait Displays */
.result-card {
  width: min(88%, 460px);
  background: linear-gradient(165deg, #FFFFFF 0%, #FAFAFD 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 32px;
  padding: clamp(28px, 4vh, 44px) clamp(22px, 3.5vw, 36px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow:
    0 24px 64px rgba(35, 31, 32, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.25);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  color: var(--text-primary);
}

.modal-visible .result-card {
  transform: scale(1) translateY(0);
}

/* Card Accent Borders */
.result-card-win {
  border-color: rgba(237, 6, 119, 0.35);
  box-shadow:
    0 24px 64px rgba(35, 31, 32, 0.28),
    0 0 45px rgba(237, 6, 119, 0.18);
}

.result-card-win::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--cim-magenta), var(--cim-blue), var(--cim-magenta));
}

.result-card-tryagain {
  border-color: rgba(178, 210, 53, 0.45);
  box-shadow:
    0 24px 64px rgba(35, 31, 32, 0.28),
    0 0 45px rgba(178, 210, 53, 0.18);
}

.result-card-tryagain::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: var(--cim-green);
}

.result-card-lost {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow:
    0 24px 64px rgba(35, 31, 32, 0.25);
}

.result-card-lost::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #6C6267, #A39B9F, #6C6267);
}

/* Modal Brand Logo - Prominent Corporate Header */
.modal-brand-logo {
  height: clamp(70px, 8.5vh, 108px);
  width: auto;
  max-width: 230px;
  object-fit: contain;
  margin-bottom: clamp(12px, 1.6vh, 20px);
  display: block;
}

/* Clean Typography */
.result-title {
  font-size: clamp(1.45rem, 2.7vh, 1.95rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 6px 0;
  line-height: 1.22;
}

.result-subtitle {
  font-size: clamp(0.82rem, 1.4vh, 0.95rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 clamp(16px, 2.4vh, 26px) 0;
  font-weight: 500;
}

/* Product Showcase Display */
.result-image-wrap {
  position: relative;
  width: clamp(140px, 18vh, 195px);
  height: clamp(140px, 18vh, 195px);
  margin-bottom: clamp(14px, 2.2vh, 24px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-image-wrap.hidden {
  display: none;
}

/* Halo Spotlight behind product */
.result-product-halo {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(237, 6, 119, 0.18) 0%, rgba(0, 183, 231, 0.08) 55%, transparent 75%);
  filter: blur(14px);
  animation: haloBreathe 3s infinite ease-in-out;
}

@keyframes haloBreathe {

  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.result-product-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 14px 22px rgba(35, 31, 32, 0.24));
  animation: floatProduct 3.5s infinite ease-in-out;
}

@keyframes floatProduct {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.result-gift-name {
  font-size: clamp(1.18rem, 2vh, 1.45rem);
  font-weight: 700;
  color: var(--cim-black);
  margin: 0 0 6px 0;
}

.result-gift-name:empty {
  display: none;
}

.result-description {
  font-size: clamp(0.86rem, 1.4vh, 0.98rem);
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 clamp(20px, 2.8vh, 28px) 0;
  max-width: 380px;
}

/* Action Buttons */
.btn-kiosk-action {
  width: min(90%, 340px);
  height: clamp(50px, 6vh, 60px);
  border-radius: 999px;
  border: none;
  outline: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: clamp(1rem, 1.6vh, 1.18rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(35, 31, 32, 0.16);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn-kiosk-action:active {
  transform: scale(0.96);
  filter: brightness(1.1);
}

.btn-magenta {
  background: linear-gradient(135deg, #FF1E90 0%, var(--cim-magenta) 100%);
  color: var(--cim-white);
  box-shadow: 0 8px 24px rgba(237, 6, 119, 0.38);
}

.btn-green {
  background: linear-gradient(135deg, #C4E245 0%, var(--cim-green) 100%);
  color: #1A1819;
  box-shadow: 0 8px 24px rgba(178, 210, 53, 0.38);
}

.btn-dark {
  background: linear-gradient(135deg, #3A3236 0%, #231F20 100%);
  color: var(--cim-white);
  box-shadow: 0 8px 22px rgba(35, 31, 32, 0.25);
}

/* Fullscreen Confetti Canvas */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 150;
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-height: 800px) {
  .kiosk-viewport {
    padding: 8px 16px;
  }

  .brand-logo {
    height: 48px;
  }

  .campaign-title {
    font-size: 1.4rem;
  }

  .wheel-assembly {
    width: min(72vw, 420px);
    height: min(72vw, 420px);
  }

  .btn-spin-main {
    height: 58px;
    font-size: 1.25rem;
  }
}