/* Досье Миши — дизайн-система «UNICORN» (стобалл), статический миниапп */

@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/unbounded-cyrillic-700-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/unbounded-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/golos-text-cyrillic-400-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/golos-text-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}

:root {
  --violet: #2f6fed;
  --magenta: #ec4899;
  --gold: #ff9f0a;
  --bg: #F2F3F7;
  --ink: #0F0F14;
  --muted: #8E93A3;
  --card: #ffffff;
  --card-brd: rgba(15, 17, 26, 0.045);
  --chip: #eef0f5;
  --text-2: #3A3E4D;
  color-scheme: light;

  /* φ-шкала: шаги Фибоначчи 5·8·13·21·34·55·89 — отступы, радиусы, типографика */
  --s1: 5px; --s2: 8px; --s3: 13px; --s4: 21px; --s5: 34px; --s6: 55px; --s7: 89px;
  --r-sm: 13px; --r-md: 21px;
}

html.dark {
  --bg: #0F1015;
  --ink: #F2F3F7;
  --muted: #8E93A3;
  --card: #171923;
  --card-brd: rgba(255, 255, 255, 0.07);
  --chip: #22252F;
  --text-2: #C6CAD6;
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

img { max-width: 100%; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Golos Text", -apple-system, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Фон: светлый, с деликатными бренд-затеканиями (как промо-блоки unicorn) */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 38% at 12% 0%, rgba(47, 111, 237, 0.10), transparent 60%),
    radial-gradient(50% 32% at 92% 8%, rgba(236, 72, 153, 0.08), transparent 60%),
    radial-gradient(70% 46% at 50% 112%, rgba(168, 85, 247, 0.07), transparent 65%),
    #f2f3f7;
}
html.dark .app-bg {
  background:
    radial-gradient(60% 38% at 12% 0%, rgba(47, 111, 237, 0.16), transparent 60%),
    radial-gradient(50% 32% at 92% 8%, rgba(236, 72, 153, 0.12), transparent 60%),
    radial-gradient(70% 46% at 50% 112%, rgba(168, 85, 247, 0.10), transparent 65%),
    #0f1015;
}

/* Скрываем скроллбары, TG-стиль */
::-webkit-scrollbar { width: 0; height: 0; }

/* --- сплэш (как у стобалла) --- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.35s ease;
}
.splash.is-hidden { opacity: 0; pointer-events: none; }
.splash-brand {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, #ec4899 0%, #a855f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: splashPulse 1.4s ease-in-out infinite;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.08); opacity: 1; }
}

/* --- карточка: liquid glass над живым градиентом (рецепт kaminn-ui/README) ---
   матовое стекло: backdrop blur+saturate, спекуляр-хайрлайн по верхней кромке;
   блик за пальцем --lgx/--lgy пишет liquid-glass.js (класс .lg-on) */
.glass {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-brd);
  border-radius: var(--r-md);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 10px rgba(15, 17, 26, 0.05),
    0 14px 36px -18px rgba(15, 17, 26, 0.12);
}
html.dark .glass {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 2px 10px rgba(0, 0, 0, 0.28),
    0 14px 36px -18px rgba(0, 0, 0, 0.55);
}
@supports (background: color-mix(in srgb, red 70%, transparent)) {
  .glass { background: color-mix(in srgb, var(--card) 72%, transparent); }
  html.dark .glass { background: color-mix(in srgb, var(--card) 64%, transparent); }
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    backdrop-filter: blur(18px) saturate(1.5);
  }
}
/* блик, следящий за пальцем; проявляется на тапе — как в iOS */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: radial-gradient(130px 130px at var(--lgx, 50%) var(--lgy, -30%),
    rgba(255, 255, 255, 0.28), transparent 70%);
}
.glass.lg-on::after { opacity: 1; }
html.dark .glass::after {
  background: radial-gradient(130px 130px at var(--lgx, 50%) var(--lgy, -30%),
    rgba(255, 255, 255, 0.10), transparent 70%);
}

.glow-violet { box-shadow: 0 10px 26px -8px rgba(255, 45, 85, 0.45); }

