:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    
    --surface: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-darker));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Background blob effects */
body::before, body::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.15;
}

body::before {
    background: var(--primary);
    top: -200px;
    left: -200px;
}

body::after {
    background: var(--success);
    bottom: -200px;
    right: -200px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 900px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

#username-display {
    font-weight: 500;
    color: var(--text-main);
}

/* Utilities */
.hidden {
    display: none !important;
}

.mt-2 { margin-top: 20px; }
.mb-2 { margin-bottom: 20px; }
.w-100 { width: 100%; }

/* Glass Card */
.glass-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-md);
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

section {
    animation: fadeIn 0.4s ease-out;
}

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

/* Typography */
h2 {
    font-size: 1.75rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 25px;
}

/* Buttons */
button {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--surface-border);
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-text {
    background: none;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-text:hover {
    color: var(--danger);
}

/* Forms */
.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--surface-border);
}

.tab-btn {
    flex: 1;
    background: none;
    color: var(--text-muted);
    padding: 10px;
    font-size: 1rem;
    font-weight: 500;
    position: relative;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

/* Dashboard */
.domain-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.domain-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.domain-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.domain-icon {
    font-size: 2rem;
}

.domain-title {
    font-weight: 600;
    font-size: 1rem;
}

.domain-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
}

.history-item .score {
    font-weight: 600;
    color: var(--primary);
}

/* Quiz Section */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.quiz-progress {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    color: var(--warning);
}

.timer.danger {
    color: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

.question-container h3 {
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 25px;
    font-weight: 500;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    text-align: left;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
}

.option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.option-btn.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
}

.option-btn.correct {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.option-btn.wrong {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
}

.feedback-msg {
    font-size: 0.95rem;
    font-weight: 500;
}

.feedback-msg.correct-text { color: var(--success); }
.feedback-msg.wrong-text { color: var(--danger); }

/* Results Section */
.result-header {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    width: 150px;
    height: 150px;
    margin: 20px auto;
}

.circular-chart {
    display: block;
    margin: 0 auto;
    max-width: 80%;
    max-height: 250px;
}

.circle-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 2.5;
}

.circle {
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    animation: progress 1s ease-out forwards;
}

@keyframes progress {
    0% { stroke-dasharray: 0 100; }
}

.percentage {
    fill: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 8px;
    text-anchor: middle;
}

.total-score {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: var(--border-radius-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-box.correct { border-bottom: 2px solid var(--success); }
.stat-box.wrong { border-bottom: 2px solid var(--danger); }
.stat-box.time { border-bottom: 2px solid var(--primary); }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.suggestion-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary);
}

.suggestion-box h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.suggestion-box p {
    font-size: 1.05rem;
    line-height: 1.5;
}

.result-actions {
    display: flex;
    gap: 15px;
}

.result-actions button {
    flex: 1;
}

/* Responsive */
@media (max-width: 480px) {
    .domain-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        gap: 10px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .glass-card {
        padding: 20px;
    }
    
    .result-actions {
        flex-direction: column;
    }
}
