.api-profile-save-entry { text-align: center; }
.api-profile-save-entry button {
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid #237cb8;
    border-radius: 6px;
    background: #237cb8;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
body.api-profile-save-open { overflow: hidden; }
#api-profile-save-editor {
    width: min(840px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    margin: auto;
    padding: 20px;
    box-sizing: border-box;
    overflow: auto;
    border: 1px solid #c8d3dc;
    border-radius: 8px;
    background: #f7f9fc;
    color: #24364a;
    font: inherit;
}
#api-profile-save-editor::backdrop { background: rgba(8, 16, 24, .72); }
.api-profile-save-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.api-profile-save-editor-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.api-profile-save-icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid #c8d3dc;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font-family: Arial, sans-serif;
    font-size: 26px;
    cursor: pointer;
}
.api-profile-save-editor-layout { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); grid-template-areas: "preview position" "preview controls"; gap: 20px 28px; align-items: start; }
.api-profile-save-preview { grid-area: preview; position: relative; min-width: 0; align-self: start; aspect-ratio: 3 / 4; }
.api-profile-save-card {
    position: absolute;
    top: 0;
    left: 0;
    isolation: isolate;
    width: 540px;
    height: 720px;
    transform: scale(var(--profile-preview-scale, .6666667));
    transform-origin: top left;
    box-sizing: border-box;
    overflow: hidden;
    border: 6px solid var(--profile-frame, #8195a5);
    border-radius: 8px;
    background-color: var(--profile-bg-1, #edf2f5);
    background-image: var(--profile-bg-image, none), linear-gradient(160deg, var(--profile-bg-1, #edf2f5), var(--profile-bg-2, #cbd5dd));
    background-position: center;
    background-size: cover;
    color: #fff;
    box-shadow: inset 0 0 0 2px var(--profile-frame-accent, #f6f9fb), 0 0 12px var(--profile-frame-glow, transparent);
}
.api-profile-save-card::after { content: ''; position: absolute; inset: 3px; border: 1px solid var(--profile-frame-accent, #f6f9fb); border-radius: 3px; pointer-events: none; }
.api-profile-save-brand {
    padding: 60px 21px 0;
    font-size: 18px;
    line-height: 1.4;
    color: #fff;
    text-align: center;
    text-shadow: 0 2px 3px rgba(48, 48, 48, .8), 0 4px 8px rgba(48, 48, 48, .65), 0 0 12px rgba(48, 48, 48, .6);
}
.api-profile-save-character { position: absolute; left: var(--profile-foot-x, 50%); top: var(--profile-foot-y, 66%); width: 0; height: 0; }
.api-profile-save-character img { position: absolute; display: block; width: 260px; height: auto; max-width: none; max-height: none; left: -130px; top: -260px; object-fit: contain; image-rendering: auto; }
.api-profile-save-character span { position: absolute; bottom: 0; left: -150px; width: 300px; font-size: 18px; text-align: center; text-shadow: 0 1px 3px #16232f; }
.api-profile-save-identity { position: absolute; bottom: 0; left: 0; right: 0; padding: 21px 24px 42px; background: linear-gradient(transparent, rgba(10, 19, 29, .86)); text-align: center; overflow-wrap: anywhere; text-shadow: 0 1px 3px #16232f; }
.api-profile-save-nickname { margin-bottom: 7px; font-size: 33px; line-height: 1.35; }
.api-profile-save-world { margin-bottom: 16px; font-size: 18px; }
.api-profile-save-nickname, .api-profile-save-world { position: relative; top: 12px; }
.api-profile-save-tags { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-end; gap: 6px 15px; min-height: 66px; font-size: 20px; line-height: 1.5; }
.api-profile-save-tags span { min-width: 0; max-width: 100%; }
.api-profile-save-controls { grid-area: controls; min-width: 0; }
.api-profile-save-zero { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #8393a4; }
.api-profile-save-zero button { font: inherit; cursor: pointer; }
#api-profile-save-zero-status { margin: 12px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.api-profile-save-visibility { margin: 0; padding: 0 0 20px; border: 0; border-bottom: 1px solid #c8d3dc; }
.api-profile-save-visibility legend, .api-profile-save-theme-controls h3 { margin: 0 0 14px; padding: 0; font-size: 14px; }
.api-profile-save-switch { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 40px 28px; align-items: center; gap: 10px; min-height: 44px; font-size: 13px; cursor: pointer; }
.api-profile-save-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.api-profile-save-switch-track { position: relative; width: 40px; height: 24px; box-sizing: border-box; border: 1px solid #8393a4; border-radius: 14px; background: #d7e0e9; }
.api-profile-save-switch-track::after { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform 150ms ease; }
.api-profile-save-switch input:checked + .api-profile-save-switch-track { background: #237cb8; border-color: #237cb8; }
.api-profile-save-switch input:checked + .api-profile-save-switch-track::after { transform: translateX(16px); }
.api-profile-save-switch input:focus-visible + .api-profile-save-switch-track { outline: 2px solid #237cb8; outline-offset: 3px; }
.api-profile-save-switch > span:last-child { font-size: 11px; }
.api-profile-save-theme-controls { margin-top: 20px; }
.api-profile-save-theme-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 14px; border: 1px solid #8393a4; border-radius: 4px; overflow: hidden; }
.api-profile-save-theme-modes button { min-height: 40px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
.api-profile-save-theme-modes button + button { border-left: 1px solid #8393a4; }
.api-profile-save-theme-modes button[aria-pressed="true"] { background: #237cb8; color: #fff; }
.api-profile-save-freestyle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.api-profile-save-freestyle label { display: grid; gap: 6px; min-width: 0; color: #63778b; font-size: 11px; }
.api-profile-save-freestyle select { width: 100%; min-width: 0; min-height: 40px; padding: 8px; border: 1px solid #8393a4; border-radius: 4px; background: #fff; color: #24364a; font: inherit; font-size: 12px; cursor: pointer; }
.api-profile-save-freestyle select:focus-visible { outline: 2px solid #237cb8; outline-offset: 2px; }
.api-profile-save-theme-controls dl { margin: 0 0 16px; }
.api-profile-save-theme-controls dl > div { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 0; border-bottom: 1px solid #dce4eb; }
.api-profile-save-theme-controls dt { font-size: 11px; color: #63778b; }
.api-profile-save-theme-controls dd { margin: 0; font-size: 13px; }
#api-profile-save-swap { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; border: 1px solid #8393a4; border-radius: 4px; background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
#api-profile-save-swap span { font-family: Arial, sans-serif; font-size: 24px; }
#api-profile-save-theme-note { min-height: 36px; margin: 12px 0 0; color: #63778b; font-size: 11px; line-height: 1.7; }
.api-profile-save-position-controls { grid-area: position; min-width: 0; padding-bottom: 20px; border-bottom: 1px solid #8393a4; }
.api-profile-save-position-controls h3 { margin: 0 0 14px; font-size: 14px; }
.api-profile-save-position-controls button { min-height: 40px; border: 1px solid #8393a4; border-radius: 4px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
#api-profile-save-foot-pick { width: 100%; font-size: 12px; }
#api-profile-save-foot-pick[aria-pressed="true"] { background: #237cb8; color: #fff; }
.api-profile-save-axis-dials { display: grid; gap: 14px; margin: 16px 0; }
.api-profile-save-axis { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; gap: 4px 12px; font-size: 12px; }
.api-profile-save-axis output { text-align: right; font-variant-numeric: tabular-nums; }
.api-profile-save-axis input { grid-column: 1 / -1; width: 100%; min-width: 0; height: 28px; margin: 0; padding: 0; accent-color: #237cb8; cursor: pointer; }
.api-profile-save-axis input:focus-visible { outline: 2px solid #237cb8; outline-offset: 3px; }
#api-profile-save-position-reset { width: 100%; font-size: 12px; }
#api-profile-save-download { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 18px; border: 1px solid #237cb8; border-radius: 4px; background: #237cb8; color: #fff; font: inherit; font-size: 13px; cursor: pointer; }
#api-profile-save-download span { font: 22px Arial, sans-serif; }
#api-profile-save-download:disabled { opacity: .65; cursor: wait; }
.api-profile-save-position-controls :disabled { opacity: .4; cursor: default; }
.api-profile-save-card.is-picking-foot { cursor: crosshair; }
.api-profile-save-card.is-picking-foot .api-profile-save-character::after { content: ''; position: absolute; width: 16px; height: 16px; left: -8px; top: -8px; border: 2px solid #fff; outline: 2px solid #237cb8; border-radius: 50%; pointer-events: none; }
#api-profile-save-editor [hidden] { display: none !important; }
#api-profile-save-editor button:focus-visible, .api-profile-save-entry button:focus-visible { outline: 2px solid #237cb8; outline-offset: 3px; }
body.theme-dark #api-profile-save-editor { background: #151c25; border-color: #435165; color: #eef3f8; }
body.theme-dark .api-profile-save-visibility, body.theme-dark .api-profile-save-theme-controls dl > div { border-color: #435165; }
body.theme-dark .api-profile-save-theme-controls dt, body.theme-dark #api-profile-save-theme-note { color: #becbd8; }
body.theme-dark .api-profile-save-freestyle label { color: #becbd8; }
body.theme-dark .api-profile-save-freestyle select { background: #101722; border-color: #8393a4; color: #eef3f8; }
@media (max-width: 640px) {
    #api-profile-save-editor { padding: 16px; }
    .api-profile-save-editor-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "preview" "position" "controls"; grid-template-rows: auto auto auto; gap: 24px; }
    .api-profile-save-preview { width: min(100%, 360px); margin: 0 auto; }
    .api-profile-save-editor-head h2 { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .api-profile-save-switch-track::after { transition: none; } }
