.page.aviator-page {
  display: none;
}

.page.aviator-page.active {
  display: flex;
}

.aviator-page {
  background: #090c11;
  padding: 0;
  overflow: hidden;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.aviator-page::before {
  display: none;
}

.aviator-root {
  height: 100%;
  min-height: 100%;
  background: #090c11;
  color: #fff;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.aviator-shell {
  width: min(100%, 390px);
  height: 100%;
  min-height: 0;
  max-height: 860px;
  margin: 0 auto;
  padding: 0 8px max(8px, env(safe-area-inset-bottom, 0px));
  background: #090c11;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

#page-aviator {
  height: 100dvh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden !important;
}

#page-aviator .aviator-root,
#page-aviator .aviator-shell {
  overflow: hidden !important;
}

.aviator-topbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #090c11;
}

.aviator-brand-name {
  color: #ff174f;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
}

.aviator-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aviator-wallet-box {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.aviator-wallet-box strong {
  color: #49ff00;
  font-size: 20px;
  font-weight: 900;
}

.aviator-wallet-box span {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.aviator-menu-top-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: #2b2b2b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.10);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.aviator-menu-top-btn span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
}

.aviator-quick-menu-wrap {
  position: relative;
}

.aviator-quick-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 132px;
  padding: 8px;
  border-radius: 14px;
  background: #141922;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.05),
    0 14px 28px rgba(0,0,0,0.38);
  display: grid;
  gap: 8px;
  z-index: 20;
}

.aviator-quick-menu.hidden {
  display: none;
}

.aviator-quick-menu button {
  height: 34px;
  border: none;
  border-radius: 999px;
  background: #0e131a;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.aviator-history-strip {
  display: flex;
  gap: 8px;
  overflow-x: hidden;
  padding: 6px 0;
  scrollbar-width: none;
}

.aviator-history-strip::-webkit-scrollbar {
  display: none;
}

.aviator-history-chip {
  flex: 0 0 auto;
  min-width: 68px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #050608;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
}

.aviator-history-chip.tone-pink { color: #ff6e96; }
.aviator-history-chip.tone-blue { color: #53a8ff; }
.aviator-history-chip.tone-purple { color: #c86bff; }

.aviator-stage-info {
  padding: 0 4px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255,255,255,0.72);
  font-size: 10px;
}

.aviator-stage-info strong {
  color: #fff;
  font-weight: 700;
}

.aviator-stage-card {
  position: relative;
  height: clamp(258px, 39svh, 336px);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(0,120,255,0.35), transparent 34%),
    linear-gradient(135deg, #161217 0%, #0d1016 42%, #050608 100%);
  box-shadow:
    inset 0 0 0 1px rgba(72,72,72,0.7),
    0 0 0 1px rgba(45,45,45,0.95);
}

.aviator-stars,
.aviator-stage-rays,
.aviator-flight-svg,
.aviator-stage-left-dots,
.aviator-stage-bottom-dots,
.aviator-stage-center,
.aviator-crash-burst,
.aviator-plane {
  position: absolute;
}

.aviator-stars,
.aviator-stage-rays,
.aviator-flight-svg,
.aviator-stage-center {
  inset: 0;
}

.aviator-stage-rays {
  background:
    linear-gradient(126deg, transparent 0 18%, rgba(255,255,255,0.03) 18% 19%, transparent 19% 100%),
    linear-gradient(142deg, transparent 0 38%, rgba(255,255,255,0.03) 38% 39%, transparent 39% 100%),
    linear-gradient(156deg, transparent 0 58%, rgba(255,255,255,0.03) 58% 59%, transparent 59% 100%);
}

.aviator-star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 0 7px rgba(255,255,255,0.35);
  animation: aviator-star-pulse 2.4s ease-in-out infinite;
}

@keyframes aviator-star-pulse {
  50% {
    opacity: .25;
    transform: scale(.7);
  }
}

.aviator-stage-left-dots {
  left: 20px;
  top: 18px;
  z-index: 4;
  display: grid;
  gap: 34px;
}

.aviator-stage-left-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #49baff;
}

.aviator-stage-bottom-dots {
  left: 40px;
  right: 20px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  justify-content: space-between;
}

.aviator-stage-bottom-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
}

