@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  color-scheme: dark;
  /* Черно-бело-красная цветовая схема - черный в приоритете */
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --bg-tertiary: #1a1a1a;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #707070;
  --accent-red: #ff0000;
  --accent-red-dark: #cc0000;
  --accent-red-light: #ff3333;
  --accent-white: #ffffff;
  --border-color: #2a2a2a;
  --border-color-strong: #3a3a3a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
  --glow-red: 0 0 20px rgba(255, 0, 0, 0.5), 0 0 40px rgba(255, 0, 0, 0.3), 0 0 60px rgba(255, 0, 0, 0.2);
  --glow-red-strong: 0 0 30px rgba(255, 0, 0, 0.8), 0 0 60px rgba(255, 0, 0, 0.5), 0 0 90px rgba(255, 0, 0, 0.3);
  --glow-white: 0 0 20px rgba(255, 255, 255, 0.3), 0 0 40px rgba(255, 255, 255, 0.2);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-top: env(safe-area-inset-top, 0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at top, #1a0000 0%, var(--bg-primary) 50%);
  z-index: 0;
}

/* Интерактивный снег - на фоне, не перекрывает элементы */
.snow-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
  mix-blend-mode: screen;
  will-change: contents;
  transform: translateZ(0);
  image-rendering: optimizeSpeed;
}

.screen {
  position: relative;
  z-index: 2;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  overflow-x: hidden;
  background: transparent;
}

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--border-color);
  transition: var(--transition);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

.avatar:hover {
  border-color: var(--accent-red);
  transform: scale(1.08);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.4);
}

.avatar:active {
  transform: scale(1.02);
  transition: var(--transition-fast);
}

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

.avatar .initials {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hello {
  font-weight: 600;
  font-size: 16px;
  color: var(--text-primary);
}

.user-id {
  font-size: 13px;
  color: var(--text-secondary);
}

.pill {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.pill:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.pill.brand {
  background: var(--bg-secondary);
  border-color: var(--accent-red);
}

.pill svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-red);
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.card:hover {
  box-shadow: var(--shadow-lg), var(--glow-white);
  transform: translateY(-3px);
  border-color: var(--border-color-strong);
}

.card-title {
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 12px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.subscription .status {
  font-size: 28px;
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 8px;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  transition: var(--transition);
}

.subscription .status:contains("Активна") {
  color: var(--accent-red);
  text-shadow: var(--glow-red);
}

.sub-meta {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.progress-line {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-tertiary);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-red-light));
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.6), 0 0 20px rgba(255, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: progressShine 2s infinite;
}

@keyframes progressShine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Buttons */
.ghost-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  cursor: not-allowed;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.ghost-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.ghost-btn:not(:disabled) {
  cursor: pointer;
  color: var(--text-primary);
}

.ghost-btn:not(:disabled):hover {
  background: var(--bg-secondary);
  border-color: var(--accent-red);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
  transform: translateY(-2px);
}

.ghost-btn:not(:disabled):hover::before {
  opacity: 1;
}

.ghost-btn:not(:disabled):active {
  transform: translateY(0) scale(0.97);
  transition: var(--transition-fast);
}

.ghost-btn.alt {
  border-style: dashed;
  cursor: pointer;
}

.ghost-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.primary-btn {
  width: 100%;
  background: var(--accent-red);
  color: var(--accent-white);
  border: 2px solid var(--accent-red);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--glow-red);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.primary-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease, opacity 0.6s ease;
  opacity: 0;
}

.primary-btn:active::before {
  width: 300px;
  height: 300px;
  opacity: 1;
  transition: width 0.3s ease, height 0.3s ease, opacity 0.3s ease;
}

.primary-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn:hover::after {
  left: 100%;
}

.primary-btn:hover {
  background: var(--accent-red-light);
  box-shadow: var(--glow-red-strong);
  transform: translateY(-4px) scale(1.03);
  border-color: var(--accent-red-light);
}

.primary-btn:active {
  transform: translateY(-2px) scale(0.99);
  box-shadow: var(--glow-red);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.primary-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
}

