/* Image Generator Component Styles */

:root {
    --brand-primary: #9E7FA4;
    --brand-light: #B9A8BF;
    --brand-pale: rgba(158, 127, 164, 0.1);
    --text-dark: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-family-base: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.blur {
    filter: blur(4px);
    opacity: 0.5;
    pointer-events: none;
}

.gallerybox {
    white-space: nowrap;
    overflow-x: auto;
    cursor: pointer;
    user-select: none;
    height: 200px;
    display: flex;
    align-items: center;
}

.imgbox {
    height: 120px;
    padding-left: 3px;
    padding-right: 3px;
}

.imgbox img {
    width: 120px;
    margin-right: 5px;
    border-radius: 20px;
    border: 1px solid rgb(138, 138, 128);
    transition: transform 0.2s ease;
}

/* Size comes from the gallery grid in style.css; a fixed width here made the
   thumbnails wider than their grid cells, so they overlapped. */
.designer-thumb {
    object-fit: cover;
    border-radius: 15px;
}

.imgbox img.selected {
    transform: scale(1.06);
    border: 5px solid #9E7FA4;
}

.pointer-hover {
    cursor: pointer;
}

#promptToggleIcon {
    transition: transform 0.2s ease;
}

.pointer-hover:hover {
    opacity: 0.85;
}

.designer-preview {
    position: relative;
}

#delete-preview-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
}

#delete-preview-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    background-color: #dc3545;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

#delete-preview-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
    background-color: #c82333;
}

#delete-preview-btn i {
    font-size: 1.2rem;
    color: white;
}

.thumb-container.removing {
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: scale(0);
    opacity: 0;
}

/* Clear Input Button */
.clear-input-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-input-btn:hover {
    color: var(--brand-primary);
    transform: scale(1.1);
}

.clear-input-btn:active {
    transform: scale(0.95);
}

.clear-input-btn i {
    display: block;
}

.credit-cost-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.78rem;
    font-weight: 600;
}

/* Modern Checkbox Styles */
.modern-checkbox-container {
    display: flex;
    align-items: center;
}

.modern-checkbox-container.full-width {
    width: 100%;
}

.modern-checkbox-input {
    display: none;
}

.modern-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    transition: all 0.2s ease;
    user-select: none;
}

.modern-checkbox-label.full-width {
    width: 100%;
}

.modern-checkbox-label:hover {
    border-color: var(--brand-light);
    background: var(--brand-pale);
}

.checkbox-icon {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-icon i {
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modern-checkbox-input:checked + .modern-checkbox-label .checkbox-icon {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.modern-checkbox-input:checked + .modern-checkbox-label .checkbox-icon i {
    opacity: 1;
}

.modern-checkbox-input:checked + .modern-checkbox-label {
    border-color: var(--brand-primary);
    background: var(--brand-pale);
}

.checkbox-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

/* Popup showing 4 example images for a style */
.style-examples-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.style-examples-image {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

/* ===== GENERATION MODAL ===== */

.generation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.generation-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.generation-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    max-width: 800px;
    max-height: 95vh;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    font-family: var(--font-family-base);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.generation-header {
    padding: 1.5rem 2rem 1rem;
    border-bottom: 2px solid #e9ecef;
    background: white;
    position: relative;
}

.generation-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    text-align: center;
}

.close-modal-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    font-size: 1rem;
}

.close-modal-btn:hover {
    background: #f8f9fa;
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    transform: scale(1.05);
}

.close-modal-btn:active {
    transform: scale(0.95);
}

.generation-body {
    padding: 1.5rem 2rem 2rem;
}

.generation-prompt-display {
    background: var(--brand-pale);
    border-left: 4px solid var(--brand-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.generation-prompt-display p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dark);
    font-style: italic;
    line-height: 1.4;
}

.generation-image-container {
    position: relative;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* 3:4 designs: same height as the square box, narrower */
.generation-image-container--portrait {
    max-width: 263px;
    aspect-ratio: 3 / 4;
}

.image-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
}

.image-skeleton-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.generation-image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: imageFadeIn 0.6s ease;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.generation-progress-container {
    margin-bottom: 1.25rem;
}

.generation-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.generation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-light) 100%);
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generation-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.generation-progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.generation-stages {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stage-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: transparent;
}

