:root {
  --bg-main: #14032c;
  --bg-card: #080313;
  --bg-tile: #2a0b4f;
  --brand: #72c8ff;
  --brand-strong: #43a6ff;
  --brand-soft: #4e2a95;
  --text: #f4efff;
  --muted: #b0a5d1;
  --danger: #ff79a6;
  --success: #7ef29b;
}

/* iOS-качество: все анимируемые свойства только через transform/opacity (60 fps) */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

*:focus,
*:focus-visible {
  outline: none;
  box-shadow: none;
}

html {
  min-height: 100%;
  background: #12052a;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: radial-gradient(1200px 800px at 55% -20%, #7939ff 0%, #2f0e57 35%, #16072f 65%, #0d041b 100%);
  color: var(--text);
  min-height: 100vh;
  font-size: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

/* Контуры единорожек как фоновый паттерн — мультяшный стиль */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80' fill='none' stroke='%23a06aff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3C!-- Horn --%3E%3Cpath d='M54 28 L68 6 L62 32'/%3E%3C!-- Ear --%3E%3Cpath d='M42 26 L38 14 L52 22'/%3E%3C!-- Head --%3E%3Ccircle cx='42' cy='47' r='22'/%3E%3C!-- Eye --%3E%3Ccircle cx='50' cy='45' r='7'/%3E%3C!-- Eye highlight --%3E%3Ccircle cx='54' cy='41' r='2.5' fill='%23a06aff'/%3E%3C!-- Nostril --%3E%3Cpath d='M60 55 Q63 58 60 60'/%3E%3C!-- Mane --%3E%3Cpath d='M22 34 C13 27 9 37 13 45 C17 53 13 59 17 66'/%3E%3Cpath d='M20 27 C9 20 5 32 11 41'/%3E%3C/svg%3E");
  background-size: 115px 115px;
  background-repeat: repeat;
  opacity: 0.1;
}