.primary-btn.pay {
  margin-top: 0;
}

.primary-btn.pay.small {
  padding: 12px;
  font-size: 15px;
}

/* Icon Buttons */
.icon-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px;
  display: grid;
  place-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-red);
  transform: translateY(-4px) scale(1.08);
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 0, 0, 0.3);
}

.icon-btn:hover::before {
  opacity: 1;
}

.icon-btn:active {
  transform: translateY(-2px) scale(0.95);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-btn .icon {
  font-size: 20px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Premium Upgrade Card */
.premium-upgrade-card {
  margin-top: 6px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 2px solid var(--accent-red);
  box-shadow: var(--glow-red);
  animation: premiumPulse 3s ease-in-out infinite;
  transition: var(--transition);
}

.premium-upgrade-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-red-strong);
}

@keyframes premiumPulse {
  0%, 100% {
    box-shadow: var(--glow-red);
  }
  50% {
    box-shadow: var(--glow-red-strong);
  }
}

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

.premium-upgrade-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.premium-upgrade-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.premium-upgrade-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.premium-upgrade-lte {
  font-size: 12px;
  color: var(--accent-red);
  font-weight: 500;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.premium-upgrade-pill {
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--accent-red);
  color: var(--accent-white);
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--glow-red);
  white-space: nowrap;
  transition: var(--transition);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.premium-upgrade-pill:hover {
  background: var(--accent-red-light);
  transform: scale(1.08);
  box-shadow: var(--glow-red-strong);
}

.premium-upgrade-pill:active {
  transform: scale(1.02);
  transition: var(--transition-fast);
}

/* Referral Card */
.referral {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ref-header svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent-red);
  stroke-width: 2;
}

.ref-header .subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.ref-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
}

.ref-cta svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent-red);
  stroke-width: 2;
}

.ref-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* Backdrop & Sheet */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 8;
}

.backdrop.show {
  opacity: 1;
  pointer-events: auto;
  animation: backdropFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes backdropFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-secondary);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  border-bottom: none;
  padding: 12px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 0, 0, 0.1);
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 9;
  max-width: 520px;
  margin: 0 auto;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  backdrop-filter: blur(20px);
}

.sheet.open {
  transform: translateY(0);
  animation: sheetSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sheetSlideUp {
  0% {
    transform: translateY(110%) scale(0.95);
    opacity: 0;
  }
  60% {
    transform: translateY(-3%) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-color-strong);
  border-radius: 999px;
  margin: 0 auto 16px;
}

.sheet-title {
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 20px;
}

/* Subscription Options */
.subscription-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.subscription-option-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.subscription-option-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-red);
  transform: scaleX(0);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

.subscription-option-card:hover::before,
.subscription-option-card:active::before {
  transform: scaleX(1);
}

.subscription-option-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-red);
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lg), 0 0 20px rgba(255, 0, 0, 0.2);
}

.subscription-option-card:active {
  transform: translateY(-2px) scale(0.98);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.subscription-option-card.premium {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(255, 0, 0, 0.15) 100%);
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
  position: relative;
}

.subscription-option-card.premium::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.2), transparent);
  border-radius: var(--radius);
  pointer-events: none;
  animation: premiumGlow 2s ease-in-out infinite;
  z-index: 0;
}

.subscription-option-card.premium > * {
  position: relative;
  z-index: 1;
}

.subscription-option-card.premium:hover {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 0, 0, 0.25) 100%);
  border-color: var(--accent-red-light);
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--glow-red-strong);
}

.subscription-option-card.premium:hover::after {
  opacity: 1;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.3), transparent);
}

@keyframes premiumGlow {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

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

.subscription-option-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.subscription-option-price {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-red);
}

