.profile-bio-panel {
    box-sizing:border-box;
    min-width:0;
    margin-top:.65rem;
    padding:clamp(8px,2%,16px);
    border:1px solid var(--profile-box-border,var(--profile-tile-border,#8fa6c2));
    border-radius:var(--profile-box-corners,10px);
    background:var(--profile-tile,var(--profile-ui-card,#eaf0fa));
    overflow-wrap:anywhere;
}
.profile-bio-panel [data-bio-panel-text] {margin:0;white-space:pre-wrap;color:inherit;font:inherit;}
.profile-bio-images {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,120px),1fr));gap:8px;align-items:start;}
.profile-bio-panel [data-bio-panel-text]:not([hidden]) + .profile-bio-images:has(img) {margin-top:8px;}
.profile-bio-images img {display:block;width:auto;max-width:100%;height:auto;max-height:320px;object-fit:contain;justify-self:center;}
.profile-bio-panel[hidden],.profile-bio-panel [hidden],#profile_bio [data-empty-bio][hidden],.profile-bio-editor [hidden] {display:none!important;}
.profile-custom-dialog .profile-bio-editor {
    box-sizing:border-box;min-width:0;margin:6px 0 12px;padding:8px 10px;border:1px solid var(--profile-ui-border,#658ba8);border-radius:8px;
}
.profile-custom-dialog .profile-bio-editor legend {width:auto;margin:0;padding:0 4px;font:18px/1.2 'Bangers',sans-serif;color:inherit;}
.profile-custom-dialog .profile-bio-editor label {display:grid;gap:3px;justify-content:stretch;margin:5px 0;}
.profile-custom-dialog .profile-bio-editor > label {display:flex;justify-content:flex-start;}
.profile-custom-dialog .profile-bio-editor input[type=checkbox] {width:18px;height:18px;accent-color:var(--profile-ui-accent,#35c9db);}
.profile-custom-dialog .profile-bio-editor :is(textarea,input:not([type=checkbox])) {min-width:0;width:100%;max-width:100%;box-sizing:border-box;}
.profile-custom-dialog .profile-bio-editor textarea,.profile-custom-dialog .profile-bio-editor input[type=text] {
    color:var(--profile-ui-ink,inherit);background:var(--profile-ui-field,transparent);border:1px solid var(--profile-ui-border,#658ba8);
    border-radius:6px;padding:5px;font:inherit;font-size:16px;
}
.profile-custom-dialog .profile-bio-editor textarea {resize:vertical;}
.profile-bio-image-edit {display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:center;gap:5px;}
.profile-bio-image-edit img {width:40px;height:40px;object-fit:contain;}
.profile-bio-status {margin:4px 0 0;}
.profile-bio-status:empty {display:none;}

/* Use the actual column and card widths, including after a saved section is moved. */
#profile-layout-row [data-profile-column]:has(> [data-profile-split]) {container:profile-column / inline-size;}
#profile-layout-row [data-profile-split] {container:profile-split / inline-size;align-self:flex-start;}
@container profile-column (max-width:251px) {
    #profile-layout-row [data-profile-column] > [data-profile-split] {--profile-split-width:100%;}
}
@container profile-split (max-width:280px) {
    html body .forumcontainer #profile-layout-row [data-profile-split][id] > .card-body {
        box-sizing:border-box;min-width:0;max-width:100%;padding:8px!important;
        --profile-editor-end:0px;--profile-title-end:0px;--collections-padding-right:0px;
    }
    /* The two editor buttons use their own row above the heading. */
    html body .forumcontainer #profile-layout-row.profile-layout-editable [data-profile-split][id] > .card-body {margin-top:36px!important;}
    html body .forumcontainer #profile-layout-row [data-profile-split][id] :is(.profile-scene-toolbar,.habitat-carousel-toolbar,.profile-achievements-heading) {
        flex-wrap:wrap!important;gap:4px!important;min-width:0;padding-inline:0!important;
    }
    html body .forumcontainer #profile-layout-row :is(#profile_userdetails,#profile_stats,#profile_links,#collections,#profile_bio,#profile_bugs,#profile_pets,#profile_trophies,#profile_sanctuary,#profile_habitats,#profile_achievements,.profile-showcase)[data-profile-split] .card-body h5.card-title {
        padding:0!important;margin:0 0 6px!important;min-height:0!important;min-width:0;
        max-width:100%;font-size:clamp(16px,8cqi,var(--profile-box-heading_size,24px))!important;
        line-height:1.15!important;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word;
    }
    html body .forumcontainer #profile-layout-row [data-profile-split] .profile-panel-options {min-width:0;margin:4px 0!important;padding:4px!important;}
    html body .forumcontainer #profile-layout-row [data-profile-split] .profile-move-buttons {display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;}
    #profile-layout-row [data-profile-split] :is(.profile-showcase-nav,.profile-panel-options label) {flex-wrap:wrap;min-width:0;gap:3px;}
    #profile-layout-row :is(#profile_userdetails,#profile_stats,#profile_bio)[data-profile-split] .card-body p {overflow-wrap:anywhere;}
    #profile-layout-row #profile_userdetails[data-profile-split] #profile_boards_avatar_container img {max-width:100%;height:auto;}
    #profile-layout-row #profile_userdetails[data-profile-split] #profile_ha_container {width:100%;max-width:200px;height:auto!important;aspect-ratio:200/285;}
    #profile-layout-row #profile_userdetails[data-profile-split] .pronouns-tag {box-sizing:border-box;max-width:100%;white-space:normal;overflow-wrap:anywhere;padding:5px 7px;}
    #profile-layout-row [data-profile-split] .profile-showcase-grid {grid-template-columns:repeat(auto-fit,minmax(min(100%,78px),1fr))!important;gap:4px;padding:2px;}
    #profile-layout-row [data-profile-split] .profile-showcase-art {width:min(100%,64px)!important;height:auto!important;aspect-ratio:1;}
    #profile-layout-row [data-profile-split] .profile-showcase-art img {width:100%!important;height:100%!important;object-fit:contain;}
    html body .forumcontainer #profile-layout-row #profile_links[data-profile-split] > .card-body > .profile-links-grid {
        display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,52px),1fr))!important;gap:4px!important;
    }
    #profile-layout-row #profile_links[data-profile-split] .profile-links-grid img {width:36px!important;height:36px!important;}
    html body .forumcontainer #profile-layout-row #collections[data-profile-split] > .card-body > .profile-collections-grid {display:grid!important;grid-template-columns:minmax(0,1fr)!important;}
    html body .forumcontainer #profile-layout-row #collections[data-profile-split] .profile-collections-grid > .card.m-1 {width:100%!important;grid-column:auto!important;}
    html body .forumcontainer #profile-layout-row #collections[data-profile-split] table td:last-child {flex-direction:column!important;align-items:start!important;}
    html body .forumcontainer #profile-layout-row #collections[data-profile-split] table td :is(.card-title,a) {white-space:normal!important;overflow-wrap:anywhere;}
    #profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > img:first-child {max-width:100%!important;width:100%!important;height:auto!important;object-fit:contain;}
    html body .forumcontainer #profile-layout-row #profile_achievements[data-profile-split] .profile-achievements-grid {
        display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(100%,90px),1fr))!important;gap:4px!important;
    }
    html body .forumcontainer #profile-layout-row #profile_achievements[data-profile-split] .profile-achievement,
    html body .forumcontainer #profile-layout-row #profile_trophies[data-profile-split] .profile_trophy {min-width:0!important;min-height:0!important;width:auto!important;max-width:100%!important;}
    #profile-layout-row :is(#profile_trophies,#profile_achievements)[data-profile-split] :is(.profile_trophy,.profile-achievement) img {
        width:min(80px,100%)!important;max-width:100%!important;min-width:0!important;height:auto!important;aspect-ratio:1;object-fit:contain;
    }
}