.stage-item.active {
    background: var(--brand-pale);
}

.stage-item.completed {
    opacity: 0.7;
}

.stage-item.failed {
    background: #fff5f5;
}

.stage-status {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    position: relative;
}

.stage-check {
    display: none;
    color: #28a745;
    font-size: 1.1rem;
    line-height: 1;
}

.stage-error {
    display: none;
    color: #dc3545;
    font-size: 1.1rem;
    line-height: 1;
}

.stage-loader {
    display: none;
}

.custom-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.stage-item.active .stage-loader {
    display: block;
}

.stage-item.completed .stage-check {
    display: block;
    animation: checkPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.stage-item.completed .stage-loader {
    display: none;
}

.stage-item.failed .stage-error {
    display: block;
    animation: errorShake 0.5s ease;
}

.stage-item.failed .stage-loader {
    display: none;
}

@keyframes checkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    75% {
        transform: translateX(4px);
    }
}

.stage-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.stage-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.2;
}

.stage-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.stage-item.active .stage-label {
    color: var(--brand-primary);
}

.stage-item.failed .stage-label {
    color: #dc3545;
}

.stage-item:not(.active):not(.completed):not(.failed) {
    opacity: 0.5;
}

.stage-item:not(.active):not(.completed):not(.failed) .stage-label {
    color: var(--text-muted);
}

.generation-cancel-container {
    text-align: center;
    margin-bottom: 1rem;
}

#cancel-generation-btn {
    border-color: var(--border-color);
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

#cancel-generation-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.generation-info {
    text-align: center;
    margin-bottom: 1rem;
}

#generation-status-message {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
}

.generation-time-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Compact inline alert instead of a full empty-state block, so it reads as
   a quick status update rather than taking over the modal. */
.generation-error {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    background: rgba(220, 53, 69, 0.06);
    border: 1px solid rgba(220, 53, 69, 0.25);
    border-left: 4px solid #dc3545;
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    text-align: left;
    margin-bottom: 1rem;
}

.generation-error i {
    font-size: 1.15rem;
    color: #dc3545;
    flex-shrink: 0;
    line-height: 1.4;
}

.generation-error-body {
    flex: 1 1 auto;
    min-width: 0;
}

#generation-error-message {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.55rem;
    line-height: 1.4;
}

.generation-error-actions {
    display: flex;
    justify-content: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.generation-error-actions .btn {
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.generation-error-actions .btn-primary {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.generation-error-actions .btn-primary:hover {
    background: var(--brand-light);
    border-color: var(--brand-light);
}

.generation-success {
    text-align: center;
    padding: 1rem 0;
}

#continue-to-customization-btn {
    font-size: 1.1rem;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(158, 127, 164, 0.3);
    transition: all 0.3s ease;
}

#continue-to-customization-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(158, 127, 164, 0.4);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .generation-modal.active {
        padding: 0.5rem;
        align-items: flex-start;
    }

    .generation-modal-content {
        border-radius: 12px;
        max-height: 98vh;
        margin-top: 0.5rem;
    }

    .generation-header {
        padding: 1rem 1.25rem 0.75rem;
    }

    .generation-title {
        font-size: 1.25rem;
    }

    .generation-body {
        padding: 1rem 1.25rem 1.5rem;
    }

    .generation-prompt-display {
        padding: 0.6rem 0.85rem;
        margin-bottom: 1rem;
    }

    .generation-prompt-display p {
        font-size: 0.85rem;
    }

    .generation-image-container {
        max-width: 280px;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .generation-progress-container {
        margin-bottom: 1rem;
    }

    .generation-stages {
        padding: 0.6rem 0.85rem;
        gap: 0.25rem;
        margin-bottom: 1rem;
    }

    .stage-item {
        padding: 0.35rem 0.5rem;
        gap: 0.5rem;
    }

    .stage-label {
        font-size: 0.8rem;
    }

    .stage-description {
        font-size: 0.7rem;
    }

    .generation-info {
        margin-bottom: 0.85rem;
    }

    #generation-status-message {
        font-size: 0.9rem;
    }

    .generation-time-info {
        font-size: 0.75rem;
    }

    .generation-error {
        padding: 0.65rem 0.8rem;
    }

    .generation-error i {
        font-size: 1.05rem;
    }

    #generation-error-message {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    .generation-modal.active {
        padding: 0;
    }

    .generation-modal-content {
        border-radius: 0;
        max-height: 100vh;
        margin-top: 0;
    }

    .generation-header {
        padding: 0.85rem 1rem 0.6rem;
    }

    .generation-title {
        font-size: 1.1rem;
    }

    .generation-body {
        padding: 0.85rem 1rem 1.25rem;
    }

    .generation-prompt-display {
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.85rem;
    }

    .generation-prompt-display p {
        font-size: 0.8rem;
    }

    .generation-image-container {
        max-width: 240px;
        margin-bottom: 0.85rem;
        border-radius: 8px;
    }

    .generation-stages {
        padding: 0.5rem 0.65rem;
        gap: 0.2rem;
        margin-bottom: 0.85rem;
    }

    .stage-item {
        padding: 0.3rem 0.4rem;
        gap: 0.45rem;
    }

    .stage-status {
        width: 14px;
        height: 14px;
    }

    .custom-spinner {
        width: 14px;
        height: 14px;
    }

    .stage-check {
        font-size: 1rem;
    }

    .stage-label {
        font-size: 0.75rem;
    }

    .generation-info {
        margin-bottom: 0.75rem;
    }

    #generation-status-message {
        font-size: 0.85rem;
    }

    .generation-time-info {
        font-size: 0.7rem;
    }

    #continue-to-customization-btn {
        width: 100%;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .generation-title {
        font-size: 1rem;
    }

    .generation-prompt-display p {
        font-size: 0.75rem;
    }

    .stage-label {
        font-size: 0.7rem;
    }

    #generation-status-message {
        font-size: 0.8rem;
    }
}


