:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #e5e7eb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --bg-app: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #d1d5db;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius: 20px;
    
    --dog-color: #f59e0b;
    --cat-color: #ec4899;
    
    /* Lotto Colors */
    --ball-1: #facc15;
    --ball-11: #3b82f6;
    --ball-21: #ef4444;
    --ball-31: #6b7280;
    --ball-41: #10b981;
}

[data-theme="dark"] {
    --primary-color: #6366f1;
    --primary-hover: #818cf8;
    --secondary-color: #374151;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --bg-app: #111827;
    --bg-card: #1f2937;
    --border-color: #374151;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    padding: 1rem;
    transition: background-color 0.3s, color 0.3s;
}

.app-container { width: 100%; max-width: 900px; margin: 0 auto; }

.app-header { text-align: center; margin-bottom: 3rem; margin-top: 2rem; }
.app-header h1 { font-size: 2.5rem; font-weight: 800; color: var(--primary-color); margin-bottom: 0.5rem; }

/* Navigation */
.feature-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    background: var(--bg-card);
    padding: 0.5rem;
    border-radius: 40px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: inline-flex;
}

.nav-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s;
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Feature Sections Visibility */
.feature-section { display: none; }
.feature-section.active { display: block; animation: fadeIn 0.4s ease; }

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

/* Shared Panel Style */
.test-panel, .generator-panel {
    background: var(--bg-card); border-radius: var(--radius); padding: 3rem;
    box-shadow: var(--shadow-md); text-align: center; border: 1px solid var(--border-color);
}

/* Animal Test Styles */
.upload-area { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
#faceImage { width: 300px; height: 300px; object-fit: cover; border-radius: 20px; border: 4px solid var(--secondary-color); }
#webcam-container canvas { border-radius: 20px; border: 4px solid var(--primary-color); width: 100% !important; height: auto !important; max-width: 300px; }
.button-group { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* Lotto Styles */
.numbers-display { display: flex; justify-content: center; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.ball {
    width: 60px; height: 60px; border-radius: 50%; display: flex;
    justify-content: center; align-items: center; font-size: 1.25rem; font-weight: 700; color: white;
    box-shadow: inset -4px -4px 8px rgba(0,0,0,0.2); transition: transform 0.2s;
}
.ball.placeholder { background: var(--secondary-color); color: var(--text-muted); border: 2px dashed var(--border-color); box-shadow: none; }
.history-panel { margin-top: 3rem; text-align: left; }
.history-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: var(--bg-app); border-radius: 12px; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 1rem; }
.mini-ball { width: 35px; height: 35px; font-size: 0.85rem; }

@keyframes pop { 0% { transform: scale(0); } 100% { transform: scale(1); } }
.animate-pop { animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* Global components */
.theme-toggle-container { position: fixed; top: 1rem; right: 1rem; z-index: 1000; }
.theme-btn {
    background: var(--bg-card); border: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem; border-radius: 30px; cursor: pointer;
    color: var(--text-main); font-weight: 600; display: flex; align-items: center; gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.result-container { margin-top: 3rem; text-align: left; }
.progress-container { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.progress-bar { flex: 1; height: 16px; background: var(--secondary-color); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; transition: width 0.5s; }
.dog-fill { background: var(--dog-color); }
.cat-fill { background: var(--cat-color); }

.btn { padding: 0.8rem 1.5rem; border-radius: 12px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-2px); }
.btn-secondary { background: var(--bg-app); border: 1px solid var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: var(--secondary-color); }

.partnership-section, .comments-section { margin-top: 3rem; padding: 2.5rem; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border-color); }
input, textarea { width: 100%; padding: 0.8rem; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-app); color: var(--text-main); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }