.roulette777-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.roulette777-overlay[data-open="true"] {
  display: flex;
}

/* ============ ROOT COMÚN ============ */
.roulette777-root {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(31, 71, 50, 0.85);
  background: linear-gradient(180deg, rgba(5, 16, 12, 0.90), rgba(0, 0, 0, 0.76));
  box-shadow:
    0 0 0 1px rgba(243, 195, 74, 0.12),
    0 0 50px rgba(74, 222, 128, 0.10);
  clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px), 0 18px);
}

/* ============ ADMIN ============ */
.roulette777-overlay[data-role="admin"] .roulette777-root {
  width: min(1240px, 98vw);
  height: min(760px, 92vh);
}

@media (min-width: 980px) {
  .roulette777-overlay[data-role="admin"] .roulette777-root {
    grid-template-columns: 1fr 320px;
  }
}

/* ============ VIEWER - PANTALLA COMPLETA ============ */
.roulette777-overlay[data-role="viewer"] .roulette777-root {
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  padding: 0;
  gap: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
}

.roulette777-overlay[data-role="viewer"] .roulette777-stage {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.roulette777-overlay[data-role="viewer"] .roulette777-canvasWrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roulette777-overlay[data-role="viewer"] .roulette777-canvas {
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.roulette777-overlay[data-role="viewer"] .roulette777-side {
  display: none;
}

.roulette777-overlay[data-role="viewer"] .roulette777-pointer {
  top: 15px;
}

/* ============ STAGE ============ */
.roulette777-stage {
  position: relative;
  border: 1px solid rgba(31, 71, 50, 0.85);
  background: linear-gradient(180deg, rgba(5, 16, 12, 0.92), rgba(0, 0, 0, 0.78));
  box-shadow: inset 0 0 40px rgba(74, 222, 128, 0.08);
  overflow: hidden;
  border-radius: 14px;
}

.roulette777-canvasWrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.roulette777-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.roulette777-pointer {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) rotate(var(--r777-clap-angle, 0rad));
  transform-origin: 50% 0%;
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 30px solid rgba(255, 230, 120, 0.95);
  filter: drop-shadow(0 0 12px rgba(255, 230, 120, 0.55));
  transition: transform 30ms linear;
  z-index: 5;
}

/* ============ SIDE PANEL ADMIN ============ */
.roulette777-side {
  display: none;
  border: 1px solid rgba(31, 71, 50, 0.85);
  background: linear-gradient(180deg, rgba(5, 16, 12, 0.92), rgba(0, 0, 0, 0.76));
  border-radius: 14px;
  box-shadow: inset 0 0 40px rgba(74, 222, 128, 0.06);
  overflow: hidden;
}

.roulette777-overlay[data-role="admin"] .roulette777-side {
  display: block;
}

.roulette777-sideHeader {
  padding: 14px 14px 12px 14px;
  border-bottom: 1px solid rgba(31, 71, 50, 0.85);
  background: linear-gradient(90deg, rgba(243, 195, 74, 0.10), rgba(74, 222, 128, 0.06));
}

.roulette777-sideHeader .h {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 230, 120, 0.92);
}

.roulette777-controls {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.roulette777-btn {
  border: 1px solid rgba(31, 71, 50, 0.85);
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.92);
  padding: 14px 14px;
  font-family: 'Orbitron', system-ui, sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  cursor: pointer;
  clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  box-shadow: inset 0 0 18px rgba(74, 222, 128, 0.06);
}

.roulette777-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(243, 195, 74, 0.30);
  box-shadow: inset 0 0 20px rgba(243, 195, 74, 0.08), 0 0 18px rgba(74, 222, 128, 0.08);
}

.roulette777-btn:active {
  transform: translateY(0px) scale(0.99);
}

.roulette777-btn.primary {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.18), rgba(0, 0, 0, 0.35));
  border-color: rgba(74, 222, 128, 0.30);
}

.roulette777-btn.danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(0, 0, 0, 0.35));
}

.roulette777-btn.warn {
  border-color: rgba(243, 195, 74, 0.35);
  background: linear-gradient(135deg, rgba(243, 195, 74, 0.14), rgba(0, 0, 0, 0.35));
}

/* ============ RESULT DISPLAY ADMIN ============ */
.roulette777-result-display {
  margin: 10px 14px 14px 14px;
  padding: 24px 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(243, 195, 74, 0.3);
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.05), 0 0 15px rgba(0, 0, 0, 0.3);
}