.text-grad {
  background: linear-gradient(100deg, #ec4899 0%, #a855f7 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Чипы: капсулы-сегменты (свет/тьма через токен) */
.chip {
  border: 1px solid transparent;
  background: var(--chip);
  border-radius: 999px;
}

/* --- стаггер-появление карточек при переключении вкладки --- */
.reveal-card { animation: cardIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

/* --- приложение --- */
.app {
  max-width: 430px;
  margin: 0 auto;
  padding: var(--s3) var(--s3) calc(128px + env(safe-area-inset-bottom));
}

.tab-enter { animation: tabIn 0.22s cubic-bezier(0.22, 1, 0.36, 1) both; }
.tab-exit { animation: tabOut 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes tabOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

.h1 {
  font-family: "Unbounded", sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

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

.section-title {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  font-weight: 700;
  margin: var(--s4) 4px var(--s2);
}

/* --- hero: фото 89×144 — золотой прямоугольник (1:φ) --- */
.hero { padding: var(--s4); text-align: center; }
.hero-photo {
  width: 89px;
  height: 144px;
  object-fit: cover;
  border-radius: var(--r-sm);
  box-shadow:
    0 2px 10px rgba(15, 17, 26, 0.05),
    0 14px 36px -18px rgba(15, 17, 26, 0.12);
  border: 3px solid var(--card);
}
.hero-name { margin-top: var(--s3); }
.hero-sub { margin-top: var(--s1); font-size: 13.5px; }
.hero-tag {
  display: inline-block;
  margin-top: var(--s3);
  padding: 5px 13px;
  background: var(--chip);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}

/* --- статистика: цифры по золотому сечению (21px число / 13px подпись ≈ φ) --- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s2);
  margin: var(--s3) 0 0;
}
.stat { padding: var(--s3) 4px; text-align: center; overflow: hidden; }
.stat-num {
  position: relative;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-num .num {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 21px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: var(--s1);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* --- карточки миров --- */
.world { padding: var(--s3); margin-bottom: var(--s2); }
.world-head { display: flex; align-items: center; gap: var(--s3); }
.world-emoji {
  width: var(--s5);
  height: var(--s5);
  flex: none;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: var(--r-sm);
  background: var(--chip);
}
.world-title { font-weight: 700; font-size: 15px; min-width: 0; }
.world-text { margin-top: var(--s2); font-size: 14px; color: var(--text-2); }

/* --- топ-5, аккордеон --- */
details.faq { padding: 0 var(--s3); }
details.faq summary {
  list-style: none;
  cursor: pointer;
  padding: var(--s3) 0;
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2);
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary .chev { color: var(--muted); transition: transform 0.2s; font-size: 12px; flex: none; }
details.faq[open] summary .chev { transform: rotate(180deg); }
details.faq .faq-body { padding: 0 0 var(--s3); font-size: 14px; color: var(--text-2); }
details.faq + details.faq { border-top: 1px solid var(--card-brd); }

/* --- продукты --- */
.product { padding: var(--s3); margin-bottom: var(--s2); }
.product-head { display: flex; align-items: center; gap: var(--s3); }
.product-emoji {
  width: var(--s5);
  height: var(--s5);
  flex: none;
  display: grid;
  place-items: center;
  font-size: 19px;
  border-radius: var(--r-sm);
}
.product-title { font-weight: 700; font-size: 15px; min-width: 0; }
.product-desc { margin-top: var(--s2); font-size: 14px; color: var(--text-2); }
.product-open {
  margin-top: var(--s3);
  width: 100%;
  padding: var(--s3);
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.product-open:active { transform: scale(0.97); filter: brightness(1.15); }

/* Shimmer для загрузки */
.shimmer {
  position: relative;
  overflow: hidden;
  background: var(--chip);
}
.shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  100% { transform: translateX(100%); }
}

/* --- свой бот --- */
.offer { padding: var(--s4) var(--s3); margin-bottom: var(--s2); }
.offer-title { font-weight: 700; font-size: 15.5px; }
.offer-text { margin-top: var(--s1); font-size: 13.5px; color: var(--text-2); }
.btn {
  display: block;
  width: 100%;
  margin-top: var(--s3);
  padding: var(--s3);
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #ff5a5f 0%, #ff2d55 100%);
  color: #ffffff;
  box-shadow: 0 8px 22px -8px rgba(255, 45, 85, 0.5);
}
.btn-primary:active { filter: brightness(1.06); }
.btn-accent { background: var(--violet); color: #fff; border-radius: var(--r-sm); }
.btn-ghost { background: var(--chip); color: var(--ink); }

/* --- конфетти --- */
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -14px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear both;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(540deg); opacity: 0.4; }
}

/* --- нижняя навигация --- */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(430px, calc(100% - 24px));
  display: flex;
  padding: 5px;
  border-radius: var(--r-md);
  z-index: 10;
}
.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  z-index: 1;
  transition: color 0.2s;
}
.nav-item.is-active { color: var(--ink); }
.nav-emoji { font-size: 18px; }
.nav-label { max-width: 100%; overflow: hidden; }
.nav-pill {
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 5px;
  width: calc((100% - 10px) / 4);
  border-radius: var(--r-sm);
  background: var(--chip);
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  z-index: 0;
}
.nav-pill.pos-1 { transform: translateX(100%); }
.nav-pill.pos-2 { transform: translateX(200%); }
.nav-pill.pos-3 { transform: translateX(300%); }

/* --- картинки --- */
.art-status { display: flex; gap: var(--s2); margin-bottom: var(--s3); }
.art-status .chip { flex: 1; min-width: 0; padding: var(--s3) var(--s1); text-align: center; }
.art-status .chip b { font-family: "Unbounded", sans-serif; font-size: 15px; display: block; font-variant-numeric: tabular-nums; }
.art-status .chip span { font-size: 10.5px; color: var(--muted); line-height: 1.25; display: block; margin-top: 3px; overflow-wrap: break-word; }

.gen-input {
  width: 100%;
  min-height: var(--s7);
  padding: var(--s3);
  border-radius: var(--r-sm);
  border: 1px solid var(--card-brd);
  background: var(--card);
  font-family: inherit;
  font-size: 14.5px;
  resize: none;
  outline: none;
  color: var(--ink);
}
.gen-input:focus { border-color: var(--violet); }

/* --- строка «голос + сгенерировать»: микрофон компактный, ряд сжимается и не распирается --- */
.gen-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.gen-actions .btn { margin-top: 0; min-width: 0; }
.btn-mic {
  flex: none;
  width: var(--s6); /* 55px — шаг φ-шкалы */
  padding: 0;
  font-size: 20px;
  line-height: 1;
}
.btn-mic.is-rec { color: #ff2d55; }
.gen-actions .btn-primary { flex: 1 1 0; }

.art-result { margin-top: var(--s3); padding: var(--s3); text-align: center; }
.art-result img { width: 100%; border-radius: var(--r-sm); display: block; }
.art-result .btn { margin-top: var(--s2); }
.art-note { font-size: 12.5px; color: var(--muted); margin-top: var(--s2); line-height: 1.45; overflow-wrap: break-word; }

.upload-row { display: flex; gap: var(--s2); align-items: center; margin-top: var(--s3); }
.upload-row .art-note { flex: 1; min-width: 0; margin-top: 0; }
.upload-preview {
  width: var(--s6);
  height: var(--s6);
  border-radius: var(--r-sm);
  object-fit: cover;
  border: 1px solid var(--card-brd);
  display: none;
  flex: none;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: min(390px, calc(100% - 32px));
  background: rgba(15, 15, 20, 0.92);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.toast.is-show { opacity: 1; }

@media (max-width: 350px) {
  .stat-label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- запись голоса: пульс --- */
.btn.is-rec {
  background: rgba(255, 45, 85, 0.12);
  animation: recPulse 1.2s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 45, 85, 0.25); }
  50% { box-shadow: 0 0 0 9px rgba(255, 45, 85, 0.08); }
}
