*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --tg-bg: #05060a;
  --tg-bg-soft: rgba(12, 16, 28, 0.96);
  --tg-accent: #5865f2;
  --tg-accent-soft: rgba(88, 101, 242, 0.14);
  --tg-border-soft: rgba(255, 255, 255, 0.08);
  --tg-text: #f5f5f5;
  --tg-text-soft: #a4a7c5;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b2134 0, #05060a 40%, #000 100%);
  color: var(--tg-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Основной контейнер приложения */

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px calc(80px + env(safe-area-inset-bottom, 0));
}

/* Заголовок */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.app-title {
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.app-subtitle {
  font-size: 12px;
  opacity: 0.72;
}

/* Карточки */

.card {
  background: var(--tg-bg-soft);
  border-radius: 18px;
  padding: 16px 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(120, 135, 255, 0.22);
  backdrop-filter: blur(20px);
}

.card + .card {
  margin-top: 14px;
}

/* Секции */

.section {
  display: none;
  animation: fadeIn 0.35s ease-out;
}

.section.active {
  display: block;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.section-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--tg-text-soft);
}

/* Кнопки */

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #5865f2, #4b9fff);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  box-shadow: 0 16px 32px rgba(50, 110, 255, 0.55);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    opacity 0.12s ease-out;
}

.button-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 6px 18px rgba(50, 110, 255, 0.45);
  opacity: 0.9;
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--tg-border-soft);
  background: rgba(11, 13, 22, 0.96);
  color: var(--tg-text-soft);
  font-size: 12px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.12s ease-out, border-color 0.12s ease-out,
    opacity 0.12s ease-out;
}

.button-secondary:active {
  opacity: 0.85;
  background: rgba(28, 32, 51, 0.96);
  border-color: rgba(255, 255, 255, 0.16);
}

/* Чипы */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 20, 0.9);
  color: var(--tg-text-soft);
}

/* Рулетка */

.roulette-wrapper {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.roulette-wheel-container {
  position: relative;
  width: min(260px, 70vw);
  height: min(260px, 70vw);
}

.roulette-wheel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #2e3bff 0deg 45deg,
    #ff3b7f 45deg 90deg,
    #2affb8 90deg 135deg,
    #ffb13b 135deg 180deg,
    #26d0ff 180deg 225deg,
    #9b51ff 225deg 270deg,
    #ff6f3b 270deg 315deg,
    #21f3a3 315deg 360deg
  );
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8),
    0 0 0 8px rgba(255, 255, 255, 0.04);
  transition: transform 4s cubic-bezier(0.12, 0.02, 0.07, 0.99);
}

.roulette-wheel-inner {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #262c42 0, #02030b 48%, #000 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tg-text);
  font-size: 13px;
  text-align: center;
  padding: 0 16px;
}

.roulette-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-bottom: 18px solid #ffffff;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}

/* Результат */

.prize-result {
  margin-top: 20px;
  min-height: 40px;
  font-size: 14px;
  text-align: center;
}

.prize-result-text {
  animation: prizePop 0.6s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  text-shadow: 0 0 12px rgba(143, 179, 255, 0.55), 0 0 24px rgba(88, 135, 255, 0.55);
}

.prize-code {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.78;
}

.prize-code span {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.12em;
}

/* Список призов */

.prizes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.prize-item {
  border-radius: 12px;
  padding: 10px 12px;
  background: linear-gradient(
    135deg,
    rgba(26, 32, 56, 0.96),
    rgba(10, 14, 30, 0.96)
  );
  border: 1px solid rgba(112, 130, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prize-item-name {
  font-size: 13px;
}

.prize-item-qty {
  font-size: 11px;
  opacity: 0.82;
}

/* Нижняя навигация */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom, 0));
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.92),
    rgba(0, 0, 0, 0.48)
  );
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: center;
}

.bottom-nav-inner {
  width: 100%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: rgba(9, 11, 20, 0.96);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85);
}

.nav-btn {
  flex: 1;
  border-radius: 999px;
  padding: 7px 4px;
  border: none;
  background: transparent;
  color: var(--tg-text-soft);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.18s ease-out, color 0.18s ease-out,
    transform 0.12s ease-out;
}

.nav-btn span.icon {
  font-size: 14px;
}

.nav-btn-active {
  background: radial-gradient(circle at top, #5865f2 0, #3941a6 60%, #15182e 100%);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Анимации */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes prizePop {
  0% {
    transform: translateY(10px) scale(0.85);
    opacity: 0;
    filter: blur(2px);
  }
  40% {
    transform: translateY(-4px) scale(1.08);
    opacity: 1;
    filter: blur(0);
  }
  70% {
    transform: translateY(0) scale(0.98);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

/* Адаптация под большие экраны */

@media (min-width: 768px) {
  .app {
    padding-top: 24px;
  }
}
