:root {
    --primary-color: #ff5722;
    --secondary-color: #607d8b;
    --accent-color: #ff9800;
    --background-dark: #121212;
    --background-medium: #1e1e1e;
    --background-light: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #bdbdbd;
    --correct-color: #4caf50;
    --wrong-color: #f44336;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {

    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-primary);
    position: fixed;
}

body {
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    font-size: 16px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    text-rendering: optimizeLegibility;
}

.app-container {
    width: 100%;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.app-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--secondary-color);
}

.app-title {
    font-size: 2.2rem;
    color: var(--accent-color);
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.app-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Стили для выбора режима */
.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--background-medium);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.mode-selection-title {
    margin-bottom: 20px;
    color: var(--accent-color);
    font-size: 1.5rem;
}

.mode-options {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 15px;
}

.mode-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--text-primary);
    border: none;
    padding: 15px;
    font-size: 1.1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 100%;
}

.mode-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.mode-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Стили для экрана викторины */
.quiz-screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.quiz-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.progress-container {
    flex-grow: 1;
    height: 10px;
    background-color: var(--background-light);
    border-radius: 5px;
    overflow: hidden;
    margin-right: 15px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.4s ease;
}

.score-counter {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-color);
    min-width: 70px;
    text-align: right;
}

.question-container {
    background-color: var(--background-medium);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
}

.question-text {
    font-size: 1.3rem;
    line-height: 1.4;
    color: var(--text-primary);
}

.options-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.option {
    background-color: var(--background-light);
    border: 2px solid var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 15px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    box-shadow: var(--box-shadow);
    text-align: center;
    color: var(--text-primary);
}

.option:hover {
    background-color: var(--background-medium);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
}

.option:active {
    transform: translateY(0);
}

.option.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
    color: white;
}

.option.wrong {
    background-color: var(--wrong-color);
    border-color: var(--wrong-color);
    color: white;
}

.answer-feedback {
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.answer-explanation {
    background-color: var(--background-medium);
    padding: 15px;
    border-left: 4px solid var(--accent-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.5;
}

.next-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--text-primary);
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
    width: 100%;
}

.next-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.next-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.exit-button {
    background-color: var(--background-light);
    color: var(--text-primary);
    border: 2px solid var(--secondary-color);
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 20px;
    width: 100%;
}

.exit-button:hover {
    background-color: var(--background-medium);
}

/* Добавим в раздел кнопок, рядом с .exit-button */
#quiz-restart-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--text-primary);
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
    width: 100%;
}

#quiz-restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

