:root {
    --bg-color: #f0f2f5;
    --text-color: #333;
    --container-bg: #fff;
    --primary-color: #1877f2;
    --primary-hover: #166fe5;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --btn-shadow: rgba(24, 119, 242, 0.3);
    --btn-shadow-hover: rgba(24, 119, 242, 0.4);
}

[data-theme="dark"] {
    --bg-color: #1a1a1b;
    --text-color: #e4e6eb;
    --container-bg: #242526;
    --primary-color: #2d88ff;
    --primary-hover: #4ea2ff;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --btn-shadow: rgba(45, 136, 255, 0.2);
    --btn-shadow-hover: rgba(45, 136, 255, 0.3);
}

body {
    font-family: 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    background: var(--container-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--shadow-color);
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: #fff;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.lotto-machine {
    margin-bottom: 30px;
}

.number-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    min-height: 60px;
}

.number {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color 0.3s ease;
    animation: popIn 0.3s ease forwards;
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

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

.btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px var(--btn-shadow);
}

.btn:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 15px var(--btn-shadow-hover);
}

/* Animal Face Test Section */
.test-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--shadow-color);
}

.test-section h2 {
    color: var(--primary-color);
    margin-bottom: 5px;
}

.mode-toggle {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.mode-toggle .btn-small {
    margin-top: 0;
    opacity: 0.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
}

.mode-toggle .btn-small.active {
    opacity: 1;
    background-color: var(--primary-color);
    color: #fff;
}

.upload-area {
    margin: 20px auto;
    padding: 30px;
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    background: var(--bg-color);
    transition: all 0.3s ease;
}

.upload-area:hover {
    background: var(--container-bg);
}

.upload-icon {
    font-size: 3rem;
}

#webcam-viewer {
    margin: 20px auto;
    width: 200px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 4px 15px var(--shadow-color);
}

#webcam-viewer canvas {
    width: 100% !important;
    height: 100% !important;
}

#result-container {
    margin-top: 20px;
    text-align: left;
}

.bar-container {
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar {
    height: 20px;
    border-radius: 10px;
    width: 0%;
    transition: width 1s ease;
}

.bar.dog { background-color: #fbc400; }
.bar.cat { background-color: #69c8f2; }

#loading {
    margin: 20px 0;
    font-style: italic;
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Contact Section */
.contact-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--shadow-color);
    text-align: left;
}

.contact-section h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.contact-section form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-section input, 
.contact-section textarea,
.contact-section select {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--shadow-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.contact-section input:focus, 
.contact-section textarea:focus,
.contact-section select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-select {
    cursor: pointer;
}

/* Comments Section */
.comments-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--shadow-color);
}

.contact-section textarea {
    resize: vertical;
    min-height: 80px;
}

/* Ball Colors */
.color-1 { background-color: #fbc400; } /* Yellow */
.color-2 { background-color: #69c8f2; } /* Blue */
.color-3 { background-color: #ff7272; } /* Red */
.color-4 { background-color: #aaa; }    /* Gray */
.color-5 { background-color: #b0d840; } /* Green */