/* ================= GUEST SIGN-IN =================
   Guests use the generator like members; Generate opens this panel instead of
   generating. A centred modal on desktop, a bottom sheet on phones. */
.guest-generate-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.guest-generate-hint i {
    color: var(--brand-primary);
}

/* Wide enough for the longest (German) button text on one line */
.guest-signin-modal .modal-dialog {
    max-width: 500px;
}

.guest-signin-modal .modal-content {
    position: relative;
    border: none;
    border-top: 4px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(45, 55, 72, 0.18);
}

.guest-signin-close {
    position: absolute;
    top: 0.6rem;
    right: 0.9rem;
    z-index: 1;
}

.guest-signin-body {
    padding: 2rem 2rem 1.25rem;
    text-align: center;
}

.guest-signin-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-light) 100%);
    color: white;
    font-size: 1.4rem;
}

.guest-signin-title {
    margin-bottom: 0.4rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.guest-signin-text {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* The guest's own prompt, so they see it is kept */
.guest-signin-prompt {
    margin: 0 0 1.1rem;
    padding: 0.6rem 0.85rem;
    background: var(--brand-pale);
    border-left: 3px solid var(--brand-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-dark);
    text-align: left;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.guest-signin-places {
    margin: -0.4rem 0 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-primary);
}

.guest-signin-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Bootstrap buttons don't wrap; on narrow screens long labels must. */
.guest-signin-primary,
.guest-signin-secondary {
    width: 100%;
    white-space: normal;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.guest-signin-primary {
    padding: 0.7rem 1rem;
    font-weight: 600;
}

.guest-signin-secondary {
    display: block;
    padding: 0.55rem 1rem;
    border: 2px solid var(--brand-primary);
    border-radius: 0.25rem;
    color: var(--brand-primary);
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.guest-signin-secondary:hover,
.guest-signin-secondary:focus-visible {
    background: var(--brand-pale);
    color: var(--brand-primary);
    text-decoration: none;
}

.guest-signin-dismiss {
    margin-top: 0.85rem;
    padding: 0.25rem 0.5rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.guest-signin-dismiss:hover,
.guest-signin-dismiss:focus-visible {
    color: var(--text-dark);
    text-decoration: underline;
}

@media (max-width: 576px) {
    .guest-signin-modal .modal-dialog,
    .style-examples-modal .modal-dialog,
    .edit-picker-modal .modal-dialog {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        min-height: 0;
        margin: 0;
        align-items: flex-end;
    }

    .guest-signin-modal .modal-content,
    .style-examples-modal .modal-content,
    .edit-picker-modal .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .guest-signin-modal.fade .modal-dialog,
    .style-examples-modal.fade .modal-dialog,
    .edit-picker-modal.fade .modal-dialog {
        transform: translateY(100%);
        transition: transform 0.25s ease-out;
    }

    .guest-signin-modal.show .modal-dialog,
    .style-examples-modal.show .modal-dialog,
    .edit-picker-modal.show .modal-dialog {
        transform: none;
    }
}

/* ================= SELECTED DESIGN DETAILS =================
   Under the gallery preview: prompt, style, background, preview on shirt.
   Takes over the bordered box the prompt alone used to have. */
.designer-preview-info {
    flex: 0 0 auto;
    width: 100%;
    max-height: 45%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem 1rem 0.85rem;
    background: white;
    border-top: 1px solid var(--border-color);
}

/* The user's own idea, shown as a quote */
.designer-preview-info .designer-preview-prompt {
    max-height: none;
    overflow: visible;
    padding: 0.55rem 0.8rem;
    border: none;
    border-left: 3px solid var(--brand-primary);
    border-radius: 0;
    background: var(--brand-pale);
}

.designer-preview-info .designer-preview-prompt-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: normal;
    text-transform: none;
    color: var(--brand-primary);
}

.designer-preview-info .designer-preview-prompt-text {
    font-size: 0.9rem;
    font-style: italic;
    overflow-wrap: anywhere;
    /* An edited design's prompt is the original idea, then "→ change" per line */
    white-space: pre-line;
    quotes: "\201C" "\201D";
}

.designer-preview-info .designer-preview-prompt-text:lang(de) {
    quotes: "\201E" "\201C";
}

.designer-preview-info .designer-preview-prompt-text::before {
    content: open-quote;
}

.designer-preview-info .designer-preview-prompt-text::after {
    content: close-quote;
}

.designer-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.designer-preview-meta:not(:has(.design-meta-chip:not([style*="none"]))) {
    display: none;
}

.design-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--brand-pale);
    color: var(--text-dark);
    font-size: 0.78rem;
    line-height: 1.4;
}

.design-meta-chip i {
    color: var(--brand-primary);
}

.design-meta-value {
    font-weight: 600;
}

.design-preview-shirt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.5rem 0.9rem;
    border: 2px solid var(--brand-primary);
    border-radius: var(--radius-md);
    background: white;
    color: var(--brand-primary);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.design-preview-shirt-btn:hover,
.design-preview-shirt-btn:focus-visible {
    background: var(--brand-primary);
    color: white;
}

/* Two actions under the preview: on the shirt, and edit */
.designer-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.designer-preview-actions .design-preview-shirt-btn {
    flex: 1 1 0;
    min-width: 0;
}

/* Design picker popup */
.edit-picker-modal .modal-dialog {
    max-width: 640px;
}

.edit-picker-modal .modal-content {
    border: none;
    border-top: 4px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 32px rgba(45, 55, 72, 0.18);
}

.edit-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 0.25rem;
}

.edit-picker-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-dark);
}