.profile-custom-dialog .profile-all-boxes {justify-content:flex-start;margin:8px 0 0;gap:7px;}
.profile-all-boxes > input {width:18px;height:18px;accent-color:var(--profile-ui-accent);}
.profile-all-boxes[hidden],.profile-all-boxes + small[hidden],.profile-inner-sample[hidden] {display:none!important;}
.profile-custom-dialog .profile-inner-sample {margin-top:8px;border:1px solid;border-radius:8px;padding:6px 10px;font:inherit;}
#profile-layout-row #profile_bio.profile-custom-item_background .profile-bio-panel {background:var(--profile-item_background)!important;}
#profile-layout-row #profile_bio.profile-custom-item_border .profile-bio-panel {border-color:var(--profile-item_border)!important;}
html body .forumcontainer #profile-layout-row #collections.profile-custom-item_background:not([data-item-cards="off"]) .profile-collections-grid > .card {
    background:var(--profile-item_background)!important;
}
html body .forumcontainer #profile-layout-row #collections.profile-custom-item_background:not([data-item-cards="off"]) .profile-collections-grid > .card > .card-body {
    background:transparent!important;
}
html body .forumcontainer #profile-layout-row #collections.profile-custom-item_border:not([data-item-cards="off"]) .profile-collections-grid > .card {
    border:1px solid var(--profile-item_border)!important;
}

