/* ---------- banner background ---------- */
body.has-banner::before {
    content: '';
    position: fixed;
    inset: 0;
    /* Zero, not negative. A negative z-index child paints behind the body's
       own background unless the body is a stacking context, which hid the
       banner and the video on the page (they only showed through the
       translucent enter-gate). Giving the backdrop layers non-negative
       indexes keeps their order — body background, banner/video, ambient,
       content — without forcing the whole body into a stacking context, which
       disturbed the cursor-trail canvas compositing. */
    z-index: 0;
    background:
        linear-gradient(var(--p-banner-scrim-1), var(--p-banner-scrim-2)),
        var(--banner) center / cover no-repeat;
    /* The owner's dim dial, independent of the scrim tokens above so it works
       the same for a picture as it does for a clip. */
    filter: brightness(calc(1 - var(--p-bg-dim, 0) * .6));
}

/* ---------- video background ----------
   A video replaces the banner as the backdrop, so the ::before layer above is
   hidden and this element takes its place behind the ambient wash. It sits at
   z-index -2 like the banner did, stretches to the viewport regardless of
   aspect ratio, and is inert to input so clicking anywhere still reaches the
   page (and the fx gate) underneath. */
body.has-video.has-banner::before { display: none; }
.profile-body .p-video {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    /* The scrim keeps text legible over whatever frame is showing; the
       owner's dim dial multiplies on top of the glass level's brightness. */
    filter: brightness(calc(var(--p-video-brightness, .78) * (1 - var(--p-bg-dim, 0)))) saturate(var(--p-video-saturate, 1.05));
}
/* Until the first frame decodes the poster/banner colour shows, so the page
   never flashes an empty black rectangle. */
.profile-body .p-video:not([data-p-video-ready]) { background: var(--p-ambient-bg, none); }

/* Visitors who ask for less motion get the poster frame, not a loop. */
@media (prefers-reduced-motion: reduce) {
    .profile-body .p-video { display: none; }
    body.has-video.has-banner::before { display: block; }
}
/* Backgrounds stay off very small screens: a looping video competes with the
   text and eats battery on the devices least able to spare it. */
@media (max-width: 480px) {
    .profile-body .p-video { display: none; }
    body.has-video.has-banner::before { display: block; }
}

/* ---------- profile page: layouts, fonts, music, live editor ---------- */

