/**
 * Account area and public profiles.
 *
 * Same language as the Pricing section: flat surfaces, chamfered corners,
 * hairline rules, no gradients, Khand for display type and Inter for
 * everything small. Tokens come from .pricing-v2, which both pages carry on
 * <body>.
 *
 * Layout is a settings console rather than a stack of forms: an identity rail
 * that stays put, and numbered panels beside it, so the page reads as part of
 * the same technical family as the Technology and Company sections.
 */

body.account-page {
    --ac-bg: #0a0a1a;
    --ac-grid: rgba(140, 150, 230, 0.07);
    --ac-rail-w: 248px;

    background: var(--ac-bg);
    color: var(--pr-ink);
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html[data-theme="light"] body.account-page {
    --ac-bg: #f0f0f5;
    --ac-grid: rgba(60, 70, 160, 0.08);
}

html[data-theme="midnight"] body.account-page { --ac-bg: #0f172a; }
html[data-theme="quantum"] body.account-page { --ac-bg: #1a0a25; }

.ac-main {
    position: relative;
    flex: 1 0 auto;
    padding: 104px 0 72px;
}

/* The drafting grid the home page sections use, faded out down the page so it
   frames the header without competing with the forms. */
.ac-main::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 420px;
    pointer-events: none;
    background-image:
        linear-gradient(var(--ac-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--ac-grid) 1px, transparent 1px);
    background-size: 54px 54px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}

.ac-wrap {
    position: relative;
    width: min(1120px, 100% - 48px);
    margin: 0 auto;
}

.ac-narrow {
    width: min(720px, 100% - 48px);
}

/* ── Page head ───────────────────────────────────────────────────────────── */

.ac-head {
    padding-bottom: 22px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-eyebrow {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pr-faint);
    margin-bottom: 10px;
}

.ac-title {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.6rem;
    font-weight: 600;
    line-height: 1.02;
    color: var(--pr-ink);
    margin: 0 0 8px;
}

.ac-lede {
    font-size: 0.93rem;
    line-height: 1.6;
    color: var(--pr-muted);
    margin: 0;
}

/* Dot-separated facts under the title. */
.ac-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    font-size: 0.87rem;
    color: var(--pr-muted);
}

.ac-facts > * + *::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--pr-faint);
    margin-right: 14px;
    vertical-align: middle;
}

/* ── Two-column console ──────────────────────────────────────────────────── */

.ac-layout {
    display: grid;
    grid-template-columns: var(--ac-rail-w) minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.ac-rail {
    position: sticky;
    top: 96px;
}

/*
 * Settings: the panels are centred on the page and the rail sits in the
 * margin to their left, rather than the pair being centred together (which
 * pushed the panels right by half the rail). The right column is empty and
 * gives way first when the window narrows, so the layout slides back to
 * rail-beside-panels instead of squeezing the rail.
 */
.ac-wrap--wide {
    width: calc(100% - 48px);
}

.ac-layout--centered {
    grid-template-columns: minmax(var(--ac-rail-w), 1fr) minmax(0, 846px) minmax(0, 1fr);
}

.ac-layout--centered > .ac-rail {
    width: var(--ac-rail-w);
    justify-self: end;
}

.ac-rail-id {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-rail-name {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--pr-ink);
    margin: 0;
    overflow-wrap: anywhere;
}

.ac-rail-handle {
    font-size: 0.8rem;
    color: var(--pr-faint);
    margin: 0;
    overflow-wrap: anywhere;
}

/* Section links. The index numbers echo the pricing cards and the department
   tiles, which is what ties this page to the rest of the site. */
.ac-nav {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.ac-nav a {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: baseline;
    column-gap: 10px;
    padding: 8px 10px 8px 0;
    border-left: 2px solid transparent;
    padding-left: 12px;
    font-size: 0.89rem;
    font-weight: 500;
    color: var(--pr-muted);
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease;
}

.ac-nav a:hover {
    color: var(--pr-ink);
    text-decoration: none;
}

/* The active row is marked by weight and a soft tint rather than a coloured
   bar, which read as decoration bolted on rather than part of the page. */
.ac-nav a.is-active {
    color: var(--pr-ink);
    border-left-color: var(--pr-line-strong);
    background: var(--pr-current-bg);
    font-weight: 600;
}

.ac-nav .n {
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
    color: var(--pr-faint);
}

.ac-rail-foot {
    padding-top: 14px;
    border-top: 1px solid var(--pr-line);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.ac-rail-link {
    font-size: 0.84rem;
    color: var(--pr-muted);
    text-decoration: none;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.ac-rail-link:hover {
    color: var(--pr-accent);
    text-decoration: none;
}

.ac-rail-admin {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pr-accent);
    font-weight: 600;
}

.ac-rail-admin[hidden] {
    display: none;
}


/* ── Identity block, at the top of the Profile panel ─────────────────────── */

.ac-ident {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-bottom: 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-ident-copy {
    min-width: 0;
}

.ac-ident-name {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 1.7rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--pr-ink);
    margin: 0 0 2px;
    overflow-wrap: anywhere;
}

.ac-ident-handle {
    font-size: 0.88rem;
    color: var(--pr-faint);
    margin: 0 0 10px;
    overflow-wrap: anywhere;
}

/* Facts as chips rather than a dot-separated run: the dots crowded the line
   and the whole thing drifted oddly while scrolling when it sat in the page
   header. */
.ac-ident-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.ac-chip {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--pr-line);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pr-muted);
    line-height: 1.3;
    white-space: nowrap;
}

.ac-chip--plan {
    border-color: var(--pr-line-strong);
    color: var(--pr-ink);
}

@media (max-width: 575.98px) {
    .ac-ident {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
}


/* ── Profile picture, which is also the upload control ───────────────────── */

/*
 * Discoverability is graded: a small plus badge always sits on the corner so
 * the picture reads as interactive at a glance, and hovering or focusing
 * covers it with a camera and the word Change so there is no doubt.
 */
.ac-photo {
    position: relative;
    display: block;
    width: 84px;
    height: 84px;
    padding: 0;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    background: var(--pr-current-bg);
    cursor: pointer;
    overflow: hidden;
    flex: 0 0 auto;
    transition: border-color .15s ease;
}

.ac-photo:hover {
    border-color: var(--pr-line-strong);
}

/* Keyboard users still need to see where they are, so focus keeps a ring.
   Hover does not: the veil below is already unmistakable. */
.ac-photo:focus-visible {
    outline: 2px solid var(--pr-line-strong);
    outline-offset: 3px;
}

.ac-photo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ac-photo-veil {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: rgba(8, 10, 24, 0.72);
    color: #fff;
    opacity: 0;
    transition: opacity .15s ease;
}

.ac-photo:hover .ac-photo-veil,
.ac-photo:focus-visible .ac-photo-veil {
    opacity: 1;
}

.ac-photo-veil-text {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ac-photo[aria-busy="true"] {
    pointer-events: none;
    opacity: 0.6;
}

/* Fixed width, so the copy beside it starts at the same place whether or not
   there is a picture to remove. */
.ac-photo-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 84px;
    flex: 0 0 auto;
}

.ac-ident-remove {
    padding: 0;
    border: 0;
    background: none;
    color: var(--pr-faint);
    font-family: inherit;
    font-size: 0.76rem;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ac-ident-remove:hover {
    color: var(--pr-ink);
}

/*
 * visibility rather than display or the hidden attribute: the row must keep
 * its height and the column its width whether or not this is showing, or
 * uploading a picture shunts everything beside it.
 */
.ac-ident-remove.is-hidden {
    visibility: hidden;
    pointer-events: none;
}

/* Silent until there is something to say. */
.ac-photo-hint:empty {
    display: none;
}

/* ── Panels ──────────────────────────────────────────────────────────────── */

/* These are <section> elements, and newindex.css gives every section
   min-height:100vh for the full-viewport bands on the home page. Left alone,
   each panel stretches to a whole screen with its border colour showing
   below the content. */
.ac-card,
.ac-main section {
    min-height: 0;
}

.ac-card {
    --pcut: 20px;
    padding: 1px;
    background: var(--pr-edge);
    clip-path: polygon(var(--pcut) 0, 100% 0, 100% calc(100% - var(--pcut)), calc(100% - var(--pcut)) 100%, 0 100%, 0 var(--pcut));
    margin-bottom: 20px;
    /* Cleared by the sticky rail when jumped to from the section nav. */
    scroll-margin-top: 96px;
}

.ac-card:last-child {
    margin-bottom: 0;
}

.ac-card-inner {
    background: var(--pr-surface);
    clip-path: polygon(var(--pcut) 0, 100% 0, 100% calc(100% - var(--pcut)), calc(100% - var(--pcut)) 100%, 0 100%, 0 var(--pcut));
}

.ac-card-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 26px 13px 30px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-card-n {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--pr-faint);
    font-variant-numeric: tabular-nums;
}

.ac-card-title {
    flex: 1 1 auto;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.17em;
    text-transform: uppercase;
    color: var(--pr-muted);
    margin: 0;
}

.ac-card-aside {
    font-size: 0.82rem;
    color: var(--pr-faint);
    text-decoration: none;
    white-space: nowrap;
}

.ac-card-aside:hover {
    color: var(--pr-accent);
    text-decoration: none;
}

.ac-card-body {
    padding: 26px 30px 28px;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.ac-field {
    margin-bottom: 20px;
}

.ac-field:last-child {
    margin-bottom: 0;
}

.ac-label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pr-faint);
    margin-bottom: 8px;
}

.ac-input,
.ac-textarea,
select.ac-input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--pr-btn-border);
    border-radius: 6px;
    background: transparent;
    color: var(--pr-ink);
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.5;
    transition: border-color .15s ease, background .15s ease;
}

