.custom-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.custom-confirm-box {
    background: var(--nav-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 350px;
    text-align: center;
}

.custom-confirm-box h4 {
    margin-bottom: 10px;
    color: var(--text-color);
}

.custom-confirm-box p {
    color: var(--footer-text);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
}

.confirm-actions .action-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.9rem;
    min-width: unset;
    margin: 0;
}

.confirm-actions .secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.ai-tool-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 25px;
}

.tool-header h2 {
    font-size: 2.2rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.tool-header p {
    color: var(--footer-text);
    font-size: 1rem;
}

.styles-scroller-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.styles-scroller-container::-webkit-scrollbar {
    height: 6px;
}

.styles-scroller-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.styles-track {
    display: flex;
    gap: 10px;
    padding: 0 5px;
    width: max-content;
}

.style-chip {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    user-select: none;
    white-space: nowrap;
}

.style-chip:hover {
    border-color: var(--hover-color);
    background: rgba(13, 110, 253, 0.05);
}

.style-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.ai-workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.input-card {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

#ai-prompt {
    width: 100%;
    min-height: 120px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    color: var(--text-color);
    font-size: 1rem;
    resize: vertical;
    font-family: inherit;
    transition: 0.3s;
    margin-bottom: 15px;
}

#ai-prompt:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ratio-group {
    display: flex;
    gap: 10px;
    background: var(--bg-color);
    padding: 5px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.ratio-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    transition: 0.2s;
}

.ratio-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ratio-btn.active {
    background: var(--nav-bg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: bold;
}

.css-shape {
    border: 2px solid currentColor;
    border-radius: 2px;
    opacity: 0.8;
}

.css-shape.landscape {
    width: 18px;
    height: 12px;
}

.css-shape.portrait {
    width: 12px;
    height: 18px;
}

.css-shape.square {
    width: 14px;
    height: 14px;
}

.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 150px;
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background: var(--hover-color);
}

.action-btn.success {
    background: var(--primary-color);
    color: white;
    width: 100%;
    margin-top: 15px;
}

.action-btn.success:hover {
    background: var(--hover-color);
}

.action-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loader-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.result-card {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-frame {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-frame img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
}

.gallery-section {
    border-top: 1px solid var(--border-color);
    padding-top: 30px;
    margin-bottom: 40px;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-text-danger {
    background: transparent;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-text-danger:hover {
    text-decoration: underline;
}

.empty-state-text {
    color: var(--footer-text);
    font-style: italic;
    text-align: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.gallery-item {
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.dl-btn-small {
    background: transparent;
    border: none;
    padding: 10px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    border-top: 1px solid var(--border-color);
    transition: 0.2s;
}

.dl-btn-small:hover {
    background: var(--primary-color);
    color: white;
}

@media (max-width: 600px) {
    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .controls-row {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .ratio-group {
        flex: 1.5;
        justify-content: space-between;
        padding: 4px;
    }

    .ratio-btn {
        padding: 6px 4px;
        font-size: 0.75rem;
    }

    .css-shape {
        transform: scale(0.8);
    }

    .action-btn {
        flex: 1;
        min-width: unset;
        padding: 10px;
        font-size: 0.9rem;
        margin: 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}


.prompt-wrapper {
    position: relative;
    width: 100%;
}

.random-dice-btn {
    position: absolute;
    bottom: 25px;
    right: 15px;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.random-dice-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

#ai-prompt {
    margin-bottom: 10px;
}