:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --success-bg: #fef2f2;
    --success-text: #991b1b;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --border-color: #f1f5f9;
    --shadow-soft: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 1600px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 2.5rem 1.5rem;
}

.app-header {
    margin-bottom: 2.5rem;
    padding-top: 1rem;
}

.app-header h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.app-header .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 400;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quote-card {
    background: #fef2f2;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #fee2e2;
}

.quote-card h2 {
    font-size: 0.8rem;
    font-weight: 800;
    color: #000000;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.quote-card p {
    font-size: 0.95rem;
    color: #000000;
    opacity: 1;
    line-height: 1.4;
    font-weight: 500;
}

.quiz-selection-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: var(--transition);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-color);
}

.quiz-card:active {
    transform: scale(0.97);
}

.quiz-card-icon {
    font-size: 2rem;
    background: #f1f5f9;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.quiz-card-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.quiz-card-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.state-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    width: 100%;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#question-text {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    line-height: 1.3;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-md);
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.option-btn:hover {
    border-color: var(--primary);
    background: white;
}

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

.option-btn.correct {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

.option-btn.wrong {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.hidden {
    display: none !important;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.content-area>* {
    animation: slideUp 0.5s ease-out forwards;
}

@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem 1rem;
    }

    .app-header {
        margin-bottom: 1.5rem;
    }

    .state-card {
        padding: 1.5rem;
    }

    #question-text {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    .options-grid {
        gap: 0.6rem;
    }

    .option-btn {
        padding: 1rem;
    }

    #feedback-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 2.5rem 1.5rem 1.5rem 1.5rem;
        margin-top: 0;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        max-height: 85vh;
        overflow-y: auto;
    }
}

.streak-box {
    background-color: #fff7ed;
    border: 1px solid #fdba74;
    color: #ea580c;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
}

.explanation-message {
    padding: 1.25rem;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    border: none;
    margin-top: 1rem;
    width: 100%;
}

.primary-btn {
    background: var(--primary);
    color: white;
    padding: 1.15rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    border: none;
    cursor: pointer;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#feedback-container {
    margin-top: 1.5rem;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

#quiz-screen {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.grid-panel {
    width: 550px;
    flex-shrink: 0;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-color: transparent transparent;
}

.grid-panel:hover {
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.grid-panel::-webkit-scrollbar {
    width: 6px;
}

.grid-panel::-webkit-scrollbar-track {
    background: transparent;
}

.grid-panel::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 10px;
}

.grid-panel:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}

.grid-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

.question-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

@media (min-width: 1024px) {
    .question-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

.grid-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 2px solid transparent;
    transition: var(--transition);
}

.grid-item:hover {
    background: #e2e8f0;
}

.grid-item.status-correct {
    background: #dcfce7;
    color: #166534;
}

.grid-item.status-wrong {
    background: #fee2e2;
    color: #991b1b;
}

.grid-item.is-active {
    border-color: var(--primary);
    transform: scale(1.05);
}

.bottom-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: #f1f5f9;
    color: var(--text-primary);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
}

.nav-btn:hover:not(:disabled) {
    background: #e2e8f0;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.hidden-desktop {
    display: none !important;
}


@media (max-width: 768px), (max-width: 1024px) and (orientation: portrait) {
    #quiz-screen {
        flex-direction: column;
        display: block;
    }
    .grid-panel {
        display: none !important;
    }
    .bottom-nav {
        display: none !important;
    }
    .hidden-desktop {
        display: block !important;
    }
}

@media (max-width: 767px) {
    .hidden-mobile {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .question-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}
