body {
  margin: 0; min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center;
  background: #f0f4fa; color: #1a1a1a;
  padding: 24px;
}

.card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,87,168,.12);
  padding: 40px 40px 32px; width: 100%; max-width: 700px;
  margin-top: 40px;
}

.logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: #0057a8; }
.logo h1 { margin: 0; font-size: 1.25rem; font-weight: 700; color: #0057a8; }
.logo sup { font-size: .7rem; color: #888; font-weight: 400; }

label { display: block; font-size: .875rem; font-weight: 600; color: #444; margin-bottom: 8px; }

.input-row { display: flex; gap: 10px; }

input[type="text"] {
  flex: 1; padding: 13px 16px;
  border: 1.5px solid #c8d4e8; border-radius: 8px;
  font-size: 1rem; outline: none; transition: border-color .15s; color: #1a1a1a;
}
input[type="text"]:focus { border-color: #0057a8; }

button#searchBtn {
  padding: 13px 24px; background: #0057a8; color: #fff;
  border: none; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
button#searchBtn:hover { background: #004494; }
button#searchBtn:disabled { background: #7aaad4; cursor: not-allowed; }

.examples { margin-top: 16px; font-size: .82rem; color: #888; }
.examples span {
  display: inline-block; margin-right: 4px; margin-bottom: 6px;
  background: #e8f0fb; color: #0057a8; border-radius: 20px;
  padding: 3px 12px; cursor: pointer; transition: background .15s;
}
.examples span:hover { background: #d0e2f8; }

/* ── Status bar ─────────────────────────────── */
#statusBar {
  display: none; margin-top: 20px;
  padding: 10px 14px; border-radius: 8px;
  background: #f0f6ff; border-left: 3px solid #0057a8;
  font-size: .85rem; color: #0057a8;
  display: none; align-items: center; gap: 10px;
}
#statusBar.active { display: flex; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #c8d4e8; border-top-color: #0057a8;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error box ───────────────────────────────── */
#errorBox {
  display: none; margin-top: 16px;
  padding: 12px 16px; border-radius: 8px;
  font-size: .88rem; line-height: 1.5;
  align-items: flex-start; gap: 10px;
}
#errorBox.active { display: flex; }
#errorBox.err-warn  { background: #fff8e1; border-left: 4px solid #f59e0b; color: #78350f; }
#errorBox.err-block { background: #fef2f2; border-left: 4px solid #ef4444; color: #7f1d1d; }
#errorBox.err-limit { background: #fff3cd; border-left: 4px solid #f59e0b; color: #713f12; }
#errorBox.err-info  { background: #f0f7ff; border-left: 4px solid #0057a8; color: #1e3a5f; }
.error-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* ── Zeichenzähler ──────────────────────────── */
.input-meta { display: flex; justify-content: flex-end; margin-top: 4px; }
#charCount { font-size: .75rem; color: #aaa; }
#charCount.warn  { color: #f59e0b; font-weight: 600; }
#charCount.limit { color: #ef4444; font-weight: 700; }

/* ── Results ─────────────────────────────────── */
#results { margin-top: 24px; display: none; }

.results-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding: 6px 0;
}
.results-header h2 {
  font-size: .9rem; color: #888; margin: 0; font-weight: 600;
}
.results-toggle {
  font-size: .78rem; color: #0057a8; white-space: nowrap;
}
.results-toggle::before { content: '▾ '; }
.results-header.collapsed .results-toggle::before { content: '▸ '; }

.result-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px; padding-bottom: 4px;
}
.result-chips.hidden { display: none; }

.result-chip {
  display: inline-flex; flex-direction: column;
  background: #f0f4fa; border: 1px solid #dde4ef;
  border-radius: 8px; padding: 5px 10px;
  max-width: 200px; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.result-chip:hover { background: #e0ebf8; border-color: #0057a8; }
.chip-title {
  font-size: .8rem; font-weight: 600; color: #0057a8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip-meta {
  font-size: .72rem; color: #999; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Answer box ──────────────────────────────── */
#answerBox {
  margin-top: 24px; display: none;
  border-top: 1px solid #e8edf5; padding-top: 20px;
}
#answerBox h2 { font-size: 1rem; color: #444; margin: 0 0 14px; }

#answerNotice {
  display: none; padding: 12px 16px; border-radius: 8px;
  font-size: .88rem; line-height: 1.5; margin-bottom: 12px;
}
#answerNotice.notice-info  { background: #f0f7ff; border-left: 4px solid #0057a8; color: #1e3a5f; }
#answerNotice.notice-warn  { background: #fff8e1; border-left: 4px solid #f59e0b; color: #78350f; }

#answerStream {
  min-height: 40px;
}

.loading-dots {
  display: flex; gap: 8px; align-items: center; padding: 10px 0;
}
.loading-dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: #0057a8;
  animation: dot-pulse 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: .2s; }
.loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot-pulse {
  0%, 80%, 100% { opacity: .25; transform: scale(.8); }
  40%           { opacity: 1;   transform: scale(1);   }
}

#answerFormatted { display: none; overflow-wrap: break-word; }

/* Markdown rendering — matches answer.html style */
#answerFormatted h3 {
  color: #0057a8; margin-top: 1.6em; margin-bottom: .4em;
  border-bottom: 1px solid #dde4ef; padding-bottom: 6px;
  font-size: 1.05rem;
}
#answerFormatted a { color: #0057a8; }
#answerFormatted ul { padding-left: 1.5em; }
#answerFormatted li { margin-bottom: .5em; font-size: .9rem; }
#answerFormatted strong { color: #111; }
#answerFormatted p { margin: .5em 0; font-size: .9rem; }
#answerFormatted hr {
  border: none; border-top: 1px solid #dde4ef; margin: 1em 0;
}

footer {
  margin-top: 24px; font-size: .78rem; color: #aaa; text-align: center;
}
footer a { color: #0057a8; text-decoration: none; }
#versionBadge {
  display: inline-block; margin-left: 8px;
  background: #e8f0fb; color: #0057a8;
  border-radius: 12px; padding: 1px 9px;
  font-size: .72rem; font-weight: 600;
  vertical-align: middle;
}

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 600px) {
  body { padding: 12px; overflow-x: hidden; }

  .card { padding: 24px 16px 20px; margin-top: 16px; }

  .input-row { flex-direction: column; }

  button#searchBtn { width: 100%; }

  .logo { flex-wrap: wrap; }
  .logo h1 { font-size: 1.05rem; }
}