.edit-picker-body {
    padding: 0.75rem 1.5rem 1.5rem;
}

.edit-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 0.65rem;
}

.edit-picker-item {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.edit-picker-item:hover,
.edit-picker-item:focus-visible {
    border-color: var(--brand-light);
    transform: translateY(-1px);
    outline: none;
}

.edit-picker-item.selected {
    border-color: var(--brand-primary);
}

.edit-picker-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-picker-check {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: white;
    font-size: 0.8rem;
}

.edit-picker-item.selected .edit-picker-check {
    display: flex;
}

.edit-picker-empty {
    margin: 1rem 0;
    text-align: center;
    color: var(--text-muted);
}

@media (max-width: 576px) {
    .edit-picker-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .designer-preview-actions .design-preview-shirt-btn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        font-size: 0.85rem;
    }
}

/* ================= STYLE GRID =================
   Every style at a glance: a square cover, name and one-line description,
   with category filters above and the selected style's samples below.
   A swipeable strip on tablets and phones. */
.style-picker {
    /* One tile size on every screen */
    --style-tile-size: 112px;
    margin-bottom: 1rem;
}

.style-picker-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.style-picker-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}

.style-picker-title i {
    color: var(--brand-primary);
}

.style-picker-optional {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--style-tile-size));
    gap: 0.9rem 0.75rem;
}

