/**
 * ==============================================================================
 * FeelingsWheels - Responsive Wheel Stage, Canvas, Pointer & Typography
 * ==============================================================================
 * File: assets/css/wheel.css
 */

:root {
  /* Fluid Scale Units */
  --hub-size: clamp(48px, 12vw, 76px);
  --wheel-font-size: clamp(0.65rem, 1.8vw, 0.95rem);
}

/* Base Card Container */
.wheel-stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: clamp(0.75rem, 2.5vw, 1.25rem);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 1rem);
  width: 100%;
  box-sizing: border-box;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  z-index: 20;
}

.wheel-select-wrapper {
  position: relative;
}

.btn-wheel-select {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.45rem 0.9rem;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.btn-wheel-select .icon-layers {
  color: var(--accent-mint);
}

.wheel-select-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: min(280px, 85vw);
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  z-index: 100;
}

.wheel-select-dropdown.is-open {
  display: flex;
}

.dropdown-header-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
}

.preset-item-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.preset-item-btn.is-active {
  background: rgba(0, 229, 153, 0.1);
  color: var(--accent-mint);
  font-weight: 600;
}

.btn-stage-action {
  width: clamp(34px, 8vw, 40px);
  height: clamp(34px, 8vw, 40px);
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ==========================================================================
   Canvas Viewport (Fluid & Centered)
   ========================================================================== */
.canvas-viewport {
    position: relative;
    width: 100%;
    max-width: 540px;
    margin: 0.5rem auto;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
        touch-action: pan-y !important;
}

.wheel-rim-glow {
  position: absolute;
  inset: -2%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 225, 255, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* The HTML5 Canvas (Mobile Scroll Safe) */
#wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    cursor: grab;
    z-index: 2;
    transition: transform 0.05s linear;
    
    /* --- YEH SABSE ZAROORI LINE HAI --- */
    touch-action: pan-y !important; /* Mobile & Tablet par ungli se vertical scroll kabhi nahi rukega! */
    -webkit-user-select: none;
    user-select: none;
}

#wheel-canvas:active {
  cursor: grabbing;
}

/* ==========================================================================
   Wheel Slice Labels
   ========================================================================== */
.wheel-slice-text,
.wheel-slice-label,
svg text.slice-text {
  font-family: var(--font-heading, sans-serif);
  font-size: var(--wheel-font-size);
  font-weight: 700;
  fill: currentColor;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Center Spin Hub (Auto-Scale)
   ========================================================================== */
.wheel-center-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--hub-size);
  height: var(--hub-size);
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  padding: 0;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wheel-center-hub:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.wheel-center-hub:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.center-hub-text {
  font-family: var(--font-heading);
  font-size: clamp(0.75rem, 2.2vw, 1.1rem);
  font-weight: 800;
  color: #EF4444;
  text-transform: uppercase;
  user-select: none;
  line-height: 1;
}

/* ==========================================================================
   Custom Shape Pointers Engine (Base Desktop Setup)
   ========================================================================== */
.wheel-pointer-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  z-index: 9;
  pointer-events: none;
  --hub-size-fixed: 72px;
}

.pointer-scaler {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: bottom center;
}

.pointer-tick-anim {
  animation: pointerTick 0.12s ease-out;
}

@keyframes pointerTick {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-12deg); }
  100% { transform: rotate(0deg); }
}

/* --- Style 1: Teardrop (Classic / Golden) Desktop --- */
.pointer-style-teardrop .pointer-shape {
  position: absolute;
  width: 26px;
  height: 40px;
  bottom: calc(var(--hub-size-fixed) / 2.35);
  left: -13px;
  filter: drop-shadow(0 -2px 6px rgba(0, 0, 0, 0.45));
}

.pointer-style-teardrop .pointer-shape::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.pointer-style-teardrop .pointer-shape::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 3.5px;
  right: 3.5px;
  bottom: 3.5px;
  background: #EF4444;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* --- Style 2: Triangle (Neon Theme) Desktop --- */
