/* ===== VARIABLES ===== */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-secondary: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #475569;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 0.75rem;
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    
    --transition: all 0.2s ease;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-main);
    min-height: 100vh;
    padding: 1rem;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 48rem;
    margin: 0 auto;
}

/* ===== HEADER ===== */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.1) 0%, rgba(114, 9, 183, 0.1) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(67, 97, 238, 0.2);
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== STATS ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== CATEGORIES ===== */
.category-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-btn {
    padding: 0.75rem;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

.category-btn.active {
    background: rgba(67, 97, 238, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.category-btn:hover:not(.active) {
    background: var(--bg-secondary);
}

/* ===== TASK CARD ===== */
.task-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.task-display {
    background: rgba(67, 97, 238, 0.05);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    text-align: center;
}

.task-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
}

.task-instruction {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===== INPUT ===== */
.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#userAnswer {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

#userAnswer:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

#userAnswer:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: #475569;
}

/* ===== FEEDBACK ===== */
.feedback-section {
    margin: 1.5rem 0;
    min-height: 5rem;
}

.feedback-correct {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.feedback-incorrect {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    min-width: 120px;
}

/* ===== RULES ===== */
.rules-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-top: 1.5rem;
    overflow: hidden;
}

.rules-header {
    padding: 1rem;
    background: rgba(67, 97, 238, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.rules-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.rules-content.show {
    padding: 1rem;
    max-height: 1000px;
}

.rule-item {
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 3px solid var(--primary);
}

.rule-title {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rule-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .container {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .task-number {
        font-size: 1.5rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        min-width: 100%;
    }
    
    .category-selector {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }
    
    .task-card {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
    }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.pulse {
    animation: pulse 1s infinite;
}