.ac-textarea {
    resize: vertical;
    min-height: 96px;
}

.ac-input::placeholder,
.ac-textarea::placeholder {
    color: var(--pr-faint);
    opacity: 0.7;
}

.ac-input:focus,
.ac-textarea:focus {
    outline: none;
    border-color: var(--pr-accent);
    background: var(--pr-current-bg);
}

.ac-input[aria-invalid="true"] {
    border-color: var(--pr-error);
}

.ac-hint {
    font-size: 0.79rem;
    line-height: 1.5;
    color: var(--pr-faint);
    margin: 7px 0 0;
}

/*
 * Hints under a field hold their line whether or not they say anything.
 *
 * min-height reserves exactly one line and opacity does the appearing, so a
 * message arriving mid-sentence cannot push the rest of the form down. The
 * text is still written into the element either way, which is what a screen
 * reader announces through role="status".
 */
.ac-hint#ac-username-hint {
    /* Exactly one line: same number as line-height above, so the reserved
       box and the filled box are the same height to the pixel. */
    min-height: 1.5em;
    opacity: 0;
    transition: opacity .18s ease;
}

.ac-hint#ac-username-hint.is-shown {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .ac-hint#ac-username-hint { transition: none; }
}

.ac-hint--error { color: var(--pr-error); }
.ac-hint--ok { color: var(--pr-accent); }

/* Username field carries its eventual URL inline, so the result is obvious
   before it is saved. */
.ac-prefix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--pr-btn-border);
    border-radius: 6px;
    overflow: hidden;
    transition: border-color .15s ease;
}

.ac-prefix:focus-within {
    border-color: var(--pr-accent);
}

.ac-prefix span {
    display: flex;
    align-items: center;
    padding: 0 0 0 13px;
    font-size: 0.88rem;
    color: var(--pr-faint);
    white-space: nowrap;
}

.ac-prefix .ac-input {
    border: 0;
    border-radius: 0;
    padding-left: 1px;
}

.ac-prefix .ac-input:focus {
    background: transparent;
}

.ac-grid2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* The pair's spacing is the grid's gap, the same side by side and stacked
   (where the last field's own zero margin used to butt it against the next). */
.ac-grid2 > .ac-field {
    margin-bottom: 0;
}

/* Checkbox rows read as a statement, not a bare box. */
/*
 * The same drawn box the simulator uses for Auto-Run, so a checkbox looks
 * like a Qubibyte checkbox everywhere and not like the browser's. The real
 * input stays in the page, invisible, so keyboard use, labels and screen
 * readers all keep working; only the picture is replaced.
 */
.ac-check {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    column-gap: 11px;
    align-items: start;
    cursor: pointer;
}

.ac-check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.ac-check-box {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 5px;
    border: 1.5px solid var(--pr-line-strong);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.ac-check-box::after {
    content: '';
    width: 5px;
    height: 9px;
    margin-top: -2px;
    border: solid var(--pr-on-accent, #06070f);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .15s ease;
}

.ac-check input:checked + .ac-check-box {
    background: var(--pr-accent);
    border-color: var(--pr-accent);
}

.ac-check input:checked + .ac-check-box::after {
    transform: rotate(45deg) scale(1);
}

.ac-check:hover .ac-check-box {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 22%, transparent);
}

.ac-check input:focus-visible + .ac-check-box {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 45%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .ac-check-box,
    .ac-check-box::after { transition: none; }
}

.ac-check-text {
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--pr-ink);
}

.ac-check .ac-hint {
    grid-column: 2;
    margin-top: 4px;
}

.ac-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid var(--pr-line);
}

.ac-status {
    font-size: 0.85rem;
    color: var(--pr-muted);
    margin: 0;
}

.ac-status--error { color: var(--pr-error); }
.ac-status--ok { color: var(--pr-accent); }

/* ── Avatar ──────────────────────────────────────────────────────────────── */


.ac-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--pr-current-bg);
    border: 1px solid var(--pr-line-strong);
    flex: 0 0 auto;
}

.ac-avatar--letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.1rem;
    font-weight: 600;
    color: var(--pr-muted);
}


/* A file input cannot be styled, so a label drives a hidden one. */
.ac-file {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ── Membership ──────────────────────────────────────────────────────────── */

.ac-plan {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 7px;
}

.ac-plan-name {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1;
    color: var(--pr-ink);
}

.ac-badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    border: 1px solid var(--pr-line-strong);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pr-muted);
    line-height: 1.2;
}

.ac-badge--active {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

.ac-badge--warn {
    border-color: var(--pr-error);
    color: var(--pr-error);
}

.ac-rows {
    list-style: none;
    margin: 20px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--pr-line);
}

.ac-rows--plain {
    margin: 0;
    padding: 0;
    border: 0;
}

.ac-rows li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.89rem;
}

.ac-rows li + li { margin-top: 10px; }
.ac-rows .k { color: var(--pr-muted); }
.ac-rows .v {
    color: var(--pr-ink);
    font-weight: 600;
    text-align: right;
    overflow-wrap: anywhere;
}

/* ── Danger ──────────────────────────────────────────────────────────────── */

.ac-card--danger {
    background: var(--pr-error);
}

.ac-card--danger .ac-card-title,
.ac-card--danger .ac-card-n {
    color: var(--pr-error);
}

.ac-danger-text {
    font-size: 0.89rem;
    line-height: 1.6;
    color: var(--pr-muted);
    margin: 0 0 20px;
}

.pr-btn--danger,
.pr-btn--danger:hover,
.pr-btn--danger:focus-visible {
    border-color: var(--pr-error);
    color: var(--pr-error);
}

/* ── Loading ─────────────────────────────────────────────────────────────── */

/*
 * The page starts blank rather than showing a spinner, and the skeleton only
 * fades in after a beat. A local /api/me answers in a few milliseconds, and a
 * message that appears and vanishes inside one frame reads as a flicker, which
 * is worse than showing nothing at all.
 */
.ac-boot {
    opacity: 0;
    animation: ac-boot-in .25s ease 0.35s forwards;
}

@keyframes ac-boot-in {
    to { opacity: 1; }
}

.ac-skel {
    background: var(--pr-current-bg);
    border-radius: 6px;
    height: 14px;
    margin-bottom: 12px;
}

.ac-skel--title { height: 34px; width: 280px; margin-bottom: 18px; }
.ac-skel--line { width: 100%; max-width: 520px; }
.ac-skel--short { width: 180px; }

@media (prefers-reduced-motion: reduce) {
    .ac-boot { animation-duration: .01s; }
}

/* The boot skeleton laid out like the profile head it stands in for. */
.pf-boot {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 30px 32px;
    min-height: 168px;
}

.pf-boot-avatar {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    margin-bottom: 0;
    flex: 0 0 auto;
}

.pf-boot-copy {
    flex: 1 1 260px;
    min-width: 0;
    padding-top: 6px;
}

.pf-boot-copy .ac-skel--title { max-width: 100%; }

/* ── Public profile ──────────────────────────────────────────────────────── */

.pf-head {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 30px 32px;
    flex-wrap: wrap;
    /* Tall enough for the marks in the corner even on a bare profile. */
    min-height: 168px;
}

.pf-avatar {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--pr-line-strong);
    background: var(--pr-current-bg);
    flex: 0 0 auto;
}

.pf-avatar--letter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.9rem;
    font-weight: 600;
    color: var(--pr-muted);
}

.pf-copy {
    flex: 1 1 260px;
    min-width: 0;
    /* Room for the three marks in the corner, plus the edit button above
       them. Reserved whether or not anybody has filled those links in. */
    padding-right: 150px;
    padding-bottom: 18px;
}

