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

:root {
  --bg:      #dbeeff;
  --surface: #eef6ff;
  --accent:  #1a6cf5;
  --text:    #1a2a3a;
  --sub:     #4a6a82;
  --muted:   #7a9ab8;
  --border:  #b0cde0;
  --edge:    #9fbcd6;           /* 3D button "thickness" colour */
  --shadow:  0 2px 4px rgba(0,0,0,.05), 0 8px 28px rgba(0,0,0,.09);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* ── GRAIN ── */
body::after {
  content: ''; position: fixed; inset: 0;
  pointer-events: none; z-index: 998; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── TOP GLOW ── */
body::before {
  content: ''; position: fixed; top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 700px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
  pointer-events: none; z-index: 0;
}

/* ── MOUSE CURSOR + TAIL (desktop only) ── */
@media (pointer: fine) {
  body, a, button, input, label { cursor: none; }

  #mouse-cursor {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    width: 40px; height: 21px;   /* must match SVG width="40" */
    overflow: visible;
  }

  .tail-dot {
    position: fixed;
    border-radius: 50%;
    background: #90b8d0;
    transform: translate(-100%, -50%);
    pointer-events: none;
    z-index: 99997;
  }
}

/* ── ANT — life size +10% via physical mm units ── */
#ant {
  position: fixed;
  top: 0; left: 0;
  width: 2.75mm;
  height: 1.65mm;
  pointer-events: all;
  z-index: 9999;
  overflow: hidden;
}

/* ════════════════════════════════
   PAGE LAYOUT
════════════════════════════════ */
.page {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2.5rem 1.2rem;
}

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

/* ── AVATAR BEHIND BUTTONS ── */
.socials-wrap { position: relative; margin-top: 1.2rem; }

.avatar-bg {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 200px; height: 200px;
  border-radius: 50%; object-fit: cover;
  opacity: 0.75;
  z-index: 0;
  pointer-events: none;
  animation: avatarPulse 3.5s ease-in-out infinite;
}
@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 12px 3px rgba(26,108,245,.15); }
  50%      { box-shadow: 0 0 28px 8px rgba(26,108,245,.35); }
}

