:root {
  --bg: #0f1420;
  --panel: #171d2b;
  --panel-2: #1e2637;
  --text: #e7ecf3;
  --muted: #8b97ab;
  --accent: #4f8cff;
  --green: #2ecc71;
  --blue: #3aa0ff;
  --amber: #f5a623;
  --border: #263143;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2334 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 64px 20px 96px;
}

/* --- Hero --- */
.hero { text-align: center; margin-bottom: 28px; }
.hero h1 { font-size: 2.2rem; margin: 0 0 8px; letter-spacing: -0.02em; }
.subtitle { color: var(--muted); margin: 0 auto; max-width: 560px; }

/* --- Search bar --- */
.search-bar {
  display: flex;
  gap: 10px;
  margin: 24px 0 8px;
}
.search-bar input {
  flex: 1;
  padding: 14px 16px;
  font-size: 1rem;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}
.search-bar button {
  padding: 0 22px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: filter 0.15s ease;
}
.search-bar button:hover { filter: brightness(1.08); }
.search-bar button:disabled { opacity: 0.5; cursor: not-allowed; }

.status-line {
  min-height: 1.2em;
  margin: 6px 2px 20px;
  color: var(--muted);
  font-size: 0.9rem;
}
.status-line.error { color: var(--amber); }

/* --- Results --- */
.results { display: flex; flex-direction: column; gap: 14px; }

.result-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.result-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.result-score {
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--green);
  white-space: nowrap;
}
.result-path {
  color: var(--muted);
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 2px 0 10px;
}
.result-snippet { margin: 0; color: #cdd6e4; }
.result-snippet mark {
  background: rgba(245, 166, 35, 0.28);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}
.result-tags { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.72rem;
  color: #c7b3ff;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
}

.empty { color: var(--muted); text-align: center; padding: 28px; }

/* --- Connection badge --- */
.badge {
  position: fixed;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  user-select: none;
  z-index: 10;
}
.badge__dot { font-size: 0.7rem; line-height: 1; }

.badge--connecting { color: var(--muted); }
.badge--connecting .badge__dot { color: var(--muted); animation: pulse 1s infinite; }

.badge--local { color: var(--green); border-color: rgba(46, 204, 113, 0.4); }
.badge--local .badge__dot { color: var(--green); }

.badge--static { color: var(--blue); border-color: rgba(58, 160, 255, 0.4); }
.badge--static .badge__dot { color: var(--blue); }

.badge--offline { color: var(--amber); border-color: rgba(245, 166, 35, 0.4); }
.badge--offline .badge__dot { color: var(--amber); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (max-width: 560px) {
  .container { padding-top: 72px; }
  .search-bar { flex-direction: column; }
  .badge { top: 10px; right: 10px; }
}
