/* Omar-Thing User Finder — dark-first indigo UI with a violet accent.
   Layout: sticky header, centered lookup card, single rich profile result. */

:root {
  color-scheme: dark;
  --bg: #0b0b12;
  --bg-soft: #12121c;
  --surface: #16161f;
  --surface-2: #1d1d2a;
  --border: #272733;
  --fg: #ecebf3;
  --muted: #9a98ad;
  --faint: #6c6a7e;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --accent-ink: #0b0b12;
  --good: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --live: #f43f5e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  --radius: 18px;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5fb; --bg-soft: #efedf7; --surface: #ffffff; --surface-2: #f3f1fb;
  --border: #e4e1f0; --fg: #1a1826; --muted: #5e5b70; --faint: #908da3;
  --accent: #7c3aed; --accent-strong: #6d28d9; --accent-ink: #ffffff;
  --good: #059669; --warn: #b45309; --danger: #e11d48; --live: #e11d48;
  --shadow: 0 18px 50px rgba(76, 51, 140, 0.14);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f5fb; --bg-soft: #efedf7; --surface: #ffffff; --surface-2: #f3f1fb;
    --border: #e4e1f0; --fg: #1a1826; --muted: #5e5b70; --faint: #908da3;
    --accent: #7c3aed; --accent-strong: #6d28d9; --accent-ink: #ffffff;
    --good: #059669; --warn: #b45309; --danger: #e11d48; --live: #e11d48;
    --shadow: 0 18px 50px rgba(76, 51, 140, 0.14);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 620px at 82% -12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--bg);
  color: var(--fg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { max-width: 720px; margin: 0 auto; padding: 13px 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.brand .paw { font-size: 18px; }
.brand .name { font-family: var(--font-display); letter-spacing: -0.01em; }
.header-spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--fg);
  cursor: pointer; font-size: 16px; transition: border-color .15s, transform .1s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.95); }

/* ---------- layout ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 20px; padding-block: 40px 24px; }

.hero { text-align: center; margin-bottom: 26px; }
.logo-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 6vw, 40px); letter-spacing: -0.02em; line-height: 1.08;
  margin: 0 0 10px; text-wrap: balance;
}
.grad {
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #f0abfc));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin: 0 auto; max-width: 46ch; }

/* ---------- lookup card ---------- */
.search-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
}
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 0 14px;
}
.search-input:focus-within { border-color: var(--accent); }
.search-input svg { color: var(--faint); flex: none; }
.search-input input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--fg);
  font: inherit; font-size: 16px; padding: 14px 0; outline: none;
}
.btn {
  border: 0; cursor: pointer; font: inherit; font-weight: 600;
  border-radius: 12px; padding: 0 22px; background: var(--accent); color: var(--accent-ink);
  transition: filter .15s, transform .1s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--surface); color: var(--fg); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.block { display: block; width: 100%; text-align: center; padding: 13px; text-decoration: none; }

.hints { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.hints .label { color: var(--faint); font-size: 13px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: all .14s;
}
.chip:hover { border-color: var(--accent); color: var(--fg); }

/* ---------- result states ---------- */
.result { margin-top: 22px; }
.state { text-align: center; padding: 48px 20px; color: var(--muted); }
.state .big { font-size: 40px; margin-bottom: 10px; }
.state.error { color: var(--danger); }
.state b { color: var(--fg); font-weight: 600; }
.spin {
  width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 14px;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: rot .8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- profile ---------- */
.profile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.p-head { display: flex; gap: 16px; align-items: center; }
.p-avatar {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none;
  border: 2px solid var(--border); background: var(--surface-2);
}
.p-id { min-width: 0; }
.p-name {
  font-family: var(--font-display); font-size: 23px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 6px; letter-spacing: -0.01em;
}
.p-name .v-check { color: var(--accent); flex: none; }
.p-handle { color: var(--muted); margin-top: 1px; }
.p-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 500;
  border: 1px solid var(--border); color: var(--muted); background: var(--bg-soft);
}
.badge.v { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.badge.live { color: #fff; background: var(--live); border-color: var(--live); }

.p-about { margin: 16px 0 0; line-height: 1.5; white-space: pre-wrap; }
.p-biolink { display: inline-block; margin-top: 10px; color: var(--accent); word-break: break-all; font-size: 14px; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.pill {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.pill-k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.pill-v { font-weight: 600; margin-left: auto; }
.pill-v .code { color: var(--faint); font-weight: 500; }
.pill-v .unknown { color: var(--faint); font-weight: 500; }

.sec-label {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
  margin: 24px 0 10px; font-weight: 600;
}

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.stat { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 14px 8px; text-align: center; }
.stat .n { font-family: var(--font-display); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 11px; margin-top: 3px; letter-spacing: .02em; }

.details { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.d-row {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; font-size: 14px;
}
.d-k { color: var(--muted); flex: none; min-width: 118px; }
.d-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.copy-btn {
  margin-left: auto; flex: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--fg); }

.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions .btn { flex: 1; }

.foot { text-align: center; color: var(--faint); font-size: 13px; padding: 12px 20px 36px; display: grid; gap: 6px; }
.dbline { font-variant-numeric: tabular-nums; opacity: .9; }
.feedback { display: none; }

/* ---------- connections ---------- */
.conn-tabs { display: flex; gap: 8px; }
.conn-tab {
  flex: 1; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 11px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: all .14s;
}
.conn-tab:hover { border-color: var(--accent); color: var(--fg); }
.conn-tab.active { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--fg); }
.pill-n {
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.conn-tab.active .pill-n { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

.conn-list { margin-top: 12px; display: grid; gap: 6px; max-height: 420px; overflow-y: auto; }
.edge {
  display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft);
  transition: border-color .14s;
}
.edge:hover { border-color: var(--accent); }
.edge-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-2); }
.edge-id { min-width: 0; display: flex; flex-direction: column; }
.edge-nick { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edge-handle { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edge-region { margin-left: auto; flex: none; color: var(--faint); font-size: 12px; }
.conn-empty { color: var(--muted); text-align: center; padding: 22px; }

.conn-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.conn-foot .conn-more { flex: none; }
.conn-saved { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 560px) {
  .search-row { flex-wrap: wrap; }
  .btn.search-go { flex: 1; padding: 14px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .p-avatar { width: 68px; height: 68px; }
  .p-name { font-size: 20px; }
  .actions { flex-direction: column; }
  .d-k { min-width: 96px; }
}

.api-link {
  font-size: 13px; font-weight: 600; text-decoration: none; color: var(--muted);
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
}
.api-link:hover { color: var(--accent); border-color: var(--accent); }