#quiz-restart-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Стили для экрана результатов */
.result-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: var(--background-medium);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.result-title {
    color: var(--accent-color);
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.result-summary {
    font-size: 1.2rem;
    margin-bottom: 20px;
    text-align: center;
}

.result-summary span {
    font-weight: bold;
    color: var(--accent-color);
}

.result-category {
    background-color: var(--background-light);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    width: 100%;
    text-align: center;
}

.result-category h3 {
    color: var(--accent-color);
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.result-category p {
    font-size: 1rem;
    line-height: 1.5;
}

.result-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
}

.restart-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: var(--text-primary);
    border: none;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.restart-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Вспомогательные классы */
.hidden {
    display: none !important;
}

.disabled {
    pointer-events: none;
    opacity: 0.7;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }
    
    .app-title {
        font-size: 1.8rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .option {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .mode-selection, .result-screen {
        padding: 15px;
    }
    
    .question-container {
        padding: 15px;
    }
    
    .options-container {
        gap: 8px;
    }
    
    .answer-explanation {
        padding: 12px;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .app-container {
        padding: 5px;
    }
    
    .app-header {
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    
    .app-title {
        font-size: 1.2rem;
        margin-bottom: 0;
    }
    
    .app-subtitle {
        font-size: 0.9rem;
    }
    
    .question-text {
        font-size: 1rem;
    }
    
    .option {
        padding: 8px 10px;
        font-size: 0.9rem;
    }
    
    .answer-explanation {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .next-button, .restart-button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

/* Улучшенная адаптация под маленькие экраны */
@media (max-width: 600px) {
    .app-container {
        padding: 10px;
        min-height: 100vh;
        height: auto;
        overflow-y: auto;
    }
    
    .app-header {
        padding: 10px 0;
    }
    
    .app-title {
        font-size: 1.5rem;
    }
    
    .app-subtitle {
        font-size: 0.9rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .option {
        padding: 12px 8px;
        font-size: 0.9rem;
    }
    
    .answer-explanation {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .next-button, .restart-button {
        padding: 10px;
        font-size: 1rem;
    }
}

/* Адаптация под ландшафтный режим */
@media (orientation: landscape) {
    .app-container {
        padding: 10px;
    }
    
    .quiz-screen {
        overflow-y: auto;
    }
    
    .options-container {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .question-container {
        padding: 15px;
    }
    
    .answer-feedback {
        position: sticky;
        bottom: 0;
        background: var(--background-dark);
        padding: 10px 0;
    }
}

/* Для очень маленьких экранов в ландшафтном режиме */
@media (orientation: landscape) and (max-height: 500px) {
    .app-header {
        margin-bottom: 5px;
        padding-bottom: 5px;
    }
    
    .app-title {
        font-size: 1.2rem;
    }
    
    .app-subtitle {
        display: none;
    }
    
    .question-text {
        font-size: 1rem;
        line-height: 1.3;
    }
    
    .option {
        padding: 6px 4px;
        font-size: 0.8rem;
    }
    
    .answer-explanation {
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .next-button, .restart-button {
        padding: 6px;
        font-size: 0.9rem;
    }
    
    .progress-container {
        height: 6px;
    }
    
    .score-counter {
        font-size: 0.9rem;
    }
}

/* Для очень высоких экранов */
@media (min-height: 1000px) {
    .app-container {
        justify-content: center;
    }
    
    .quiz-screen {
        max-height: 900px;
    }
}

/* Фикс для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: -webkit-fill-available;
    }
}

/* Добавьте это в конец файла style.css */

/* Адаптация под очень большое масштабирование */
@media (min-resolution: 250dpi) {
    .app-container {
        padding: 30px;
        max-width: 1200px;
    }
    
    .app-title {
        font-size: 3rem;
    }
    
    .app-subtitle {
        font-size: 1.5rem;
    }
    
    .mode-selection, 
    .result-screen {
        padding: 30px;
        max-width: 800px;
    }
    
    .mode-selection-title {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    .mode-button {
        padding: 25px;
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .quiz-progress {
        margin-bottom: 30px;
    }
    
    .progress-container {
        height: 15px;
    }
    
    .score-counter {
        font-size: 1.8rem;
        min-width: 120px;
    }
    
    .question-container {
        padding: 30px;
        margin-bottom: 30px;
    }
    
    .question-text {
        font-size: 2rem;
        line-height: 1.5;
    }
    
    .options-container {
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .option {
        padding: 25px;
        font-size: 1.5rem;
        border-width: 3px;
    }
    
    .answer-feedback {
        margin-top: 30px;
    }
    
    .answer-explanation {
        padding: 25px;
        font-size: 1.5rem;
        border-left-width: 6px;
        margin-bottom: 25px;
    }
    
    .next-button,
    .restart-button,
    .exit-button,
    #quiz-restart-button {
        padding: 20px;
        font-size: 1.8rem;
        margin-top: 30px;
    }
    
    .result-title {
        font-size: 2.5rem;
        margin-bottom: 30px;
    }
    
    .result-summary {
        font-size: 1.8rem;
        margin-bottom: 30px;
    }
    
    .result-category {
        padding: 30px;
        margin-bottom: 30px;
    }
    
    .result-category h3 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .result-category p {
        font-size: 1.5rem;
    }
    
    .result-actions {
        gap: 20px;
    }
}

/* Для экранов с очень высоким разрешением и масштабированием */
@media (min-width: 2000px) {
    .app-container {
        max-width: 1600px;
    }
    
    .app-title {
        font-size: 4rem;
    }
    
    .app-subtitle {
        font-size: 2rem;
    }
    
    .mode-selection-title {
        font-size: 3rem;
    }
    
    .question-text {
        font-size: 2.5rem;
    }
    
    .option {
        font-size: 2rem;
        padding: 30px;
    }
    
    .next-button,
    .restart-button,
    .exit-button,
    #quiz-restart-button {
        font-size: 2.5rem;
        padding: 30px;
    }
}

/* Улучшенная адаптация для ландшафтного режима при масштабировании */
@media (orientation: landscape) and (min-resolution: 250dpi) {
    .app-container {
        padding: 20px;
    }
    
    .options-container {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .question-text {
        font-size: 1.8rem;
    }
    
    .option {
        font-size: 1.3rem;
        padding: 20px;
    }
    
    .answer-feedback {
        position: sticky;
        bottom: 0;
        background: var(--background-dark);
        padding: 15px 0;
    }
}

/* Улучшенный контроль размера шрифта при масштабировании */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Улучшенное поведение при масштабировании */
body {
    touch-action: pan-x pan-y;
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

.app-container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Улучшенные отступы для кнопок на маленьких экранах с большим масштабированием */
@media (max-width: 600px) and (min-resolution: 250dpi) {
    .app-container {
        padding: 20px;
    }
    
    .mode-button,
    .next-button,
    .restart-button,
    .exit-button,
    #quiz-restart-button {
        margin-bottom: 15px;
    }
    
    .result-actions {
        gap: 15px;
    }
}