:root {
    --primary-color: #4a90e2;
    --background-color: #f0f4f8;
    --text-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --container-bg: #fff;
    --btn-hover: #357abd;
    --gradient: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
}

body.dark-mode {
    --primary-color: #6ab0ff;
    --background-color: #1a1a2e;
    --text-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --container-bg: #16213e;
    --btn-hover: #5a9ee0;
    --gradient: linear-gradient(to right, #0f3460 0%, #16213e 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-image: var(--gradient);
    transition: background-image 0.4s ease;
}

/* ── Theme toggle ─────────────────────────────────────────────────────────── */
#theme-toggle {
    position: fixed;
    top: 1.2rem;
    right: 1.2rem;
    background: var(--container-bg);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--shadow-color);
    transition: transform 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:hover {
    transform: scale(1.15) rotate(20deg);
}

/* ── Container ────────────────────────────────────────────────────────────── */
.container {
    text-align: center;
    background-color: var(--container-bg);
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 20px var(--shadow-color);
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    transition: color 0.4s ease;
}

/* ── Generate button ──────────────────────────────────────────────────────── */
@keyframes btnGlow {
    0%, 100% { box-shadow: 0 4px 6px var(--shadow-color); }
    50%       { box-shadow: 0 4px 24px rgba(74, 144, 226, 0.7); }
}

#generate-btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.15s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
    min-width: 180px;
}

#generate-btn:hover:not(:disabled) {
    background-color: var(--btn-hover);
    transform: translateY(-1px);
}

#generate-btn:active:not(:disabled) {
    transform: scale(0.96);
}

#generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#generate-btn.generating {
    animation: btnGlow 0.75s ease infinite;
}

/* ── Result area ──────────────────────────────────────────────────────────── */
.result-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    min-height: 70px;
}

/* ── Confetti particles ───────────────────────────────────────────────────── */
@keyframes confettiBurst {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2) rotate(280deg); }
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    animation: confettiBurst 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem;
    }
}
