:root {
  /* Bright Solid Orange Palette (Sensus Ekonomi Bright & Clean) */
  --orange-solid: #ff5d00;
  --orange-bright: #ff6810;
  --orange-deep: #e54e00;
  --orange-light: #fff2eb;
  --orange-border: #ffd8bf;

  --navy-dark: #1e293b;
  --navy-muted: #64748b;
  --navy-light: #f8fafc;

  --white: #ffffff;
  --white-trans: rgba(255, 255, 255, 0.92);
  --white-pill: rgba(255, 255, 255, 0.18);

  --gold: #f59e0b;
  --gold-light: #fef3c7;

  --font-serif: "Cinzel", Georgia, serif;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--orange-solid);
}

body {
  min-height: 100vh;
  margin: 0;
  position: relative;
  overflow-x: hidden;
  color: var(--white);
  font-family: var(--font-sans);
  background: var(--orange-solid);
  -webkit-font-smoothing: antialiased;
}

/* Background - Pure Bright Solid Clean Orange */
.stage-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: var(--orange-solid);
}

.bg-glow, .bg-pattern {
  display: none;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 25;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Main Container */
.stage {
  position: relative;
  z-index: 2;
  display: flex;
  width: min(1080px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 18px;
  flex-direction: column;
  justify-content: center;
}

/* Header Section - Bright & Crisp White Typography */
.masthead {
  margin-bottom: 20px;
  text-align: center;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  margin-bottom: 12px;
  border-radius: 30px;
  background: var(--white);
  box-shadow: 0 4px 14px rgba(180, 50, 0, 0.2);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange-solid);
}

.eyebrow {
  color: var(--orange-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--white);
  text-shadow: 0 3px 12px rgba(170, 45, 0, 0.35);
}

h1 em {
  font-style: normal;
  color: #fff4cc;
  text-shadow: 0 3px 15px rgba(160, 40, 0, 0.4);
}

.ornament {
  display: flex;
  width: min(340px, 70%);
  margin: 12px auto 0;
  align-items: center;
  gap: 14px;
}

.ornament span {
  height: 2px;
  flex: 1;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 2px;
}

.ornament-diamond {
  display: grid;
  width: 28px;
  height: 28px;
  border: 2px solid var(--white);
  border-radius: 5px;
  transform: rotate(45deg);
  place-items: center;
  background: rgba(255, 255, 255, 0.2);
}

.ornament-diamond span {
  transform: rotate(-45deg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--white);
  height: auto;
  flex: none;
  background: transparent;
}

.masthead p {
  margin: 10px 0 0;
  color: var(--white-trans);
  font-size: clamp(0.92rem, 2vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(170, 45, 0, 0.3);
}

/* Main Card - Crisp Solid White */
.roulette-card {
  position: relative;
  padding: 24px clamp(16px, 3.2vw, 36px) 26px;
  border-radius: 20px;
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 24px 60px rgba(160, 45, 0, 0.28),
    0 4px 16px rgba(0, 0, 0, 0.06);
}

.card-glass-glow {
  display: none;
}

/* Card Header Label */
.card-label {
  display: flex;
  margin-bottom: 18px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.label-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-dark);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.label-icon {
  width: 17px;
  height: 17px;
  stroke: var(--orange-solid);
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 20px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #059669;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-live 2s infinite ease-in-out;
}

/* Digits Stage */
.digit-stage {
  padding: 4px 0 10px;
}

.digit-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: clamp(8px, 1.6vw, 15px);
  perspective: 1000px;
}

/* Solid Bright Orange Digit Token */
.digit {
  position: relative;
  aspect-ratio: 0.72;
  border-radius: 14px;
  background: var(--orange-solid);
  border: 2px solid var(--orange-deep);
  box-shadow: 
    0 8px 18px rgba(229, 78, 0, 0.32),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  overflow: hidden;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.digit-inner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.digit span.digit-num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6.8vw, 5.2rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--white);
  text-shadow: 0 2px 8px rgba(170, 45, 0, 0.4);
  user-select: none;
}

.digit.spinning {
  background: var(--orange-bright);
  border-color: #ff8533;
  box-shadow: 0 0 20px rgba(255, 104, 16, 0.45);
}

.digit.spinning span.digit-num {
  animation: digit-spin-blur 0.1s linear infinite;
  color: #fff9e6;
}

.digit.locked {
  background: #ea580c;
  border-color: var(--gold);
  animation: lock-spring 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    0 10px 24px rgba(234, 88, 12, 0.4),
    0 0 0 2px rgba(245, 158, 11, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

.digit.locked span.digit-num {
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

/* Control Settings Panel - Clean Light Style */
.draw-settings {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr 1.1fr;
  margin-top: 16px;
  gap: 1px;
  border-radius: 14px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.setting-item {
  margin: 0;
  padding: 13px 18px;
  background: #f8fafc;
  border: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.setting-item legend,
.setting-header span,
.music-text b {
  font-family: var(--font-sans);
  color: var(--navy-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setting-item legend {
  padding: 0;
  margin-bottom: 8px;
}

/* Segmented Control */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: #e2e8f0;
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  padding: 7px 6px;
  border-radius: 7px;
  color: var(--navy-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.18s ease;
}

.segmented-control input:checked + span {
  color: var(--white);
  background: var(--orange-solid);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(255, 93, 0, 0.35);
}

.segmented-control label:hover input:not(:checked) + span {
  color: var(--navy-dark);
}

/* Range Slider Control */
.delay-control {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.setting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.setting-header output {
  font-family: var(--font-display);
  color: var(--orange-deep);
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--orange-light);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--orange-border);
}

.delay-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none;
  margin: 4px 0 6px;
  cursor: pointer;
}

.delay-control-item.manual-mode {
  opacity: 0.5;
  pointer-events: none;
}

.delay-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange-solid);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(255, 93, 0, 0.45);
  transition: transform 0.15s ease;
}

.delay-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.range-hints {
  display: flex;
  justify-content: space-between;
}

.range-hints small {
  color: var(--navy-muted);
  font-size: 0.64rem;
  font-weight: 600;
}

/* Music Switch Control */
.music-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  width: 100%;
}

.music-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.music-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  background: var(--orange-light);
  border: 1px solid var(--orange-border);
  color: var(--orange-solid);
}

.music-icon svg {
  width: 17px;
  height: 17px;
}

.music-text {
  display: flex;
  flex-direction: column;
}

.music-text small {
  color: var(--navy-muted);
  font-size: 0.64rem;
  font-weight: 500;
  margin-top: 2px;
}

.music-control input[type="checkbox"] {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: #cbd5e1;
  transition: background 0.22s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.music-control input:checked + .switch {
  background: var(--orange-solid);
}

.music-control input:checked + .switch::after {
  transform: translateX(20px);
}

.draw-settings.disabled {
  opacity: 0.55;
  pointer-events: none;
}

/* Status Banner */
.status-wrapper {
  margin: 15px 0 16px;
  display: flex;
  justify-content: center;
}

.status {
  margin: 0;
  padding: 8px 24px;
  border-radius: 30px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--navy-dark);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  transition: all 0.25s ease;
}

.status.winner {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
  animation: pulse-winner 1.5s infinite ease-in-out;
}

/* Action Button - Solid Bright Orange */
.action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.draw-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(360px, 100%);
  min-height: 58px;
  padding: 0 32px;
  border-radius: 14px;
  border: 0;
  background: var(--orange-solid);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 
    0 12px 28px rgba(255, 93, 0, 0.38),
    0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease, background 0.2s ease;
}

.button-glow {
  position: absolute;
  top: -80%;
  left: -40%;
  width: 35%;
  height: 260%;
  transform: rotate(25deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shine 4s ease-in-out infinite;
  pointer-events: none;
}

.button-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.button-icon {
  display: flex;
  align-items: center;
}

.button-icon svg,
.button-arrow svg {
  width: 19px;
  height: 19px;
  stroke: var(--white);
}

.button-arrow {
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.draw-button:hover:not(:disabled) {
  background: var(--orange-bright);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
    0 16px 36px rgba(255, 93, 0, 0.46),
    0 4px 10px rgba(0, 0, 0, 0.12);
}

.draw-button:hover:not(:disabled) .button-arrow {
  transform: translateX(4px);
}

.draw-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.draw-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.draw-button.manual-active {
  display: none;
}

.stop-button {
  display: inline-flex;
  width: min(360px, 100%);
  min-height: 58px;
  padding: 0 32px;
  border: 0;
  border-radius: 14px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--white);
  cursor: pointer;
  background: var(--navy-dark);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.3);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: stop-pulse 1.2s ease-in-out infinite;
  transition: transform 0.18s ease, background 0.18s ease;
}

.stop-button[hidden] {
  display: none;
}

.stop-button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  background: #243451;
}

.stop-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
}

.stop-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.stop-icon {
  width: 14px;
  height: 14px;
  border: 2px solid var(--white);
  border-radius: 2px;
}

.digit.manual-ready {
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 3px;
  transition: outline-color 0.18s ease, transform 0.18s ease;
}

.digit.manual-ready:hover,
.digit.manual-ready:focus-visible {
  z-index: 3;
  outline-color: var(--orange-solid);
  transform: translateY(-3px);
}

/* Footer Section - Crisp White on Bright Orange */
.stage-footer {
  display: flex;
  margin-top: 18px;
  padding: 10px 6px 0;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(170, 45, 0, 0.3);
}

.status-indicator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px #ffffff;
}

.footer-mark {
  color: var(--white);
  font-family: var(--font-display);
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  text-shadow: 0 1px 4px rgba(170, 45, 0, 0.3);
}

/* Keyframes Animations */
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes pulse-winner {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes stop-pulse {
  0%, 100% { box-shadow: 0 12px 28px rgba(15, 23, 42, 0.3); }
  50% { box-shadow: 0 12px 34px rgba(15, 23, 42, 0.55), 0 0 0 5px rgba(255, 255, 255, 0.18); }
}

@keyframes digit-spin-blur {
  0% { transform: translateY(0); filter: blur(0px); opacity: 1; }
  50% { transform: translateY(3px); filter: blur(2px); opacity: 0.75; }
  100% { transform: translateY(0); filter: blur(0px); opacity: 1; }
}

@keyframes lock-spring {
  0% { transform: scale(1.12) rotateX(-20deg); }
  60% { transform: scale(0.96) rotateX(8deg); }
  100% { transform: scale(1) rotateX(0deg); }
}

@keyframes shine {
  0%, 65% { left: -40%; }
  85%, 100% { left: 140%; }
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .stage {
    width: min(100% - 24px, 640px);
    padding: 20px 0;
  }

  .roulette-card {
    padding: 20px 14px 22px;
    border-radius: 16px;
  }

  .draw-settings {
    grid-template-columns: 1fr;
    gap: 1px;
  }

  .setting-item {
    padding: 12px 14px;
  }

  .digit {
    border-radius: 10px;
  }

  .digit-row {
    gap: 6px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2.2rem;
  }

  .masthead p {
    font-size: 0.85rem;
  }

  .digit-row {
    gap: 4px;
  }

  .digit {
    border-radius: 8px;
  }

  .draw-button {
    font-size: 0.82rem;
    min-height: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
