/* --- Global Reset & Base Styles --- */
:root {
    --primary-red: #b91c1c; /* red-700 */
    --dark-red: #7f1d1d; /* red-900 */
    --amber-50: #fffbeb;
    --amber-200: #fde68a;
    --amber-500: #f59e0b;
    --yellow-300: #fde047;
    --text-dark: #1f2937;
    --text-gray: #374151;
    --white: #ffffff;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background-color: var(--amber-50);
    color: var(--text-dark);
}

* {
    box-sizing: border-box;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .9; transform: scale(1.05); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

.animate-pulse-btn {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Soha Navigation (Giữ nguyên style cũ + flexbox chuẩn) --- */
.sp-sticky-header {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 45px;
    background-color: #000; 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    z-index: 99999; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.5); 
    font-family: Arial, sans-serif;
}

.left-group, .right-group { 
    display: flex; 
    align-items: center; 
    height: 100%; 
}

.sp-back-to-soha-new {
    display: flex; align-items: center; justify-content: center; 
    width: 45px; height: 45px;
    background-color: #007f74; color: white; font-size: 18px; cursor: pointer;
    transition: background-color 0.3s ease;
}
.sp-back-to-soha-new:hover { background-color: #00665d; }

.emg-icon-svg { fill: currentColor; width: 20px; height: 20px; }

.sp-mag-logo-new { margin-left: 15px; display: flex; align-items: center; }
.sp-mag-logo-new img { height: 24px; width: auto; display: block; }

.center-logo {
    position: absolute; left: 50%; transform: translateX(-50%); 
    pointer-events: none; user-select: none;
    display: flex; align-items: center; justify-content: center;
}
.center-logo img { height: 26px; width: auto; display: block; }

.mobile-emag-logo {
    display: none; 
    height: 24px;
    width: auto;
    margin-right: 15px;
}

.fb-custom-btn {
    display: flex; align-items: center; gap: 6px; color: white; 
    font-size: 13px; font-weight: bold; cursor: pointer; opacity: 0.9;
    margin-right: 15px;
    text-decoration: none;
    transition: opacity 0.3s ease;
}
.fb-custom-btn:hover { opacity: 1; text-decoration: underline; }

@media (max-width: 768px) { 
    .center-logo, .fb-custom-btn { display: none !important; } 
    .mobile-emag-logo { display: block !important; }
}

/* --- Layout Components --- */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

.main-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-top: 45px; /* header height */
    /* Gradient Background replacement */
    background: radial-gradient(ellipse at center, #991b1b, #7f1d1d, #451a03); 
}

@media (min-width: 768px) {
    .main-container {
        padding: 40px;
        padding-top: 60px;
        padding-bottom: 40px;
    }
}

.quiz-card {
    width: 100%;
    max-width: 672px; /* max-w-2xl */
    background-color: var(--amber-50);
    z-index: 10;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 45px);
}

@media (min-width: 768px) {
    .quiz-card {
        border-radius: 1.5rem; /* rounded-3xl */
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
        border: 1px solid rgba(245, 158, 11, 0.5);
        min-height: auto;
    }
}

/* --- Header Section --- */
.quiz-header {
    padding: 1.25rem;
    text-align: center;
    color: white;
    border-bottom: 2px solid #fbbf24;
    position: relative;
    background: linear-gradient(to right, #b91c1c, #dc2626, #d97706);
}

.pattern-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0.1;
    background-image: url('https://www.transparenttextures.com/patterns/cubes.png');
}

.quiz-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #fef08a; /* yellow-200 */
    text-transform: uppercase;
    letter-spacing: 0.025em;
    position: relative;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@media (min-width: 768px) { .quiz-title { font-size: 1.5rem; } }

/* --- Start Screen --- */
.start-screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.hero-image-container {
    width: 100%;
    position: relative;
    cursor: pointer;
}
.hero-image {
    width: 100%;
    height: auto;
    display: block;
}
.start-btn-container {
    padding: 2rem;
    background-color: var(--amber-50);
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-start {
    padding: 1.25rem 2rem;
    width: 100%;
    background: linear-gradient(to right, #dc2626, #991b1b);
    color: #fef3c7;
    font-weight: 700;
    font-size: 1.125rem;
    border-radius: 9999px;
    box-shadow: 0 10px 15px -3px rgba(127, 29, 29, 0.3);
    border: 2px solid #f59e0b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: transform 0.2s;
}
.btn-start:hover { transform: scale(1.05); background: linear-gradient(to right, #ef4444, #b91c1c); }
@media (min-width: 768px) { .btn-start { width: auto; min-width: 300px; } }

/* --- Quiz Interface --- */
.quiz-body {
    padding: 1.5rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    height: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 768px) { .quiz-body { padding: 2.5rem; } }

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.category-badge {
    background-color: #fef2f2;
    color: #991b1b;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    border: 1px solid #fecaca;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.progress-track {
    width: 8rem;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background-color: #dc2626;
    transition: width 0.5s ease-out;
}
.progress-text {
    font-size: 0.875rem;
    font-weight: 700;
    color: #6b7280;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2rem;
    line-height: 1.375;
}
@media (min-width: 768px) { .question-text { font-size: 1.5rem; } }

.options-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    background-color: white;
    font-weight: 500;
    font-size: 1.125rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
}

.option-btn:hover:not(:disabled) {
    background-color: var(--amber-50);
    border-color: #fcd34d;
}

.option-icon {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #9ca3af;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

/* Feedback States */
.option-btn.correct {
    background-color: #f0fdf4; /* green-50 */
    border-color: #22c55e;
    color: #14532d;
    box-shadow: 0 0 0 1px #22c55e;
}
.option-btn.correct .option-icon {
    background-color: #22c55e;
    border-color: #22c55e;
    color: white;
    border: none;
}

.option-btn.wrong {
    background-color: #fef2f2; /* red-50 */
    border-color: #ef4444;
    color: #7f1d1d;
}
.option-btn.wrong .option-icon {
    background-color: #ef4444;
    border-color: #ef4444;
    color: white;
    border: none;
}

.option-btn.disabled {
    opacity: 0.6;
    background-color: #f9fafb;
    pointer-events: none;
}

.explanation-box {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 0.75rem;
    border-left-width: 4px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.explanation-box.correct {
    background-color: #f0fdf4;
    border-left-color: #22c55e;
}
.explanation-box.wrong {
    background-color: #fff7ed;
    border-left-color: #f97316;
}

.explanation-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.text-green { color: #166534; }
.text-orange { color: #9a3412; }

.btn-next {
    margin-top: 1.5rem;
    width: 100%;
    padding: 1rem;
    background-color: #b91c1c;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(127, 29, 29, 0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s, transform 0.2s;
}
.btn-next:hover { background-color: #991b1b; transform: translateY(-2px); }

/* --- Result Screen --- */
.result-screen {
    padding: 2.5rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-image: url('https://www.transparenttextures.com/patterns/rice-paper.png');
}

.award-icon-container {
    display: inline-block;
    padding: 1rem;
    border-radius: 50%;
    background-color: #fef9c3;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}

.result-score {
    font-size: 3.75rem;
    font-weight: 800;
    background: linear-gradient(to right, #dc2626, #991b1b);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 2rem;
}

.result-message-box {
    background-color: white;
    border: 2px solid #fde68a;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.result-bar-decor {
    position: absolute; top: 0; left: 0; width: 100%; height: 8px;
    background: linear-gradient(to right, #ef4444, #eab308, #ef4444);
}

.wishes-box {
    padding: 1.5rem;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.btn-restart {
    padding: 1rem 2.5rem;
    background-color: #1f2937;
    color: white;
    font-weight: 700;
    font-size: 1.125rem;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto;
    transition: background-color 0.2s;
}
.btn-restart:hover { background-color: #111827; }

/* --- Footer --- */
.footer {
    width: 100%;
    background-color: #bfdbfe; /* blue-200 */
    color: #334155; /* slate-700 */
    padding: 1rem;
    position: relative;
    z-index: 20;
    font-size: 0.875rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}
.footer-content {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
}
@media (min-width: 768px) {
    .footer-content { flex-direction: row; gap: 1.5rem; }
}
.footer-dot {
    display: none; width: 4px; height: 4px; border-radius: 50%; background-color: #94a3b8;
}
@media (min-width: 768px) { .footer-dot { display: block; } }
.footer-bold { font-weight: 700; color: #0f172a; }

/* --- Fireworks Canvas --- */
.fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}