/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg:          oklch(14% 0.01 260);
  --surface:     oklch(19% 0.015 260);
  --surface-hi:  oklch(24% 0.018 260);
  --border:      oklch(32% 0.02 260 / 0.6);
  --text:        oklch(96% 0.005 260);
  --text-muted:  oklch(62% 0.015 260);
  --accent:      oklch(68% 0.18 260);
  --accent-soft: oklch(68% 0.18 260 / 0.15);
  --sonar-dot:   var(--accent);
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --gap:         16px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
  overflow: hidden;
}

/* ── Sonar canvas ───────────────────────────────────────────────────────── */
#sonar {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--sonar-dot); /* canvas reads this for dot color */
  pointer-events: none;
  z-index: 0;
}

/* ── App shell ──────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap);
}

.screen { width: 100%; display: flex; flex-direction: column; align-items: center; }
.hidden { display: none !important; }

/* ── Loading ────────────────────────────────────────────────────────────── */
.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* ── Profile card ───────────────────────────────────────────────────────── */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 2px 24px oklch(0% 0 0 / 0.4);
  animation: card-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@media (prefers-reduced-motion: reduce) { .profile-card { animation: none; } }
@keyframes card-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Avatar */
.avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}
.avatar,
.avatar-fallback {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid var(--border);
}
.avatar { object-fit: cover; display: block; }
.avatar-fallback {
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* Info */
.profile-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}
.profile-username {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}
.profile-id {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  margin-top: 2px;
}

/* ── Error ──────────────────────────────────────────────────────────────── */
.error-card {
  background: var(--surface);
  border: 1px solid oklch(55% 0.18 25 / 0.5);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  text-align: center;
}
.error-icon { font-size: 2rem; }
#error-msg  { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }
