*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --border:   #21262d;
  --border2:  #30363d;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --dim:      #484f58;
  --accent:   #4ade80;
  --accent-bg:#0d2a1a;
  --blue:     #818cf8;
  --search-bg:#0d1117;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding: 1.4rem 1.5rem 0;
  max-width: 760px;
  margin: 0 auto;
}

.logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -.01em;
}
.logo:hover { text-decoration: underline; }

.logo-sub {
  font-size: .8rem;
  color: var(--dim);
  font-weight: 400;
}

/* ── Search ───────────────────────────────────────────────────────────── */
#page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

#search-wrap {
  margin: 2rem 0 1.6rem;
}

#search-box {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1.5px solid var(--border2);
  border-radius: 10px;
  padding: .6rem .85rem;
  transition: border-color .15s;
}

#search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(129,140,248,.12);
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .95rem;
  caret-color: var(--blue);
}

#search-input::placeholder { color: var(--dim); }

#search-clear {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  font-size: .8rem;
  padding: 0 .1rem;
  display: none;
  line-height: 1;
}
#search-clear:hover { color: var(--muted); }
#search-clear.visible { display: block; }

#search-meta {
  font-size: .78rem;
  color: var(--dim);
  margin-top: .5rem;
  min-height: 1.2em;
}

/* ── Result cards ────────────────────────────────────────────────────── */
.result-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.result-card:first-child { border-top: 1px solid var(--border); }

.result-body { flex: 1; min-width: 0; }

.result-name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-name mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

.result-desc {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.result-desc mark {
  background: none;
  color: #93c5fd;
  font-weight: 500;
}

.result-meta {
  font-size: .72rem;
  color: var(--dim);
  margin-top: .35rem;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex-shrink: 0;
}

.btn-qr {
  background: var(--accent-bg);
  border: 1px solid #238636;
  border-radius: 7px;
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  padding: .6rem .75rem;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 62px;
  transition: background .15s, border-color .15s;
}

.btn-qr:hover { background: #143d22; border-color: #2ea043; }

.btn-qr svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Empty state ─────────────────────────────────────────────────────── */
#empty-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.empty-sub { font-size: .85rem; color: var(--dim); }

/* ── QR modal ─────────────────────────────────────────────────────────── */
#qr-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
#qr-overlay.open { display: flex; }

#qr-modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 1.5rem 1.6rem;
  width: 90%;
  max-width: 320px;
  text-align: center;
}

.qr-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  text-align: left;
  margin-bottom: 1rem;
}

.qr-modal-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .15rem;
}

.qr-modal-desc {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qr-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
  padding: .1rem;
}
.qr-close:hover { color: var(--text); }

.qr-hint {
  font-size: .72rem;
  color: var(--dim);
  margin-bottom: .9rem;
}

#qr-img-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

#qr-img-wrap img {
  border-radius: 8px;
  max-width: 200px;
}

#qr-desktop-btn {
  width: 100%;
  background: var(--accent-bg);
  border: 1px solid #238636;
  border-radius: 7px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 600;
  padding: .5rem .8rem;
  cursor: pointer;
  transition: background .15s;
}
#qr-desktop-btn:hover { background: #143d22; }

/* ── Skeleton loader ──────────────────────────────────────────────────── */
.skeleton {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.skeleton:first-child { border-top: 1px solid var(--border); }

.skel-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--border2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.no-results {
  padding: 2.5rem 0;
  text-align: center;
  color: var(--dim);
  font-size: .9rem;
}

/* ── Reporter button + directory sub-header (Phase 1 step 6) ── */
.directory-sub-help {
  width: 100%;
  font-size: .78rem;
  color: #8b949e;
  margin-top: .6rem;
  line-height: 1.5;
}
.directory-sub-help strong {
  color: #c9d1d9;
  font-weight: 600;
}
.btn-report {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: rgba(129,140,248,.12);
  border: 1px solid rgba(129,140,248,.32);
  color: #818cf8;
  border-radius: 6px;
  padding: .45rem .85rem;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn-report:hover {
  background: rgba(129,140,248,.22);
  border-color: rgba(129,140,248,.5);
  transform: translateY(-1px);
}
