* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; }

a {
  color: #4a9eff;
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.container {
  max-width: 1000px;
  margin: 0 auto;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header h1 {
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 6px;
  background: #1a1a1a;
  border: 1px solid #333;
}

.nav-links a:hover {
  background: #252525;
  text-decoration: none;
}

.config-panel {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #333;
  margin-bottom: 24px;
}

.config-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.config-row:last-child { margin-bottom: 0; }

.config-field {
  flex: 1;
  min-width: 200px;
}

label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  background: #252525;
  border: 1px solid #444;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #4a9eff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

input[type="number"] { max-width: 120px; }

select {
  cursor: pointer;
}

.model-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.model-row select {
  flex: 1;
}

.model-info-btn {
  background: #444;
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.model-info-btn.visible {
  display: flex;
}

.model-info-btn:hover {
  background: #555;
  color: #fff;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #4a9eff;
  color: #fff;
}

.btn-primary:hover { background: #3a8eef; }
.btn-primary:disabled { background: #444; cursor: not-allowed; }

.btn-secondary {
  background: #444;
  color: #fff;
}

.btn-secondary:hover { background: #555; }

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover { background: #c82333; }

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.chat-display {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 24px;
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid #333;
  margin-bottom: 24px;
}

.message {
  margin-bottom: 20px;
  padding: 16px;
  border-radius: 12px;
  animation: fadeIn 0.3s ease;
}

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

.message.model-a {
  background: #1e3a5f;
  border-left: 4px solid #4a9eff;
  margin-right: 40px;
}

.message.model-b {
  background: #2d1e3a;
  border-left: 4px solid #b54a9e;
  margin-left: 40px;
}

.message-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-a .message-header { color: #4a9eff; }
.model-b .message-header { color: #b54a9e; }

.message-content {
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.streaming-cursor::after {
  content: '▊';
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.status-bar {
  text-align: center;
  padding: 12px;
  color: #888;
  font-size: 14px;
}

.status-bar.active { color: #4a9eff; }
.status-bar.error { color: #dc3545; }

.round-indicator {
  text-align: center;
  color: #666;
  font-size: 12px;
  margin-bottom: 16px;
  padding: 8px;
  background: #252525;
  border-radius: 6px;
}

.model-info-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.model-info-modal.show {
  display: flex;
}

.modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #333;
}

.modal-header h2 {
  color: #fff;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: #fff; }

.info-section {
  margin-bottom: 16px;
}

.info-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  margin-bottom: 8px;
}

.info-section p {
  color: #e0e0e0;
  line-height: 1.5;
  margin: 0;
}

.capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.capability {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: #252525;
  color: #888;
}

.capability.enabled {
  background: #1e3a2f;
  color: #4a9eff;
}

.capability.disabled {
  background: #2a1e1e;
  color: #666;
}

.pricing-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pricing-item {
  background: #252525;
  padding: 12px;
  border-radius: 6px;
}

.pricing-item label {
  margin-bottom: 4px;
}

.pricing-item span {
  font-size: 16px;
  color: #fff;
}

.chats-list {
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #333;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chats-rows {
  max-height: 312px;
  overflow-y: auto;
}

.chats-header {
  display: grid;
  grid-template-columns: 180px 1fr 180px 180px 80px;
  padding: 12px 16px;
  background: #252525;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  font-weight: 600;
}

.chat-row {
  display: grid;
  grid-template-columns: 180px 1fr 180px 180px 80px;
  padding: 16px;
  border-bottom: 1px solid #333;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-row:last-child { border-bottom: none; }

.chat-row:hover {
  background: #252525;
}

.chat-row.selected {
  background: #1e3a5f;
}

.chat-row .topic {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 16px;
}

.chat-row .date {
  color: #888;
  font-size: 13px;
}

.chat-row .model {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-row .rounds {
  text-align: center;
  color: #888;
}

.chat-view {
  margin-top: 24px;
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #333;
  padding: 24px;
  display: none;
}

.chat-view.show {
  display: block;
}

.chat-view-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #333;
}

.chat-view-header h2 {
  color: #fff;
  margin-bottom: 8px;
  font-size: 18px;
}

.chat-view-meta {
  display: flex;
  gap: 24px;
  color: #888;
  font-size: 13px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: #4a9eff;
  font-size: 14px;
}

.back-link:hover { text-decoration: underline; }
