:root {
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --violet: #a855f7;
  --ink: #14161f;
  --ink-2: #3d4256;
  --muted: #6b7280;
  --line: #e6e8f0;
  --line-2: #eff1f7;
  --bg: #f7f8fc;
  --card: #ffffff;
  --ok: #059669;
  --danger: #dc2626;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 10px 30px -12px rgba(24, 30, 60, .18);
  --shadow-lg: 0 24px 60px -20px rgba(24, 30, 60, .28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 18px; color: var(--ink); letter-spacing: -.3px; }
.brand:hover { text-decoration: none; }
.brand span span { color: var(--indigo); }
.brand-mark { display: flex; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--ink-2); font-size: 14.5px; font-weight: 550; padding: 7px 12px;
  border-radius: 9px;
}
.nav a:hover { background: var(--line-2); text-decoration: none; color: var(--ink); }
.nav a.active { background: #eef0fe; color: var(--indigo-dark); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; transition: transform .06s ease, background .15s ease, box-shadow .15s ease, border-color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--indigo), #7c3aed); color: #fff; box-shadow: 0 6px 18px -8px rgba(79, 70, 229, .8); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: #cfd4e4; color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--line-2); }
.btn-danger { background: #fff; border-color: #f5c9c9; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 6px 11px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  margin: 26px 0 22px; padding: 40px 32px 34px;
  border-radius: 24px;
  background:
    radial-gradient(900px 380px at 12% -10%, #e9e7ff 0%, transparent 60%),
    radial-gradient(700px 340px at 92% 4%, #f3e8ff 0%, transparent 62%),
    linear-gradient(180deg, #ffffff, #fbfbff);
  border: 1px solid #e9eaf6;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.7px; margin: 0 0 8px; }
.hero h1 .grad { background: linear-gradient(100deg, var(--indigo), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { margin: 0 0 22px; color: var(--ink-2); font-size: 16px; max-width: 620px; }

.searchbar { display: flex; gap: 10px; background: #fff; padding: 8px; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.searchbar .field { flex: 1 1 auto; display: flex; align-items: center; gap: 9px; padding: 0 8px; min-width: 0; }
.searchbar input { border: 0; outline: 0; font: inherit; font-size: 15.5px; width: 100%; background: transparent; color: var(--ink); padding: 10px 0; }
.searchbar select {
  font: inherit; font-size: 14px; color: var(--ink-2); background: #f7f8fc;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; cursor: pointer; max-width: 200px;
}
.searchbar .divider { width: 1px; background: var(--line); margin: 6px 2px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; cursor: pointer; user-select: none; transition: all .14s;
}
.chip:hover { border-color: #ccd1e4; }
.chip.on { background: #eef0fe; border-color: #c7cbfa; color: var(--indigo-dark); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- results header ---------- */
.results-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 8px 0 14px; }
.results-head h2 { font-size: 17px; margin: 0; letter-spacing: -.2px; }
.results-head .count { color: var(--muted); font-size: 14px; }
.results-head .spacer { flex: 1; }
.sort-select { font: inherit; font-size: 13.5px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; }

/* ---------- cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; padding-bottom: 40px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #dcdfee; }
.card-head { display: flex; gap: 12px; align-items: flex-start; }
.avatar {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  overflow: hidden; letter-spacing: -.5px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 76px; height: 76px; border-radius: 22px; font-size: 30px; }
.who { min-width: 0; flex: 1; }
.who .name { font-weight: 700; font-size: 16px; letter-spacing: -.2px; display: block; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .handle { color: var(--muted); font-size: 13px; }
.place { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); background: #f4f5fb; border-radius: 999px; padding: 3px 9px; margin-top: 4px; }

.card .bio { font-size: 14px; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.links { display: flex; flex-direction: column; gap: 7px; }
.linkrow {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px;
  background: #fafbfe; border: 1px solid var(--line-2); border-radius: 10px;
  font-size: 13px;
}
.linkrow .pf { flex: 0 0 auto; width: 20px; text-align: center; font-size: 13px; line-height: 1.5; }
.linkrow .body { min-width: 0; flex: 1; }
.linkrow .desc { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.linkrow .desc mark { background: #fff2b8; color: inherit; padding: 0 1px; border-radius: 3px; }
.linkrow a.go { color: var(--muted); flex: 0 0 auto; }
.linkrow a.go:hover { color: var(--indigo); }

.card-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; }
.pill { font-size: 12px; color: var(--muted); background: #f6f7fb; border-radius: 8px; padding: 3px 8px; }
.fav-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer;
  transition: all .14s;
}
.fav-btn:hover { border-color: #ffc9d4; color: #e11d48; }
.fav-btn.on { background: #fff1f4; border-color: #ffd0da; color: #e11d48; }
.fav-btn .heart { font-size: 13px; line-height: 1; }

/* ---------- profile page ---------- */
.profile-wrap { padding: 26px 0 50px; }
.backlink { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.profile-hero { padding: 26px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.profile-hero .who .name { font-size: 24px; }
.profile-hero .bio { font-size: 15px; color: var(--ink-2); margin: 10px 0 0; white-space: pre-wrap; }
.profile-hero .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 26px 0 10px; }
.linklist { display: flex; flex-direction: column; gap: 10px; }
.linkcard {
  display: flex; gap: 14px; padding: 16px; align-items: flex-start;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.linkcard:hover { border-color: #d6daf0; box-shadow: var(--shadow); }
.pf-badge {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-size: 18px; background: #f4f5fb; border: 1px solid var(--line-2);
}
.linkcard .lc-body { min-width: 0; flex: 1; }
.linkcard .lc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.linkcard .lc-platform { font-weight: 700; font-size: 14.5px; }
.linkcard .lc-handle { color: var(--muted); font-size: 13px; }
.linkcard .lc-desc { color: var(--ink-2); font-size: 14px; margin-top: 4px; white-space: pre-wrap; }

/* ---------- forms ---------- */
.form-card { max-width: 460px; margin: 40px auto; padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.form-card.wide { max-width: 760px; }
.form-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.4px; }
.form-card .lede { color: var(--muted); font-size: 14.5px; margin: 0 0 22px; }
.field-row { margin-bottom: 15px; }
.field-row label { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.input, .textarea, select.input {
  width: 100%; font: inherit; font-size: 14.5px; color: var(--ink);
  background: #fff; border: 1px solid #dfe3ef; border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: #b9befa; box-shadow: 0 0 0 3px rgba(99, 102, 241, .14); }
.textarea { resize: vertical; min-height: 84px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.hint.err { color: var(--danger); }
.hint.ok { color: var(--ok); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-foot { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.form-alt { font-size: 14px; color: var(--muted); text-align: center; }

/* socials editor */
.soc-editor { display: flex; flex-direction: column; gap: 12px; }
.soc-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfcff; }
.soc-item .si-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.soc-item .si-head select { max-width: 190px; }
.soc-item .si-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.soc-item .si-grid .full { grid-column: 1 / -1; }
.char-count { font-size: 12px; color: var(--muted); float: right; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: #fff; border: 1px dashed #dfe3ef; border-radius: 18px; margin-bottom: 40px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0 0 16px; font-size: 14.5px; }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); font-size: 14px; }
.spinner { width: 22px; height: 22px; border: 2.5px solid #e3e6f4; border-top-color: var(--indigo); border-radius: 50%; animation: spin .7s linear infinite; margin-bottom: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.footer { margin-top: auto; border-top: 1px solid var(--line); background: #fff; }
.footer-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; flex-wrap: wrap; }
.footer p { margin: 0; font-size: 13px; color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 18px);
  background: #111827; color: #fff; font-size: 14px; padding: 11px 18px; border-radius: 11px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; max-width: 90vw;
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #991b1b; }

.badge-soon { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--indigo-dark); background: #eef0fe; border-radius: 6px; padding: 2px 6px; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .hero { padding: 28px 20px 24px; margin-top: 16px; }
  .hero h1 { font-size: 27px; }
  .searchbar { flex-wrap: wrap; }
  .searchbar .field { flex: 1 1 100%; }
  .searchbar .divider { display: none; }
  .searchbar select { max-width: none; flex: 1 1 45%; }
  .searchbar .btn { flex: 1 1 100%; }
  .grid { grid-template-columns: 1fr; }
  .two-col, .soc-item .si-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .profile-hero { padding: 20px; }
  .profile-hero .actions { margin-left: 0; width: 100%; }
  .form-card { margin: 20px auto; padding: 22px; }
  .footer-in { justify-content: center; text-align: center; }
}
