:root {
    --bg-color: #f4f7f6;
    --surface-color: #ffffff;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --primary-color: #1bbd9c;
    --primary-hover: #14967c;
    --border-color: #dfe6e9;
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 40px rgba(27, 189, 156, 0.2);
    --transition-bounce: 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --transition-smooth: 0.3s ease;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --text-primary: #f5f6fa;
    --text-secondary: #b2bec3;
    --border-color: #2d3436;
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 20px 40px rgba(27, 189, 156, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
    overflow-x: hidden;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow);
    z-index: 100;
}

.main-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 4rem;
    width: 90%;
    max-width: 1300px;
    padding: 2rem;
    transition: all 0.6s ease;
}

.media-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    flex: 1;
    min-width: 400px;
    max-width: 500px;
}

.media-sidebar.hidden { display: none; }

.app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 450px;
    max-width: 600px;
    transition: all 0.6s ease;
}

.main-layout.quiz-active {
    max-width: 800px;
}

.main-layout.quiz-active .app-container {
    max-width: 100%;
}

.logo-container {
    margin-bottom: 2rem;
}

.logo-img {
    max-height: 70px;
    width: auto;
}

.screen {
    width: 100%;
}

.screen.hidden {
    display: none;
}

.card {
    background: var(--surface-color);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    width: 100%;
}

.input-group {
    margin-bottom: 1.5rem;
}

input[type="text"] {
    width: 100%;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.btn {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-bounce);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.answers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.answer-option {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    padding: 1.2rem;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-bounce);
}

.answer-option.selected {
    border-color: var(--primary-color);
}

.checkbox-custom {
    width: 24px; height: 24px;
    border-radius: 6px;
    border: 2px solid var(--text-secondary);
    display: flex; justify-content: center; align-items: center;
}

.answer-option.selected .checkbox-custom {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-custom i {
    color: white;
    opacity: 0;
}

.answer-option.selected .checkbox-custom i {
    opacity: 1;
}

.quiz-footer {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.quiz-footer .btn {
    width: auto;
}

.progress-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-bar-bg {
    flex-grow: 1;
    height: 10px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.6s ease;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    border-radius: 20px;
    border: 6px solid var(--surface-color);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.pdf-wrapper {
    position: relative;
    border-radius: 20px;
    border: 6px solid var(--surface-color);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: 0.3s;
}

.pdf-preview-img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
}

.pdf-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(27, 189, 156, 0.85);
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    color: white; opacity: 0; transition: 0.3s;
}

.pdf-wrapper:hover .pdf-overlay {
    opacity: 1;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
}

.modal-content {
    margin: 2% auto;
    width: 90%;
    height: 85%;
    border-radius: 12px;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

@keyframes popIn { 0% { opacity: 0; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } }
@keyframes slideRight { 0% { opacity: 0; transform: translateX(-30px); } 100% { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { 0% { opacity: 0; transform: translateY(30px); } 100% { opacity: 1; transform: translateY(0); } }
@keyframes fadeDown { 0% { opacity: 0; transform: translateY(-20px); } 100% { opacity: 1; transform: translateY(0); } }

.animate-pop-in {
    animation: popIn 0.6s ease forwards;
}

.animate-slide-right {
    animation: slideRight 0.5s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.6s ease forwards;
}

.animate-fade-down {
    animation: fadeDown 0.6s ease forwards;
}

@media (max-width: 1000px) {
    .main-layout {
        flex-direction: column;
        align-items: center;
    }

    .media-sidebar, .app-container {
        min-width: 100%;
        width: 100%;
    }
}

.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    padding: 3rem 2.5rem;
}

.result-card h3 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
    margin: 0;
}

.result-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    position: relative;
    margin: 0;
}

.result-card h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    margin: 0.5rem auto 0;
}

.qr-wrapper {
    background: #ffffff;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(27, 189, 156, 0.15);
    border: 2px solid var(--primary-color);
    display: inline-block;
}

.stats {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--bg-color);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border-color);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
}

.stat-row span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(27, 189, 156, 0.1);
    padding: 0.2rem 0.8rem;
    border-radius: 8px;
    letter-spacing: 0.03em;
}

.result-card .btn {
    margin-top: 0.4rem;
    width: 100%;
}

.card h2 {
    margin-bottom: 1.5rem;
}

.quiz-header {
    margin-bottom: 1rem;
}

.input-group {
    margin-bottom: 0.8rem;
}