:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-border: #2a2e3a;
  --text: #e8e9ee;
  --text-muted: #9aa0ae;
  --accent: #7c6cf5;
  --accent-hover: #9385ff;
  --good: #3ecf8e;
  --error-bg: #3a1d22;
  --error-border: #7a2b36;
  --error-text: #ff9aa8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

header h1 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

header p {
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 2rem;
}

header a,
footer a {
  color: var(--accent-hover);
  text-decoration: none;
}

header a:hover,
footer a:hover {
  text-decoration: underline;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.checkbox-control {
  gap: 0.4rem;
}

.checkbox-control input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.warning {
  font-size: 0.82rem;
  color: #ffcf6b;
  background: #3a2f14;
  border: 1px solid #6b551f;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: -0.5rem 0 1rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.status-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
}

.field {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

textarea,
.text-input {
  width: 100%;
  resize: vertical;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.4;
}

.text-input {
  margin-top: 0.4rem;
}

select#queryTaskSelect {
  width: 100%;
}

textarea:focus,
select:focus,
.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.document-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}

.document-item textarea {
  flex: 1;
}

.remove-btn {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  border-radius: 6px;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.remove-btn:hover {
  color: var(--error-text);
  border-color: var(--error-border);
}

.add-btn {
  background: transparent;
  border: 1px dashed var(--panel-border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
}

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

.search-btn {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
}

.search-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  color: var(--text-muted);
}

.spinner {
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--panel-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.results {
  margin-top: 2rem;
}

.results h2 {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.result-item {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}

.rank {
  color: var(--text-muted);
  font-weight: 600;
}

.score {
  color: var(--good);
  font-weight: 600;
}

.result-text {
  line-height: 1.5;
}

.vectors-section {
  margin-top: 2rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.25rem 1rem 1rem;
}

.vectors-section summary {
  cursor: pointer;
  padding: 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  user-select: none;
}

.vectors-section summary:hover {
  color: var(--text);
}

.vector-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.vector-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.vector-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.vector-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.copy-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
}

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

.vector-source {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.vector-values {
  max-height: 8rem;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  margin: 0;
}

.error {
  margin-top: 1.5rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}
