
:root {
  --bg: #1a1c1f;
  --panel: rgba(30, 33, 38, 0.88);
  --panel-solid: #1e2126;
  --panel-2: #242830;
  --line: rgba(255, 255, 255, 0.04);
  --line-strong: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #9098a6;
  --muted-2: #6c7583;
  --accent: #4e88ff;
  --accent-2: #6ca9ff;
  --green: #61df8b;
  --red: #ff7171;
  --amber: #ffca72;
  --blue: #76a6ff;
  --violet: #bd8cff;
  --gold: #ffd567;
  --radius-2xl: 34px;
  --radius-xl: 28px;
  --radius-lg: 24px;
  --radius-md: 20px;
  --radius-sm: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
  --hud-top: calc(env(safe-area-inset-top, 0px) + 8px);
  --hud-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  --app-height: var(--tg-viewport-height, 100svh);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overscroll-behavior: none;
}

body {
  touch-action: pan-y;
}

button,
input,
select {
  font: inherit;
}

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

img {
  display: block;
  max-width: 100%;
}

input,
select {
  outline: none;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100%;
  min-height: var(--app-height);
  height: var(--app-height);
  overflow: hidden;
  background: var(--bg);
}

.screen {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--hud-top) + 54px) 14px calc(var(--hud-bottom) + 96px);
  scrollbar-width: none;
}

.screen::-webkit-scrollbar,
.scroll-x::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar {
  display: none;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: max-content;
}

.flex-fill {
  flex: 1 1 auto;
}

.hud-layer {
  position: absolute;
  top: var(--hud-top);
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 40;
  pointer-events: none;
}

.glass,
.card,
.modal-sheet {
  background: rgba(30, 33, 38, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.035);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(22px) saturate(1.1);
  -webkit-backdrop-filter: blur(22px) saturate(1.1);
}

.hud-chip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text);
}

.balance-chip {
  padding-right: 18px;
  font-weight: 700;
}

.hud-chip-icon,
.chip-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #74afff;
}

.card {
  border-radius: var(--radius-2xl);
  padding: 14px;
}

.slim-card {
  padding: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.compact-gap {
  margin-bottom: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chip.subtle {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.chip.subtle.muted {
  color: var(--muted);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
}

.muted-text {
  color: var(--muted);
}

.bottom-nav {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: var(--hud-bottom);
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
}

.nav-item {
  min-height: 66px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: transform .22s ease, background .22s ease, color .22s ease;
}

.nav-item:active {
  transform: scale(.98);
}

.nav-item.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(78,136,255,0.24), rgba(78,136,255,0.12));
  box-shadow: inset 0 0 0 1px rgba(120,170,255,0.12);
}

.nav-icon,
.nav-svg {
  width: 24px;
  height: 24px;
  display: inline-flex;
}

.nav-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.multiplier-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.multiplier-stack.crashed .multiplier-value {
  color: var(--red);
}

.multiplier-value {
  font-family: Manrope, Inter, sans-serif;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 800;
}

.multiplier-caption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.crash-card {
  overflow: hidden;
}

.crash-stage {
  position: relative;
  min-height: 250px;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(21,23,28,0.98), rgba(24,27,33,0.94));
}

.curve-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 82%, rgba(111, 238, 140, .10), transparent 20%),
    radial-gradient(circle at 64% 32%, rgba(111, 238, 140, .12), transparent 18%),
    radial-gradient(circle at 84% 12%, rgba(138, 198, 255, .08), transparent 22%);
}

.crash-curve,
.rocket-sprite,
.crash-burst {
  position: absolute;
}

.crash-curve {
  inset: 0;
  z-index: 2;
}

.rocket-sprite {
  width: 102px;
  height: 102px;
  z-index: 4;
  color: #8db7ff;
  transition: left .22s linear, top .22s linear, transform .22s linear;
  filter: drop-shadow(0 18px 36px rgba(44, 90, 255, .20));
}

.rocket-sprite svg {
  width: 100%;
  height: 100%;
}

.rocket-sprite.crashed {
  animation: crashPulse .6s ease-in-out infinite alternate;
}

.crash-burst {
  left: 76%;
  top: 19%;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 112, 112, .30), rgba(255, 112, 112, 0));
  filter: blur(14px);
  z-index: 3;
}

.history-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.history-pill {
  flex: 0 0 auto;
  min-width: 74px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: rgba(255,255,255,0.05);
}