.pointer-style-triangle .pointer-shape {
  position: absolute;
  width: 28px;
  height: 44px;
  bottom: calc(var(--hub-size-fixed) / 2.7);
  left: -14px;
  filter: drop-shadow(0 -4px 10px rgba(0, 0, 0, 0.45)) 
          drop-shadow(0 0 12px rgba(168, 85, 247, 0.75));
}

.pointer-style-triangle .pointer-shape::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  clip-path: polygon(
    50% 0%, 100% 72%, 76% 72%, 76% 100%, 24% 100%, 24% 72%, 0% 72%
  );
}

.pointer-style-triangle .pointer-shape::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  background: linear-gradient(180deg, #7E22CE 0%, #C084FC 70%, #F3E8FF 100%);
  clip-path: polygon(
    50% 0%, 100% 72%, 76% 72%, 76% 100%, 24% 100%, 24% 72%, 0% 72%
  );
}

/* --- Style 3: Gem Theme Desktop --- */
.pointer-style-gem .pointer-shape {
  position: absolute;
  width: 26px;
  height: 42px;
  bottom: calc(var(--hub-size-fixed) / 2.6);
  left: -13px;
  filter: drop-shadow(0 -4px 8px rgba(0, 0, 0, 0.4)) 
          drop-shadow(0 0 12px rgba(56, 189, 248, 0.8));
}

.pointer-style-gem .pointer-shape::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  clip-path: polygon(50% 0%, 100% 32%, 82% 100%, 18% 100%, 0% 32%);
}

.pointer-style-gem .pointer-shape::after {
  content: "";
  position: absolute;
  top: 4.5px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  background: linear-gradient(180deg, #E0F2FE 0%, #38BDF8 38%, #0284C7 100%);
  clip-path: polygon(50% 0%, 100% 32%, 82% 100%, 18% 100%, 0% 32%);
}

/* --- Style 4: Heart (Wedding Theme) Desktop --- */
.pointer-style-heart .pointer-shape {
  position: absolute;
  width: 32px;
  height: 42px;
  bottom: calc(var(--hub-size-fixed) / 2.5);
  left: -16px;
  filter: drop-shadow(0 -4px 8px rgba(0, 0, 0, 0.45)) 
          drop-shadow(0 0 12px rgba(244, 63, 94, 0.8));
}

.pointer-style-heart .pointer-shape::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #FFFFFF;
  clip-path: polygon(
    50% 0%, 78% 22%, 100% 48%, 86% 82%, 50% 100%, 14% 82%, 0% 48%, 22% 22%
  );
}

.pointer-style-heart .pointer-shape::after {
  content: "";
  position: absolute;
  top: 4.5px;
  left: 3.5px;
  right: 3.5px;
  bottom: 3.5px;
  background: linear-gradient(180deg, #FFE4E6 0%, #F43F5E 42%, #BE123C 100%);
  clip-path: polygon(
    50% 0%, 78% 22%, 100% 48%, 86% 82%, 50% 100%, 14% 82%, 0% 48%, 22% 22%
  );
}

/* ==========================================================================
   Bottom Controls Bar
   ========================================================================== */
.stage-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.quick-controls-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-control-square {
  width: clamp(38px, 9vw, 44px);
  height: clamp(38px, 9vw, 44px);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.timer-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  background: var(--accent-mint);
  color: #0B0F14;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.08rem 0.28rem;
  border-radius: var(--radius-sm);
}

.hero-spin-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.btn-hero-spin {
  width: 100%;
  max-width: 280px;
  height: clamp(38px, 9vw, 46px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-cyan);
  color: #0B0F14;
  font-family: var(--font-heading);
  font-size: clamp(0.85rem, 2.2vw, 1rem);
  font-weight: 800;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-cyan-glow);
  white-space: nowrap;
  padding: 0 0.75rem;
  transition: transform 0.1s ease;
}

.btn-hero-spin:active {
  transform: scale(0.97);
}