.profile-body {
    /* Backdrop stack order, all in the root stacking context: body background,
       then the banner/video at z-index 0, then the ambient wash at z-index 1,
       then `.main` content at z-index 1 (later in DOM, so above the wash).
       These used to be negative and relied on `isolation:isolate` here to keep
       them from painting behind the opaque `--p-body-bg`; that made the whole
       body a stacking context and interfered with the compositing of the
       fixed cursor-trail canvas. Non-negative indexes achieve the same order
       without a page-wide stacking context. */
    --profile-font: var(--font-sans);
    --accent: var(--blood-bright);
    /* Design tokens — every component below consumes these; themes.css is the
       only file that redefines the palette, from the owner's two colours and
       the transparency dial. New surface styles must read tokens, not colors. */
    --p-page-width: 720px;
    --p-ink: var(--foreground);
    --p-muted: var(--muted-foreground);
    --p-line: var(--border);
    --p-line-accent: var(--border-blood);
    --p-accent: var(--blood-bright);
    --p-accent-deep: var(--blood);
    --p-accent-dark: var(--blood-dark);
    --p-accent-glow: var(--blood-glow);
    --p-accent-text: #fff;
    --p-accent-soft: rgba(196, 30, 30, .45);
    --p-accent-faint: rgba(196, 30, 30, .10);
    --p-accent-halo: rgba(139, 0, 0, .12);
    --p-avatar-bg: radial-gradient(circle at 30% 20%, rgba(196, 30, 30, .35), rgba(0, 0, 0, .6));
    --p-avatar-border: var(--border-blood);
    --p-avatar-ring: 0 0 0 6px rgba(139, 0, 0, .10);
    --p-avatar-shadow: 0 10px 40px rgba(0, 0, 0, .6);
    --p-avatar-initial: #ffd9d9;
    --p-icon-bg: rgba(255, 255, 255, .04);
    --p-input-bg: rgba(255, 255, 255, .04);
    --p-btn-bg: rgba(255, 255, 255, .05);
    --p-item-bg: rgba(255, 255, 255, .02);
    --p-item-line: rgba(255, 255, 255, .08);
    --p-link-bg: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(0, 0, 0, .18));
    --p-link-hover-bg: linear-gradient(180deg, rgba(196, 30, 30, .10), rgba(0, 0, 0, .2));
    --p-music-bg: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(0, 0, 0, .25));
    --p-music-cover-bg: rgba(139, 0, 0, .2);
    --p-player-bg: linear-gradient(180deg, var(--p-accent), var(--p-accent-dark));
    --p-player-border: rgba(255, 255, 255, .12);
    --p-editor-bg: rgba(10, 5, 5, .85);
    --p-danger: #ff8a8a;
    --p-scanline: rgba(196, 30, 30, .10);
    --p-radius-sm: 10px;
    --p-radius-md: 14px;
    --p-radius-lg: 16px;
    --p-shadow: 0 10px 30px rgba(0, 0, 0, .4);
    --p-body-bg: var(--background-deep);
    --p-body-image:
        radial-gradient(1200px 500px at 50% -10%, rgba(139, 0, 0, .10), transparent 60%),
        radial-gradient(900px 400px at 100% 20%, rgba(80, 0, 0, .08), transparent 60%);
    --p-banner-scrim-1: rgba(5, 3, 2, .78);
    --p-banner-scrim-2: rgba(0, 0, 0, .9);
    color: var(--p-ink);
    background-color: var(--p-body-bg);
    background-image: var(--p-body-image);
}

body.font-system { --profile-font: var(--font-sans); }
body.font-gothic { --profile-font: 'gothic', 'Old English Text MT', 'Times New Roman', serif; }
body.font-mono { --profile-font: 'mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; }
body.font-fancy { --profile-font: 'fancy', 'Brush Script MT', cursive; }
body.font-casual { --profile-font: 'casual', 'Comic Sans MS', 'Segoe Print', cursive; }

/* ---------- page builder: width, spacing, corners, shadows, portrait ----
   All free presentation the owner picks in the dashboard. The classes are set
   server-side on <body> and swapped live by profile-dash.js; the values only
   ever move the same custom properties the components already consume. */

body.width-narrow { --p-page-width: 560px; }
body.width-standard { --p-page-width: 720px; }
body.width-wide { --p-page-width: 900px; }

body.spacing-compact { --p-space: .72; }
body.spacing-cozy { --p-space: 1; }
body.spacing-roomy { --p-space: 1.3; }

body.shape-sharp {
    --p-radius-sm: 2px;
    --p-radius-md: 4px;
    --p-radius-lg: 6px;
}
body.shape-soft {
    --p-radius-sm: 10px;
    --p-radius-md: 14px;
    --p-radius-lg: 16px;
}
body.shape-round {
    --p-radius-sm: 14px;
    --p-radius-md: 999px;
    --p-radius-lg: 20px;
}

body.avatar-circle .profile-avatar-img,
body.avatar-circle .profile-avatar { border-radius: 50%; }
body.avatar-squircle .profile-avatar-img,
body.avatar-squircle .profile-avatar { border-radius: 30%; }
body.avatar-square .profile-avatar-img,
body.avatar-square .profile-avatar { border-radius: 10px; }

/* Shadows are a chosen depth, not a decoration each component owns. None
   removes every lift including the hover one; deep pushes the link cards
   further off the page without changing their colour. */
body.shadow-none .profile-link,
body.shadow-none .profile-link:hover,
body.shadow-none .music-bar,
body.shadow-none .name-record-chip:hover { box-shadow: none; }
body.shadow-deep .profile-link {
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / .05),
        0 16px 40px -16px var(--p-accent-glow),
        0 26px 60px -34px rgb(0 0 0 / .85);
}
body.shadow-deep .profile-link:hover {
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / .07),
        0 20px 48px -16px var(--p-accent-glow),
        0 32px 70px -34px rgb(0 0 0 / .9);
}
body.shadow-deep .music-bar {
    box-shadow: 0 22px 50px -20px rgb(0 0 0 / .8);
}
body.page-light.shadow-deep .profile-link {
    box-shadow:
        inset 0 1px 0 rgb(255 255 255 / .4),
        0 16px 40px -16px var(--p-accent-glow),
        0 26px 52px -34px rgb(0 0 0 / .45);
}
body.page-light.shadow-deep .music-bar {
    box-shadow: 0 22px 44px -22px rgb(0 0 0 / .35);
}

