@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&display=swap');

/* ─── Theme Variables ─── */
:root {
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.25);
  --glass-hover: rgba(255, 255, 255, 0.22);
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --accent: rgba(255, 255, 255, 0.9);
  --accent-green: rgba(80, 230, 160, 0.9);
  --body-bg: #0a0a0f;
  --avatar-bg: #0a0a0f;
  --orb1: rgba(120, 80, 255, 0.35);
  --orb2: rgba(0, 160, 255, 0.3);
  --orb3: rgba(255, 60, 130, 0.15);
  --cookie-bg: rgba(18, 18, 28, 0.96);
  --cookie-border: rgba(255, 255, 255, 0.15);
  --shadow: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.78);
  --text-primary: rgba(10, 10, 20, 0.92);
  --text-secondary: rgba(10, 10, 20, 0.45);
  --accent: rgba(10, 10, 20, 0.85);
  --accent-green: rgba(20, 160, 100, 1);
  --body-bg: #eef0f7;
  --avatar-bg: #eef0f7;
  --orb1: rgba(140, 100, 255, 0.18);
  --orb2: rgba(0, 140, 255, 0.15);
  --orb3: rgba(255, 60, 130, 0.08);
  --cookie-bg: rgba(245, 246, 252, 0.98);
  --cookie-border: rgba(0, 0, 0, 0.1);
  --shadow: rgba(0, 0, 0, 0.12);
}

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

html, body {
  min-height: 100%;
  font-family: -apple-system, 'SF Pro Display', 'Nunito', BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--body-bg);
  overflow-x: hidden;
  position: relative;
  transition: background 0.35s ease;
}

/* ─── Animated background ─── */
.bg-mesh {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
}
.bg-mesh::before {
  content: ''; position: absolute; top: -30%; left: -20%;
  width: 70%; height: 70%;
  background: radial-gradient(ellipse, var(--orb1) 0%, transparent 70%);
  animation: drift1 12s ease-in-out infinite alternate;
  transition: background 0.35s ease;
}
.bg-mesh::after {
  content: ''; position: absolute; bottom: -20%; right: -20%;
  width: 60%; height: 60%;
  background: radial-gradient(ellipse, var(--orb2) 0%, transparent 70%);
  animation: drift2 15s ease-in-out infinite alternate;
  transition: background 0.35s ease;
}
.bg-orb {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 50%; height: 50%;
  background: radial-gradient(ellipse, var(--orb3) 0%, transparent 70%);
  z-index: 0; animation: drift3 10s ease-in-out infinite alternate;
  transition: background 0.35s ease;
}

@keyframes drift1 { from { transform: translate(0,0) scale(1); } to { transform: translate(8%,12%) scale(1.1); } }
@keyframes drift2 { from { transform: translate(0,0) scale(1); } to { transform: translate(-10%,-8%) scale(1.15); } }
@keyframes drift3 { from { transform: translate(-50%,-50%) scale(1); } to { transform: translate(-48%,-54%) scale(1.2); } }

/* ─── Noise grain ─── */
.noise {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  position: fixed !important; top: 20px !important; right: 20px !important;
  z-index: 300; width: 40px; height: 40px; border-radius: 50%;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.5s 0.1s ease both; opacity: 0;
}
.theme-toggle:hover { background: var(--glass-hover); transform: scale(1.08); box-shadow: 0 8px 24px var(--shadow); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg {
  width: 18px; height: 18px; fill: none; stroke: var(--text-primary);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: opacity 0.2s ease, transform 0.3s ease; position: absolute;
}
.theme-toggle .icon-sun  { opacity: 0; transform: rotate(-45deg) scale(0.7); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="light"] .theme-toggle .icon-sun  { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(45deg) scale(0.7); }

/* ─── Animations ─── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Cookie Banner ─── */
.cookie-banner {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(140%);
  z-index: 999; width: calc(100% - 48px); max-width: 560px;
  background: var(--cookie-bg); border: 1px solid var(--cookie-border);
  border-radius: 18px; padding: 18px 20px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.3);
  transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s ease, background 0.35s ease, border-color 0.35s ease;
  opacity: 0; pointer-events: none;
}
.cookie-banner.visible { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }
.cookie-banner-inner { display: flex; align-items: center; gap: 16px; }
.cookie-icon { font-size: 26px; flex-shrink: 0; line-height: 1; }
.cookie-text { flex: 1; min-width: 0; }
.cookie-text p { font-size: 13px; color: var(--text-primary); line-height: 1.55; font-weight: 400; transition: color 0.35s ease; }
.cookie-text p strong { font-weight: 600; }
.cookie-btn {
  flex-shrink: 0; padding: 9px 18px; border-radius: 10px;
  background: var(--text-primary); color: var(--body-bg); border: none;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s ease, transform 0.15s ease, background 0.35s ease, color 0.35s ease;
  white-space: nowrap;
}
.cookie-btn:hover { opacity: 0.85; transform: scale(1.03); }
.cookie-btn:active { transform: scale(0.97); }
@media (max-width: 480px) {
  .cookie-banner-inner { flex-wrap: wrap; }
  .cookie-btn { width: 100%; text-align: center; padding: 11px; }
}