.btn-hero-spin .kbd-badge {
  background: rgba(11, 15, 20, 0.2);
  border: 1px solid rgba(11, 15, 20, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.quick-controls-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-ad-free-badge {
  height: clamp(38px, 9vw, 44px);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 clamp(0.5rem, 2vw, 0.85rem);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--accent-pink);
  text-decoration: none;
  font-size: clamp(0.72rem, 1.8vw, 0.825rem);
  font-weight: 700;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* 7. FULLSCREEN VIEWPORT STYLING (Guaranteed 100% Perfect Circle on any Screen)*/
/* -------------------------------------------------------------------------- */
/* Fullscreen Stage (z-index 9000 par rahega taaki Modal 99999 upar dikhe) */
.wheel-stage-card.is-fullscreen,
:fullscreen .wheel-stage-card,
:-webkit-full-screen .wheel-stage-card {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9000 !important; /* <-- Isko 9000 kar dein */
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    padding: 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    background: var(--bg-body) !important;
    box-sizing: border-box !important;
}

.wheel-stage-card.is-fullscreen .stage-header,
.wheel-stage-card:fullscreen .stage-header {
    max-width: 500px;
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Force Exact 1:1 Square (Width = Height = min(78vw, 78vh)) */
.wheel-stage-card.is-fullscreen .canvas-viewport,
.wheel-stage-card:fullscreen .canvas-viewport,
.wheel-stage-card:-webkit-full-screen .canvas-viewport {
    width: min(78vw, 78vh) !important;
    height: min(78vw, 78vh) !important;
    max-width: min(78vw, 78vh) !important;
    max-height: min(78vw, 78vh) !important;
    aspect-ratio: 1 / 1 !important;
    margin: auto !important;
    flex-shrink: 0 !important;
}

.wheel-stage-card.is-fullscreen #wheel-canvas,
.wheel-stage-card:fullscreen #wheel-canvas {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
}

/* ==========================================================================
   Media Queries: Tablets & Laptops (769px - 1024px)
   ========================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
  .canvas-viewport {
    max-width: min(420px, 60vw);
  }
}

/* ==========================================================================
   Media Queries: Tablet Sizing (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .btn-hero-spin .kbd-badge {
    display: none !important;
  }

  .wheel-pointer-container {
    --hub-size-fixed: 64px;
  }

  /* Teardrop on Tablet */
  .pointer-style-teardrop .pointer-shape {
    width: 23px;
    height: 35px;
    left: -11.5px;
    bottom: calc(var(--hub-size-fixed) / 2.35);
  }

  .pointer-style-teardrop .pointer-shape::after {
    top: 4px;
    left: 3px;
    right: 3px;
    bottom: 3px;
  }

  /* Triangle (Neon) on Tablet - Exact vector shape preserved */
  .pointer-style-triangle .pointer-shape {
    width: 24px;
    height: 38px;
    left: -12px;
    bottom: calc(var(--hub-size-fixed) / 2.7);
    filter: drop-shadow(0 -3px 6px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 9px rgba(168, 85, 247, 0.75));
  }

  .pointer-style-triangle .pointer-shape::after {
    top: 4px;
    left: 2.5px;
    right: 2.5px;
    bottom: 2.5px;
  }

  /* Gem on Tablet */
  .pointer-style-gem .pointer-shape {
    width: 22px;
    height: 36px;
    left: -11px;
    bottom: calc(var(--hub-size-fixed) / 2.6);
  }

  .pointer-style-gem .pointer-shape::after {
    top: 3.5px;
    left: 2.5px;
    right: 2.5px;
    bottom: 2.5px;
  }

  /* Heart (Wedding) on Tablet - Exact vector shape preserved */
  .pointer-style-heart .pointer-shape {
    width: 27px;
    height: 36px;
    left: -13.5px;
    bottom: calc(var(--hub-size-fixed) / 2.5);
    filter: drop-shadow(0 -3px 6px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 9px rgba(244, 63, 94, 0.75));
  }

  .pointer-style-heart .pointer-shape::after {
    top: 3.5px;
    left: 2.8px;
    right: 2.8px;
    bottom: 2.8px;
  }
}

/* ==========================================================================
   Media Queries: Mobile Screens (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .wheel-pointer-container {
    --hub-size-fixed: 56px;
  }

  /* Teardrop on Mobile */
  .pointer-style-teardrop .pointer-shape {
    width: 20px;
    height: 30px;
    left: -10px;
    bottom: calc(var(--hub-size-fixed) / 2.35);
  }

  .pointer-style-teardrop .pointer-shape::after {
    top: 3px;
    left: 2px;
    right: 2px;
    bottom: 2px;
  }

  /* Triangle (Neon) on Mobile - Razor Sharp */
  .pointer-style-triangle .pointer-shape {
    width: 22px;
    height: 34px;
    left: -11px;
    bottom: calc(var(--hub-size-fixed) / 2.7);
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 7px rgba(168, 85, 247, 0.8));
  }

  .pointer-style-triangle .pointer-shape::after {
    top: 3px;
    left: 2px;
    right: 2px;
    bottom: 2px;
  }

  /* Gem on Mobile */
  .pointer-style-gem .pointer-shape {
    width: 19px;
    height: 31px;
    left: -9.5px;
    bottom: calc(var(--hub-size-fixed) / 2.6);
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.4)) 
            drop-shadow(0 0 7px rgba(56, 189, 248, 0.8));
  }

  .pointer-style-gem .pointer-shape::after {
    top: 3px;
    left: 2px;
    right: 2px;
    bottom: 2px;
  }

  /* Heart (Wedding) on Mobile - Razor Sharp */
  .pointer-style-heart .pointer-shape {
    width: 23px;
    height: 31px;
    left: -11.5px;
    bottom: calc(var(--hub-size-fixed) / 2.5);
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 7px rgba(244, 63, 94, 0.8));
  }

  .pointer-style-heart .pointer-shape::after {
    top: 3px;
    left: 2px;
    right: 2px;
    bottom: 2px;
  }
}

