:root {
    --primary-color: #6c5ce7;
    --primary-hover: #5649c0;
    --background-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] {
    --primary-color: #8a7ff0;
    --primary-hover: #7a6de4;
    --background-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #e0e0e0;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.4s, color 0.4s;
    /* Remove body flex centering that might cause overflow issues */
    margin: 0;
    padding: 0;
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding: 50px 20px;
    width: 100%;
    max-width: 100%;
}

/* Common Card Style - Reset margins */
.lotto-machine, 
.contact-section, 
.comments-section,
.ai-container {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    text-align: center;
    width: 500px; /* Fixed width */
    max-width: 100%; /* Responsive */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: background-color 0.4s;
}

#disqus_thread {
    width: 100%;
}

/* Theme Toggle Button */
.theme-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10;
}

.theme-btn .moon { display: none; }
[data-theme='dark'] .theme-btn .moon { display: inline; }
[data-theme='dark'] .theme-btn .sun { display: none; }

h1 {
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* Lotto Ball Styles */
.ball-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    min-height: 60px;
    width: 100%;
}

.ball {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2), inset 0 -5px 10px rgba(0,0,0,0.1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    background-color: #dfe6e9; 
    transition: transform 0.2s ease;
}

.ball:hover {
    transform: scale(1.1);
}

/* Buttons */
#draw-button, .action-btn, .submit-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(108, 92, 231, 0.4);
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

#draw-button:hover, .action-btn:hover, .submit-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.5);
}

#draw-button:active, .action-btn:active, .submit-btn:active {
    transform: translateY(0);
}

/* Contact Form */
.contact-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.contact-section form {
    width: 100%;
}

.input-group {
    margin-bottom: 15px;
    text-align: left;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 600;
}

.input-group input, 
.input-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: inherit;
    transition: all 0.3s ease;
}

[data-theme='dark'] .input-group input,
[data-theme='dark'] .input-group textarea {
    border-color: #444;
}

.input-group textarea {
    height: 100px;
    resize: none;
}

.submit-btn {
    width: 100%;
    margin-top: 10px;
}

/* AI Page Specifics */
.ai-container {
    border-radius: 30px;
    border: 4px solid #fff;
    width: 400px;
    margin: 50px auto; /* Center horizontally and add vertical space */
}

[data-theme='dark'] .ai-container {
    border-color: #2c3e50;
}

.ai-title {
    font-family: 'Jua', sans-serif;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}
/* ... existing styles ... */
.back-link:hover { color: var(--primary-color); }

/* Responsive Design */
@media (max-width: 600px) {
    .lotto-machine, 
    .contact-section, 
    .comments-section,
    .ai-container {
        width: 95%;
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .ball {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .ai-title {
        font-size: 1.5rem;
    }
}

.ai-subtitle {
    font-family: 'Jua', sans-serif;
    font-size: 1rem;
    color: #888;
    margin-bottom: 30px;
}

.file-upload-btn {
    display: inline-block;
    padding: 15px 30px;
    background-color: #ff9ff3;
    color: white;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    font-family: 'Jua', sans-serif;
    transition: transform 0.2s, background-color 0.3s;
    border: 2px solid white;
    box-shadow: 0 5px 15px rgba(255, 159, 243, 0.4);
    margin-bottom: 20px;
}

.file-upload-btn:hover {
    background-color: #f368e0;
    transform: scale(1.05);
}

.file-upload-input {
    display: none;
}

#image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.result-container {
    width: 100%;
    margin-top: 10px;
}

.result-bar-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-color);
    font-family: 'Jua', sans-serif;
}

.result-label {
    width: 80px;
    text-align: right;
    margin-right: 10px;
    font-weight: bold;
}

.progress-bg {
    flex-grow: 1;
    height: 15px;
    background-color: #eee;
    border-radius: 10px;
    overflow: hidden;
}

[data-theme='dark'] .progress-bg {
    background-color: #333;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.5s ease;
}

.back-link {
    display: inline-block;
    margin-top: 30px;
    color: #b2bec3;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: 'Jua', sans-serif;
}

.back-link:hover { color: var(--primary-color); }