/* ════════════════════════════════════════════════
   LINKTREE PAGE
   ════════════════════════════════════════════════ */
.page {
  position: relative; z-index: 2; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px 48px;
}

header {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; margin-bottom: 40px;
  animation: fadeUp 0.7s ease both;
}

.avatar-wrap { position: relative; width: 96px; height: 96px; }

.avatar-ring {
  position: absolute; inset: -3px; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(120,80,255,0.8), rgba(0,180,255,0.8), rgba(255,60,130,0.8), rgba(120,80,255,0.8));
  animation: spin 6s linear infinite; z-index: 0;
}

.avatar-inner {
  position: absolute; inset: 3px; border-radius: 50%;
  background: var(--avatar-bg); z-index: 1; overflow: hidden;
  transition: background 0.35s ease;
}
.avatar-inner img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.avatar-placeholder {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(135deg, rgba(120,80,255,0.6), rgba(0,160,255,0.6));
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700; color: white; letter-spacing: -1px;
}

header h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; transition: color 0.35s ease; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  letter-spacing: 0.5px; text-transform: uppercase;
  transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

main { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; }

/* Icon-only grid */
.icons-grid {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px;
  width: 100%; max-width: 420px;
}

.icon-item { position: relative; display: flex; align-items: center; justify-content: center; }

.icon-btn {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; color: var(--text-primary);
  transition: all 0.26s cubic-bezier(0.34,1.56,0.64,1);
  outline: none; position: relative; overflow: hidden;
  opacity: 0; animation: fadeUp 0.5s ease both;
}
.icon-btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: var(--icon-accent, transparent); opacity: 0; transition: opacity 0.22s ease;
}
.icon-btn:hover::before, .icon-btn:focus-visible::before { opacity: 0.15; }
.icon-btn:hover, .icon-btn:focus-visible {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 12px 36px var(--shadow);
  background: var(--glass-hover);
}
.icon-btn:active { transform: scale(0.97); }
.icon-btn:focus-visible { box-shadow: 0 0 0 3px rgba(80,230,160,0.4); }
.icon-btn svg, .icon-btn img { width: 24px; height: 24px; display: block; position: relative; z-index: 1; pointer-events: none; }

