.profile-photo-upload {
    justify-items: start;
}

.profile-file-button {
    display: inline-grid;
    min-height: 48px;
    place-items: center;
    padding: 0.7rem 1.2rem;
    border: 2px dashed rgba(17, 100, 102, 0.55);
    border-radius: 4px;
    color: var(--brand);
    background: rgba(17, 100, 102, 0.06);
    cursor: pointer;
    font-weight: 800;
}

.profile-file-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.profile-file-button:focus-within {
    outline: 3px solid rgba(217, 164, 65, 0.55);
    outline-offset: 2px;
}

.profile-image-preview {
    display: block;
    width: 180px;
    height: 240px;
    margin-top: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.profile-image-preview[hidden] {
    display: none;
}

.avatar {
    border: 1px solid var(--line);
    border-radius: 4px;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}

.avatar-large {
    width: 96px;
    height: 128px;
}

.profile-card {
    grid-template-columns: 225px minmax(0, 1fr);
    align-items: start;
}

.profile-photo {
    width: 225px;
    height: 300px;
    max-width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--line);
    border-radius: 4px;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.crop-modal-open {
    overflow: hidden;
}

.crop-modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 1.25rem;
    background: rgba(12, 25, 42, 0.76);
    backdrop-filter: blur(5px);
}

.crop-modal[hidden] {
    display: none;
}

.crop-dialog {
    display: grid;
    gap: 1rem;
    width: min(820px, 100%);
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    padding: clamp(1rem, 3vw, 1.75rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.crop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.crop-header h2 {
    margin: 0;
}

.crop-close {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: white;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-size: 1.35rem;
    font-weight: 800;
}

.crop-stage {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 4px;
    background: #172234;
    touch-action: none;
}

.crop-stage canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 9999px rgba(8, 17, 30, 0.52), 0 0 0 1px rgba(255, 255, 255, 0.75) inset;
    cursor: move;
    touch-action: none;
}

.crop-box:focus {
    outline: 3px solid rgba(217, 164, 65, 0.72);
    outline-offset: -1px;
}

.crop-size-controls,
.crop-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.crop-size-controls .button {
    min-width: 46px;
    padding: 0.45rem 0.9rem;
}

@media (max-width: 520px) {
    .crop-modal {
        padding: 0.6rem;
    }

    .crop-dialog {
        max-height: calc(100vh - 1.2rem);
    }
}

@media (max-width: 760px) {
    .profile-card {
        grid-template-columns: 1fr;
    }

    .profile-photo {
        justify-self: center;
    }
}