.style-tile {
    position: relative;
    min-width: 0;
}

.style-tile-select {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.style-tile-select:focus {
    outline: none;
}

.style-tile-cover {
    position: relative;
    display: block;
    margin-bottom: 0.4rem;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--brand-pale);
    box-shadow: 0 0 0 1px var(--border-color);
    transition: box-shadow 0.15s ease;
}

.style-tile-cover > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.style-tile-select[aria-pressed="true"] .style-tile-cover {
    box-shadow: 0 0 0 3px var(--brand-primary);
}

.style-tile-select:focus-visible .style-tile-cover {
    box-shadow: 0 0 0 3px var(--brand-primary), 0 0 0 7px var(--brand-pale);
}

.style-tile-check {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: white;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.style-tile-select[aria-pressed="true"] .style-tile-check {
    opacity: 1;
    transform: none;
}

.style-tile-name {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-dark);
    transition: color 0.15s ease;
}

.style-tile-select[aria-pressed="true"] .style-tile-name {
    color: var(--brand-primary);
}

.style-tile-hint {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.74rem;
    line-height: 1.3;
    color: var(--text-muted);
}

.style-tile-new {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    padding: 0.15rem 0.45rem;
    border-radius: 50px;
    background: white;
    color: var(--brand-primary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* The selected style's samples. Hugs its four images on wide screens,
   full width on tablets and phones. */
.style-examples-panel {
    width: fit-content;
    max-width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    background: var(--brand-pale);
}

.style-examples-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.style-examples-panel-title {
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
}

.style-examples-panel-more {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0;
    border: none;
    background: none;
    color: var(--brand-primary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.style-examples-panel-more:hover,
.style-examples-panel-more:focus-visible {
    text-decoration: underline;
    outline: none;
}

.style-examples-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    gap: 0.5rem;
}

@media (max-width: 575.98px) {
    .style-examples-panel-grid {
        grid-template-columns: repeat(4, minmax(0, 72px));
        gap: 0.4rem;
    }
}

.style-examples-panel-item {
    position: relative;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: none;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.7);
    cursor: zoom-in;
}

/* Fades in once loaded, over a soft placeholder */
.style-examples-panel-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.style-examples-panel-item.is-loaded img {
    opacity: 1;
}

.style-examples-panel-item:focus {
    outline: none;
}

.style-examples-panel-item:focus-visible {
    box-shadow: 0 0 0 3px var(--brand-primary);
}

@media (max-width: 575.98px) {
    .style-examples-panel {
        margin-top: 0.6rem;
        padding: 0.6rem;
    }

    .style-examples-panel-grid {
        gap: 0.4rem;
    }
}

/* ================= PROMPT BOX =================
   The image to change, the prompt and the choices behind one credit, in one
   box. On phones it docks to the bottom of the screen while the styles
   above it are in view. */
.composer {
    position: relative;
    background: white;
    border: 2px solid var(--brand-light);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px var(--brand-pale);
}

/* The attached image */
.composer-attachment {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: fit-content;
    max-width: calc(100% - 1.5rem);
    margin: 0.75rem 0.75rem 0;
    padding: 0.4rem 0.5rem 0.4rem 0.4rem;
    border-radius: var(--radius-md);
    background: var(--brand-pale);
}

.composer-attachment-thumb {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    background-image:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%),
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%, transparent 75%, #e2e8f0 75%);
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
}

.composer-attachment--portrait .composer-attachment-thumb {
    width: 45px;
    height: 60px;
}

.composer-attachment-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.composer-attachment-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.composer-attachment-caption {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--brand-primary);
}

.composer-attachment-name {
    max-width: 24ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    color: var(--text-dark);
}

.composer-attachment-name:empty {
    display: none;
}

.composer-attachment-remove {
    flex: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--text-dark);
    color: white;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.composer-attachment-remove:hover,
.composer-attachment-remove:focus-visible {
    background: var(--brand-primary);
    outline: none;
}

/* The prompt */
.composer-input {
    position: relative;
}

