/* PrimeNet Developers — Telegram Mini App (mobile-first, dark) */
:root {
  --bg: #08090a;
  --surface: rgba(18, 19, 22, 0.86);
  --card: rgba(17, 17, 17, 0.84);
  --field: rgba(255, 255, 255, 0.06);
  --dark: #111111;
  --text: #f2f2f4;
  --muted: #9a9aa1;
  --border: rgba(255, 255, 255, 0.12);
  --accent: #4f46e5;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
  --container: 560px;
  --transition: 0.3s cubic-bezier(0.22, 1, 0.36, 1);

  /* Safe areas: Telegram (Bot API 8.0+) + системные. max() — чтобы не складывать дважды */
  --safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --header-h: 56px;
  --tabbar-h: 66px;

  color-scheme: dark;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html {
  scroll-behavior: smooth;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  overflow-x: hidden;
  line-height: 1.5;
  padding-top: calc(var(--safe-top) + var(--header-h));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea { -webkit-user-select: text; user-select: text; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* ---------- Canvas rain ---------- */
#rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: block;
  pointer-events: none;
  opacity: 0.4;
}

/* ---------- Header ---------- */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: calc(var(--safe-top) + 8px) 12px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 9, 10, 0.92), rgba(8, 9, 10, 0));
}

