/* ─────────────────────────────────────────────────────────────
   Design tokens — light iOS liquid-glass
   ───────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base: radial-gradient(ellipse 90% 60% at 50% 0%, #d6ecff 0%, #eaf3fb 35%, #f6f9fc 70%, #ffffff 100%);
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-strong: rgba(255, 255, 255, 0.86);
  --surface-glass-subtle: rgba(255, 255, 255, 0.45);

  /* Borders */
  --border-glass: rgba(15, 23, 42, 0.06);
  --border-glass-strong: rgba(15, 23, 42, 0.12);

  /* Telegram accent */
  --accent: #2aabee;
  --accent-soft: #3390ec;
  --accent-deep: #1f95d6;
  --accent-glow: rgba(42, 171, 238, 0.28);
  --accent-glow-soft: rgba(42, 171, 238, 0.14);
  --accent-grad: linear-gradient(135deg, #2aabee 0%, #1f95d6 100%);

  /* Text */
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-subtle: #94a3b8;

  /* Effects */
  --blur-glass: blur(22px) saturate(180%);
  --shadow-glass: 0 10px 28px -8px rgba(15, 23, 42, 0.18),
                  0 4px 10px -4px rgba(15, 23, 42, 0.10),
                  inset 0 1px 0 0 rgba(255, 255, 255, 0.7);
  --shadow-elevated: 0 24px 60px -16px rgba(15, 23, 42, 0.25),
                     0 8px 20px -8px rgba(15, 23, 42, 0.15);
  --shadow-button: 0 8px 20px -6px var(--accent-glow);

  /* Status */
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --success-ink: #166534;
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.10);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --warning-ink: #92400e;

  /* Radii */
  --r-pill: 999px;
  --r-card: 22px;
  --r-bubble: 18px;
  --r-phone: 36px;
  --r-input: 14px;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* Easings */
  --ease-out-soft: cubic-bezier(0.2, 0.85, 0.3, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Soft floating colour blobs behind everything — adds depth to glass */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}
body::before {
  width: 420px;
  height: 420px;
  top: -120px;
  left: -100px;
  background: radial-gradient(circle, #b8defb 0%, transparent 70%);
}
body::after {
  width: 360px;
  height: 360px;
  top: 200px;
  right: -120px;
  background: radial-gradient(circle, #cfe6ff 0%, transparent 70%);
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding:
    max(2rem, calc(env(safe-area-inset-top) + 1rem))
    max(1.25rem, env(safe-area-inset-right))
    max(5rem, calc(env(safe-area-inset-bottom) + 4rem))
    max(1.25rem, env(safe-area-inset-left));
}

/* ─────────────────────────────────────────────────────────────
   Progress tracker — horizontal pill stepper
   ───────────────────────────────────────────────────────────── */
.progress-track {
  margin: 0 0 2rem;
}
.progress-track__list {
  list-style: none;
  margin: 0;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-glass);
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.4rem 0.85rem 0.4rem 0.4rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: all 280ms var(--ease-out-soft);
  min-width: 0;
}
.progress-step__dot {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--surface-glass-subtle);
  border: 1.5px solid var(--border-glass-strong);
  color: var(--ink-subtle);
  flex-shrink: 0;
  transition: all 280ms var(--ease-out-soft);
}
.progress-step__check {
  width: 14px;
  height: 14px;
  color: white;
  display: none;
}
.progress-step__num {
  display: inline;
}
.progress-step__label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-subtle);
  white-space: nowrap;
  transition: color 280ms var(--ease-out-soft);
}
.progress-step__line {
  flex: 1;
  height: 2px;
  background: var(--border-glass-strong);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
  min-width: 12px;
  transition: background 380ms var(--ease-out-soft);
}

/* States */
.progress-step[data-state="pending"] { opacity: 0.7; }

.progress-step[data-state="active"] {
  background: var(--surface-glass-strong);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow-soft);
}
.progress-step[data-state="active"] .progress-step__dot {
  background: var(--accent-grad);
  border-color: transparent;
  color: white;
  box-shadow: 0 4px 12px -2px var(--accent-glow);
  animation: progress-pulse 2.4s var(--ease-out-soft) infinite;
}
.progress-step[data-state="active"] .progress-step__label {
  color: var(--ink);
  font-weight: 600;
}

.progress-step[data-state="completed"] .progress-step__dot {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
.progress-step[data-state="completed"] .progress-step__check { display: inline-block; }
.progress-step[data-state="completed"] .progress-step__num { display: none; }
.progress-step[data-state="completed"] .progress-step__label {
  color: var(--ink-muted);
  font-weight: 500;
}
.progress-step[data-state="completed"] + .progress-step__line {
  background: var(--success);
}

@keyframes progress-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px -2px var(--accent-glow); }
  50% { transform: scale(1.06); box-shadow: 0 4px 18px 0 var(--accent-glow); }
}

