:root {
  --bg: var(--tg-theme-bg-color, #0a0e17);
  --fg: var(--tg-theme-text-color, #f4f6fb);
  --hint: var(--tg-theme-hint-color, #8b9cb8);
  --card: var(--tg-theme-secondary-bg-color, #141c2b);
  --accent: var(--tg-theme-button-color, #3b82f6);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #a855f7;
  --orange: #f97316;
  --pink: #ec4899;
  --radius: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 16px 28px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.screen { display: none; flex-direction: column; gap: 16px; flex: 1; animation: fadeIn .35s ease; }
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero {
  text-align: center;
  padding: 8px 0 4px;
}
.hero-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.hero h1 { font-size: 24px; font-weight: 800; line-height: 1.25; margin-bottom: 8px; }
.hero p { color: var(--hint); font-size: 15px; }
.promo-card { margin-top: 4px; }
.promo-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--hint);
  margin-bottom: 10px;
}
.promo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.promo-list li {
  font-size: 14px;
  line-height: 1.4;
  padding-left: 2px;
}
.progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 8px;
}
.progress span {
  height: 4px;
  flex: 1;
  max-width: 48px;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  transition: background .3s;
}
.progress span.on { background: linear-gradient(90deg, var(--blue), var(--purple)); }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,.06);
}
.lesson-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.lesson-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.lesson-icon.g { background: rgba(34,197,94,.2); }
.lesson-icon.b { background: rgba(59,130,246,.2); }
.lesson-icon.p { background: rgba(168,85,247,.2); }
.lesson-card h3 { font-size: 16px; margin-bottom: 4px; }
.lesson-card p { font-size: 14px; color: var(--hint); }
.btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.choice {
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  color: #fff;
}
.choice:active { transform: scale(.97); }
.choice.sel {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.25);
}
.c-green { background: linear-gradient(145deg, #16a34a, #22c55e); }
.c-blue { background: linear-gradient(145deg, #2563eb, #3b82f6); }
.c-purple { background: linear-gradient(145deg, #7c3aed, #a855f7); }
.c-orange { background: linear-gradient(145deg, #ea580c, #f97316); }
.c-pink { background: linear-gradient(145deg, #db2777, #ec4899); }
.c-slate { background: linear-gradient(145deg, #334155, #475569); }
.c-apple { background: linear-gradient(145deg, #1e293b, #334155); }
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 14px;
}
.summary-row:last-child { border: none; }
.summary-row .k { color: var(--hint); }
.summary-row .v { font-weight: 600; text-align: right; }
.status { text-align: center; color: var(--hint); font-size: 13px; min-height: 18px; }
.status.ok { color: var(--green); }
.btn-primary {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  margin-top: auto;
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--hint);
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
}
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--hint);
  line-height: 1.4;
  padding-top: 8px;
}
.steps-video {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  font-size: 14px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Двухколоночный конструктор: слева шаги, справа превью чата бота */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 920px;
  margin: 0 auto;
}
.layout .app {
  max-width: 420px;
  width: 100%;
}
.preview-panel {
  display: none;
  padding: 12px 16px 24px;
}
.preview-label {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hint);
  margin-bottom: 10px;
}
.phone-mock {
  background: #0d1117;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  max-width: 320px;
  margin: 0 auto;
}
.phone-header {
  background: #17212b;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #7eb6ff;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.phone-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}
.mock-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px 12px 12px 4px;
  font-size: 13px;
  line-height: 1.4;
  background: #182533;
  color: #e8edf5;
}
.mock-msg.bot { align-self: flex-start; }
.mock-msg.user { align-self: flex-end; background: #2b5278; border-radius: 12px 12px 4px 12px; }
.mock-msg.file {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px dashed rgba(59,130,246,.5);
  background: rgba(59,130,246,.12);
}
.mock-msg.muted { color: var(--hint); font-style: italic; }
.mock-msg.step { font-size: 12px; opacity: .92; }
.file-icon { font-size: 28px; line-height: 1; }
.file-meta b { display: block; font-size: 13px; }
.file-meta small { display: block; margin-top: 4px; color: var(--hint); font-size: 11px; }
.mock-msg small { display: block; margin-top: 6px; color: var(--hint); font-size: 11px; }
.mock-kb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.mock-kb span {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #b8c5d9;
}
.mock-kb span.primary {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  font-weight: 600;
}

@media (min-width: 720px) {
  .layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    padding: 16px;
  }
  .layout .app {
    flex: 1;
    min-width: 0;
  }
  .preview-panel {
    display: block;
    flex: 0 0 300px;
    position: sticky;
    top: 12px;
  }
  .preview-panel.visible-mobile {
    display: block;
  }
}

@media (max-width: 719px) {
  .preview-panel.visible-mobile {
    display: block;
  }
}

.device-card .device-label {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 4px;
}
.device-card .device-value {
  font-size: 18px;
  font-weight: 700;
}
.captcha {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  user-select: none;
}
.captcha input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}
