.upgrade-view {
  position: fixed;
  z-index: 7;
  top: 0;
  right: max(0px, calc((100vw - 460px) / 2));
  bottom: 0;
  left: max(0px, calc((100vw - 460px) / 2));
  display: flex;
  width: min(100%, 460px);
  flex-direction: column;
  gap: 13px;
  margin: 0;
  padding: calc(64px + max(10px, env(safe-area-inset-top)) + var(--telegram-fullscreen-top-gap, 0px)) var(--pvp-content-gutter) max(98px, calc(90px + env(safe-area-inset-bottom)));
  overflow-y: auto;
  background: var(--upgrade-page-background);
  color: #fff;
  overscroll-behavior: contain;
}
.upgrade-view[hidden] { display: none; }
.upgrade-header { position: relative; display: grid; min-height: 40px; grid-template-columns: 38px 1fr auto; align-items: center; gap: 9px; }
.upgrade-header h1 { position: absolute; top: 50%; left: 50%; margin: 0; font-size: 17px; font-weight: 900; text-align: center; transform: translate(-50%, calc(-50% - 50px)); }
.upgrade-profile { display: grid; width: 34px; height: 34px; place-items: center; overflow: hidden; padding: 0; border: 0; border-radius: 50%; background: linear-gradient(145deg, #d66bdc, #7757ce); font-size: 18px; transform: translateY(-8px); }
.upgrade-profile img { width: 100%; height: 100%; object-fit: cover; }
.upgrade-balance { position: absolute; top: calc(50% - 8px); right: 0; display: flex; height: 30px; min-height: 30px; align-items: center; gap: 4px; padding: 0 7px; border: 1px solid rgba(255,255,255,.05); border-radius: 11px; background: #41195a; font-size: 12px; font-weight: 800; transform: translateY(-50%); }
.upgrade-balance img { width: 15px; height: 15px; object-fit: contain; }
.upgrade-balance strong { font-weight: 800; }
.upgrade-balance span { display: block; width: auto; height: auto; padding-left: 4px; border-radius: 0; background: transparent; color: inherit; font-size: 16px; font-weight: 400; line-height: 1; }
.upgrade-balance:hover, .upgrade-balance:focus-visible { border-color: rgba(255,255,255,.22); background: #552173; }
.upgrade-balance:focus-visible { outline: 2px solid #81d7ff; outline-offset: 2px; }
.upgrade-balance:active { transform: translateY(-50%) scale(.97); }
.upgrade-help { flex: 0 0 auto; padding: 11px 13px; border: 1px solid rgba(255,255,255,.08); border-radius: 15px; background: rgba(43,43,49,.86); }
.upgrade-help summary { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 850; cursor: pointer; list-style: none; }
.upgrade-help summary::-webkit-details-marker { display: none; }
.upgrade-help summary span { color: #13d39c; font-size: 16px; }
.upgrade-help ol { display: grid; gap: 8px; margin: 13px 0 9px; padding: 0; list-style: none; counter-reset: upgrade-step; }
.upgrade-help li { display: grid; grid-template-columns: 23px 1fr; gap: 2px 8px; counter-increment: upgrade-step; }
.upgrade-help li::before { display: grid; width: 22px; height: 22px; grid-row: span 2; place-items: center; border-radius: 50%; background: #0dbc8b; content: counter(upgrade-step); font-size: 11px; font-weight: 900; }
.upgrade-help li strong { font-size: 11px; }
.upgrade-help li small, .upgrade-help > p { margin: 0; color: #c6c2cc; font-size: 10px; line-height: 1.4; }
.upgrade-help > p { padding-left: 31px; }
.upgrade-wheel-area { position: relative; display: grid; min-height: 248px; flex: 1 0 220px; place-items: center; }
.upgrade-wheel {
  position: relative;
  width: min(66vw, 244px);
  aspect-ratio: 1;
  border: 10px solid #25272f;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #12c58e 0 var(--upgrade-chance), #343641 var(--upgrade-chance) 100%);
  box-shadow: 0 12px 35px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.035);
  transform: rotate(0deg);
  transition: box-shadow .3s ease, background .3s ease;
}
.upgrade-wheel::before { position: absolute; inset: 12px; border: 1px dashed rgba(255,255,255,.12); border-radius: 50%; content: ""; pointer-events: none; }
.upgrade-wheel.is-won { background: conic-gradient(#12c58e, #12c58e); box-shadow: 0 0 35px rgba(18,197,142,.55), 0 12px 35px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.12); }
.upgrade-wheel.is-lost { background: conic-gradient(#ed4b56, #ed4b56); box-shadow: 0 0 35px rgba(237,75,86,.55), 0 12px 35px rgba(0,0,0,.35), inset 0 0 0 2px rgba(255,255,255,.12); }
.upgrade-wheel-center { position: absolute; z-index: 2; top: 50%; left: 50%; display: flex; width: min(50vw, 184px); aspect-ratio: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 15px; border: 1px solid rgba(255,255,255,.06); border-radius: 50%; background: radial-gradient(circle at 50% 32%, #24252d, #121318 80%); text-align: center; transform: translate(-50%, -50%); pointer-events: none; }
.upgrade-wheel-center strong { font-size: clamp(32px, 10vw, 46px); font-weight: 950; line-height: 1; }
.upgrade-wheel-center span { max-width: 135px; color: #aaa8b3; font-size: 11px; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; }
.upgrade-pointer { position: absolute; z-index: 1; top: 0; left: 50%; width: 0; height: 0; border: 0 solid transparent; border-right-width: 15px; border-left-width: 15px; border-top: 21px solid #fff; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); transform: translateX(-50%); }
.upgrade-selectors { display: grid; grid-template-columns: minmax(0,1fr) 26px minmax(0,1fr); align-items: center; gap: 5px; }
.upgrade-selection { display: flex; min-width: 0; min-height: 122px; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px 9px; border: 1px solid rgba(255,255,255,.06); border-radius: 18px; color: #fff; cursor: pointer; }
.upgrade-selection--source { background: radial-gradient(ellipse at 50% 42%, rgba(127,28,206,.32), transparent 66%), #1d1c24; }
.upgrade-selection--target { background: radial-gradient(ellipse at 50% 42%, rgba(214,116,23,.28), transparent 66%), #1d1c24; }
.upgrade-selection:disabled { opacity: .5; cursor: not-allowed; }
.upgrade-selection-label { font-size: 12px; font-weight: 900; text-align: center; }
.upgrade-selection-preview { display: flex; width: 100%; min-height: 38px; align-items: center; justify-content: center; gap: 5px; overflow: hidden; padding: 6px 8px; border-radius: 12px; background: rgba(255,255,255,.09); font-size: 10px; font-weight: 850; }
.upgrade-selection-preview img { width: 25px; height: 25px; flex: 0 0 25px; object-fit: contain; }
.upgrade-selection-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upgrade-select-arrow { color: #ffd22b; font-size: 22px; font-weight: 950; text-align: center; }
.upgrade-message { margin: -4px 0 0; padding: 9px 11px; border: 1px solid rgba(24,203,144,.2); border-radius: 11px; background: rgba(20,174,118,.1); color: #9af1cf; font-size: 11px; font-weight: 750; line-height: 1.4; text-align: center; }
.upgrade-message--error { border-color: rgba(255,101,101,.28); background: rgba(190,45,45,.12); color: #ffaaa5; }
.upgrade-submit { min-height: 52px; flex: 0 0 auto; border: 0; border-radius: 16px; background: linear-gradient(105deg, #ffd314, #ff920f); box-shadow: 0 7px 20px rgba(250,144,15,.18); color: #201408; font-size: 15px; font-weight: 950; cursor: pointer; }
.upgrade-submit:disabled { background: linear-gradient(105deg, #625d4c, #51443a); box-shadow: none; color: #c0b9a9; cursor: not-allowed; }
.upgrade-picker { position: fixed; inset: auto 0 max(0px, env(safe-area-inset-bottom)); display: flex; width: min(100%, 460px); max-width: none; height: min(82dvh, 700px); flex-direction: column; gap: 12px; margin: 0 auto; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); overflow: hidden; border: 1px solid rgba(255,255,255,.08); border-bottom: 0; border-radius: 24px 24px 0 0; background: #17181d; box-shadow: 0 -14px 44px rgba(0,0,0,.5); color: #fff; }
.upgrade-picker:not([open]) { display: none; }
.upgrade-picker[open] { animation: upgrade-picker-in .48s cubic-bezier(.2,.85,.25,1) both; }
.upgrade-picker::backdrop { background: rgba(0,0,0,.72); animation: upgrade-backdrop-in .35s ease-out both; }
.upgrade-picker-handle { width: 42px; height: 4px; flex: 0 0 4px; align-self: center; border-radius: 5px; background: #4d4f58; }
.upgrade-picker-header { display: grid; min-height: 34px; flex: 0 0 auto; grid-template-columns: 1fr 32px; align-items: center; gap: 8px; }
.upgrade-picker-header h2 { margin: 0; font-size: 17px; font-weight: 900; text-align: center; }
.upgrade-picker-header button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: #292a31; color: #fff; font-size: 21px; cursor: pointer; }
.upgrade-picker-tabs { display: flex; flex: 0 0 auto; padding: 4px; border-radius: 14px; background: #24252b; }
.upgrade-picker-tabs button { min-height: 34px; flex: 1; border: 0; border-radius: 11px; background: #41434e; color: #fff; font-size: 12px; font-weight: 850; }
.upgrade-search { display: flex; min-height: 40px; flex: 0 0 auto; align-items: center; gap: 8px; padding: 0 11px; border-radius: 13px; background: #24252b; color: #9195a2; }
.upgrade-search > span { font-size: 20px; }
.upgrade-search input { width: 100%; border: 0; outline: 0; background: transparent; color: #fff; font: inherit; font-size: 12px; }
.upgrade-multipliers { display: grid; flex: 0 0 auto; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.upgrade-multipliers button { min-height: 35px; border: 0; border-radius: 11px; background: #24252b; color: #eee; font-size: 11px; font-weight: 850; }
.upgrade-multipliers button.is-active { background: #444652; box-shadow: inset 0 0 0 1px rgba(255,255,255,.09); }
.upgrade-gift-grid { display: grid; flex: 1 1 auto; grid-template-columns: repeat(3, minmax(0,1fr)); align-content: start; gap: 9px; overflow-y: auto; padding-bottom: 8px; overscroll-behavior: contain; }
.upgrade-gift-card { display: flex; min-width: 0; min-height: 135px; flex-direction: column; align-items: center; gap: 5px; padding: 8px 6px; border: 1px solid rgba(255,255,255,.06); border-radius: 15px; background: #24252b; color: #fff; cursor: pointer; }
.upgrade-gift-card:disabled { opacity: .45; cursor: not-allowed; }
.upgrade-gift-card.is-selected { border-color: #19d59a; box-shadow: 0 0 0 1px rgba(25,213,154,.5); }
.upgrade-gift-card img { width: 68px; height: 68px; object-fit: contain; }
.upgrade-gift-card strong { display: -webkit-box; width: 100%; overflow: hidden; color: #f4f3f7; font-size: 10px; font-weight: 850; line-height: 1.25; text-align: center; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.upgrade-gift-card > span, .upgrade-gift-card small { color: #c9c7d0; font-size: 9px; font-weight: 750; text-align: center; }
.upgrade-gift-card > .upgrade-gift-price { color: #ffd65a; font-size: 10px; font-weight: 900; text-shadow: 0 0 9px rgba(255,214,90,.32); }
.upgrade-gift-card small { color: #8de8c2; }
.upgrade-gift-card small.is-unavailable { color: #d6a076; }
.upgrade-empty { margin: auto; padding: 24px 16px; color: #a8a8b2; font-size: 13px; line-height: 1.5; text-align: center; }
.upgrade-picker[open] ~ .bottom-nav { z-index: 0; }
@keyframes upgrade-picker-in { from { opacity: 0; transform: translateY(48px); } to { opacity: 1; transform: translateY(0); } }
@keyframes upgrade-backdrop-in { from { background: rgba(0,0,0,0); } to { background: rgba(0,0,0,.72); } }
@media (max-width: 360px) {
  .upgrade-view { gap: 10px; padding-right: 11px; padding-left: 11px; }
  .upgrade-wheel-area { min-height: 212px; flex-basis: 195px; }
  .upgrade-wheel { width: min(63vw, 215px); border-width: 8px; }
  .upgrade-selection { min-height: 106px; padding: 10px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .upgrade-picker[open], .upgrade-picker::backdrop { animation: none; }
}