.profile-page {
    font-family: var(--profile-font);
    position: relative;
    max-width: var(--p-page-width);
    margin: 0 auto;
    padding: calc(40px * var(--p-space, 1)) 20px calc(80px * var(--p-space, 1));
    gap: calc(22px * var(--p-space, 1));
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* The site-wide entrance animates transform, which makes the page the
   containing block for `position: fixed` descendants — the owner's Edit
   pill anchored itself to the page bottom instead of the viewport corner.
   Profiles animate through their own section reveals instead. */
body.profile-body .main > .page.profile-page { animation: none; }

/* A finished card, not a document: text selection and the mobile long-press
   callout are off on the page. The dashboard and every field re-enable
   native selection so the owner can still edit. */
body.profile-body .page.profile-page {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
body.profile-body .bb-dash,
body.profile-body .bb-dash *,
body.profile-body input,
body.profile-body textarea,
body.profile-body select {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* The profile is a card on a stage: centred when it fits and scrolling when
   it does not. Auto margins centre without the clipping that
   justify-content: center causes on a tall page. */
body.profile-body .main {
    display: flex;
    flex-direction: column;
    align-items: center;
}
body.profile-body .main > .page.profile-page {
    width: 100%;
    margin: auto;
}

.profile-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    width: 100%;
    padding: 12px 0 4px;
}

.profile-avatar-wrap {
    position: relative;
    flex: 0 0 auto;
}

.profile-avatar-img,
.profile-avatar {
    width: 116px;
    height: 116px;
    /* --p-avatar-clip lets a stylesheet cut the portrait into a different
       silhouette without forking this rule. `none` is a circle, and nothing
       sets it now that the named skins are retired. */
    clip-path: var(--p-avatar-clip, none);
    border-radius: var(--p-avatar-radius, 50%);
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--p-avatar-bg);
    border: 1px solid var(--p-avatar-border);
    box-shadow: var(--p-avatar-ring), var(--p-avatar-shadow);
    font-size: 44px;
    color: var(--p-avatar-initial);
    text-transform: uppercase;
    user-select: none;
}

.profile-meta { min-width: 0; }

.profile-handle {
    font-size: clamp(1.9rem, 6vw, 2.9rem);
    line-height: 1.05;
    letter-spacing: -.02em;
}

body.font-gothic .profile-handle { letter-spacing: 0; }
body.font-fancy .profile-handle { font-size: clamp(2.4rem, 8vw, 3.6rem); }

/* ---------- name typography (free) ----------
   Treatments for the page name itself, chosen in the Profile tab rather than
   the premium page-fx group. All read the owner's palette; the ink-fill is
   forced so a light page's ink rule cannot wash an outline out. */
body.profile-body.namefx-gradient .profile-handle {
    background-image: linear-gradient(100deg,
        var(--p-accent) 0%, var(--p-ink) 32%, var(--p-accent) 64%, var(--p-ink) 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: namefx-pan 7s linear infinite;
}

body.profile-body.namefx-shimmer .profile-handle {
    background-image: linear-gradient(110deg,
        var(--p-ink) 38%, var(--p-accent) 50%, var(--p-ink) 62%);
    background-size: 250% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: namefx-pan 3.4s linear infinite;
}

body.profile-body.namefx-outline .profile-handle {
    color: transparent;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 1.5px var(--p-accent);
    text-shadow: 0 0 26px var(--p-accent-glow);
}

body.profile-body.namefx-glitch .profile-handle {
    text-shadow:
        2px 0 var(--p-accent),
        -2px 0 color-mix(in srgb, var(--p-ink) 70%, var(--p-accent)),
        0 0 18px var(--p-accent-glow);
    animation: namefx-glitch 4.5s steps(1) infinite;
}

@keyframes namefx-pan {
    from { background-position: 0% 50%; }
    to   { background-position: 200% 50%; }
}

@keyframes namefx-glitch {
    0%, 92%, 100% { transform: none; }
    93% { transform: translate(1px, -1px); }
    95% { transform: translate(-2px, 1px); }
    97% { transform: translate(1px, 0); }
}

@media (prefers-reduced-motion: reduce) {
    body.profile-body.namefx-gradient .profile-handle,
    body.profile-body.namefx-shimmer .profile-handle,
    body.profile-body.namefx-glitch .profile-handle { animation: none; }
}

.profile-sub {
    color: var(--p-muted);
    font-size: .95rem;
    margin-top: 6px;
    word-break: break-all;
}

/* ---------- the owner's name, and their words ---------- */
.profile-alt {
    margin-top: 4px;
    font-size: clamp(1rem, .95rem + .4vw, 1.25rem);
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--p-ink);
    opacity: .92;
}

.profile-bio {
    width: 100%;
    max-width: 58ch;
    margin: 0 auto;
    font-size: .95rem;
    line-height: 1.7;
    color: var(--p-ink);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    text-align: center;
}

body.layout-left .profile-bio,
body.layout-magazine .profile-bio,
body.layout-compact .profile-bio { max-width: none; margin: 0; text-align: left; }
body.layout-right .profile-bio { max-width: none; margin: 0 0 0 auto; text-align: right; }

/* ---------- custom badge chips ---------- */
.profile-custom-badges {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-badges .custom-badge {
    --badge-colour: var(--p-pill);
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: none;
    color: var(--p-ink);
    background: color-mix(in srgb, var(--badge-colour) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--badge-colour) 55%, transparent);
}

/* ---------- section visibility ---------- */
/* Set server-side from the saved config and toggled live in the editor. */
.profile-body .section-off { display: none !important; }

/* ---------- badges, stats, follow ---------- */
.profile-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 14px;
    font-size: .82rem;
    color: var(--p-muted);
}

