:root {
    --bg-color: #11111b;
    --surface-color: #1e1e2e;
    --overlay-color: #313244;
    --text-primary: #cdd6f4;
    --text-secondary: #a6adc8;
    --accent-color: #89b4fa;
    --correct-color: #a6e3a1;
    --incorrect-color: #f38ba8;
    --gold-color: #f9e2af;
    --border-radius: 0.25rem;
}

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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.screen {
    width: 100%;
    max-width: 1000px;
    min-height: 100vh;
    padding: 4rem 2rem;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Intro Screen Styles */
.intro-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.intro-content {
    animation: fadeInIntro 0.8s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.intro-title {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-color);
    letter-spacing: 0.1em;
}

.intro-text {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.intro-text-large {
    font-size: 2rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.intro-subtext {
    font-size: 1.25rem;
    color: var(--gold-color);
    font-weight: 500;
}

@keyframes fadeInIntro {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Titles and Typography */
.main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 4rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    color: var(--accent-color);
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.subtitle {
    display: block;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--gold-color);
    margin-top: 0.5rem;
}

.description {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto 3rem;
    line-height: 1.6;
}

.creator-info {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4rem;
    background: var(--surface-color);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--overlay-color);
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

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

.secondary-btn {
    background: var(--overlay-color);
    color: var(--text-primary);
    border: 1px solid var(--accent-color);
}

.secondary-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.text-btn {
    background: transparent;
    color: var(--text-secondary);
}

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

.icon-btn {
    background: var(--overlay-color);
    padding: 0.75rem;
    font-size: 1.2rem;
}

.btn i {
    margin-right: 0.75rem;
}

.icon-btn i {
    margin-right: 0;
    color: #fff;
}

/* Menu Specifics */
.menu-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    width: 100%;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
}

.lvl-card {
    background: var(--surface-color);
    border: 1px solid var(--overlay-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
}

.lvl-card.unlocked {
    border-color: var(--accent-color);
}

.lvl-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.section-label {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    letter-spacing: 0.1em;
}

.menu-footer {
    width: 100%;
    margin-top: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.puan-card {
    background: var(--surface-color);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    color: var(--gold-color);
    font-weight: 700;
    border: 1px solid var(--overlay-color);
}

/* Quiz Specifics */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.level-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold-color);
}

.progress-container {
    width: 100%;
    height: 8px;
    background: var(--overlay-color);
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
    overflow: hidden;
}

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

.question-card {
    padding: 3rem 0;
    text-align: center;
}

.question-num {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 3rem 0;
}

.option-btn {
    background: var(--surface-color);
    border: 1px solid var(--overlay-color);
    color: var(--text-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
}

.option-btn:not(:disabled):hover {
    border-color: var(--accent-color);
    background: var(--overlay-color);
}

.option-btn.correct {
    background-color: var(--correct-color);
    color: var(--bg-color);
}

.option-btn.incorrect {
    background-color: var(--incorrect-color);
    color: var(--bg-color);
}

.option-btn.missed {
    border: 2px solid var(--correct-color);
}

.hidden {
    display: none !important;
}



/* History Nav */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 3rem;
    border-top: 1px solid var(--overlay-color);
}

.history-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.history-grid {
    display: flex;
    gap: 0.75rem;
}

.hist-dot {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    background: var(--surface-color);
    border: 1px solid var(--overlay-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    cursor: pointer;
}

.hist-dot.active {
    background: var(--accent-color);
    color: var(--bg-color);
}

.hist-dot.correct {
    background: var(--correct-color);
    color: var(--bg-color);
}

.hist-dot.incorrect {
    background: var(--incorrect-color);
    color: var(--bg-color);
}

.hist-dot.available {
    border-color: var(--accent-color);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--surface-color);
    border: 1px solid var(--overlay-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 90%;
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--overlay-color);
}

.modal-header h3 {
    color: var(--gold-color);
    font-size: 1.5rem;
}

.close-btn {
    background: var(--overlay-color);
    color: var(--text-primary);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--incorrect-color);
    color: var(--bg-color);
}

.ans-key-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 1rem;
}

.ans-key-list p {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
}

.ans-key-list p span {
    color: var(--text-secondary);
}

.ans-key-list p strong {
    color: var(--accent-color);
}

/* Custom Scrollbar for Modal */
.ans-key-list::-webkit-scrollbar {
    width: 6px;
}

.ans-key-list::-webkit-scrollbar-track {
    background: transparent;
}

.ans-key-list::-webkit-scrollbar-thumb {
    background: var(--overlay-color);
    border-radius: 10px;
}

/* Result Screen */
.result-card {
    text-align: center;
    margin: auto;
}

.result-title {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
}

.result-score-box {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--border-radius);
    margin-bottom: 3rem;
    border: 1px solid var(--overlay-color);
}

.final-score {
    font-size: 5rem;
    font-weight: 800;
    color: var(--gold-color);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

/* Responsive Design & Media Queries */
@media (max-width: 1024px) {
    .main-title {
        font-size: 3.5rem;
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 2rem 1rem;
    }

    .intro-title {
        font-size: 2.5rem;
    }

    .intro-text-large {
        font-size: 1.5rem;
    }

    .main-title {
        font-size: 2.5rem;
        margin-bottom: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .description {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .creator-info {
        margin-bottom: 3rem;
        width: 100%;
    }

    /* Stack Grids */
    .level-grid,
    .options-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .lvl-card {
        padding: 1.5rem;
    }

    .option-btn {
        padding: 1.25rem;
        font-size: 1.1rem;
    }

    /* Quiz Improvements */
    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-right {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    .progress-container {
        margin-bottom: 2rem;
    }

    .question-text {
        font-size: 1.5rem;
    }

    /* Footer / History Dots */
    .quiz-footer {
        flex-direction: column;
        gap: 2rem;
        align-items: center;
        text-align: center;
    }

    .history-nav {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .history-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .hist-dot {
        width: 36px;
        height: 36px;
    }

    #ans-key-btn {
        width: 100%;
    }

    /* Results */
    .result-title {
        font-size: 2.25rem;
    }

    .final-score {
        font-size: 4rem;
    }

    .result-actions {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .result-actions .btn {
        width: 100%;
    }

    /* Menu Footer */
    .menu-footer {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .intro-title {
        font-size: 2rem;
    }

    .intro-text-large {
        font-size: 1.25rem;
    }

    .main-title {
        font-size: 2rem;
    }

    .question-text {
        font-size: 1.25rem;
    }

    .screen {
        padding-top: 1rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

/* Fluid Typography Helper (Optional but good) */
h1 {
    font-size: clamp(2rem, 5vw + 1rem, 4rem);
}

.question-text {
    font-size: clamp(1.2rem, 3vw + 0.8rem, 2rem);
}