/* ── Page shell ── */
.lotto-page { display: grid; gap: var(--space-4); }

.lotto-hero { padding: var(--space-7) var(--space-8); }
.lotto-hero .hero-note { margin-bottom: var(--space-4); }
.lotto-hero__title {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.3rem);
  letter-spacing: -0.04em;
  line-height: 1.2;
}
.lotto-hero__body {
  max-width: 600px;
  margin: var(--space-3) 0 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.lotto-layout {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 960px) {
  .lotto-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    align-items: start;
  }
}

/* ── Stage panel ── */
.lotto-stage {
  padding: clamp(24px, 3vw, 36px);
  display: grid;
  gap: var(--space-6);
}

.lotto-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.lotto-panel__eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.lotto-panel__title {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

/* ── Draw area: coordinate reference for eject ball ── */
.lotto-draw-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow: visible;
}

/* ── Machine wrap (globe + spout tube) ── */
.machine-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── Globe ── */
.machine-globe {
  position: relative;
  width: min(240px, 68vw);
  height: min(240px, 68vw);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%,
    #f5f9ff 0%,
    #daeeff 38%,
    #b8dcf5 72%,
    #96cae8 100%
  );
  border: 3px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    0 28px 60px rgba(80, 160, 220, 0.22),
    0 6px 20px rgba(0, 0, 0, 0.08),
    inset 0 2px 12px rgba(255, 255, 255, 0.6),
    inset 0 -8px 24px rgba(120, 180, 220, 0.18);
  overflow: hidden;
  flex-shrink: 0;
}

/* glass shine */
.machine-shine {
  position: absolute;
  top: 7%;
  left: 10%;
  width: 46%;
  height: 40%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.78) 0%, transparent 65%);
  pointer-events: none;
  z-index: 10;
}

/* ── Spout tube below globe ── */
.machine-spout-tube {
  width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #b8d8ec 0%, #90bcd8 100%);
  border-left: 2px solid rgba(255, 255, 255, 0.55);
  border-right: 2px solid rgba(255, 255, 255, 0.55);
  border-bottom: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 0 0 10px 10px;
  box-shadow:
    inset 2px 0 6px rgba(255,255,255,0.22),
    inset -2px 0 6px rgba(0,0,0,0.08),
    0 6px 14px rgba(80,160,220,0.18);
  padding-bottom: 6px;
  margin-top: -3px;
}

.spout-gate {
  width: 30px;
  height: 10px;
  background: linear-gradient(180deg, #7aabcb 0%, #5c8ea8 100%);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.18);
  margin-bottom: 2px;
}

/* ── Drum inner (rotation wrapper) ── */
.drum-inner {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

@keyframes drum-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.machine-globe.is-spinning .drum-inner {
  animation: drum-rotate 1.1s linear infinite;
}

/* ── Balls inside globe ── */
.d-ball {
  position: absolute;
  border-radius: 50%;
  box-shadow:
    inset -3px -3px 8px rgba(0,0,0,0.22),
    inset 2px 2px 5px rgba(255,255,255,0.45),
    0 2px 6px rgba(0,0,0,0.12);
}

.d-ball.sz-lg { width: 38px; height: 38px; }
.d-ball.sz-md { width: 34px; height: 34px; }
.d-ball.sz-sm { width: 28px; height: 28px; }

.d-ball.c-yellow { background: radial-gradient(circle at 35% 30%, #ffe57a, #f9c84a); }
.d-ball.c-blue   { background: radial-gradient(circle at 35% 30%, #7bbfee, #4a90d9); }
.d-ball.c-red    { background: radial-gradient(circle at 35% 30%, #f08080, #e05555); }
.d-ball.c-gray   { background: radial-gradient(circle at 35% 30%, #9ca3af, #6b7280); }
.d-ball.c-green  { background: radial-gradient(circle at 35% 30%, #86d07a, #54b847); }

@keyframes drift-1 {
  0%   { transform: translate(18px, 22px); }
  20%  { transform: translate(160px, 14px); }
  40%  { transform: translate(140px, 160px); }
  60%  { transform: translate(28px, 150px); }
  80%  { transform: translate(80px, 60px); }
  100% { transform: translate(18px, 22px); }
}
@keyframes drift-2 {
  0%   { transform: translate(90px, 10px); }
  25%  { transform: translate(155px, 80px); }
  50%  { transform: translate(70px, 170px); }
  75%  { transform: translate(10px, 70px); }
  100% { transform: translate(90px, 10px); }
}
@keyframes drift-3 {
  0%   { transform: translate(150px, 25px); }
  30%  { transform: translate(20px, 90px); }
  60%  { transform: translate(120px, 155px); }
  90%  { transform: translate(160px, 80px); }
  100% { transform: translate(150px, 25px); }
}
@keyframes drift-4 {
  0%   { transform: translate(10px, 100px); }
  33%  { transform: translate(130px, 40px); }
  66%  { transform: translate(145px, 145px); }
  100% { transform: translate(10px, 100px); }
}
@keyframes drift-5 {
  0%   { transform: translate(110px, 140px); }
  25%  { transform: translate(20px, 30px); }
  50%  { transform: translate(155px, 20px); }
  75%  { transform: translate(130px, 155px); }
  100% { transform: translate(110px, 140px); }
}
@keyframes drift-6 {
  0%   { transform: translate(55px, 150px); }
  20%  { transform: translate(150px, 110px); }
  40%  { transform: translate(90px, 20px); }
  60%  { transform: translate(15px, 50px); }
  80%  { transform: translate(30px, 140px); }
  100% { transform: translate(55px, 150px); }
}
@keyframes drift-7 {
  0%   { transform: translate(130px, 100px); }
  30%  { transform: translate(30px, 150px); }
  60%  { transform: translate(20px, 20px); }
  100% { transform: translate(130px, 100px); }
}
@keyframes drift-8 {
  0%   { transform: translate(70px, 70px); }
  25%  { transform: translate(150px, 50px); }
  50%  { transform: translate(100px, 160px); }
  75%  { transform: translate(20px, 110px); }
  100% { transform: translate(70px, 70px); }
}
@keyframes drift-9 {
  0%   { transform: translate(40px, 40px); }
  33%  { transform: translate(160px, 140px); }
  66%  { transform: translate(15px, 140px); }
  100% { transform: translate(40px, 40px); }
}

.d-ball.b1 { animation: drift-1 3.8s ease-in-out infinite; }
.d-ball.b2 { animation: drift-2 4.4s ease-in-out infinite; }
.d-ball.b3 { animation: drift-3 5.1s ease-in-out infinite; }
.d-ball.b4 { animation: drift-4 3.5s ease-in-out infinite; }
.d-ball.b5 { animation: drift-5 4.8s ease-in-out infinite; }
.d-ball.b6 { animation: drift-6 4.2s ease-in-out infinite; }
.d-ball.b7 { animation: drift-7 5.5s ease-in-out infinite; }
.d-ball.b8 { animation: drift-8 3.9s ease-in-out infinite; }
.d-ball.b9 { animation: drift-9 4.6s ease-in-out infinite; }

.machine-globe.is-spinning .d-ball {
  animation-duration: 0.9s !important;
}

@keyframes drum-pulse {
  0%   { box-shadow: 0 28px 60px rgba(80,160,220,0.22), 0 6px 20px rgba(0,0,0,0.08), inset 0 2px 12px rgba(255,255,255,0.6); }
  50%  { box-shadow: 0 28px 80px rgba(80,160,220,0.48), 0 6px 32px rgba(80,160,220,0.2), inset 0 2px 18px rgba(255,255,255,0.76); }
  100% { box-shadow: 0 28px 60px rgba(80,160,220,0.22), 0 6px 20px rgba(0,0,0,0.08), inset 0 2px 12px rgba(255,255,255,0.6); }
}

@keyframes drum-shake {
  0%, 100% { transform: translate(0, 0); }
  20%       { transform: translate(-3px, 1px); }
  40%       { transform: translate(3px, -1px); }
  60%       { transform: translate(-2px, 2px); }
  80%       { transform: translate(2px, -2px); }
}

.machine-globe.is-spinning {
  animation: drum-pulse 0.55s ease-in-out infinite, drum-shake 0.18s linear infinite;
}

/* ── Result track ── */
.result-track {
  width: 100%;
  max-width: 460px;
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.result-track__label {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.result-slots {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(6px, 1.6vw, 12px);
}

/* ── Result slot ── */
.result-slot {
  width: clamp(44px, 10vw, 54px);
  height: clamp(44px, 10vw, 54px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(0.85rem, 2.4vw, 1.05rem);
  font-weight: 800;
  color: #fff;
  transition: background 120ms ease;
}

.result-slot.is-empty {
  background: rgba(23, 32, 51, 0.05);
  border: 2px dashed rgba(23, 32, 51, 0.14);
  color: transparent;
  box-shadow: none;
}

.result-slot.is-settled {
  box-shadow:
    inset -3px -3px 8px rgba(0,0,0,0.2),
    inset 2px 2px 5px rgba(255,255,255,0.35),
    0 6px 18px rgba(0,0,0,0.16);
}

/* ── Eject ball (flying overlay) ── */
.eject-ball {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  pointer-events: none;
  z-index: 100;
  box-shadow:
    inset -3px -3px 9px rgba(0,0,0,0.22),
    inset 2px 2px 6px rgba(255,255,255,0.38),
    0 8px 24px rgba(0,0,0,0.22),
    0 2px 8px rgba(0,0,0,0.14);
  will-change: transform, opacity;
}

/* ── Controls ── */
.lotto-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
}

.lotto-draw-btn {
  min-height: 52px;
  padding: 0 32px;
  font-size: 1rem;
  border-radius: 20px;
}

/* ── Side panel ── */
.lotto-side {
  display: grid;
  gap: var(--space-5);
  align-content: start;
}

.lotto-side-card {
  padding: var(--space-5) var(--space-6);
}

.lotto-side-eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.lotto-side-title {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── History ── */
.lotto-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(3,105,161,0.2) transparent;
}

.lotto-history__empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: var(--space-3) 0;
}

.lotto-history__item {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xs);
  border: 1px solid rgba(23,32,51,0.06);
  background: #fff;
  display: grid;
  gap: var(--space-2);
}

.lotto-history__round {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
}

.lotto-history__balls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.18), inset 1px 1px 3px rgba(255,255,255,0.35);
}

/* ── Color guide ── */
.lotto-color-guide {
  display: grid;
  gap: 10px;
  margin-top: var(--space-4);
}

.color-guide-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset -1px -1px 3px rgba(0,0,0,0.15);
}
