:root {
  --white:    #ffffff;
  --bg:       #f7f6f3;
  --bg2:      #eeece7;
  --ink:      #0f0e0d;
  --ink2:     #3a3835;
  --ink3:     #7d7a75;
  --ink4:     #b5b2ac;
  --rule:     rgba(0,0,0,0.08);
  --rule2:    rgba(0,0,0,0.05);
  --blue:     #2563eb;
  --blue-lt:  #eff6ff;
  --blue-md:  #dbeafe;
  --green:    #059669;
  --green-lt: #ecfdf5;
  --red:      #dc2626;
  --red-lt:   #fef2f2;
  --amber:    #d97706;
  --amber-lt: #fffbeb;
  --purple:   #8b5cf6;
  --purple-lt:#f5f3ff;
  --radius:   14px;
  --radsm:    9px;
  --radxs:    6px;
  --sha:      0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --sha2:     0 2px 8px rgba(0,0,0,0.06), 0 12px 40px rgba(0,0,0,0.08);
}

.dark-mode {
  --white:    #1a1a1a;
  --bg:       #121212;
  --bg2:      #1e1e1e;
  --ink:      #ffffff;
  --ink2:     #e0e0e0;
  --ink3:     #a0a0a0;
  --ink4:     #666666;
  --rule:     rgba(255,255,255,0.1);
  --rule2:    rgba(255,255,255,0.05);
  --purple:   #a78bfa;
  --purple-lt:#2e2e3a;
  --blue-lt:  #1e3a5f;
  --green-lt: #1a4731;
  --amber-lt: #422b1a;
  --red-lt:   #4a1e1e;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink2);
  font-family: 'Outfit', sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink4); border-radius: 99px; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  pointer-events: none; z-index: 0; opacity: 0.5;
}

#curtain {
  position: fixed; inset: 0; z-index: 8888;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 20, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#curtain.ci {
  opacity: 1;
  pointer-events: all;
}
#curtain::after {
  content: '';
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3.5px solid rgba(255,255,255,0.15);
  border-top-color: #1d4ed8;
  border-right-color: #facc15;
  animation: spinLoad 0.7s linear infinite;
}
@keyframes spinLoad {
  to { transform: rotate(360deg); }
}

#overlay {
  position: fixed; inset: 0;
  background: rgba(15,14,13,0.45);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
#overlay.show {
  opacity: 1;
  visibility: visible;
}

#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 280px;
  background: var(--white);
  border-left: 1px solid var(--rule);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
#sidebar.open {
  transform: translateX(0);
}

.sb-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sb-brand {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.sb-close {
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radxs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
  font-size: 18px;
  transition: all 0.2s ease;
}
.sb-close:hover {
  background: var(--bg2);
  color: var(--ink);
}
.sb-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}
.sb-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 10px;
  display: block;
}
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 28px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radsm);
  border: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--ink2);
  transition: all 0.2s ease;
}
.sb-link:hover {
  border-color: var(--ink4);
  color: var(--ink);
  background: var(--bg);
}
.sb-link .material-icons {
  font-size: 17px;
  color: var(--ink3);
}

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247,246,243,0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--rule);
}
.dark-mode header {
  background: rgba(26,26,26,0.92);
}
.hdr {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hdr-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hdr-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink4);
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}
.hdr-back:hover {
  color: var(--ink);
}
.hdr-back .material-icons {
  font-size: 15px;
}
.hdr-sep {
  width: 1px;
  height: 18px;
  background: var(--rule);
}
.hdr-title {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  letter-spacing: -0.5px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.25;
  animation: ping 2.5s ease infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.25; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}
.hdr-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-toggle {
  width: 36px;
  height: 36px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink3);
  font-size: 18px;
  transition: all 0.2s ease;
}
.theme-toggle:hover {
  border-color: var(--purple);
  color: var(--purple);
}
.badge-ver {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--ink4);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radxs);
  padding: 3px 9px;
}
.btn-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radsm);
  color: var(--ink3);
  font-size: 20px;
  box-shadow: var(--sha);
  transition: all 0.2s ease;
}
.btn-menu:hover {
  border-color: var(--ink4);
  color: var(--ink);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  position: relative;
  z-index: 1;
}

