:root {
  color-scheme: dark;
  --bg: #080a0f;
  --ink: #f6f8ef;
  --muted: #9ca7a8;
  --line: rgba(255, 255, 255, 0.13);
  --glass: rgba(19, 23, 26, 0.68);
  --glass-strong: rgba(16, 19, 22, 0.86);
  --red: #ff5467;
  --green: #62e6a2;
  --cyan: #73d7ff;
  --gold: #f5cf68;
  --pink: #ff76b7;
  --violet: #9d8cff;
  --black: #0d1017;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(145deg, rgba(98, 230, 162, 0.1), transparent 32%),
    linear-gradient(25deg, rgba(255, 84, 103, 0.09), transparent 34%),
    linear-gradient(180deg, #090b10 0%, #0d0e13 54%, #07080c 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

input {
  min-width: 0;
}

.surface-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.38;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 8px);
  mix-blend-mode: overlay;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 12px max(18px, env(safe-area-inset-bottom));
}

.glass {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 22px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.glass::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.18), transparent 28%, transparent 72%, rgba(255, 255, 255, 0.08));
  opacity: 0.48;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius);
  padding: 10px;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #07110e;
  font-weight: 950;
  background: linear-gradient(145deg, var(--green), var(--cyan) 58%, var(--gold));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.brand-lockup strong,
.brand-lockup span,
.wallet-chip span,
.wallet-chip strong {
  display: block;
}

.brand-lockup strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand-lockup span,
.wallet-chip span,
.eyebrow,
.hint-line {
  color: var(--muted);
  font-size: 12px;
}

.wallet-chip {
  min-width: 148px;
  text-align: right;
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.wallet-chip strong {
  margin-top: 2px;
  font-size: 15px;
}

.nav-island {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
  padding: 6px;
  border-radius: 22px;
}

.nav-item,
.mode-btn,
.chip,
.glass-button,
.icon-btn,
.choice,
.option-pill {
  min-height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 760;
}

.nav-item svg,
.glass-button svg,
.primary-action svg,
.icon-btn svg {
  width: 17px;
  height: 17px;
}

.nav-item.active,
.mode-btn.active,
.choice.active,
.option-pill.active {
  color: var(--ink);
  background: rgba(98, 230, 162, 0.16);
  border-color: rgba(98, 230, 162, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.nav-item:active,
.mode-btn:active,
.chip:active,
.glass-button:active,
.icon-btn:active,
.choice:active,
.option-pill:active,
.primary-action:active {
  transform: translateY(1px);
}

.shell {
  min-height: 520px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewIn 240ms ease both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(152px, 1fr);
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 0 0 12px;
}

.game-rail::-webkit-scrollbar {
  height: 0;
}

.game-card {
  scroll-snap-align: start;
  min-height: 104px;
  border-radius: 18px;
  padding: 12px;
  display: grid;
  grid-template-rows: 28px 1fr auto;
  gap: 8px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    rgba(18, 21, 24, 0.74);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.game-card.active {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent, var(--green)) 62%, white 0%);
  box-shadow: 0 18px 44px color-mix(in srgb, var(--accent, var(--green)) 22%, transparent);
}

.game-card svg {
  width: 24px;
  height: 24px;
  color: var(--accent, var(--green));
}

.game-card strong,
.game-card span {
  display: block;
}

.game-card strong {
  font-size: 15px;
}

.game-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.play-layout {
  display: grid;
  gap: 12px;
}

.stage-shell,
.control-shell,
.wallet-panel,
.history-panel,
.profile-panel {
  border-radius: var(--radius);
  padding: 12px;
}

.stage-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

h1,
h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
}

.edge-pill {
  flex: 0 0 auto;
  max-width: 160px;
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.roulette-stage,
.quick-stage {
  min-height: 314px;
  display: grid;
  place-items: center;
}

.wheel-wrap {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}

#wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 28px 54px rgba(0, 0, 0, 0.52));
  transition: transform 3.2s cubic-bezier(0.12, 0.82, 0.12, 1);
}

.auto-running #wheel {
  transition-duration: 980ms;
}

.needle {
  position: absolute;
  top: 1%;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-bottom: 25px solid var(--gold);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}

.wheel-center {
  position: absolute;
  width: 142px;
  height: 142px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02)),
    rgba(8, 10, 15, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 20px 50px rgba(0, 0, 0, 0.36);
}

.wheel-center strong,
.wheel-center span {
  display: block;
}

.wheel-center strong {
  font-size: 21px;
}

.wheel-center span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.quick-stage {
  min-height: 360px;
}

.liquid-lens {
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  border-radius: 48px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    rgba(10, 14, 16, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -28px 80px rgba(115, 215, 255, 0.08),
    0 30px 70px rgba(0, 0, 0, 0.36);
}

.liquid-lens::before,
.liquid-lens::after {
  content: "";
  position: absolute;
  width: 68%;
  height: 22%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  filter: blur(18px);
  transform: rotate(-22deg);
}

.liquid-lens::before {
  top: 12%;
  left: -14%;
}

.liquid-lens::after {
  right: -18%;
  bottom: 8%;
  opacity: 0.44;
}

.liquid-lens svg {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  color: var(--cyan);
}

.liquid-lens strong {
  position: relative;
  z-index: 1;
  font-size: 35px;
  max-width: 88%;
  overflow-wrap: anywhere;
}

.liquid-lens span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
}

.quick-stage.rolling .liquid-lens {
  animation: lensRoll 720ms ease both;
}

@keyframes lensRoll {
  0% {
    transform: scale(0.98) rotate(-1deg);
  }
  42% {
    transform: scale(1.03) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.control-shell {
  display: grid;
  gap: 10px;
  align-content: start;
}

.mode-strip,
.segmented,
.choices,
.quick-choices,
.stake-grid,
.money-grid,
.split-line,
.promo-row,
.auto-panel {
  display: grid;
  gap: 8px;
}

.mode-strip {
  grid-template-columns: 1fr 1fr;
}

.segmented {
  grid-template-columns: repeat(3, 1fr);
}

.choices {
  grid-template-columns: repeat(2, 1fr);
}

.choices.numbers {
  grid-template-columns: repeat(6, 1fr);
}

.quick-choices {
  grid-template-columns: repeat(3, 1fr);
}

.stake-grid,
.money-grid {
  grid-template-columns: repeat(4, 1fr);
}

.amount-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
}

.split-line {
  grid-template-columns: minmax(0, 1fr) minmax(102px, 0.58fr);
}

.promo-row {
  grid-template-columns: minmax(0, 1fr) 74px;
}

.auto-panel {
  grid-template-columns: minmax(96px, 1fr) 76px minmax(88px, 0.8fr) minmax(84px, 0.75fr);
  align-items: center;
  border-radius: 16px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auto-copy strong,
.auto-copy span {
  display: block;
}

.auto-copy span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

input {
  width: 100%;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: rgba(115, 215, 255, 0.52);
  box-shadow: 0 0 0 3px rgba(115, 215, 255, 0.08);
}

.choice,
.option-pill {
  padding: 8px;
  overflow-wrap: anywhere;
}

.option-pill strong,
.option-pill span {
  display: block;
}

.option-pill span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.glass-button,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  font-weight: 780;
  white-space: nowrap;
}

.glass-button.alt,
.pay.alt {
  border-color: rgba(245, 207, 104, 0.36);
}

.glass-button.danger {
  border-color: rgba(255, 84, 103, 0.42);
}

.primary-action {
  min-height: 54px;
  width: 100%;
  border-radius: 16px;
  color: #07100d;
  background: linear-gradient(135deg, var(--gold), var(--green) 58%, var(--cyan));
  box-shadow: 0 18px 42px rgba(98, 230, 162, 0.18);
}

.primary-action span {
  font-weight: 950;
}

.wallet-layout {
  display: grid;
  gap: 12px;
}

.wallet-panel {
  display: grid;
  gap: 10px;
}

.hint-line {
  margin: -4px 0 2px;
}

.notice {
  display: grid;
  gap: 8px;
  border-radius: 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.history-panel,
.profile-panel {
  min-height: 360px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.052);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.history-value {
  text-align: right;
  white-space: nowrap;
}

.history-value.win {
  color: var(--green);
}

.history-value.loss {
  color: var(--red);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stats-grid div {
  min-height: 86px;
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.052);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-grid span,
.stats-grid strong {
  display: block;
}

.stats-grid span {
  color: var(--muted);
  font-size: 12px;
}

.stats-grid strong {
  margin-top: 8px;
  font-size: 22px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 30;
  border-radius: 18px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  padding: 13px;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
}

@media (min-width: 820px) {
  .play-layout {
    grid-template-columns: minmax(0, 1.16fr) minmax(330px, 0.84fr);
    align-items: start;
  }

  .wallet-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
    align-items: start;
  }
}

@media (max-width: 620px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar {
    align-items: stretch;
  }

  .wallet-chip {
    min-width: 128px;
  }

  .nav-item {
    flex-direction: column;
    gap: 3px;
    min-height: 50px;
    font-size: 11px;
  }

  .game-rail {
    grid-auto-columns: minmax(138px, 43%);
  }

  .roulette-stage,
  .quick-stage {
    min-height: 294px;
  }

  .wheel-center {
    width: 124px;
    height: 124px;
  }

  .segmented,
  .quick-choices {
    grid-template-columns: repeat(2, 1fr);
  }

  .choices.numbers {
    grid-template-columns: repeat(4, 1fr);
  }

  .stake-grid,
  .money-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .auto-panel {
    grid-template-columns: minmax(0, 1fr) 74px;
  }

  .auto-panel .glass-button {
    min-height: 42px;
  }

  .split-line {
    grid-template-columns: minmax(0, 1fr) 98px;
  }
}

@media (max-width: 360px) {
  .brand-lockup span {
    display: none;
  }

  .wallet-chip {
    min-width: 118px;
  }

  .nav-island {
    gap: 4px;
  }

  .nav-item span {
    font-size: 10px;
  }
}
