  :root {
    --bg: #1a1b26;
    --panel: #1e2030;
    --input: #24283b;
    --border: #414868;
    --text: #c0caf5;
    --muted: #565f89;
    --accent: #7aa2f7;
    --green: #9ece6a;
    --orange: #ff9e64;
    --red: #f7768e;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; padding: 40px 20px; line-height: 1.6;
  }
  .wrap { max-width: 900px; margin: 0 auto; }

  h1 { font-size: 2.1rem; margin: 0 0 0.3rem; font-weight: 700; }
  h1 .accent { color: var(--accent); }
  .tagline { color: var(--muted); margin-bottom: 2rem; font-size: 1rem; }

  .controls {
    display: flex; gap: 0.5rem; margin-bottom: 1rem;
    flex-wrap: wrap; align-items: center;
  }
  .lang-pills { display: flex; gap: 0.3rem; flex-wrap: wrap; }
  .pill {
    padding: 0.35rem 0.8rem; background: var(--input); border: 1px solid var(--border);
    border-radius: 999px; color: var(--muted); font-size: 0.8rem;
    cursor: pointer; user-select: none; transition: all 0.15s;
  }
  .pill:hover { border-color: var(--accent); color: var(--text); }
  .pill.active { border-color: var(--accent); background: rgba(122,162,247,0.15); color: var(--accent); font-weight: 600; }

  .mode-toggle {
    display: flex; margin-left: auto; background: var(--input);
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  }
  .mode-toggle button {
    padding: 0.4rem 0.9rem; background: transparent; border: none;
    color: var(--muted); font-size: 0.8rem; cursor: pointer;
  }
  .mode-toggle button.active { background: var(--accent); color: var(--bg); font-weight: 600; }

  .prompt-row { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; }
  .prompt-input {
    flex: 1; padding: 0.85rem 1.1rem; background: var(--input);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--text); font-size: 1rem; outline: none; font-family: inherit;
  }
  .prompt-input:focus { border-color: var(--accent); }
  .send-btn {
    padding: 0 1.6rem; background: var(--accent); color: var(--bg);
    border: none; border-radius: 10px; font-weight: 600; cursor: pointer;
    font-size: 0.95rem;
  }
  .send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

  .suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 2rem; }
  .suggestion {
    padding: 0.4rem 0.8rem; background: transparent; border: 1px solid var(--border);
    border-radius: 6px; color: var(--muted); font-size: 0.8rem;
    cursor: pointer; transition: all 0.15s;
  }
  .suggestion:hover { border-color: var(--accent); color: var(--text); }

  .results { display: flex; flex-direction: column; gap: 1rem; }

  .result-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 10px; padding: 1rem 1.2rem;
  }

  .answer-card { border-left: 3px solid var(--accent); }
  .answer-meta {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.6rem; color: var(--muted); font-size: 0.78rem;
  }
  .answer-body { white-space: pre-wrap; }
  .answer-body p { margin: 0.3rem 0; }
  .answer-body pre {
    background: #0d1117; border: 1px solid var(--border);
    padding: 0.7rem 0.9rem; border-radius: 6px; overflow-x: auto;
    font-size: 0.82rem; line-height: 1.5; margin: 0.5rem 0;
  }
  .answer-body code {
    font-family: 'SF Mono', 'Fira Code', monospace;
  }
  .answer-body :not(pre) > code {
    background: rgba(122,162,247,0.12); padding: 0.1rem 0.35rem;
    border-radius: 4px; font-size: 0.88em;
  }

  .sources {
    margin-top: 0.8rem; padding-top: 0.6rem; border-top: 1px solid var(--border);
    font-size: 0.78rem; color: var(--muted);
  }
  .sources a { color: var(--accent); text-decoration: none; margin-right: 0.6rem; }
  .sources a:hover { text-decoration: underline; }

  .hit-meta {
    display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem;
    font-size: 0.78rem;
  }
  .hit-lang {
    padding: 0.15rem 0.5rem; border-radius: 999px;
    background: rgba(158,206,106,0.12); color: var(--green);
    border: 1px solid rgba(158,206,106,0.3); font-size: 0.72rem;
  }
  .hit-dist {
    color: var(--muted); font-family: 'SF Mono', monospace; font-size: 0.72rem;
  }
  .hit-rank { margin-left: auto; }
  .hit-title a { color: var(--text); font-weight: 600; text-decoration: none; }
  .hit-title a:hover { color: var(--accent); }
  .hit-text {
    color: var(--muted); font-size: 0.82rem; line-height: 1.55;
    max-height: 140px; overflow: hidden; position: relative;
  }
  .hit-text::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px;
    background: linear-gradient(transparent, var(--panel));
  }
  .hit-snippet {
    background: transparent; border: none; padding: 0;
    margin: 0.4rem 0 0; white-space: pre-wrap;
  }

  .stats {
    display: flex; gap: 1.5rem; justify-content: center; align-items: center;
    padding: 0.7rem 0; border-top: 1px solid var(--border); margin-top: 2rem;
    font-size: 0.78rem; color: var(--muted);
  }
  .result-stats { border: none; }
  .stat-value { color: var(--text); font-weight: 600; }
  .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 0.3rem; }
  .dot.up { background: var(--green); }
  .dot.down { background: var(--red); }

  .loading { color: var(--muted); font-style: italic; }
  .err {
    padding: 0.8rem 1rem; background: rgba(247,118,142,0.1);
    border: 1px solid var(--red); border-radius: 8px; color: var(--red);
    font-size: 0.9rem;
  }
