/* Базовые переменные и компоненты интерфейса Mini App. */
:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --tg-theme-bg-color: #f4f7fb;
  --tg-theme-text-color: #17212b;
  --tg-theme-hint-color: #7b8794;
  --tg-theme-link-color: #2aabee;
  --tg-theme-button-color: #2aabee;
  --tg-theme-button-text-color: #ffffff;
  --tg-theme-secondary-bg-color: #ffffff;
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --background: var(--tg-theme-bg-color, #f4f7fb);
  --text: var(--tg-theme-text-color, #17212b);
  --muted: var(--tg-theme-hint-color, #7b8794);
  --accent: var(--tg-theme-link-color, #2aabee);
  --accent-solid: #2aabee;
  --line: rgba(112, 128, 144, 0.14);
  --soft-blue: rgba(42, 171, 238, 0.1);
  --shadow: 0 10px 28px rgba(32, 68, 99, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 68px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
}

body { -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(42, 171, 238, 0.38); outline-offset: 2px; }

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 85% 0%, rgba(42, 171, 238, 0.08), transparent 34%),
    var(--background);
}

.topbar {
  height: calc(58px + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-button, .avatar-button, .nav-item, .icon-button {
  border: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.brand-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.brand-mark, .avatar-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #43c2f3, #238ed4);
  font-weight: 800;
}

.brand-name { font-size: 15px; font-weight: 750; letter-spacing: -0.2px; }
.brand-name span { display: block; margin-top: 1px; color: var(--muted); font-size: 14px; font-weight: 550; letter-spacing: 0.2px; }
.avatar-button { width: 44px; height: 44px; border-radius: 50%; font-size: 14px; }

.app-content {
  min-height: calc(100dvh - var(--nav-height) - 58px - var(--safe-top));
  padding: 12px 18px calc(28px + var(--safe-bottom) + var(--nav-height));
  animation: screen-in 240ms ease both;
}

.app-content.is-transitioning { animation: screen-out 120ms ease both; }
.app-content.screen-enter { animation: screen-in 240ms ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes screen-out { to { opacity: 0; transform: translateX(-8px); } }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #37c98a; box-shadow: 0 0 0 4px rgba(55, 201, 138, 0.12); }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 8vw, 36px); line-height: 1.1; letter-spacing: -1.3px; }
h2 { margin-bottom: 6px; font-size: 23px; line-height: 1.2; letter-spacing: -0.6px; }
h3 { margin-bottom: 5px; font-size: 16px; line-height: 1.3; }
p { color: var(--muted); line-height: 1.55; }
.hero-copy { max-width: 310px; margin-bottom: 19px; font-size: 15px; }
.hero { padding-top: 14px; }
.hero h1 span { color: var(--accent); }

.hero-art {
  height: 192px;
  margin: 4px 0 20px;
  padding: 15px;
  position: relative;
  overflow: hidden;
  border-radius: 27px;
  background: linear-gradient(135deg, #dff5ff 0%, #b5e7fb 50%, #91d4f2 100%);
  box-shadow: var(--shadow);
}

.hero-art::before, .hero-art::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
}

.hero-art::before { width: 180px; height: 180px; right: -30px; top: -85px; }
.hero-art::after { width: 120px; height: 120px; left: -45px; bottom: -70px; }
.art-label { position: absolute; left: 17px; top: 17px; z-index: 1; color: #19638a; font-size: 14px; font-weight: 750; letter-spacing: 0.6px; text-transform: uppercase; }
.art-window {
  position: absolute;
  z-index: 1;
  width: 61%;
  height: 118px;
  right: 20px;
  bottom: 14px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 17px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 26px rgba(14, 97, 137, .16);
  transform: rotate(-3deg);
}
.window-dots { display: flex; gap: 4px; }
.window-dots i { width: 5px; height: 5px; border-radius: 50%; background: #abd8eb; }
.window-title { width: 72%; height: 10px; margin-top: 13px; border-radius: 8px; background: #238ed4; }
.window-subtitle { width: 48%; height: 6px; margin-top: 6px; border-radius: 6px; background: #c8d8e3; }
.window-grid { display: flex; gap: 7px; margin-top: 11px; }
.window-grid i { height: 31px; flex: 1; border-radius: 8px; background: linear-gradient(145deg, #f1f8ff, #d8eff9); }
.art-orbit { position: absolute; z-index: 2; left: 36px; bottom: 35px; display: grid; place-items: center; width: 60px; height: 60px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,255,255,.72); font-size: 25px; box-shadow: 0 8px 20px rgba(14,97,137,.12); transform: rotate(7deg); }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin: 23px 0 12px; }
.section-heading h2 { margin: 0; font-size: 19px; }
.text-button { min-height: 44px; padding: 0 2px; border: 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }

.direction-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.direction-card {
  min-height: 116px;
  padding: 12px 9px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(32, 68, 99, 0.04);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.direction-card:active, .service-card:active, .primary-button:active, .secondary-button:active { transform: scale(.975); }
.direction-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 10px; border-radius: 13px; background: var(--soft-blue); color: var(--accent); font-size: 19px; }
.direction-card strong { display: block; font-size: 14px; line-height: 1.2; }
.direction-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }

.profile-strip {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}
.profile-photo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: white; background: linear-gradient(145deg, #f5b4c5, #c17ee4); font-weight: 800; }
.profile-strip strong { display: block; font-size: 14px; }
.profile-strip small { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }
.profile-arrow { margin-left: auto; color: var(--muted); font-size: 20px; }

.page-head { margin: 8px 0 17px; }
.page-head p { margin: 7px 0 0; font-size: 14px; }
.filter-row { display: flex; gap: 8px; margin: 15px -18px 17px; padding: 0 18px 3px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip { min-height: 44px; flex: none; padding: 0 15px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--muted); font-size: 14px; font-weight: 650; cursor: pointer; }
.filter-chip.is-selected { border-color: var(--accent); background: var(--accent); color: white; }

.service-list { display: grid; gap: 12px; }
.service-card {
  width: 100%;
  min-height: 132px;
  display: flex;
  align-items: stretch;
  gap: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(32, 68, 99, 0.045);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease;
}
.service-visual { display: grid; place-items: center; flex: none; width: 91px; min-height: 104px; border-radius: 16px; overflow: hidden; font-size: 31px; }
.visual-site { background: linear-gradient(145deg, #dcf5ff, #a9e2f7); }
.visual-mini { background: linear-gradient(145deg, #e9e2ff, #c9c0fa); }
.visual-ai { background: linear-gradient(145deg, #ffefd9, #ffd5a5); }
.service-info { min-width: 0; display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 3px 0; }
.service-info h3 { margin: 2px 0 5px; font-size: 15px; }
.service-info p { margin: 0 0 8px; font-size: 14px; line-height: 1.4; }
.service-meta { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: auto; color: var(--muted); font-size: 14px; }
.service-price { color: var(--text); font-size: 14px; font-weight: 750; }
.demo-tag { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 8px; border-radius: 8px; background: rgba(255, 172, 65, .16); color: #a66000; font-size: 14px; font-weight: 750; }

.service-hero {
  min-height: 185px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  margin: 14px 0 18px;
  border-radius: 25px;
  font-size: 56px;
}
.service-hero::before, .service-hero::after { content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; background: rgba(255,255,255,.3); }
.service-hero::before { left: -50px; bottom: -90px; }
.service-hero::after { right: -35px; top: -80px; }
.service-hero-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 105px; height: 105px; border: 1px solid rgba(255,255,255,.6); border-radius: 32px; background: rgba(255,255,255,.52); box-shadow: 0 14px 26px rgba(32,68,99,.08); }
.detail-lead { margin-bottom: 16px; font-size: 14px; }
.detail-section { margin: 20px 0; }
.detail-section h3 { margin-bottom: 10px; }
.check-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.check-list li { display: flex; align-items: flex-start; gap: 9px; color: var(--text); font-size: 14px; line-height: 1.45; }
.check { display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--soft-blue); color: var(--accent); font-size: 14px; font-weight: 800; }
.price-panel { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.price-panel small { display: block; color: var(--muted); font-size: 14px; }
.price-panel strong { font-size: 17px; }
.case-preview { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); text-align: left; cursor: pointer; }
.case-thumb { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--soft-blue); font-size: 22px; }
.case-preview strong { display: block; font-size: 14px; }
.case-preview small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }

.case-art {
  min-height: 215px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  margin: 14px 0 18px;
  border-radius: 25px;
  background: linear-gradient(140deg, #dff5ff, #b3e2f6 55%, #e4dcff);
}
.case-mock { width: 67%; padding: 14px; border: 1px solid rgba(255,255,255,.8); border-radius: 20px; background: rgba(255,255,255,.82); box-shadow: 0 18px 38px rgba(28,83,113,.16); transform: rotate(-2deg); }
.case-mock-top { height: 11px; width: 53%; margin-bottom: 12px; border-radius: 8px; background: #2aabee; }
.case-mock-row { height: 9px; width: 80%; margin: 7px 0; border-radius: 8px; background: #d7e4ed; }
.case-mock-row.short { width: 47%; }
.case-mock-cards { display: flex; gap: 7px; margin-top: 14px; }
.case-mock-cards i { height: 47px; flex: 1; border-radius: 11px; background: linear-gradient(145deg, #e2f5ff, #d8d0ff); }
.case-points { display: grid; gap: 12px; }
.case-point { padding: 13px 14px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.case-point small { display: block; margin-bottom: 5px; color: var(--accent); font-size: 14px; font-weight: 750; text-transform: uppercase; letter-spacing: .4px; }
.case-point p { margin: 0; color: var(--text); font-size: 14px; }

.form-card { display: grid; gap: 16px; margin: 18px 0; padding: 17px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.field { display: grid; gap: 7px; }
.field label { font-size: 14px; font-weight: 700; }
.field-hint { color: var(--muted); font-size: 14px; }
.field select, .field textarea, .field input {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.field textarea { min-height: 105px; resize: vertical; }
.message-preview { margin: 16px 0 12px; }
.message-preview textarea { font-size: 16px; line-height: 1.5; }
.field-error { min-height: 19px; color: #d64c55; font-size: 14px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--background); color: var(--muted); font-size: 14px; cursor: pointer; }
.choice-chip.is-selected { border-color: var(--accent); background: var(--soft-blue); color: var(--accent); font-weight: 700; }

.summary-list { display: grid; gap: 0; margin: 17px 0; padding: 0 15px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.summary-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row strong { display: block; font-size: 14px; }
.summary-row p { margin: 5px 0 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.edit-button { min-height: 44px; padding: 0 2px; border: 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }

.success-hero { display: grid; place-items: center; min-height: 185px; margin: 12px 0 18px; border-radius: 25px; background: linear-gradient(145deg, #dcf8ec, #c1f0dc); }
.success-icon { display: grid; place-items: center; width: 82px; height: 82px; border: 8px solid rgba(255,255,255,.68); border-radius: 50%; background: #39c98a; color: white; font-size: 38px; box-shadow: 0 12px 25px rgba(43,156,111,.2); }
.notice-card { margin: 16px 0; padding: 14px; border-radius: 17px; background: var(--soft-blue); color: var(--text); font-size: 14px; line-height: 1.5; }

.about-art { display: flex; align-items: center; gap: 14px; margin: 13px 0 18px; padding: 17px; border-radius: 22px; background: linear-gradient(125deg, #e2f6ff, #ccecff); color: #174b69; }
.about-art .profile-photo { width: 58px; height: 58px; font-size: 19px; }
.about-art strong { display: block; font-size: 17px; }
.about-art small { display: block; margin-top: 5px; font-size: 14px; opacity: .75; }
.steps { display: grid; gap: 11px; margin: 19px 0; }
.step { display: flex; gap: 12px; align-items: center; }
.step-number { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 12px; background: var(--soft-blue); color: var(--accent); font-size: 14px; font-weight: 800; }
.step strong { display: block; font-size: 14px; }
.step small { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }

.primary-button, .secondary-button, .telegram-button {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 17px;
  background: var(--accent-solid);
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}
.primary-button:disabled { opacity: .58; cursor: wait; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.button-stack { display: grid; gap: 9px; margin-top: 17px; }
.button-hint { margin: 8px 8px 0; text-align: center; font-size: 14px; }

.bottom-nav {
  height: calc(var(--nav-height) + var(--safe-bottom));
  position: fixed;
  z-index: 10;
  bottom: 0;
  left: 50%;
  width: min(100%, 430px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px 14px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--background) 91%, transparent);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.nav-item { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 14px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 650; }
.nav-item.is-active { color: var(--accent); }
.nav-icon { height: 22px; font-size: 22px; line-height: 20px; }
.nav-grid { font-size: 20px; }

.empty-state { padding: 25px 15px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; font-size: 14px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--nav-height) + 20px + var(--safe-bottom)); width: max-content; max-width: calc(100% - 36px); padding: 12px 16px; border-radius: 14px; background: #20313e; color: white; font-size: 14px; box-shadow: var(--shadow); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 431px) {
  body { display: flex; justify-content: center; }
  .app-shell { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tg-theme-bg-color: #17212b;
    --tg-theme-text-color: #f5f7fa;
    --tg-theme-hint-color: #9aa8b5;
    --tg-theme-secondary-bg-color: #202d3a;
    --line: rgba(210, 225, 238, 0.1);
    --soft-blue: rgba(42, 171, 238, 0.16);
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
  }
}

html[data-theme="dark"] {
  --tg-theme-bg-color: #17212b;
  --tg-theme-text-color: #f5f7fa;
  --tg-theme-hint-color: #9aa8b5;
  --tg-theme-secondary-bg-color: #202d3a;
  --line: rgba(210, 225, 238, 0.1);
  --soft-blue: rgba(42, 171, 238, 0.16);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

html[data-theme="light"] {
  --tg-theme-bg-color: #f4f7fb;
  --tg-theme-text-color: #17212b;
  --tg-theme-hint-color: #7b8794;
  --tg-theme-secondary-bg-color: #ffffff;
  --line: rgba(112, 128, 144, 0.14);
  --soft-blue: rgba(42, 171, 238, 0.1);
  --shadow: 0 10px 28px rgba(32, 68, 99, 0.08);
}