/* Followers/following and the follow button are one toggleable group. */
.profile-social {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.profile-stats .stat strong {
    color: var(--p-ink);
    font-weight: 700;
}
/* The eye travels with the view count, which now lives in the card with the
   rest of the identity instead of pinned to the viewport corner. */
.profile-stats .stat-eye {
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: -2px;
    opacity: .85;
}
/* The view count is a figure, not a control: it must not look clickable. A
   <button> here would put it in the tab order and give the mouse a pointer
   for something that does nothing. */
.profile-stats .stat-views {
    cursor: default;
    font-variant-numeric: tabular-nums;
}

body.layout-left .profile-badges,
body.layout-left .profile-stats { justify-content: flex-start; }
body.layout-right .profile-badges,
body.layout-right .profile-stats { justify-content: flex-end; }
body.layout-magazine .profile-badges,
body.layout-magazine .profile-stats { justify-content: flex-start; }
body.layout-compact .profile-badges,
body.layout-compact .profile-stats { justify-content: flex-start; }

/* ---------- premium effects (locked to premium accounts) ---------- */
body.effect-glow .profile-avatar-img,
body.effect-glow .profile-avatar {
    box-shadow: 0 0 0 6px var(--p-accent-halo), 0 0 34px var(--p-accent-glow), var(--p-avatar-shadow);
    border-color: var(--p-accent);
}

body.effect-glow .profile-link:hover {
    border-color: var(--p-accent);
    box-shadow: 0 0 22px var(--p-accent-glow);
}

body.effect-shimmer .profile-avatar-img,
body.effect-shimmer .profile-avatar {
    animation: shimmer 3.2s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { box-shadow: var(--p-avatar-ring), var(--p-avatar-shadow); }
    50% { box-shadow: 0 0 0 6px var(--p-accent-soft), 0 0 40px var(--p-accent-glow); }
}

body.effect-scanline .profile-link::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent 0, transparent 3px,
        var(--p-scanline) 3px, var(--p-scanline) 4px
    );
}