/* ─────────────────────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────────────────────── */
.hero {
  margin: 0 0 1.75rem;
  text-align: center;
}
.hero h1 {
  font-size: 2.1rem;
  line-height: 1.15;
  margin: 0 0 0.85rem;
  letter-spacing: -0.025em;
  font-weight: 700;
  background: linear-gradient(135deg, #0f172a 0%, #1f3a5f 60%, #1f95d6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero .lede {
  color: var(--ink-muted);
  font-size: 1.02rem;
  margin: 0 auto;
  max-width: 540px;
}

/* ─────────────────────────────────────────────────────────────
   Glass cards
   ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-card);
  padding: 1.85rem 1.6rem;
  box-shadow: var(--shadow-glass);
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}
.card::before {
  /* Subtle inner top highlight — gives glass a polished edge */
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
}
.card h2 {
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--ink);
}
.card p { margin: 0.5rem 0 1rem; color: var(--ink-muted); }

.hint {
  color: var(--ink-muted);
  font-size: 0.93rem;
  margin: 0.25rem 0 1rem;
}

/* ─────────────────────────────────────────────────────────────
   Pricing banner (step 1) — «Бесплатно до 1 июля · 990 ₽/мес»
   ───────────────────────────────────────────────────────────── */
.price-banner {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 0 1rem;
}
.price-banner__row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
}
.price-banner__caption {
  font-size: 0.78rem;
  color: var(--ink-subtle);
  font-weight: 400;
  line-height: 1.3;
}
.price-banner__current {
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--success-ink);
  letter-spacing: -0.02em;
  line-height: 1;
}
.price-banner__regular {
  font-size: 1rem;
  color: var(--ink-subtle);
  line-height: 1;
}
.price-banner__regular s {
  text-decoration-thickness: 1.5px;
}

/* ─────────────────────────────────────────────────────────────
   BotFather Threads Settings — dark iOS-style mockup
   ───────────────────────────────────────────────────────────── */
.bf-mockup {
  margin: 1rem 0 1.25rem;
  background: #1c1c1e;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 12px 28px -8px rgba(15, 23, 42, 0.35),
              inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  font-family: var(--font-sans);
  color: #f5f5f7;
}
.bf-mockup__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #0d0d0f;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.08);
}
.bf-mockup__back {
  font-size: 22px;
  line-height: 1;
  color: #f5f5f7;
  font-weight: 300;
}
.bf-mockup__title-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.95rem;
}
.bf-mockup__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e5e7eb, #9ca3af);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.bf-mockup__verified {
  color: #2aabee;
  font-size: 0.85rem;
  margin-left: -1px;
}
.bf-mockup__dots {
  margin-left: auto;
  color: #f5f5f7;
  font-size: 1.1rem;
  letter-spacing: 1px;
  font-weight: 700;
}
.bf-mockup__section {
  margin: 0;
  padding: 18px 18px 10px;
  font-size: 1.2rem;
  font-weight: 700;
  color: #f5f5f7;
  letter-spacing: -0.01em;
}
.bf-mockup__list {
  margin: 0 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}
.bf-mockup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 14px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #f5f5f7;
}
.bf-mockup__row + .bf-mockup__row {
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
}
.bf-mockup__caption {
  margin: 0;
  padding: 0 18px 14px;
  font-size: 0.78rem;
  color: rgba(245, 245, 247, 0.55);
  text-align: center;
}

/* iOS toggle */
.ios-toggle {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  border-radius: var(--r-pill);
  background: rgba(120, 120, 128, 0.32);
  flex-shrink: 0;
  transition: background 280ms var(--ease-out-soft);
}
.ios-toggle__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18),
              0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 280ms var(--ease-pop);
}
.ios-toggle.is-on {
  /* Telegram-стиль: голубой accent, не системный iOS-зелёный */
  background: #2aabee;
  animation: toggle-glow 2.4s ease-in-out infinite;
}
.ios-toggle.is-on .ios-toggle__knob {
  transform: translateX(20px);
}
@keyframes toggle-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(42, 171, 238, 0.0); }
  50% { box-shadow: 0 0 0 4px rgba(42, 171, 238, 0.30); }
}

/* ─────────────────────────────────────────────────────────────
   Forms
   ───────────────────────────────────────────────────────────── */
form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

