/* ==========================================================================
   Nova Link public profile (profile-frame.html), owner: profile-core.
   Self-contained: the frame does not load ui/tokens.css or dashboard CSS.

   JS API (set by profile-frame.js, keep names):
   - CSS vars on <html>: --text --accent --bg --icon --opacity --blur --radius
     --link-size --align --justify --link-justify --dim --card-width
     --avatar-size --border-color --border-width --effect-color --cursor-color
     --sparkle-color --badge-color --profile-font --font-scale --letter-spacing
     --glass-rgb (r g b of the card tint) --on-accent (text on accent fills).
   - body[data-*]: layout nick effect enter enter-style cursor border
     avatar-frame avatar-shape link-hover link-tooltips font font-scale
     letter-spacing tilt audio-player badge-mono presence mode, plus
     glass gradient decoration title-motion glow-name glow-socials
     glow-badges mono cycle badge-position has-badges link-layout entered
     enter-screen has-media has-banner tone contrast, host (overlay = the
     dashboard's full-screen draft preview).
   - Per link: .link[data-mode=link|copy][data-brand] with --button-accent,
     --button-opacity, --link-radius, --glyph (icon colour), --mask.
   Effects (ui/profile-fx.css, frame-fx.js, frame-text.js) load after this
   file and are unlayered, so they override anything in @layer frame.
   #card::before is used here only for data-border=default; #card::after and
   any data-border other than "default" belong to profile-fx.
   Also profile-fx's, never styled here: #effect inside #backdrop (its ambient
   layer, .fx-ambient), #fxSurface appended to #card (border ring + tilt
   glare; kept out of the entrance stagger), #avatarWrap::before/::after
   (avatar frames on the tight #avatarWrap box, shape via --avatar-radius) and
   the name glow (body[data-glow-name]).
   Zero !important. [hidden] and reduced motion stay unlayered on purpose.
   ========================================================================== */

[hidden] { display: none; }