body.effect-scanline .profile-link { position: relative; }

/* ---------- music player ---------- */
.music-bar {
    --cover: 56px;
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--p-line);
    border-radius: var(--p-radius-lg);
    background: var(--p-music-bg);
    box-shadow: var(--p-shadow);
}

.music-cover {
    width: var(--cover);
    height: var(--cover);
    border-radius: 12px;
    object-fit: cover;
    flex: 0 0 auto;
    background: var(--p-music-cover-bg);
    border: 1px solid var(--p-line-accent);
}

.music-body { flex: 1 1 auto; min-width: 0; }

.music-track {
    font-weight: 600;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-artist {
    color: var(--p-muted);
    font-size: .78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-viz {
    width: 100%;
    height: 34px;
    display: block;
    margin-top: 4px;
}

.music-play {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--p-accent-text);
    background: var(--p-player-bg);
    border: 1px solid var(--p-player-border);
    box-shadow: 0 6px 20px var(--p-accent-glow);
    transition: transform .1s ease;
}

.music-play:active { transform: scale(.94); }
.music-play svg { width: 18px; height: 18px; }
.music-play .icon-pause { display: none; }
.music-bar.is-playing .music-play .icon-play { display: none; }
.music-bar.is-playing .music-play .icon-pause { display: block; }
.music-bar.is-playing .music-cover { animation: spin 8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- links ---------- */
.profile-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--p-link-gap, 10px);
}

.profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border: 1px solid var(--p-line);
    border-radius: var(--p-radius-md);
    background: var(--p-link-bg);
    transition: border-color .15s ease, transform .1s ease, background .15s ease;
}

.profile-link:hover {
    border-color: var(--p-accent);
    background: var(--p-link-hover-bg);
    transform: translateY(-1px);
}

.profile-link-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--p-icon-bg);
    flex: 0 0 auto;
}

.profile-link-img { width: 18px; height: 18px; object-fit: contain; }
.profile-link-label { font-weight: 500; }

/* ---------- profile-card embeds for internal blood.bid links ---------- */
.profile-link-card {
    gap: 14px;
    cursor: pointer;
}

.profile-link-card-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--p-icon-bg);
    overflow: hidden;
}

