/* ---------- База ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-size: 16px; overflow: hidden; user-select: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
[hidden] { display: none !important; }

#app { position: relative; height: 100%; max-width: 480px; margin: 0 auto; overflow: hidden; }

/* ---------- Типографика ---------- */
.display, .num { font-style: italic; font-weight: 900; letter-spacing: -.02em; line-height: .95; }
.title { font-size: clamp(36px, 11.5vw, 46px); text-align: center; text-transform: uppercase; }
.caps { font-weight: 800; font-size: 17px; text-transform: uppercase; letter-spacing: .005em; }
.card-title { font-weight: 800; font-size: 20px; margin-bottom: 4px; }
.section-title { align-self: stretch; font-weight: 800; font-size: 18px; margin: 10px 0 -2px; }
.text-2 { color: var(--text-2); }
.sm { font-size: 14px; }
.xs { font-size: 12px; }
.strong { font-weight: 700; }
.blue { color: var(--blue); }
.grow { flex: 1; min-width: 0; }

/* ---------- Иконки и декор ---------- */
.ico { display: inline-grid; place-items: center; flex: none; }
.ico > svg, .ico > .mask { width: 24px; height: 24px; display: block; }
.mask { background: currentColor; -webkit-mask: var(--src) center / contain no-repeat; mask: var(--src) center / contain no-repeat; }
.ico-lg > svg, .ico-lg > .mask { width: 34px; height: 34px; }
.ico-xl > svg, .ico-xl > .mask { width: 52px; height: 52px; }
/* декор из assets/dogs/*.svg */
.deco { display: block; flex: none; pointer-events: none; }
.deco img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brush { width: 62%; max-width: 250px; height: 30px; margin: -4px auto 0; }
.brush-sm { width: 66%; max-width: 230px; height: 30px; margin: 0 auto; }

/* ---------- Вьюхи ---------- */
.view {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity .22s var(--ease), visibility 0s .22s;
}
.view.is-active { opacity: 1; visibility: visible; transition: opacity .22s var(--ease); }
.view-loading { justify-content: center; gap: 18px; }

.app-header { position: relative; z-index: 3; text-align: center; padding: 10px 0 8px; border-bottom: 1px solid var(--border); background: var(--bg); }
.app-header-title { font-weight: 700; font-size: 17px; }
.app-header-sub { font-size: 12px; color: var(--text-2); }
body.has-header .view { top: 58px; }
.demo-chip {
  position: absolute; z-index: 4; right: 12px; top: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
body.has-header .demo-chip { top: 17px; }
@media (max-width: 380px) {
  .demo-chip { right: 8px; padding: 3px 7px; font-size: 9px; letter-spacing: .02em; }
}

/* ---------- Основной экран и страницы ---------- */
.view-main { align-items: stretch; }
.pages { position: relative; flex: 1; overflow: hidden; }
.page {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; gap: var(--gap-card);
  padding: 18px var(--pad-x) calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .18s var(--ease), transform .18s var(--ease), visibility 0s .18s;
}
.page.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .18s var(--ease), transform .18s var(--ease); }
.page::-webkit-scrollbar, .view-og::-webkit-scrollbar { display: none; }

/* вход карточек */
.page.is-active .reveal { animation: rise .3s var(--ease) both; }
.page.is-active .reveal:nth-of-type(2) { animation-delay: .05s; }
.page.is-active .reveal:nth-of-type(3) { animation-delay: .1s; }
.page.is-active .reveal:nth-of-type(4) { animation-delay: .15s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Кнопки ---------- */
.btn {
  width: 100%; min-height: 56px; border-radius: var(--radius-btn); flex: none;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  font-weight: 700; font-size: 20px; text-align: center;
  transition: transform .12s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); font-size: 16px; min-height: 48px; margin-top: 12px; }
.btn .ico > svg, .btn .ico > .mask { width: 26px; height: 26px; }
.btn:disabled { opacity: .4; }

