.profile-settings {
    --profile-muted: #a7c7d4;
    --profile-line: #5daec45c;
    --profile-field: #041824e5;
    margin-top: 20px;
}

.profile-settings [hidden] { display: none !important; }
.profile-feedback { margin: 0 0 12px; color: #b6f0ff; }
.profile-feedback:empty { display: none; }
.profile-feedback.is-error { color: #ffd2a5; }

.profile-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.profile-settings-card {
    min-width: 0;
    padding: clamp(14px, 1.65vw, 24px);
    border: 1px solid var(--profile-line);
    border-radius: 12px;
    background: linear-gradient(155deg, #123c4db3, #03131fe8 75%);
    box-shadow: inset 0 1px #8eeeff33;
}

.profile-settings-card h3, .profile-dialog h3 {
    margin: 0 0 12px;
    color: #e4faff;
    font: 650 1.02rem/1.3 var(--mono);
}
.profile-help {
    margin: 7px 0 12px;
    color: var(--profile-muted);
    font-size: .79rem;
    line-height: 1.45;
}

.profile-identity {
    display: grid;
    gap: 8px;
    margin: 0;
}
.profile-identity > div {
    display: grid;
    grid-template-columns: minmax(90px, 40%) minmax(0, 1fr);
    gap: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--profile-line);
}
.profile-identity dt { color: var(--profile-muted); font-size: .82rem; }
.profile-identity dd { margin: 0; overflow-wrap: anywhere; }

.profile-change { margin-top: 12px; }
.profile-change summary {
    color: #b6f0ff;
    font-size: .86rem;
    padding: 10px 0;
    cursor: pointer;
}
.profile-change summary:focus-visible { outline: 2px solid var(--hq-cyan); outline-offset: 3px; }

.profile-form {
    display: grid;
    justify-items: start;
    gap: 9px;
}
.profile-form label:not(.profile-check) { display: grid; width: 100%; gap: 4px; }
.profile-form label, .profile-avatar-label, .profile-character-header label {
    color: #d3edf5;
    font-size: .86rem;
    font-weight: 580;
}
.profile-form input:not([type="checkbox"]),
.profile-form select, .profile-form textarea,
.profile-character-header select {
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--profile-line);
    border-radius: 6px;
    background: var(--profile-field);
    color: #edfaff;
    font: inherit;
}
.profile-form textarea { resize: vertical; }
.profile-check {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}
.profile-settings input[type="checkbox"],
.profile-settings input[type="radio"] { accent-color: var(--hq-cyan); }
.profile-settings :is(input, select, textarea):focus-visible {
    outline: 2px solid var(--hq-cyan);
    outline-offset: 3px;
}

.profile-avatar-row {
    display: grid;
    grid-template-columns: minmax(80px, 112px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.profile-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    aspect-ratio: 1;
    width: 100%;
    border: 1px solid var(--profile-line);
    border-radius: 9px;
    background: radial-gradient(ellipse at center, #25546c91, #041521);
    color: var(--profile-muted);
    text-align: center;
    font-size: .72rem;
}
.profile-avatar img, [data-hq-profile-avatar] {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
[data-hq-profile-avatar] {
    aspect-ratio: .94;
    max-height: 34vh;
    border: 1px solid #5bacc277;
    border-radius: 5px;
}
.profile-avatar-label { display: grid; gap: 4px; }
.profile-avatar-label input { width: 100%; font: inherit; }
.profile-avatar-label input::file-selector-button {
    border: 1px solid var(--profile-line);
    border-radius: 5px;
    background: var(--profile-field);
    color: #e4faff;
    padding: 5px 8px;
    margin-inline-end: 6px;
    cursor: pointer;
}

.profile-records {
    display: grid;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}
.profile-records li {
    display: grid;
    gap: 2px;
    padding: 6px 9px;
    border-left: 2px solid var(--profile-line);
    background: #051b29a8;
}
.profile-records li strong { color: #e4faff; font-size: .85rem; }
.profile-records li span { color: var(--profile-muted); font-size: .79rem; overflow-wrap: anywhere; }
.profile-awards li { border-left-color: #efb969; }
.profile-awards li strong { color: #ffdfad; }

.profile-character-card { grid-column: 1 / -1; }
.profile-character-header {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    justify-content: space-between;
    gap: 10px;
}
.profile-character-header select { padding: 5px 8px; }
.profile-character-header h3 { margin-bottom: 0; }
.profile-figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 10px;
}
.profile-figure {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 5px;
    border: 1px solid var(--profile-line);
    border-radius: 8px;
    padding: 8px;
    background: #071d2ad9;
    cursor: pointer;
}
.profile-figure:has(input:checked) {
    border-color: var(--hq-cyan);
    box-shadow: inset 0 0 13px #51d4ec2b;
}
.profile-figure:focus-within { outline: 2px solid var(--hq-cyan); outline-offset: 2px; }
.profile-figure img {
    width: 100%;
    height: auto;
    aspect-ratio: .9;
    object-fit: cover;
    border-radius: 5px;
}
.profile-figure-title { display: flex; align-items: center; gap: 5px; }
.profile-figure-name { color: #ebfaff; font-size: .87rem; font-weight: 650; }
.profile-figure-slogan { color: #b2ecf6; font-size: .76rem; }
.profile-figure-description { color: var(--profile-muted); font-size: .73rem; }
.profile-figure-actions, .profile-dialog-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.profile-settings button:disabled { opacity: .48; cursor: default; }

.profile-dialog {
    width: min(94%, 440px);
    box-sizing: border-box;
    padding: 23px;
    border: 1px solid var(--hq-cyan);
    border-radius: 12px;
    background: linear-gradient(155deg, #123c4d, #03131f);
    color: #d8f1f8;
    box-shadow: 0 0 36px #51d4ec45;
}
.profile-dialog::backdrop { background: #010a13b8; }
.profile-dialog img {
    display: block;
    width: min(224px, 100%);
    max-height: 45vh;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    border: 1px solid var(--profile-line);
    border-radius: 6px;
    background: #03131f;
}

@media (max-width: 900px) {
    .profile-settings-grid { grid-template-columns: minmax(0, 1fr); }
}

[data-avatar-crop] { display: block; width: min(224px, 100%); height: auto; margin: auto; border: 1px solid currentColor; }
.profile-settings-card > summary, #management-body summary { cursor: pointer; }
