/* --- GENERAL STYLES --- */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-cyan: #06b6d4;
    --accent-purple: #a855f7;
    --accent-green: #10b981;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --border-color: #475569;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1f35 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

h1 { font-size: 3.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 2.25rem; font-weight: 600; margin-bottom: 1.5rem; }
h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
p { line-height: 1.6; color: var(--text-secondary); }

/* --- BUTTONS --- */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
}
.btn-primary { background: var(--accent-cyan); color: white; }
.btn-primary:hover { background: #0891b2; transform: translateY(-2px); box-shadow: 0 10px 20px rgba(6, 182, 212, 0.2); }
.btn-secondary { background: transparent; border: 2px solid var(--accent-purple); color: var(--accent-purple); }
.btn-secondary:hover { background: rgba(168, 85, 247, 0.1); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { background: var(--bg-tertiary); border-color: var(--accent-cyan); color: var(--accent-cyan); }
.w-full { width: 100%; }

/* --- LAYOUT --- */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* --- HOME PAGE --- */
.hero-container { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 4rem 2rem; max-width: 1280px; margin: 0 auto; }
.hero-content { text-align: center; margin-bottom: 4rem; }
.header-logo { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 1.5rem; }
.gamepad-icon { width: 2.5rem; height: 2.5rem; color: var(--accent-cyan); }
.gamepad-icon.small { width: 2rem; height: 2rem; }
.main-title { color: var(--text-primary); }
.subtitle { font-size: 1.25rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.tagline { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; width: 100%; }
.hero-left h2 { margin-top: 0; }
.hero-left p { font-size: 1.125rem; margin-bottom: 2rem; line-height: 1.7; }
.button-group { display: flex; gap: 1rem; flex-wrap: wrap; }
.features-grid { display: flex; flex-direction: column; gap: 1rem; }
.feature-card { background: rgba(30, 41, 59, 0.5); border: 1px solid var(--border-color); border-radius: 0.75rem; padding: 1.5rem; transition: all 0.3s ease; }
.feature-card:hover { border-color: var(--accent-cyan); background: rgba(6, 182, 212, 0.05); }
.feature-card h3 { margin: 0 0 0.5rem 0; color: var(--text-primary); }
.feature-card p { font-size: 0.875rem; margin: 0; }

/* --- MODALS --- */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; }
.modal.active { display: flex; }
.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); cursor: pointer; }
.modal-content { position: relative; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 1rem; padding: 2rem; max-width: 28rem; width: 90%; margin: auto; z-index: 1001; box-shadow: var(--shadow); }
.close-btn { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; padding: 0; }
.close-btn:hover { color: var(--text-primary); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h2 { margin-top: 0; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.form-group input { width: 100%; padding: 0.75rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); border-radius: 0.5rem; color: var(--text-primary); font-size: 1rem; transition: border-color 0.3s ease; }
.form-group input:focus { outline: none; border-color: var(--accent-cyan); }
.form-group input::placeholder { color: var(--text-muted); }
.error-message { color: var(--accent-red); font-size: 0.875rem; margin-bottom: 1rem; display: none; }
.error-message.show { display: block; }

/* --- DASHBOARD --- */
.dashboard-header { background: rgba(30, 41, 59, 0.5); border-bottom: 1px solid var(--border-color); padding: 1.5rem 2rem; display: flex; justify-content: space-between; align-items: center; }
.header-left, .header-right { display: flex; align-items: center; gap: 2rem; }
.dashboard-header .header-logo { margin: 0; gap: 0.75rem; }
.dashboard-header .header-logo span { font-size: 1.5rem; font-weight: 600; }
#user-welcome { font-size: 0.95rem; white-space: nowrap; }
.dashboard-content { max-width: 1280px; margin: 0 auto; padding: 3rem 2rem; }

/* --- QUIZ GRID --- */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.quiz-card { background: rgba(30, 41, 59, 0.5); border: 1px solid var(--border-color); border-radius: 0.75rem; overflow: hidden; transition: all 0.3s ease; display: flex; flex-direction: column; }
.quiz-card:hover { transform: translateY(-5px); border-color: var(--accent-cyan); }
.quiz-card-image { width: 100%; height: 180px; background-color: var(--bg-tertiary); background-size: cover; background-position: center; }
.quiz-card-content { padding: 1.5rem; flex-grow: 1; display: flex; flex-direction: column; }
.quiz-card-content h3 { margin: 0 0 0.5rem 0; font-size: 1.25rem; }
.quiz-card-content p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; flex-grow: 1; }

