/* ХЛБ Mini App. Макет Никиты 1080 px шириной: 1rem = 10 px макета, html font-size = ширина экрана / 108. */
@font-face { font-family: "Roboto Flex"; src: url("assets/fonts/RobotoFlex.woff2") format("woff2"); font-weight: 100 1000; font-stretch: 25% 151%; font-display: swap; }
@font-face { font-family: "SF Pro Display"; src: url("assets/fonts/SF-Pro-Display-Medium.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

:root {
  --orange: #ff9500;
  --text-font: -apple-system, "SF Pro Display", "Roboto Flex", system-ui, sans-serif;
  --head-font: "Roboto Flex", -apple-system, system-ui, sans-serif;
  --safe-top: calc(env(safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dur: .28s;
}
@media (prefers-reduced-motion: reduce) { :root { --dur: 0s; } * { animation: none !important; transition: none !important; } }
html.nomotion * { animation: none !important; transition: none !important; }

html { font-size: calc(min(100vw, 480px) / 108); background: #000; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #000; color: #fff; font-family: var(--text-font); font-weight: 500; -webkit-font-smoothing: antialiased; overflow-x: hidden; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img { display: block; }
[hidden] { display: none !important; }

#app { position: relative; width: min(100vw, 480px); margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.screen { position: absolute; inset: 0; min-height: 100vh; min-height: 100dvh; display: none; overflow: hidden; }
.screen.active { display: block; }
.screen.enter { animation: screen-in var(--dur) ease-out both; }
.screen.leave { animation: screen-out var(--dur) ease-in both; pointer-events: none; }
@keyframes screen-in { from { opacity: 0; transform: translateY(2rem); } to { opacity: 1; transform: none; } }
@keyframes screen-out { from { opacity: 1; } to { opacity: 0; } }
.page { position: relative; z-index: 1; padding: calc(5rem + var(--safe-top)) 3rem calc(22rem + var(--safe-bottom)); display: flex; flex-direction: column; gap: 1rem; }

/* Заголовок экрана */
.hdr { display: flex; align-items: center; justify-content: space-between; padding: 1rem; }
.nav-btns { display: flex; gap: 1.5rem; align-items: center; }
.round-btn { width: 10rem; height: 10.1rem; border-radius: 10rem; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; flex: none; transition: transform .15s ease, background .15s ease; }
.round-btn:active { transform: scale(.92); background: rgba(255,255,255,.14); }
.round-btn.is-on { background: rgba(255,255,255,.08); }
.ic-search { width: 5.1rem; height: 5.1rem; }
.ic-back { width: 4.8rem; height: 4rem; }
.ic-up { width: 4.8rem; height: 4rem; transform: rotate(90deg); }
.ic-home { width: 5.4rem; height: 4.79rem; }
.logo { width: 22.8rem; height: 8.05rem; }

.profile-mini { width: 10rem; display: flex; flex-direction: column; align-items: center; flex: none; transition: transform .15s ease; }
.profile-mini:active { transform: scale(.94); }
.avatar { width: 10rem; height: 10rem; border-radius: 50%; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; font-family: var(--head-font); font-weight: 700; font-size: 4.2rem; color: #fff; letter-spacing: -.05em; position: relative; z-index: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.days { position: relative; z-index: 1; margin-top: -2rem; min-width: 3.6rem; padding: .5rem 1rem; border: .05rem solid #fff; border-radius: 6rem; background: var(--orange); box-shadow: inset 0 0 2.29rem rgba(255,255,255,.7); font-weight: 700; font-size: 2.8rem; line-height: 3.3rem; text-align: center; font-family: var(--text-font); }
.days.pop { animation: pop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.bar-profile { opacity: .3; transition: opacity .2s; }
.bar-profile.is-on { opacity: 1; }

/* Свечение шапки главной */
.hero { position: absolute; top: 0; left: 0; right: 0; height: calc(65.9rem + var(--safe-top)); border-radius: 0 0 11rem 11rem; overflow: hidden; background: #000; z-index: 0; }
.hero-glow { position: absolute; left: 10.5rem; top: calc(39rem + var(--safe-top)); width: 103.9rem; height: 103.9rem; animation: breathe 6s ease-in-out infinite; }
.hero-glow img { position: absolute; inset: -51.16%; width: 202.32%; height: 202.32%; max-width: none; }
@keyframes breathe { 0%, 100% { opacity: .9; } 50% { opacity: 1; } }

/* Истории */
.stories-wrap { position: relative; margin: 0 -3rem; }
.stories { display: flex; gap: 3.5rem; padding: 6rem 3rem 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.stories::-webkit-scrollbar { display: none; }
.stories:empty { min-height: 36.1rem; }
.story { width: 19rem; flex: none; display: flex; flex-direction: column; gap: 1.5rem; align-items: center; scroll-snap-align: start; transition: transform .15s ease; }
.story:active { transform: scale(.95); }
.story-pic { width: 19rem; height: 19rem; border-radius: 50%; background: rgba(255,255,255,.09); overflow: hidden; }
.story-pic img { width: 100%; height: 100%; object-fit: cover; }
.story.viewed .story-pic { opacity: .55; }
.story-name { font-size: 3.5rem; line-height: 1.25; letter-spacing: -.07rem; opacity: .5; text-align: center; height: 9.6rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; width: 100%; }
.stories-fade { position: absolute; top: 0; right: 0; bottom: 0; width: 16rem; pointer-events: none; backdrop-filter: blur(1.2rem); -webkit-backdrop-filter: blur(1.2rem); -webkit-mask-image: linear-gradient(to right, transparent, #000 70%); mask-image: linear-gradient(to right, transparent, #000 70%); }

/* Категории */
.cats { padding: 13.6rem 1rem 1rem; display: flex; flex-direction: column; gap: 4rem; }
.cats-row { display: flex; gap: 4rem; }
.card { flex: 1 0 0; min-width: 0; height: 63.1rem; border-radius: 7.8rem; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 5rem; background: rgba(15,15,15,.8); text-align: center; transition: transform .18s ease; animation: rise .55s ease-out both; animation-delay: calc(var(--i, 0) * 70ms); }
.card:active { transform: scale(.96); }
@keyframes rise { from { opacity: 0; transform: translateY(4rem); } to { opacity: 1; transform: none; } }
.card-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; }
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 12.23rem rgba(255,149,0,.35); pointer-events: none; }
.card-text { position: relative; z-index: 1; width: 36.2rem; max-width: 100%; display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.h-cond { font-family: var(--head-font); font-weight: 1000; font-stretch: 50%; font-variation-settings: "wdth" 50, "wght" 1000; text-transform: uppercase; line-height: .97; }
.card-name { font-size: 6.5rem; letter-spacing: -.195rem; width: 100%; }
.card-desc { font-size: 3.5rem; line-height: 1.07; letter-spacing: -.07rem; opacity: .3; width: 27.1rem; max-width: 100%; }

/* Широкая кнопка со свечением */
.btn-wide { position: relative; width: 100%; height: 14.8rem; border-radius: 5.7rem; background: #0f0f0f; overflow: hidden; display: flex; align-items: center; justify-content: center; margin-top: 3rem; transition: transform .15s ease; }
.btn-wide:active { transform: scale(.98); }
.btn-wide-text { position: relative; z-index: 1; font-size: 4rem; line-height: 1.07; letter-spacing: -.08rem; display: inline-flex; align-items: center; gap: 1.2rem; }
.ic-inline { width: 4.2rem; height: 4.2rem; opacity: .9; }
.glow { position: absolute; width: 43.1rem; height: 43.1rem; pointer-events: none; }
.glow img { position: absolute; inset: -63.32%; width: 226.64%; height: 226.64%; max-width: none; }
.glow-bl { left: -6.8rem; top: 16.1rem; }
.glow-tr { left: 80.4rem; top: -37.9rem; }
.btn-wide.is-off { opacity: .45; }

/* Нижний бар */
.bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(100vw, 480px); z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: 5rem 4rem calc(2rem + var(--safe-bottom)); background: linear-gradient(to top, rgba(0,0,0,.95) 55%, rgba(0,0,0,0)); pointer-events: none; }
.bar > * { pointer-events: auto; }

/* Экран категории и профиля: фон сверху */
.bg-top { position: absolute; top: -.3rem; left: 0; right: 0; aspect-ratio: 1074 / 943; opacity: .3; z-index: 0; -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent); mask-image: linear-gradient(to bottom, #000 70%, transparent); }
.bg-top img { width: 100%; height: 100%; object-fit: cover; }
.bg-bread { left: -5.09%; right: -5.09%; aspect-ratio: 1205 / 949; opacity: .5; }
.title-block { height: 74.2rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7.1rem; padding: 1rem 1rem 7rem; }
.progress { display: flex; flex-direction: column; gap: 1.9rem; align-items: center; }
.progress-text { font-size: 3.5rem; line-height: 1.07; letter-spacing: -.07rem; opacity: .3; white-space: nowrap; }
.pbar { width: 23.6rem; height: 1.2rem; border-radius: 8rem; background: rgba(255,255,255,.04); overflow: hidden; }
.pbar i { display: block; height: 100%; width: var(--p, 0%); background: var(--orange); border-radius: 8rem; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.pbar.wide { width: 44rem; }
.cat-title { display: flex; flex-direction: column; gap: 1rem; align-items: center; text-align: center; }
.cat-name { font-family: var(--head-font); font-weight: 1000; font-stretch: 50%; font-variation-settings: "wdth" 50, "wght" 1000; text-transform: uppercase; font-size: 12rem; line-height: .97; letter-spacing: -.36rem; max-width: 66.6rem; }
.cat-desc { font-size: 3.5rem; line-height: 1.07; letter-spacing: -.07rem; opacity: .3; }

/* Посты */
.posts { display: flex; flex-direction: column; }
.post { display: flex; align-items: center; gap: 6rem; padding: 3.1rem 2.5rem 3.1rem 5.5rem; text-align: left; width: 100%; transition: transform .15s ease; animation: rise .45s ease-out both; animation-delay: calc(var(--i, 0) * 50ms); }
.post:active { transform: scale(.98); }
.post-pic { width: 27.1rem; height: 27.1rem; flex: none; border-radius: 5rem; background: #2b2b2b; overflow: hidden; position: relative; box-sizing: border-box; }
.post-pic img { width: 100%; height: 100%; object-fit: cover; }
.post-pic .post-letter { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--head-font); font-weight: 1000; font-stretch: 50%; font-variation-settings: "wdth" 50, "wght" 1000; font-size: 12rem; opacity: .15; text-transform: uppercase; }
.post.opened .post-pic { border: .3rem solid var(--orange); }
.post.opened .post-pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 14.91rem rgba(255,149,0,.5); }
.post-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1.5rem; }
.post-title { font-size: 3.5rem; line-height: 1.07; letter-spacing: -.07rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-text { font-size: 3.5rem; line-height: 1.2; letter-spacing: -.07rem; font-weight: 400; opacity: .5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; background: linear-gradient(148deg, #fff 45%, rgba(255,255,255,0) 92%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: blur(.15rem); }
.post-date { font-size: 3rem; line-height: 1.2; letter-spacing: -.06rem; font-weight: 400; opacity: .2; color: #d9d9d9; }
.subcat-title { padding: 4rem 0; text-align: center; font-size: 3.5rem; line-height: 1.2; font-weight: 400; opacity: .2; text-transform: uppercase; letter-spacing: 2.45rem; text-indent: 2.45rem; }
.empty { padding: 6rem 3rem; text-align: center; font-size: 3.5rem; line-height: 1.3; opacity: .3; }

/* Поиск */
.search-field { flex: 1; margin-left: 1.5rem; height: 10.1rem; border-radius: 10rem; background: rgba(255,255,255,.08); display: flex; align-items: center; gap: 2rem; padding: 0 3rem 0 2.6rem; }
.search-field input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: inherit; font-size: 4rem; letter-spacing: -.08rem; }
.search-field input::placeholder { color: rgba(255,255,255,.3); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-hint { padding: 4rem 1rem 1rem; text-align: center; font-size: 3.5rem; opacity: .3; letter-spacing: -.07rem; }

/* Загрузка и «пост открыт» */
.screen-loading, .screen-post-open { background: #000; }
.glow-bottom { position: absolute; left: -38.7rem; bottom: -184rem; width: 250.7rem; height: 250.7rem; pointer-events: none; animation: breathe 5s ease-in-out infinite; }
.glow-bottom img { position: absolute; inset: -51.16%; width: 202.32%; height: 202.32%; max-width: none; }
.loading-center, .center-content { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 5rem 3rem; box-sizing: border-box; }
.toast { width: 28.2rem; height: 27.9rem; object-fit: cover; animation: float 2.6s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-1.6rem) rotate(1deg); } }
.logo-dim { width: 22.8rem; height: 8.05rem; animation: blink 2.6s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.screen-loading.leave { animation: screen-out .45s ease-in both; }
.center-content { gap: 4rem; text-align: center; }
.check { width: 13.8rem; height: 13.8rem; animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; }
.big-title { font-family: var(--head-font); font-weight: 1000; font-stretch: 50%; font-variation-settings: "wdth" 50, "wght" 1000; text-transform: uppercase; font-size: 12rem; line-height: .97; letter-spacing: -.36rem; }
.big-sub { font-size: 4rem; line-height: 1.07; letter-spacing: -.08rem; opacity: .3; margin-top: -3rem; }
.screen-post-open .pbar i { transition: none; }
.screen-post-open .pbar i.run { animation: fill var(--open-ms, 3000ms) linear forwards; }
@keyframes fill { from { width: 0; } to { width: 100%; } }

/* История */
.story-page { padding-bottom: calc(3rem + var(--safe-bottom)); min-height: 100vh; min-height: 100dvh; box-sizing: border-box; }
.story-hdr { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem 2rem; }
.story-who { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }
.story-hdr-pic { width: 10rem; height: 10rem; border-radius: 50%; background: rgba(255,255,255,.09); overflow: hidden; flex: none; }
.story-hdr-pic img { width: 100%; height: 100%; object-fit: cover; }
.story-hdr-name { font-size: 4rem; line-height: 1.25; letter-spacing: -.08rem; opacity: .5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-content { position: relative; width: 99.5rem; max-width: 100%; margin: 0 auto; flex: 1; height: 168rem; max-height: calc(100vh - 32rem - var(--safe-top) - var(--safe-bottom)); max-height: calc(100dvh - 32rem - var(--safe-top) - var(--safe-bottom)); border-radius: 7rem; background: #0e0e0e; overflow: hidden; }
.story-media { position: absolute; inset: 0; }
.story-media img, .story-media video { width: 100%; height: 100%; object-fit: cover; }
.story-media .story-fade { animation: screen-in .35s ease-out both; }
.story-bars { position: absolute; left: 4.15rem; right: 4.15rem; top: 4.3rem; display: flex; gap: 1rem; z-index: 2; }
.story-bars i { flex: 1; height: 1.2rem; border-radius: 8rem; background: rgba(0,0,0,.81); overflow: hidden; display: block; position: relative; }
.story-bars i::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--orange); border-radius: 8rem; }
.story-bars i.done::before { width: 100%; }
.story-bars i.run::before { animation: fill var(--story-ms, 5000ms) linear forwards; }
.story-bars i.paused::before { animation-play-state: paused; }
.story-tap { position: absolute; top: 0; bottom: 0; width: 40%; z-index: 1; }
.story-tap-prev { left: 0; }
.story-tap-next { right: 0; width: 60%; }
.story-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 12rem 5rem 5rem; background: linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0)); font-size: 4rem; line-height: 1.25; letter-spacing: -.08rem; text-align: center; z-index: 1; }
.story-link { position: absolute; left: 50%; bottom: 5rem; transform: translateX(-50%); z-index: 3; padding: 2.4rem 6rem; border-radius: 10rem; background: rgba(255,255,255,.14); backdrop-filter: blur(1rem); -webkit-backdrop-filter: blur(1rem); font-size: 3.8rem; letter-spacing: -.08rem; white-space: nowrap; }

/* Профиль */
.avatar-big { width: 30rem; height: 30rem; font-size: 12rem; }
.profile-name { font-size: 12rem; }
.profile-sub { font-size: 4rem; letter-spacing: -.08rem; }
.days-block { padding: 7rem 1rem; display: flex; justify-content: center; }
.days-circle { width: 60rem; height: 60rem; border-radius: 50%; padding: 2.1rem; box-sizing: border-box; background: linear-gradient(45deg, var(--orange) 30%, rgba(255,149,0,0) 85%); animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; }
.days-inner { width: 100%; height: 100%; border-radius: 50%; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2.1rem; text-align: center; }
.days-label { font-size: 4rem; line-height: 1.07; letter-spacing: -.08rem; opacity: .3; }
.days-num { font-family: var(--head-font); font-weight: 1000; font-stretch: 50%; font-variation-settings: "wdth" 50, "wght" 1000; text-transform: uppercase; font-size: 12rem; line-height: .97; letter-spacing: -.36rem; }

.toast-msg { position: fixed; left: 50%; bottom: calc(26rem + var(--safe-bottom)); transform: translateX(-50%); z-index: 20; padding: 2.4rem 5rem; border-radius: 10rem; background: rgba(40,40,40,.92); font-size: 3.6rem; letter-spacing: -.07rem; white-space: nowrap; animation: pop .35s cubic-bezier(.2,1.4,.4,1) both; }
