/* ============ LOTTO MACHINE REDESIGN ============ */
.lotto-machine-container {
  --machine-primary: #ff9500;
  --machine-primary-strong: #d97706;
  --machine-bg-outer: rgba(10, 10, 16, 0.92);
  --machine-bg-card: rgba(18, 18, 26, 0.9);
  --machine-border: rgba(255, 149, 0, 0.45);
  --machine-border-muted: rgba(160, 160, 176, 0.22);
  --machine-text: #f8fafc;
  --machine-text-muted: #a0a0b0;

  width: min(980px, 100%);
  margin: 0 auto;
  padding: 24px 8px 40px;
  color: var(--machine-text);
  font-family: "Poppins", sans-serif;
}

.lotto-machine-container .lotto-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 22px 24px;
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(32, 24, 10, 0.92) 0%, var(--machine-bg-card) 100%);
  border: 2px solid var(--machine-border);
  box-shadow: 0 14px 36px rgba(255, 149, 0, 0.2);
}

.lotto-machine-container .lotto-header h1 {
  margin: 0;
  font-family: "Orbitron", monospace;
  font-size: clamp(1.6rem, 3.3vw, 2.4rem);
  letter-spacing: 1.3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ff9500 0%, #ffc04d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lotto-machine-container .lotto-subtitle {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: var(--machine-text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.lotto-machine-container .lotto-machine-card {
  border-radius: 18px;
  padding: 28px;
  background: linear-gradient(165deg, rgba(14, 14, 20, 0.94) 0%, rgba(10, 10, 15, 0.96) 100%);
  border: 1px solid var(--machine-border-muted);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lotto-machine-container .lotto-machine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.lotto-machine-container .machine-housing {
  position: relative;
  width: min(500px, 92vw);
  aspect-ratio: 1 / 1;
  padding: 14px;
  border-radius: 50%;
  border: 3px solid var(--machine-primary);
  background: radial-gradient(circle at 32% 24%, rgba(255, 149, 0, 0.16) 0%, rgba(7, 7, 10, 0.92) 72%);
  box-shadow:
    0 0 45px rgba(255, 149, 0, 0.26),
    inset 0 0 70px rgba(255, 149, 0, 0.09);
  transform-style: preserve-3d;
  will-change: transform;
}

.lotto-machine-container .machine-housing.is-shaking {
  animation: chamberShake 0.22s ease-in-out infinite;
}

.lotto-machine-container .machine-core {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  perspective: 1100px;
  transform-style: preserve-3d;
  border: 3px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 45%),
    radial-gradient(circle at 70% 80%, rgba(255, 149, 0, 0.08), transparent 40%),
    linear-gradient(140deg, rgba(31, 31, 43, 0.95), rgba(8, 8, 14, 0.95));
}

.lotto-machine-container .machine-core.is-spinning {
  animation: chamberRock 0.5s ease-in-out infinite;
}

.lotto-machine-container .machine-core::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 14px 24px rgba(255, 255, 255, 0.06),
    inset 0 -18px 26px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.lotto-machine-container .machine-inner-ring {
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 149, 0, 0.22);
  pointer-events: none;
}

.lotto-machine-container .machine-glare {
  position: absolute;
  top: 9%;
  left: 14%;
  width: 22%;
  height: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 55%, transparent 70%);
  pointer-events: none;
}

.lotto-machine-container .balls-container {
  position: absolute;
  inset: 40px;
  perspective: 1000px;
  perspective-origin: 50% 45%;
  transform-style: preserve-3d;
  will-change: transform;
}

.lotto-machine-container .balls-container.is-mixing {
  animation: drumTilt 0.42s ease-in-out infinite;
}

.lotto-machine-container .lottery-ball {
  position: absolute;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", monospace;
  font-weight: 800;
  font-size: 18px;
  color: #f1f5f9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.52) 13%, rgba(255, 255, 255, 0) 33%),
    radial-gradient(circle at 70% 76%, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.18) 55%, rgba(0, 0, 0, 0) 80%),
    radial-gradient(circle at 38% 35%, #697691 0%, #3d4a67 42%, #232b42 72%, #121828 100%);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.52),
    0 14px 26px rgba(0, 0, 0, 0.45),
    inset -9px -10px 14px rgba(0, 0, 0, 0.45),
    inset 6px 6px 10px rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  user-select: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform;
  filter: blur(0px) brightness(1) saturate(1.03);
}