.profile-link-img-card {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.profile-link-card-initial {
    font-size: 18px;
    font-weight: 700;
    color: var(--p-ink);
}

.profile-link-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-link-card-name {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.profile-link-card-check {
    color: var(--p-accent-deep, var(--blood));
    font-weight: 700;
}

.profile-link-card-handle {
    font-size: .78rem;
    color: var(--p-muted);
}

.profile-link-card-badges {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}

.profile-link-card-badges .badge-icon {
    width: 16px;
    height: 16px;
}

body.layout-magazine .profile-link-card { height: 100%; }

/* ---------- layout: left ---------- */
body.layout-left .profile-page { align-items: flex-start; }
body.layout-left .profile-hero {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 20px;
}
body.layout-left .profile-avatar-img,
body.layout-left .profile-avatar { width: 96px; height: 96px; font-size: 36px; }
body.layout-left .profile-links { max-width: 520px; }

/* ---------- layout: right ---------- */
body.layout-right .profile-page { align-items: flex-end; }
body.layout-right .profile-hero {
    flex-direction: row-reverse;
    align-items: center;
    text-align: right;
    gap: 20px;
}
body.layout-right .profile-avatar-img,
body.layout-right .profile-avatar { width: 96px; height: 96px; font-size: 36px; }
body.layout-right .profile-links { max-width: 520px; }
body.layout-right .profile-link { flex-direction: row-reverse; }
body.layout-right .profile-link-label { flex: 1 1 auto; text-align: right; }
body.layout-right .music-bar { flex-direction: row-reverse; }
body.layout-right .music-body { text-align: right; }

/* ---------- layout: magazine ---------- */
body.layout-magazine .profile-page { max-width: calc(var(--p-page-width, 720px) + 140px); }
body.layout-magazine .profile-hero {
    flex-direction: row;
    align-items: flex-end;
    text-align: left;
    gap: 26px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-blood);
}
body.layout-magazine .profile-avatar-img,
body.layout-magazine .profile-avatar {
    width: 150px;
    height: 150px;
    border-radius: 18px;
    font-size: 60px;
}
body.layout-magazine .profile-handle { font-size: clamp(2.6rem, 7vw, 4rem); }
body.layout-magazine .profile-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--p-link-gap, 12px);
}
/* an unmatched odd card (1, 3, 5, … links) centers instead of hugging
   the left column, so the row never looks half-empty */
body.layout-magazine .profile-links > .profile-link:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 6px);
}
body.layout-magazine .music-bar { max-width: 100%; }

/* ---------- layout: compact ---------- */
body.layout-compact .profile-page { max-width: calc(var(--p-page-width, 720px) - 160px); padding-top: calc(26px * var(--p-space, 1)); }
body.layout-compact .profile-hero {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 14px;
    padding: 0;
}
body.layout-compact .profile-avatar-img,
body.layout-compact .profile-avatar { width: 64px; height: 64px; font-size: 24px; }
body.layout-compact .profile-handle { font-size: 1.6rem; }
body.layout-compact .profile-links { flex-direction: row; flex-wrap: wrap; }
body.layout-compact .profile-link { flex: 1 1 auto; padding: 9px 13px; border-radius: 999px; }
body.layout-compact .profile-link-icon { width: 24px; height: 24px; }
body.layout-compact .profile-link-img { width: 15px; height: 15px; }

/* ---------- link presentation ----------
   The owner picks how their links read. Bars is the panel style the page
   always had; rows drops the panel but keeps icon + text; icons strips the
   text and lays bare icons side by side; text drops the icons and the panel.
   Body-level classes keep these above the layout rules above. */
.profile-body.links-rows .profile-link {
    background: none;
    border-color: transparent;
    box-shadow: none;
    padding-left: 4px;
    padding-right: 4px;
}
.profile-body.links-rows .profile-link:hover {
    background: none;
    border-color: transparent;
    box-shadow: none;
    transform: none;
    color: var(--p-accent);
}

.profile-body.links-icons .profile-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}
.profile-body.links-icons .profile-link {
    flex: 0 0 auto;
    background: none;
    border-color: transparent;
    box-shadow: none;
    padding: 6px;
}
.profile-body.links-icons .profile-link:hover {
    background: none;
    border-color: transparent;
    box-shadow: none;
    transform: translateY(-2px);
}
.profile-body.links-icons .profile-link-label { display: none; }
.profile-body.links-icons .profile-link-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: none;
}
.profile-body.links-icons .profile-link-img { width: 26px; height: 26px; }
.profile-body.links-icons .profile-link-card { padding: 6px; }
.profile-body.links-icons .profile-link-card-body,
.profile-body.links-icons .profile-link-card-badges { display: none; }
body.layout-left .profile-body.links-icons .profile-links { justify-content: flex-start; }
body.layout-right .profile-body.links-icons .profile-links { justify-content: flex-end; }

.profile-body.links-text .profile-link {
    background: none;
    border-color: transparent;
    box-shadow: none;
    justify-content: center;
    padding: 5px 8px;
}
.profile-body.links-text .profile-link:hover {
    background: none;
    border-color: transparent;
    box-shadow: none;
    transform: none;
    color: var(--p-accent);
}
.profile-body.links-text .profile-link-icon { display: none; }
.profile-body.links-text .profile-link-label { font-weight: 600; }

