:root {
    /* Colors */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #eab308;
    --bg-color: #030303;
    --card-bg: #0a0a0a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    
    /* Layout */
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #020202 0%, #0a0a0c 50%, #000000 100%);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#app-container {
    width: 100%;
    max-width: 900px;
    background: rgba(10, 10, 12, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    overflow: hidden;
    position: relative;
    min-height: 600px;
}

/* Screens */
.screen {
    display: none;
    padding: 2rem;
    height: 100%;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Typography & General */
h1 { font-size: 2rem; margin-bottom: 1rem; color: #fff; }
h2 { font-size: 1.5rem; margin-bottom: 1.5rem; line-height: 1.4; }
h3 { font-size: 1.25rem; margin-bottom: 1rem; }

/* Buttons */
.primary-btn, .secondary-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#start-btn {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.primary-btn:hover:not(:disabled) { 
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.primary-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

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

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

/* Start Screen */
#start-screen {
    text-align: center;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.school-logo {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    margin-bottom: 1rem;
    filter: invert(1) drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.top-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 800px;
    margin-bottom: 2.5rem;
}

@media (min-width: 768px) {
    .top-cards-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.rules-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: left;
    height: 100%;
}

.rules-card ul {
    list-style: none;
}

.rules-card li {
    margin-bottom: 0.75rem;
    color: #e2e8f0;
}

.session-stats-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    text-align: left;
    height: 100%;
}

.icon-btn {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(220, 38, 38, 0.8);
    transform: scale(1.05);
}

.session-stats-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.font-bold { font-weight: bold; }

.start-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
    margin-bottom: 2rem;
}

.contact-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 800px;
}

.contact-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.social-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.social-link {
    text-decoration: none;
    color: #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.contact-link {
    text-decoration: none;
    color: #e2e8f0;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.status-badge {
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-badge span:last-child { color: var(--warning); font-variant-numeric: tabular-nums; }
.correct-badge span:last-child { color: var(--success); }
.wrong-badge span:last-child { color: var(--danger); }
.remain-badge span:last-child { color: var(--primary); }

#wrong-badge-btn {
    cursor: pointer;
    transition: var(--transition);
}

#wrong-badge-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    transform: translateY(-2px);
}

.quiz-content { flex: 1; }

#question-image-container {
    margin-bottom: 1.5rem;
    border-radius: 8px;
    overflow: hidden;
    max-height: 250px;
    display: flex;
    justify-content: center;
    background: #000;
}

#question-image {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.hidden { display: none !important; }

/* Options */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.option-label:hover { border-color: var(--primary); background: rgba(37, 99, 235, 0.1); }
.option-label.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.15);
}

.option-label input[type="checkbox"] { display: none; }

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--border-color);
    border-radius: 6px;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
}

.option-label.selected .option-letter {
    background: var(--primary);
    color: white;
}

.option-text { font-size: 1.1rem; line-height: 1.4; }

/* Actions */
.actions-container {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

/* Modal */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.modal-content.success h2 { color: var(--success); }
.modal-content.error h2 { color: var(--danger); }

#feedback-correct-answers {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.history-modal-content {
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.history-list {
    text-align: left;
    margin-top: 1rem;
    overflow-y: auto;
    flex: 1;
    padding-right: 10px;
}
.history-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Result Screen */
#result-screen {
    text-align: center;
    justify-content: center;
    align-items: center;
}

.result-icon { font-size: 5rem; margin-bottom: 1rem; }
.stats-card {
    display: flex;
    gap: 3rem;
    background: rgba(0,0,0,0.2);
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.stat { display: flex; flex-direction: column; gap: 0.5rem; }
.stat-label { font-size: 1.1rem; color: var(--text-muted); }
.stat-value { font-size: 2.5rem; font-weight: bold; }

.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.result-message { font-size: 1.25rem; margin-bottom: 2rem; }

#wrong-answers-container {
    background: rgba(0,0,0,0.2);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 2rem;
    text-align: left;
}

.wrong-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wrong-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Responsive */
@media (max-width: 600px) {
    .actions-container { flex-direction: column; }
    .quiz-header { justify-content: center; }
    .stats-card { gap: 1.5rem; padding: 1.5rem; }
}

.social-link:hover, .contact-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #ffffff;
}
.social-link.website:hover { background: rgba(71, 85, 105, 0.3); border-color: rgba(71, 85, 105, 0.5); }
.social-link.facebook:hover { background: rgba(24, 119, 242, 0.2); border-color: rgba(24, 119, 242, 0.5); }
.social-link.instagram:hover { background: rgba(225, 48, 108, 0.2); border-color: rgba(225, 48, 108, 0.5); }
.social-link.tiktok:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.3); }
.contact-link.phone:hover { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.5); color: #60a5fa;}
.contact-link.whatsapp:hover { background: rgba(37, 211, 102, 0.2); border-color: rgba(37, 211, 102, 0.5); color: #4ade80;}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
    body {
        align-items: flex-start; /* Move app to top on mobile */
    }
    #app-container {
        margin: 0;
        border-radius: 0;
        border: none;
        min-height: 100vh;
        padding: 1rem 0.75rem;
    }
    .quiz-header {
        gap: 0.5rem;
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }
    .status-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    #question-text { font-size: 1.1rem; line-height: 1.5; font-weight: 500; margin-bottom: 1.5rem; }
    #question-image-container {
        margin-bottom: 1rem;
        max-height: 160px;
    }
    #question-image {
        max-height: 160px;
    }
    .options-container {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .option-label {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    .option-letter {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 0.8rem;
    }
    .primary-btn, .secondary-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    .actions-container {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    .explanation-box {
        padding: 1rem;
        margin-top: 1rem;
        font-size: 0.9rem;
    }
    .top-cards-grid {
        display: flex;
        flex-direction: column;
    }
    .school-logo {
        max-height: 80px;
    }
    h1 {
        font-size: 1.8rem;
    }
    .subtitle {
        font-size: 0.95rem;
    }
}

@media (min-width: 320px) {
    #question-text {
        font-size: 1.05rem !important;
    }
    .option-label {
        font-size: 0.95rem !important;
        padding: 0.75rem 1rem !important;
    }
    .option-letter {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        font-size: 0.85rem !important;
    }
}