.pf-name {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.08;
    color: var(--pr-ink);
    /*
     * The padding buys headroom the clamp would otherwise cut off, and the
     * matching negative margin gives it straight back, so nothing on the
     * page moves. The plan chip is a superscript: it sits a little above the
     * line box, and this heading clips its overflow to hold the two-line
     * clamp, which was slicing the top border off the chip.
     */
    padding-top: 4px;
    margin: -4px 0 3px;
    overflow-wrap: anywhere;
}

.pf-handle {
    font-size: 0.92rem;
    color: var(--pr-faint);
    margin: 0 0 14px;
    overflow-wrap: anywhere;
}

.pf-bio {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--pr-muted);
    margin: 0 0 16px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pf-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    font-size: 0.85rem;
    color: var(--pr-faint);
}

/* ── Links, as marks ─────────────────────────────────────────────────────── */

/*
 * Pinned to the bottom-right of the identity box.
 *
 * The text column has a wide right margin reserved for it (.pf-copy below),
 * so a long name or a long bio never runs underneath the marks, and the
 * marks never move when one of them is missing.
 */
.pf-icons {
    position: absolute;
    right: 30px;
    bottom: 26px;
    display: flex;
    gap: 8px;
}

/*
 * A mark, not a label. The destination is in the title and the accessible
 * name, so the row stays the same width whether somebody's site is called
 * a.io or something considerably longer.
 */
.pf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    color: var(--pr-muted);
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease;
}

.pf-icon:hover,
.pf-icon:focus-visible {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

.pf-icon svg {
    display: block;
}

.pf-since-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 16px 0 0;
    /* The eye is taller than the text; keep the line the text's height. */
    height: 1.25rem;
}

.pf-since-line[hidden] {
    display: none;
}

.pf-since {
    font-size: 0.83rem;
    color: var(--pr-faint);
    font-variant-numeric: tabular-nums;
    margin: 0;
    transition: opacity .15s ease;
}

/* Editing, and hidden from visitors. */
.pf-since-line.is-off .pf-since {
    opacity: 0.32;
}

.pf-since-line .pf-since-eye {
    width: 28px;
    height: 28px;
}

/* Badges, under "Member since": earned or given ones, and a country flag. */
.pf-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
}

.pf-badges[hidden] {
    display: none;
}

.pf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    border-radius: 4px;
    outline: none;
    cursor: default;
}

.pf-badge img {
    display: block;
    width: 24px;
    height: 24px;
}

/* Flags are the flag emoji (Twemoji artwork, so they look the same on
   every system: Windows has no flag emoji of its own). Square, like any
   emoji; the artwork has its own rounded shape, so no frame. */
.pf-badge--flag img {
    width: 26px;
    height: 26px;
}

.pf-badge:focus-visible {
    box-shadow: 0 0 0 2px var(--pr-accent);
}

/* A text button, for an action that should be available without competing
   with the ones either side of it. */
.ac-linkish {
    padding: 0;
    border: 0;
    background: none;
    color: var(--pr-faint);
    font-family: var(--font-body);
    font-size: 0.82rem;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color .15s ease;
}

.ac-linkish:hover {
    color: var(--pr-accent);
}

.ac-linkish:disabled {
    opacity: 0.6;
    cursor: default;
}

.ac-linkish--danger:hover {
    color: var(--pr-error);
}

/* ── Following ───────────────────────────────────────────────────────────── */

.pf-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
}

/*
 * A count and its word, reading as one thing rather than as a button with a
 * label. The underline appears on hover so it is clearly something you can
 * open, without shouting about it when you are only reading the page.
 */
.pf-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--font-body);
    font-size: 0.86rem;
    color: var(--pr-faint);
    cursor: pointer;
    transition: color .15s ease;
}

.pf-stat-n {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pr-ink);
}

.pf-stat:hover,
.pf-stat:focus-visible {
    color: var(--pr-accent);
    outline: none;
}

.pf-stat:hover .pf-stat-k,
.pf-stat:focus-visible .pf-stat-k {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/*
 * Above the marks in the same corner, because it is the one thing on this
 * card somebody is most likely to have come to press.
 */
.pf-follow {
    position: absolute;
    right: 30px;
    bottom: 74px;
    padding: 8px 20px;
    border: 1px solid var(--pr-accent);
    border-radius: 999px;
    background: var(--pr-accent);
    color: var(--pr-on-accent, #06070f);
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.pf-follow:hover {
    filter: brightness(1.08);
}

/* Already following: quiet, and on hover it says what pressing it would do. */
.pf-follow.is-following {
    background: transparent;
    color: var(--pr-muted);
    border-color: var(--pr-line-strong);
}

.pf-follow.is-following:hover {
    border-color: var(--pr-error);
    color: var(--pr-error);
    filter: none;
}

.pf-follow:disabled {
    opacity: 0.7;
    cursor: default;
}

/* ── The follower and following lists ────────────────────────────────────── */

.pf-sheet {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 5, 14, 0.62);
}

.pf-sheet:not([hidden]) {
    animation: pf-sheet-fade .16s ease both;
}

/*
 * Built like .ac-card: an outer layer in the border colour and an inner one
 * in the surface colour, both clipped to the same cut corners. A CSS border
 * on a single clipped box is cut away along the diagonals, which is what
 * left two corners of this panel open. The shadow is a filter on the
 * unclipped wrapper, since clip-path would cut a box-shadow off too.
 */
.pf-sheet-box {
    --pcut: 16px;
    width: min(420px, 100%);
    max-height: min(560px, 82vh);
    display: flex;
    filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.45));
    animation: pf-sheet-rise .2s cubic-bezier(.2, .8, .2, 1) both;
}

.pf-sheet-box:focus {
    outline: none;
}

.pf-sheet-frame,
.pf-sheet-in {
    clip-path: polygon(var(--pcut) 0, 100% 0, 100% calc(100% - var(--pcut)),
        calc(100% - var(--pcut)) 100%, 0 100%, 0 var(--pcut));
}

.pf-sheet-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    padding: 1px;
    background: var(--pr-line-strong);
}

.pf-sheet-in {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--pr-surface);
}

@keyframes pf-sheet-fade {
    from { opacity: 0; }
}

@keyframes pf-sheet-rise {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
}

.pf-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px 14px 26px;
    border-bottom: 1px solid var(--pr-line);
}

.pf-sheet-title {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.17em;
    text-transform: uppercase;
    color: var(--pr-muted);
    margin: 0;
}

/* A quiet icon button: no ring at rest, a soft tile on hover. */
.pf-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    margin-right: -6px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--pr-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.pf-sheet-close svg {
    display: block;
}

.pf-sheet-close:hover {
    background: var(--pr-current-bg);
    border-color: var(--pr-line);
    color: var(--pr-ink);
}

.pf-sheet-close:active {
    transform: scale(0.94);
}

.pf-sheet-close:focus-visible {
    outline: none;
    border-color: var(--pr-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 30%, transparent);
    color: var(--pr-ink);
}

.pf-people {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
}

.pf-person-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 26px;
    text-decoration: none;
    transition: background .15s ease;
}

.pf-person-link:hover {
    background: var(--pr-current-bg);
}

.pf-person-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pr-current-bg);
    flex: 0 0 auto;
}

.pf-person-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pf-person-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pr-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-person-handle {
    font-size: 0.79rem;
    color: var(--pr-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-sheet-note {
    font-size: 0.8rem;
    color: var(--pr-faint);
    margin: 0;
    padding: 12px 26px 16px;
    border-top: 1px solid var(--pr-line);
}

/* ── Arriving without a blank beat ────────────────────────────────────────── */

/*
 * Held for a moment while the profile is drawn, so the page appears finished
 * rather than empty first. js/profile-cache.js always lets go within 400ms.
 * Opacity, not visibility: hidden content is not drawn at all, so letting go
 * left the fixed navbar a frame behind everything else; transparent content
 * is drawn and ready, and appears in one frame. Either way the browser does
 * not count it as painted, so it keeps the previous page on screen meanwhile.
 */
.pf-hold body {
    opacity: 0;
}

/* A remembered copy is about to be drawn, so the placeholder never shows. */
.pf-warm #pf-loading {
    display: none;
}

/* A fresh answer settles in rather than popping onto an empty page. */
.pf-in {
    animation: pf-in .22s ease both;
}

@keyframes pf-in {
    from { opacity: 0; transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
    .pf-in,
    .pf-sheet:not([hidden]),
    .pf-sheet-box { animation: none; }
}

@media (max-width: 767.98px) {
    .pf-follow {
        position: static;
        margin-top: 16px;
    }
}

/* ── API keys ────────────────────────────────────────────────────────────── */

.ac-api-plan {
    margin: 0 0 16px;
}

.ac-api-plan a {
    color: var(--pr-accent);
}

/*
 * The one-time reveal. Boxed and bordered in the accent so it reads as the
 * important thing on the card, because once it is gone it is gone.
 */
.ac-key-reveal {
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid var(--pr-accent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--pr-accent) 8%, transparent);
}

.ac-key-reveal-title {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--pr-ink);
    margin: 0 0 10px;
}

