/* Демо-бот: вёрстка чата в стиле Telegram + боковая панель «что это». */

:root {
  --bg: #0e1621;
  --panel: #17212b;
  --panel-2: #1c2733;
  --in: #182533;
  --text: #e9eef4;
  --muted: #8195a8;
  --line: rgba(255, 255, 255, .07);
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);
  --radius: 16px;
}

body.light {
  --bg: #eaeef3;
  --panel: #ffffff;
  --panel-2: #f4f7fa;
  --in: #ffffff;
  --text: #12181f;
  --muted: #6b7b8c;
  --line: rgba(15, 30, 45, .1);
  --shadow: 0 18px 44px rgba(20, 35, 50, .16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, color-mix(in srgb, var(--accent, #4fa3ff) 16%, transparent), transparent 65%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 28px 48px;
}

/* ─────────────────────────── чат ─────────────────────────── */

.chat {
  display: flex;
  flex-direction: column;
  height: min(780px, calc(100vh - 68px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.avatar {
  width: 42px; height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text, #101410);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .3px;
}

.who { min-width: 0; }
.who b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; }
.who > span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.who .on { color: #4bd07a; display: inline; }

.head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.badge {
  font-size: 10px;
  letter-spacing: .12em;
  padding: 4px 7px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
}

.icon-btn {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}
.icon-btn:hover { background: var(--line); color: var(--text); }

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1px);
  background-size: 20px 20px;
  scrollbar-width: thin;
}

.chat-body::-webkit-scrollbar { width: 8px; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.chat-inner {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
}

.msg { display: flex; margin: 0 0 8px; }
.msg.out { justify-content: flex-end; }

.bubble {
  max-width: 80%;
  padding: 9px 13px 7px;
  border-radius: 14px 14px 14px 5px;
  background: var(--in);
  border: 1px solid var(--line);
  font-size: 14.5px;
  line-height: 1.46;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12);
}

.msg.out .bubble {
  border-radius: 14px 14px 5px 14px;
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text, #101410);
}

.bubble .t {
  display: block;
  text-align: right;
  font-size: 10.5px;
  opacity: .5;
  margin-top: 3px;
}

.bubble a { color: inherit; text-decoration: underline; }

/* набор текста */
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .16s; }
.typing i:nth-child(3) { animation-delay: .32s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; } 35% { opacity: 1; } }

/* кнопки под сообщением */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 14px 10px;
}
.chips:empty { display: none; }

.chip {
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.chip:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.chip:active { transform: scale(.985); }

.chat-quick {
  display: flex;
  gap: 8px;
  padding: 8px 14px 0;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  flex: none;
}
.chat-quick:empty { display: none; }
.chat-quick button {
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.chat-quick button:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

.chat-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: var(--panel-2);
  flex: none;
}

.chat-input input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14.5px;
  padding: 11px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.chat-input input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.chat-input input::placeholder { color: var(--muted); }

.send {
  width: 40px; height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text, #101410);
  font-size: 16px;
  cursor: pointer;
}
.send:hover { filter: brightness(1.06); }

/* ─────────────────────────── панель ─────────────────────────── */

.side { padding-top: 6px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

.side h1 {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.14;
  letter-spacing: -.02em;
  font-weight: 650;
}
.side h1 em { font-style: normal; color: var(--accent); }

.lede { margin: 0 0 22px; color: var(--muted); font-size: 16px; max-width: 46ch; }

.try {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  margin-bottom: 22px;
}
.try h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.try p { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.try .chips { padding: 0; }

.inside { margin: 0 0 22px; padding: 0; list-style: none; }
.inside li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 14.5px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.inside li:last-child { border-bottom: 0; }
.inside li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 6px;
  color: var(--accent);
  font-size: 12px;
}

.sources { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.sources a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 1px;
}
.sources a:hover { color: var(--text); }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text, #101410);
  font-weight: 600;
  text-decoration: none;
  font-size: 15px;
}
.cta:hover { filter: brightness(1.06); }

.note { margin: 14px 0 0; font-size: 12px; color: var(--muted); max-width: 42ch; }

/* ─────────────────────────── галерея брендов ─────────────────────────── */

.app.gallery-mode { display: block; max-width: 1120px; }

.gallery { max-width: 1000px; margin: 0 auto; padding: 48px 28px 64px; }
.gallery h1 { font-size: clamp(26px, 3.4vw, 40px); letter-spacing: -.02em; margin: 0 0 10px; }
.gallery p.lede { max-width: 60ch; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 26px; }

.tile {
  display: block;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tile) 60%, transparent); }
.tile .mono {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--tile);
  color: #101410;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 12px;
}
.tile b { display: block; font-size: 16px; margin-bottom: 3px; }
.tile span { font-size: 12.5px; color: var(--muted); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; gap: 24px; padding: 18px 14px 40px; }
  .chat { height: min(78vh, 660px); }
  .side { padding: 0 4px; }
  .side h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