.subscription-option-speed {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.subscription-option-lte {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 500;
}

.subscription-option-card.premium .subscription-option-lte {
  color: var(--accent-red);
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.subscription-option-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-secondary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.subscription-option-badge.premium-badge {
  background: var(--accent-red);
  color: #ffffff;
}

/* Payment Card */
.payment-card {
  margin-top: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.payment-plan-info {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.payment-plan-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.payment-plan-speed {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.payment-plan-lte {
  font-size: 13px;
  color: var(--accent-red);
  font-weight: 500;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.payment-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.payment-price-label {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

.payment-price-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-red);
}

.payment-description {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.payment-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Payment Waiting */
.payment-waiting-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 300px;
}

.payment-waiting-icon {
  position: relative;
  width: 120px;
  height: 120px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading Spinner */
.loading-spinner {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 4px solid transparent;
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring:nth-child(1) {
  animation-delay: -0.45s;
  border-top-color: var(--accent-red);
  opacity: 1;
}

.spinner-ring:nth-child(2) {
  animation-delay: -0.3s;
  width: 80%;
  height: 80%;
  border-top-color: var(--accent-red-light);
  opacity: 0.8;
}

.spinner-ring:nth-child(3) {
  animation-delay: -0.15s;
  width: 60%;
  height: 60%;
  border-top-color: var(--accent-red);
  opacity: 0.6;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Success Check */
.success-check {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
}

.success-check:not(.hidden) {
  display: flex;
}

.checkmark {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: var(--accent-red);
  stroke-miterlimit: 10;
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: var(--accent-red);
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes scale {
  0%, 100% {
    transform: none;
  }
  50% {
    transform: scale3d(1.1, 1.1, 1);
  }
}

@keyframes fill {
  100% {
    box-shadow: inset 0px 0px 0px 60px rgba(220, 53, 69, 0.1);
  }
}

.payment-waiting-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  transition: var(--transition);
}

.payment-waiting-message {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
  transition: var(--transition);
}

.payment-waiting-hint {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
  transition: var(--transition);
}

.payment-waiting-hint.hidden {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* Connect Sheet */
.connect-step {
  display: grid;
  gap: 16px;
}

.device-list {
  display: grid;
  gap: 12px;
}

.device-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 15px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.device-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.device-item:hover {
  border-color: var(--accent-red);
  background: var(--bg-secondary);
  transform: translateY(-4px) scale(1.03);
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 0, 0, 0.3);
}

.device-item:hover::before {
  opacity: 1;
}

.device-item:active {
  transform: translateY(-2px) scale(0.96);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.device-item.selected {
  border-color: var(--accent-red);
  background: rgba(255, 0, 0, 0.1);
  box-shadow: var(--shadow-md), var(--glow-red);
}

.device-item svg {
  width: 24px;
  height: 24px;
  stroke: var(--accent-red);
  stroke-width: 2;
}

.device-title {
  font-weight: 700;
  font-size: 16px;
}

.device-sub {
  font-size: 14px;
  color: var(--text-secondary);
}

.region-block {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.region-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

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

.region-btn {
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.region-btn:hover {
  border-color: var(--accent-red);
  background: var(--bg-primary);
}

.region-btn.active {
  border-color: var(--accent-red);
  background: rgba(255, 0, 0, 0.15);
  color: var(--accent-red);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
}

.region-btn:active {
  transform: scale(0.95);
  transition: var(--transition-fast);
}

.download-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.download-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.download-actions {
  display: flex;
  gap: 10px;
}

.download-btn {
  flex: 1;
  text-align: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.download-btn:hover {
  border-color: var(--accent-red);
  background: rgba(255, 0, 0, 0.1);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
  transform: translateY(-2px);
}

.download-btn:active {
  transform: translateY(0);
  transition: var(--transition-fast);
}

/* Profile Sheet */
.profile-header {
  display: grid;
  place-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent-red);
  background: var(--bg-secondary);
  display: grid;
  place-items: center;
  box-shadow: var(--glow-red);
  transition: var(--transition);
}

.profile-avatar:hover {
  box-shadow: var(--glow-red-strong);
  transform: scale(1.05);
}

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

.profile-name {
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
}

.profile-id {
  color: var(--text-secondary);
  font-size: 14px;
}

.profile-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.promo-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.promo-input {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  padding: 14px 16px;
  font-size: 15px;
  transition: var(--transition);
  box-sizing: border-box;
  font-family: inherit;
}

.promo-input:focus {
  outline: none;
  border-color: var(--accent-red);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.2), 0 0 20px rgba(255, 0, 0, 0.3);
  transform: scale(1.02);
  transition: var(--transition);
}

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

.profile-links {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.profile-link {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 14px;
  min-height: 48px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
  font-weight: 500;
}

.profile-link:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-red);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.2);
  transform: translateX(4px);
}

.profile-link:active {
  transform: translateX(2px) scale(0.97);
  transition: var(--transition-fast);
}

.profile-link svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
  stroke-width: 2;
}

.profile-close-btn {
  margin-top: 16px;
}

/* Referral Sheet */
.referral-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.referral-text {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}

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

.referral-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: grid;
  gap: 4px;
}

.referral-pill .label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.referral-pill .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.referral-link {
  display: grid;
  gap: 10px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.copy-btn {
  background: var(--accent-red);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--accent-white);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: var(--glow-red);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.copy-btn:hover {
  background: var(--accent-red-light);
  transform: scale(1.08);
  box-shadow: var(--glow-red-strong);
}

.copy-btn:active {
  transform: scale(0.95);
  transition: var(--transition-fast);
}

.referral-invited {
  display: grid;
  gap: 8px;
}

.referral-invited .item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--bg-primary);
}

.referral-empty {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* Agreement */
.agreement-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}

.agreement-back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.agreement-back-btn:hover {
  border-color: var(--accent-red);
  background: var(--bg-primary);
}

.agreement-back-btn:active {
  transform: scale(0.95);
}

.agreement-header .sheet-title {
  margin: 0;
  flex: 1;
}

.agreement-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 20px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color-strong) transparent;
}

.agreement-content::-webkit-scrollbar {
  width: 6px;
}

.agreement-content::-webkit-scrollbar-track {
  background: transparent;
}

.agreement-content::-webkit-scrollbar-thumb {
  background: var(--border-color-strong);
  border-radius: 3px;
}

.agreement-content::-webkit-scrollbar-thumb:hover {
  background: var(--border-color);
}

.agreement-content p {
  margin: 0 0 16px 0;
  line-height: 1.6;
  color: var(--text-primary);
  font-size: 14px;
}

.agreement-content h3 {
  margin: 24px 0 12px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

.agreement-content h3:first-of-type {
  margin-top: 0;
}

.agreement-content p:last-child {
  margin-bottom: 0;
}

/* Loading Animation for Subscription Activation */
.subscription-loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.subscription-loading.show {
  opacity: 1;
  pointer-events: auto;
}

.subscription-loading-content {
  text-align: center;
  padding: 40px;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  max-width: 320px;
  width: 90%;
}

.subscription-loading-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  position: relative;
}

.subscription-loading-spinner .spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-top-color: var(--accent-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.subscription-loading-spinner .spinner-ring:nth-child(2) {
  width: 75%;
  height: 75%;
  top: 12.5%;
  left: 12.5%;
  border-top-color: var(--accent-red-light);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

.subscription-loading-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.subscription-loading-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Telegram Only Message */
.telegram-only-message {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  z-index: 9999;
  padding: 24px;
}

.telegram-only-message.hidden {
  display: none;
}

.telegram-only-content {
  text-align: center;
  max-width: 400px;
  width: 100%;
  padding: 48px 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.4s ease-out;
}

.telegram-only-icon {
  font-size: 64px;
  margin-bottom: 24px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.telegram-only-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.telegram-only-text {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.telegram-only-hint {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Promo Success/Error Animations */
.promo-success-animation,
.promo-error-animation {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.promo-success-animation.show,
.promo-error-animation.show {
  opacity: 1;
}

.promo-success-overlay,
.promo-error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}

.promo-success-content,
.promo-error-content {
  position: relative;
  z-index: 1;
  background: var(--bg-primary);
  backdrop-filter: blur(20px);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  min-width: 280px;
  max-width: 90%;
  animation: promoSlideIn 0.4s ease-out;
  box-shadow: var(--shadow-lg);
}

.promo-success-content {
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
}

.promo-error-content {
  border-color: var(--accent-red);
}

.promo-success-icon,
.promo-error-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: promoBounce 0.6s ease-out;
  filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5));
}

.promo-success-icon {
  filter: drop-shadow(0 0 15px rgba(255, 0, 0, 0.6)) drop-shadow(0 0 30px rgba(255, 0, 0, 0.3));
}

.promo-error-icon {
  animation: promoShake 0.5s ease-out;
}

.promo-success-title,
.promo-error-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.promo-success-title {
  color: var(--accent-red);
  text-shadow: var(--glow-red);
}

.promo-error-title {
  color: var(--accent-red);
}

.promo-success-message,
.promo-error-message {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@keyframes promoSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes promoBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

@keyframes promoShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

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

/* Responsive */
@media (max-width: 440px) {
  .screen {
    padding: calc(18px + env(safe-area-inset-top, 0)) 16px 140px;
  }

  .primary-btn {
    font-size: 15px;
    padding: 14px;
  }
  
  .agreement-content {
    padding: 16px;
    max-height: calc(100vh - 180px);
  }
  
  .agreement-content p {
    font-size: 13px;
  }
  
  .agreement-content h3 {
    font-size: 15px;
  }

  .card {
    padding: 16px;
  }

  .sheet {
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  }
}

/* Маркет */
.market-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.market-item {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.market-item:hover {
  border-color: var(--border-color-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.market-item.premium-item {
  border-color: var(--accent-red);
  box-shadow: var(--glow-red);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 0, 0, 0.1) 100%);
}

.market-item.premium-item:hover {
  border-color: var(--accent-red-light);
  box-shadow: var(--glow-red-strong);
  transform: translateY(-3px);
}

.market-item-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.market-item-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--accent-red);
  flex-shrink: 0;
}

.market-item.premium-item .market-item-icon {
  background: rgba(255, 0, 0, 0.2);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.3);
}

.market-item-icon svg {
  width: 32px;
  height: 32px;
  stroke-width: 2;
}

.market-item-info {
  flex: 1;
}

.market-item-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.market-item-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.market-item-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.market-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.market-feature svg {
  width: 16px;
  height: 16px;
  color: var(--accent-red);
  flex-shrink: 0;
}

.market-item-price {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.market-price-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.market-price-label {
  font-size: 12px;
  color: var(--text-muted);
}

.market-price-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  flex-wrap: wrap;
}

.snowflake-price-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
  animation: iconPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.market-price-amount {
  color: var(--accent-red);
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
  white-space: nowrap;
}

.market-buy-btn {
  min-width: 100px;
  max-width: 100%;
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .market-item-price {
    flex-direction: column;
    align-items: stretch;
  }
  
  .market-buy-btn {
    width: 100%;
    min-width: auto;
  }
}

.market-close-btn {
  margin-top: 20px;
  width: 100%;
}

/* Performance Optimizations */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.card, .primary-btn, .ghost-btn, .icon-btn, .device-item, .sheet, .backdrop {
  will-change: transform, opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Оптимизация анимаций */
@media (prefers-reduced-motion: no-preference) {
  .card, .primary-btn, .ghost-btn {
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  }
}

/* Снег включен - интерактивный */
.christmas-decor {
  display: block !important;
}

/* Виджет баланса в реферальной программе */
.snowflakes-widget {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-red);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.1);
}

.snowflakes-widget-content {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.snowflakes-widget-content svg {
  flex-shrink: 0;
  animation: iconPulse 2s ease-in-out infinite;
}

.snowflakes-widget-info {
  flex: 1;
}

.snowflakes-widget-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.snowflakes-widget-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent-red);
  line-height: 1;
}

.snowflakes-widget-bonus {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

@keyframes iconPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}