.roulette777-result-label {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 11px;
  color: rgba(74, 222, 128, 0.8);
  text-transform: uppercase;
  letter-spacing: 4px;
  margin-bottom: 12px;
}

.roulette777-result-number {
  font-family: 'Orbitron', system-ui, sans-serif;
  font-size: 64px;
  font-weight: 900;
  color: #f3c34a;
  text-shadow: 
    0 0 20px rgba(243, 195, 74, 0.6),
    0 0 40px rgba(243, 195, 74, 0.3),
    0 0 60px rgba(243, 195, 74, 0.1);
  line-height: 1.1;
  transition: all 0.3s ease;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============ RESULTADO VIEWER - PANTALLA COMPLETA ============ */
.roulette777-viewer-result {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.roulette777-viewer-result.roulette777-viewer-show {
  opacity: 1;
}

.roulette777-viewer-number {
  font-family: 'Orbitron', 'Montserrat', system-ui, sans-serif;
  font-size: min(25vw, 40vh, 300px);
  font-weight: 900;
  color: #f3c34a;
  text-shadow: 
    0 0 40px rgba(243, 195, 74, 0.9),
    0 0 80px rgba(243, 195, 74, 0.7),
    0 0 120px rgba(243, 195, 74, 0.5),
    0 0 200px rgba(243, 195, 74, 0.3),
    0 0 300px rgba(243, 195, 74, 0.2);
  line-height: 1;
  text-align: center;
  transform: scale(0.3);
  opacity: 0;
}

.roulette777-viewer-number.roulette777-viewer-number-pop {
  animation: viewerNumberPop 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* ============ ANIMACIONES ============ */
.roulette777-result-pop {
  animation: resultReveal 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.roulette777-number-pop {
  animation: numberPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes viewerNumberPop {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
  70% {
    transform: scale(0.96);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes resultReveal {
  0% {
    transform: scale(0.85);
    border-color: rgba(243, 195, 74, 0.1);
    box-shadow: inset 0 0 10px rgba(74, 222, 128, 0.02), 0 0 0 rgba(243, 195, 74, 0);
  }
  50% {
    transform: scale(1.05);
    border-color: rgba(243, 195, 74, 0.8);
    box-shadow: 
      inset 0 0 30px rgba(74, 222, 128, 0.1),
      0 0 40px rgba(243, 195, 74, 0.5),
      0 0 60px rgba(243, 195, 74, 0.3);
  }
  100% {
    transform: scale(1);
    border-color: rgba(243, 195, 74, 0.3);
    box-shadow: 
      inset 0 0 20px rgba(74, 222, 128, 0.05),
      0 0 15px rgba(0, 0, 0, 0.3);
  }
}

@keyframes numberPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
    color: #4ade80;
    text-shadow: 
      0 0 20px rgba(74, 222, 128, 0.6),
      0 0 40px rgba(74, 222, 128, 0.3);
  }
  40% {
    transform: scale(1.15);
    opacity: 1;
    color: #f3c34a;
    text-shadow: 
      0 0 30px rgba(243, 195, 74, 0.8),
      0 0 50px rgba(243, 195, 74, 0.4),
      0 0 70px rgba(243, 195, 74, 0.2);
  }
  60% {
    transform: scale(0.95);
    color: #f3c34a;
    text-shadow: 
      0 0 25px rgba(243, 195, 74, 0.7),
      0 0 45px rgba(243, 195, 74, 0.35);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    color: #f3c34a;
    text-shadow: 
      0 0 20px rgba(243, 195, 74, 0.6),
      0 0 40px rgba(243, 195, 74, 0.3),
      0 0 60px rgba(243, 195, 74, 0.1);
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 979px) {
  .roulette777-overlay[data-role="admin"] .roulette777-root {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    padding: 5px;
    gap: 5px;
    clip-path: none;
    border-radius: 0;
  }
  
  .roulette777-overlay[data-role="admin"] .roulette777-side {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 40vh;
    overflow-y: auto;
    z-index: 10;
    border-radius: 14px 14px 0 0;
  }
  
  .roulette777-overlay[data-role="admin"] .roulette777-stage {
    border-radius: 0;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .roulette777-overlay[data-role="viewer"] .roulette777-canvas {
    width: auto;
    height: 95vh;
  }
}

@media (max-width: 480px) {
  .roulette777-overlay[data-role="viewer"] .roulette777-pointer {
    top: 8px;
    border-left-width: 10px;
    border-right-width: 10px;
    border-top-width: 22px;
  }
  
  .roulette777-overlay[data-role="admin"] .roulette777-result-number {
    font-size: 42px;
    min-height: 50px;
  }
}