/* Apple-style Minimalist Design */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Apple Light Mode Palette */
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-secondary: #86868b;
    --accent-blue: #0071e3;
    --accent-blue-hover: #0077ed;
    --border-color: rgba(0, 0, 0, 0.08);
    --success-color: #34c759;
    --success-bg: #e5f9eb;
    --error-color: #ff3b30;
    --error-bg: #ffeceb;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
    
    /* Animation Timing */
    --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 860px;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 48px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: height 0.3s var(--ease-apple);
}

/* Screens */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity 0.4s var(--ease-apple), transform 0.4s var(--ease-apple);
}

.screen.active {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: scaleUp 0.5s var(--ease-apple) forwards;
}

@keyframes scaleUp {
    0% { opacity: 0; transform: translateY(15px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Typography */
.main-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-main);
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 48px;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 980px; /* Pill shape */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    display: inline-block;
    letter-spacing: -0.01em;
}

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

.btn.primary:hover {
    background-color: var(--accent-blue-hover);
    transform: scale(1.02);
}

.btn.primary:active {
    transform: scale(0.98);
}

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

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

/* Topic Grid */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.topic-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 20px 24px;
    border-radius: 18px;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s var(--ease-apple);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
}

.topic-btn:hover {
    border-color: var(--accent-blue);
    box-shadow: 0 4px 16px rgba(0, 113, 227, 0.15);
    transform: translateY(-2px);
    color: var(--accent-blue);
}

.topic-btn:active {
    transform: translateY(0) scale(0.98);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 32px;
}

/* Quiz Screen */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

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

#progress-bar {
    height: 100%;
    width: 0%;
    background-color: var(--accent-blue);
    border-radius: 3px;
    transition: width 0.6s var(--ease-apple);
}

.question-container {
    margin-bottom: 40px;
}

#question-text {
    font-size: 1.6rem;
    line-height: 1.4;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.015em;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.option-btn {
    padding: 18px 24px;
    background: var(--card-bg);
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-main);
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s var(--ease-apple);
}

.option-btn:hover:not(:disabled) {
    border-color: var(--accent-blue);
    background-color: rgba(0, 113, 227, 0.02);
}

.option-btn:active:not(:disabled) {
    transform: scale(0.99);
}

.option-btn.correct {
    background-color: var(--success-bg);
    border-color: var(--success-color);
    color: #12803c;
}

.option-btn.wrong {
    background-color: var(--error-bg);
    border-color: var(--error-color);
    color: #c92a2a;
}

.option-btn:disabled {
    cursor: default;
    opacity: 0.7;
}

.option-btn.correct:disabled, .option-btn.wrong:disabled {
    opacity: 1; /* Keep full opacity for the highlighted answers */
}

.hidden {
    display: none !important;
}

#btn-next {
    margin-top: 32px;
    float: right;
}

/* Clearfix for float */
.quiz-screen::after {
    content: "";
    display: table;
    clear: both;
}

/* Result Screen */
.score-container {
    display: flex;
    justify-content: center;
    margin: 48px 0;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 6px solid var(--accent-blue);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 32px rgba(0, 113, 227, 0.2);
}

#score-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.feedback {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 40px;
}

/* Responsive Design (Adaptive) */
@media (max-width: 768px) {
    body {
        padding: 0;
        background-color: var(--card-bg); /* Seamless on mobile */
    }

    .app-container {
        border-radius: 0;
        box-shadow: none;
        padding: 32px 20px;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

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

    #question-text {
        font-size: 1.35rem;
    }

    .button-grid {
        grid-template-columns: 1fr;
    }

    .topic-btn {
        padding: 18px;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    #btn-next {
        float: none;
        width: 100%;
        margin-top: 24px;
    }
}