.ac-key-reveal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ac-key-secret {
    flex: 1 1 260px;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 6px;
    background: var(--pr-surface);
    color: var(--pr-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84rem;
    overflow-wrap: anywhere;
    user-select: all;
}

.ac-keys {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
}

.ac-key {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding: 11px 2px;
    border-top: 1px solid var(--pr-line);
}

.ac-key:first-child {
    border-top: 0;
}

.ac-key-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pr-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-key-prefix {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--pr-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-key-when {
    font-size: 0.78rem;
    color: var(--pr-faint);
    white-space: nowrap;
}

.ac-key-new {
    padding-top: 18px;
    border-top: 1px solid var(--pr-line);
}

.ac-key-new-field {
    max-width: 360px;
}

.ac-key-new-actions {
    margin-top: 14px;
    padding-top: 0;
    border-top: 0;
}

@media (max-width: 639.98px) {
    .ac-key {
        grid-template-columns: minmax(0, 1fr) auto;
    }
    .ac-key-prefix, .ac-key-when { grid-column: 1; }
    .ac-key .ac-linkish { grid-column: 2; grid-row: 1; }
}

/* ── Uploaded picture ────────────────────────────────────────────────────── */

.ac-upload {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 0 0 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-upload .pr-btn {
    padding: 8px 16px;
    font-size: 0.84rem;
}

.ac-upload-hint {
    flex-basis: 100%;
    margin: 0;
}

.ac-upload-wrap {
    position: relative;
    display: inline-flex;
}

/* "PLUS+" over the button's top-right corner. */
.ac-upload-tag {
    position: absolute;
    top: -8px;
    right: -10px;
    pointer-events: none;
}

/* ── Circuits ────────────────────────────────────────────────────────────── */

.pf-circuits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* One circuit on its own gets the whole row. Half a row with a gap beside it
   reads as a missing second circuit rather than a deliberate single. */
.pf-circuits > .pf-circuit:only-child {
    grid-column: 1 / -1;
}

.pf-circuit {
    --ccut: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pr-line);
    background: var(--pr-current-bg);
    clip-path: polygon(var(--ccut) 0, 100% 0, 100% calc(100% - var(--ccut)),
        calc(100% - var(--ccut)) 100%, 0 100%, 0 var(--ccut));
    transition: border-color .15s ease;
}

.pf-circuit:hover {
    border-color: var(--pr-line-strong);
}

/*
 * The drawing sits in a well on the builder's own canvas colour, so a circuit
 * looks the same here as it does where it was made. It scrolls rather than
 * being squashed: a circuit too wide for a card is still a circuit.
 */
.pf-circuit-figure {
    margin: 0;
    padding: 14px 12px;
    overflow-x: auto;
    overflow-y: auto;
    border-bottom: 1px solid var(--pr-line);
    background: #0a0a1a;
    scrollbar-width: thin;
    scrollbar-color: #6B5FC7 transparent;
    min-height: 152px;
    max-height: 264px;
    display: flex;
}

/*
 * margin auto, not align-items: center on the parent. They centre the same
 * way, but a flex item centred by align-items has its overflowing top clipped
 * and unreachable, which would make the first qubits of a tall circuit
 * impossible to scroll back to.
 */
.pf-circuit-figure .cq {
    flex: 0 0 auto;
    margin: auto;
}

/* ── The drawing itself, matching simulator/styles/components.css ────────── */

.cq {
    position: relative;
    font-family: var(--font-body, 'Inter', system-ui, sans-serif);
}

.cq-qlabel {
    position: absolute;
    left: 0;
    width: 30px;
    text-align: center;
    font-size: 0.66rem;
    font-weight: 600;
    color: #94a3b8;
    line-height: 18px;
}

.cq-wire {
    position: absolute;
    height: 2px;
    background: #6B5FC7;
    opacity: 0.6;
    transform: translateY(-1px);
}

/* The builder joins a controlled gate to its controls with a 4px bar in the
   gate's own colour. */
.cq-bus {
    position: absolute;
    width: 4px;
    background: var(--cq-color);
}

.cq-tile {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 2px solid var(--cq-edge);
    background: var(--cq-color);
    color: #fff;
    box-sizing: border-box;
}

.cq-tile-label {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
}

.cq-disc {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--cq-edge);
    background: var(--cq-color);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    box-sizing: border-box;
}

/* Gate colour families, copied from the builder. */
.cq-x { --cq-color: #ef4444; --cq-edge: #dc2626; }
.cq-y { --cq-color: #22c55e; --cq-edge: #16a34a; }
.cq-z { --cq-color: #3b82f6; --cq-edge: #2563eb; }
.cq-h { --cq-color: #a855f7; --cq-edge: #9333ea; }
.cq-phase { --cq-color: #06b6d4; --cq-edge: #0891b2; }
.cq-swap { --cq-color: #f97316; --cq-edge: #ea580c; }
.cq-measure { --cq-color: #10b981; --cq-edge: #059669; }
.cq-default { --cq-color: #6B5FC7; --cq-edge: #554A9E; }

.cq-more {
    position: absolute;
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 20px;
}

.pf-circuit-meta {
    /* Pushed to the bottom so every card in the row agrees where its name
       goes, however tall the drawing above it turned out. */
    margin-top: auto;
    padding: 11px 15px 13px;
}

.pf-circuit-name {
    display: block;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--pr-ink);
    margin: 0 0 3px;
    /* A 60 character name in a half-width card has to stop somewhere. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-circuit-stats {
    font-size: 0.76rem;
    color: var(--pr-faint);
    font-variant-numeric: tabular-nums;
    margin: 0;
}

.pf-circuit-desc {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--pr-muted);
    margin: 4px 0 0;
    overflow-wrap: anywhere;
    /* Two lines is enough to say what a circuit is for. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/*
 * The card's own controls, over the top-right corner of the drawing. Opening
 * it in the simulator is for anybody; renaming and removing appear only on
 * your own profile, and only while editing it.
 */
.pf-circuit-tools {
    position: absolute;
    top: 9px;
    right: 9px;
    display: flex;
    gap: 6px;
}

.pf-circuit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    background: var(--pr-surface);
    color: var(--pr-muted);
    font-size: 15px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.pf-circuit-btn:hover {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

.pf-circuit-btn--owner {
    display: none;
}

body.pf-is-editing .pf-circuit-btn--owner {
    display: inline-flex;
}

.pf-circuit-btn--danger:hover {
    border-color: var(--pr-error);
    color: var(--pr-error);
}

.pf-circuit-edit {
    display: grid;
    gap: 8px;
    padding: 12px 15px 14px;
    border-top: 1px solid var(--pr-line);
    background: var(--pr-surface);
}

.pf-circuit-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.pf-circuit-edit .pr-btn {
    padding: 7px 14px;
    font-size: 0.82rem;
}

.pf-circuits-empty {
    font-size: 0.87rem;
    line-height: 1.6;
    color: var(--pr-muted);
    margin: 0;
}

.pf-circuits-empty a {
    color: var(--pr-accent);
}

@media (max-width: 639.98px) {
    .pf-circuits {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ── Published work: articles, series, videos ────────────────────────────── */

/*
 * One item at a time, picture beside the words. More than one and the card
 * head gains a count and a pair of arrows, and the items slide along a track
 * inside a window exactly one item wide.
 */
.pf-works {
    overflow: hidden;
    /* The tiles are cut at the corners; keep the cut clear of the window edge. */
    padding: 1px;
    margin: -1px;
}

.pf-works-track {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    transition: transform .38s cubic-bezier(.22, .8, .24, 1);
    will-change: transform;
}

.pf-work {
    --ccut: 12px;
    flex: 0 0 100%;
    min-width: 0;
    border: 1px solid var(--pr-line);
    background: var(--pr-current-bg);
    clip-path: polygon(var(--ccut) 0, 100% 0, 100% calc(100% - var(--ccut)),
        calc(100% - var(--ccut)) 100%, 0 100%, 0 var(--ccut));
    transition: border-color .15s ease, opacity .38s ease;
}

/* The ones off to either side dim as they leave, so the slide reads as a
   hand-off rather than a hard wipe. */
.pf-work[inert] {
    opacity: 0.35;
}

.pf-work:hover,
.pf-work:focus-within {
    border-color: var(--pr-line-strong);
}

.pf-work-link {
    display: flex;
    align-items: stretch;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.pf-work-link:hover {
    color: inherit;
    text-decoration: none;
}

.pf-work-link:focus-visible {
    outline: 2px solid var(--pr-accent);
    outline-offset: -2px;
}

.pf-work-thumb {
    position: relative;
    display: block;
    flex: 0 0 44%;
    aspect-ratio: 16 / 9;
    background: #0a0a1a;
    border-right: 1px solid var(--pr-line);
    overflow: hidden;
}

.pf-work-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}

.pf-work-link:hover .pf-work-thumb img {
    transform: scale(1.03);
}

/* Videos and series play, so they say so. */
.pf-work-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 7, 15, 0.72);
    color: #fff;
    backdrop-filter: blur(4px);
}

.pf-work-copy {
    display: block;
    min-width: 0;
    margin: auto 0;
    padding: 16px 20px;
}

.pf-work-title {
    display: -webkit-box;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--pr-ink);
    margin: 0 0 5px;
    overflow: hidden;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.pf-work-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    color: var(--pr-faint);
    font-variant-numeric: tabular-nums;
}

.pf-work-ext {
    flex: 0 0 auto;
    display: inline-flex;
}

/* The count and arrows, at the right of the card head. */
.pf-works-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pf-works-nav .ac-card-aside {
    margin: 0 6px 0 0;
    font-variant-numeric: tabular-nums;
}

.pf-works-arrow {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--pr-line-strong);
    border-radius: 6px;
    background: transparent;
    color: var(--pr-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
}

.pf-works-arrow svg {
    display: block;
}

.pf-works-arrow:hover:not(:disabled) {
    background: var(--pr-current-bg);
    border-color: var(--pr-accent);
    color: var(--pr-ink);
}

.pf-works-arrow:active:not(:disabled) {
    transform: scale(0.94);
}

.pf-works-arrow:focus-visible {
    outline: none;
    border-color: var(--pr-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 30%, transparent);
}

.pf-works-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

@media (prefers-reduced-motion: reduce) {
    .pf-works-track,
    .pf-work,
    .pf-work-thumb img { transition: none; }
}

@media (max-width: 639.98px) {
    .pf-work-link {
        flex-direction: column;
    }

    .pf-work-thumb {
        flex-basis: auto;
        border-right: 0;
        border-bottom: 1px solid var(--pr-line);
    }

    .pf-work-copy {
        margin: 0;
        padding: 12px 15px 14px;
    }
}

/* The verified badge and its hover bubble are in css/site-account.css, with the
   navbar they appear in on every page. */

/* ── Plan badge ──────────────────────────────────────────────────────────── */

/*
 * Rides on the name rather than taking a line of its own. vertical-align is
 * set explicitly because a bare <sup> would also shrink the line box it sits
 * in, which moves the handle underneath it.
 */
.pf-plan-chip {
    display: inline-block;
    vertical-align: super;
    margin-left: 9px;
    padding: 2px 8px;
    border-radius: 4px;
    /* Plain ink rather than the accent: the badge beside it is already
       accent-coloured, and two different accents on one line compete.
       --pr-ink is white on the dark theme and near-black on the light one,
       so it stays readable either way. */
    border: 1px solid var(--pr-ink);
    font-family: var(--font-body);
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--pr-ink);
    white-space: nowrap;
}

/*
 * Reserve the scrollbar on these two pages.
 *
 * Opening the inline editor makes the profile tall enough to scroll, and the
 * scrollbar arriving narrows the viewport by 8px, which slides the centred
 * column 4px left. Nothing about the editor moved; the page did. A permanent
 * gutter means entering and leaving edit mode does not shift the layout.
 */
html {
    scrollbar-gutter: stable;
}

/* ── Edit mode ───────────────────────────────────────────────────────────── */

.pf-edit {
    position: absolute;
    top: 26px;
    right: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--pr-muted);
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.pf-edit:hover,
.pf-edit:focus-visible {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

/*
 * The inputs carry the class of the text they stand in for, so they are the
 * same font, size and weight. Only the frame is added, which is what makes
 * the page look the same in edit mode as out of it.
 */
/*
 * Deliberately sets no font. Each input also carries the class of the text it
 * stands in for (.pf-name, .pf-bio), and those supply the family, size and
 * weight, which is what makes edit mode the same page rather than a form.
 * The negative left margin cancels the border and padding, so the text inside
 * the box sits exactly where it sat outside it.
 */
.pf-input {
    display: block;
    width: 100%;
    padding: 6px 10px;
    margin: 0 0 3px -11px;
    border: 1px solid var(--pr-btn-border);
    border-radius: 6px;
    background: transparent;
    color: var(--pr-ink);
    transition: border-color .15s ease;
}

.pf-input:focus {
    outline: none;
    border-color: var(--pr-accent);
}

.pf-input[aria-invalid="true"] {
    border-color: var(--pr-error);
}

.pf-textarea {
    resize: vertical;
    min-height: 92px;
    margin-bottom: 8px;
}

.pf-field-msg {
    font-size: 0.75rem;
    color: var(--pr-error);
    margin: 0 0 10px -11px;
}

.pf-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--pr-faint);
    margin: 0 0 4px;
}

/*
 * The marks and the pencil are both away while editing, so the gutter held
 * for them goes back to the fields. Only padding-right changes, so the left
 * edge of every input stays exactly where its text was.
 */
body.pf-is-editing .pf-copy {
    padding-right: 0;
    padding-bottom: 0;
}

.pf-edit-panel {
    padding: 18px 32px 26px;
    border-top: 1px solid var(--pr-line);
}

.pf-edit-panel .ac-avatars {
    margin-bottom: 22px;
    border-bottom: 0;
    padding: 10px 0 0;
}

.pf-link-edit {
    display: grid;
    gap: 18px;
}

.pf-link-field .ac-label {
    margin-bottom: 7px;
}

.pf-link-field .pf-field-msg {
    margin: 6px 0 0;
}

.pf-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--pr-line);
}

/*
 * The primary action on a card. Named on the settings page's Save button
 * since it was written but never given a rule, so that button has been
 * drawing as an outline like everything around it.
 */
.pr-btn--solid,
.pr-btn--solid:hover,
.pr-btn--solid:focus-visible {
    border-color: var(--pr-accent);
    background: var(--pr-accent);
    color: var(--pr-on-accent, #06070f);
}

.pr-btn--solid:hover,
.pr-btn--solid:focus-visible {
    filter: brightness(1.08);
}

.pr-btn--solid:disabled {
    opacity: 0.6;
    cursor: default;
    filter: none;
}

@media (max-width: 767.98px) {
    /* No room to put the marks beside the text, so they go back in the flow
       under it and the reserved gutter comes off. */
    .pf-icons {
        position: static;
        margin-top: 18px;
    }

    .pf-copy {
        padding-right: 44px;
        padding-bottom: 0;
    }

    .pf-head {
        min-height: 0;
    }
}

@media (max-width: 575.98px) {
    .pf-edit {
        top: 18px;
        right: 18px;
    }

    .pf-edit-panel {
        padding: 18px 20px 24px;
    }
}

.pf-empty {
    text-align: center;
    padding: 72px 24px;
}

.pf-empty h1 {
    font-family: var(--font-display, 'Khand', sans-serif);
    font-size: 2rem;
    color: var(--pr-ink);
    margin: 0 0 8px;
}

.pf-empty p {
    color: var(--pr-muted);
    margin: 0 0 22px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
    .ac-layout,
    .ac-layout--centered {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ac-wrap--wide {
        width: min(1120px, 100% - 48px);
    }

    .ac-layout--centered > .ac-rail {
        width: auto;
        justify-self: stretch;
    }

    /* Unpinned once it is a horizontal strip above the content. */
    .ac-rail {
        position: static;
    }

    .ac-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 0;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--pr-line);
    }

    .ac-nav a {
        /* The number column goes with the numbers, or the name would be put
           in its 22px and spill over the next tab. */
        display: block;
        white-space: nowrap;
        border-left: 0;
        border-bottom: 2px solid transparent;
        padding: 6px 10px;
    }

    .ac-nav a.is-active {
        border-left: 0;
        border-bottom-color: var(--pr-line-strong);
    }

    .ac-nav .n { display: none; }

    .ac-rail-foot {
        flex-direction: row;
        gap: 18px;
        padding-top: 12px;
    }
}

@media (max-width: 767.98px) {
    .ac-wrap, .ac-narrow { width: calc(100% - 32px); }
    .ac-main { padding: 88px 0 48px; }
    .ac-title { font-size: 2.05rem; }
    .ac-grid2 { grid-template-columns: 1fr; }
    .ac-card-body { padding: 22px 20px 24px; }
    .ac-card-head { padding: 13px 20px 12px 26px; }
    .pf-head { padding: 24px 20px; gap: 18px; }
    .pf-links { padding: 14px 20px 20px; }
    .qa-name { display: none; }
}
/* ── Avatar chooser ──────────────────────────────────────────────────────── */

.ac-avatars {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    padding: 18px 0 22px;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-avatar-opt {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    transition: border-color .15s ease, transform .15s ease;
}

.ac-avatar-opt img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* Uploaded pictures are any shape; crop to the circle, never squash. */
    object-fit: cover;
    /* The default face is a transparent PNG, so the disc comes from here.
       The other fifteen draw their own and cover this completely. */
    background: var(--pr-current-bg);
}

.ac-avatar-opt:hover {
    transform: translateY(-2px);
}

.ac-avatar-opt:focus-visible {
    outline: none;
    border-color: var(--pr-line-strong);
}

.ac-avatar-opt[aria-checked="true"] {
    border-color: var(--pr-accent);
}

@media (max-width: 767.98px) {
    .ac-avatars {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 479.98px) {
    .ac-avatars {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Field counters ──────────────────────────────────────────────────────── */

/*
 * The counter shares the label's line and is only inked near the limit.
 * It occupies its space from the start and never changes the line's height,
 * so appearing cannot move a single pixel of the form.
 */
.ac-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.ac-label-row .ac-label {
    margin-bottom: 0;
}

.ac-count {
    /* Shared with the field's error message, which is why it clips rather
       than wraps: two lines here would move everything below it. */
    max-width: 62%;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: var(--pr-faint);
    white-space: nowrap;
    opacity: 0;
    transition: opacity .18s ease, color .18s ease;
}

.ac-count.is-shown {
    opacity: 1;
}

.ac-count.is-full {
    color: var(--pr-error);
}

@media (prefers-reduced-motion: reduce) {
    .ac-count { transition: none; }
}

/* ── Selects ─────────────────────────────────────────────────────────────── */

/*
 * A transparent select leaves the popup list to the platform, which on a dark
 * page renders white-on-white and is unreadable. Giving the control and its
 * options a real surface, and declaring the colour scheme, makes the native
 * list follow the page.
 */
select.ac-select {
    background-color: var(--pr-surface);
    color: var(--pr-ink);
    color-scheme: dark;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2399a1c4' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 10px 6px;
    padding-right: 34px;
}

html[data-theme="light"] .ac-select {
    color-scheme: light;
}

select.ac-select option {
    background-color: var(--pr-surface);
    color: var(--pr-ink);
}

/* ── Long-value guards ───────────────────────────────────────────────────── */

/*
 * Nothing stops somebody entering fifty W's. Every place a name or link is
 * rendered therefore either wraps mid-word or truncates, so a single
 * unbroken run cannot widen a card or push a layout sideways.
 */
.ac-ident-name,
.ac-rail-name,
.ac-rail-handle,
.pf-name,
.pf-handle {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/*
 * Wrapping alone is not enough. Fifty W's wrap to three lines and stretch the
 * card down the page, so the display name is also clamped: it takes at most
 * two lines anywhere it appears, and the rest is an ellipsis.
 */
.ac-ident-name,
.ac-rail-name,
.pf-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ac-rail-handle,
.pf-handle {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-link {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-rows .v {
    overflow-wrap: anywhere;
}

/* ── Checkout banner ─────────────────────────────────────────────────────── */

/*
 * Shown once, on the account page, after coming back from Stripe. It sits
 * under the navbar across the whole width and pushes the page down rather
 * than covering it. Closing it, reloading, or leaving the page all make it go:
 * the page strips the checkout details from the address as soon as it reads
 * them, so there is nothing left to show it again.
 */
.qb-banner {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--qb-banner-top, 64px);
    z-index: 1020;
    background: color-mix(in srgb, var(--pr-surface) 88%, var(--qb-banner-tone, var(--pr-accent)));
    border-bottom: 1px solid color-mix(in srgb, var(--qb-banner-tone, var(--pr-accent)) 45%, transparent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    animation: qb-banner-in .28s cubic-bezier(.2, .8, .2, 1) both;
}

.qb-banner--ok { --qb-banner-tone: #10b981; }
.qb-banner--warn { --qb-banner-tone: var(--pr-error); }

.qb-banner-in {
    display: flex;
    align-items: center;
    gap: 14px;
    width: min(1120px, 100% - 32px);
    margin: 0 auto;
    padding: 12px 0;
}

.qb-banner-icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--qb-banner-tone, var(--pr-accent));
    background: color-mix(in srgb, var(--qb-banner-tone, var(--pr-accent)) 16%, transparent);
}

.qb-banner-spin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: qb-banner-spin .8s linear infinite;
}

.qb-banner-text {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--pr-muted);
}

.qb-banner-text strong {
    color: var(--pr-ink);
    font-weight: 600;
    margin-right: 4px;
}

.qb-banner-act {
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--pr-ink);
    background: transparent;
    border: 1px solid var(--pr-line-strong);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
}

.qb-banner-act:hover { border-color: var(--qb-banner-tone, var(--pr-accent)); }
.qb-banner-act:disabled { opacity: .6; cursor: default; }

.qb-banner-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--pr-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.qb-banner-close:hover {
    background: var(--pr-current-bg);
    border-color: var(--pr-line);
    color: var(--pr-ink);
}

.qb-banner-close:focus-visible,
.qb-banner-act:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--pr-accent) 35%, transparent);
}

/* Room for the banner, so it never sits on top of the page. */
.ac-main {
    transition: padding-top .28s cubic-bezier(.2, .8, .2, 1);
}

.has-qb-banner .ac-main {
    padding-top: calc(104px + var(--qb-banner-height, 56px));
}

@keyframes qb-banner-in {
    from { transform: translateY(-8px); opacity: 0; }
}

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

@media (prefers-reduced-motion: reduce) {
    .qb-banner, .ac-main { animation: none; transition: none; }
    .qb-banner-spin { animation-duration: 2s; }
}

/* ── API: key, usage and credit ──────────────────────────────────────────── */

.ac-api {
    display: grid;
    gap: 22px;
    margin-top: 18px;
}

.ac-api-block {
    display: grid;
    gap: 10px;
}

.ac-api-block + .ac-api-block {
    padding-top: 20px;
    border-top: 1px solid var(--pr-line);
}

.ac-apikey-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-wrap: wrap;
}

.ac-apikey {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.86rem;
    color: var(--pr-muted);
    background: var(--pr-current-bg);
    border: 1px solid var(--pr-line);
    border-radius: 7px;
    overflow-wrap: anywhere;
    letter-spacing: 0.02em;
}

.ac-apikey.is-shown {
    color: var(--pr-ink);
    user-select: all;
}

.ac-apikey-replace {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.86rem;
    color: var(--pr-muted);
}

.ac-apikey-confirm {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ac-apikey-confirm[hidden] { display: none; }

.ac-usage-line {
    margin: 0;
    font-size: 1rem;
    color: var(--pr-muted);
    font-variant-numeric: tabular-nums;
}

.ac-usage-line strong {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--pr-ink);
}

.ac-usage-of { margin: 0 2px; }
.ac-usage-left { font-size: 0.88rem; margin-left: 4px; }

.ac-meter {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: var(--pr-current-bg);
    border: 1px solid var(--pr-line);
    overflow: hidden;
}

.ac-meter-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--pr-accent);
    transition: width .5s cubic-bezier(.2, .8, .2, 1);
}

.ac-meter.is-high .ac-meter-fill { background: var(--pr-error); }

.ac-credit-buy {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ac-credit-buy[hidden] { display: none; }
.ac-credit-buy .pr-btn { min-width: 76px; }

.ac-usage-test {
    padding: 16px;
    border: 1px dashed var(--pr-line-strong);
    border-radius: 8px;
}

.ac-usage-test[hidden] { display: none; }

.ac-usage-test-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.86rem;
    color: var(--pr-muted);
}

.ac-usage-test-row label { min-width: 150px; }
.ac-usage-test-row .ac-input { max-width: 150px; }

@media (prefers-reduced-motion: reduce) {
    .ac-meter-fill { transition: none; }
}

/* ── Qubibyte Cloud ──────────────────────────────────────────────────────── */

.ac-cloud-warn {
    margin: 18px 0 0;
    padding: 10px 14px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--pr-ink);
    font-size: 0.86rem;
    line-height: 1.5;
}

