:root {
  color-scheme: dark;
  --bg: #080a0f;
  --panel: #111722;
  --panel-2: #172033;
  --line: #2b3953;
  --text: #edf4ff;
  --muted: #9fb0c7;
  --cyan: #ffd33d;
  --lime: #fff16a;
  --pink: #ff4fa3;
  --amber: #ffc247;
  --danger: #ff5d5d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, #07080c 0%, #101725 48%, #0b0f16 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 78px;
  height: 100vh;
}

.stage {
  position: relative;
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  background: #020408;
}

#glCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#glCanvas:active {
  cursor: grabbing;
}

.stars {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 229, 94, 0.92);
  box-shadow: 0 0 10px rgba(255, 210, 54, 0.62);
  animation: twinkle 3.8s ease-in-out infinite;
}

.star.big {
  width: 6px;
  height: 6px;
  background: rgba(255, 244, 156, 0.82);
  box-shadow: 0 0 16px rgba(255, 219, 70, 0.78);
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.26;
  }
  50% {
    opacity: 0.9;
  }
}

.pad-labels {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.pad-label {
  position: absolute;
  min-width: 24px;
  padding: 1px 3px;
  transform: translate(-50%, -50%);
  color: #fff6b6;
  background: rgba(7, 12, 20, 0.42);
  border: 1px solid rgba(255, 226, 90, 0.24);
  border-radius: 5px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

.pad-label.hot {
  color: #ffe65a;
  border-color: rgba(255, 226, 90, 0.55);
  box-shadow: 0 0 18px rgba(255, 210, 44, 0.18);
}

.pad-label.dim {
  color: rgba(204, 219, 240, 0.72);
  border-color: rgba(104, 131, 170, 0.18);
}

.panel {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 16px 14px;
  background: rgba(8, 12, 19, 0.96);
  border-right: 1px solid rgba(108, 137, 180, 0.22);
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.35);
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, var(--cyan), transparent 52%),
    linear-gradient(315deg, var(--pink), var(--amber));
  box-shadow: 0 0 28px rgba(55, 213, 255, 0.26);
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.control {
  display: grid;
  gap: 8px;
}

label,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: #0b1019;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input[type="number"]:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(55, 213, 255, 0.16);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
}

.money-row,
.stepper {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 6px;
}

.icon-btn,
.segment,
.drop {
  border: 0;
  color: var(--text);
  cursor: pointer;
}

.icon-btn {
  height: 38px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 800;
}

.icon-btn:hover,
.segment:hover {
  border-color: rgba(55, 213, 255, 0.72);
}

.segments {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.segment {
  height: 34px;
  border-radius: 8px;
  background: #0b1019;
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  color: #181000;
  background: linear-gradient(135deg, #ffbd25, #fff36d);
  border-color: transparent;
}

.drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border-radius: 8px;
  color: #181000;
  background: linear-gradient(135deg, #fff36d, #ffc12d);
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(255, 204, 45, 0.24);
}

.drop:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.drop-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #181000;
  box-shadow: 0 0 0 5px rgba(24, 16, 0, 0.16);
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.stats > div,
.hud > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: rgba(16, 24, 38, 0.76);
  border: 1px solid rgba(108, 137, 180, 0.22);
  border-radius: 8px;
}

.stats strong,
.hud strong {
  white-space: nowrap;
}

.multipliers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-bottom: 16px;
}

.multi {
  min-height: 31px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  place-items: center;
  border-radius: 8px;
  background: #0b1019;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.multi span {
  display: block;
  margin-top: 2px;
  color: currentColor;
  font-size: 8px;
  opacity: 0.76;
}

.multi.hot {
  color: #16070d;
  background: linear-gradient(135deg, var(--pink), var(--amber));
}

.multi.good {
  color: #081307;
  background: linear-gradient(135deg, var(--lime), #5fffb3);
}

.proof-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: rgba(4, 8, 14, 0.82);
  border: 1px solid rgba(255, 210, 61, 0.24);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
}

.proof-panel[hidden] {
  display: none;
}

.proof-title {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.proof-panel button {
  height: 32px;
  border: 1px solid rgba(255, 210, 61, 0.42);
  border-radius: 8px;
  color: #181000;
  background: linear-gradient(135deg, #fff36d, #ffc12d);
  font-weight: 900;
  cursor: pointer;
}

.hud {
  position: absolute;
  z-index: 3;
}

.hud.top {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  top: 18px;
  left: 18px;
  right: 18px;
  pointer-events: none;
}

.hud.result {
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  min-width: 220px;
  padding: 12px 18px;
  text-align: center;
  font-weight: 900;
  background: rgba(10, 14, 22, 0.86);
  border: 1px solid rgba(108, 137, 180, 0.28);
  border-radius: 8px;
}

.recent-rail {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  background: rgba(4, 7, 12, 0.9);
  border-left: 1px solid rgba(108, 137, 180, 0.18);
}

#recentResults {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-height: calc(100vh - 28px);
  overflow: hidden;
}

.recent-chip {
  display: grid;
  place-items: center;
  min-height: 36px;
  padding: 6px 4px;
  border-radius: 8px;
  color: #171000;
  background: linear-gradient(180deg, #fff94f, #ffbd25);
  border: 1px solid rgba(255, 246, 88, 0.8);
  box-shadow: 0 0 18px rgba(255, 220, 45, 0.22);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.recent-chip.low {
  color: #d7e5f8;
  background: linear-gradient(180deg, #1f2a3b, #111824);
  border-color: rgba(106, 132, 172, 0.32);
  box-shadow: none;
}

.recent-chip.hot {
  color: #16070d;
  background: linear-gradient(180deg, #ffed47, #ff5d5d);
  border-color: rgba(255, 212, 74, 0.85);
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
  }

  .stage {
    grid-column: 1;
    grid-row: 1;
    height: 62vh;
    min-height: 480px;
  }

  .panel {
    grid-column: 1;
    grid-row: 2;
    border-left: 0;
    border-top: 1px solid rgba(108, 137, 180, 0.26);
  }

  .recent-rail {
    grid-column: 1;
    grid-row: 3;
    padding: 10px 14px 16px;
  }

  #recentResults {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
  }

  .recent-chip {
    min-width: 58px;
  }

  .hud.top {
    grid-template-columns: 1fr;
    right: auto;
    min-width: 190px;
  }
}
