.teacher-badge-slot,
.teacher-earned-badge-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.teacher-badge-slot[hidden],
.teacher-earned-badge-slot[hidden],
.teacher-earned-badge-slot--centered[hidden],
.teacher-earned-badge-slot--avatar[hidden] {
    display: none !important;
}

.teacher-earned-badge-slot--centered {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.teacher-earned-badge-slot--avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.teacher-badge-identity {
    display: inline-flex;
    min-width: 0;
    gap: 0.45rem;
    align-items: center;
}

.teacher-badge {
    --teacher-badge-size: 1.5rem;
    display: inline-flex;
    max-width: 100%;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: #172033;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.25;
    vertical-align: middle;
}

.teacher-badge--interactive {
    border-radius: 10px;
    cursor: pointer;
    outline: none;
    pointer-events: auto !important;
    touch-action: manipulation;
}

.teacher-badge--interactive .teacher-badge__image {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.teacher-badge--interactive:hover .teacher-badge__image {
    filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.16));
    transform: translateY(-2px) scale(1.04);
}

.teacher-badge--interactive:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.38);
    outline-offset: 4px;
}

.teacher-badge__image {
    display: block;
    width: var(--teacher-badge-size);
    height: var(--teacher-badge-size);
    max-width: none;
    flex: 0 0 var(--teacher-badge-size);
    object-fit: contain;
}

.teacher-badge__label {
    color: #1e3a5f;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

.teacher-badge--avatar {
    --teacher-badge-size: 1.25rem;
}

.teacher-badge--compact {
    --teacher-badge-size: 1.5rem;
}

.teacher-badge--inline {
    --teacher-badge-size: 2rem;
    gap: 0.5rem;
}

.teacher-badge--card {
    --teacher-badge-size: 3rem;
}

.teacher-badge--hero,
.teacher-badge--progress,
.teacher-badge--celebration {
    flex-direction: column;
    gap: 0.65rem;
    margin-inline: auto;
}

.teacher-badge--hero {
    --teacher-badge-size: clamp(6rem, 18vw, 8rem);
}

.teacher-badge--hero .teacher-badge__label {
    color: #1d4ed8;
    font-size: 1rem;
}

.teacher-badge--progress {
    --teacher-badge-size: clamp(4.5rem, 12vw, 6rem);
}

.teacher-badge--celebration {
    --teacher-badge-size: clamp(8rem, 28vw, 10rem);
}

.teacher-profile-badge-slot {
    width: 100%;
    margin-top: 1rem;
    text-align: center;
}

.custom-popup-container.teacher-badge-detail-popup {
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
    border-top: 4px solid #3b82f6;
}

.custom-popup-container.teacher-badge-detail-popup .custom-popup-content {
    align-items: flex-start;
    gap: 0;
    padding: 28px 32px 32px;
}

.custom-popup-container.teacher-badge-detail-popup .custom-popup-icon {
    display: none;
}

.custom-popup-container.teacher-badge-detail-popup .custom-popup-text {
    width: 100%;
    padding-right: 0;
}

.custom-popup-container.teacher-badge-detail-popup .custom-popup-title {
    margin: 0 36px 4px;
    color: #0f172a;
    font-size: 1.25rem;
    text-align: center;
}

.teacher-badge-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.teacher-badge-detail__image {
    display: block;
    width: clamp(12rem, 48vw, 16rem);
    height: clamp(12rem, 48vw, 16rem);
    max-width: 100%;
    object-fit: contain;
}

.teacher-badge-detail__description {
    max-width: 42ch;
    margin: 0;
    color: #475569;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

.teacher-badge-detail__progress-link {
    color: #3b82f6;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.teacher-badge-detail__progress-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.teacher-badge-detail__progress-link:focus-visible {
    border-radius: 4px;
    outline: 3px solid rgba(59, 130, 246, 0.38);
    outline-offset: 4px;
}

@media (max-width: 480px) {
    .teacher-badge--hero {
        --teacher-badge-size: 6rem;
    }

    .teacher-badge--celebration {
        --teacher-badge-size: 8rem;
    }

    .custom-popup-container.teacher-badge-detail-popup .custom-popup-content {
        padding: 24px 20px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .teacher-badge--interactive .teacher-badge__image {
        transition: none;
    }
}

@media (forced-colors: active) {
    .teacher-badge__image {
        border: 1px solid CanvasText;
        border-radius: 50%;
    }
}