.ac-cloud-warn[hidden] {
    display: none;
}

.ac-cloud-uses {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.ac-cloud-uses li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 6px;
    font-size: 0.86rem;
}

.ac-cloud-use-size {
    color: var(--pr-muted);
    white-space: nowrap;
}

#sec-cloud .ac-api-block {
    margin-top: 18px;
}

.ac-cloud-use-name {
    color: var(--pr-ink);
    font-weight: 600;
    text-decoration: none;
}

.ac-cloud-use-name:hover {
    color: var(--pr-accent);
}

.ac-cloud-foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 16px;
}

.ac-cloud-foot .ac-hint {
    margin: 0;
}

/* ── Forum activity, on a profile ────────────────────────────────────────── */

.pf-forum-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-bottom: 14px;
    font-size: 0.8rem;
    color: var(--pr-faint);
}

.pf-forum-stat strong {
    margin-right: 5px;
    color: var(--pr-ink);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

/* The frame scrolls; the page does not grow with a busy poster. */
.pf-forum-scroll {
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--pr-line);
    border-radius: 8px;
    scrollbar-width: thin;
}

.pf-forum-scroll.is-empty {
    border-style: dashed;
}

.pf-forum {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pf-forum-item + .pf-forum-item {
    border-top: 1px solid var(--pr-line);
}

.pf-forum-link {
    display: grid;
    /* One column no wider than the card: without the limit the top line
       sets the width and the row runs out of the frame on a phone. */
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 12px 16px;
    color: var(--pr-ink);
    text-decoration: none;
    transition: background .15s ease;
}

.pf-forum-link:hover {
    background: var(--pr-current-bg);
    color: var(--pr-ink);
}

.pf-forum-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    font-size: 0.74rem;
    color: var(--pr-faint);
}