/* ---------- Карточки ---------- */
.card {
  width: 100%; border-radius: var(--radius-card); border: 1px solid var(--border);
  background: linear-gradient(180deg, #1b1b1b 0%, var(--surface) 100%); padding: 16px 18px;
}

/* ---------- HOME ---------- */
.hero { position: relative; margin-top: 6px; }
.hero-star { position: absolute; left: -34px; top: 74px; width: 22px; height: 22px; }
.hero-rays { position: absolute; right: -44px; top: -6px; width: 48px; height: 61px; }
.balance-wrap { position: relative; display: grid; place-items: center; margin-top: -10px; }
.bolt { position: absolute; z-index: 0; width: min(340px, calc(100vw - 24px)); height: 74px; left: 50%; top: 50%; transform: translate(-50%, -18%); }
.balance { position: relative; z-index: 1; font-size: clamp(54px, 17vw, 70px); }
.balance-label { color: #cfcfcf; font-weight: 700; font-size: 18px; text-transform: uppercase; margin-top: -6px; position: relative; z-index: 1; }

.airdrop-card { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.airdrop-head { display: flex; align-items: center; gap: 18px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 10px; border-radius: 10px; background: var(--track); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; border-radius: 10px; background: var(--blue); transition: width 1s var(--ease); }
.tag { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }

.score-card { padding-bottom: 6px; }
.score-row { width: 100%; display: flex; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 17px; font-weight: 500; }
.score-row:last-child { border-bottom: 0; }
.score-row b { font-weight: 700; }
.score-row:active { opacity: .7; }

/* ---------- TASKS ---------- */
.task-list { padding: 4px 16px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.task-ico > * { width: 24px; height: 24px; display: block; }
.task-title { font-weight: 600; font-size: 16px; }
.task-desc { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.task-reward { color: var(--blue); font-weight: 700; font-size: 13px; margin-top: 3px; }
.task-btn {
  min-width: 88px; height: 36px; padding: 0 14px; border-radius: 12px; font-weight: 700; font-size: 14px;
  background: var(--text); color: var(--bg); text-align: center; flex: none; transition: transform .12s, opacity .2s;
}
.task-btn:active { transform: scale(.98); }
.task-btn.is-started { background: var(--blue); color: #fff; }
.task-btn.is-pending { opacity: .5; pointer-events: none; }
.task-btn.is-completed { background: var(--surface-2); color: var(--text-2); pointer-events: none; }
.task-next { color: var(--text-2); font-size: 11px; text-align: center; margin-top: 4px; }

/* Wall of Fame */
.wall { width: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--gap-card); margin-top: 18px; }
.wall-title { font-size: clamp(28px, 9vw, 36px); text-align: center; }
.wall-brush { margin-top: -10px; }
.wall-me { display: flex; align-items: center; gap: 14px; border: 2px solid var(--blue); padding: 14px 18px; }
.wall-name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-rank { font-size: 28px; flex: none; }
.wall-holders { align-self: stretch; font-size: 15px; color: var(--text-2); margin: 6px 0 -4px; }
.wall-list { padding: 4px 16px; }
.wall-row .pos { width: 40px; flex: none; }
.wall-row .pos.medal { font-size: 26px; font-style: normal; }
.wall-row.is-me .name { color: var(--blue); }
.you { font-size: 11px; font-weight: 700; color: var(--bg); background: var(--blue); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 2px; }
.sk { background: var(--surface-2); border-radius: 8px; }
.sk-line { height: 12px; width: 60%; margin: 4px 0; }
.sk-line.short { width: 35%; }
.wall.is-loading .sk { animation: sk-pulse 1.2s ease-in-out infinite; }
.wall.is-loading #me-avatar { background: var(--surface-2); }
@keyframes sk-pulse { 50% { opacity: .45; } }
.empty .btn { margin-top: 12px; }
/* таблица ещё закрыта: «Leaderboard in progress…» */
.wall-locked { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 22px 8px 20px; }
.wall-locked .strong { font-size: 17px; }
.wall-dots { display: flex; gap: 6px; margin-bottom: 4px; }
.wall-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); animation: wall-dot 1.2s ease-in-out infinite; }
.wall-dots i:nth-child(2) { animation-delay: .15s; }
.wall-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes wall-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-weight: 900; font-size: 18px; flex: none; }
.avatar.dim { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row .pos { width: 34px; text-align: center; font-weight: 800; color: var(--text-2); }
.empty { color: var(--text-2); text-align: center; padding: 16px 0; font-size: 14px; }

/* ---------- FRIENDS ---------- */
.friends-title { position: relative; margin-top: 6px; }
.title-rays { position: absolute; right: -34px; top: -8px; width: 38px; height: 46px; }
.friends-num { display: flex; align-items: center; gap: 16px; margin-top: 2px; }
.friends-num .num { font-size: clamp(50px, 15vw, 62px); }
/* живой текст поверх мазка brush_banner_invite.svg */
.banner { position: relative; width: 100%; aspect-ratio: 372 / 68; display: grid; place-items: center; transform: rotate(-2.5deg); }
.banner-bg { position: absolute; inset: 0; }
.banner-text { position: relative; color: #fff; text-align: center; padding: 0 18px 8px 4px; font-style: italic; font-weight: 800; font-size: clamp(14px, 4.7vw, 20px); white-space: nowrap; }
.mission { width: 100%; display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 16px; }
.mission:last-child { border-bottom: 0; }
.mission b { font-weight: 700; }
.check { width: 28px; height: 28px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s; }
.mission.is-started .check { border-color: var(--blue); }
.mission.is-pending .check { border-color: var(--blue); opacity: .5; }
.mission.is-completed .check { background: var(--blue); border-color: var(--blue); }
.mission.is-completed .check > * { width: 18px; height: 18px; }
.airdrop-status { display: flex; align-items: center; gap: 20px; padding: 18px 20px; }
.airdrop-status .caps { font-size: 20px; margin-bottom: 4px; }
.friends-rules { padding-top: 10px; text-align: center; }

/* ---------- OG STATUS ---------- */
.view-og { z-index: 5; background: var(--bg); overflow-y: auto; overflow-x: hidden; gap: 10px; padding: 16px var(--pad-x) calc(20px + env(safe-area-inset-bottom)); }
.view-og.is-active .card { animation: rise .3s var(--ease) both; }
.back { position: absolute; left: 12px; top: 12px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); z-index: 2; }
body.in-telegram .back { display: none; } /* в Telegram — нативная BackButton */
.og-title { font-size: clamp(40px, 13vw, 54px); margin-top: 14px; }
@media (max-width: 380px) { body:not(.in-telegram) .og-title { margin-top: 48px; } }
.brush-og { width: 64%; }
/* лапы как на макете: крупные, у самых краёв экрана, повёрнуты пальцами наружу */
.og-hero { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 6px; }
.paw { position: absolute; top: 50%; width: clamp(80px, 26vw, 104px); aspect-ratio: 98 / 93; height: auto; }
.paw-l { left: calc(-1 * var(--pad-x) - 6px); transform: translateY(-46%) rotate(-24deg); }
.paw-r { right: calc(-1 * var(--pad-x) - 6px); transform: translateY(-46%) scaleX(-1) rotate(-24deg); }
.years-row { display: flex; align-items: center; gap: 8px; margin-top: -14px; position: relative; }
.years-rays { width: 40px; height: 46px; }
.years { font-size: clamp(96px, 32vw, 124px); }
.years-label { font-size: clamp(22px, 7vw, 26px); font-weight: 900; margin-top: -4px; }
.verify-card { border: 2px solid var(--blue); padding: 2px 18px; margin-top: 8px; }
.verify-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; font-weight: 600; font-size: 17px; }
.verify-row + .verify-row { border-top: 1px solid var(--border); }
.v-state { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .03em; }
.v-state .ico { color: var(--blue); }
.v-state .ico > * { width: 26px; height: 26px; }
.og-note { text-align: center; margin-top: -2px; }
.og-bonus { position: relative; text-align: center; padding: 18px 16px 16px; }
.og-bonus-num { font-size: clamp(36px, 11.5vw, 46px); margin-top: 12px; }
.bonus-dashes { position: absolute; right: 8px; top: 12px; width: 53px; height: 37px; }
.og-cta { margin-top: auto; }

/* ---------- Навигация ---------- */
.nav {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex;
  min-height: var(--nav-h); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--border);
}
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 15px; font-weight: 600; color: var(--text); text-align: center; transition: color .18s; }
.nav button .ico > * { width: 28px; height: 28px; }
.nav button.is-active { color: var(--blue); }

/* ---------- Тост ---------- */
.toast {
  position: absolute; left: 50%; top: 14px; z-index: 10; transform: translate(-50%, -90px);
  background: var(--blue); color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 14px;
  transition: transform .3s var(--ease); max-width: calc(100% - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Уменьшение движения ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