.composer-textarea {
    display: block;
    width: 100%;
    min-height: 88px;
    padding: 1rem 2.75rem 0.5rem 1.1rem;
    border: none;
    outline: none;
    resize: none;
    overflow-y: hidden;
    background: transparent;
    font-family: inherit;
    font-size: 1.15rem;
    line-height: 1.45;
    color: var(--text-dark);
}

.composer-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

.composer .clear-input-btn {
    top: 0.75rem;
    right: 0.75rem;
}

/* Tools, counter and Generate */
.composer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem 0.6rem 0.75rem;
}

.composer-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.composer-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 36px;
    max-width: 100%;
    padding: 0 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    background: white;
    color: var(--text-dark);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.composer-chip:hover {
    background: var(--brand-pale);
    border-color: var(--brand-light);
}

.composer-chip:focus {
    outline: none;
}

.composer-chip:focus-visible {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-pale);
}

/* A choice other than the default */
.composer-chip.is-set {
    border-color: transparent;
    background: var(--brand-pale);
    color: #6f4f76;
}

.composer-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer-chip--icon {
    position: relative;
    width: 36px;
    padding: 0;
    justify-content: center;
    font-size: 1.05rem;
}

.composer-chip-plus {
    position: absolute;
    right: 2px;
    bottom: 1px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    font-size: 0.75rem;
    line-height: 1;
}

.composer-chip--style {
    max-width: 14rem;
}

.composer-chip--style.is-set {
    padding-left: 0.3rem;
}

.composer-chip-caret {
    flex: none;
    margin-left: -0.1rem;
    font-size: 0.7rem;
    opacity: 0.6;
}

.composer-style-dropdown {
    min-width: 0;
}

/* The style menu: every style with its tile, like the format and background menus */
.composer-menu--styles {
    width: 21rem;
}

