.badge-tool {
    display: grid;
    align-items: start;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .badge-tool {
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 3rem;
    }
}

.badge-formats {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.375rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.875rem;
    background: white;
}

.badge-formats label {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.badge-formats input {
    position: absolute;
    opacity: 0;
}

.badge-formats span {
    display: block;
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.badge-formats input:checked + span {
    background: #006dce;
    color: white;
}

/* A darker brand blue keeps small control labels readable on white. */
.badge-tool .text-cncf-blue {
    color: #0062bd;
}

.badge-tool :focus-visible,
.badge-formats input:focus-visible + span {
    outline: 3px solid #0086ff;
    outline-offset: 3px;
}

.badge-preview {
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: repeating-conic-gradient(#e5e7eb 0% 25%, #f9fafb 0% 50%) 0 0 /
        24px 24px;
    box-shadow: 0 16px 40px -16px #0b193b40;
}

#badge-canvas {
    display: block;
    width: 100%;
    height: auto;
}

#badge-canvas.has-photo {
    touch-action: none;
    cursor: grab;
}

#badge-canvas.has-photo:active {
    cursor: grabbing;
}

.badge-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-controls input[type="text"],
.badge-caption {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
    padding: 0.75rem;
    font-size: 0.875rem;
}

.badge-caption {
    resize: vertical;
    min-height: 10rem;
    line-height: 1.6;
}

.badge-controls input[type="file"] {
    width: 100%;
    font-size: 0.875rem;
}

.badge-controls input::file-selector-button {
    margin-right: 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: #e6f3ff;
    color: #005caf;
    padding: 0.75rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.badge-controls input[type="range"] {
    width: 100%;
    min-height: 1.5rem;
    accent-color: #0086ff;
}

#badge-crop:disabled {
    opacity: 0.45;
}

.badge-social {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-social:hover {
    background: #e6f3ff;
}
