/* ─────────── Домашняя Mini App: liquid glass, mobile-first ───────────
   Лэйаут — флекс-колонка на весь экран (надёжно для вебвью Telegram):
   шапка (auto) → контент (flex:1, скролл) → таб-бар (auto, всегда внизу).
   НЕ используем position:fixed для таб-бара (в TG вьюпорт «плавает»). */
body.home {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 100vh;               /* фолбэк */
  height: 100dvh;              /* динамический вьюпорт, где поддерживается */
  padding: 0;
  overflow: hidden;            /* скроллит только .home-content */
}

/* шапка */
.home-head {
  flex: 0 0 auto;
  padding: 14px 16px 12px;
  padding-top: 14px;
}
@supports (padding: env(safe-area-inset-top)) {
  .home-head { padding-top: calc(14px + env(safe-area-inset-top)); }
}
.hello { display: flex; align-items: center; gap: 13px; }
.avatar {
  width: 50px; height: 50px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff; flex-shrink: 0;
  background: var(--accent-grad); background-size: 160% 160%;
  box-shadow: 0 10px 24px rgba(124,92,255,.5), var(--glass-inset);
  animation: sheen 6s ease infinite;
}
.hello-name { font-size: clamp(18px,5vw,21px); font-weight: 800; letter-spacing:-.02em; }
.hello-sub { font-size: 13px; color: var(--tg-hint); margin-top: 1px; }

/* контент — единственная прокручиваемая область */
.home-content {
  position: relative; z-index: 1;
  flex: 1 1 auto;
  min-height: 0;               /* чтобы flex-ребёнок мог скроллиться */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 6px 14px 14px;
  animation: fade .3s ease;
}
.loader { display: flex; justify-content: center; padding: 70px 0; }

/* карточка розыгрыша — liquid glass */
.gcard {
  position: relative; overflow: hidden;
  border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  animation: rise .5s cubic-bezier(.2,.8,.2,1) both;
}
.gcard::before {
  content:""; position:absolute; inset:0 0 auto 0; height:46%;
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent);
  pointer-events:none;
}
.gcard > * { position: relative; z-index: 1; }
.gcard h3 { margin: 0 0 6px; font-size: clamp(17px,4.8vw,19px); letter-spacing:-.01em; }
.gcard .desc { color: var(--tg-hint); font-size: 14px; margin: 0 0 12px; white-space: pre-line; line-height:1.45; }
.prize-row { display: flex; gap: 9px; align-items: flex-start; margin: 5px 0; font-size: 15px; }
.prize-row .medal { flex-shrink: 0; }
.meta { display: flex; gap: 16px; color: var(--tg-hint); font-size: 13px; margin: 12px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 16px; }
.chip {
  font-size: 12px; padding: 6px 11px; border-radius: 999px; font-weight: 600;
  background: rgba(255,255,255,.07); border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-inset);
}
.chip.prem { background: linear-gradient(135deg,#ffd16633,#ff8a0022); border-color:#ffd16666; color:#ffe2a3; }

/* кнопки */
.btn {
  width: 100%; border: none; cursor: pointer; min-height: 52px;
  padding: 15px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700;
  color: var(--tg-button-text);
  background: var(--accent-grad); background-size: 160% 160%;
  box-shadow: 0 12px 26px rgba(124,92,255,.42), var(--glass-inset);
  transition: transform .12s ease; animation: sheen 6s ease infinite;
}
.btn:active { transform: scale(.97); }
.btn.ghost {
  background: rgba(255,255,255,.07); box-shadow: var(--glass-inset);
  border: 1px solid var(--glass-brd); animation: none;
}

/* строки (билеты / итоги) */
.item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-radius: var(--radius-sm); padding: 15px 16px; margin-bottom: 11px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
}
.item .title { font-weight: 700; font-size: 15px; }
.item .sub { color: var(--tg-hint); font-size: 12px; margin-top: 3px; }
.badge { font-size: 12px; padding: 6px 11px; border-radius: 999px; white-space: nowrap; font-weight: 700; box-shadow: var(--glass-inset); }
.badge.joined { background:#3a86ff22; color:#8fc0ff; }
.badge.winner { background:linear-gradient(135deg,#ffd16633,#ff8a0022); color:#ffe2a3; }
.badge.review { background:#ffa94d22; color:#ffc078; }
.badge.rejected { background:#ff6b6b22; color:#ff9a9a; }
.ticket-no { font-weight:800; color: var(--tg-link); }
.win-line { display:flex; gap:8px; font-size:14.5px; margin:5px 0; align-items:flex-start; }

.empty { text-align: center; color: var(--tg-hint); padding: 56px 18px; font-size: 15px; line-height:1.5; }

/* профиль */
.profile-block {
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.profile-block h4 { margin: 0 0 12px; font-size: 12px; color: var(--tg-hint); text-transform: uppercase; letter-spacing: .08em; }
.lang-row { display: flex; gap: 10px; }
.lang-btn {
  flex: 1; padding: 14px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 700; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid var(--glass-brd); color: var(--tg-text);
  box-shadow: var(--glass-inset); transition: transform .1s;
}
.lang-btn:active { transform: scale(.97); }
.lang-btn.active { background: var(--accent-grad); border-color: transparent; box-shadow: 0 10px 22px rgba(124,92,255,.4); }
.rules { white-space: pre-line; color: var(--tg-hint); font-size: 14px; line-height: 1.6; }

/* нижний таб-бар — обычный нижний flex-элемент (не fixed!) */
.tabbar {
  flex: 0 0 auto; z-index: 5;
  display: flex; padding: 7px;
  margin: 4px 10px 10px;
  border-radius: 22px;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-brd);
  box-shadow: 0 16px 40px rgba(0,0,0,.5), var(--glass-inset);
}
@supports (margin: env(safe-area-inset-bottom)) {
  .tabbar { margin-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
.tab {
  flex: 1; background: none; border: none; cursor: pointer; color: var(--tg-hint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 8px 0; border-radius: 16px;
  transition: color .2s, background .2s; min-height: 52px; justify-content: center;
}
.tab .tab-ic { font-size: 21px; transition: transform .2s; }
.tab.active { color: #fff; background: var(--accent-grad); background-size:160% 160%; box-shadow: 0 8px 18px rgba(124,92,255,.45); animation: sheen 6s ease infinite; }
.tab.active .tab-ic { transform: translateY(-1px) scale(1.05); }