.aviator-flight-svg {
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.aviator-plane {
  left: 11%;
  bottom: 11%;
  z-index: 6;
  transform: translate(-50%, 50%) rotate(-8deg) scale(1);
  transform-origin: 50% 55%;
  transition: opacity .18s ease;
}

.aviator-plane.hidden {
  opacity: 0;
}

.aviator-plane-trail {
  position: absolute;
  left: -76px;
  top: 24px;
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,106,106,0.24) 36%, rgba(255,45,45,0.95) 100%);
  filter: blur(4px);
}

.aviator-plane-glyph {
  font-size: 62px;
  line-height: 1;
  color: #ff4e43;
  text-shadow:
    0 0 16px rgba(255, 72, 72, 0.35),
    -10px 8px 0 #64d8ff;
}

.aviator-stage-center {
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.aviator-multiplier {
  font-size: 78px;
  line-height: .92;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 26px rgba(255,255,255,0.16);
}

.aviator-stage-card.crashed .aviator-multiplier {
  color: #ff5a5a;
}

.aviator-phase-banner {
  min-width: 162px;
  min-height: 36px;
  margin-top: 10px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(8, 10, 14, 0.88);
  box-shadow: inset 0 0 0 1px rgba(255, 112, 112, 0.18);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aviator-phase-banner.hidden {
  display: none;
}

.aviator-crash-burst {
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  z-index: 8;
}

.aviator-crash-burst.hidden {
  display: none;
}

.aviator-crash-ring {
  position: absolute;
  border-radius: 50%;
}

.aviator-crash-burst .ring-a {
  inset: 20px;
  background: rgba(255, 68, 68, 0.26);
  animation: aviator-burst-ping 1.15s ease-out infinite;
}

.aviator-crash-burst .ring-b {
  inset: 48px;
  background: rgba(255, 196, 54, 0.42);
  animation: aviator-burst-pulse 1.05s ease-in-out infinite;
}

.aviator-crash-core {
  position: relative;
  z-index: 2;
  font-size: 88px;
  animation: aviator-burst-bounce 1s ease-in-out infinite;
}

.aviator-crash-spark {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffe16c, #ff6b2f 70%, transparent 72%);
  animation: aviator-spark-fly 0.95s ease-out infinite;
}

.aviator-crash-spark.spark-1 { top: 30px; left: 86px; --tx: -16px; --ty: -36px; }
.aviator-crash-spark.spark-2 { top: 52px; right: 34px; animation-delay: .08s; --tx: 28px; --ty: -26px; }
.aviator-crash-spark.spark-3 { right: 22px; bottom: 62px; animation-delay: .16s; --tx: 34px; --ty: 12px; }
.aviator-crash-spark.spark-4 { bottom: 28px; left: 98px; animation-delay: .24s; --tx: 10px; --ty: 30px; }
.aviator-crash-spark.spark-5 { bottom: 60px; left: 24px; animation-delay: .32s; --tx: -26px; --ty: 18px; }
.aviator-crash-spark.spark-6 { top: 62px; left: 22px; animation-delay: .40s; --tx: -30px; --ty: -8px; }

@keyframes aviator-burst-ping {
  0% { transform: scale(.45); opacity: .92; }
  100% { transform: scale(1.22); opacity: 0; }
}

@keyframes aviator-burst-pulse {
  50% { transform: scale(1.12); opacity: .76; }
}

@keyframes aviator-burst-bounce {
  50% { transform: scale(1.08) rotate(-4deg); }
}

@keyframes aviator-spark-fly {
  0% { transform: scale(.6) translate(0, 0); opacity: 1; }
  100% { transform: scale(1.1) translate(var(--tx), var(--ty)); opacity: 0; }
}

.aviator-controls {
  margin-top: 8px;
  display: grid;
  gap: 8px;
  background: #090c11;
  flex: 1;
  min-height: 0;
  align-content: start;
}

.aviator-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #0d0d0d;
  padding: 4px;
  border-radius: 16px;
}

.aviator-mode-chip {
  height: 36px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: rgba(255,255,255,0.70);
  font-size: 15px;
  font-weight: 800;
}

.aviator-mode-chip.active {
  background: #2b2f36;
  color: #fff;
}

.aviator-control-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.aviator-control-panel.hidden {
  display: none;
}

.aviator-amount-panel,
.aviator-action-btn {
  min-height: 104px;
}

.aviator-amount-panel {
  padding: 8px;
  border-radius: 14px;
  background: #111;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.aviator-bet-entry,
.aviator-auto-cashout-wrap {
  height: 40px;
  border-radius: 999px;
  background: #090d13;
}

.aviator-bet-entry {
  padding: 0 4px;
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  gap: 4px;
  align-items: center;
}

.aviator-step-btn {
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #10161d;
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.aviator-amount-input,
.aviator-auto-cashout-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  appearance: textfield;
  -moz-appearance: textfield;
}

.aviator-auto-cashout-input {
  text-align: right;
}

.aviator-amount-input::-webkit-outer-spin-button,
.aviator-amount-input::-webkit-inner-spin-button,
.aviator-auto-cashout-input::-webkit-outer-spin-button,
.aviator-auto-cashout-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.aviator-amount-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.aviator-amount-grid button {
  height: 30px;
  border: none;
  border-radius: 9px;
  background: #10151d;
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  font-weight: 900;
}

.aviator-amount-grid button.active {
  background: linear-gradient(180deg, #1ede11, #18b203);
  color: #fff;
}

.aviator-action-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.02;
  letter-spacing: 0;
}

.aviator-action-btn span {
  font-size: 10px;
  font-weight: 800;
}

.aviator-action-btn strong {
  font-size: 15px;
  font-weight: 900;
}

.aviator-bet-btn {
  background: linear-gradient(180deg, #27db08, #18af00);
  box-shadow: 0 12px 22px rgba(44,214,18,0.18);
}

.aviator-bet-btn.cashout-mode {
  background: linear-gradient(180deg, #f9b536, #da8b08);
  box-shadow: 0 12px 22px rgba(245,164,27,0.18);
}

.aviator-bet-btn.crashed-mode {
  background: linear-gradient(180deg, #834444, #5f2b2b);
  box-shadow: none;
}

.aviator-auto-fields {
  display: grid;
  gap: 8px;
  align-content: start;
}

.aviator-auto-field {
  display: grid;
  gap: 4px;
}

.aviator-auto-field span {
  color: rgba(255,255,255,0.62);
  font-size: 10px;
  font-weight: 700;
}

.aviator-auto-cashout-wrap {
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
}

.aviator-auto-cashout-wrap em {
  font-style: normal;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.aviator-amount-input:focus,
.aviator-auto-cashout-input:focus {
  caret-color: #ffffff;
}

.aviator-auto-btn {
  background: linear-gradient(180deg, #2370ff, #1149bb);
  box-shadow: 0 12px 22px rgba(31,96,255,0.18);
}

.aviator-rules-card {
  width: min(100%, 338px);
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  background: #202226;
  color: #fff;
  text-align: left;
}

.aviator-rules-head {
  padding: 18px 18px 16px;
  font-size: 18px;
  font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.aviator-rules-body {
  max-height: 64vh;
  overflow-y: auto;
  padding: 18px;
  color: rgba(255,255,255,0.82);
  font-size: 14px;
  line-height: 1.6;
}

.aviator-rules-body p {
  margin: 0 0 18px;
}

.aviator-rules-highlight {
  color: #ef3434 !important;
}

.aviator-rules-body h4 {
  margin: 22px 0 12px;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
}

.aviator-rules-close {
  width: calc(100% - 36px);
  margin: 0 18px 18px;
}

.aviator-win-card {
  width: min(100%, 312px);
  padding: 26px 24px 22px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 227, 94, 0.20), transparent 34%),
    linear-gradient(180deg, #1a202a 0%, #10151d 100%);
  color: #fff;
  text-align: center;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 42px rgba(0, 0, 0, 0.36);
}

.aviator-win-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 124px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffce45, #ff9f0a);
  color: #241300;
  font-size: 14px;
  font-weight: 900;
}

.aviator-win-card h3 {
  margin: 14px 0 6px;
  font-size: 28px;
  font-weight: 900;
  color: #fff;
}

.aviator-win-card strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  font-weight: 900;
  color: #39df00;
}

.aviator-win-card p {
  margin: 8px 0 0;
  color: rgba(255,255,255,0.72);
  font-size: 15px;
}

.aviator-win-close {
  width: 100%;
  margin-top: 18px;
}