/* Tooltip */
.tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(10,10,15,0.88); backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.92); font-size: 11px; font-weight: 600;
  letter-spacing: 0.3px; white-space: nowrap; padding: 5px 10px;
  border-radius: 8px; pointer-events: none; opacity: 0;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 10; border: 1px solid rgba(255,255,255,0.1);
}
.tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: rgba(10,10,15,0.88);
}
.icon-item:hover .tooltip, .icon-item:focus-within .tooltip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Footer links */
.page-footer {
  margin-top: 40px; display: flex; flex-direction: column;
  align-items: center; gap: 10px;
  animation: fadeUp 0.5s 0.6s ease both; opacity: 0;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a, .footer-copy {
  font-size: 11px; color: var(--text-secondary); text-decoration: none;
  transition: color 0.2s ease; letter-spacing: 0.3px;
}
.footer-links a:hover { color: var(--text-primary); }

/* Admin lock button */
.admin-lock {
  position: fixed; bottom: 20px; right: 20px; z-index: 300;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; color: var(--text-secondary);
  transition: all 0.2s ease; opacity: 0.5;
  animation: fadeUp 0.5s 0.8s ease both;
}
.admin-lock:hover { opacity: 1; transform: scale(1.1); color: var(--text-primary); box-shadow: 0 4px 16px var(--shadow); }
.admin-lock svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Skeleton */
.skeleton {
  width: 56px; height: 56px; border-radius: 18px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ════════════════════════════════════════════════
   SETUP PAGE
   ════════════════════════════════════════════════ */
.setup-page {
  position: relative; z-index: 2; min-height: 100vh;
  max-width: 900px; margin: 0 auto; padding: 60px 24px 64px;
}

.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-secondary); text-decoration: none;
  font-size: 13px; font-weight: 500; letter-spacing: 0.2px;
  margin-bottom: 48px; transition: color 0.2s ease;
  animation: fadeUp 0.5s ease both;
}
.back-link:hover { color: var(--text-primary); }
.back-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.setup-header { margin-bottom: 56px; animation: fadeUp 0.6s 0.05s ease both; opacity: 0; }
.setup-header .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--accent-green); margin-bottom: 10px; transition: color 0.35s ease; }
.setup-header h1 { font-size: clamp(32px,6vw,52px); font-weight: 800; color: var(--text-primary); letter-spacing: -1.5px; line-height: 1.05; margin-bottom: 12px; transition: color 0.35s ease; }
.setup-header h1 span { background: linear-gradient(90deg, rgba(120,80,255,0.9), rgba(0,180,255,0.9)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.setup-header p { color: var(--text-secondary); font-size: 14px; max-width: 440px; line-height: 1.6; transition: color 0.35s ease; }

.affiliate-notice {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 40px; padding: 6px 14px; border-radius: 20px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 11px; font-weight: 500; color: var(--text-secondary);
  letter-spacing: 0.2px; transition: background 0.35s ease, color 0.35s ease;
}
.affiliate-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-green); flex-shrink: 0; }

.setup-section { margin-bottom: 48px; opacity: 0; animation: fadeUp 0.5s ease both; }
.section-label { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-label-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); flex-shrink: 0; transition: background 0.35s ease, box-shadow 0.35s ease; }
.section-label h2 { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-secondary); transition: color 0.35s ease; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

a.item-card { text-decoration: none; cursor: pointer; }
a.item-card:hover .item-name { color: var(--accent-green); }
a.item-card .item-icon-wrap { position: relative; }

.item-card-link-badge {
  position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-green); display: flex; align-items: center; justify-content: center;
}
.item-card-link-badge svg { width: 8px; height: 8px; stroke: #0a0a0f; fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.item-ref-tag { font-size: 9px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--accent-green); opacity: 0.7; margin-top: 2px; }

.item-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 16px; padding: 18px 20px;
  display: flex; align-items: center; gap: 16px;
  position: relative; overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}
.item-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 55%); pointer-events: none; }
.item-card:hover { background: var(--glass-hover); transform: translateY(-2px); box-shadow: 0 12px 36px var(--shadow); }

.item-icon-wrap { position: relative; flex-shrink: 0; }
.item-icon { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 20px; transition: background 0.35s ease, border-color 0.35s ease; }
[data-theme="light"] .item-icon { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.08); }

.item-info { flex: 1; min-width: 0; }
.item-type { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 3px; transition: color 0.35s ease; }
.item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.35s ease; }

.setup-footer {
  margin-top: 64px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding-top: 24px; border-top: 1px solid var(--glass-border);
  animation: fadeUp 0.5s 0.7s ease both; opacity: 0;
  transition: border-color 0.35s ease;
}
.setup-footer p { font-size: 12px; color: var(--text-secondary); transition: color 0.35s ease; }
.setup-footer a { font-size: 12px; color: var(--text-secondary); text-decoration: none; transition: color 0.2s ease; }
.setup-footer a:hover { color: var(--text-primary); }

.setup-section:nth-child(1) { animation-delay: 0.10s; }
.setup-section:nth-child(2) { animation-delay: 0.20s; }
.setup-section:nth-child(3) { animation-delay: 0.30s; }
.cards-grid .item-card:nth-child(1) { animation: fadeUp 0.4s 0.20s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(2) { animation: fadeUp 0.4s 0.25s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(3) { animation: fadeUp 0.4s 0.30s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(4) { animation: fadeUp 0.4s 0.35s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(5) { animation: fadeUp 0.4s 0.40s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(6) { animation: fadeUp 0.4s 0.45s ease both; opacity: 0; }
.cards-grid .item-card:nth-child(7) { animation: fadeUp 0.4s 0.50s ease both; opacity: 0; }

@media (max-width: 500px) {
  .cards-grid { grid-template-columns: 1fr; }
}