/* Контент поверх паттерна. Прозрачный фон — виден градиент body и плитка body::before. */
.app-shell {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(2px, env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
  background: transparent;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-emoji {
  font-size: 1.5rem;
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(255, 140, 210, 0.7));
}

.topbar-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  margin: 0;
  font-size: clamp(0.78rem, 2.6vw, 0.96rem);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #ffffff 0%, #c8a8ff 60%, #72c8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ghost-btn {
  background: transparent;
  color: #dce7f5;
  border: 0;
  font-size: 24px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn {
  position: relative;
  border-radius: 50%;
  transition: background 200ms cubic-bezier(0.22, 1, 0.36, 1),
              color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.refresh-btn i {
  font-size: 20px;
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  display: block;
}
.refresh-btn:active {
  background: rgba(185, 140, 255, 0.15);
  transition: background 80ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.refresh-btn.spinning i {
  animation: spin-once 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.refresh-btn.loading i {
  animation: spin-loop 900ms linear infinite;
}
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes spin-loop {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.screen-container {
  padding-bottom: 108px;
}

.screen {
  animation: fadeSlide 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: transform, opacity;
}

.screen.screen--no-enter {
  animation: none;
  opacity: 1;
  transform: none;
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  .screen {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Профиль: лёгкое затемнение без сильного blur — в WKWebView тяжёлый backdrop на большом блоке «съедает» фон/паттерн */
.profile-screen {
  position: relative;
  padding-bottom: 4px;
}

.profile-screen::before {
  content: "";
  position: absolute;
  inset: -10px -6px -6px -6px;
  z-index: 0;
  border-radius: 24px;
  pointer-events: none;
  background: rgba(13, 4, 28, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 28px rgba(6, 2, 18, 0.28);
}

.profile-screen > * {
  position: relative;
  z-index: 1;
}

.profile-screen .profile-card {
  background: linear-gradient(
    165deg,
    rgba(15, 5, 30, 0.92) 5%,
    rgba(26, 8, 48, 0.94) 100%
  );
  border-color: rgba(185, 140, 255, 0.32);
}

.profile-screen .menu-item {
  background: rgba(17, 6, 32, 0.96);
  border: 1px solid rgba(185, 140, 255, 0.2);
  box-shadow: 0 4px 14px rgba(6, 2, 18, 0.32);
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.982);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  background: linear-gradient(165deg, rgba(15, 5, 30, 0.97) 5%, rgba(30, 10, 56, 0.95) 100%);
  border: 1px solid rgba(185, 140, 255, 0.24);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(6, 2, 18, 0.45);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.logo {
  font-size: clamp(1.7rem, 7vw, 2.4rem);
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.logo span {
  font-size: clamp(0.9rem, 3.4vw, 1.1rem);
  color: #d5c2ff;
}

.wallet-card {
  min-width: 132px;
  text-align: right;
}

.amount {
  margin: 3px 0 10px;
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: rgba(0, 11, 20, 0.5);
  border-radius: 22px;
  padding: 4px;
  margin: 8px 0 12px;
}

.tabs-topup {
  max-width: 360px;
}

.tab-btn {
  border: 0;
  border-radius: 18px;
  padding: 12px 8px;
  color: #7ca7cb;
  font-size: clamp(0.8rem, 3.4vw, 0.98rem);
  background: transparent;
  cursor: pointer;
  transition: background-color 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              color 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.tab-btn.active {
  color: #ecf5ff;
  background: linear-gradient(180deg, #6438b4, #472986);
  box-shadow: inset 0 0 0 1px rgba(190, 153, 255, 0.5);
}

/* Быстрое нажатие (80ms), плавное отпускание через spring — как на iOS */
.tab-btn,
.primary-btn,
.outline-btn,
.menu-item,
.nav-btn,
.amount-btn,
.period-btn,
.ghost-btn {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
              background-color 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              color 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              box-shadow 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.tab-btn:active,
.primary-btn:active,
.outline-btn:active,
.menu-item:active,
.nav-btn:active,
.amount-btn:active,
.period-btn:active,
.ghost-btn:active {
  transform: scale(0.96);
  transition: transform 80ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-card {
  position: relative;
}

.hero-tile-grid {
  margin-top: 14px;
}

.hero-days-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  flex: 1;
}

/* Цифра поверх звезды; звезда слева без кольца */
.hero-days-num {
  display: inline-grid;
  align-items: center;
  justify-items: start;
  vertical-align: middle;
}

.hero-days-num .hero-days-star,
.hero-days-num .days-left {
  grid-area: 1 / 1;
}

.hero-days-num .hero-days-star {
  z-index: 0;
  line-height: 1;
  font-size: clamp(2.2rem, 12vw, 3.55rem);
  color: rgba(255, 210, 255, 0.34);
  text-shadow: 0 0 16px rgba(180, 140, 255, 0.55);
  animation: heroDaysStarSpin 18s linear infinite;
}

@keyframes heroDaysStarSpin {
  from {
    transform: translate(clamp(4px, 1vw, 10px), -8%) rotate(0deg);
  }
  to {
    transform: translate(clamp(4px, 1vw, 10px), -8%) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-days-num .hero-days-star {
    animation: none;
    transform: translate(clamp(4px, 1vw, 10px), -8%);
  }
}

.hero-days-num .days-left {
  position: relative;
  z-index: 1;
  padding-inline-start: clamp(0.75rem, 5.5vw, 1.2rem);
}

.hero-days-title {
  margin: 0;
  font-size: clamp(1.35rem, 5.4vw, 1.9rem);
  line-height: 1.05;
}

.hero-card h2.hero-days-title {
  margin: 0;
}

.days-left {
  color: #ffffff;
  font-size: clamp(2.2rem, 11vw, 3.4rem);
}

.hero-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.primary-sub-badge {
  margin: 8px 0 0;
  font-size: clamp(0.78rem, 3.2vw, 0.92rem);
  line-height: 1.35;
  color: #d4c4ff;
}

.primary-sub-badge.hidden {
  display: none;
}

.tariff-card--primary {
  border: 1px solid rgba(180, 150, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(143, 104, 255, 0.2),
    0 8px 26px rgba(100, 60, 200, 0.35);
}

.outline-btn--compact {
  width: 100%;
  margin-top: 14px;
  padding: 10px 12px;
  font-size: clamp(0.78rem, 3.4vw, 0.92rem);
  font-weight: 600;
}

.accent {
  color: #b5a5ff;
  font-size: clamp(0.92rem, 3.7vw, 1.1rem);
}

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

.tile {
  background: linear-gradient(150deg, #3a1468, #251146);
  border-radius: 16px;
  padding: 15px 14px;
}

.tile-label {
  margin: 0;
  color: #e4d8ff;
  font-size: clamp(0.86rem, 3.5vw, 1rem);
}

.tile-value {
  margin: 8px 0 0;
  font-weight: 700;
  font-size: clamp(1rem, 4vw, 1.2rem);
}

.invite-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.invite-card h3 {
  margin: 0 0 8px;
  font-size: clamp(1.1rem, 4.8vw, 1.45rem);
}

.invite-card p {
  margin: 0;
  font-size: clamp(0.86rem, 3.7vw, 1rem);
}

.mascot {
  font-size: clamp(2rem, 10vw, 3rem);
  filter: drop-shadow(0 0 18px rgba(137, 106, 255, 0.45));
}

.primary-btn,
.outline-btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: clamp(0.84rem, 3.6vw, 1rem);
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(180deg, #8f68ff, #5b36c7);
  color: #fff;
}

.primary-btn.small {
  font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  padding: 8px 14px;
}

.outline-btn {
  width: 100%;
  background: #31115d;
  color: #efe5ff;
  border: 1px solid rgba(195, 169, 255, 0.45);
}

.subscription-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subscription-title h2 {
  margin: 0;
  font-size: clamp(1.2rem, 4.9vw, 1.6rem);
}

.status-green {
  color: var(--success);
  font-weight: 700;
  font-size: clamp(0.86rem, 3.7vw, 1rem);
}

.kv-grid p {
  margin: 14px 0;
  font-size: clamp(0.86rem, 3.6vw, 1rem);
}

.bonuses-card h2,
.links-card h3,
.profile-card h2 {
  margin: 0 0 10px;
  font-size: clamp(1.2rem, 5vw, 1.6rem);
}

.links-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ref-link {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #241046;
  border-radius: 16px;
  padding: 12px 14px;
}

.ref-name {
  font-size: clamp(0.95rem, 3.8vw, 1.08rem);
  margin: 0 0 4px;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: linear-gradient(145deg, #8152ff, #30145f);
}

.profile-list p {
  display: flex;
  justify-content: space-between;
  margin: 10px 0;
  font-size: clamp(0.85rem, 3.5vw, 0.98rem);
}

.menu-list {
  display: grid;
  gap: 10px;
}

.menu-item {
  text-align: left;
  border: 0;
  border-radius: 16px;
  background: #110520;
  color: #eaf4ff;
  padding: 16px;
  font-size: clamp(0.88rem, 3.6vw, 1rem);
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 50;
  pointer-events: auto;
  transform: translateX(-50%);
  width: min(430px, calc(100% - 28px));
  background: rgba(12, 4, 23, 0.9);
  border: 1px solid rgba(171, 139, 252, 0.25);
  border-radius: 26px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px;
  backdrop-filter: blur(6px);
}

.nav-btn {
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: #baa8de;
  font-size: clamp(0.72rem, 3vw, 0.85rem);
  padding: 10px 4px;
  cursor: pointer;
}

.nav-btn.active {
  color: #d8cbff;
  background: rgba(151, 102, 255, 0.17);
}

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

/* Объявление к ссылке подписки: переводы строк из текста / \\n из .env видны как новая строка */
.sub-link-announce {
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0 0 12px;
  white-space: pre-line;
}

.danger {
  color: var(--danger);
}

.success {
  color: var(--success);
}

.hidden {
  display: none;
}

@media (max-width: 460px) {
  .app-shell {
    padding: max(2px, env(safe-area-inset-top)) 10px calc(14px + env(safe-area-inset-bottom));
  }

  .topbar {
    height: 62px;
  }

  .bottom-nav {
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 360px) {
  .brand-row {
    flex-direction: column;
    align-items: stretch;
  }
  .wallet-card {
    width: 100%;
    text-align: left;
  }
}

/* ── Phosphor icon alignment ─────────────────────── */
i[class*="ph-"] {
  vertical-align: -0.13em;
  font-size: 1.15em;
  margin-right: 5px;
  line-height: 1;
}
i[class*="ph-"]:only-child {
  margin-right: 0;
}
.modal-close i[class*="ph-"],
.modal-title > i[class*="ph-"] {
  margin-right: 6px;
}
.tile-value i[class*="ph-"] {
  font-size: 1.4rem;
  margin-right: 0;
  color: #c8a8ff;
}
.menu-item i[class*="ph-"] {
  font-size: 1.1rem;
  margin-right: 10px;
  color: #a888ff;
}

/* ── Unicorn mascot image ────────────────────────── */
.mascot-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(255, 140, 210, 0.55));
  flex-shrink: 0;
}
.mascot-img--sm {
  width: 52px;
  height: 52px;
}

/* ── Clickable tiles ──────────────────────────────── */
.tile-btn {
  cursor: pointer;
  will-change: transform;
}
.tile-btn:active {
  opacity: 0.8;
  transform: scale(0.96);
  transition: transform 80ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 80ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Modal overlay ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 2, 18, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  /* Выше нижней навигации и контента Telegram */
  z-index: 100002;
  padding: 0 0 env(safe-area-inset-bottom);
  animation: fadeIn 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  will-change: opacity;
}
.modal-overlay.modal-overlay--fullscreen {
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.modal-overlay.hidden {
  display: none;
}
.modal-overlay.closing {
  animation: fadeOut 280ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  pointer-events: none;
}
@keyframes fadeIn {
  from { opacity: 0 }
  to   { opacity: 1 }
}
@keyframes fadeOut {
  from { opacity: 1 }
  to   { opacity: 0 }
}

.modal-box {
  width: min(460px, 100%);
  background: linear-gradient(170deg, #1a0636 0%, #0d0320 100%);
  border: 1px solid rgba(185, 140, 255, 0.28);
  border-radius: 28px 28px 0 0;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  animation: slideUp 420ms cubic-bezier(0.32, 0.72, 0, 1) both;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  will-change: transform, opacity;
}
/* Оферта: один скролл по тексту, кнопки прибиты к низу (без вложенного scroll в scroll). */
.modal-box.modal-box--fullscreen {
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}
.modal-box.modal-box--fullscreen.modal-box--offer {
  max-height: none;
}
.modal-box.modal-box--offer {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, calc(var(--tg-viewport-height, 100vh) - 24px));
  overflow: hidden;
  padding-bottom: max(18px, calc(14px + env(safe-area-inset-bottom)));
}
.modal-title--offer {
  margin: 0 0 12px;
  flex-shrink: 0;
}
.modal-box.modal-box--offer .offer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 4px 0 10px;
}
.modal-offer-actions {
  flex-shrink: 0;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(185, 140, 255, 0.15);
}
.modal-overlay.closing .modal-box {
  animation: slideDown 280ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes slideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(100%);
    opacity: 0;
  }
}

.modal-title {
  font-size: clamp(1.1rem, 4.8vw, 1.45rem);
  font-weight: 700;
  margin: 0 0 16px;
}
.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 8px;
}

/* ── Amount grid (topup) ─────────────────────────── */
.amount-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.amount-btn {
  border: 1px solid rgba(185, 140, 255, 0.3);
  border-radius: 12px;
  background: #200a40;
  color: var(--text);
  font-size: clamp(0.82rem, 3.4vw, 0.95rem);
  font-weight: 600;
  padding: 12px 4px;
  cursor: pointer;
}
.amount-btn.selected,
.amount-btn:hover {
  background: linear-gradient(180deg, #7038d8, #4f28a0);
  border-color: rgba(185, 140, 255, 0.6);
}
.modal-input {
  width: 100%;
  background: #1a0636;
  border: 1px solid rgba(185, 140, 255, 0.3);
  border-radius: 14px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-family: inherit;
}
.modal-input:focus {
  border-color: rgba(185, 140, 255, 0.7);
}
.modal-input::placeholder { color: var(--muted); }

/* ── Tariff cards ────────────────────────────────── */
.tariff-card {
  background: linear-gradient(165deg, rgba(15,5,30,.97) 5%, rgba(30,10,56,.95) 100%);
  border: 1px solid rgba(185,140,255,.24);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
}
.tariff-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.tariff-name {
  font-size: clamp(1rem, 4.2vw, 1.25rem);
  font-weight: 700;
  margin: 0 0 4px;
}
.tariff-country {
  color: var(--muted);
  font-size: .88rem;
  margin: 0;
}
.tariff-price-main {
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  font-weight: 800;
  color: #d2b4ff;
  white-space: nowrap;
}
.tariff-period-tabs {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.period-btn {
  border: 1px solid rgba(185,140,255,.25);
  border-radius: 10px;
  background: #200a40;
  color: var(--muted);
  font-size: clamp(.76rem,3.1vw,.88rem);
  padding: 8px 4px;
  cursor: pointer;
  font-family: inherit;
}
.period-btn.active {
  background: linear-gradient(180deg,#6438b4,#472986);
  color: #ecf5ff;
  border-color: rgba(190,153,255,.5);
}

/* ── History list ────────────────────────────────── */
.history-list {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #110520;
  border: 1px solid rgba(185, 140, 255, 0.18);
  border-radius: 16px;
  padding: 14px;
  font-size: clamp(.84rem, 3.5vw, .96rem);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(6, 2, 18, 0.28);
}

/* как в профиле: .menu-item i[class*="ph-"] */
.history-item i[class*="ph-"] {
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-right: 0;
  vertical-align: -0.13em;
  line-height: 1;
  margin-top: 2px;
  color: #a888ff;
}
.history-item-label {
  flex: 1;
  min-width: 0;
  line-height: 1.42;
}

/* ── Avatar initials ─────────────────────────────── */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  user-select: none;
}

/* ── Setup step list ─────────────────────────────── */
.setup-steps {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.setup-step {
  background: #150430;
  border-radius: 14px;
  padding: 12px 14px;
}
.setup-step--tap {
  cursor: pointer;
  border: 1px solid rgba(185, 140, 255, 0.2);
  will-change: transform;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
              background 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
              border-color 200ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.setup-step--tap:active {
  transform: scale(0.97);
  background: #1e0840;
  border-color: rgba(185, 140, 255, 0.45);
  transition: transform 80ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.setup-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.setup-step-arrow {
  color: var(--muted);
  font-size: 1rem;
  margin-right: 0;
}
.setup-step strong {
  display: block;
  margin-bottom: 0;
  font-size: .96rem;
}
.setup-step p {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: .86rem;
}
.setup-dl-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.setup-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(180deg, #6438b4, #472986);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
}
.setup-dl-btn--outline {
  background: transparent;
  border: 1px solid rgba(185, 140, 255, 0.4);
  color: #c8a8ff;
  pointer-events: auto;
  cursor: pointer;
  transition: background 150ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.setup-dl-btn--outline:active {
  background: rgba(185, 140, 255, 0.15);
}
.setup-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

/* ── Empty state ─────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 16px 24px;
  color: var(--muted);
  gap: 14px;
}
.empty-state .mascot-img {
  width: 96px;
  height: 96px;
  margin: 0;
}
.empty-state p { margin: 0; font-size: .95rem; }

/* ── Admin panel ─────────────────────────────────── */
.admin-modal {
  max-height: 88vh;
  overflow-y: auto;
  text-align: left;
}
.admin-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(185, 140, 255, 0.25);
}
.admin-section h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.admin-row {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #150430;
  border-radius: 12px;
  font-size: 0.86rem;
}
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.admin-actions .outline-btn,
.admin-actions .primary-btn {
  flex: 1;
  min-width: 90px;
  width: auto;
}
.btn-danger {
  background: linear-gradient(180deg, #a6386b, #6b2244) !important;
  border-color: rgba(255, 120, 160, 0.4) !important;
}
.admin-field-label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0;
  align-items: center;
  font-size: 0.88rem;
}

/* ── Публичная оферта (модалка) ───────────────────── */
.offer-scroll {
  max-height: min(58vh, 380px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 2px 8px;
  margin: 0 -2px;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.45;
}

.offer-legal h3 {
  margin: 14px 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.offer-legal h3:first-child {
  margin-top: 0;
}

.offer-legal p {
  margin: 0 0 8px;
}

.offer-legal ul {
  margin: 6px 0 10px 1rem;
  padding: 0;
}

.offer-legal li {
  margin-bottom: 4px;
}

button.link-inline {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  vertical-align: baseline;
}

/* ── iOS-quality scroll & GPU hints ─────────────────── */
.screen-container,
.modal-box,
.admin-modal {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Карточки — плавный lift при нажатии */
.card,
.tariff-card {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Nav active indicator — плавная подсветка */
.nav-btn.active {
  transition: color 300ms cubic-bezier(0.22, 1, 0.36, 1),
              background-color 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Tab active — spring-переход */
.tab-btn.active {
  transition: background-color 300ms cubic-bezier(0.22, 1, 0.36, 1),
              color 300ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Предотвращаем дёрганье при scroll — translateZ без перебивания translateX(-50%) */
.bottom-nav {
  transform: translateX(-50%) translateZ(0);
  -webkit-transform: translateX(-50%) translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
