*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #F7F9FA;
  --surface: #FFFFFF;
  --surface2: #F1F3F5;
  --surface-alt: #F1F3F5;
  --border: #EAEAEA;
  --primary: #229ED9;
  --primary-hover: #1D8EC5;
  --primary-highlight: #E8F5FD;
  --text: #1D1F21;
  --text-s: #858A90;
  --text-m: #9BA1A8;
  --error: #EF4444;
  --success: #31C46C;
  --warning-bg: #FFF8E1;
  --warning-border: #FFE082;
  --warning-text: #7B6B2E;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(0,0,0,.06);
  --max-w: 560px;
  --transition: background .2s, color .2s, border-color .2s;
}
[data-theme="dark"] {
  --bg: #000000;
  --surface: #161618;
  --surface2: #1C1C1E;
  --surface-alt: #1C1C1E;
  --border: #2C2C2E;
  --primary: #229ED9;
  --primary-hover: #1D8EC5;
  --primary-highlight: #0D2B3E;
  --text: #ECECEC;
  --text-s: #8E8E93;
  --text-m: #6C6C72;
  --error: #EF4444;
  --success: #31C46C;
  --warning-bg: #1F1A07;
  --warning-border: #4A3C00;
  --warning-text: #C9A84C;
  --shadow: 0 1px 6px rgba(0,0,0,.4);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Shared layout ─────────────────────────────────────────── */
.page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.topbar {
  position: absolute;
  top: 12px;
  right: 16px !important;
  left: auto !important;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
}
.topbar-home {
  position: absolute;
  top: 12px;
  left: 16px !important;
  right: auto !important;
  z-index: 100;
}
.topbar-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-s);
  cursor: pointer;
  transition: background .15s, color .15s;
  padding: 0;
}
.topbar-home-btn:hover { background: var(--surface2, var(--surface-alt)); color: var(--primary); }
.topbar-logo {
  font-weight: 700;
  font-size: 15px;
  color: var(--primary);
  cursor: pointer;
}
.topbar-logo:hover { text-decoration: none; }
.content { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: var(--max-w);
  overflow: hidden;
}
.card-body { padding: 24px; }

/* ── Profile header ────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(34,158,217,.08);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar svg { color: var(--primary); }
.profile-name {
  font-weight: 600;
  font-size: 17px;
  word-break: break-word;
}
.profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 2px;
}

/* ── Section cards ─────────────────────────────────────────── */
.section { margin-bottom: 16px; }
.section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-s);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 10px;
}
.section-content {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 14px 16px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.info-label { color: var(--text-s); font-size: 13px; }
.info-value { font-weight: 500; font-size: 14px; }

.contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.contact-label { color: var(--text-s); font-size: 13px; min-width: 70px; }
.contact-value { font-size: 14px; color: var(--primary); font-weight: 500; }
.contact-value:hover { text-decoration: underline; }

.bio-text { color: var(--text-s); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

/* ── Copy link button ──────────────────────────────────────── */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  color: var(--text-s);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.copy-btn:hover { background: var(--border); color: var(--text); }
.copy-btn.copied { color: var(--success); border-color: var(--success); }
.copy-btn svg { flex-shrink: 0; }

/* ── Safety note ───────────────────────────────────────────── */
.safety-note {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--warning-text);
  line-height: 1.6;
}

/* ── States ────────────────────────────────────────────────── */
.state-center {
  text-align: center;
  padding: 48px 24px;
}
.state-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  color: var(--text-m);
}
.state-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.state-desc { font-size: 14px; color: var(--text-s); max-width: 320px; margin: 0 auto 20px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  background: var(--surface);
  color: var(--text-s);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-outline:hover { background: var(--bg); }

/* ── Landing ───────────────────────────────────────────────── */
.landing-hero { text-align: center; padding: 32px 24px; }
.landing-logo-above {
  text-align: center;
  margin-bottom: 4px;
}
.landing-logo-above img {
  width: 260px;
  height: 260px;
  object-fit: contain;
}
.landing-sitename { font-size: 22px; font-weight: 700; margin: 6px 0 0; color: var(--text); }
.landing-tagline  { font-size: 14px; color: var(--text-s); margin: 4px 0 0; }
.landing-title { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.landing-desc { font-size: 15px; color: var(--text-s); max-width: 420px; margin: 0 auto 28px; line-height: 1.6; }
.landing-badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-s);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.badge:hover { background: var(--border); color: var(--text); text-decoration: none; }
.badge svg { flex-shrink: 0; color: var(--primary); }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ────────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 20px 16px;
  padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
  padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom, 0px)));
  font-size: 12px;
  color: var(--text-m);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin-bottom: 10px;
}
.footer-links a {
  color: var(--text-s);
  font-size: 12px;
  text-decoration: none;
}
.footer-links a:hover { color: var(--primary); text-decoration: none; }
.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 4px;
  margin-bottom: 10px;
}
.footer-social a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--text-s);
  font-size: 12px;
  text-decoration: none;
  transition: background .12s, color .12s;
}
.footer-social a:hover { background: var(--surface-alt); color: var(--primary); }

/* ── Theme toggle ──────────────────────────────────────────── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-s);
  transition: background .15s, color .15s, border-color .15s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: var(--border); color: var(--text); }
.theme-toggle svg { pointer-events: none; }

/* ── Language switcher ─────────────────────────────────────── */
.lang-switcher {
  position: relative;
  flex-shrink: 0;
}
.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text-s);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: .03em;
  transition: background .15s, color .15s, border-color .15s;
}
.lang-btn:hover { background: var(--border); color: var(--text); }
.lang-btn svg { pointer-events: none; }
.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 148px;
  z-index: 999;
  padding: 6px;
  overflow: hidden;
}
.lang-dropdown.open { display: block; }
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-s);
  transition: background .12s;
  white-space: nowrap;
}
.lang-option:hover { background: var(--surface-alt); color: var(--text); }
.lang-option.active { color: var(--primary); font-weight: 600; }
.lang-option .lang-code { font-size: 11px; font-weight: 700; color: var(--text-m); min-width: 22px; }

/* smooth theme transitions */
body, .card, .topbar, .section-content, .badge, .copy-btn, .safety-note, .btn-outline {
  transition: var(--transition);
}