.history-pill.red { color: #ff7a7a; background: rgba(255, 94, 94, .14); }
.history-pill.blue { color: #84b2ff; background: rgba(95, 147, 255, .16); }
.history-pill.green { color: #7fe39d; background: rgba(89, 223, 131, .14); }
.history-pill.violet { color: #d09cff; background: rgba(189, 140, 255, .15); }
.history-pill.gold { color: #ffd35f; background: rgba(255, 194, 65, .17); }

.action-btn {
  min-height: 58px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #2b8cff 0%, #1874ef 100%);
  color: white;
  font-weight: 800;
  letter-spacing: -0.03em;
  box-shadow: 0 16px 28px rgba(24, 116, 239, .25);
}

.action-btn.compact {
  min-height: 52px;
}

.action-btn:disabled {
  opacity: .55;
}

.feed-card {
  padding: 12px;
}

.feed-no-border {
  border-color: rgba(255,255,255,0.02);
}

.bet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  background: var(--panel-solid);
}

.bet-row.mine {
  background: linear-gradient(180deg, rgba(31,34,40,1), rgba(34,38,46,1));
}

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

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(93,116,148,.8), rgba(58,67,80,.9));
  color: #f6f7fa;
  font-weight: 800;
}

.avatar.tiny {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar.large {
  width: 82px;
  height: 82px;
  font-size: 30px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bet-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.bet-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.bet-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.status-pill.wait { background: rgba(255,255,255,.05); color: var(--muted); }
.status-pill.win { background: rgba(97,223,139,.14); color: var(--green); }
.status-pill.lose { background: rgba(255,113,113,.14); color: var(--red); }

.bet-right-main {
  min-width: 54px;
  text-align: right;
  font-size: 14px;
  font-weight: 800;
}

.positive { color: var(--green); }
.negative { color: var(--red); }

.roulette-card {
  overflow: hidden;
}

.roulette-topline {
  margin-bottom: 8px;
}

.pot-amount {
  font-size: 15px;
  font-weight: 700;
}

.roulette-stage {
  position: relative;
  min-height: 258px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.wheel-arrow {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 22px solid white;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,.22));
  z-index: 5;
}

.wheel-shell {
  position: relative;
  width: 222px;
  height: 222px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.02);
  box-shadow: inset 0 0 0 10px rgba(255,255,255,.03), 0 18px 40px rgba(0,0,0,.24);
}

.wheel-glow {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94,142,255,.10), transparent 60%);
}

.wheel {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  transition: transform 6.4s cubic-bezier(.11, .66, .18, 1);
  box-shadow: inset 0 0 0 6px rgba(15,16,20,.28);
}

.wheel-core {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(180deg, #242830, #1b1f24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.roulette-footer-note {
  margin-top: 6px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.ticker-card {
  overflow: hidden;
}

.ticker-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.04);
  font-size: 13px;
  font-weight: 800;
}

.live-dot,
.ticker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #53dc78;
  box-shadow: 0 0 0 6px rgba(83,220,120,.12);
}

.ticker-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  min-height: 38px;
  align-items: center;
}

.ticker-chip {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ticker-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.empty-card {
  min-height: 280px;
}

.no-cases-card {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 28px 18px;
}

.empty-icon {
  width: 60px;
  height: 60px;
  display: inline-flex;
  color: var(--muted);
  margin-bottom: 12px;
}

.empty-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.empty-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  max-width: 320px;
}

.profile-hero {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  padding-top: 24px;
  padding-bottom: 20px;
  overflow: hidden;
}

.profile-orbit {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% -10%, rgba(86,132,255,.18), transparent 38%);
}

.profile-badge {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--blue);
}

.profile-name {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.profile-level {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.wallet-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.balance-display {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.wallet-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-action {
  min-height: 52px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
}

.ghost-action svg {
  width: 18px;
  height: 18px;
}

.inventory-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inventory-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255,255,255,.03);
}

.inventory-row-icon {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.05);
  color: var(--blue);
}

.empty-state {
  min-height: 130px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border-radius: 22px;
  background: rgba(255,255,255,.03);
}

.empty-state.compact {
  min-height: 92px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 8, 11, .58);
  display: flex;
  align-items: flex-end;
}

.modal-sheet {
  width: 100%;
  border-radius: 34px 34px 0 0;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
  max-height: 84svh;
  overflow: hidden;
  transition: transform .24s ease;
}

.modal-handle {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.16);
  margin: 2px auto 12px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.modal-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.04);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.modal-scroll {
  overflow-y: auto;
  max-height: 62svh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.segmented-line {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.03);
}

.modal-segments {
  margin-bottom: 12px;
}

.segment-mini {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segment-mini.active {
  color: white;
  background: linear-gradient(180deg, rgba(78,136,255,0.96), rgba(64,121,255,0.88));
}

.modal-card {
  border-radius: 28px;
  background: rgba(255,255,255,.03);
  padding: 16px;
}

.modal-card.stack-gap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.05);
  color: var(--blue);
  margin-bottom: 12px;
}

.modal-card-title {
  font-size: 18px;
  font-weight: 800;
}

.modal-card-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 2px;
}

.input {
  width: 100%;
  min-height: 54px;
  border: 0;
  padding: 0 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--text);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,.45) 50%), linear-gradient(135deg, rgba(255,255,255,.45) 50%, transparent 50%);
  background-position: calc(100% - 24px) 24px, calc(100% - 18px) 24px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.03);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--hud-bottom) + 92px);
  transform: translateX(-50%);
  z-index: 90;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(31,34,40,.92);
  border: 1px solid rgba(255,255,255,.05);
}

@keyframes crashPulse {
  from { transform: translate(-50%, -50%) scale(.98); }
  to { transform: translate(-50%, -50%) scale(1.04); }
}

@media (max-width: 380px) {
  .nav-label {
    font-size: 11px;
  }

  .multiplier-value {
    font-size: 40px;
  }

  .wheel-shell {
    width: 206px;
    height: 206px;
  }

  .profile-name {
    font-size: 28px;
  }

  .wallet-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .wallet-actions {
    width: 100%;
    justify-content: stretch;
  }

  .ghost-action,
  .wallet-actions .action-btn {
    width: 100%;
    justify-content: center;
  }
}