@layer frame {
  :root {
    --text: #ffffff;
    --accent: #ff7a1a;
    --bg: #0a0908;
    --icon: #ffffff;
    --opacity: .28;
    --blur: 20px;
    --radius: 28px;
    --link-size: 44px;
    --align: center;
    --justify: center;
    --link-justify: center;
    --dim: .2;
    --card-width: 560px;
    --avatar-size: 112px;
    --border-color: var(--accent);
    --border-width: 1px;
    --badge-color: var(--accent);
    --profile-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-scale: 1;
    --letter-spacing: 0em;
    --glass-rgb: 12 11 10;
    --on-accent: #160b03;

    --text-2: color-mix(in srgb, var(--text) 80%, transparent);
    --text-3: color-mix(in srgb, var(--text) 60%, transparent);
    --line: color-mix(in srgb, var(--text) 11%, transparent);
    --line-strong: color-mix(in srgb, var(--text) 20%, transparent);
    --tile: color-mix(in srgb, var(--text) 6%, transparent);
    --tile-hover: color-mix(in srgb, var(--text) 11%, transparent);
    --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --spring: cubic-bezier(.34, 1.56, .64, 1);
    --pad-x: 32px;
    --pad-y: 34px;
    --chrome-bg: rgb(14 13 12 / .58);
    --chrome-line: rgb(255 255 255 / .12);
    color-scheme: dark;
    min-height: 100%;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

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

  body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    color: var(--text);
    background: var(--bg);
    font: 400 calc(15px * var(--font-scale)) / 1.55 var(--profile-font);
    letter-spacing: var(--letter-spacing);
    overflow-wrap: anywhere;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
  }

  body[data-tone="light"] { color-scheme: light; }

  button, a, input { -webkit-tap-highlight-color: transparent; }
  button, a { touch-action: manipulation; }
  button { font: inherit; color: inherit; }
  img { max-width: 100%; }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgb(0 0 0 / .55);
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  /* ---- Backdrop ---------------------------------------------------------- */
  #backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background: var(--bg);
    pointer-events: none;
  }

  #ambient,
  #backgroundImage,
  #backgroundVideo,
  #backgroundDim,
  #fxCanvas,
  #vignette {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }

  /* Default ambience so an empty profile is never flat black. */
  #ambient {
    inset: -15%;
    width: auto;
    height: auto;
    background:
      radial-gradient(48vmax 34vmax at 50% 28%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
      radial-gradient(36vmax 30vmax at 12% 86%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 70%),
      radial-gradient(32vmax 28vmax at 90% 72%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
    animation: nfAmbient 26s ease-in-out infinite alternate;
    will-change: transform;
  }

  body[data-tone="light"] #ambient { opacity: .55; }
  body[data-has-media="true"] #ambient { display: none; }

  #backgroundImage {
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
  }

  #backgroundVideo {
    object-fit: cover;
    opacity: 0;
    transition: opacity .8s ease;
  }

  #backgroundVideo.is-ready { opacity: 1; }

  #youtubeBackground {
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100vw, 177.78vh);
    height: max(100vh, 56.25vw);
    border: 0;
    background: #000;
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 0;
    transition: opacity .8s ease;
  }

  #youtubeBackground.is-ready { opacity: 1; }

  #backgroundDim {
    background: #000;
    opacity: var(--dim);
  }

  body[data-has-media="false"] #backgroundDim { display: none; }

  #fxCanvas { display: block; }

  /* Readability scrim: darker edges and a soft pool behind the content. */
  #vignette {
    display: none;
    background:
      radial-gradient(60% 55% at 50% 50%, rgb(0 0 0 / .26), transparent 75%),
      radial-gradient(120% 90% at 50% 50%, transparent 55%, rgb(0 0 0 / .5) 100%);
  }

  body[data-has-media="true"] #vignette { display: block; }

  #cursorLayer {
    position: fixed;
    inset: 0;
    z-index: 65;
    pointer-events: none;
    overflow: hidden;
  }

  /* ---- Stage --------------------------------------------------------------- */
  #stage {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-height: 100svh;
    padding:
      max(64px, calc(env(safe-area-inset-top) + 56px))
      max(16px, env(safe-area-inset-right))
      max(16px, calc(env(safe-area-inset-bottom) + 12px))
      max(16px, env(safe-area-inset-left));
  }

  body[data-mode="preview"] #stage { padding-top: 40px; }
  /* Dashboard draft preview (profile-frame.html?host=overlay): leave room for the host's close bar. */
  body[data-mode="preview"][data-host="overlay"] #stage { padding-top: max(76px, calc(env(safe-area-inset-top) + 68px)); }

  #foot {
    display: flex;
    justify-content: center;
    padding-top: 28px;
  }

  /* Site chrome (r181 unslop): a quiet tag, control radius, regular tracking, one quick colour change. */
  #watermark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px 0 8px;
    border-radius: 10px;
    color: rgb(255 255 255 / .62);
    background: rgb(10 9 8 / .32);
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .08);
    font: 500 12px/1 var(--ui-font);
    letter-spacing: 0;
    text-decoration: none;
    transition: color 120ms cubic-bezier(.22, 1, .36, 1), background-color 120ms cubic-bezier(.22, 1, .36, 1);
  }

  #watermark:hover { color: #fff; background: rgb(10 9 8 / .55); }
  #watermark img { width: 16px; height: 16px; flex: none; }
  body[data-tone="light"][data-has-media="false"] #watermark { color: rgb(20 14 10 / .6); background: rgb(255 255 255 / .45); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); }

  /* ---- Card ---------------------------------------------------------------- */
  #card {
    --card-fill: rgb(var(--glass-rgb) / var(--opacity));
    position: relative;
    z-index: 1;
    width: min(var(--card-width), 100%);
    margin-block: auto;
    padding: var(--pad-y) var(--pad-x) calc(var(--pad-y) - 6px);
    border-radius: var(--radius);
    isolation: isolate;
    text-align: var(--align);
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--text) 7%, transparent), transparent 38%),
      var(--card-tint, linear-gradient(transparent, transparent)),
      var(--card-fill);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.4);
    backdrop-filter: blur(var(--blur)) saturate(1.4);
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / .14),
      0 1px 2px rgb(0 0 0 / .22),
      0 28px 70px -22px rgb(0 0 0 / .62),
      0 0 110px -50px color-mix(in srgb, var(--accent) 70%, transparent);
  }

  body[data-tone="light"] #card {
    box-shadow:
      inset 0 1px 0 rgb(255 255 255 / .6),
      0 1px 2px rgb(0 0 0 / .08),
      0 28px 60px -28px rgb(40 24 12 / .35);
  }

  /* Gradient hairline border (default border style only). */
  body[data-border="default"] #card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    padding: var(--border-width);
    border-radius: inherit;
    background: linear-gradient(160deg,
      rgb(255 255 255 / .34),
      rgb(255 255 255 / .07) 32%,
      rgb(255 255 255 / .04) 62%,
      color-mix(in srgb, var(--border-color) 55%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    pointer-events: none;
  }

  body[data-tone="light"][data-border="default"] #card::before {
    background: linear-gradient(160deg, rgb(255 255 255 / .9), rgb(0 0 0 / .06) 50%, color-mix(in srgb, var(--border-color) 45%, transparent));
  }

  body[data-gradient="true"] #card {
    --card-tint: linear-gradient(140deg, color-mix(in srgb, var(--accent) 24%, transparent), transparent 68%);
  }

  body[data-glass="solid"] #card {
    --card-fill: color-mix(in srgb, var(--bg) 90%, var(--text));
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  body[data-glass="clear"] #card,
  body[data-layout="minimal"] #card {
    --card-fill: transparent;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  body[data-glass="clear"] #card::before,
  body[data-layout="minimal"] #card::before { content: none; }

  body[data-has-media="true"] #card { text-shadow: 0 1px 2px rgb(0 0 0 / .28); }
  body[data-has-media="true"][data-layout="minimal"] #card,
  body[data-has-media="true"][data-glass="clear"] #card { text-shadow: 0 1px 14px rgb(0 0 0 / .6), 0 1px 2px rgb(0 0 0 / .5); }
  body[data-contrast="adjusted"] #card { text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
  body[data-tone="light"][data-has-media="false"] #card { text-shadow: none; }

  /* ---- Banner -------------------------------------------------------------- */
  #banner {
    position: relative;
    height: 150px;
    margin: calc(var(--pad-y) * -1) calc(var(--pad-x) * -1) 0;
    border-radius: max(0px, calc(var(--radius) - 1px)) max(0px, calc(var(--radius) - 1px)) 0 0;
    overflow: hidden;
    background:
      radial-gradient(70% 120% at 85% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
      linear-gradient(135deg, color-mix(in srgb, var(--accent) 60%, #000) 0%, color-mix(in srgb, var(--accent) 22%, #000) 100%);
    background-size: cover;
    background-position: center;
  }

  #banner.has-image { background-color: rgb(var(--glass-rgb)); }

  #banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgb(var(--glass-rgb) / .5));
  }

  body[data-layout="minimal"] #banner,
  body[data-glass="clear"] #banner {
    margin: 0 0 4px;
    border-radius: var(--radius);
  }

  body[data-layout="sleek"] #banner { height: 168px; }

  /* ---- Head: avatar + identity --------------------------------------------- */
  #head {
    display: flex;
    flex-direction: column;
    align-items: var(--justify);
    gap: 16px;
  }

  #avatarWrap {
    --avatar-radius: 50%;
    position: relative;
    flex: none;
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: var(--avatar-radius);
  }

  body[data-has-banner="true"] #avatarWrap { margin-top: calc(var(--avatar-size) * -.5); }
  body[data-avatar-shape="rounded"] #avatarWrap { --avatar-radius: 28%; }
  body[data-avatar-shape="square"] #avatarWrap { --avatar-radius: 12%; }

  #avatar,
  #avatarMono {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--avatar-radius);
  }

  #avatar {
    object-fit: cover;
    background: rgb(var(--glass-rgb) / .7);
    box-shadow: 0 0 0 1px rgb(255 255 255 / .1), 0 14px 34px -12px rgb(0 0 0 / .7);
  }

  body[data-has-banner="true"] #avatar,
  body[data-has-banner="true"] #avatarMono {
    box-shadow: 0 0 0 4px rgb(var(--glass-rgb) / .92), 0 14px 34px -12px rgb(0 0 0 / .7);
  }

  #avatarMono {
    display: grid;
    place-items: center;
    color: var(--on-accent);
    background:
      radial-gradient(120% 120% at 28% 18%, color-mix(in srgb, var(--accent) 50%, #fff) 0%, var(--accent) 46%, color-mix(in srgb, var(--accent) 55%, #000) 100%);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), inset 0 -10px 24px rgb(0 0 0 / .18), 0 14px 34px -12px color-mix(in srgb, var(--accent) 60%, #000);
    font: 750 calc(var(--avatar-size) * .42) / 1 var(--profile-font);
    letter-spacing: -.02em;
    text-shadow: none;
    user-select: none;
  }

  #presenceDot {
    --dot: max(14px, calc(var(--avatar-size) * .17));
    position: absolute;
    right: calc(var(--avatar-size) * .146 - var(--dot) / 2);
    bottom: calc(var(--avatar-size) * .146 - var(--dot) / 2);
    z-index: 3;
    width: var(--dot);
    height: var(--dot);
    border-radius: 50%;
    background: var(--status, #80848e);
    box-shadow: 0 0 0 3px rgb(var(--glass-rgb)), 0 0 12px color-mix(in srgb, var(--status, #80848e) 60%, transparent);
  }

  body[data-avatar-shape="rounded"] #presenceDot,
  body[data-avatar-shape="square"] #presenceDot { right: -4px; bottom: -4px; }

  #presenceDot[data-status="online"] { --status: #23a55a; }
  #presenceDot[data-status="idle"] { --status: #f0b232; }
  #presenceDot[data-status="dnd"] { --status: #f23f43; }
  #presenceDot[data-status="offline"] { --status: #80848e; }

  #identity {
    display: flex;
    flex-direction: column;
    align-items: var(--justify);
    gap: 6px;
    min-width: 0;
    max-width: 100%;
  }

  #nameRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: var(--justify);
    gap: 8px 12px;
    max-width: 100%;
  }

  #name {
    margin: 0;
    min-width: 0;
    color: var(--text);
    font-size: calc(clamp(28px, 1.3vw + 22px, 40px) * var(--font-scale));
    font-weight: 760;
    line-height: 1.12;
    letter-spacing: calc(-.025em + var(--letter-spacing));
  }

  #nameText { display: inline-block; max-width: 100%; }

  #handle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: var(--justify);
    gap: 4px 8px;
    margin: 0;
    color: var(--text-3);
    font: 500 calc(13.5px * var(--font-scale)) / 1.3 var(--mono);
    letter-spacing: 0;
  }

  /* ---- Badges (inline capsule, tooltips via #tip) --------------------------- */
  #badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    max-width: 100%;
    padding: 4px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--text) 7%, transparent);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  #badges.is-orbit {
    position: absolute;
    z-index: 4;
    padding: 3px 4px;
    background: rgb(var(--glass-rgb) / .85);
    box-shadow: inset 0 0 0 1px var(--line), 0 6px 16px -6px rgb(0 0 0 / .6);
  }

  body[data-badge-position="top-right"] #badges.is-orbit { top: -6px; right: -12px; }
  body[data-badge-position="bottom-left"] #badges.is-orbit { bottom: -6px; left: -12px; }

  .badge {
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    cursor: default;
  }

  .badge:focus-visible { outline-offset: 2px; }

  .badge-more {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 0;
    border-radius: 999px;
    color: var(--text-2);
    background: color-mix(in srgb, var(--text) 12%, transparent);
    font: 700 11px/1 var(--ui-font);
    cursor: pointer;
  }

  .badge-more:hover { color: var(--text); background: color-mix(in srgb, var(--text) 18%, transparent); }
  body[data-glow-badges="true"] .badge .nb-medal { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent)); }

  /* ---- Bio and meta --------------------------------------------------------- */
  #bio {
    margin: 14px 0 0;
    color: var(--text-2);
    font-size: calc(15.5px * var(--font-scale));
    line-height: 1.6;
    white-space: pre-wrap;
  }

  body[data-align="center"] #bio { margin-inline: auto; max-width: 46ch; }

  #meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: var(--justify);
    gap: 6px 16px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    color: var(--text-3);
    font-size: calc(13px * var(--font-scale));
    line-height: 1.3;
  }

  #meta li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 20px;
    white-space: nowrap;
  }

  /* r180: a long location wraps inside the card instead of widening the page on a phone. */
  #meta #location { max-width: 100%; min-width: 0; white-space: normal; }
  #meta #location > span { min-width: 0; overflow-wrap: anywhere; }

  #meta svg {
    width: 15px;
    height: 15px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .9;
  }

  #meta .meta-value { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

  /* ---- Links ---------------------------------------------------------------- */
  #links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: var(--link-justify);
    gap: 10px;
    margin-top: 24px;
  }

  #links:empty { display: none; }

  .link {
    --glyph: var(--icon);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--link-size);
    height: var(--link-size);
    padding: 0;
    border: 0;
    border-radius: var(--link-radius, 14px);
    color: var(--icon);
    background: color-mix(in srgb, var(--button-accent, var(--accent)) var(--button-opacity, 10%), var(--tile));
    box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgb(255 255 255 / .06);
    text-decoration: none;
    cursor: pointer;
    transition: transform .28s var(--ease), background-color .2s ease, box-shadow .28s var(--ease), color .2s ease;
  }

  .link:hover { background-color: color-mix(in srgb, var(--button-accent, var(--accent)) var(--button-opacity, 10%), var(--tile-hover)); box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 1px 0 rgb(255 255 255 / .08); }
  .link:active { transform: scale(.96); }
  .link[data-glass="solid"] { background: var(--button-accent, var(--accent)); --glyph: var(--on-accent); color: var(--on-accent); }
  .link[data-glass="clear"] { background: none; box-shadow: none; }

  .link-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: calc(var(--link-size) * .52);
    height: calc(var(--link-size) * .52);
  }

  .glyph {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--glyph);
    -webkit-mask: var(--mask) center / contain no-repeat;
    mask: var(--mask) center / contain no-repeat;
  }

  .link .icon-img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
  .link .letter { color: var(--glyph); font-size: calc(var(--link-size) * .42); font-weight: 750; line-height: 1; }
  .link .link-svg { width: 100%; height: 100%; color: var(--glyph); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

  body[data-glow-socials="true"] .link-icon { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--glyph) 55%, transparent)); }

  .link-text { display: none; min-width: 0; }
  .link-go { display: none; }

  body[data-link-layout="buttons"] #links {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body[data-link-layout="buttons"] .link {
    width: 100%;
    height: auto;
    min-height: 58px;
    justify-content: flex-start;
    gap: 14px;
    padding: 9px 16px 9px 9px;
    color: var(--text);
    text-align: left;
  }

  body[data-link-layout="buttons"] .link-icon {
    width: 40px;
    height: 40px;
    padding: 9px;
    border-radius: max(8px, calc(var(--link-radius, 14px) * .72));
    background: color-mix(in srgb, var(--glyph) 13%, transparent);
  }

  body[data-link-layout="buttons"] .link .letter { font-size: 18px; }

  body[data-link-layout="buttons"] .link-text {
    display: grid;
    flex: 1;
    gap: 2px;
  }

  .link .label {
    overflow: hidden;
    color: var(--text);
    font-size: calc(15px * var(--font-scale));
    font-weight: 650;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .link .sub {
    overflow: hidden;
    color: var(--text-3);
    font: 500 calc(12px * var(--font-scale)) / 1.25 var(--mono);
    letter-spacing: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  body[data-link-layout="buttons"] .link-go {
    display: block;
    flex: none;
    width: 18px;
    height: 18px;
    color: var(--text-3);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .28s var(--ease), color .2s ease;
  }

  body[data-link-layout="buttons"] .link:hover .link-go { color: var(--text); transform: translate(2px, -2px); }
  body[data-link-layout="buttons"] .link[data-mode="copy"]:hover .link-go { transform: scale(1.08); }

  body[data-layout="stack"] #links { gap: 12px; }
  body[data-layout="stack"] .link { min-height: 62px; }

  /* ---- Tooltip and toast ----------------------------------------------------- */
  #tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 70;
    max-width: min(260px, calc(100vw - 24px));
    padding: 7px 11px;
    border-radius: 10px;
    color: #f6f1ec;
    background: rgb(16 14 13 / .96);
    box-shadow: 0 10px 28px -8px rgb(0 0 0 / .7), inset 0 0 0 1px rgb(255 255 255 / .09);
    font: 600 12.5px/1.3 var(--ui-font);
    letter-spacing: .01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    opacity: 0;
    transform: translate3d(var(--x, -999px), calc(var(--y, -999px) + 4px), 0) scale(.96);
    transition: opacity .14s ease, transform .18s var(--ease);
  }

  #tip.is-on {
    opacity: 1;
    transform: translate3d(var(--x, -999px), var(--y, -999px), 0);
  }

  #toast {
    position: fixed;
    left: 50%;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    z-index: 80;
    max-width: calc(100vw - 32px);
    padding: 11px 16px;
    border-radius: 14px;
    color: #f6f1ec;
    background: rgb(16 14 13 / .95);
    box-shadow: 0 16px 40px -10px rgb(0 0 0 / .7), inset 0 0 0 1px rgb(255 255 255 / .09);
    font: 600 13.5px/1.35 var(--ui-font);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 10px);
    transition: opacity .2s ease, transform .25s var(--ease);
  }

  #toast.is-on { opacity: 1; transform: translate(-50%, 0); }
  #toast:empty { display: none; }

  /* ---- Host chrome (public mode) --------------------------------------------- */
  /* Site chrome, not the owner's design (r181 unslop): Nova Link's quiet ramp, one easing curve, a 1.5
     stroke, a press of .98, a solid menu with a hairline and a soft neutral shadow (it floats over the page). */
  #chrome {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    z-index: 30;
    display: flex;
    gap: 8px;
    font-family: var(--ui-font);
  }

  .chrome-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: rgb(255 255 255 / .86);
    background: var(--chrome-bg);
    box-shadow: inset 0 0 0 1px var(--chrome-line), 0 6px 18px -8px rgb(0 0 0 / .6);
    cursor: pointer;
    transition: color 120ms cubic-bezier(.22, 1, .36, 1), background-color 120ms cubic-bezier(.22, 1, .36, 1), transform 120ms cubic-bezier(.22, 1, .36, 1);
  }

  .chrome-btn:hover { color: #fff; background: rgb(24 22 20 / .78); }
  .chrome-btn:active { transform: scale(.98); }
  .chrome-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

  .chrome-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    margin: 0;
    padding: 4px;
    border-radius: 14px;
    background: #1b1a18;
    box-shadow: 0 12px 32px -12px rgb(0 0 0 / .55), inset 0 0 0 1px rgb(239 233 227 / .1);
    list-style: none;
    transform-origin: top right;
    animation: nfMenu 180ms cubic-bezier(.22, 1, .36, 1);
  }

  .chrome-menu a,
  .chrome-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    color: #efe9e3;
    background: none;
    font: 500 14px/1.2 var(--ui-font);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
  }

  .chrome-menu a:hover,
  .chrome-menu button:hover,
  .chrome-menu a:focus-visible,
  .chrome-menu button:focus-visible { background: #262422; box-shadow: none; outline-offset: -2px; }

  .chrome-menu svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .72; }
  .chrome-menu .is-danger { color: #ff6b61; }
  .chrome-menu hr { height: 1px; margin: 4px 8px; border: 0; background: rgb(239 233 227 / .08); }
  .chrome-menu .menu-hint { margin-left: auto; color: #a0978d; font-size: 12px; }

  /* ---- Enter screen ----------------------------------------------------------- */
  #enter {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 24px;
    color: #fff;
    background: rgb(8 7 6 / .42);
    -webkit-backdrop-filter: blur(22px) saturate(1.2);
    backdrop-filter: blur(22px) saturate(1.2);
    font-family: var(--profile-font);
    cursor: pointer;
    transition: opacity .75s var(--ease), visibility .75s, -webkit-backdrop-filter .75s ease, backdrop-filter .75s ease;
  }

  #enter:focus-visible { outline: 0; box-shadow: none; }
  #enter:focus-visible .enter-inner { outline: 2px solid var(--accent); outline-offset: 10px; border-radius: 18px; }
  body[data-enter-style="dark"] #enter { background: rgb(6 5 4 / .94); -webkit-backdrop-filter: none; backdrop-filter: none; }
  body[data-enter-style="glass"] #enter { background: rgb(8 7 6 / .2); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  body[data-enter-style="minimal"] #enter { background: var(--bg); color: var(--text); -webkit-backdrop-filter: none; backdrop-filter: none; }
  /* Light profiles: the white enter text needs a darker veil to stay readable. */
  body[data-tone="light"][data-enter-style="blur"] #enter { background: rgb(8 7 6 / .56); }
  body[data-tone="light"][data-enter-style="glass"] #enter { background: rgb(8 7 6 / .26); }

  #enter.is-leaving {
    opacity: 0;
    visibility: hidden;
    -webkit-backdrop-filter: blur(0) saturate(1);
    backdrop-filter: blur(0) saturate(1);
    pointer-events: none;
  }

  .enter-inner {
    display: grid;
    justify-items: center;
    gap: 12px;
    max-width: min(560px, 100%);
    text-align: center;
    transition: transform .75s var(--ease);
  }

  #enter.is-leaving .enter-inner { transform: scale(1.06); }

  body[data-enter-style="glass"] .enter-inner {
    padding: 30px 40px 28px;
    border-radius: 26px;
    background: rgb(255 255 255 / .07);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    backdrop-filter: blur(24px) saturate(1.3);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .18), inset 0 0 0 1px rgb(255 255 255 / .1), 0 30px 60px -20px rgb(0 0 0 / .6);
  }

  body[data-tone="light"][data-enter-style="glass"] .enter-inner { background: rgb(18 13 10 / .5); }

  .enter-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 4px;
    border-radius: 50%;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 34px -4px color-mix(in srgb, var(--accent) 55%, transparent);
    animation: nfPing 2.4s var(--ease) infinite;
  }

  .enter-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  body[data-enter-style="minimal"] .enter-icon { display: none; }

  #enterText {
    font-size: calc(clamp(17px, .6vw + 14px, 22px) * var(--font-scale));
    font-weight: 650;
    line-height: 1.3;
    letter-spacing: calc(.14em + var(--letter-spacing));
    text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 55%, transparent);
    animation: nfBreathe 2.8s ease-in-out infinite;
  }

  #enterSubtext {
    max-width: 44ch;
    color: rgb(255 255 255 / .66);
    font-size: calc(13.5px * var(--font-scale));
    line-height: 1.5;
    letter-spacing: .02em;
  }

  body[data-enter-style="minimal"] #enterSubtext { color: var(--text-3); }
  body[data-enter-style="minimal"] #enterText { text-shadow: none; }

  #enter.is-preview { cursor: default; }
  /* Release 172: the example label repeated on the enter screen (the page's own label is hidden until entering). */
  #enter .enter-badge, #enter .enter-showcase {
    position: absolute;
    top: 14px;
    left: 50%;
    padding: 5px 10px;
    border-radius: 999px;
    color: rgb(255 255 255 / .75);
    background: rgb(0 0 0 / .35);
    font: 600 11px/1 var(--ui-font);
    letter-spacing: .06em;
    text-transform: uppercase;
    transform: translateX(-50%);
  }
  #enter .enter-showcase { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); text-transform: none; letter-spacing: .02em; white-space: nowrap; }
  #enter .enter-showcase[hidden] { display: none; }

  /* Hide the profile until the visitor enters (only when an entrance animation follows). */
  body[data-enter-screen="true"][data-entered="false"]:not([data-enter="none"]) #card,
  body[data-enter-screen="true"][data-entered="false"]:not([data-enter="none"]) #foot { opacity: 0; }

  /* ---- Entrance animations (after nova:frame-enter) ---------------------------
     Children are listed explicitly, so #fxSurface and anything else another
     module appends to #card never get a stagger animation (--i comes from
     profile-frame.js stagger()). */
  body[data-entered="true"][data-enter="fade"] #card { animation: nfFade .7s ease both; }
  body[data-entered="true"][data-enter="rise"] #card { animation: nfRise .8s var(--ease) both; }
  body[data-entered="true"][data-enter="pop"] #card { animation: nfPop .7s var(--spring) both; }
  body[data-entered="true"][data-enter="unfold"] #card { animation: nfUnfold .9s var(--ease) both; transform-origin: 50% 0; }
  body[data-entered="true"][data-enter="blur"] #card { animation: nfFade .6s ease both; }
  body[data-entered="true"][data-enter="blur"] :is(#banner, #head, #bio, #meta, #links, #widgets, #audioPanel) { animation: nfBlurIn .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }

  body[data-entered="true"]:not([data-enter="none"]):not([data-enter="blur"]) :is(#head, #bio, #meta, #links, #widgets, #audioPanel) {
    animation: nfChild .7s var(--ease) both;
    animation-delay: calc(140ms + var(--i, 0) * 60ms);
  }

  body[data-entered="true"]:not([data-enter="none"]) #foot { animation: nfFade 1s ease .5s both; }

  /* ---- Layout: sleek (banner top, left-aligned header) ----------------------- */
  body[data-layout="sleek"] #card { text-align: left; }
  body[data-layout="sleek"] #head { flex-direction: row; align-items: flex-start; gap: 18px; }
  body[data-layout="sleek"] #identity { align-items: flex-start; padding-top: 14px; }
  body[data-layout="sleek"] #nameRow,
  body[data-layout="sleek"] #handle,
  body[data-layout="sleek"] #meta { justify-content: flex-start; }
  body[data-layout="sleek"] #links { justify-content: flex-start; }
  body[data-layout="sleek"] #bio { margin-inline: 0; max-width: none; }
  body[data-layout="sleek"] #name { font-size: calc(clamp(26px, 1.1vw + 20px, 36px) * var(--font-scale)); }

  /* ---- Layout: stack (wide card, full-width buttons) -------------------------- */
  body[data-layout="stack"] #card { width: min(max(var(--card-width), 620px), 100%); }

  /* ---- Layout: minimal -------------------------------------------------------- */
  body[data-layout="minimal"] #card { --pad-x: 8px; }
  /* A drawn card border (profile-fx #fxSurface ring) needs breathing room around the tiles. */
  body[data-layout="minimal"]:is([data-border="static"], [data-border="dashed"], [data-border="shimmer"], [data-border="pulse"], [data-border="gradient"]) #card { --pad-x: 20px; }

  /* ---- Widgets: Discord presence + clock (frame-widgets.js) ------------------- */
  #widgets {
    display: grid;
    /* Bounded column: a long one-line activity (nowrap + ellipsis) must not widen the tiles past the card. */
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-top: 22px;
    text-align: left;
  }

  .tile {
    position: relative;
    border-radius: max(12px, calc(var(--radius) * .62));
    background: var(--tile);
    box-shadow: inset 0 0 0 1px var(--line);
  }

  body[data-layout="minimal"] .tile,
  body[data-glass="clear"] .tile { background: rgb(var(--glass-rgb) / .45); }

  .pc {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .pc-user {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }

  .pc-ava {
    position: relative;
    flex: none;
    width: 44px;
    height: 44px;
  }

  .pc-ava img,
  .pc-ava .pc-ava-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: color-mix(in srgb, var(--accent) 30%, rgb(var(--glass-rgb)));
  }

  .pc-ava-fallback { display: grid; place-items: center; color: var(--text); font-weight: 700; }

  .pc-ava i {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--status, #80848e);
    box-shadow: 0 0 0 3px rgb(var(--glass-rgb));
  }

  .pc-ava i[data-status="online"], .pc-dot[data-status="online"] { --status: #23a55a; }
  .pc-ava i[data-status="idle"], .pc-dot[data-status="idle"] { --status: #f0b232; }
  .pc-ava i[data-status="dnd"], .pc-dot[data-status="dnd"] { --status: #f23f43; }

  .pc-who { display: grid; min-width: 0; flex: 1; gap: 1px; }
  .pc-name { overflow: hidden; color: var(--text); font-weight: 680; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
  .pc-status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12.5px; }
  .pc-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--status, #80848e); }

  .pc-logo { width: 20px; height: 20px; flex: none; color: var(--text-3); fill: currentColor; opacity: .8; }

  .pc-sample {
    padding: 3px 7px;
    border-radius: 999px;
    color: var(--text-3);
    background: color-mix(in srgb, var(--text) 8%, transparent);
    font: 600 10.5px/1.2 var(--ui-font);
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
  }

  .pc-act {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
  }

  .pc-art {
    position: relative;
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 55%, #000), color-mix(in srgb, var(--accent) 18%, #000));
    box-shadow: inset 0 0 0 1px var(--line);
  }

  .pc-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .pc-art svg { position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; color: rgb(255 255 255 / .85); fill: currentColor; }
  .pc-art.is-spotify svg { color: #1ed760; }
  .pc-art .glyph { position: absolute; inset: 0; width: 44%; height: 44%; margin: auto; }
  .pc-art.is-spotify { background: linear-gradient(140deg, #1c2a20, #0c120e); }

  .pc-lines { display: grid; gap: 2px; min-width: 0; flex: 1; }
  .pc-kicker { color: var(--text-3); font: 650 11px/1.2 var(--ui-font); letter-spacing: .06em; text-transform: uppercase; }
  .pc-title { overflow: hidden; color: var(--text); font-weight: 650; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }
  .pc-sub { overflow: hidden; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }

  .pc-bar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--text-3);
    font: 500 11px/1 var(--mono);
    font-variant-numeric: tabular-nums;
  }

  .pc-bar b {
    position: relative;
    height: 4px;
    border-radius: 99px;
    overflow: hidden;
    background: color-mix(in srgb, var(--text) 14%, transparent);
  }

  .pc-bar b::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 0) * 100%);
    border-radius: inherit;
    background: #1ed760;
  }

  /* Compact presence: one row pill. */
  .pc.is-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 999px;
  }

  .pc.is-compact .pc-art { width: 28px; height: 28px; border-radius: 8px; }
  .pc.is-compact .pc-art svg { width: 16px; height: 16px; }
  .pc.is-compact .pc-lines { display: block; }
  .pc.is-compact .pc-title { display: block; }
  .pc.is-compact .pc-title { font-size: 13.5px; font-weight: 600; }
  .pc.is-compact .pc-dot { width: 10px; height: 10px; }

  body[data-align="center"] .pc.is-compact { justify-self: center; max-width: 100%; }

  .pc-note {
    margin: 0;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-2);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
    font: 500 12.5px/1.45 var(--ui-font);
  }

  .clock {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
  }

  .clock-face {
    position: relative;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent);
  }

  .clock-face i {
    position: absolute;
    left: 50%;
    bottom: 50%;
    width: 2px;
    border-radius: 2px;
    background: var(--text);
    transform-origin: 50% 100%;
    transform: translateX(-50%) rotate(var(--deg, 0deg));
  }

  .clock-face .h { height: 11px; width: 2.5px; }
  .clock-face .m { height: 15px; background: var(--accent); }
  .clock-face::after { content: ""; position: absolute; inset: 0; margin: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--text); }

  .clock-lines { display: grid; gap: 2px; min-width: 0; }
  .clock-time { color: var(--text); font: 700 20px/1.1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
  .clock-sub { overflow: hidden; color: var(--text-3); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }

  /* ---- Audio player (frame-audio.js) ----------------------------------------- */
  #audioPanel {
    --ap-cover: 46px;
    display: grid;
    grid-template-columns: var(--ap-cover) minmax(0, 1fr) auto;
    grid-template-areas: "cover meta ctrl" "seek seek seek";
    align-items: center;
    gap: 10px 12px;
    margin-top: 22px;
    padding: 12px 12px 10px;
    text-align: left;
  }

  .ap-cover {
    grid-area: cover;
    position: relative;
    width: var(--ap-cover);
    height: var(--ap-cover);
    border-radius: 11px;
    overflow: hidden;
    background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 70%, #fff 0%), color-mix(in srgb, var(--accent) 25%, #000));
    box-shadow: inset 0 0 0 1px var(--line), 0 8px 20px -10px rgb(0 0 0 / .7);
  }

  .ap-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .ap-cover svg { position: absolute; inset: 0; margin: auto; width: 46%; height: 46%; color: rgb(255 255 255 / .9); fill: currentColor; }

  .ap-eq {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    padding: 2px 3px;
    border-radius: 4px;
    background: rgb(0 0 0 / .45);
  }

  .ap-eq i { width: 2px; height: 100%; border-radius: 1px; background: #fff; transform-origin: bottom; animation: nfEq .9s ease-in-out infinite; }
  .ap-eq i:nth-child(2) { animation-delay: -.3s; }
  .ap-eq i:nth-child(3) { animation-delay: -.6s; }
  #audioPanel[data-state="playing"] .ap-eq { display: inline-flex; }

  .ap-meta { grid-area: meta; display: grid; gap: 1px; min-width: 0; }

  .ap-title,
  .ap-artist {
    overflow: hidden;
    white-space: nowrap;
  }

  .ap-title { color: var(--text); font-weight: 680; font-size: calc(14.5px * var(--font-scale)); line-height: 1.3; }
  .ap-artist { color: var(--text-3); font-size: calc(12.5px * var(--font-scale)); line-height: 1.3; text-overflow: ellipsis; }
  .ap-title span { display: inline-block; }
  .ap-title.is-overflow span { animation: nfMarquee var(--marquee-time, 8s) ease-in-out infinite alternate; }
  .ap-title.is-overflow { -webkit-mask: linear-gradient(90deg, #000 85%, transparent); mask: linear-gradient(90deg, #000 85%, transparent); }

  .ap-ctrl { grid-area: ctrl; display: flex; align-items: center; gap: 2px; }

  .ap-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-2);
    background: none;
    cursor: pointer;
    transition: color .15s, background-color .15s, transform .2s var(--ease);
  }

  .ap-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 9%, transparent); }
  .ap-btn:active { transform: scale(.92); }
  .ap-btn svg { width: 18px; height: 18px; fill: currentColor; }

  .ap-play {
    width: 42px;
    height: 42px;
    color: var(--on-accent);
    background: var(--accent);
    box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgb(255 255 255 / .3);
  }

  .ap-play:hover { color: var(--on-accent); background: color-mix(in srgb, var(--accent) 88%, #fff); }
  .ap-play svg { width: 18px; height: 18px; }
  .ap-play .i-pause,
  #audioPanel[data-state="playing"] .ap-play .i-play { display: none; }
  #audioPanel[data-state="playing"] .ap-play .i-pause { display: block; }

  .ap-vol { display: flex; align-items: center; }
  .ap-vol .i-muted,
  .ap-vol[data-muted="true"] .i-vol { display: none; }
  .ap-vol[data-muted="true"] .i-muted { display: block; }

  .ap-seek-row {
    grid-area: seek;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    color: var(--text-3);
    font: 500 11px/1 var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
  }

  .ap-range {
    --p: 0;
    width: 100%;
    height: 18px;
    margin: 0;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
  }

  .ap-range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent) calc(var(--p) * 100%), color-mix(in srgb, var(--text) 16%, transparent) calc(var(--p) * 100%));
  }

  .ap-range::-moz-range-track {
    height: 4px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent) calc(var(--p) * 100%), color-mix(in srgb, var(--text) 16%, transparent) calc(var(--p) * 100%));
  }

  .ap-range::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
    opacity: 0;
    transition: opacity .15s;
    -webkit-appearance: none;
    appearance: none;
  }

  .ap-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
  }

  .ap-range:hover::-webkit-slider-thumb,
  .ap-range:focus-visible::-webkit-slider-thumb { opacity: 1; }
  .ap-range:focus-visible { outline-offset: 4px; box-shadow: none; }

  .ap-volume { width: 76px; }

  /* Full player: cover art first. */
  #audioPanel[data-player="full"] {
    --ap-cover: 92px;
    grid-template-areas: "cover meta meta" "cover seek seek" "cover ctrl ctrl";
    grid-template-columns: var(--ap-cover) minmax(0, 1fr) auto;
    gap: 6px 16px;
    padding: 14px;
  }

  #audioPanel[data-player="full"] .ap-cover { border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line), 0 14px 30px -12px color-mix(in srgb, var(--accent) 50%, #000); }
  #audioPanel[data-player="full"] .ap-title { font-size: calc(16px * var(--font-scale)); }
  #audioPanel[data-player="full"] .ap-ctrl { justify-content: flex-start; gap: 4px; }

  .ap-float {
    position: fixed;
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
    z-index: 30;
  }

  .ap-float .i-pause,
  .ap-float[data-state="playing"] .i-play { display: none; }
  .ap-float[data-state="playing"] .i-pause { display: block; }
  .ap-float svg { fill: currentColor; stroke: none; }

  /* ---- Badge medallion (frame copy of ui/components.css section 24) --------- */
  .nb-medal {
    --nb-size: 28px;
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--nb-size);
    height: var(--nb-size);
    border-radius: 36%;
    color: #fff;
    background: radial-gradient(120% 90% at 30% 18%, color-mix(in srgb, var(--nb-light) 55%, #fff) 0%, var(--nb-light) 38%, var(--nb-deep) 100%);
    box-shadow:
      0 0 0 1.5px rgb(255 255 255 / .92),
      0 0 0 2.5px color-mix(in srgb, var(--nb-deep) 45%, transparent),
      inset 0 1px 1px rgb(255 255 255 / .55),
      inset 0 -3px 6px color-mix(in srgb, var(--nb-deep) 70%, #000 10%),
      0 4px 12px -3px color-mix(in srgb, var(--nb-glow) 75%, transparent);
    isolation: isolate;
    overflow: hidden;
    text-shadow: none;
    transition: transform .18s var(--ease);
  }

  .nb-medal::before {
    content: "";
    position: absolute;
    inset: 0 0 52%;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(180deg, rgb(255 255 255 / .42), rgb(255 255 255 / 0));
  }

  /* Sweep only on hover/focus (not an infinite loop on every medal). */
  .nb-medal::after {
    content: "";
    position: absolute;
    inset: -40%;
    background: linear-gradient(115deg, transparent 42%, rgb(255 255 255 / .55) 50%, transparent 58%);
    transform: translateX(-70%);
    pointer-events: none;
  }

  .badge:hover .nb-medal::after,
  .badge:focus-visible .nb-medal::after { animation: nbSweep 1.1s ease-in-out; }

  .nb-medal svg {
    width: 60%;
    height: 60%;
    overflow: visible;
    filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--nb-deep) 80%, #000));
  }

  .badge:hover .nb-medal { transform: translateY(-1px) scale(1.08); }
  .nb-medal[data-anim="pulse"] svg { animation: nbPulse 2.2s ease-in-out infinite; }
  .nb-medal[data-anim="float"] svg { animation: nbFloat 2.6s ease-in-out infinite; }
  .nb-medal[data-anim="spin"] svg { animation: nbSpin 6s linear infinite; }
  .nb-medal[data-anim="spark"] svg { animation: nbSpark 2.4s ease-in-out infinite; }
  .nb-medal[data-anim="bounce"] svg { animation: nbBounce 2s ease-in-out infinite; }
  .nb-medal[data-anim="orbit"] svg { animation: nbOrbit 3.8s ease-in-out infinite; }

  /* Release 162: a user-made badge with an uploaded picture (the icon underneath returns if it fails). */
  .nb-medal.has-image svg { display: none; }
  .nb-medal-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    pointer-events: none;
  }

  /* ---- Phones ------------------------------------------------------------------ */
  @media (max-width: 560px) {
    :root { --pad-x: 20px; --pad-y: 28px; }
    #stage { padding-top: max(66px, calc(env(safe-area-inset-top) + 58px)); }
    body[data-mode="preview"] #stage { padding-top: 28px; }
    #avatarWrap { width: min(var(--avatar-size), 30vw); height: min(var(--avatar-size), 30vw); }
    body[data-has-banner="true"] #avatarWrap { margin-top: calc(min(var(--avatar-size), 30vw) * -.5); }
    #avatarMono { font-size: calc(min(var(--avatar-size), 30vw) * .42); }
    #banner { height: 118px; }
    body[data-layout="sleek"] #banner { height: 128px; }
    body[data-layout="sleek"] #head { gap: 14px; }
    #name { font-size: calc(clamp(24px, 6.4vw, 30px) * var(--font-scale)); }
    #bio { font-size: calc(15px * var(--font-scale)); }
    #meta { gap: 6px 12px; }
    #links { gap: 9px; }
    .link { --link-size-m: max(44px, var(--link-size)); width: var(--link-size-m); height: var(--link-size-m); }
    .link-icon { width: calc(var(--link-size-m) * .5); height: calc(var(--link-size-m) * .5); }
    body[data-link-layout="buttons"] .link-icon { width: 40px; height: 40px; }
    #audioPanel[data-player="full"] {
      --ap-cover: 64px;
      grid-template-areas: "cover meta" "seek seek" "ctrl ctrl";
      grid-template-columns: var(--ap-cover) minmax(0, 1fr);
    }
    #audioPanel[data-player="full"] .ap-ctrl { justify-content: center; }
    /* Mini player on phones: cover · title · play, then prev · seek · next. */
    #audioPanel[data-player="mini"] {
      grid-template-columns: var(--ap-cover) minmax(0, 1fr) 46px;
      grid-template-areas: "cover meta play" "prev seek next";
      gap: 8px 10px;
    }
    #audioPanel[data-player="mini"][data-multi="false"] { grid-template-areas: "cover meta play" "seek seek seek"; }
    #audioPanel[data-player="mini"] .ap-ctrl { display: contents; }
    #audioPanel[data-player="mini"] .ap-play { grid-area: play; }
    #audioPanel[data-player="mini"] .ap-prev { grid-area: prev; justify-self: center; }
    #audioPanel[data-player="mini"] .ap-next { grid-area: next; justify-self: center; }
    .ap-vol { display: none; }
    .chrome-btn { width: 44px; height: 44px; }
    .ap-btn { width: 44px; height: 44px; }
    .ap-play { width: 46px; height: 46px; }
    body[data-enter-style="glass"] .enter-inner { padding: 24px 22px; }
  }

  @media (pointer: coarse) {
    .link { min-width: 44px; min-height: 44px; }
    .ap-vol { display: none; } /* phones use hardware volume; iOS ignores audio.volume */
    .badge-more { position: relative; }
    .badge-more::after { content: ""; position: absolute; inset: -11px; }
    .ap-range::-webkit-slider-thumb { opacity: 1; }
    /* r180: 44px share / more buttons at every width, and a 44px touch row for the watermark (same look). */
    .chrome-btn { width: 44px; height: 44px; }
    .chrome-menu a,
    .chrome-menu button { min-height: 44px; }
    #watermark { position: relative; }
    #watermark::after { content: ""; position: absolute; inset: -6px 0; }
    .badge { position: relative; }
    .badge::after { content: ""; position: absolute; inset: -11px -2px; }
  }

  /* Phones: the card blur is the only backdrop-filter; keep its radius modest. */
  @media (max-width: 560px), (pointer: coarse) {
    #card { -webkit-backdrop-filter: blur(min(var(--blur), 28px)) saturate(1.3); backdrop-filter: blur(min(var(--blur), 28px)) saturate(1.3); }
  }

  /* ---- Phones: compact + calm (r160) -------------------------------------------
     The real public page on a phone (data-mode=public; the editor/landing previews keep
     their look). Tighter card rhythm and a slightly smaller avatar; the owner's colours
     stay, only the decorative accent halos (card glow, default ambience, enter glow,
     play button) are turned down so a bright phone screen is easy on the eyes. */
  @media (max-width: 560px) {
    body[data-mode="public"] { --pad-x: 18px; --pad-y: 24px; --avatar-m: min(var(--avatar-size), 26vw); }
    body[data-mode="public"]:not([data-tone="light"], [data-glass="clear"], [data-layout="minimal"]) #card {
      box-shadow:
        inset 0 1px 0 rgb(255 255 255 / .12),
        0 1px 2px rgb(0 0 0 / .2),
        0 22px 50px -24px rgb(0 0 0 / .6),
        0 0 80px -50px color-mix(in srgb, var(--accent) 45%, transparent);
    }
    body[data-mode="public"] #ambient { opacity: .7; }
    body[data-mode="public"] #head { gap: 12px; }
    body[data-mode="public"] #avatarWrap { width: var(--avatar-m); height: var(--avatar-m); }
    body[data-mode="public"][data-has-banner="true"] #avatarWrap { margin-top: calc(var(--avatar-m) * -.5); }
    body[data-mode="public"] #avatarMono { font-size: calc(var(--avatar-m) * .42); }
    body[data-mode="public"] #presenceDot { --dot: max(12px, calc(var(--avatar-m) * .17)); right: calc(var(--avatar-m) * .146 - var(--dot) / 2); bottom: calc(var(--avatar-m) * .146 - var(--dot) / 2); }
    body[data-mode="public"]:is([data-avatar-shape="rounded"], [data-avatar-shape="square"]) #presenceDot { right: -4px; bottom: -4px; }
    body[data-mode="public"] #identity { gap: 4px; }
    body[data-mode="public"] #bio { margin-top: 10px; font-size: calc(14.5px * var(--font-scale)); line-height: 1.55; }
    body[data-mode="public"] #meta { margin-top: 10px; }
    body[data-mode="public"] #links { gap: 8px; margin-top: 18px; }
    body[data-mode="public"][data-link-layout="buttons"] .link { min-height: 52px; gap: 12px; padding: 6px 14px 6px 6px; }
    body[data-mode="public"][data-link-layout="buttons"] .link-icon { width: 38px; height: 38px; padding: 8px; }
    body[data-mode="public"][data-layout="stack"] .link { min-height: 54px; }
    body[data-mode="public"] #widgets { gap: 8px; margin-top: 16px; }
    body[data-mode="public"] #audioPanel { margin-top: 16px; padding: 10px 10px 8px; }
    body[data-mode="public"] .ap-play { box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 1px 0 rgb(255 255 255 / .25); }
    body[data-mode="public"] #audioPanel[data-player="full"] .ap-cover { box-shadow: inset 0 0 0 1px var(--line), 0 10px 22px -12px rgb(0 0 0 / .7); }
    body[data-mode="public"] #foot { padding-top: 18px; }
    body[data-mode="public"] #watermark { min-height: 32px; padding: 0 12px 0 8px; color: rgb(255 255 255 / .56); font-size: 12px; }
    body[data-mode="public"] #watermark img { width: 14px; height: 14px; }
    body[data-mode="public"] .chrome-btn { color: rgb(255 255 255 / .8); box-shadow: inset 0 0 0 1px var(--chrome-line); }
    body[data-mode="public"] .enter-icon { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); animation: none; }
    body[data-mode="public"] #enterText { font-size: calc(17px * var(--font-scale)); }
    body[data-mode="public"]:not([data-enter-style="minimal"]) #enterText { text-shadow: 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent); }
    body[data-mode="public"] #enterSubtext { font-size: calc(13px * var(--font-scale)); }
  }

  /* Small Androids (360px): six default-size link tiles still fit on one row. */
  @media (max-width: 380px) {
    body[data-mode="public"] { --pad-x: 14px; }
    body[data-mode="public"] #links { gap: 6px; }
  }
}

