.cg-container {
    --cg-btn-color: #3498db;
    --cg-border-color: #f1f3f5;

    max-width: 560px;
    margin: 30px auto;
    padding: 28px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: 1px solid var(--cg-border-color);
}

.cg-header h2 {
    margin: 0 0 10px;
    font-size: 26px;
    color: #2c3e50;
    text-align: center;
    font-weight: 700;
}

.cg-desc {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.5;
}

.cg-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.cg-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #34495e;
    font-size: 14px;
}

.cg-select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.25s;
}

.cg-select:focus {
    outline: none;
    border-color: var(--cg-btn-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.cg-btn {
    width: 100%;
    padding: 13px;
    background: var(--cg-btn-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cg-btn:hover:not(.cg-btn-loading) {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cg-btn.cg-btn-loading {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.cg-btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.cg-btn.cg-btn-loading .cg-btn-loader {
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.cg-result-box {
    margin-top: 24px;
    min-height: 20px;
}

.cg-result-box.cg-error {
    padding: 18px;
    border-radius: 12px;
    text-align: center;
    background: #fff5f5;
    border: 1px solid #e74c3c;
}

.cg-error-msg {
    margin: 0;
    color: #e74c3c;
    font-weight: 500;
    font-size: 15px;
}

.cg-caption-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cg-caption-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafb;
    border: 1px solid #eef1f3;
    border-radius: 10px;
}

.cg-caption-text {
    margin: 0;
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.5;
    flex: 1;
}

.cg-copy-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    background: #fff;
    color: var(--cg-btn-color);
    border: 1px solid var(--cg-btn-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cg-copy-btn:hover {
    background: var(--cg-btn-color);
    color: #fff;
}

.cg-copy-btn.cg-copied {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.cg-copy-btn.cg-copy-error {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

@media (max-width: 580px) {
    .cg-container {
        padding: 24px 20px;
        margin: 20px 12px;
    }
    .cg-filters {
        grid-template-columns: 1fr;
    }
    .cg-caption-item {
        flex-direction: column;
        align-items: stretch;
    }
    .cg-copy-btn {
        width: 100%;
    }
}