input[type="text"], textarea {
  width: 100%;
  font: inherit;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-glass-strong);
  border-radius: var(--r-input);
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, background .2s;
  font-family: var(--font-mono);
}
textarea {
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 120px;
}
input[type="text"]::placeholder, textarea::placeholder {
  color: var(--ink-subtle);
}
input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 4px var(--accent-glow-soft);
}

/* Дополнительный блок полей под основным textarea (URL-кнопка) */
.field-group {
  margin: 0.25rem 0 0;
  padding: 1rem;
  background: var(--surface-glass-subtle);
  border: 1px solid var(--border-glass);
  border-radius: var(--r-input);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.field-group__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.field-group__hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-subtle);
  margin-left: 0.35rem;
}
.field-group .hint {
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────── */
.btn-primary {
  appearance: none;
  background: var(--accent-grad);
  color: white;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  border: none;
  border-radius: var(--r-input);
  padding: 0.85rem 1.4rem;
  cursor: pointer;
  transition: transform .2s var(--ease-out-soft), box-shadow .2s var(--ease-out-soft), filter .2s;
  align-self: flex-start;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-button);
  position: relative;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px var(--accent-glow);
  filter: brightness(1.04);
}
.btn-primary:active { transform: translateY(0); filter: brightness(0.96); }
.btn-primary:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
  box-shadow: none;
}
.btn-link {
  align-self: stretch;
  justify-content: center;
  text-align: center;
}

.btn-secondary {
  appearance: none;
  background: var(--surface-glass-strong);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  border: 1px solid var(--border-glass-strong);
  border-radius: var(--r-input);
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background .2s, border-color .2s, transform .2s;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-secondary:disabled { opacity: 0.55; cursor: progress; }

/* ─────────────────────────────────────────────────────────────
   Status blocks (error / warning / success)
   ───────────────────────────────────────────────────────────── */
.error,
.success,
.warning {
  border-radius: var(--r-input);
  padding: 0.85rem 1rem;
  margin-top: 0.85rem;
  font-size: 0.94rem;
  border-left: 4px solid;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.error {
  background: var(--error-soft);
  color: var(--error);
  border-left-color: var(--error);
}
.success {
  background: var(--success-soft);
  color: var(--success-ink);
  border-left-color: var(--success);
  font-weight: 500;
}
.warning {
  background: var(--warning-soft);
  color: var(--warning-ink);
  border-left-color: var(--warning);
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.2rem;
}
.warning-title {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--warning-ink);
  font-size: 1rem;
}
.warning-body {
  margin: 0.25rem 0 0.5rem;
  font-size: 0.95rem;
}

code {
  font-family: var(--font-mono);
  background: rgba(15, 23, 42, 0.06);
  padding: 0.12em 0.42em;
  border-radius: 6px;
  font-size: 0.9em;
}

.instructions {
  padding-left: 1.25rem;
  margin: 0.75rem 0 1.25rem;
}
.instructions li { margin: 0.4rem 0; }

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

/* ─────────────────────────────────────────────────────────────
   Spinner
   ───────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border-glass-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -2px;
  margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────────────────────────
   Phone Mockup — two iPhones side-by-side, animated chat flow
   ───────────────────────────────────────────────────────────── */
.phone-stage {
  margin: 0 0 1.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  justify-items: center;
  align-items: start;
  padding: 0.5rem 0 0.25rem;
}
.phone-stage[hidden] { display: none; }
.phone-stage__label {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-align: center;
  letter-spacing: 0.01em;
}
.phone-stage__label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 3px var(--accent-glow-soft);
}

.phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 240px;
  width: 100%;
}
.phone__frame {
  position: relative;
  width: 240px;
  height: 504px;
  border-radius: var(--r-phone);
  padding: 5px;
  background: linear-gradient(135deg, #1f1f21 0%, #34343a 50%, #1f1f21 100%);
  box-shadow:
    0 24px 60px -16px rgba(15, 23, 42, 0.45),
    0 10px 30px -8px rgba(15, 23, 42, 0.28),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 0 rgba(0, 0, 0, 0.4);
}
.phone__frame::after {
  /* Side highlight strip — metallic glint */
  content: "";
  position: absolute;
  top: 30%;
  bottom: 30%;
  left: -1px;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,0.20) 50%, transparent);
  border-radius: 2px;
}
.phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #f0f3f7;
  border-radius: 31px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone__notch {
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 17px;
  background: #000;
  border-radius: 999px;
  z-index: 10;
}

