* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 24px;
    padding: 40px;
    max-width: 700px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

h1 {
    font-size: 2.5em;
    color: #333;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 1.2em;
    color: #666;
    margin-bottom: 30px;
}

.input-area {
    margin-bottom: 20px;
}

#subject {
    width: 100%;
    padding: 18px 24px;
    font-size: 1.3em;
    border: 3px solid #ddd;
    border-radius: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#subject:focus {
    border-color: #667eea;
}

.buttons {
    display: flex;
    gap: 16px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 16px 32px;
    font-size: 1.2em;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    font-size: 1.3em;
}

.btn-create {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.btn-search {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.btn-ideas {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    color: #1a1a1a;
}

.suggestions {
    margin-top: 20px;
    padding: 16px;
    background: #fffbeb;
    border: 2px dashed #fcd34d;
    border-radius: 16px;
    text-align: left;
}

.suggestions-label {
    font-weight: 700;
    color: #92400e;
    margin-bottom: 12px;
    text-align: center;
}

.suggestions-loading,
.suggestions-error {
    color: #92400e;
    text-align: center;
    font-style: italic;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.chip {
    background: white;
    border: 2px solid #fcd34d;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 1em;
    color: #78350f;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.chip:hover {
    background: #fef3c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-print {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #1a1a1a;
}

.btn-again {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #1a1a1a;
}

.hint {
    margin-top: 16px;
    font-size: 0.9em;
    color: #888;
    line-height: 1.6;
}

/* Loading */
.loading {
    padding: 40px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #eee;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.loading p {
    font-size: 1.2em;
    color: #666;
}

/* Result */
.result {
    margin-top: 20px;
}

#result-image {
    max-width: 100%;
    border-radius: 16px;
    border: 3px solid #eee;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.result-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Error */
.error {
    background: #fff0f0;
    border: 2px solid #ffcccc;
    border-radius: 16px;
    padding: 24px;
    margin-top: 20px;
}

.error p {
    font-size: 1.1em;
    color: #cc3333;
    margin-bottom: 16px;
}

/* Print success */
.print-success {
    background: #f0fff4;
    border: 2px solid #b2f5ea;
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
    animation: fadeIn 0.3s ease;
}

.print-success p {
    font-size: 1.1em;
    color: #276749;
    font-weight: 600;
}

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

/* Print: show only the coloring page image */
@media print {
    @page { margin: 0.25in; }
    body {
        background: white;
        display: block;
        padding: 0;
        min-height: auto;
    }
    .container {
        box-shadow: none;
        padding: 0;
        max-width: none;
        border-radius: 0;
    }
    .container > *:not(#result) {
        display: none !important;
    }
    #result {
        display: block !important;
        margin: 0;
    }
    #result-image {
        max-width: 100%;
        max-height: 100vh;
        object-fit: contain;
        border: none;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
    }
    .result-buttons {
        display: none !important;
    }
}

.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 500px) {
    .container {
        padding: 24px;
    }

    h1 {
        font-size: 1.8em;
    }

    #subject {
        font-size: 1.1em;
        padding: 14px 18px;
    }

    .btn {
        padding: 14px 24px;
        font-size: 1em;
        flex: 1;
        justify-content: center;
    }
}
