.tf-avatar-trigger {
    position: relative;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 14px;
    background: transparent;
    vertical-align: middle;
}

.tf-avatar-trigger img {
    display: block;
    width: 104px;
    height: 104px;
    object-fit: cover;
    border-radius: 14px;
}

.tf-avatar-trigger span {
    position: absolute;
    bottom: 5px;
    padding: 3px 7px;
    border-radius: 7px;
    background: #192437;
    color: white;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.player-avatar-photo { position: relative; display: inline-block; }
.player-avatar-photo .tf-avatar-upload {
    position: absolute;
    z-index: 4;
    bottom: 10px;
    inset-inline: 0;
    pointer-events: none;
}
.player-avatar-photo .tf-avatar-trigger {
    min-height: 44px;
    pointer-events: auto;
}
.player-avatar-photo .tf-avatar-trigger span {
    position: static;
    padding: 8px 12px;
}
.player-avatar-photo .tf-avatar-status {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    padding: 5px;
    background: #192437;
    color: white;
    border-radius: 7px;
}

.tf-avatar-status {
    margin: 6px 0 0;
    max-width: 24ch;
    font-size: 12px;
    color: inherit;
}

.tf-avatar-dialog:not([open]) { display: none; }

.tf-avatar-dialog {
    pointer-events: auto;
    position: fixed;
    inset: 0;
    width: min(480px, calc(100% - 16px));
    max-height: calc(100% - 16px);
    margin: auto;
    padding: clamp(12px, 4vw, 22px);
    border: 0;
    border-radius: 16px;
    background: white;
    color: #192437;
    box-shadow: 0 16px 56px #11182755;
    overscroll-behavior: contain;
    overflow: auto;
}

.tf-avatar-dialog::backdrop { background: #111827b8; }
.tf-avatar-dialog h2 { font-size: 19px; margin: 0 0 6px; }
.tf-avatar-dialog p { margin: 0 0 10px; font-size: 13px; }
.tf-avatar-stage {
    height: clamp(145px, 42vh, 360px);
    margin: 22px 12px;
    touch-action: none;
}

.tf-avatar-stage .cropper-container { direction: ltr; text-align: left; }
.tf-avatar-stage img { display: block; max-width: 100%; }
.tf-avatar-stage .cropper-view-box { outline: 2px solid white; outline-offset: -1px; }
.tf-avatar-stage .cropper-face { cursor: move; }
.tf-avatar-stage .cropper-point {
    width: 44px;
    height: 44px;
    margin: 0;
    opacity: 1;
    background: transparent;
}
.tf-avatar-stage .cropper-point::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 1px solid #17233d;
    background: white;
    box-shadow: 0 1px 4px #11182788;
    opacity: 1;
    pointer-events: none;
}
.tf-avatar-stage :is(.point-n, .point-s)::before { width: 22px; height: 8px; }
.tf-avatar-stage :is(.point-e, .point-w)::before { width: 8px; height: 22px; }
.tf-avatar-stage :is(.point-nw, .point-n, .point-ne) { top: -22px; }
.tf-avatar-stage :is(.point-sw, .point-s, .point-se) { bottom: -22px; }
.tf-avatar-stage :is(.point-nw, .point-w, .point-sw) { left: -22px; }
.tf-avatar-stage :is(.point-ne, .point-e, .point-se) { right: -22px; }
.tf-avatar-stage :is(.point-n, .point-s) { margin-left: -22px; }
.tf-avatar-stage :is(.point-e, .point-w) { margin-top: -22px; }

.tf-avatar-tools, .tf-avatar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.tf-avatar-actions { justify-content: flex-end; }
.tf-avatar-dialog button {
    min-height: 44px;
    min-width: 44px;
    padding: 5px 10px;
    border: 1px solid #cbd4e1;
    border-radius: 8px;
    background: #f7f9fc;
    color: #192437;
    font: inherit;
    font-size: 13px;
}
.tf-avatar-dialog [data-crop-apply] {
    background: #2347a1;
    color: #fff;
    border-color: #2347a1;
    font-weight: 700;
}
.tf-avatar-dialog button:disabled { opacity: .55; }
.tf-avatar-dialog :focus-visible, .tf-avatar-trigger:focus-visible {
    outline: 2px solid #1675dd;
    outline-offset: 3px;
}
.tf-avatar-dialog .tf-avatar-feedback { margin: 8px 0 0; }
.tf-avatar-feedback:empty { display: none; }