.lotto-machine-container .lottery-ball::before,
.lotto-machine-container .lottery-ball::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.lotto-machine-container .lottery-ball::before {
  top: 6px;
  left: 7px;
  width: 34%;
  height: 34%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.08) 78%, rgba(255, 255, 255, 0) 100%);
  transform: translateZ(5px);
}

.lotto-machine-container .lottery-ball::after {
  right: 6px;
  bottom: 7px;
  width: 28%;
  height: 28%;
  background: radial-gradient(circle at 40% 40%, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.08) 75%, rgba(0, 0, 0, 0) 100%);
  transform: translateZ(-2px);
}

.lotto-machine-container .lottery-ball.tumbling {
  animation-timing-function: linear !important;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.55),
    0 18px 34px rgba(0, 0, 0, 0.42),
    inset -9px -10px 14px rgba(0, 0, 0, 0.45),
    inset 6px 6px 10px rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.lotto-machine-container .lottery-ball.glowing {
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 252, 232, 0.95) 0%, rgba(255, 255, 255, 0.38) 18%, rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 70% 78%, rgba(120, 53, 15, 0.5) 0%, rgba(120, 53, 15, 0) 70%),
    radial-gradient(circle at 38% 35%, #facc15 0%, #f59e0b 48%, #d97706 76%, #b45309 100%);
  color: #fff;
  box-shadow:
    0 0 28px rgba(251, 191, 36, 0.72),
    0 0 40px rgba(251, 191, 36, 0.3),
    inset -9px -10px 13px rgba(120, 53, 15, 0.35),
    inset 6px 6px 11px rgba(255, 251, 235, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  animation: glow 0.9s ease-in-out infinite !important;
}

.lotto-machine-container .lottery-ball.drawn {
  opacity: 0.28;
  transform: scale(0.82) translateZ(-20px);
  pointer-events: none;
}

.lotto-machine-container .draw-chute {
  width: min(250px, 85%);
  padding: 12px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 149, 0, 0.28);
  background: linear-gradient(180deg, rgba(30, 30, 44, 0.88) 0%, rgba(14, 14, 20, 0.88) 100%);
  display: flex;
  justify-content: center;
  gap: 16px;
}

.lotto-machine-container .draw-chute-line {
  width: 38%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 149, 0, 0.75), transparent);
}

.lotto-machine-container .drawn-balls {
  width: 100%;
  min-height: 110px;
  padding: 14px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(20, 20, 30, 0.55);
  border: 1px solid rgba(255, 149, 0, 0.2);
}

.lotto-machine-container .drawn-ball {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", monospace;
  font-weight: 900;
  font-size: 26px;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  background:
    radial-gradient(circle at 31% 26%, rgba(255, 251, 235, 0.92) 0%, rgba(255, 255, 255, 0.32) 14%, rgba(255, 255, 255, 0) 35%),
    radial-gradient(circle at 73% 78%, rgba(124, 45, 18, 0.38) 0%, rgba(124, 45, 18, 0) 70%),
    radial-gradient(circle at 38% 35%, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  box-shadow:
    0 10px 24px rgba(255, 149, 0, 0.45),
    0 16px 28px rgba(0, 0, 0, 0.32),
    inset -8px -9px 12px rgba(124, 45, 18, 0.35),
    inset 6px 6px 10px rgba(255, 251, 235, 0.22);
  animation: resultEnter 0.5s ease-out;
}

.lotto-machine-container .drawn-ball::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 9px;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0) 72%);
}