.pf-forum-kind {
    padding: 1px 7px;
    border-radius: 4px;
    background: var(--pr-current-bg);
    color: var(--pr-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.66rem;
}

.pf-forum-kind--topic {
    color: var(--pr-accent);
}

.pf-forum-kind--solution {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.pf-forum-cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.pf-forum-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: var(--c);
}

.pf-forum-when {
    margin-left: auto;
    white-space: nowrap;
}

.pf-forum-title {
    font-weight: 600;
    font-size: 0.93rem;
    overflow-wrap: anywhere;
}

.pf-forum-excerpt {
    color: var(--pr-muted);
    font-size: 0.84rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pf-forum-likes {
    color: #f43f5e;
    font-size: 0.76rem;
    font-weight: 600;
}

.pf-forum-end {
    margin: 0;
    padding: 14px 16px;
    color: var(--pr-faint);
    font-size: 0.82rem;
    text-align: center;
}


/* ── The profile's sections: arranged by the owner ───────────────────────── */

/*
 * While editing, every section is on the page so it can be arranged. A
 * hidden one is dimmed with a dashed edge and says so; an empty one says so
 * too. Neither is on the page for anyone else.
 */
.pf-section--off {
    opacity: 0.55;
}

.pf-section--off .ac-card-inner {
    border-style: dashed;
}

.pf-section-tag {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--pr-line-strong);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--pr-muted);
    vertical-align: middle;
}

