:root {
  --bg: #0b1220;
  --bg-soft: #101a2e;
  --card: #131f36;
  --card-edge: #1e2d4d;
  --text: #e7edf7;
  --muted: #8fa3bf;
  --accent: #fbbf24;
  --accent-strong: #f59e0b;
  --accent-ink: #2a1d02;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(251, 191, 36, 0.07), transparent),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  max-width: 720px;
  margin: 0 auto;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 30px; height: 30px; }
.brand strong { font-size: 18px; letter-spacing: 0.2px; }
.brand .tagline { display: block; font-size: 12px; color: var(--muted); margin-top: -2px; }

.controls { display: flex; gap: 8px; }

select {
  appearance: none;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  padding: 8px 30px 8px 10px;
  font: inherit;
  font-size: 14px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238fa3bf'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

main { max-width: 720px; margin: 0 auto; padding: 4px 16px 48px; }

.hero { text-align: left; }
.hero h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.25; }
.hero p { margin: 0 0 14px; color: var(--muted); }
.hero .badge-c {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: var(--accent);
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.07);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 14px;
}

/* Search */
.search-wrap { position: relative; }
#q {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--card-edge);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 40px 14px 14px;
  font: inherit;
  font-size: 17px;
}
.btn-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(143, 163, 191, 0.15);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.result-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Editor */
.editor-card .field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--card-edge);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
.field textarea { resize: vertical; min-height: 110px; }

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: 0 0 10px;
}

.editor-actions { display: flex; gap: 10px; }
.btn-primary {
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  padding: 11px 18px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost {
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 11px 16px;
  font: inherit;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* Results */
.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-item {
  border: 1px solid var(--card-edge);
  border-left: 3px solid rgba(143, 163, 191, 0.35);
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 12px 14px;
}
.note-item.hit-title { border-left-color: var(--accent); }
.note-title { font-weight: 600; overflow-wrap: anywhere; }
.note-snippet {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.note-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.note-tags { color: var(--accent); font-size: 12.5px; }
.note-when { color: var(--muted); font-size: 12px; }
.note-actions { margin-left: auto; display: flex; gap: 6px; }
.mini-btn {
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.mini-btn:hover { color: var(--text); border-color: var(--muted); }
.mini-btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.empty { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

footer {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 0 16px 40px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
footer code { color: var(--accent); font-size: 12px; }
