:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --border: #262b33;
  --text: #e8eaed;
  --muted: #9aa4b2;
  --accent: #6ee7b7;
  --accent-strong: #34d399;
  --danger: #f87171;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #182028 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #1f2733, #0f1216);
  border: 1px solid var(--border);
  color: var(--accent);
}

h1 { font-size: 22px; margin: 0 0 2px; letter-spacing: -0.01em; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; }

.badges { display: flex; gap: 8px; }
.badge {
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: var(--panel);
}
.badge:hover { border-color: var(--accent); color: var(--accent); }

main { display: flex; flex-direction: column; gap: 20px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-no {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #1c2330;
  color: var(--accent);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
code { background: #1b2027; padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

form { display: flex; gap: 10px; }

input[type="text"] {
  flex: 1;
  background: #0f1216;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

button {
  background: var(--accent-strong);
  color: #04120b;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.5; cursor: wait; }

.status { margin-top: 14px; font-size: 13.5px; color: var(--muted); min-height: 18px; }
.status.error { color: var(--danger); }
.status.success { color: var(--accent); }
.status .spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
  vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#ask-panel[hidden], #answer-card[hidden] { display: none; }

.answer-card { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.answer-mode {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.answer-text {
  white-space: pre-wrap;
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 18px;
}

.citations { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.citations li { font-size: 13px; }
.citations .cite-path { color: var(--accent); font-weight: 600; }
.citations .cite-excerpt {
  display: block;
  margin-top: 4px;
  background: #0f1216;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 140px;
  overflow: auto;
}

footer { margin-top: 36px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
footer a { color: var(--accent); }

@media (max-width: 520px) {
  form { flex-direction: column; }
  header { flex-direction: column; }
}