/* ---------- editor ---------- */
.edit-toggle {
    align-self: flex-end;
    margin-bottom: 4px;
    padding: 8px 16px;
    border-radius: 999px;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--p-accent-text);
    background: var(--p-accent);
    border: 1px solid var(--p-player-border);
    backdrop-filter: blur(8px);
    box-shadow: var(--p-shadow);
}
.edit-toggle:hover { filter: brightness(1.12); }

.editor {
    width: 100%;
    max-width: 520px;
    display: none;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px dashed var(--p-line-accent);
    border-radius: var(--p-radius-lg);
    background: var(--p-editor-bg);
    text-align: left;
}
body.dash-on .profile-link,
body.dash-on .profile-avatar-wrap { outline: 1px dashed var(--p-accent-soft); outline-offset: 4px; border-radius: 12px; }

.editor-row { display: flex; flex-direction: column; gap: 6px; }
.editor-row label { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-foreground); }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.editor select,
.editor input[type="text"],
.editor textarea {
    font: inherit;
    font-size: .9rem;
    width: 100%;
    padding: 9px 11px;
    color: var(--p-ink);
    background: var(--p-input-bg);
    border: 1px solid var(--p-line);
    border-radius: var(--p-radius-sm);
}

.editor select:focus,
.editor input[type="text"]:focus,
.editor textarea:focus { outline: none; border-color: var(--p-accent); }

.btn {
    font: inherit;
    font-size: .85rem;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: var(--p-radius-sm);
    cursor: pointer;
    color: var(--p-ink);
    background: var(--p-btn-bg);
    border: 1px solid var(--p-line);
}
.btn:hover { border-color: var(--p-accent); }
.btn-danger { color: var(--p-danger); }
.btn-danger:hover { background: var(--p-accent-faint); border-color: var(--p-accent); }
.editor-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.avatar-edit {
    position: absolute;
    right: -4px;
    bottom: -4px;
    /* Above the portrait and above fx layers (shimmer sheen is z-index 2),
       so the pencil is always reachable while editing. */
    z-index: 4;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: none;
    place-items: center;
    cursor: pointer;
    font-size: 15px;
    color: var(--p-accent-text);
    background: var(--p-accent);
    border: 2px solid var(--p-body-bg);
}
body.dash-on .avatar-edit { display: grid; }

.editor-note { font-size: .74rem; color: var(--p-muted); }
.editor-error { font-size: .78rem; color: var(--p-danger); min-height: 1em; }

.editor-block {
    padding: 12px;
    border: 1px solid var(--p-item-line);
    border-radius: 12px;
    background: var(--p-item-bg);
}
.editor-song-on {
    color: var(--p-accent);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: .72rem;
}
.editor select:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- links editor ---------- */
.editor-link-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.editor-link-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--p-item-line);
    border-radius: 10px;
    background: var(--p-item-bg);
}
.editor-link-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .82rem;
}
.editor-link-item .btn { flex: 0 0 auto; padding: 4px 10px; font-size: .74rem; }

.editor-wk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--p-item-line);
    border-radius: 10px;
    background: var(--p-item-bg);
}
.editor-wk-row .editor-wk-name {
    flex: 0 0 160px;
    min-width: 0;
    font-family: var(--font-mono, monospace);
    font-size: .78rem;
}
.editor-wk-row .editor-wk-content {
    flex: 1 1 auto;
    min-width: 0;
    resize: none;
    font-family: var(--font-mono, monospace);
    font-size: .78rem;
}
.editor-wk-row .btn { flex: 0 0 auto; padding: 4px 10px; font-size: .74rem; }
.editor-wk-row textarea.editor-wk-content { height: auto; min-height: 38px; }