.brand, .lang-switch {
  pointer-events: auto;
  height: 40px;
  background: rgba(20, 21, 24, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.brand {
  min-width: 0;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.02em;
}
.brand svg { flex-shrink: 0; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lang-switch {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
}

.lang-btn {
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: var(--transition);
}
.lang-btn.active { background: #fff; color: var(--dark); }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 10px);
  z-index: 100;
  width: calc(100% - 24px);
  max-width: calc(var(--container) - 24px);
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 5px;
  background: rgba(20, 21, 24, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition: transform var(--transition), opacity var(--transition);
}

/* прячем, когда открыта клавиатура или показана MainButton Telegram */
body.kbd .tabbar,
body.has-mainbtn .tabbar {
  transform: translate(-50%, 150%);
  opacity: 0;
  pointer-events: none;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 7px;
  border-radius: 19px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.tab:active { transform: scale(0.96); }
.tab.active { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ---------- Layout ---------- */
section, .hero {
  scroll-margin-top: calc(var(--safe-top) + var(--header-h) + 8px);
}

section {
  max-width: var(--container);
  margin: 0 auto 64px;
  padding: 0 16px;
}

.hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 16px 20px;
}

.section-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: clamp(28px, 8.4vw, 40px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.035em;
}
.section-title .muted { color: #8e8e93; }

/* ---------- Hero ---------- */
.hero-card {
  background-color: var(--card);
  background-image: radial-gradient(circle at 85% 0%, rgba(255, 255, 255, 0.08), transparent 50%);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px 22px 24px;
}

.hero h1 {
  font-size: clamp(38px, 11.5vw, 54px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
}
.hero h1 span { color: #8e8e93; }

.hero-services {
  list-style: none;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14.5px;
  color: #d1d1d6;
}
.hero-services li::before { content: "+ "; color: #8e8e93; }

.hero-desc {
  margin: 24px 0 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 16px;
  line-height: 1.45;
}
.hero-desc span { color: #8e8e93; }

.hero-actions { display: flex; flex-direction: column; gap: 10px; }

.btn-primary, .btn-secondary {
  text-align: center;
  padding: 15px 20px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 15px;
  transition: transform 0.15s, background 0.2s;
}
.btn-primary { background: #fff; color: var(--dark); }
.btn-secondary { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-primary:active, .btn-secondary:active, .price-btn:active, .submit-btn:active { transform: scale(0.98); }

/* ---------- Trust strip ---------- */
.trust-strip {
  list-style: none;
  max-width: var(--container);
  margin: 0 auto 56px;
  padding: 0 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.trust-strip::-webkit-scrollbar { display: none; }

.trust-strip li {
  flex: none;
  scroll-snap-align: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 11px 16px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Advantages ---------- */
.chat-card {
  margin-top: 28px;
  height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(18, 19, 22, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.chat-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  font-weight: 600;
}

.chat-contact strong { display: block; font-size: 15px; line-height: 1.2; }
.chat-contact small { font-size: 12px; color: #34c759; }

.chat-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: none;
}
.chat-body::-webkit-scrollbar { display: none; }

.chat-day { text-align: center; font-size: 11px; color: var(--muted); }

.msg {
  max-width: 84%;
  padding: 9px 13px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.38;
  opacity: 0;
  transform: translateY(10px);
  animation: msgIn 0.4s ease forwards;
}
.msg.in { background: #26272c; color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.out { background: #fff; color: #111; align-self: flex-end; border-bottom-right-radius: 4px; }

@keyframes msgIn { to { opacity: 1; transform: translateY(0); } }

.chat-composer { padding: 10px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }
.composer-input { border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; }

.benefits-box { margin-top: 28px; display: flex; flex-direction: column; gap: 24px; }

.statement { font-size: 20px; line-height: 1.35; color: var(--muted); }
.statement span { color: var(--text); font-weight: 500; }

.stats-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-top strong { font-size: 48px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat-index { font-size: 13px; color: var(--muted); }
.stat-details h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.stat-details p { font-size: 14px; color: var(--muted); }

/* ---------- Pricing ---------- */
.pricing-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  background: rgba(24, 25, 29, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin: 36px 0 16px;
}

.pricing-tab {
  position: relative;
  padding: 12px 6px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: #a1a1a6;
  text-align: center;
  transition: var(--transition);
  white-space: nowrap;
}
.pricing-tab.active { background: #fff; color: #111; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); }

.tab-badge-rec {
  position: absolute;
  top: -15px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
  pointer-events: none;
}

.pricing-grid { display: block; }

.price-card {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 22px;
}
.price-card.mobile-active { display: flex; animation: msgIn 0.3s ease forwards; }
.price-card .badge-rec { display: none; }

.price-head { margin-bottom: 10px; }
.price-head h3 { font-size: 24px; }

.price-desc { font-size: 14.5px; color: #a1a1a6; margin-bottom: 20px; line-height: 1.45; }

.price-val { font-size: 48px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; margin-bottom: 10px; }
.price-val.custom-price { font-size: 34px; padding: 5px 0; }
.price-val small { font-size: 16px; font-weight: 400; color: #8e8e93; }

.price-scope { font-size: 14px; color: #8e8e93; padding-bottom: 20px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

.price-list { list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 14.5px; color: #e5e5ea; margin-bottom: 26px; }
.price-list li { display: flex; align-items: flex-start; gap: 12px; line-height: 1.4; }
.price-list li::before {
  content: "+";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #d1d1d6;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.price-delivery { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: #8e8e93; margin-bottom: 16px; }
.price-delivery span:last-child { color: #fff; font-weight: 500; text-align: right; }

.price-btn {
  display: block;
  text-align: center;
  background: #fff;
  color: var(--dark);
  padding: 15px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.15s;
}

/* ---------- FAQ ---------- */
.faq-wrap { display: grid; grid-template-columns: 1fr; gap: 24px; }
.faq-subtitle { color: var(--muted); margin-top: 12px; font-size: 15px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }

details.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
details.faq-item summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-weight: 500;
  font-size: 15.5px;
  cursor: pointer;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary span:last-child { font-size: 22px; transition: transform 0.2s; flex-shrink: 0; }
details.faq-item[open] summary span:last-child { transform: rotate(45deg); }
details.faq-item p { margin-top: 12px; font-size: 14.5px; color: var(--muted); }

/* ---------- Contact ---------- */
.contact-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px 16px 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.contact-title { padding: 0 6px; }
.contact-subtitle { color: #a1a1a6; margin-top: 12px; font-size: 15px; padding: 0 6px; }

.contact-form {
  background: rgba(28, 29, 33, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.contact-form h3 { font-size: 19px; line-height: 1.25; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }

.field input, .field textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 16px; /* 16px — иначе iOS приближает страницу при фокусе */
  background: var(--field);
  color: var(--text);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field textarea:focus { border-color: rgba(255, 255, 255, 0.45); }
.field input::placeholder, .field textarea::placeholder { color: #6e6e73; }
.field input:user-invalid { border-color: #ff453a; }

/* Custom select */
.custom-select { position: relative; }

.custom-select-trigger {
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--field);
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: border-color 0.2s;
}
.custom-select.open .custom-select-trigger { border-color: rgba(255, 255, 255, 0.45); }

.cs-trigger-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cs-trigger-text strong { font-size: 15.5px; font-weight: 600; line-height: 1.25; }
.cs-trigger-text small { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.cs-chevron { flex-shrink: 0; transition: transform 0.25s ease; }
.custom-select.open .cs-chevron { transform: rotate(180deg); }

.custom-select-menu {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #1c1d21;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.custom-select.open .custom-select-menu { display: flex; }

.cs-option {
  padding: 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.cs-option:active, .cs-option.selected { background: rgba(255, 255, 255, 0.09); }
.cs-opt-info { display: flex; flex-direction: column; gap: 2px; }
.cs-opt-info strong { font-size: 15.5px; font-weight: 600; }
.cs-opt-info small { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.cs-opt-right { font-size: 15.5px; font-weight: 600; flex-shrink: 0; }

.submit-btn {
  background: #fff;
  color: var(--dark);
  padding: 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 15px;
  margin-top: 4px;
  transition: transform 0.15s, opacity 0.2s;
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* В Telegram вместо этой кнопки используется MainButton */
body.is-tg .submit-btn { display: none; }

.form-status { font-size: 13.5px; color: #34c759; display: none; }
.form-status.error { color: #ff453a; }

/* ---------- Orders (Telegram) ---------- */
.seg { display: grid; grid-template-columns: repeat(2, 1fr); background: rgba(24, 25, 29, 0.95); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px; margin: 24px 0 4px; }
.seg-btn { padding: 11px 6px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 500; color: #a1a1a6; transition: var(--transition); }
.seg-btn.active { background: #fff; color: #111; font-weight: 600; }

.orders-list { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.orders-note { color: var(--muted); font-size: 14.5px; text-align: center; padding: 28px 8px; }
.orders-note.error { color: #ff453a; }
.orders-note .btn-secondary { display: inline-block; margin-top: 14px; }
.link-btn { color: #fff; text-decoration: underline; }

.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.order-head { width: 100%; text-align: left; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.order-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.order-title strong { font-size: 16px; font-weight: 600; }
.order-title small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status { flex-shrink: 0; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: var(--radius-pill); }
.st-NEW { background: rgba(79, 70, 229, 0.28); color: #c3c0ff; }
.st-IN_PROGRESS { background: rgba(255, 214, 10, 0.14); color: #ffd60a; }
.st-DONE { background: rgba(52, 199, 89, 0.15); color: #34c759; }
.st-CANCELLED { background: rgba(255, 69, 58, 0.15); color: #ff453a; }

.order-body { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.stepper { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 18px 0 16px; }
.stepper li { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.stepper li::before { content: ""; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.stepper li.done::before { background: #fff; }
.stepper li.now { color: #fff; font-weight: 600; }
.order-cancelled { margin: 18px 0 16px; font-size: 13.5px; color: #ff453a; }

.order-info { font-size: 14px; display: flex; flex-direction: column; gap: 6px; color: #d1d1d6; }
.order-info span { color: var(--muted); }
.order-info a { text-decoration: underline; }
.order-sub { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.order-hist { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.order-hist li { display: flex; justify-content: space-between; gap: 12px; }
.order-hist small { color: var(--muted); text-align: right; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.order-actions button { padding: 11px 16px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 600; background: #fff; color: var(--dark); }
.order-actions button.danger { background: rgba(255, 69, 58, 0.15); color: #ff453a; }
.order-actions button:disabled { opacity: 0.5; }
.order-err { margin-top: 10px; font-size: 13px; color: #ff453a; }

/* ---------- Footer ---------- */
footer {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Wider windows (Telegram Desktop / Web) ---------- */
@media (min-width: 640px) {
  .brand span { overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .msg, .price-card.mobile-active { animation-duration: 0.01s; }
}