.lotto-machine-container .control-panel {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lotto-machine-container .btn-large {
  padding: 14px 34px !important;
  font-size: 0.95rem !important;
}

.lotto-machine-container .btn-warning {
  background: rgba(255, 149, 0, 0.12);
  border: 1px solid rgba(255, 149, 0, 0.55);
  color: #ffbb4d;
}

.lotto-machine-container .btn-warning:hover {
  background: rgba(255, 149, 0, 0.9);
  border-color: #ff9500;
  color: #141414;
}

.lotto-machine-container .results-section {
  margin-top: 22px;
}

.lotto-machine-container .results-card {
  border-radius: 16px;
  padding: 22px;
  background: linear-gradient(165deg, rgba(18, 18, 26, 0.94) 0%, rgba(14, 14, 20, 0.96) 100%);
  border: 1px solid rgba(255, 149, 0, 0.36);
  box-shadow: 0 14px 28px rgba(255, 149, 0, 0.16);
  text-align: center;
}

.lotto-machine-container .results-card h2 {
  margin: 0 0 16px;
  font-family: "Orbitron", monospace;
  font-size: 1.2rem;
  color: #ffb347;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.lotto-machine-container .results-numbers {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.lotto-machine-container .result-number {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Orbitron", monospace;
  font-weight: 900;
  font-size: 1.15rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 251, 235, 0.9) 0%, rgba(255, 255, 255, 0.28) 14%, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 38% 35%, #ffb347 0%, #ff9500 50%, #cc7700 100%);
  box-shadow:
    0 8px 18px rgba(255, 149, 0, 0.38),
    inset -6px -7px 10px rgba(124, 45, 18, 0.28),
    inset 5px 5px 8px rgba(255, 251, 235, 0.2);
}

.lotto-machine-container .result-number::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 8px;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 75%);
}

.lotto-machine-container .draw-time {
  margin: 0;
  color: var(--machine-text-muted);
  font-size: 0.88rem;
}

.lotto-machine-container .results-actions {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

@keyframes glow {
  0%,
  100% {
    transform: scale(1) translateZ(0px);
  }
  50% {
    transform: scale(1.08) translateZ(10px);
  }
}

@keyframes chamberShake {
  0% {
    transform: translate3d(0px, 0px, 0px) rotate(0deg);
  }
  20% {
    transform: translate3d(-4px, 2px, 0px) rotate(-1.2deg);
  }
  40% {
    transform: translate3d(4px, -2px, 0px) rotate(1.3deg);
  }
  60% {
    transform: translate3d(-3px, -2px, 0px) rotate(-1deg);
  }
  80% {
    transform: translate3d(3px, 2px, 0px) rotate(0.9deg);
  }
  100% {
    transform: translate3d(0px, 0px, 0px) rotate(0deg);
  }
}

@keyframes chamberRock {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(1.2deg);
  }
  50% {
    transform: rotate(-1.5deg);
  }
  75% {
    transform: rotate(1deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes drumTilt {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
  25% {
    transform: rotateX(7deg) rotateY(-8deg);
  }
  50% {
    transform: rotateX(-6deg) rotateY(9deg);
  }
  75% {
    transform: rotateX(6deg) rotateY(7deg);
  }
  100% {
    transform: rotateX(0deg) rotateY(0deg);
  }
}

@keyframes resultEnter {
  from {
    transform: scale(0) rotate(300deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .lotto-machine-container {
    width: 100%;
    padding-inline: 0;
  }

  .lotto-machine-container .lotto-machine-card {
    padding: 20px;
  }

  .lotto-machine-container .machine-housing {
    width: min(440px, 95vw);
  }

  .lotto-machine-container .balls-container {
    inset: 34px;
  }
}

@media (max-width: 640px) {
  .lotto-machine-container .lotto-machine-card {
    padding: 16px;
  }

  .lotto-machine-container .machine-housing {
    width: min(360px, 96vw);
  }

  .lotto-machine-container .balls-container {
    inset: 26px;
  }

  .lotto-machine-container .drawn-ball {
    width: 58px;
    height: 58px;
    font-size: 22px;
  }

  .lotto-machine-container .result-number {
    width: 50px;
    height: 50px;
    font-size: 1rem;
  }

  .lotto-machine-container .btn-large {
    width: 100%;
    justify-content: center;
  }
}