/* ---------- premium custom cursors (name-specific) ---------- */
.cursor-crosshair, .cursor-crosshair * { cursor: crosshair !important; }
.cursor-pointer,  .cursor-pointer  * { cursor: pointer !important; }
.cursor-text,     .cursor-text     * { cursor: text !important; }
.cursor-wait,     .cursor-wait     * { cursor: wait !important; }
.cursor-help,     .cursor-help     * { cursor: help !important; }
.cursor-grab,     .cursor-grab     * { cursor: grab !important; }
.cursor-move,     .cursor-move     * { cursor: move !important; }
.cursor-cell,     .cursor-cell     * { cursor: cell !important; }
.cursor-copy,     .cursor-copy     * { cursor: copy !important; }
.cursor-zoom-in,  .cursor-zoom-in  * { cursor: zoom-in !important; }

@media (max-width: 560px) {
    body.layout-magazine .profile-links { grid-template-columns: 1fr; }
    body.layout-magazine .profile-links > .profile-link:last-child:nth-child(odd) {
        width: 100%;
    }
    body.layout-magazine .profile-hero { flex-direction: column; align-items: flex-start; }
}

/* ---------- name record (ownership + provenance) ---------- */
.name-record {
    width: 100%;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--p-line);
    color: var(--p-muted);
    font-size: .8rem;
    line-height: 1.6;
}
.name-record-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.name-record-kicker {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--p-muted);
    opacity: .8;
}
.name-record-meta { font-variant-numeric: tabular-nums; }
.name-record-market { margin: 12px 0 0; }
.name-record-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border: 1px solid var(--p-line-accent);
    border-radius: 999px;
    color: var(--p-accent);
    background: var(--p-accent-faint);
    font-size: .76rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.name-record-chip:hover {
    transform: translateY(-1px);
    box-shadow: var(--p-accent-glow);
}
.nr-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--p-accent);
    box-shadow: 0 0 10px var(--p-accent);
    animation: nr-pulse 2.2s ease-in-out infinite;
}
@keyframes nr-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}
.name-record-history {
    margin-top: 16px;
    padding-left: 18px;
    border-left: 1px solid var(--p-line);
}
.name-record-history summary {
    cursor: pointer;
    list-style: none;
    font-size: .72rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--p-muted);
    user-select: none;
}
.name-record-history summary::-webkit-details-marker { display: none; }
.name-record-history summary::before {
    content: '\25B8';
    display: inline-block;
    margin-right: 6px;
    color: var(--p-accent);
    transition: transform .15s ease;
}
.name-record-history[open] summary::before { transform: rotate(90deg); }
.name-record-list { margin: 6px 0 0; padding: 0 0 0 2px; list-style: none; }
.nr-item {
    position: relative;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 12px;
    align-items: baseline;
    padding: 7px 0 7px 4px;
}
.nr-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 1.05em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--p-accent-faint);
    border: 1px solid var(--p-accent);
    box-shadow: 0 0 10px var(--p-accent-glow);
}
.nr-date {
    color: var(--p-muted);
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.nr-text { color: var(--p-ink); }

/* ---------- page-builder blocks ---------- */
.profile-blocks {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 26px;
}
.profile-block { margin: 0; }
.block-text {
    width: 100%;
    font-size: .95rem;
    line-height: 1.7;
    color: var(--p-ink);
    white-space: pre-wrap;
    overflow-wrap: break-word;
}
.block-heading {
    font-size: clamp(1.15rem, 1.05rem + .6vw, 1.55rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--p-ink);
}
.block-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--p-muted);
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.block-divider::before,
.block-divider::after {
    content: '';
    flex: 0 0 auto;
    width: 54px;
    height: 1px;
    background: var(--p-line-accent);
}

/* block editor rows */
.editor-block-row { gap: 8px; }
.editor-block-kind {
    flex: 0 0 auto;
    min-width: 56px;
    font-family: var(--font-mono, monospace);
    font-size: .64rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--p-accent);
}
.editor-block-input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .8rem;
}
.editor-block-row .btn { flex: 0 0 auto; padding: 4px 9px; font-size: .72rem; }
