:root {
    --bg-color: #f8fafc;
    --container-bg: #ffffff;
    --text-color: #1e293b;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --accent-color: #f59e0b;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --btn-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2);
    --input-bg: #f1f5f9;
    --input-border: #e2e8f0;
    --nav-bg: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --container-bg: #1e293b;
    --text-color: #f1f5f9;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary-color: #94a3b8;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --input-bg: #334155;
    --input-border: #475569;
    --nav-bg: rgba(30, 41, 59, 0.8);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    background-image: radial-gradient(var(--input-border) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.top-nav {
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    padding: 0;
    display: flex;
    justify-content: center;
    box-shadow: 0 1px 3px var(--shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--input-border);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    padding: 0 1.5rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.hero-section {
    text-align: center;
    padding: 6rem 1.5rem;
    background: linear-gradient(to bottom, var(--container-bg), transparent);
    width: 100%;
    margin-bottom: 0;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    letter-spacing: -0.05em;
    line-height: 1.1;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--secondary-color);
    max-width: 700px;
    margin: 0 auto;
}

.main-wrapper {
    max-width: 1100px;
    margin: -4rem auto 0;
    padding: 0 1.5rem 6rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
}

.container {
    background: var(--container-bg);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--input-border);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-color);
}

h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
    color: var(--primary-color);
}

/* Lotto Specific */
#numbers-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 3rem 0;
    flex-wrap: wrap;
    min-height: 64px;
}

.number-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 800;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: rotate(-5deg);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.number-circle:hover {
    transform: rotate(0deg) scale(1.1);
}

#generate-btn, .submit-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: var(--btn-shadow);
    transition: all 0.2s ease;
}

#generate-btn:hover, .submit-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* Animal Test Specific */
.test-mode-toggle {
    background: var(--input-bg);
    padding: 0.5rem;
    border-radius: 16px;
    display: inline-flex;
    gap: 0.5rem;
    margin-bottom: 3rem;
}

.mode-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--secondary-color);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background: var(--container-bg);
    color: var(--primary-color);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

.upload-area {
    border: 2px dashed var(--input-border);
    background: var(--input-bg);
    padding: 4rem 2rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.upload-icon { font-size: 3rem; }
.upload-text { font-weight: 700; color: var(--primary-color); }

.prediction-result {
    font-size: 2rem;
    font-weight: 800;
    margin: 2rem 0;
    color: var(--primary-color);
}

.label-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.label-container div {
    background: var(--input-bg);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
}

.spinner {
    border: 4px solid var(--input-border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 3rem auto;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Blog/Stats */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
}

.blog-card {
    background: var(--container-bg);
    border-radius: 24px;
    padding: 2.5rem;
    border: 1px solid var(--input-border);
    transition: all 0.3s ease;
    box-shadow: var(--card-shadow);
    text-align: left;
}

.blog-card:hover {
    transform: translateY(-8px);
}

.blog-card h3 { color: var(--primary-color); font-size: 1.5rem; margin-top: 0; }

.read-more {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.footer {
    padding: 6rem 1.5rem;
    background: var(--container-bg);
    border-top: 1px solid var(--input-border);
    text-align: center;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-links a { color: var(--secondary-color); text-decoration: none; font-weight: 600; }

.theme-toggle {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--input-border);
    background: var(--container-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.hidden { display: none; }

.comments-section {
    width: 100%;
    max-width: 800px;
    background: var(--container-bg);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--input-border);
    box-sizing: border-box;
    margin-top: 2rem;
}

#preview-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: var(--card-shadow);
}

.webcam-container canvas {
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    max-width: 100%;
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 1rem 2rem;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: var(--primary-color);
    color: white;
}

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

@media (max-width: 768px) {
    .hero-section h1 { font-size: 2.5rem; }
    .nav-links { display: none; }
    .container { padding: 2rem; }
}