.phone__chat-header {
  height: 52px;
  flex-shrink: 0;
  padding: 22px 12px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(247, 248, 250, 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 0.5px solid rgba(15, 23, 42, 0.08);
  z-index: 5;
}
.phone__back {
  color: var(--accent);
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  margin-left: -2px;
}
.phone__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.phone__avatar--bot {
  background: linear-gradient(135deg, #2aabee, #1f95d6);
}
.phone__avatar--user {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  font-weight: 600;
  font-size: 11px;
}
.phone__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.phone__name-sub {
  font-size: 10px;
  color: var(--ink-subtle);
  font-weight: 400;
  margin-left: auto;
}

/* Chat scroll area */
.phone__messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background:
    linear-gradient(180deg, rgba(247, 248, 250, 0.0), rgba(247, 248, 250, 0.0)),
    repeating-linear-gradient(45deg, #e8edf3 0 2px, #ecf0f5 2px 4px);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.phone__messages::-webkit-scrollbar { display: none; }

/* Bubble */
.bubble {
  max-width: 78%;
  padding: 7px 10px 8px;
  border-radius: 14px;
  font-size: 11.5px;
  line-height: 1.35;
  position: relative;
  animation: bubble-enter 360ms var(--ease-out-soft) both;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.bubble--received {
  align-self: flex-start;
  background: white;
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.bubble--sent {
  align-self: flex-end;
  background: linear-gradient(135deg, #4fc3f7 0%, #2aabee 100%);
  color: white;
  border-bottom-right-radius: 4px;
}
.bubble--exiting {
  animation: bubble-exit 320ms ease-in both;
}

/* Reactions — small emoji-pill стоящая снизу bubble (как в Telegram) */
.bubble__reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  margin-bottom: -2px;
}
.bubble__reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px 1px 4px;
  border-radius: var(--r-pill);
  background: rgba(42, 171, 238, 0.14);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  animation: reaction-pop 420ms var(--ease-pop) both;
}
.bubble--sent .bubble__reaction {
  background: rgba(255, 255, 255, 0.22);
  color: white;
}

/* "Моя" реакция — та, которую ставит сам владелец этого экрана.
   Заметно ярче, чтобы было понятно «это поставил я», а не собеседник. */
.bubble__reaction--mine {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 0 1.5px rgba(42, 171, 238, 0.32);
}
.bubble--sent .bubble__reaction--mine {
  background: white;
  color: var(--accent);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.45);
}
.bubble__reaction-emoji {
  font-size: 11px;
  line-height: 1;
}
@keyframes reaction-pop {
  0% { transform: scale(0) translateY(2px); opacity: 0; }
  60% { transform: scale(1.25) translateY(0); opacity: 1; }
  100% { transform: scale(1); }
}
.bubble__reply {
  font-size: 10px;
  padding: 4px 6px 4px 8px;
  margin: -2px -4px 5px;
  background: rgba(42, 171, 238, 0.10);
  border-left: 2px solid var(--accent);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.bubble--sent .bubble__reply {
  background: rgba(255, 255, 255, 0.18);
  border-left-color: rgba(255, 255, 255, 0.85);
}
.bubble__reply-author {
  font-weight: 600;
  color: var(--accent);
  font-size: 9.5px;
}
.bubble--sent .bubble__reply-author { color: rgba(255, 255, 255, 0.95); }
.bubble__reply-text {
  color: var(--ink-muted);
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.bubble--sent .bubble__reply-text { color: rgba(255, 255, 255, 0.85); }
.bubble__time {
  font-size: 9px;
  color: var(--ink-subtle);
  margin-left: 6px;
  vertical-align: baseline;
}
.bubble--sent .bubble__time { color: rgba(255, 255, 255, 0.78); }

/* Voice message inside bubble */
.bubble--voice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
  padding: 8px 10px 9px;
}
.bubble__voice-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-play {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  flex-shrink: 0;
}
.bubble--received .voice-play {
  background: var(--accent);
  color: white;
}
.voice-wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1.5px;
  height: 18px;
}
.voice-wave span {
  width: 2px;
  background: currentColor;
  border-radius: 1px;
  opacity: 0.85;
  animation: voice-wave-anim 1.2s ease-in-out infinite;
}
.voice-time {
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

/* Typing indicator */
.typing {
  align-self: flex-start;
  background: white;
  padding: 8px 12px;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: bubble-enter 280ms var(--ease-out-soft) both;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink-subtle);
  animation: dot-jump 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.30s; }

/* Composer */
.phone__composer {
  flex-shrink: 0;
  padding: 6px 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(247, 248, 250, 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-top: 0.5px solid rgba(15, 23, 42, 0.08);
}
.phone__composer-input {
  flex: 1;
  background: white;
  border: 0.5px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--ink-subtle);
  height: 28px;
  display: flex;
  align-items: center;
}
.phone__composer-mic {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

/* Admin phone — two views (list ↔ detail) with slide transition */
.phone--admin .phone__screen {
  /* Уже position: relative и overflow: hidden, нам этого достаточно */
}
.phone__view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transition: transform 520ms var(--ease-out-soft);
  background: #f0f3f7;
  will-change: transform;
}
.phone__view--list { transform: translateX(0); z-index: 2; }
.phone__view--detail { transform: translateX(100%); z-index: 1; }
.phone--admin.is-in-detail .phone__view--list { transform: translateX(-100%); }
.phone--admin.is-in-detail .phone__view--detail { transform: translateX(0); z-index: 3; }

/* Detail header — name + status in two lines */
.phone__name-block {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
  flex: 1;
}
.phone__name-sub--inline {
  margin-left: 0;
  font-size: 9.5px;
  color: var(--ink-subtle);
  margin-top: 1px;
  transition: color 220ms ease;
}
.phone__name-sub--inline.is-typing {
  color: var(--accent);
  font-weight: 500;
}

/* Highlight pulse on row before operator opens it */
.topic-row.is-opening {
  background: rgba(42, 171, 238, 0.18);
  transition: background 200ms ease;
}

/* Composer typewriter — caret blinks, text fills in via animation */
.phone__composer-input {
  position: relative;
  overflow: hidden;
}
.composer-text {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  vertical-align: middle;
  transition: color 200ms ease;
}
.composer-caret {
  display: none;
  width: 1px;
  height: 13px;
  background: var(--accent);
  vertical-align: middle;
  margin-left: 1px;
  animation: caret-blink 0.9s steps(2, end) infinite;
}
.phone__composer-input.is-typing .composer-caret { display: inline-block; }
.phone__composer-input.is-typing .composer-text { color: var(--ink); }
@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.phone__topic-list {
  flex: 1;
  overflow: hidden;
  background: white;
  padding: 4px 0 0;
}
.topic-row {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 0.5px solid rgba(15, 23, 42, 0.06);
  cursor: pointer;
  animation: topic-slide-in 380ms var(--ease-pop) both;
  transition: background 200ms;
}
.topic-row--new {
  background: rgba(42, 171, 238, 0.06);
}
.topic-row__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.topic-row__body {
  flex: 1;
  min-width: 0;
}
.topic-row__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}
.topic-row__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topic-row__time {
  font-size: 9.5px;
  color: var(--ink-subtle);
  flex-shrink: 0;
}
.topic-row__preview {
  font-size: 10.5px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.topic-row__badge {
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  margin-left: 6px;
  animation: badge-pop 600ms var(--ease-pop) both;
}

/* Animations */
@keyframes bubble-enter {
  0% { transform: translateY(8px) scale(0.94); opacity: 0; filter: blur(2px); }
  60% { opacity: 1; filter: blur(0); }
  100% { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
@keyframes bubble-exit {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-4px) scale(0.96); opacity: 0; }
}
@keyframes dot-jump {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-4px); opacity: 1; }
}
@keyframes topic-slide-in {
  0% { transform: translateY(-16px); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes badge-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes voice-wave-anim {
  0%, 100% { height: 4px; }
  20% { height: 14px; }
  40% { height: 8px; }
  60% { height: 18px; }
  80% { height: 6px; }
}

/* ─────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wrap { padding: 1.25rem 1rem 4rem; }
  .hero h1 { font-size: 1.65rem; }
  .progress-step__label { display: none; }
  .progress-step { padding: 0.4rem; }
  .phone-stage {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .phone, .phone__frame {
    width: 100%;
    max-width: 168px;
  }
  .phone__frame {
    height: 354px;
    border-radius: 26px;
    padding: 4px;
  }
  .phone__screen { border-radius: 22px; }
  .phone__notch { width: 42px; height: 13px; top: 5px; }
  .phone__chat-header { height: 40px; padding: 16px 8px 4px; }
  .phone__name { font-size: 11px; }
  .bubble { font-size: 10px; padding: 5px 8px 6px; }
  .topic-row { padding: 6px 8px; }
  .topic-row__avatar { width: 26px; height: 26px; font-size: 10px; }
  .topic-row__name { font-size: 10.5px; }
  .topic-row__preview { font-size: 9.5px; }
  .card { padding: 1.5rem 1.25rem; }
}

/* ─────────────────────────────────────────────────────────────
   Accessibility
   ───────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .progress-step[data-state="active"] .progress-step__dot { animation: none; }
}
