/* Layout 3: a centre card with the custom-button sections either side. */

:root {
  color-scheme: dark;   /* dark native scrollbar + form controls (volume slider) */
  --bg: #0b0d14;
  --surface: #161a25;
  --border: #2a3040;
  --text: #eef0f5;
  --dim: #9aa3b5;
  --accent: #8a93a6;   /* default: neutral slate; overridden from <html> */
  --accent2: #a4abba;  /* lighter partner */
  --btn-opacity: 1;   /* link-tile fill opacity, overridden from <html> */
  --box-opacity: 1;   /* profile-box fill + border opacity, overridden from <html> */
  --box-line: var(--border);  /* profile-box border colour; the 'outline' style swaps it for the accent */
}

* { box-sizing: border-box; }

/* Visible keyboard focus for interactive elements; :where() keeps specificity at 0. */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent, #8a93a6);
  outline-offset: 2px;
}

body {
  margin: 0;
  min-height: 100vh;
  /* svh = height with the browser bars showing; vh fallback. */
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 28px 20px;
  /* viewport-fit=cover: grow into the notch strips; env() is 0 off-notch. */
  padding: max(28px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

/* Optional page background: fixed layers behind everything, plus a readability scrim. */
/* lvh, so the background doesn't resize as phone bars slide away; vh fallback. */
.page-bg,
.page-bg-scrim {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
}
.page-bg {
  z-index: -2;
  border: 0;
  object-fit: cover;               /* <video> */
  background-size: cover;          /* <div>   */
  background-position: center;
  background-repeat: no-repeat;
}
.page-bg-scrim {
  z-index: -1;
  background: rgba(11, 13, 20, 0.62);
}

/* Auto margins centre the card on tall viewports. */
.card { width: 100%; max-width: 420px; text-align: center; position: relative; margin-block: auto; }

.cf-turnstile:not(.turnstile-row) {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden;
}

/* Identity box: avatar, name, bio, badges. */
.profile {
  border: 1px solid;
  border-color: color-mix(in srgb, var(--box-line) calc(var(--box-opacity) * 100%), transparent);
  background: color-mix(in srgb, var(--surface) calc(var(--box-opacity) * 100%), transparent);
  border-radius: 16px;
  padding: 28px 24px 24px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

/* Profile-box styles; --box-opacity fades fill + border. */
[data-box-style="sharp"]   .profile,
[data-box-style="sharp"]   .badges,
[data-box-style="sharp"]   .location-line,
[data-box-style="sharp"]   .view-count { border-radius: 4px; }

[data-box-style="outline"] { --box-line: color-mix(in srgb, var(--accent) 45%, var(--border)); }
[data-box-style="outline"] .profile,
[data-box-style="outline"] .badges,
[data-box-style="outline"] .location-line,
[data-box-style="outline"] .view-count { background: transparent; }

[data-box-style="shadow"]  .profile,
[data-box-style="shadow"]  .badges,
[data-box-style="shadow"]  .location-line,
[data-box-style="shadow"]  .view-count { border-color: transparent; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32); }
[data-box-style="shadow"]  .profile { box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4); }

/* 'glass': frosted see-through fill, light edge, soft shadow. */
[data-box-style="glass"] :is(.profile, .badges, .location-line, .view-count) {
  background: rgba(10, 12, 18, calc(var(--box-opacity) * 0.45));
  border-color: rgba(255, 255, 255, calc(var(--box-opacity) * 0.12));
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
[data-box-style="glass"] .profile {
  border-radius: 20px;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Profile-box hover: base motion plus outline / glow add-ons. Mouse only. */
@media (hover: hover) {
  [data-box-outline] .profile:hover { border-color: var(--accent); }
  [data-box-glow]    .profile:hover {
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent),
                0 0 46px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  [data-box-hover="lift"] .profile:hover { transform: translateY(-1px); }
  [data-box-hover="zoom"] .profile:hover { transform: scale(1.02); }
}

/* 'tilt' is pointer-driven from layout.js; give it a bit more smoothing. */
[data-box-hover="tilt"] .profile {
  transition: transform 0.2s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Neon glow around the identity card. */
[data-box-neon="1"] .profile {
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 42%, transparent),
              0 0 50px color-mix(in srgb, var(--accent) 20%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  [data-box-neon="1"] .profile { animation: fx-neon-box 2.6s ease-in-out infinite; }
}
@keyframes fx-neon-box {
  0%, 100% { box-shadow: 0 0 15px color-mix(in srgb, var(--accent) 38%, transparent),
                         0 0 42px color-mix(in srgb, var(--accent) 18%, transparent); }
  50%      { box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 55%, transparent),
                         0 0 66px color-mix(in srgb, var(--accent) 28%, transparent); }
}

/* Accent stripe along the top. After the box styles so it survives them. */
[data-box-stripe="1"] .profile { border-top: 5px solid var(--accent); }

/* Location + view-count pills share the box effects, minus hover motion. */
@media (hover: hover) {
  [data-box-outline] :is(.location-line, .view-count):hover { border-color: var(--accent); }
  [data-box-glow]    :is(.location-line, .view-count):hover {
    box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent),
                0 0 24px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}
[data-box-neon="1"] :is(.location-line, .view-count) {
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 42%, transparent),
              0 0 26px color-mix(in srgb, var(--accent) 20%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  [data-box-neon="1"] :is(.location-line, .view-count) { animation: fx-neon-pill 2.6s ease-in-out infinite; }
}
@keyframes fx-neon-pill {
  0%, 100% { box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 38%, transparent),
                         0 0 22px color-mix(in srgb, var(--accent) 18%, transparent); }
  50%      { box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 55%, transparent),
                         0 0 34px color-mix(in srgb, var(--accent) 28%, transparent); }
}

.profile-col { margin-bottom: 22px; }
.link-col { min-width: 0; }

@media (min-width: 820px) {
  .card {
    max-width: 760px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
  }
  /* Sticky and vertically centred via --pc-h; 28px from the top without JS. */
  .profile-col {
    position: sticky;
    top: max(28px, calc(50vh - var(--pc-h, 100vh) / 2));
    top: max(28px, calc(50svh - var(--pc-h, 100svh) / 2));
    margin-bottom: 0;
  }
  /* Centre the links against the profile box when they're the shorter column. */
  .link-col { align-self: center; }
}

.avatar-wrap {
  position: relative;
  isolation: isolate;   /* contains the orbit ring's z-index:-1, like #profile-block does in Layout 2 */
  -webkit-tap-highlight-color: transparent;   /* no grey/blue flash when tapped (spin + page-number tooltip) */
  display: block;
  width: 104px;
  height: 104px;
  margin: 0 auto 18px;
}
.avatar,
.avatar-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.avatar {
  display: grid;
  place-items: center;
  font-family: 'Courier New', monospace;   /* matches the name */
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}
.avatar-img { object-fit: cover; }

/* Spotlight glow behind the photo. */
[data-avatar-spotlight="1"] .avatar-wrap {
  border-radius: 50%;
  box-shadow: 0 0 28px 6px color-mix(in srgb, var(--avatar-col, var(--accent)) 50%, transparent),
              0 0 70px 18px color-mix(in srgb, var(--avatar-col, var(--accent)) 22%, transparent);
}
/* Float / pulse move the photo, so the glow goes on the photo to move with it. */
[data-avatar-spotlight="1"][data-avatar-anim="float"] .avatar-wrap,
[data-avatar-spotlight="1"][data-avatar-anim="pulse"] .avatar-wrap { box-shadow: none; }
[data-avatar-spotlight="1"][data-avatar-anim="float"] :is(.avatar, .avatar-img),
[data-avatar-spotlight="1"][data-avatar-anim="pulse"] :is(.avatar, .avatar-img) {
  box-shadow: 0 0 28px 6px color-mix(in srgb, var(--avatar-col, var(--accent)) 50%, transparent),
              0 0 70px 18px color-mix(in srgb, var(--avatar-col, var(--accent)) 22%, transparent);
}

/* Photo position 'corner': photo on the box's top-left corner, name beside it. */
[data-avatar-pos="corner"] {
  --cc-size: 104px;  /* photo diameter - .avatar-wrap's own size, used for the spacing below */
  --cc-rise: 30px;   /* how far it rises above the box */
  --cc-lean: 12px;   /* how far it leans out past the box's left edge */
  --cc-gap: 14px;    /* photo to name */
}
/* Room above the box for the raised photo. */
[data-avatar-pos="corner"] .profile-col { padding-top: var(--cc-rise); }
[data-avatar-pos="corner"] .profile { position: relative; text-align: left; padding-top: 20px; }
[data-avatar-pos="corner"] .avatar-wrap {
  position: absolute;
  z-index: 2;
  top: calc(var(--cc-rise) * -1);
  left: calc(var(--cc-lean) * -1);
  margin: 0;
}
/* Name indented past the photo. */
[data-avatar-pos="corner"] h1 {
  margin-left: calc(var(--cc-size) - var(--cc-lean) - 24px + var(--cc-gap));
  min-height: calc(var(--cc-size) - var(--cc-rise) - 20px);
}
/* The bio and badges stay centred below, as with a centred photo. */
[data-avatar-pos="corner"] .bio { text-align: center; }

/* orbit / spin: the photo is clickable for the fast-spin easter egg (layout.js) */
[data-avatar-anim="orbit"] .avatar-wrap,
[data-avatar-anim="spin"] .avatar-wrap { cursor: pointer; }

/* Photo animations: orbit / spin add a ring; the rest act on the photo. */
@media (prefers-reduced-motion: no-preference) {
  [data-avatar-anim="pulse"] .avatar,
  [data-avatar-anim="pulse"] .avatar-img { animation: av-pulse 2.4s ease-in-out infinite; }

  [data-avatar-anim="float"] .avatar,
  [data-avatar-anim="float"] .avatar-img { animation: av-float 3s ease-in-out infinite; }

  [data-avatar-anim="glow"] .avatar,
  [data-avatar-anim="glow"] .avatar-img { animation: av-glow 2.6s ease-in-out infinite; }

  [data-avatar-anim="spin"] .avatar-wrap::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--avatar-col, var(--accent));
    border-right-color: var(--avatar-col, var(--accent));
    animation: av-spin 1.5s linear infinite;
  }

  /* Click / tap the photo: one fast whip-around, same as the orbit ring. */
  [data-avatar-anim="spin"] .avatar-wrap.fast-orbit::before {
    animation: av-spin-fast 0.5s linear forwards;
  }

  /* Orbit: a soft accent ball straddling the photo rim. */
  [data-avatar-anim="orbit"] .avatar-wrap::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: radial-gradient(circle at 6px 6px, var(--avatar-col, var(--accent)) 10%, transparent 15%);
    animation: av-spin 3s linear infinite;
    z-index: -1;
    filter: blur(1px);
    box-shadow: none;
  }

  /* fast orbit on click (own keyframes force a restart) */
  [data-avatar-anim="orbit"] .avatar-wrap.fast-orbit::after {
    animation: av-spin-fast 0.5s linear forwards;
  }
}