/* A starting height; setUpComposer fits it to the room around the chip */
.composer-style-list {
    max-height: min(24rem, 45vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.composer-style-option-thumb {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.composer-style-option[aria-pressed="true"] {
    background: var(--brand-pale);
}

.composer-style-option-new {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0.05rem 0.4rem;
    border-radius: 50px;
    background: var(--brand-pale);
    color: var(--brand-primary);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: 0.1em;
}

.composer-style-thumb {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.composer-format-icon {
    flex: none;
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.composer-format-icon[data-format-icon="3:4"] {
    width: 11px;
    height: 15px;
}

.composer-bg-icon {
    flex: none;
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-light) 100%);
}

.composer-bg-icon[data-bg-icon="transparent"] {
    border: 1px solid var(--border-color);
    background-color: white;
    background-image:
        linear-gradient(45deg, #cbd5e0 25%, transparent 25%, transparent 75%, #cbd5e0 75%),
        linear-gradient(45deg, #cbd5e0 25%, transparent 25%, transparent 75%, #cbd5e0 75%);
    background-size: 6px 6px;
    background-position: 0 0, 3px 3px;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.composer-counter {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.composer-generate {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.45rem 1.2rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
}

.composer-generate .credit-cost-badge {
    margin-right: -0.6rem;
}

/* Disabled until there is something to generate from */
.composer-generate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Menus of the image, format and background chips */
.composer-menu {
    min-width: 16rem;
    max-width: calc(100vw - 2rem);
    padding: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 32px rgba(45, 55, 72, 0.18);
}

.composer-menu-header {
    margin: 0;
    padding: 0.4rem 0.6rem 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.composer-menu-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    border-radius: 8px;
    white-space: normal;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.composer-menu-item > span:not([aria-hidden]) {
    flex: 1 1 auto;
    min-width: 0;
}

.composer-menu-item > i:first-child {
    width: 1.25rem;
    text-align: center;
    font-size: 1.05rem;
    color: var(--brand-primary);
}

.composer-menu-item small {
    display: block;
    font-size: 0.76rem;
    font-weight: 400;
    line-height: 1.3;
    color: var(--text-muted);
}

.composer-menu-item:hover,
.composer-menu-item:focus,
.composer-menu-item:active {
    background: var(--brand-pale);
    color: var(--text-dark);
    outline: none;
}

.composer-menu-check {
    margin-left: auto;
    color: var(--brand-primary);
    visibility: hidden;
}

.composer-menu-item[aria-pressed="true"] .composer-menu-check {
    visibility: visible;
}

/* Dragging a file over the box */
.composer-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 2px dashed var(--brand-primary);
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.94);
    color: var(--brand-primary);
    font-weight: 700;
    pointer-events: none;
}

.composer-drop-overlay i {
    font-size: 1.3rem;
}

.composer.is-dragover .composer-drop-overlay {
    display: flex;
}

/* An upload being prepared */
.composer.is-busy {
    cursor: progress;
}

.composer.is-busy #composer-add-image-btn {
    animation: composer-pulse 1s ease-in-out infinite;
}

@keyframes composer-pulse {
    50% { opacity: 0.4; }
}

/* What Generate will do */
.composer-mode-line {
    min-height: 1.3em;
    margin: 0.5rem 0.25rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
    .style-tile-check,
    .style-examples-panel-item img {
        transition: none;
    }

    .composer.is-busy #composer-add-image-btn {
        animation: none;
    }
}

/* Tablets and phones: the prompt box docks to the bottom of the screen */
@media (max-width: 767.98px) {
    /* -1px so it is never quite fully in view while docked: that is how the
       script tells (see setUpComposerDock) and adds the shadow. */
    .composer-dock {
        position: sticky;
        bottom: -1px;
        z-index: 5;
        margin: 0 -0.75rem -0.75rem;
        padding: 0.6rem 0.75rem calc(0.6rem + 1px + env(safe-area-inset-bottom, 0px));
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        background: white;
        transition: box-shadow 0.2s ease;
    }

    .composer-dock.is-docked {
        border-radius: 0;
        box-shadow: 0 -10px 18px -12px rgba(45, 55, 72, 0.35);
    }

    .composer-mode-line {
        margin-top: 0.35rem;
        font-size: 0.8rem;
    }

    /* Styles become a swipeable strip; the next tile peeks in at the edge */
    .style-grid {
        display: flex;
        gap: 0.65rem;
        margin: 0 -0.75rem;
        padding: 0.25rem 0.75rem 0.4rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 0.75rem;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .style-grid::-webkit-scrollbar {
        display: none;
    }

    .style-tile {
        flex: 0 0 var(--style-tile-size);
        scroll-snap-align: start;
    }

    .guest-generate-hint {
        margin-top: 1rem;
    }
}

/* Phones: compact tiles and toolbar */
@media (max-width: 575.98px) {
    .style-tile-name {
        font-size: 0.8rem;
    }

    .style-tile-hint {
        font-size: 0.7rem;
    }

    /* Room for four lines, so a whole prompt (and the longer German
       placeholders) is readable without scrolling; it still grows as you type. */
    .composer-textarea {
        min-height: 7.25rem;
        padding: 0.8rem 2.5rem 0.25rem 0.9rem;
        font-size: 1.05rem; /* 16px+ so iOS doesn't zoom in on focus */
    }

    .composer-bar {
        padding: 0.4rem 0.5rem 0.5rem;
    }

    /* Chips wrap onto a second line rather than squeezing: format and
       background always show their full text. */
    .composer-tools {
        flex: 1 1 100%;
        flex-wrap: wrap;
    }

    .composer-tools > .dropdown {
        flex: none;
    }

    .composer-tools > .composer-style-dropdown {
        flex: 0 1 auto;
        min-width: 0;
    }

    .composer-chip--style {
        max-width: 12rem;
    }

    .composer-counter {
        display: none;
    }

    .composer-actions,
    .composer-generate {
        flex: 1 1 100%;
    }

    .composer-attachment {
        margin: 0.6rem 0.6rem 0;
    }

    .composer-attachment-name {
        max-width: 16ch;
    }
}

/* Small phones (iPhone SE and the like): slightly tighter chips, so they settle
   into two rows (image and style; format and background) instead of four. */
@media (max-width: 359.98px) {
    .composer-tools {
        gap: 0.3rem;
    }

    .composer-chip {
        gap: 0.3rem;
        padding: 0 0.55rem;
        font-size: 0.8rem;
    }

    .composer-chip--icon {
        padding: 0;
    }

    .composer-chip--style {
        max-width: 10rem;
    }
}