.profile-section {
  text-align: center;
  margin-bottom: 48px;
  animation: riseUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
}
.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--purple);
  box-shadow: 0 0 30px rgba(139,92,246,0.3);
  margin-bottom: 20px;
}
.profile-name-large {
  font-family: 'Instrument Serif', serif;
  font-size: 42px;
  color: var(--ink);
  margin-bottom: 8px;
  letter-spacing: -1px;
}
.profile-bio-large {
  color: var(--ink3);
  font-size: 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 40px 0;
}

.nav-card {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 32px 24px;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--sha);
  animation: riseUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
}
.nav-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  box-shadow: var(--sha2);
}
.nav-card-icon {
  font-size: 48px;
  color: var(--purple);
  margin-bottom: 20px;
}
.nav-card-title {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  color: var(--ink);
  margin-bottom: 12px;
}
.nav-card-desc {
  color: var(--ink3);
  font-size: 15px;
  line-height: 1.6;
}

.friend-list {
  margin-top: 40px;
}
.section-title-home {
  font-family: 'Geist Mono', monospace;
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.friend-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all 0.2s ease;
  animation: riseUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
}
.friend-item:hover {
  transform: translateY(-2px);
  border-color: var(--purple);
  box-shadow: var(--sha);
}
.friend-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--purple-lt);
}
.friend-info {
  flex: 1;
}
.friend-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 16px;
  margin-bottom: 4px;
}
.friend-desc {
  color: var(--ink3);
  font-size: 13px;
}

.loader {
  text-align: center;
  padding: 40px;
  color: var(--ink4);
}
.loader-spinner {
  font-size: 24px;
  margin-bottom: 12px;
  display: inline-block;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  background: var(--red-lt);
  border: 1px solid var(--red);
  color: var(--red);
  padding: 16px;
  border-radius: var(--radsm);
  margin: 20px 0;
  text-align: center;
}

.foot {
  text-align: center;
  margin-top: 60px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.foot-text {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--ink4);
  letter-spacing: 0.5px;
}

#custom-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}
#custom-toast.hidden {
  display: none;
}
.toast-content {
  background: var(--ink);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radsm);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--sha2);
  border-left: 4px solid var(--purple);
}
.toast-content i {
  font-size: 14px;
  color: var(--purple);
}

@keyframes riseUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  main { padding: 28px 16px 60px; }
  .hdr { padding: 0 16px; }
  .hdr-back span:not(.material-icons) { display: none; }
  .badge-ver { display: none; }
  .profile-avatar-large { width: 100px; height: 100px; }
  .profile-name-large { font-size: 32px; }
  .nav-card { padding: 24px 20px; }
  .nav-card-icon { font-size: 40px; }
  .nav-card-title { font-size: 24px; }
}
.api-description {
  max-width: 640px;
  margin: 0 auto 32px;
  padding: 20px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--rad);
  border-left: 3px solid var(--blue);
}
.api-desc-text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
  text-align: center;
}


.home-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.home-logo-img {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 0 30px rgba(139,92,246,0.4), 0 0 60px rgba(37,99,235,0.2);
  border: 2px solid rgba(139,92,246,0.4);
  animation: neonPulse 2.5s ease-in-out infinite;
}
@keyframes neonPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(139,92,246,0.5), 0 0 40px rgba(37,99,235,0.25); }
  50% { box-shadow: 0 0 40px rgba(139,92,246,0.8), 0 0 80px rgba(37,99,235,0.45), 0 0 120px rgba(139,92,246,0.2); }
}
.card-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin: 32px 0;
}
.card-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 32px 0;
}
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 32px 0;
}

.nav-card-sm {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 18px;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--sha);
  animation: riseUp 0.7s cubic-bezier(0.22,1,0.36,1) forwards;
  text-align: center;
}
.nav-card-sm:hover {
  transform: translateY(-3px);
  border-color: var(--purple);
  box-shadow: var(--sha2);
}
.nav-card-sm-icon {
  font-size: 28px;
  color: var(--purple);
  margin-bottom: 10px;
}
.nav-card-sm-title {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.nav-card-sm-desc {
  color: var(--ink3);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .card-grid-3 { grid-template-columns: 1fr; }
  .card-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .card-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .nav-card-sm { padding: 18px 16px; text-align: left; display: flex; align-items: center; gap: 14px; }
  .nav-card-sm-icon { font-size: 22px; margin-bottom: 0; flex-shrink: 0; }
  .nav-card-sm-desc { display: none; }
}