@keyframes av-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes av-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes av-spin      { to { transform: rotate(360deg); } }
@keyframes av-spin-fast { to { transform: rotate(360deg); } }  /* separate name so the click spin restarts */
@keyframes av-glow {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--avatar-col, var(--accent)) 40%, transparent); }
  50%      { box-shadow: 0 0 20px 5px color-mix(in srgb, var(--avatar-col, var(--accent)) 40%, transparent); }
}

/* Name in Courier New, like Layout 2 (a picked name font still overrides it). */
h1 { margin: 0 0 16px; font-family: 'Courier New', ui-monospace, SFMono-Regular, monospace; font-size: 1.6rem; overflow-wrap: anywhere; }

/* Name effects; only the movement is motion-gated. */
[data-name-effect="gradient"] h1,
[data-name-effect="shine"] h1 {
  background: linear-gradient(92deg, var(--accent, #8a93a6), var(--accent2, #a4abba));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Lighten the far stop so the sweep shows on close accent colours. */
[data-name-effect="gradient"] h1 {
  background-image: linear-gradient(92deg,
      var(--accent, #8a93a6),
      color-mix(in srgb, var(--accent2, #a4abba), #fff 42%));
}
[data-name-effect="shine"] h1 {
  /* moving white streak over a static accent gradient */
  background-image:
      linear-gradient(100deg, transparent 44%, rgba(255, 255, 255, 0.92) 50%, transparent 56%),
      linear-gradient(92deg, var(--accent, #8a93a6), var(--accent2, #a4abba));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 50% 0, 0 0;   /* streak centred when motion is off */
}
[data-name-effect="glitch"] h1 {
  text-shadow: 1px 0 #ff2e97, -1px 0 var(--accent, #8a93a6);
}
/* Name neon glow; no pulse with glitch. */
[data-name-neon="1"] h1 {
  filter: drop-shadow(0 0 5px var(--accent, #8a93a6)) drop-shadow(0 0 13px var(--accent, #8a93a6));
}
@media (prefers-reduced-motion: no-preference) {
  [data-name-effect="shine"] h1  { animation: name-shine 3.6s linear infinite; }
  [data-name-effect="glitch"] h1 { animation: name-glitch 1.9s steps(2, end) infinite; }
  [data-name-neon="1"]:not([data-name-effect="glitch"]) h1 { animation: name-neon 2.2s ease-in-out infinite; }
  /* Re-declare shine + neon as one animation list where both are combined. */
  [data-name-effect="shine"][data-name-neon="1"] h1 {
    animation: name-shine 3.6s linear infinite, name-neon 2.2s ease-in-out infinite;
  }
}
@keyframes name-shine {
  0%   { background-position: 120% 0, 0 0; }   /* streak off the left edge */
  100% { background-position: -30% 0, 0 0; }   /* streak off the right edge */
}
@keyframes name-glitch {
  0%, 100% { text-shadow: 1px 0 #ff2e97, -1px 0 var(--accent, #8a93a6); transform: translate(0); }
  25%      { text-shadow: -2px 0 #ff2e97, 2px 0 var(--accent, #8a93a6); transform: translate(1px, -1px); }
  50%      { text-shadow: 2px 0 #ff2e97, -2px 0 var(--accent, #8a93a6); transform: translate(-1px, 1px); }
  75%      { text-shadow: -1px 0 #ff2e97, 1px 0 var(--accent, #8a93a6); transform: translate(1px, 0); }
}
@keyframes name-neon {
  0%, 100% { filter: drop-shadow(0 0 4px var(--name-col, var(--accent, #8a93a6))) drop-shadow(0 0 11px var(--name-col, var(--accent, #8a93a6))); }
  50%      { filter: drop-shadow(0 0 7px var(--name-col, var(--accent, #8a93a6))) drop-shadow(0 0 22px var(--name-col, var(--accent, #8a93a6))); }
}

/* Bio effects reuse the name keyframes. */
[data-bio-effect="gradient"] .bio,
[data-bio-effect="shine"] .bio {
  background: linear-gradient(92deg, var(--accent, #8a93a6), var(--accent2, #a4abba));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-bio-effect="gradient"] .bio {
  background-image: linear-gradient(92deg,
      var(--accent, #8a93a6),
      color-mix(in srgb, var(--accent2, #a4abba), #fff 42%));
}
[data-bio-effect="shine"] .bio {
  background-image:
      linear-gradient(100deg, transparent 44%, rgba(255, 255, 255, 0.92) 50%, transparent 56%),
      linear-gradient(92deg, var(--accent, #8a93a6), var(--accent2, #a4abba));
  background-size: 250% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 50% 0, 0 0;
}
[data-bio-effect="glitch"] .bio {
  text-shadow: 1px 0 #ff2e97, -1px 0 var(--accent, #8a93a6);
}
[data-bio-neon="1"] .bio {
  filter: drop-shadow(0 0 4px var(--accent, #8a93a6)) drop-shadow(0 0 11px var(--accent, #8a93a6));
}
@media (prefers-reduced-motion: no-preference) {
  [data-bio-effect="shine"] .bio  { animation: name-shine 3.6s linear infinite; }
  [data-bio-effect="glitch"] .bio { animation: name-glitch 1.9s steps(2, end) infinite; }
  [data-bio-neon="1"]:not([data-bio-effect="glitch"]) .bio { animation: bio-neon 2.2s ease-in-out infinite; }
  [data-bio-effect="shine"][data-bio-neon="1"] .bio {
    animation: name-shine 3.6s linear infinite, bio-neon 2.2s ease-in-out infinite;
  }
}
/* Own keyframes so the bio glow follows --bio-col, not --name-col. */
@keyframes bio-neon {
  0%, 100% { filter: drop-shadow(0 0 4px var(--bio-col, var(--accent, #8a93a6))) drop-shadow(0 0 11px var(--bio-col, var(--accent, #8a93a6))); }
  50%      { filter: drop-shadow(0 0 7px var(--bio-col, var(--accent, #8a93a6))) drop-shadow(0 0 22px var(--bio-col, var(--accent, #8a93a6))); }
}

/* Solid fill where background-clip: text isn't supported. */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  [data-name-effect="gradient"] h1,
  [data-name-effect="shine"] h1,
  [data-bio-effect="gradient"] .bio,
  [data-bio-effect="shine"] .bio {
    background: none;
    color: var(--text);
    -webkit-text-fill-color: var(--text);
  }
}
@media (forced-colors: active) {
  [data-name-effect] h1,
  [data-bio-effect] .bio {
    background: none !important;
    color: CanvasText !important;
    -webkit-text-fill-color: CanvasText !important;
  }
}

/* Bio colour: retarget the accents locally. */
[data-bio-col] .bio {
  --accent: var(--bio-col);
  --accent2: color-mix(in srgb, var(--bio-col) 78%, #fff);
  color: var(--bio-col);
  -webkit-text-fill-color: var(--bio-col);
}
[data-bio-effect="gradient"][data-bio-col] .bio,
[data-bio-effect="shine"][data-bio-col] .bio {
  color: transparent;
  -webkit-text-fill-color: transparent;
}
/* Emoji keep their own colours under the text effects. */
.bio .emo { -webkit-text-fill-color: var(--bio-col, var(--dim)); text-shadow: none; }

/* ---- Per-element colour overrides ---- */

/* Name colour: retarget the accents locally. */
[data-name-col] h1 {
  --accent: var(--name-col);
  --accent2: color-mix(in srgb, var(--name-col) 78%, #fff);
  color: var(--name-col);
  -webkit-text-fill-color: var(--name-col);
}
[data-name-effect="gradient"][data-name-col] h1,
[data-name-effect="shine"][data-name-col] h1 {
  color: transparent;
  -webkit-text-fill-color: transparent;
}
/* Emoji keep their own colours under the name effects. */
h1 .emo { -webkit-text-fill-color: var(--name-col, var(--text)); text-shadow: none; }

/* Coloured icons: a masked <span> instead of the white <img>. */
[data-icon-col] .link-icon {
  display: inline-block;
  filter: none;
  background-color: var(--icon-col);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* Brand-colour icons keep their own fills. */
.link-icon.is-brand,
[data-icon-col] .link-icon.is-brand,
.link-icon.is-custom,
[data-icon-col] .link-icon.is-custom {
  filter: none;
  background: none;
  -webkit-mask: none;
  mask: none;
}
/* A handle's own icon image (Pro): fitted, slightly rounded. */
.link-icon.is-custom { object-fit: contain; border-radius: 4px; }

/* Badge glyphs: same masked-span treatment. */
[data-badge-col] .badge {
  display: inline-block;
  filter: none;
  background-color: var(--badge-col);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* Badge neon glow; badge colour, else the accent. */
[data-badge-neon="1"] .badge-container {
  filter: drop-shadow(0 0 4px var(--badge-col, var(--accent, #8a93a6)))
          drop-shadow(0 0 10px var(--badge-col, var(--accent, #8a93a6)));
}
@media (prefers-reduced-motion: no-preference) {
  [data-badge-neon="1"] .badge-container { animation: fx-neon-badge 2.2s ease-in-out infinite; }
}
@keyframes fx-neon-badge {
  0%, 100% { filter: drop-shadow(0 0 3px var(--badge-col, var(--accent, #8a93a6)))
                     drop-shadow(0 0 8px var(--badge-col, var(--accent, #8a93a6))); }
  50%      { filter: drop-shadow(0 0 6px var(--badge-col, var(--accent, #8a93a6)))
                     drop-shadow(0 0 16px var(--badge-col, var(--accent, #8a93a6))); }
}

/* Solid page background: sits under .page-bg so an image/video still covers it. */
[data-bg-col] body { background: var(--bg-col); }

/* Optional bio: a line or two under the name, before badges/links. */
.bio {
  max-width: 36ch;
  margin: -6px auto 22px;
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Badge strip: an inset box sharing the profile-box style + --box-opacity.
   Sized to its badges; wraps at full width. */
.badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 12px 14px;
  border: 1px solid;
  border-color: color-mix(in srgb, var(--box-line) calc(var(--box-opacity) * 100%), transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) calc(var(--box-opacity) * 100%), transparent);
}
.badge {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1); /* dark monochrome SVGs -> flat white */
  transition: transform 0.15s ease;
}
/* "Badge colours": the SVG's own fills, no white filter / colour mask. */
.badge.is-brand,
[data-badge-col] .badge.is-brand { filter: none; background: none; -webkit-mask: none; mask: none; }

.badge-container { position: relative; display: inline-flex; }

/* Badge hover animation. */
@media (prefers-reduced-motion: no-preference) {
  .badge-container:hover .badge                            { transform: scale(1.18); }
  [data-badge-anim="tilt"]   .badge-container:hover .badge { transform: rotate(-12deg) scale(1.08); }
  [data-badge-anim="bounce"] .badge-container:hover .badge { transform: none; animation: bd-bounce 0.5s ease; }
  [data-badge-anim="spin"]   .badge-container:hover .badge { transform: none; animation: bd-spin 0.6s linear; }
  [data-badge-anim="wobble"] .badge-container:hover .badge { transform: none; animation: bd-wobble 0.6s ease; }
}
[data-badge-anim="none"] .badge-container:hover .badge { transform: none; animation: none; }
@keyframes bd-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  35%      { transform: translateY(-5px) scale(1.12); }
  65%      { transform: translateY(1px) scale(1.05); }
}
@keyframes bd-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes bd-wobble {
  0%, 100% { transform: rotate(0); }
  20%      { transform: rotate(-13deg); }
  45%      { transform: rotate(9deg); }
  70%      { transform: rotate(-5deg); }
  88%      { transform: rotate(2deg); }
}

/* Badge tooltips; the profile photo's "Page #N" tooltip shares the look. */
.badge-container .tooltip,
.avatar-wrap .tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(calc(-50% + var(--tip-shift, 0px)));   /* --tip-shift: tip-edge.js */
  max-width: calc(100vw - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 10;
}
.badge-container:hover .tooltip,
.badge-container.tip-open .tooltip,
.avatar-wrap:hover .tooltip,
.avatar-wrap.tip-open .tooltip { opacity: 1; visibility: visible; }   /* tap to reveal on touch */

/* Link tiles get the same hover tooltip as the badges, above the row. */
.link .tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(calc(-50% + var(--tip-shift, 0px)));
  max-width: min(90vw, 340px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 100;
}
.link:hover .tooltip,
.link.tip-open .tooltip,
.link.is-copied .tooltip { opacity: 1; visibility: visible; }   /* tap to reveal on touch; "Copied!" flash */
.link--copy { cursor: pointer; }   /* no-URL social: click copies the handle (layout.js) */
/* Lift the hovered tile (and its tooltip) above the later sibling tiles. */
.link:hover,
.link.tip-open { z-index: 20; }

.links { display: flex; flex-direction: column; gap: 12px; }
.link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 12px;
  text-decoration: none;
  background: color-mix(in srgb, var(--surface) calc(var(--btn-opacity) * 100%), transparent);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
/* Link hover: base motion plus outline / glow add-ons. Mouse only. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  /* Picture buttons (.link-card) share these, and the style / add-on rules below. */
  [data-link-hover="lift"] .link:hover { transform: translateY(-1px); }
  [data-link-hover="lift"] .link-card:hover { transform: translateY(-2px); }   /* a big card needs a bigger nudge to read */
  [data-link-hover="zoom"] :is(.link, .link-card):hover { transform: scale(1.03); }
  /* 'pop': the tile scales up, the icon scales further on icon hover. */
  [data-link-hover="pop"] :is(.link, .link-card):hover { transform: scale(1.06); }
  [data-link-hover="pop"] :is(.link-icon, .link-card--icon .link-card-media):hover { transform: scale(1.4) rotateY(15deg); }
  /* 'spin' / 'wobble': tile scale-up as 'pop', plus a spin/wobble on icon hover. */
  [data-link-hover="spin"] :is(.link, .link-card):hover { transform: scale(1.06); }
  [data-link-hover="spin"] :is(.link-icon, .link-card--icon .link-card-media):hover { animation: bd-spin 0.6s linear; }
  [data-link-hover="wobble"] :is(.link, .link-card):hover { transform: scale(1.06); }
  [data-link-hover="wobble"] :is(.link-icon, .link-card--icon .link-card-media):hover { animation: bd-wobble 0.6s ease; }
  [data-link-hover="spin"] :is(.link-icon, .link-card--icon .link-card-media):hover,
  [data-link-hover="wobble"] :is(.link-icon, .link-card--icon .link-card-media):hover { scale: 1.4; }
}
.link .handle {
  color: var(--dim);
  font-size: 0.9rem;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Link-button style + label switches, set on <html>; defaults need no rule. */
/* 'pill' on a square picture card means extra-round corners rather than a capsule. */
[data-btn-style="pill"]    .link { border-radius: 999px; }
[data-btn-style="pill"]    .link-card { border-radius: 24px; }
[data-btn-style="sharp"]   :is(.link, .link-card) { border-radius: 4px; }
[data-btn-style="outline"] :is(.link, .link-card) {
  background: transparent;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
[data-btn-style="shadow"]  :is(.link, .link-card) { border-color: transparent; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.38); }
@media (hover: hover) {
  [data-btn-style="shadow"]  :is(.link, .link-card):hover { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5); }

  /* 'outline' add-on, re-asserted after the button-style rules. */
  [data-link-outline] :is(.link, .link-card):hover { border-color: var(--icon-col, var(--accent)); }

  /* 'glow' add-on: a soft halo, re-asserted after the button-style rules. */
  [data-link-glow] :is(.link, .link-card):hover {
    box-shadow: 0 0 16px color-mix(in srgb, var(--icon-col, var(--accent)) 42%, transparent),
                0 0 40px color-mix(in srgb, var(--icon-col, var(--accent)) 20%, transparent);
  }
}

/* Link neon glow. */
[data-link-neon="1"] :is(.link, .link-card) {
  box-shadow: 0 0 13px color-mix(in srgb, var(--icon-col, var(--accent)) 42%, transparent),
              0 0 32px color-mix(in srgb, var(--icon-col, var(--accent)) 20%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  [data-link-neon="1"] :is(.link, .link-card) { animation: fx-neon-link 2.4s ease-in-out infinite; }
}
@keyframes fx-neon-link {
  0%, 100% { box-shadow: 0 0 11px color-mix(in srgb, var(--icon-col, var(--accent)) 38%, transparent),
                         0 0 26px color-mix(in srgb, var(--icon-col, var(--accent)) 18%, transparent); }
  50%      { box-shadow: 0 0 19px color-mix(in srgb, var(--icon-col, var(--accent)) 55%, transparent),
                         0 0 44px color-mix(in srgb, var(--icon-col, var(--accent)) 28%, transparent); }
}

/* Icon only: wrapping grid of icon buttons; custom buttons keep their text. */
[data-btn-labels="0"] .links {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
[data-btn-labels="0"] .link:not(.link--custom) {
  flex: none;
  width: 56px;
  height: 56px;
  padding: 0;
  justify-content: center;
}
[data-btn-labels="0"] .link:not(.link--custom) .link-left { gap: 0; }
/* Hide the platform label, not the icon (a bare <span> when an icon colour is set). */
[data-btn-labels="0"] .link:not(.link--custom) .link-left span:not(.link-icon),
[data-btn-labels="0"] .link:not(.link--custom) .handle { display: none; }
[data-btn-labels="0"] .link:not(.link--custom) .link-icon { width: 26px; height: 26px; }
[data-btn-labels="0"] .links > :is(.link--custom, .link-card) { flex: 1 1 100%; }

.link-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.link-left span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Force the monochrome icon SVGs to flat white so colour icons match. */
.link-icon { width: 24px; height: 24px; flex: none; object-fit: contain; filter: brightness(0) invert(1); transition: transform 0.15s ease, scale 0.15s ease; }

/* Custom buttons: the social-link shell with a bold label + arrow, no handle. */
.link--custom .link-left span { font-weight: 600; }
.link--custom .handle { font-size: 1rem; }

/* Blank row between the social links and the custom buttons below them. */
.link-sep { height: 10px; }
[data-btn-labels="0"] .link-sep { flex-basis: 100%; height: 0; }

/* Section heading. */
.link-group-title {
  margin: 10px 0 -2px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  color: var(--dim);
  overflow-wrap: anywhere;
}
.links > .link-group-title:first-child { margin-top: 0; }
[data-btn-labels="0"] .link-group-title { flex-basis: 100%; }

/* Picture button: image with a caption; shares the link styles. */
.link-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) calc(var(--btn-opacity) * 100%), transparent);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.link-card--nolink { cursor: default; }
.link-card-media { display: block; aspect-ratio: 1 / 1; background: var(--bg); }
.link-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.link-card-caption {
  display: block;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Small picture (<= 128px): a normal tile with the picture as its icon. */
.link-card.link-card--icon {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  overflow: visible;
}
.link-card--icon .link-card-media { width: 24px; height: 24px; aspect-ratio: auto; flex: none; background: none; transition: transform 0.15s ease, scale 0.15s ease; }
.link-card--icon .link-card-media img { object-fit: contain; }
.link-card--icon .link-card-caption { flex: 1; min-width: 0; padding: 0; text-align: left; }
a.link-card--icon::after { content: "\2197"; color: var(--dim); font-size: 1rem; }
[data-btn-style="pill"] .link-card--icon { border-radius: 999px; }

/* Grid tiles: square, centred (a part-filled last row too); custom buttons and headings stay full width. */
[data-btn-labels="2"] .links {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
[data-btn-labels="2"] .links > * { flex: 0 0 100%; }
[data-btn-labels="2"] .links > .link:not(.link--custom) { flex: 0 0 136px; }
/* Phones / single column: always three across - 136px tiles only fit two. */
@media (max-width: 819.98px) {
  [data-btn-labels="2"] .links > .link:not(.link--custom) { flex-basis: calc((100% - 20px) / 3); }
}
[data-btn-labels="2"] .link-sep { height: 0; }
[data-btn-labels="2"] .link:not(.link--custom) {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1;
  min-width: 0;
  padding: 12px 8px;
  text-align: center;
}
[data-btn-labels="2"] .link:not(.link--custom) .link-left { flex-direction: column; gap: 8px; max-width: 100%; }
[data-btn-labels="2"] .link:not(.link--custom) .link-left span:not(.link-icon) { max-width: 100%; font-size: 0.9rem; }
[data-btn-labels="2"] .link:not(.link--custom) .handle { max-width: 100%; font-size: 0.78rem; }
[data-btn-labels="2"] .link:not(.link--custom) .link-icon { width: 30px; height: 30px; }
/* A capsule would turn a square tile into a circle: extra-round corners instead. */
[data-btn-labels="2"][data-btn-style="pill"] .link:not(.link--custom) { border-radius: 24px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  [data-btn-labels="2"][data-link-hover="lift"] .link:not(.link--custom):hover { transform: translateY(-2px); }
}

.empty { color: var(--dim); }

/* Location line + view-count pill. */
.location-line {
  display: flex;               /* block-level so it forces .view-count onto its own line */
  align-items: center;
  justify-content: center;
  gap: 7px;                    /* gap / size / spacing match .view-count so the two pills read as a pair */
  width: max-content;          /* pill hugs its text, then margin:auto centres it */
  max-width: 100%;
  margin: 14px auto 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) calc(var(--box-opacity) * 100%), transparent);
  border: 1px solid;
  border-color: color-mix(in srgb, var(--box-line) calc(var(--box-opacity) * 100%), transparent);
  color: var(--dim);
  font-size: 0.8rem;
  line-height: 1;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.location-line span { overflow-wrap: anywhere; letter-spacing: 0.04em; }
.meta-icon {
  width: 15px;
  height: 15px;
  flex: none;
  display: inline-block;
  background-color: var(--accent);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* Sits just below .profile, sharing its style + --box-opacity. */
.view-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 14px auto 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) calc(var(--box-opacity) * 100%), transparent);
  border: 1px solid;
  border-color: color-mix(in srgb, var(--box-line) calc(var(--box-opacity) * 100%), transparent);
  color: var(--dim);
  font-size: 0.8rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.view-count-num {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}
.view-count-label { letter-spacing: 0.04em; text-transform: lowercase; }

/* Phones: location + view count share a row. */
@media (max-width: 819.98px) {
  .location-line { display: inline-flex; }
  .location-line,
  .view-count { margin: 14px 4px 0; vertical-align: middle; }
}

@media (max-width: 560px) {
  /* room for the fixed music pill */
  body:has(> .music-player) { padding-bottom: max(100px, calc(env(safe-area-inset-bottom) + 72px)); }
}

/* Music widget; [data-state] / [data-muted] swap the icons. */
.music-player {
  position: fixed;
  left: 14px;
  bottom: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));   /* clear the iOS home indicator */
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(12, 14, 20, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
}
.music-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}
.music-btn:hover { background: rgba(255, 255, 255, 0.22); }
.music-player .i-pause,
.music-player .i-muted { display: none; }
.music-player[data-state="playing"] .i-play { display: none; }
.music-player[data-state="playing"] .i-pause { display: inline; }
.music-player[data-muted="1"] .i-vol { display: none; }
.music-player[data-muted="1"] .i-muted { display: inline; }
.music-vol {
  width: 74px;
  accent-color: var(--accent, #8a93a6);
}
@media (max-width: 480px) {
  /* Centre the control along the bottom edge on phones. */
  .music-player { left: 50%; transform: translateX(-50%); }
  .music-vol { width: 52px; }
}

/* Full-screen button: fades out, returns on pointer move or tap. */
.fs-toggle {
  position: fixed;
  top: 14px;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(12, 14, 20, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background 0.15s ease;
}
.fs-toggle.is-shown { opacity: 1; pointer-events: auto; }
.fs-toggle:hover { background: rgba(12, 14, 20, 0.6); }
.fs-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fs-toggle .fs-exit,
.fs-toggle.is-full .fs-enter { display: none; }
.fs-toggle.is-full .fs-exit { display: block; }
html.fs-idle, html.fs-idle * { cursor: none !important; }
/* No scrollbar in full screen, so the background fills the whole width. */
html.fs-on, html.fs-on body { scrollbar-width: none; }
html.fs-on::-webkit-scrollbar, html.fs-on body::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) {
  .fs-toggle { transition: none; }
}

/* Click-to-enter music gate. */
.music-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(10, 12, 18, 0.35);
  -webkit-backdrop-filter: blur(14px) saturate(0.9);
  backdrop-filter: blur(14px) saturate(0.9);
}
.music-gate.is-dismissed { display: none; }
.music-gate-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  animation: music-gate-fade 0.6s ease both;
}
.music-gate-label {
  font-family: 'Courier New', monospace;
  font-size: 24px;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
}
.music-gate-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.music-gate-btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
.music-gate-btn:hover { background: rgba(255, 255, 255, 0.18); }
.music-gate-play {
  border-color: var(--accent, #8a93a6);
  background: var(--accent, #8a93a6);
  color: var(--accent-ink, #0b0d14);   /* default slate accent: dark ink reads best */
}
.music-gate-play:hover { background: var(--accent, #8a93a6); filter: brightness(1.1); }
@keyframes music-gate-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .music-gate-box { animation: none; }
}
/* On-page toasts: notice at the top, promo at the bottom. Below the music gate. */
.page-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 55;
  width: min(420px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 16px 18px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  color: var(--text);
  transform: translate(-50%, -16px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.page-toast[hidden] { display: none; }
.page-toast.is-in { transform: translate(-50%, 0); opacity: 1; }
.page-toast.is-leaving { transform: translate(-50%, -16px); opacity: 0; }
.page-toast-body { flex: 1; min-width: 0; }
.page-toast-title { display: block; font-size: 0.95rem; font-weight: 700; }
.page-toast-text {
  margin: 3px 0 0;
  color: var(--dim);
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-line;          /* keep the owner's line breaks */
  overflow-wrap: anywhere;
}
.page-toast-title + .page-toast-text { margin-top: 4px; }
.page-toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
}
.page-toast-close:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.page-toast-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--accent);
  transform-origin: left;
}
/* The promo: from the bottom, clear of the fixed music pill when there is one. */
.page-toast--bottom {
  top: auto;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 16px));
  transform: translate(-50%, 16px);
}
/* Lift the box clear of the music pill on narrow screens. */
@media (max-width: 800px) {
  body:has(> .music-player) .page-toast--bottom { bottom: calc(env(safe-area-inset-bottom) + 76px); }
}
.page-toast--bottom.is-in { transform: translate(-50%, 0); }
.page-toast--bottom.is-leaving { transform: translate(-50%, 16px); }
.page-toast-brand { flex: none; width: 30px; height: 30px; margin-top: 2px; }
.page-toast-link { color: var(--text); font-weight: 700; text-decoration: none; }
.page-toast-link:hover { color: var(--accent2); }
@media (prefers-reduced-motion: reduce) {
  .page-toast,
  .page-toast.is-in,
  .page-toast.is-leaving { transition: opacity 0.2s ease; transform: translate(-50%, 0); }
}

/* Leaving-page confirm; reuses the music gate styles. */
.leave-gate { z-index: 70; }
.leave-gate-host {
  margin: -8px 0 0;
  max-width: min(90vw, 420px);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* Cursor trail; --dx / --dy / --r are per-dot randoms. */
.cursor-fx-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}
.cursor-fx-dot {
  position: fixed;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Trail - a plain fading dot in the accent. */
.cursor-fx-dot--trail {
  background: var(--accent, #8a93a6);
  box-shadow: 0 0 8px var(--accent, #8a93a6);
  animation: cfx-trail 0.6s ease-out forwards;
}
@keyframes cfx-trail {
  from { opacity: 0.85; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.3); }
}

/* Glitter - small bright sparks that fall and shrink. */
.cursor-fx-dot--glitter {
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  background: #fff;
  box-shadow: 0 0 6px 1px var(--accent, #8a93a6);
  animation: cfx-glitter 0.9s ease-in forwards;
}
@keyframes cfx-glitter {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to   { opacity: 0; transform: translate(calc(var(--dx, 0) * 16px), calc(20px + var(--dy, 0) * 8px)) scale(0.2); }
}

/* Sparkle - a four-point star (the span + its ::before cross) that spins out. */
.cursor-fx-dot--sparkle {
  width: 3px; height: 15px; margin: -7.5px 0 0 -1.5px;
  border-radius: 2px;
  background: var(--accent, #8a93a6);
  box-shadow: 0 0 6px var(--accent, #8a93a6);
  animation: cfx-sparkle 0.7s ease-out forwards;
}
.cursor-fx-dot--sparkle::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: 2px;
  transform: rotate(90deg);
}
@keyframes cfx-sparkle {
  from { opacity: 1; transform: rotate(var(--r, 0deg)) scale(1); }
  to   { opacity: 0; transform: rotate(calc(var(--r, 0deg) + 140deg)) scale(0.1); }
}

/* Neon glow - a bright orb with a heavy multi-layer halo. */
.cursor-fx-dot--neon {
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: color-mix(in srgb, var(--accent, #8a93a6) 70%, #fff);
  box-shadow:
    0 0 10px var(--accent, #8a93a6),
    0 0 22px var(--accent, #8a93a6),
    0 0 34px var(--accent, #8a93a6);
  animation: cfx-neon 0.55s linear forwards;
}
@keyframes cfx-neon {
  from { opacity: 0.95; transform: scale(1.1); }
  to   { opacity: 0; transform: scale(0.35); }
}

/* Glitch - an RGB-split shard that jitters sideways in steps. */
.cursor-fx-dot--glitch {
  width: 14px; height: 4px; margin: -2px 0 0 -7px;
  border-radius: 0;
  background: var(--accent, #8a93a6);
  box-shadow: 3px 0 0 rgba(255, 0, 90, 0.75), -3px 0 0 rgba(0, 255, 240, 0.75);
  animation: cfx-glitch 0.4s steps(4, end) forwards;
}
@keyframes cfx-glitch {
  from { opacity: 0.9; transform: translateX(calc(var(--dx, 0) * 4px)) scaleX(1); }
  to   { opacity: 0; transform: translateX(calc(var(--dx, 0) * 22px)) scaleX(0.2); }
}

/* Bubbles - a hollow ring that floats up and swells. */
.cursor-fx-dot--bubbles {
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--accent, #8a93a6) 80%, #fff);
  animation: cfx-bubble 1s ease-out forwards;
}
@keyframes cfx-bubble {
  from { opacity: 0.9; transform: translateY(0) scale(0.6); }
  to   { opacity: 0; transform: translateY(-28px) scale(1.3); }
}

/* Ripple - an expanding accent ring. */
.cursor-fx-dot--ripple {
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  background: transparent;
  border: 2px solid var(--accent, #8a93a6);
  animation: cfx-ripple 0.7s ease-out forwards;
}
@keyframes cfx-ripple {
  from { opacity: 0.7; transform: scale(0.3); }
  to   { opacity: 0; transform: scale(4); }
}

/* Ember - a warm spark that drifts up and flickers out (fixed palette). */
.cursor-fx-dot--ember {
  width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  background: radial-gradient(circle at 50% 40%, #fff3b0, #ff9d3c 45%, #ff4d2e 82%);
  box-shadow: 0 0 8px 2px rgba(255, 120, 40, 0.8);
  animation: cfx-ember 0.9s ease-out forwards;
}
@keyframes cfx-ember {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to   { opacity: 0; transform: translate(calc(var(--dx, 0) * 12px), -24px) scale(0.2); }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-fx-layer { display: none; }
}

/* Bigger tap targets on touch; glyphs keep their size. */
@media (pointer: coarse) {
  .music-btn { width: 40px; height: 40px; }
  .music-vol { width: 72px; height: 32px; }
  .page-toast-close { width: 40px; height: 40px; margin: -10px -10px 0 0; }
  .badge-container { padding: 5px; margin: -5px; }
}

/* ---- Stage ----
   Centre card holds the profile and links; sections sit either side, stacked in --o order when narrow. */
.stage {
  width: 100%;
  max-width: 460px;
  margin-block: auto;   /* centred between the rails */
  display: flex;
  flex-direction: column;
  gap: 22px;
  text-align: center;
}
/* Centre card stays above the side cards; a section with an open tooltip rises above it. */
.stage-centre { order: 0; min-width: 0; position: relative; z-index: 2; }
.stage-side { display: contents; }
.stage-section { position: relative; z-index: 1; }
.stage-section:has(.tip-open) { z-index: 3; }

/* Accent glow around the centre card. */
.stage .profile {
  padding: 32px 26px 18px;
  border-color: color-mix(in srgb, var(--accent) calc(var(--box-opacity) * 45%), transparent);
  box-shadow: 0 0 40px -8px color-mix(in srgb, var(--accent) 45%, transparent),
              0 20px 50px rgba(0, 0, 0, 0.45);
}
[data-box-stripe="1"] .stage .profile { border-top-color: var(--accent); }

/* Photo straddles the card's top edge. */
:root:not([data-avatar-pos="corner"]) .stage-centre { padding-top: 52px; }
:root:not([data-avatar-pos="corner"]) .stage .profile .avatar-wrap {
  z-index: 2;
  margin-top: calc(-32px - 52px);
  margin-bottom: 14px;
}

/* Social links below a thin divider. */
.stage .profile > .links {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}
.stage .profile > .empty { margin: 22px 0 0; }

/* Icon only: small round icon buttons in a centred row. */
[data-btn-labels="0"] .stage .profile > .links { gap: 10px; }
[data-btn-labels="0"] .stage .profile .link:not(.link--custom) {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}
[data-btn-labels="0"] .stage .profile .link:not(.link--custom) .link-icon { width: 20px; height: 20px; }
@media (pointer: coarse) {
  [data-btn-labels="0"] .stage .profile .link:not(.link--custom) { width: 44px; height: 44px; }
}

/* Compact grid tiles. */
[data-btn-labels="2"] .stage .profile > .links { gap: 8px; }
[data-btn-labels="2"] .stage .profile > .links > .link:not(.link--custom) { flex-basis: calc((100% - 24px) / 4); }
@media (max-width: 420px) {
  [data-btn-labels="2"] .stage .profile > .links > .link:not(.link--custom) { flex-basis: calc((100% - 16px) / 3); }
}
[data-btn-labels="2"] .stage .profile .link:not(.link--custom) {
  aspect-ratio: auto;
  gap: 4px;
  padding: 10px 6px 9px;
}
[data-btn-labels="2"] .stage .profile .link:not(.link--custom) .link-left { gap: 6px; }
[data-btn-labels="2"] .stage .profile .link:not(.link--custom) .link-icon { width: 24px; height: 24px; }
[data-btn-labels="2"] .stage .profile .link:not(.link--custom) .link-left span:not(.link-icon) { font-size: 0.78rem; }
/* Too narrow for a readable handle (long ones, e.g. emails, got cut off): icon + name only. */
[data-btn-labels="2"] .stage .profile .link:not(.link--custom) .handle { display: none; }
/* The side sections hold only custom buttons, which never become tiles. */
[data-btn-labels="2"] .stage-section .links { display: flex; flex-direction: column; }
[data-btn-labels="2"] .stage-section .links > * { flex: 0 1 auto; }

/* Footer row: view count left, location right. */
.stage-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 14px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}
.stage-meta > :is(.view-count, .location-line) {
  display: inline-flex;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  animation: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-size: 0.78rem;
}
.stage-meta > .location-line:only-child { margin-left: auto; }
/* Plain text here - no hover glow / outline from the profile box effects. */
.stage-meta > :is(.view-count, .location-line):hover { border-color: transparent; box-shadow: none; }

/* Side cards: slim buttons. */
.stage-section :is(.link--custom, .link-card--icon) { padding: 11px 14px; }
.stage-section .link-card--icon .link-card-media { width: 18px; height: 18px; }
.stage-section .link-card--icon .link-card-caption { text-align: center; font-size: 0.92rem; }
.stage-section .link--custom .link-left { flex: 1; min-width: 0; }
.stage-section .link--custom .link-left span:not(.link-icon) { flex: 1; text-align: center; font-size: 0.92rem; }
.stage-section .link--custom .link-icon { width: 18px; height: 18px; }
.stage-section .link--custom .handle { font-size: 0.85rem; opacity: 0.6; }

/* Corner photo: two floats keep the centred name clear of the photo. */
.cc-pad { display: none; }
[data-avatar-pos="corner"] .stage-centre { padding-top: var(--cc-rise); }
[data-avatar-pos="corner"] .stage .profile { text-align: center; padding-top: 20px; }
[data-avatar-pos="corner"] .stage .profile .cc-pad {
  display: block;
  float: left;
  width: calc(var(--cc-size) - var(--cc-lean) - 26px + var(--cc-gap));
  height: calc(var(--cc-size) - var(--cc-rise) - 20px);
}
[data-avatar-pos="corner"] .stage .profile .cc-pad--r { float: right; }
/* Phones: no right spacer, so long words don't break. The name sits beside
   the left spacer, not centred under it, or short names wrap early. */
@media (max-width: 480px) {
  [data-avatar-pos="corner"] .stage .profile .cc-pad--r { display: none; }
  [data-avatar-pos="corner"] .stage .profile h1 { display: flow-root; }
}
[data-avatar-pos="corner"] .stage .profile { display: flow-root; }
[data-avatar-pos="corner"] .stage .profile h1 {
  min-height: 0;   /* the spacers hold the room - a taller box would stretch a name overlay */
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  text-align: center;
  overflow-wrap: break-word;   /* break between words; not mid-word like 'anywhere' */
}
[data-avatar-pos="corner"] .stage .profile h1 + * { clear: both; }

/* Section cards follow the profile card style. */
.stage-section {
  order: var(--o, 1);
  min-width: 0;
  padding: 18px 16px 16px;
  border: 1px solid;
  border-color: color-mix(in srgb, var(--box-line) calc(var(--box-opacity) * 100%), transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) calc(var(--box-opacity) * 100%), transparent);
}
.stage-section-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.stage-section .links { gap: 10px; }
/* Picture buttons as a wide strip, not a big square, to keep the columns short. */
.stage-section .link-card:not(.link-card--icon) .link-card-media { aspect-ratio: 16 / 9; }
.stage-section .link-card-caption { padding: 10px 14px; }

/* Section cards share the box effects. */
.stage-section { transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
[data-box-hover="tilt"] .stage-section { transition: transform 0.2s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
@media (hover: hover) {
  [data-box-outline] .stage-section:hover { border-color: var(--accent); }
  [data-box-glow]    .stage-section:hover {
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent),
                0 0 46px color-mix(in srgb, var(--accent) 22%, transparent);
  }
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  [data-box-hover="lift"] .stage-section:hover { transform: translateY(-1px); }
  [data-box-hover="zoom"] .stage-section:hover { transform: scale(1.02); }
}
[data-box-neon="1"] .stage-section {
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 42%, transparent),
              0 0 50px color-mix(in srgb, var(--accent) 20%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  [data-box-neon="1"] .stage-section { animation: fx-neon-box 2.6s ease-in-out infinite; }
}

/* Entrance: centre card then each section drops in, staggered by --o. */
@media (prefers-reduced-motion: no-preference) {
  .stage-centre  { animation: l3-card-in 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) backwards; }
  .stage-section { animation: l3-card-in 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) calc(var(--o, 1) * 0.15s) backwards; }
  [data-box-neon="1"] .stage-section {
    animation: l3-card-in 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) calc(var(--o, 1) * 0.15s) backwards,
               fx-neon-box 2.6s ease-in-out infinite;
  }
}
@keyframes l3-card-in {
  from { opacity: 0; transform: translateY(-50px); }
}

[data-box-style="sharp"]   .stage-section { border-radius: 4px; }
[data-box-style="outline"] .stage-section { background: transparent; }
[data-box-style="shadow"]  .stage-section { border-color: transparent; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4); }
[data-box-style="glass"]   .stage-section {
  border-radius: 20px;
  background: rgba(10, 12, 18, calc(var(--box-opacity) * 0.45));
  border-color: rgba(255, 255, 255, calc(var(--box-opacity) * 0.12));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/* Wide screens: side columns either side of the centre card. */
@media (min-width: 1080px) {
  .stage--sides-1,
  .stage--sides-2 {
    display: grid;
    align-items: center;
    justify-content: center;
    column-gap: 22px;
    max-width: none;
  }
  /* One side: an empty left track the same width keeps the centre card centred. */
  .stage--sides-1,
  .stage--sides-2 { grid-template-columns: 260px minmax(0, 460px) 260px; }
  .stage-side { display: flex; flex-direction: column; gap: 14px; grid-row: 1; }
  .stage-centre { grid-row: 1; }
  .stage--sides-2 .stage-side--left  { grid-column: 1; }
  .stage--sides-2 .stage-centre      { grid-column: 2; }
  .stage--sides-2 .stage-side--right { grid-column: 3; }
  .stage--sides-1 .stage-centre      { grid-column: 2; }
  .stage--sides-1 .stage-side--right { grid-column: 3; }
}