/* --- QUIZ PAGE --- */
.quiz-container { max-width: 800px; margin: 0 auto; padding: 2rem; min-height: 100vh; display: flex; flex-direction: column; }
.back-btn { background: none; border: none; color: var(--accent-cyan); font-size: 1rem; cursor: pointer; margin-bottom: 2rem; padding: 0.5rem 0; }
.back-btn:hover { color: #0891b2; }
.quiz-content { background: rgba(30, 41, 59, 0.5); border: 1px solid var(--border-color); border-radius: 1rem; padding: 2rem; flex: 1; display: flex; flex-direction: column; }
.quiz-header { margin-bottom: 2rem; }
.quiz-header h2 { margin: 0 0 1rem 0; }
.quiz-progress { margin-bottom: 1rem; }
.quiz-progress span { font-size: 0.875rem; color: var(--text-muted); }
.progress-bar { height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-top: 0.75rem; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-cyan); width: 20%; transition: width 0.3s ease; }
.quiz-body { flex: 1; }
.quiz-body h3 { margin-top: 0; margin-bottom: 2rem; font-size: 1.5rem; }
.options-grid { display: grid; gap: 1rem; }
.option { background: var(--bg-tertiary); border: 2px solid var(--border-color); border-radius: 0.5rem; padding: 1rem; cursor: pointer; transition: all 0.3s ease; text-align: left; }
.option:hover { border-color: var(--accent-cyan); background: rgba(6, 182, 212, 0.05); }
.option.selected { border-color: var(--accent-cyan); background: rgba(6, 182, 212, 0.1); }
.quiz-footer { display: flex; gap: 1rem; margin-top: 2rem; justify-content: space-between; }
.quiz-footer .btn { flex: 1; }

/* --- TIMER aur ANSWER HIGHLIGHTING --- */
.timer-display { display: block; margin-top: 1rem; font-size: 1rem; color: var(--accent-orange); font-weight: 600; }
.option.disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
.option.right { border-color: var(--accent-green) !important; background: rgba(16, 185, 129, 0.1) !important; color: var(--accent-green) !important; font-weight: 700; pointer-events: none; animation: pulse-correct 0.5s ease-in-out; }
.option.wrong { border-color: var(--accent-red) !important; background: rgba(239, 68, 68, 0.1) !important; color: var(--accent-red) !important; pointer-events: none; animation: shake-wrong 0.5s ease-in-out; }

/* --- Animations for Feedback --- */
@keyframes pulse-correct {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake-wrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* --- RESULTS MODAL --- */
.results-modal-content { max-width: 450px; text-align: center; }
.results-header { margin-bottom: 2rem; }
.results-score-circle { width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple)); display: flex; align-items: center; justify-content: center; margin: 1rem auto; font-size: 2rem; font-weight: 700; color: var(--bg-primary); box-shadow: 0 10px 20px rgba(6, 182, 212, 0.2); }
.results-details p { font-size: 1rem; color: var(--text-secondary); margin: 0.5rem 0; }
.results-actions { margin-top: 2rem; }
.share-buttons { margin-top: 1.5rem; }
.share-buttons p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.share-btn { margin: 0.25rem; font-size: 0.8rem; padding: 0.5rem 1rem; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; } h2 { font-size: 1.75rem; }
    .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
    .button-group { flex-direction: column; } .button-group .btn { width: 100%; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .header-right { width: 100%; justify-content: space-between; } #user-welcome { white-space: normal; }
    .quiz-grid { grid-template-columns: 1fr; }
    .quiz-footer { flex-direction: column; } .quiz-footer .btn { width: 100%; }
    .modal-content { width: 95%; max-width: 100%; }
}