/* ==========================================================================
   Media Queries: Small Screens & Foldables (<= 380px)
   ========================================================================== */
@media (max-width: 380px) {
  .stage-controls-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.35rem;
  }

  .btn-ad-free-badge span:last-child {
    display: none;
  }

  .wheel-pointer-container {
    --hub-size-fixed: 48px;
  }

  /* Teardrop on Small Mobile */
  .pointer-style-teardrop .pointer-shape {
    width: 17px;
    height: 25px;
    left: -8.5px;
    bottom: calc(var(--hub-size-fixed) / 2.35);
  }

  /* Triangle (Neon) on Small Mobile */
  .pointer-style-triangle .pointer-shape {
    width: 18px;
    height: 28px;
    left: -9px;
    bottom: calc(var(--hub-size-fixed) / 2.7);
    filter: drop-shadow(0 -2px 3px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 5px rgba(168, 85, 247, 0.85));
  }

  /* Gem on Small Mobile */
  .pointer-style-gem .pointer-shape {
    width: 16px;
    height: 26px;
    left: -8px;
    bottom: calc(var(--hub-size-fixed) / 2.6);
  }

  /* Heart (Wedding) on Small Mobile */
  .pointer-style-heart .pointer-shape {
    width: 19px;
    height: 26px;
    left: -9.5px;
    bottom: calc(var(--hub-size-fixed) / 2.5);
    filter: drop-shadow(0 -2px 3px rgba(0, 0, 0, 0.45)) 
            drop-shadow(0 0 5px rgba(244, 63, 94, 0.85));
  }
}

/* ==========================================================================
   Media Queries: Landscape Mode on Mobile
   ========================================================================== */
@media (max-height: 520px) and (orientation: landscape) {
  .wheel-stage-card {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
  }

  .canvas-viewport {
    max-width: 55vh;
    max-height: 55vh;
  }

  .stage-controls-bar {
    width: auto;
    flex-direction: column;
  }
}