.pf-section-empty {
    font-size: 0.87rem;
    line-height: 1.6;
    color: var(--pr-muted);
    margin: 0;
}

.pf-section-empty a {
    color: var(--pr-accent);
}

/* "Add a circuit": in the card head, owner only, while editing. */
.pf-section-add {
    margin-left: auto;
    padding: 6px 12px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 8px;
    background: var(--pr-surface);
    color: var(--pr-ink);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.pf-section-add:hover {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

.ac-card-head:has(.pf-section-add:not([hidden])) .ac-card-aside {
    margin-left: 0;
}

/* A Graphics document or 3D model: the page that draws it, in a frame. */
.pf-circuit-frame {
    position: relative;
    aspect-ratio: 16 / 10;
    border-bottom: 1px solid var(--pr-line);
    background: #0a0a1a;
}

.pf-circuit-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0a0a1a;
}

.pf-circuit-none {
    margin: auto;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Marked but not showing: the owner sees it dimmed, with why. */
.pf-circuit--off {
    opacity: 0.6;
    border-style: dashed;
}

.pf-circuit-problem {
    margin: 6px 0 0;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--pr-error);
}

/* ── Arranging the sections, in the edit panel ───────────────────────────── */

.pf-hint {
    margin: 0 0 10px;
    font-size: 0.82rem;
    color: var(--pr-muted);
}

.pf-layout {
    list-style: none;
    margin: 0 0 22px;
    padding: 0;
    display: grid;
    gap: 6px;
}

.pf-layout-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px 30px 34px;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 4px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: var(--pr-surface);
    transition: border-color .15s ease, opacity .15s ease, box-shadow .15s ease;
}

.pf-layout-row.is-off {
    opacity: 0.6;
    border-style: dashed;
}

.pf-layout-row.is-dragging {
    border-color: var(--pr-accent);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
    opacity: 1;
    position: relative;
    z-index: 2;
}

.pf-layout-grip,
.pf-layout-step,
.pf-layout-eye {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--pr-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.pf-layout-grip {
    width: 30px;
    cursor: grab;
    touch-action: none;
}

.pf-layout-row.is-dragging .pf-layout-grip {
    cursor: grabbing;
}

.pf-layout-step {
    width: 30px;
    font-size: 0.95rem;
    line-height: 1;
}

.pf-layout-eye {
    width: 34px;
}

.pf-layout-grip:hover,
.pf-layout-step:hover:not(:disabled),
.pf-layout-eye:hover {
    background: var(--pr-current-bg);
    color: var(--pr-ink);
}

.pf-layout-step:disabled {
    opacity: 0.3;
    cursor: default;
}

.pf-layout-copy {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.pf-layout-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--pr-ink);
    white-space: nowrap;
}

.pf-layout-count {
    font-size: 0.76rem;
    color: var(--pr-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Adding to a section: the picker ─────────────────────────────────────── */

.pf-pick-lede {
    margin: 0;
    padding: 0 26px 10px;
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--pr-muted);
}

.pf-pick {
    list-style: none;
    margin: 0;
    padding: 4px 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pr-line-strong) transparent;
}

.pf-pick-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 26px;
    border-top: 1px solid var(--pr-line);
}

.pf-pick-row:first-child {
    border-top: 0;
}

.pf-pick-row--error {
    background: rgba(239, 68, 68, 0.08);
}

.pf-pick-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.pf-pick-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--pr-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pf-pick-sub {
    font-size: 0.76rem;
    color: var(--pr-faint);
}

.pf-pick-action {
    flex: 0 0 auto;
}

.pf-pick-btn {
    padding: 7px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.pf-pick-state {
    font-size: 0.78rem;
    color: var(--pr-muted);
    white-space: nowrap;
}

@media (max-width: 639.98px) {
    .pf-layout-row {
        grid-template-columns: 26px minmax(0, 1fr) 26px 26px 30px;
        gap: 4px;
    }

    .pf-layout-copy {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
}

/* ── A banned account (js/account-page.js paintBan) ───────────────────────── */

.ac-ban {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    margin-bottom: 18px;
    border: 1px solid color-mix(in srgb, var(--pr-error) 55%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--pr-error) 9%, var(--pr-surface));
}

.ac-ban[hidden] {
    display: none;
}

.ac-ban-icon {
    flex: 0 0 auto;
    color: var(--pr-error);
    margin-top: 2px;
}

.ac-ban-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: var(--pr-ink);
}

.ac-ban-text,
.ac-ban-note {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--pr-muted);
}

.ac-ban-note {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--pr-current-bg);
    color: var(--pr-ink);
    white-space: pre-wrap;
}

body.ac-banned [aria-disabled="true"] .ac-card-body {
    opacity: 0.45;
    filter: grayscale(0.4);
}


/* ── Badges (Profile section) ──────────────────────────────────────────── */

.ac-badges {
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--pr-line);
}

.ac-badges-hint {
    display: block;
    margin: -2px 0 14px;
}

.ac-badge-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: grid;
    gap: 10px;
}

.ac-badge-list[hidden] {
    display: none;
}

.ac-badge-check {
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
}

.ac-badge-check:hover {
    border-color: var(--pr-line-strong);
}

.ac-badge-text {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ac-check .ac-badge-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ac-badge-copy .ac-hint {
    display: block;
    margin: 0;
}

.ac-badge-text strong {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--pr-ink);
}

.ac-badge-img {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
}

