.app-scroll.is-upgrade {
  background: radial-gradient(163% 82% at 50% 50%, #040b19, #08132b 100%);
}

.screen-game.is-upgrade {
  padding:
    14px
    14px
    calc(18px + var(--tg-safe-bottom) + var(--tg-content-safe-bottom));
}

.upgrade-screen {
  width: min(100%, 440px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}

.upgrade-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.upgrade-heading {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.upgrade-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0 4px;
}

.upgrade-wheel {
  position: relative;
  width: min(72vw, 260px);
  aspect-ratio: 1;
}

.upgrade-wheel__ring {
  width: 100%;
  height: 100%;
  display: block;
}

.upgrade-wheel__arc {
  filter: drop-shadow(0 0 8px rgba(212, 160, 255, 0.45));
    stroke-dasharray 0.28s linear,
    transform 0.28s linear,
    opacity 0.2s ease;
}

.upgrade-wheel__core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #3a1d63 0%, #1a102e 72%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.upgrade-wheel__chance {
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.upgrade-wheel__label {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff66;
  font-weight: 700;
}

.upgrade-needle {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transform-origin: 50% 50%;
}

.upgrade-needle__tip {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) rotate(180deg);
  filter: drop-shadow(0 0 8px rgba(232, 176, 255, 0.55));
}

.upgrade-meta {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.upgrade-side {
  min-height: 72px;
  border-radius: 16px;
  background: #00000038;
  border: 1px solid #ffffff16;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  text-align: center;
}

.upgrade-side.is-filled {
  border-color: #d4a0ff55;
  background: #2a154866;
}

.upgrade-side__art {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  background: #00000033;
  display: grid;
  place-items: center;
}

.upgrade-side__art img,
.upgrade-side__art canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upgrade-side__name {
  font-size: 11px;
  font-weight: 700;
  color: #ffffffcc;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-side__stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
}

.upgrade-side__stars img {
  width: 11px;
  height: 11px;
}

.upgrade-side__empty {
  font-size: 11px;
  color: #ffffff66;
  font-weight: 600;
}

.upgrade-arrow {
  font-size: 18px;
  color: #ffffff55;
  font-weight: 800;
}

.upgrade-arrow.is-live {
  color: #d4a0ff;
}

.upgrade-run {
  width: 100%;
  max-width: 280px;
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #c87bff 0%, #9b3dff 55%, #6b1fc4 100%);
  box-shadow: 0 8px 24px rgba(155, 61, 255, 0.35);
}

.upgrade-run:disabled {
  opacity: 0.4;
  box-shadow: none;
  background: #ffffff14;
}

.upgrade-outcome {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.upgrade-outcome.is-ok {
  color: #7dffa8;
}

.upgrade-outcome.is-bad {
  color: #ff8f9f;
}

.upgrade-stars-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #00000030;
  border: 1px solid #ffffff14;
}

.upgrade-stars-row.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.upgrade-stars-row label {
  font-size: 12px;
  font-weight: 700;
  color: #ffffffaa;
  white-space: nowrap;
}

.upgrade-stars-row input[type="range"] {
  flex: 1;
  accent-color: #c87bff;
}

.upgrade-stars-row__val {
  min-width: 42px;
  text-align: right;
  font-weight: 800;
  font-size: 13px;
}

.upgrade-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 14px;
  background: #00000033;
  border: 1px solid #ffffff12;
}

.upgrade-tab {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: #ffffff88;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 10px;
}

.upgrade-tab.is-active {
  background: #ffffff18;
  color: #fff;
  box-shadow: inset 0 0 0 1px #ffffff14;
}

.upgrade-search {
  width: 100%;
  border: 1px solid #ffffff18;
  background: #00000035;
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.upgrade-search:focus {
  border-color: #d4a0ff66;
  box-shadow: 0 0 0 3px #9b3dff33;
}

.upgrade-search::placeholder {
  color: #ffffff55;
}

.upgrade-panel {
  min-height: 40px;
}

.upgrade-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-bottom: 8px;
}

.upgrade-card {
  position: relative;
  border: 1px solid #ffffff14;
  background: #00000035;
  border-radius: 14px;
  padding: 8px 6px 10px;
  color: #fff;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 112px;
}

.upgrade-card.is-selected {
  border-color: #d4a0ff;
  box-shadow: 0 0 0 1px #d4a0ff88, 0 0 18px rgba(180, 90, 255, 0.25);
  background: #2a1548aa;
}

.upgrade-card__art {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #00000040;
}

.upgrade-card__art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.upgrade-card__name {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.upgrade-card__stars {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  color: #f0d7ff;
}

.upgrade-card__stars img {
  width: 10px;
  height: 10px;
}

.upgrade-card__buy {
  margin-top: 2px;
  border: 0;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: #9b3dff;
}

.upgrade-section-title {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff99;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.upgrade-wins {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-win {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 14px;
  background: #00000035;
  border: 1px solid #ffffff12;
}

.upgrade-win__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #00000044;
}

.upgrade-win__name {
  font-size: 13px;
  font-weight: 700;
}

.upgrade-win__meta {
  font-size: 11px;
  color: #ffffff77;
  font-weight: 600;
}

.upgrade-win__target {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #00000040;
}

.upgrade-empty {
  text-align: center;
  padding: 24px 12px;
  color: #ffffff66;
  font-size: 13px;
  font-weight: 600;
}