/* An explicitly selected glow also reaches nested biography text and links on personal themes. */
html body .forumcontainer #profile-layout-row [data-profile-section][id].profile-font-glow > .card-body,
html body .forumcontainer #profile-layout-row [data-profile-section][id].profile-font-glow > .card-body :is(h2,h3,h4,h5,p,a,span,strong,em,small,td,figcaption):not(:where(button *,[role=button],.profile-panel-options *)),
html body dialog.profile-custom-dialog .profile-custom-preview.profile-font-glow :is(h4,p,.profile-inner-sample) {
    text-shadow:var(--profile-font-shadow)!important;
}
.profile-custom-dialog .profile-glow-controls {
    min-width:0;margin:8px 0;padding:5px 10px;border:1px solid var(--profile-ui-border);border-radius:8px;
}
.profile-custom-dialog .profile-glow-controls legend {
    width:auto;margin:0;padding:0 4px;color:inherit;font:18px/1.2 'Bangers',sans-serif;
}
.profile-custom-dialog .profile-glow-controls .profile-custom-field {margin:4px 0;}

/* Tie each companion to its own portrait, including after dragging or resizing the card. */
#profile-layout-row #profile_pets .petprofile_image_link > .petprofile_minimal {
    width:min(40%,80px);max-width:100%;height:auto;object-fit:contain;
}
#profile-layout-row #profile_pets[data-profile-split] .profile_pet_container,
#profile-layout-row #profile_pets[data-profile-split] .profile_pet {
    box-sizing:border-box;width:100%!important;min-width:0!important;max-width:100%!important;
    height:auto!important;min-height:0!important;margin:0!important;
}
#profile-layout-row #profile_pets[data-profile-split] .profile_pet {
    display:grid!important;grid-template-columns:minmax(0,1fr);align-content:start;gap:4px;padding:4px!important;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link {
    display:block!important;position:relative!important;inset:auto!important;float:none!important;
    width:100%!important;height:auto!important;aspect-ratio:1;margin:0!important;padding:0!important;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > img {
    display:block!important;position:absolute!important;max-width:100%!important;margin:0!important;object-fit:contain!important;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > img:first-child {
    inset:0!important;width:100%!important;height:100%!important;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > .petprofile_minimal {
    inset:auto 2px 2px auto!important;width:min(40%,80px)!important;height:auto!important;max-height:44%;pointer-events:none;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > .petprofile_first_edition_icon {
    inset:3px 3px auto auto!important;width:clamp(12px,13%,20px)!important;height:auto!important;pointer-events:none;
}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_image_link > .is-left {left:3px!important;right:auto!important;}
#profile-layout-row #profile_pets[data-profile-split] .petprofile_name {
    display:block!important;position:static!important;float:none!important;min-width:0;width:auto!important;height:auto!important;
    margin:0!important;line-height:1.3!important;text-align:center;white-space:normal!important;overflow-wrap:anywhere;
}

@media (max-width:767.98px) {
    html body dialog.profile-custom-dialog {
        width:460px;
        max-width:calc(100vw - 14px);
        max-height:calc(100dvh - 24px);
        padding:9px;
        font-size:14px;
        line-height:1.3;
    }
    html body .profile-custom-dialog > h3 {font-size:21px;margin:0 0 4px;}
    html body .profile-custom-dialog > p {font-size:12px;margin:3px 0 6px;}
    html body .profile-custom-dialog .profile-custom-preview {min-height:0;margin:5px 0;padding:6px 8px;}
    html body .profile-custom-dialog .profile-custom-preview h4 {margin-bottom:2px;}
    html body .profile-custom-dialog .profile-custom-preview + div {
        display:grid;
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:4px 8px;
    }
    html body .profile-custom-dialog .profile-custom-preview + div > * {grid-column:1/-1;min-width:0;}
    html body .profile-custom-dialog .profile-custom-field {gap:4px;margin:0;}
    html body .profile-custom-dialog .profile-custom-field > label {font-size:13px;line-height:1.2;}
    html body .profile-custom-dialog .profile-custom-field:has(> input[type=color]) {
        display:grid;
        grid-column:auto;
        grid-template-columns:36px minmax(0,1fr);
        gap:1px 4px;
    }
    html body .profile-custom-dialog .profile-custom-field:has(> input[type=color]) > label {grid-column:1/-1;}
    html body .profile-custom-dialog .profile-custom-field > input[type=color] {
        width:36px;
        height:34px;
        min-height:34px;
        margin:0;
    }
    html body dialog.profile-custom-dialog[aria-labelledby] :is(button,select,input[type=file]) {
        min-height:34px !important;
        padding:3px 6px !important;
    }
    html body dialog.profile-custom-dialog select {font-size:16px;}
    html body .profile-custom-dialog .profile-custom-image-title {font-size:18px;margin:5px 0 1px;}
    html body .profile-custom-dialog .profile-custom-upload-status {margin:0;}
    html body .profile-custom-dialog .profile-custom-actions {gap:5px;margin-top:6px;}
    html body .profile-custom-dialog .profile-custom-choice-list {max-height:150px;}
    html body dialog.profile-custom-dialog {box-sizing:border-box;overflow:auto;overscroll-behavior:contain;}
    html body .profile-custom-dialog .profile-all-boxes {min-height:32px;margin:2px 0 0;}
    html body .profile-custom-dialog .profile-all-boxes + small {font-size:12px;line-height:1.25;}
    html body .profile-custom-dialog .profile-glow-controls {margin:3px 0;padding:2px 8px 4px;}
    html body .profile-custom-dialog .profile-glow-controls .profile-custom-field {
        display:grid;grid-template-columns:minmax(100px,1fr) minmax(60px,1fr) 43px;min-height:29px;margin:0;
    }
    html body .profile-custom-dialog .profile-glow-controls input[type=color] {grid-column:2/4;justify-self:end;}
    html body .profile-custom-dialog .profile-glow-controls .profile-custom-field > label {grid-column:1;}
    html body .profile-custom-dialog .profile-glow-controls input[type=range] {width:100%;min-height:28px;margin:0;}
    html body .profile-custom-dialog .profile-custom-preview [data-bio-panel-text]:not([hidden]) {
        display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;
    }
    html body .profile-custom-dialog .profile-custom-preview .profile-bio-images {
        grid-template-columns:repeat(auto-fit,minmax(min(100%,48px),1fr));gap:4px;
    }
    html body .profile-custom-dialog .profile-custom-preview .profile-bio-images img {max-height:48px;}
    html body .profile-custom-dialog .profile-bio-editor {padding:4px 8px;margin:2px 0;}
    html body .profile-custom-dialog .profile-bio-editor label {margin:3px 0;}
    html body .profile-custom-dialog .profile-bio-editor textarea {height:3.25em;}
}