/* ---- Keyframes ------------------------------------------------------------------ */
@keyframes nfAmbient {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(2%, -1.5%, 0) scale(1.05); }
  100% { transform: translate3d(-2%, 1.5%, 0) scale(1.02); }
}
@keyframes nfFade { from { opacity: 0; } }
@keyframes nfRise { from { opacity: 0; transform: translateY(28px) scale(.985); } }
@keyframes nfPop { 0% { opacity: 0; transform: scale(.86); } 60% { opacity: 1; } }
@keyframes nfUnfold { from { opacity: 0; transform: perspective(1200px) rotateX(-16deg) scaleY(.82); } }
@keyframes nfBlurIn { from { opacity: 0; filter: blur(14px); transform: translateY(6px); } }
@keyframes nfChild { from { opacity: 0; transform: translateY(10px); } }
@keyframes nfBreathe { 50% { opacity: .62; } }
@keyframes nfPing {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent), 0 0 34px -4px color-mix(in srgb, var(--accent) 55%, transparent); }
  70%, 100% { box-shadow: 0 0 0 16px transparent, 0 0 34px -4px color-mix(in srgb, var(--accent) 55%, transparent); }
}
@keyframes nfMenu { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
@keyframes nfMarquee { 0%, 14% { transform: translateX(0); } 86%, 100% { transform: translateX(var(--marquee-distance, 0)); } }
@keyframes nfEq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@keyframes nbSweep { from { transform: translateX(-70%); } to { transform: translateX(70%); } }
@keyframes nbPulse { 50% { transform: scale(1.12); } }
@keyframes nbFloat { 50% { transform: translateY(-2px); } }
@keyframes nbSpin { to { transform: rotate(360deg); } }
@keyframes nbSpark { 45% { transform: scale(1.12) rotate(-6deg); } 55% { transform: scale(1.08) rotate(6deg); } }
@keyframes nbBounce { 50% { transform: translateY(-3px); } 65% { transform: translateY(1px); } }
@keyframes nbOrbit { 50% { transform: rotate(14deg) translate(1px, -1px); } }

/* Reduced motion wins over every layer (unlayered on purpose). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms;
    animation-iteration-count: 1;
    transition-duration: .01ms;
    scroll-behavior: auto;
  }
  #ambient, .nb-medal svg, .enter-icon, #enterText, .ap-eq i, .ap-title span { animation: none; }
}
