/* ===== Базовая настройка ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0f1115;
  --bg-2: #161a22;
  --surface: #1c2230;
  --surface-2: #232a3a;
  --text: #eef1f6;
  --text-dim: #9aa3b2;
  --accent: #ff6a45;
  --accent-2: #ffb088;
  --bot: #2a3243;
  --user: linear-gradient(135deg, #ff6a45, #ff8a5a);
  --border: rgba(255,255,255,0.08);
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0,0,0,0.35);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(255,106,69,0.18), transparent 60%),
    radial-gradient(700px 400px at -10% 30%, rgba(120,90,255,0.10), transparent 60%),
    var(--bg);
}

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 7vw, 44px); line-height: 1.1; }
h2 { font-size: clamp(22px, 5vw, 30px); margin-bottom: 16px; }
h3 { font-size: 18px; margin-bottom: 6px; }
p  { color: var(--text-dim); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Шапка ===== */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15,17,21,0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #ff6a45, #ff8a5a);
  display: grid; place-items: center;
  font-family: 'Fraunces', serif; font-size: 20px; color: #fff;
  box-shadow: 0 6px 18px rgba(255,106,69,0.35);
}
.logo-text { font-family: 'Fraunces', serif; font-size: 20px; }

.header-nav { display: none; gap: 22px; }
.header-nav a { color: var(--text-dim); font-size: 15px; }
.header-nav a:hover { color: var(--text); text-decoration: none; }

.menu-btn {
  background: none; border: none; padding: 8px;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
.menu-btn span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.2s; }

.mobile-menu {
  position: fixed; top: 62px; right: 12px; z-index: 49;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; min-width: 200px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  display: block; padding: 10px 14px; color: var(--text);
  font-size: 15px; border-radius: 8px;
}
.mobile-menu a:hover { background: var(--surface-2); text-decoration: none; }

/* ===== Главный контент ===== */
.main { padding: 0 16px; max-width: 760px; margin: 0 auto; }

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 36px 6px 24px;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.5;
}
.blob-1 { width: 280px; height: 280px; background: #ff6a45; top: -80px; right: -80px; }
.blob-2 { width: 220px; height: 220px; background: #6a7cff; bottom: -60px; left: -60px; opacity: 0.3; }
.hero-content { position: relative; z-index: 1; }

.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,106,69,0.12);
  color: var(--accent-2);
  font-size: 13px; font-weight: 500;
  border: 1px solid rgba(255,106,69,0.25);
  margin-bottom: 14px;
}
.hero h1 { color: var(--text); margin-bottom: 12px; }
.hero-sub { font-size: 16px; max-width: 560px; }

/* ===== Чат ===== */
.chat-section { margin-top: 22px; }

.chat-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
}

.chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.chat-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, #ff6a45, #ff8a5a);
  display: grid; place-items: center; color: #fff;
}
.chat-title { font-weight: 600; font-size: 15px; }
.chat-status {
  font-size: 12px; color: var(--text-dim);
  display: flex; align-items: center; gap: 6px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #46d18b; box-shadow: 0 0 8px #46d18b; }

.chat-messages {
  padding: 18px 14px;
  min-height: 260px;
  max-height: 56vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }

.msg { display: flex; max-width: 88%; }
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; }

.bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15px; line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-bot .bubble {
  background: var(--bot);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg-user .bubble {
  background: var(--user);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.bubble.thinking::after {
  content: '...';
  display: inline-block;
  animation: dots 1.2s infinite;
  letter-spacing: 2px;
}
@keyframes dots {
  0%, 20% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

.quick-prompts {
  display: flex; gap: 8px;
  padding: 10px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-prompts::-webkit-scrollbar { display: none; }
.quick-prompts button {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s;
  font-family: inherit;
}
.quick-prompts button:hover, .quick-prompts button:active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.chat-input {
  display: flex; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.chat-input textarea {
  flex: 1;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px; /* 16px чтобы iOS не зумил */
  font-family: inherit;
  resize: none;
  max-height: 140px;
  outline: none;
  transition: border 0.15s;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input button {
  width: 46px; height: 46px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 14px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.15s;
}
.chat-input button:hover { background: #ff7a56; }
.chat-input button:disabled { background: var(--surface-2); cursor: not-allowed; }

.chat-hint {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 14px 14px;
}

/* ===== Преимущества ===== */
.features, .howto, .faq, .docs, .contacts {
  padding: 40px 4px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}
.features { border-top: none; margin-top: 40px; }

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}
.feature {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.feature-icon { font-size: 26px; margin-bottom: 10px; }
.feature h3 { color: var(--text); }
.feature p { font-size: 14px; }

/* ===== Как пользоваться ===== */
.howto-list { padding-left: 20px; }
.howto-list li { margin-bottom: 10px; color: var(--text-dim); }
.howto-list li b { color: var(--text); }

/* ===== FAQ ===== */
.faq details {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text);
  list-style: none;
  padding-right: 26px;
  position: relative;
}
.faq summary::after {
  content: '+';
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: 22px; color: var(--accent);
  transition: 0.2s;
}
.faq details[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq p { margin-top: 10px; font-size: 14px; }

/* ===== Документы и контакты ===== */
.docs p, .contacts p { font-size: 14px; margin-bottom: 8px; line-height: 1.7; }

/* ===== Подвал ===== */
.footer {
  margin-top: 50px;
  padding: 28px 16px 36px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
.footer p { font-size: 13px; margin-bottom: 6px; color: var(--text-dim); }
.footer-links a { color: var(--text-dim); }
.footer-note { color: var(--text-dim); opacity: 0.7; margin-top: 8px; }

/* ===== Адаптив ===== */
@media (min-width: 720px) {
  .header-nav { display: flex; }
  .menu-btn { display: none; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .main { padding: 0 24px; }
}

@media (min-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

/* Безопасные зоны iOS */
@supports (padding: max(0px)) {
  .app-header { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .footer { padding-bottom: max(36px, env(safe-area-inset-bottom)); }
}