/* ── HANDLE ── */
.handle {
  margin-top: .6rem;
  font-size: 1rem; font-weight: 700;
  color: var(--muted);
  display: inline-block;
  cursor: default; user-select: none;
  transition: color .2s, letter-spacing .2s;
}
.handle.drop-hidden { opacity: 0; transform: translateY(-15px); }
.handle.revealed {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.handle:hover {
  color: var(--accent);
  letter-spacing: .06em;
  animation: glitch .35s steps(2,end) 1;
}
@keyframes glitch {
  0%   { text-shadow:  3px 0 #ff0080,-3px 0 #00ccff; }
  33%  { text-shadow: -3px 0 #ff0080, 3px 0 #00ccff; }
  66%  { text-shadow:  3px 2px #ff0080,-3px -2px #00ccff; }
  100% { text-shadow: none; }
}
.page-title {
  display: block;
  margin-top: .15rem;
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em;
  color: var(--text);
}

/* ── SOCIALS — 3-column grid ── */
.socials {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
  position: relative;
  z-index: 1;
}
.socials.labelled { row-gap: 2.1rem; padding-bottom: 1.2rem; }
.page-title + .socials-wrap { margin-top: 1.6rem; }
/* single-row pages: smaller avatar so it doesn't spill onto the title */
.socials-wrap:has(.labelled) .avatar-bg { width: 150px; height: 150px; top: calc(50% - .6rem); }

/* ── 3D BUTTONS ──
   Raised "keycap" look: light-from-top gradient, inner highlight,
   a solid bottom edge for thickness, then a soft drop shadow.        */
.soc-btn {
  --edge-c: var(--edge);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 18px;
  background:
    linear-gradient(165deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(180deg, var(--surface) 0%, #d6e7f7 100%);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.95),
    inset 0 -3px 6px rgba(30,70,120,.10),
    0 5px 0 var(--edge-c),
    0 9px 14px rgba(20,50,90,.20),
    0 16px 30px rgba(20,50,90,.10);
  display: flex; align-items: center; justify-content: center;
  color: var(--sub); text-decoration: none;
  font: inherit;
  transition: background 2s ease, border-color 2s ease, color 2s ease, box-shadow 2s ease, transform 2s ease;
  will-change: transform; position: relative;
  container-type: inline-size;   /* lets icons size off the square (cqw) */
}
.soc-btn.drop-hidden { opacity: 0; transform: translateY(-30px); }
.soc-btn.dropped {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Coloured state shared by hover / press / light-show */
.soc-btn:hover {
  --edge-c: color-mix(in srgb, var(--bc, var(--accent)) 60%, #000);
  background:
    linear-gradient(165deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,.16) 100%),
    var(--bc, var(--accent));
  border-color: var(--bc, var(--accent));
  color: #fff;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.45),
    inset 0 -3px 6px rgba(0,0,0,.18),
    0 5px 0 var(--edge-c),
    0 10px 22px var(--bs, rgba(26,108,245,.32));
}

/* Instagram gradient */
.soc-btn.insta:hover {
  --edge-c: #8e1a6b;
  background:
    linear-gradient(165deg, rgba(255,255,255,.3) 0%, rgba(255,255,255,0) 50%),
    radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
  border-color: #d6249f;
}

/* Brand-logo buttons (multi-colour image) keep a light face so the logo stays visible */
.soc-btn.brand:hover, .soc-btn.brand.lit {
  background:
    linear-gradient(165deg, #fff 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, #f4f9ff 0%, #dcebfb 100%) !important;
  border-color: var(--bc) !important;
}

/* Press-down: the key sinks onto its edge */
.soc-btn:not(.qr-active):active {
  transform: translateY(4px) !important;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.4),
    inset 0 -2px 4px rgba(0,0,0,.18),
    0 1px 0 var(--edge-c),
    0 3px 6px rgba(20,50,90,.25) !important;
  transition: transform .08s ease, box-shadow .08s ease !important;
}

/* Mobile touch feedback — press glow in brand colour */
@media (pointer: coarse) {
  .soc-btn:active {
    --edge-c: color-mix(in srgb, var(--bc, var(--accent)) 60%, #000);
    background:
      linear-gradient(165deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,.16) 100%),
      var(--bc, var(--accent));
    border-color: var(--bc, var(--accent));
    color: #fff;
  }
  .soc-btn.insta:active {
    background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    border-color: #d6249f;
  }
}

/* Logos fill 80% of the square */
.soc-btn > svg, .soc-btn > img.logo {
  width: 80%; height: 80%;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.7)) drop-shadow(0 2px 2px rgba(20,50,90,.18));
  transition: filter .3s;
}
.soc-btn > img.logo { object-fit: contain; pointer-events: none; }
.soc-btn:hover > svg, .soc-btn.lit > svg { filter: drop-shadow(0 2px 2px rgba(0,0,0,.28)); }
.x-logo {
  font-family: 'Black Han Sans', sans-serif; line-height: 1;
  font-size: 72cqw;
  text-shadow: 0 1px 0 rgba(255,255,255,.7), 0 2px 3px rgba(20,50,90,.18);
}
.soc-btn:hover .x-logo, .soc-btn.lit .x-logo { text-shadow: 0 2px 3px rgba(0,0,0,.3); }

/* Caption under a button (referrals page) */
.soc-label {
  position: absolute; top: calc(100% + 9px); left: -6px; right: -6px;
  font-size: .72rem; font-weight: 600; color: var(--sub);
  line-height: 1.2; pointer-events: none;
}

/* Share dropdown */
.soc-wrap { position: relative; }

.share-menu {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.13);
  padding: .55rem;
  min-width: 210px;
  z-index: 200;
  display: none; flex-direction: column; gap: .2rem;
  white-space: nowrap;
}
.share-menu.open { display: flex; }

.share-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .85rem;
  border-radius: 10px;
  text-decoration: none; color: var(--text);
  font: 500 .85rem 'Inter', sans-serif;
  transition: background .15s;
  border: none; background: none; text-align: left; width: 100%;
}
.share-item:hover { background: var(--bg); color: var(--accent); }
.share-item svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.si { font-size: .9rem; flex-shrink: 0; line-height: 1; }

/* ── LIGHT-UP ── */
.soc-btn.lit {
  --edge-c: color-mix(in srgb, var(--bc, var(--accent)) 60%, #000);
  background:
    linear-gradient(165deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,.16) 100%),
    var(--bc, var(--accent)) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.45),
    0 5px 0 var(--edge-c),
    0 0 22px var(--bs, rgba(26,108,245,.5)),
    0 10px 22px var(--bs, rgba(26,108,245,.32)) !important;
  transform: scale(1.08) !important;
}
.soc-btn.insta.lit {
  background: radial-gradient(circle at 30% 110%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285AEB 90%) !important;
  box-shadow: 0 5px 0 #8e1a6b, 0 0 22px rgba(214,36,159,.5), 0 10px 22px rgba(214,36,159,.35) !important;
}

/* ── QR CODES ── */
.qr-toggle {
  display: block; margin: 1.6rem auto 0; padding: 8px 16px;
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 3px 0 var(--edge), 0 6px 12px rgba(20,50,90,.15);
  border-radius: 12px; color: var(--sub); cursor: pointer;
  transition: background 0.2s, color 0.2s, transform .08s, box-shadow .08s;
  font-family: 'Inter', sans-serif; font-size: .85rem; font-weight: 500;
}
.qr-toggle:hover, .qr-toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 3px 0 #0e47a8, 0 6px 12px rgba(26,108,245,.3); }
.qr-toggle:active { transform: translateY(3px); box-shadow: 0 0 0 #0e47a8, 0 2px 4px rgba(26,108,245,.3); }

.soc-btn .qr-overlay {
  position: absolute; inset: 4px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border-radius: 14px;
  opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.soc-btn .qr-overlay canvas { width: 88%; height: auto; }
.qr-mode .soc-btn .qr-overlay { opacity: 1; }

.qr-logo {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22%; aspect-ratio: 1;
  background: #fff;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  color: var(--bc, var(--accent));
}
.soc-btn .qr-logo svg, .soc-btn .qr-logo img { width: 72%; height: 72%; fill: currentColor; filter: none; }
.soc-btn .qr-logo .x-logo { font-size: 15cqw; text-shadow: none; }

/* QR focused — tap one QR to expand it (centred, never off-screen); others fade */
.qr-focused .soc-btn {
  opacity: 0 !important;
  transform: scale(0.5) !important;
  transition: opacity 0.35s ease, transform 0.35s ease !important;
  pointer-events: none;
}
.qr-focused .soc-btn.qr-active {
  opacity: 1 !important;
  transform: translate(var(--qx, 0px), var(--qy, 0px)) scale(var(--qs, 1.9)) !important;
  z-index: 100;
  pointer-events: auto;
  transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

/* ── HIDDEN CONTROL-ROOM BUTTON — invisible tap target, bottom-right corner ── */
#secret-btn {
  position: fixed; right: 0; bottom: 0;
  width: 56px; height: 56px;
  background: transparent; border: 0; opacity: 0;
  z-index: 9998;
  -webkit-tap-highlight-color: transparent;
}

/* ── MODAL (site QR / Wi-Fi) ── */
.fd-overlay {
  position: fixed; inset: 0; z-index: 99980;
  background: rgba(15,30,50,.45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; transition: opacity .2s ease;
}
.fd-overlay.open { opacity: 1; }
.fd-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(10,30,60,.35);
  padding: 1.4rem 1.4rem 1.2rem;
  width: 100%; max-width: 340px;
  text-align: center;
  transform: translateY(12px) scale(.97); transition: transform .25s cubic-bezier(0.34,1.56,0.64,1);
}
.fd-overlay.open .fd-modal { transform: none; }
.fd-modal h2 { font-size: 1.1rem; margin-bottom: .9rem; }
.fd-qr-box {
  position: relative; background: #fff; border-radius: 16px;
  padding: 14px; margin: 0 auto; width: min(260px, 100%);
  box-shadow: inset 0 0 0 1px var(--border);
}
.fd-qr-box canvas { width: 100%; height: auto; display: block; }
.fd-qr-box .qr-logo { width: 20%; color: var(--accent); }
.fd-qr-box .qr-logo svg, .fd-qr-box .qr-logo img { width: 72%; height: 72%; fill: currentColor; }
.fd-rows { margin-top: 1rem; display: grid; gap: .4rem; text-align: left; }
.fd-row {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: .5rem .75rem; font-size: .85rem;
}
.fd-row span:first-child { color: var(--muted); }
.fd-row b { font-weight: 600; font-family: ui-monospace, Menlo, monospace; word-break: break-all; }
.fd-row button { border: 0; background: none; color: var(--accent); font: 600 .78rem 'Inter', sans-serif; padding: .2rem .3rem; }
.fd-note { margin-top: .8rem; font-size: .78rem; color: var(--sub); }
.fd-close {
  margin-top: 1rem; width: 100%;
  padding: .7rem; border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
  box-shadow: 0 3px 0 var(--edge);
  font: 600 .9rem 'Inter', sans-serif; color: var(--text);
}
.fd-close:active { transform: translateY(3px); box-shadow: none; }

/* ── CONTROL ROOM PANEL ── */
.cr-panel {
  position: fixed; inset: 0; z-index: 99985;
  background: rgba(15,30,50,.5);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; justify-content: center; align-items: flex-start;
  overflow-y: auto; padding: 16px;
}
.cr-card {
  width: 100%; max-width: 460px; margin: 2vh 0 4vh;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 22px; box-shadow: 0 20px 60px rgba(10,30,60,.35);
  padding: 1.1rem 1.1rem 1.3rem; color: var(--text);
}
.cr-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.cr-head h2 { font-size: 1.05rem; }
.cr-x { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--sub); padding: .2rem .4rem; }
.cr-sec { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: .8rem .9rem; margin-top: .7rem; }
.cr-sec h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .55rem; }
.cr-vol { display: flex; align-items: center; gap: .7rem; }
.cr-vol input[type=range] { flex: 1; accent-color: var(--accent); }
.cr-vol output { width: 3ch; text-align: right; font-variant-numeric: tabular-nums; font-size: .85rem; }
.cr-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: .35rem .7rem; font: 600 .8rem 'Inter', sans-serif;
}
.cr-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cr-ranges { display: flex; gap: .35rem; flex-wrap: wrap; }
.cr-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .7rem; }
.cr-tile { background: var(--surface); border-radius: 10px; padding: .55rem; text-align: center; }
.cr-tile b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.cr-tile span { font-size: .7rem; color: var(--sub); }
.cr-bars { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin-top: .4rem; }
.cr-bars div { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 1px; opacity: .85; }
.cr-list { list-style: none; font-size: .82rem; }
.cr-list li { display: flex; justify-content: space-between; gap: .6rem; padding: .28rem 0; border-top: 1px solid #eef3f8; }
.cr-list li:first-child { border-top: 0; }
.cr-list li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-list li span:last-child { font-variant-numeric: tabular-nums; color: var(--sub); flex-shrink: 0; }
.cr-muted { font-size: .8rem; color: var(--sub); line-height: 1.45; }
.cr-muted code { font-size: .75rem; background: var(--surface); padding: 0 .25rem; border-radius: 4px; }
.cr-src {
  margin: 1.1rem 0 .1rem; padding-top: .9rem; border-top: 1px dashed var(--border);
  font-size: .85rem; display: flex; justify-content: space-between; align-items: baseline;
}
.cr-stats > .cr-src:first-child { border-top: 0; padding-top: 0; margin-top: .8rem; }
.cr-src a { font-size: .75rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.cr-ver { margin-top: .9rem; text-align: center; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