.ac-badges-none {
    margin: 0 0 18px;
    color: var(--pr-muted);
    font-size: 0.88rem;
}

.ac-flag-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pr-ink);
}

.ac-flag-row {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 420px;
}

.ac-flag-preview {
    flex: 0 0 auto;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
}

.ac-flag-preview.is-empty::before {
    content: '';
    width: 28px;
    height: 20px;
    border-radius: 4px;
    border: 1px dashed var(--pr-line-strong);
}

/* The flag emoji, as on the profile. */
.ac-flag-img {
    width: 30px;
    height: 30px;
}

.ac-flag-select {
    flex: 1 1 auto;
    min-width: 0;
}

#ac-badges-status {
    margin-top: 12px;
}


/* ── Badges, in the profile's edit panel ──────────────────────────────── */

.pf-badge-picks {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pf-badge-picks[hidden] {
    display: none;
}

.pf-badge-pick {
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
}

.pf-badge-pick:hover {
    border-color: var(--pr-line-strong);
}

.pf-badge-pick-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--pr-ink);
}

.pf-badge-pick-img {
    width: 24px;
    height: 24px;
}

.pf-flag-row {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 420px;
    margin: 0 0 22px;
}

.pf-flag-select {
    flex: 1 1 auto;
    min-width: 0;
}

/* The Badges heading gets the same room above it as Sections does. */
.pf-link-edit + .pf-section-label {
    margin-top: 24px;
}


/* ── Profile edit mode: the picture and the badges edit in place ───────── */

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

/* The pencil on the picture (edit mode only). */
.pf-avatar-edit {
    position: absolute;
    right: 2px;
    bottom: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--pr-line-strong);
    border-radius: 50%;
    background: var(--pr-surface);
    color: var(--pr-ink);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pf-avatar-edit[hidden] {
    display: none;
}

.pf-avatar-edit:hover,
.pf-avatar-edit[aria-expanded="true"] {
    border-color: var(--pr-accent);
    color: var(--pr-accent);
}

.pf-picture {
    margin-bottom: 22px;
}

.pf-picture[hidden] {
    display: none;
}

.pf-picture .pf-hint:empty {
    display: none;
}

/* The Custom tile: the uploaded picture, or an upload arrow, with its tag. */
.pf-avatar-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--pr-line-strong);
    color: var(--pr-muted);
}

.pf-avatar-custom[aria-checked="true"] {
    border-style: solid;
}

.pf-avatar-custom:hover {
    color: var(--pr-ink);
}

.pf-custom-tag {
    position: absolute;
    left: 50%;
    bottom: -7px;
    transform: translateX(-50%);
}

/* "PLUS+": marks what comes with Plus and Pro. */
.plus-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--pr-accent);
    color: var(--pr-on-accent, #06070f);
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.3;
    white-space: nowrap;
}

/* The badges line: the badges, and in edit mode the pencil beside them. */
.pf-badges-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.pf-badges-line .pf-badges {
    margin: 0;
}

/* With "Member since" off, the badges keep its gap from the counts. */
.pf-since-line[hidden] + .pf-badges-line {
    margin-top: 16px;
}

.pf-badges-line:has(.pf-badges[hidden]):has(.pf-badges-edit[hidden]) {
    display: none;
}

.pf-badges-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--pr-line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--pr-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.pf-badges-edit[hidden] {
    display: none;
}

.pf-badges-edit:hover,
.pf-badges-edit[aria-expanded="true"] {
    border-color: var(--pr-accent);
    color: var(--pr-ink);
}

.pf-badge-editor {
    margin-top: 14px;
    max-width: 520px;
}

.pf-badge-editor[hidden] {
    display: none;
}

.pf-badge-row .pf-flag-select {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 0.88rem;
}

.pf-badge-row-pic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
}

.pf-badge-row-pic.is-empty::before {
    content: '';
    width: 24px;
    height: 17px;
    border-radius: 3px;
    border: 1px dashed var(--pr-line-strong);
}

.pf-badge-row-img {
    width: 26px;
    height: 26px;
}

/* With the Custom tile there are 17 pictures: nine a row keeps them to two rows. */
@media (min-width: 768px) {
    .ac-avatars:has(.pf-avatar-custom) {
        grid-template-columns: repeat(9, 1fr);
    }
}

/* Free accounts see the allowance meter but not the API key or its limits. */
.ac-api-block[hidden] {
    display: none;
}

/* ── Usage history (account page, API section) ─────────────────────────── */

.ac-history-row .pr-btn {
    margin-top: 2px;
}

.ac-history {
    /* Centred in the viewport; the site's global reset takes the margin the
       browser would otherwise centre it with. */
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(560px, calc(100vw - 32px));
    height: fit-content;
    max-height: min(680px, calc(100dvh - 48px));
    padding: 0;
    border: 1px solid var(--pr-line-strong);
    border-radius: 14px;
    background: var(--pr-surface);
    color: var(--pr-ink);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.ac-history[open] {
    display: flex;
    flex-direction: column;
}

.ac-history::backdrop {
    background: rgba(4, 6, 18, 0.6);
}

.ac-history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-history-title {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pr-ink);
}

.ac-history-sub {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--pr-muted);
}

.ac-history-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: 1px solid var(--pr-line);
    border-radius: 8px;
    background: transparent;
    color: var(--pr-muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.ac-history-close:hover,
.ac-history-close:focus-visible {
    color: var(--pr-ink);
    border-color: var(--pr-line-strong);
    outline: none;
}

.ac-history-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px 12px 12px;
}

.ac-history-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ac-history-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--pr-line);
}

.ac-history-item:last-child {
    border-bottom: 0;
}

.ac-history-tag {
    min-width: 58px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--pr-line-strong);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-align: center;
    color: var(--pr-muted);
}

.ac-history-item--qubiai .ac-history-tag {
    color: var(--pr-accent);
    border-color: color-mix(in srgb, var(--pr-accent) 45%, transparent);
}

.ac-history-item--credit .ac-history-tag {
    color: #34d399;
    border-color: color-mix(in srgb, #34d399 45%, transparent);
}

.ac-history-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ac-history-label {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--pr-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-history-when {
    font-size: 0.74rem;
    color: var(--pr-faint);
}

.ac-history-amount {
    font-size: 0.86rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--pr-ink);
    white-space: nowrap;
}

.ac-history-amount.is-in {
    color: #34d399;
}

/* The info button at the end of each row, and the details box it opens
   under the row (js/account-page.js, js/usage-meta.js). Closed by default. */
.ac-history-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--pr-faint);
    cursor: pointer;
}

.ac-history-info:hover,
.ac-history-info.is-open {
    color: var(--pr-ink);
    border-color: var(--pr-line);
}

.ac-history-info:focus-visible {
    outline: 2px solid var(--pr-accent);
    outline-offset: 1px;
    color: var(--pr-ink);
}

.ac-history-details {
    grid-column: 1 / -1;
    min-width: 0;
}

.ac-history-details[hidden] {
    display: none;
}

.ac-history-details-scroll {
    /* About six rows, then it scrolls. */
    max-height: 15.5rem;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--pr-ink) 3%, transparent);
}

.ac-history-details-scroll:focus-visible {
    outline: 2px solid var(--pr-accent);
    outline-offset: 1px;
}

.ac-history-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.78rem;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.ac-history-table th,
.ac-history-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--pr-line);
    text-align: left;
    vertical-align: top;
}

.ac-history-table tbody tr:last-child th,
.ac-history-table tbody tr:last-child td {
    border-bottom: 0;
}

.ac-history-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--pr-surface);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pr-faint);
}

.ac-history-table tbody th {
    width: 38%;
    font-weight: 500;
    color: var(--pr-muted);
}

.ac-history-table td {
    color: var(--pr-ink);
    overflow-wrap: anywhere;
}

.ac-history-note {
    margin: 0;
    padding: 18px 8px 4px;
    font-size: 0.84rem;
    text-align: center;
    color: var(--pr-muted);
}

.ac-history-note:empty {
    display: none;
}

.ac-history-sentinel {
    height: 1px;
}

html[data-theme="light"] .ac-history::backdrop {
    background: rgba(20, 24, 50, 0.35);
}

html[data-theme="light"] .ac-history-item--credit .ac-history-tag,
html[data-theme="light"] .ac-history-amount.is-in {
    color: #059669;
}

@media (max-width: 575.98px) {
    .ac-history-head {
        padding: 16px 14px 10px;
    }

    .ac-history-scroll {
        padding: 4px 6px 10px;
    }

    .ac-history-item {
        gap: 8px;
    }

    .ac-history-tag {
        min-width: 0;
    }
}
