:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --border: #1f1f1f;
  --text: #e0e0e0;
  --text-bright: #ffffff;
  --accent: #00ff41;
  --accent-dim: #00cc33;
  --accent-glow: rgba(0, 255, 65, 0.15);
  --muted: #666666;
  --danger: #ff3355;
  --warning: #ffaa00;
  --font: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

#sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: bold;
  text-shadow: 0 0 10px var(--accent-glow);
  transition: opacity 0.15s;
}
.logo:hover { opacity: 0.8; }

.nav-center { display: flex; gap: 1.5rem; }
.nav-link { color: var(--muted); font-size: 0.8rem; font-family: var(--font); transition: color 0.15s; }
.nav-link:hover { color: var(--text); }

.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1rem; font-family: var(--font); cursor: pointer; }

@media (max-width: 768px) {
  .nav-center { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 1rem; gap: 0.75rem; z-index: 100; }
  .nav-center.open { display: flex; }
  .menu-toggle { display: block; }
  .landing-nav { position: relative; flex-wrap: wrap; }
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.session-item {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  transition: all 0.15s;
  color: var(--muted);
}

.session-item:hover { background: var(--bg-tertiary); color: var(--text); }
.session-item.active { background: var(--bg-tertiary); color: var(--accent); }

.session-icon { font-size: 1rem; }
.session-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  transition: all 0.15s;
}

.sidebar-btn:hover { border-color: var(--accent); color: var(--accent); }

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#header {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  gap: 1rem;
}

#menuToggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.header-title { font-size: 0.9rem; font-weight: bold; }
.header-model { margin-left: auto; font-size: 0.75rem; color: var(--muted); }

#chatContainer {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

#welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 0.75rem;
}

.welcome-logo {
  font-size: 2.5rem;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  font-weight: bold;
}

.welcome-sub { font-size: 1rem; color: var(--muted); }
.welcome-info { font-size: 0.8rem; color: var(--muted); max-width: 400px; }

.welcome-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  margin-top: 1rem;
  transition: all 0.2s;
}

.welcome-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 20px var(--accent-glow);
}

#messages { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.5rem 0; }

.message {
  display: flex;
  gap: 0.75rem;
  max-width: 85%;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.message.user .message-avatar { background: var(--accent); color: var(--bg-primary); }
.message.assistant .message-avatar { background: var(--bg-tertiary); color: var(--accent); border: 1px solid var(--border); }

.message-content {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .message-content {
  background: var(--accent);
  color: var(--bg-primary);
}

.message.assistant .message-content {
  border: 1px solid var(--border);
}

.message-model {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

#inputArea {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

#messageInput {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}

#messageInput:focus { border-color: var(--accent); }
#messageInput::placeholder { color: var(--muted); }

#sendBtn {
  background: var(--accent);
  border: none;
  color: var(--bg-primary);
  width: 42px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.15s;
  flex-shrink: 0;
}

#sendBtn:hover { box-shadow: 0 0 15px var(--accent-glow); }
#sendBtn:disabled { opacity: 0.3; cursor: not-allowed; }

#statusBar {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: var(--bg-primary);
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.2); }
}

.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.overlay.hidden { display: none; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.05);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: bold; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

.modal-close:hover { color: var(--text); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.wizard-step { text-align: center; }

.wizard-icon { font-size: 3rem; margin-bottom: 1rem; }

.wizard-step h2 {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.wizard-step p {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.wizard-benefits {
  text-align: left;
  display: inline-block;
  margin: 1rem auto;
}

.benefit { color: var(--accent); font-size: 0.85rem; padding: 0.35rem 0; }

.api-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  text-align: left;
  transition: all 0.2s;
}

.api-card:hover { border-color: var(--accent); }
.api-card.connected { border-color: var(--accent); background: rgba(0, 255, 65, 0.05); }

.api-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.api-card-info { flex: 1; }
.api-card-name { font-size: 0.9rem; font-weight: bold; }
.api-card-desc { font-size: 0.75rem; color: var(--muted); margin-top: 0.2rem; }

.api-connect-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.75rem;
  white-space: nowrap;
  transition: all 0.15s;
}

.api-connect-btn:hover { background: var(--accent); color: var(--bg-primary); }
.api-connect-btn.connected { background: var(--accent); color: var(--bg-primary); cursor: default; }

.wizard-next, .donate-btn {
  background: var(--accent);
  border: none;
  color: var(--bg-primary);
  padding: 0.75rem 2rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: bold;
  margin-top: 1rem;
  transition: all 0.2s;
}

.wizard-next:hover, .donate-btn:hover {
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
}

.wizard-skip {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wizard-skip:hover { color: var(--text); }

.wizard-dots {
  display: flex;
  gap: 6px;
}

.wizard-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.15s;
}

.wizard-dot.active { background: var(--accent); }
.wizard-dot.done { background: var(--accent-dim); }

.api-key-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.8rem;
  margin-top: 0.5rem;
  outline: none;
}

.api-key-input:focus { border-color: var(--accent); }

#landing {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.landing-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
}

.nav-right { display: flex; align-items: center; gap: 1.5rem; }

.lang-select { font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.lang-select:hover { color: var(--accent); }

.live-count { font-size: 0.75rem; color: var(--accent); }

.hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.hero-content { max-width: 640px; }

.hero-badge {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 0.35rem 1rem;
  border-radius: 20px;
  margin-bottom: 1.5rem;
  opacity: 0.8;
}

.hero-title {
  font-size: 3.5rem;
  color: var(--accent);
  text-shadow: 0 0 30px var(--accent-glow);
  margin-bottom: 0.75rem;
}

.hero-sub { font-size: 1.25rem; color: var(--text); margin-bottom: 1rem; }
.hero-sub .accent { color: var(--accent); }

.hero-desc { color: var(--muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 2rem; }

.hero-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font);
  font-size: 1.1rem;
  padding: 0.85rem 2.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2rem;
}

.hero-btn:hover {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 25px var(--accent-glow);
}

.hero-trust {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--muted);
}

.apis-section, .faq-section {
  padding: 4rem 2rem;
  text-align: center;
}

.section-title {
  font-size: 1.3rem;
  color: var(--text-bright);
  margin-bottom: 0.5rem;
}

.section-desc { font-size: 0.85rem; color: var(--muted); margin-bottom: 2rem; }

.api-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 700px;
  margin: 0 auto;
}

.api-logo {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.15s;
}

.api-logo:hover { border-color: var(--accent); color: var(--accent); }
.api-icon { font-size: 1rem; }

.faq-list {
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.faq-q {
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 0.3rem;
}

.faq-a {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  display: none;
}

.faq-item.open .faq-a { display: block; }

.landing-footer {
  display: flex;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
}

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  z-index: 5000;
  font-family: var(--font);
}
.cookie-btn {
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 0.4rem 1.2rem;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.cookie-btn:hover { opacity: 0.9; }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .hero-title { font-size: 2.2rem; }
  .hero-sub { font-size: 1rem; }
  .landing-nav { padding: 0.75rem 1rem; }
  .api-grid { gap: 0.6rem; }
  .api-logo { padding: 0.5rem 0.8rem; font-size: 0.75rem; }
}
