/* scmeAI — фиолетовая тема */
:root {
  --bg: #0a0612;
  --bg-2: #120a22;
  --surface: #1a1030;
  --surface-2: #221540;
  --border: #2b1d4d;
  --text: #ece6ff;
  --muted: #9a8ec7;
  --primary: #8b5cf6;
  --primary-hover: #a374ff;
  --accent: #c084fc;
  --accent-2: #6d28d9;
  --danger: #ef4444;
  --shadow: 0 8px 32px rgba(139, 92, 246, 0.18);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { position: relative; overflow-x: hidden; }

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(139, 92, 246, 0.20), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(192, 132, 252, 0.14), transparent 50%);
}

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

/* ── brand ─────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.5));
}
.brand .ai {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sm { font-size: 18px; }
.brand-sm .brand-logo { width: 30px; height: 30px; }
.brand-center { display: flex; justify-content: center; margin-bottom: 32px; }

/* ── buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all 0.18s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(139, 92, 246, 0.5);
  color: white;
}
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  display: inline-block;
}
.btn-ghost:hover { color: var(--text); border-color: var(--primary); }

/* ── landing ───────────────────────────────────── */
.nav {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 48px;
  max-width: 1200px;
  margin: 0 auto;
}
.nav-links { display: flex; gap: 14px; align-items: center; }

.landing { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 32px; }

.hero { text-align: center; padding: 90px 0 70px; }
.hero h1 {
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 22px;
}
.grad {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lead {
  font-size: 19px;
  color: var(--muted);
  max-width: 580px;
  margin: 0 auto 36px;
}
.hero-actions { display: flex; justify-content: center; gap: 14px; }

.models { padding: 50px 0; }
.models h2 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
}
.model-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.2s ease;
}
.model-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.model-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.model-desc { color: var(--muted); font-size: 14px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 50px 0;
}
.feature {
  background: rgba(26, 16, 48, 0.5);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
}
.feature-icon { font-size: 36px; margin-bottom: 12px; }
.feature h3 { font-size: 18px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; }

.foot {
  text-align: center;
  color: var(--muted);
  padding: 40px 0 30px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ── auth ──────────────────────────────────────── */
.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card h2 {
  font-size: 24px;
  margin-bottom: 6px;
  font-weight: 700;
}
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.auth-card .btn { margin: 22px 0 18px; }

/* ── chat app ──────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 280px;
  background: rgba(10, 6, 18, 0.85);
  backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
}
.sidebar-head { margin-bottom: 16px; padding: 4px 6px; }

#new-chat { margin-bottom: 14px; }

.chat-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 -4px;
  padding: 0 4px;
}
.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text);
  font-size: 14px;
}
.chat-item:hover { background: var(--surface); }
.chat-item.active { background: var(--surface-2); border-left: 2px solid var(--primary); }
.chat-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-del {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s;
}
.chat-item:hover .chat-del { opacity: 1; }
.chat-del:hover { color: var(--danger); background: rgba(239, 68, 68, 0.15); }

.sidebar-foot {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary);
}
.user-name { font-size: 14px; font-weight: 600; }
.user-limit { font-size: 12px; color: var(--muted); }

/* ── chat main ─────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-head {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}
.select:focus { border-color: var(--primary); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.empty-state {
  margin: auto;
  text-align: center;
  max-width: 600px;
}
.empty-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 18px;
  filter: drop-shadow(0 0 24px rgba(139, 92, 246, 0.5));
}
.empty-state h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 28px;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prompts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.prompt-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s;
}
.prompt-chip:hover {
  border-color: var(--primary);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.msg {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.msg.user .msg-avatar {
  background: var(--surface-2);
  color: var(--accent);
}
.msg.assistant .msg-avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  overflow: hidden;
}
.msg.assistant .msg-avatar img {
  width: 100%; height: 100%; object-fit: contain;
}
.msg-body {
  flex: 1;
  padding-top: 4px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.msg-body p { margin-bottom: 10px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 10px 0;
  font-size: 13px;
}
.msg-body code {
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.msg-body pre code { padding: 0; background: transparent; }

.typing {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── composer ──────────────────────────────────── */
.composer {
  padding: 16px 24px 22px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
#input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  resize: none;
  outline: none;
  max-height: 200px;
  transition: border-color 0.15s;
}
#input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); }
.send-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  color: white;
  border: none;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.send-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.attach-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 12px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.attach-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ── scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── mobile ────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 16px 20px; }
  .hero { padding: 50px 0 40px; }
  .sidebar { width: 240px; }
  .messages { padding: 20px 16px; }
  .composer { padding: 12px 16px 16px; }
  .chat-head { padding: 12px 16px; }
}
@media (max-width: 580px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; max-height: 40vh; }
}
