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

:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-hover: #1a1a28;
  --border: #2a2a3a;
  --text: #e4e4ef;
  --text-dim: #8888a0;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --green: #00b894;
  --orange: #fdcb6e;
  --red: #e17055;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
.header {
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1040 50%, #0a0a1a 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, var(--accent-glow) 0%, transparent 50%);
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.header-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.logo-icon { font-size: 2.5rem; }

.logo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.badges {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.3);
  color: var(--accent-light);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Main */
.main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

section {
  margin-bottom: 3rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.section-header p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Chat Section */
.api-key-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.api-key-bar label {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.api-key-bar input {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: monospace;
}

.api-key-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#save-key-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s;
}

#save-key-btn:hover { background: #5a4bd6; }

.link-small {
  font-size: 0.8rem;
  white-space: nowrap;
}

.chat-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-messages {
  height: 400px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.message.system {
  align-self: center;
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.2);
  max-width: 95%;
  text-align: center;
}

.message.error {
  align-self: center;
  background: rgba(225, 112, 85, 0.1);
  border: 1px solid rgba(225, 112, 85, 0.3);
  color: var(--red);
  max-width: 95%;
  text-align: center;
}

.message-content {
  white-space: pre-wrap;
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5rem 0;
}

.message-content pre code {
  background: none;
  padding: 0;
}

.chat-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

#user-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 150px;
}

#user-input:focus {
  outline: none;
  border-color: var(--accent);
}

#send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

#send-btn:hover { background: #5a4bd6; }
#send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.send-icon { font-size: 1rem; }

.example-prompts {
  margin-top: 1rem;
}

.example-prompts p {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.prompts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.5rem;
}

.prompt-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
  transition: all 0.2s;
  line-height: 1.4;
}

.prompt-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--bg-hover);
}

/* Benchmarks */
.benchmark-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.tab:hover { border-color: var(--accent); color: var(--text); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.table-container {
  overflow-x: auto;
}

.table-container.hidden { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  white-space: nowrap;
}

th {
  background: rgba(108, 92, 231, 0.1);
  font-weight: 700;
  color: var(--text);
}

th.highlight, td.highlight {
  color: var(--accent-light);
  font-weight: 700;
}

tr:last-child td { border-bottom: none; }
tr:hover { background: var(--bg-hover); }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.about-card:hover { border-color: var(--accent); }

.about-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--accent-light);
}

.about-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.links-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  transition: all 0.2s;
  text-decoration: none !important;
}

.link-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.link-icon { font-size: 1.25rem; }

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-small { font-size: 0.75rem; margin-top: 0.3rem; }

/* Thinking indicator */
.thinking {
  display: flex;
  gap: 0.3rem;
  padding: 0.5rem 0;
}

.thinking span {
  width: 8px;
  height: 8px;
  background: var(--accent-light);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.thinking span:nth-child(1) { animation-delay: -0.32s; }
.thinking span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Responsive */
@media (max-width: 640px) {
  .logo h1 { font-size: 1.75rem; }
  .header { padding: 2rem 1rem; }
  .main { padding: 1rem; }
  .chat-messages { height: 300px; }
  .prompts-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .links-grid { grid-template-columns: 1fr; }
}
