:root {
  --bg-1: #0f0f14;
  --bg-2: #1b1b24;
  --card: #17171f;
  --text: #f2f2f5;
  --muted: #9a9aa8;
  --accent: #7c5cff;
  --accent-2: #ff5ca7;
  --border: #2a2a35;
  --danger: #ff5c5c;
  --success: #4ade80;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-2), var(--bg-1) 60%);
  min-height: 100vh;
}

/* ---------- Public page ---------- */

.page {
  display: flex;
  justify-content: center;
  padding: 48px 16px 80px;
}

.card {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.avatar-wrap { display: flex; justify-content: center; margin-bottom: 16px; }

.avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.name {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.verified-badge { flex-shrink: 0; }

.handle { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.bio {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 28px;
  white-space: pre-line;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.link-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: #1e1e29;
}

.link-icon { font-size: 18px; }

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

.footer { margin-top: 40px; }
.admin-link { color: var(--bg-2); text-decoration: none; font-size: 20px; }
.admin-link:hover { color: var(--muted); }

/* ---------- Admin ---------- */

.admin-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 80px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 { font-size: 20px; margin: 0; }

.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #6b4bef; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.panel h2 { margin-top: 0; font-size: 16px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }

.field input[type=text],
.field input[type=url],
.field input[type=password],
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field textarea { resize: vertical; min-height: 70px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 16px; height: 16px; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }

.link-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--bg-1);
}

.link-row.inactive { opacity: .5; }

.link-row .drag-icon { color: var(--icon, #ff5ca7); }
.link-row .order-btns { display: flex; flex-direction: column; gap: 2px; }
.link-row .order-btns button {
  background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; line-height: 1;
  padding: 2px 4px;
}
.link-row .order-btns button:hover { color: var(--text); }

.link-row .icon-emoji { font-size: 20px; width: 26px; text-align: center; }

.link-row .info { flex: 1; min-width: 0; }
.link-row .info .title { font-weight: 600; font-size: 14px; }
.link-row .info .url { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .clicks { font-size: 12px; color: var(--muted); white-space: nowrap; }

.link-row .actions { display: flex; gap: 6px; }

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 14px;
}
.alert-success { background: rgba(74, 222, 128, .12); color: var(--success); border: 1px solid rgba(74,222,128,.3); }
.alert-error { background: rgba(255, 92, 92, .12); color: var(--danger); border: 1px solid rgba(255,92,92,.3); }

.login-wrap {
  max-width: 360px;
  margin: 80px auto;
  padding: 0 16px;
}

.muted { color: var(--muted); font-size: 13px; }
