 :root {
            --bg-color: #0d0d15;
            --text-color: #e0e0c0;
            --accent-color: #b38867;
            --panel-bg: rgba(13, 13, 21, 0.95);
            --choice-bg: #2a2a3a;
            --choice-hover: #3a3a5a;
            --visited-color: #a0c0a0;
            --locked-color: #666;
            --good-ending: #2e7d32;
            --bad-ending: #c62828;
            --neutral-ending: #fbc02d;
            --error-color: #ff4444;
            --success-color: #44ff44;
        }
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body {
            background: var(--bg-color);
            color: var(--text-color);
            font-family: 'Georgia', 'Times New Roman', serif;
            padding: 20px;
            max-width: 800px;
            margin: 0 auto;
            line-height: 1.8;
            overflow-x: hidden;
            position: relative;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            min-height: 100vh;
        }
        h1 {
            text-align: center;
            font-size: 2.5em;
            margin: 40px 0 20px;
            color: var(--accent-color);
            text-shadow: 0 0 10px rgba(179, 136, 103, 0.5);
            letter-spacing: 2px;
            word-wrap: break-word;
            padding: 80px 20px 20px; /* Отступ сверху для панели прогресса */
            position: relative;
            z-index: 1;
            background: rgba(13, 13, 21, 0.9); /* Полупрозрачный фон */
            border-radius: 10px;
            backdrop-filter: blur(5px); /* Эффект размытия фона */
            -webkit-backdrop-filter: blur(5px); /* Поддержка Safari */
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); /* Тень для лучшей читаемости */
        }
        .scene {
            background: rgba(20, 20, 30, 0.7);
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
            margin: 30px 0;
            position: relative;
            animation: fadeIn 0.8s ease-in;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .choice {
            display: block;
            margin: 15px 0;
            padding: 12px 20px;
            background: var(--choice-bg);
            color: #e0d0a0;
            border: 1px solid #5a4a3a;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            font-weight: bold;
            text-align: left;
            width: 100%;
            font-size: 1em;
            touch-action: manipulation;
        }
        .choice:hover {
            background: var(--choice-hover);
            transform: translateX(5px);
            box-shadow: 0 0 15px rgba(179, 136, 103, 0.4);
        }
        .choice:active {
            transform: scale(0.98);
        }
        .ending {
            background: rgba(40, 20, 20, 0.9);
            padding: 40px;
            padding-top: 60px; /* Доп. отступ под ярлык типа концовки */
            text-align: center;
            font-size: 1.3em;
            border: 2px dashed #8b5a5a;
            animation: pulse 2s infinite;
            word-wrap: break-word;
            position: relative;
            overflow-wrap: break-word;
        }
        .ending-tag {
            position: absolute;
            top: -15px;
            left: 50%;
            transform: translateX(-50%);
            padding: 5px 15px;
            border-radius: 20px;
            font-size: 0.9em;
            font-weight: bold;
            text-transform: uppercase;
            z-index: 2;
        }
        .good { background: var(--good-ending); color: white; }
        .bad { background: var(--bad-ending); color: white; }
        .neutral { background: var(--neutral-ending); color: #000; }
        @keyframes pulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(179, 136, 103, 0.7); }
            50% { box-shadow: 0 0 0 15px rgba(179, 136, 103, 0); }
        }
        .restart {
            display: inline-block;
            margin-top: 30px;
            padding: 15px 30px;
            background: var(--accent-color);
            color: #0d0d15;
            font-weight: bold;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 1.1em;
            transition: all 0.3s ease;
            touch-action: manipulation;
        }
        .restart:hover {
            background: #d4b483;
            transform: scale(1.05);
        }
        .restart:active {
            transform: scale(0.98);
        }
        footer {
            text-align: center;
            margin-top: 50px;
            font-size: 0.9em;
            color: #666;
            padding-bottom: 30px;
        }
        /* 🗺️ Карта прогресса */
        #progress-panel {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 250px;
            background: var(--panel-bg);
            padding: 15px;
            border-radius: 10px;
            box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
            border: 1px solid var(--accent-color);
            z-index: 100;
            font-size: 0.9em;
            transition: all 0.3s ease;
            max-height: 80vh;
            overflow-y: auto;
        }
        #progress-panel.collapsed {
            height: 45px;
            overflow: hidden;
            padding: 10px 15px;
        }
        #progress-toggle {
            position: absolute;
            top: 10px;
            right: 10px;
            background: none;
            border: none;
            color: var(--accent-color);
            font-size: 1.2em;
            cursor: pointer;
            z-index: 101;
            padding: 0;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.3s ease;
            touch-action: manipulation;
        }
        #progress-toggle:hover {
            color: #d4b483;
            background: rgba(179, 136, 103, 0.2);
        }
        #progress-panel.collapsed #progress-content {
            display: none;
        }
        #progress-panel h3 {
            margin: 0 0 10px;
            color: var(--accent-color);
            border-bottom: 1px solid #5a4a3a;
            padding-bottom: 5px;
            position: relative;
        }
        #progress-panel.collapsed h3 {
            border: none;
            padding: 0;
            margin: 0;
            font-size: 1em;
            text-align: center;
        }
        .progress-item {
            margin: 5px 0;
            font-size: 0.9em;
            transition: color 0.3s ease;
            padding: 3px 0;
        }
        .progress-item.visited {
            color: var(--visited-color);
            font-weight: bold;
        }
        .progress-item.locked {
            color: var(--locked-color);
        }
        /* 🏆 Достижения */
        #achievements-btn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: var(--accent-color);
            color: #0d0d15;
            padding: 10px 15px;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            z-index: 100;
            border: none;
            transition: all 0.3s ease;
            font-size: 0.9em;
            touch-action: manipulation;
        }
        #achievements-btn:hover {
            background: #d4b483;
            transform: translateY(-2px);
        }
        #achievements-btn:active {
            transform: scale(0.98);
        }
        /* 🔄 Кнопка сброса прогресса */
        #reset-btn {
            position: fixed;
            bottom: 60px; /* Размещаем выше кнопки достижений */
            right: 20px;
            background: var(--bad-ending); /* Красный цвет, как у плохой концовки */
            color: white;
            padding: 10px 15px;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
            z-index: 100;
            border: none;
            transition: all 0.3s ease;
            font-size: 0.9em;
            touch-action: manipulation;
        }
        #reset-btn:hover {
            background: #d32f2f; /* Более светлый красный при наведении */
            transform: translateY(-2px);
        }
        #reset-btn:active {
            transform: scale(0.98);
        }
        #achievements-panel {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(13, 13, 21, 0.98);
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 0 30px rgba(179, 136, 103, 0.5);
            width: 90%;
            max-width: 600px;
            max-height: 80vh;
            overflow-y: auto;
            z-index: 1000;
            border: 2px solid var(--accent-color);
            animation: panelFadeIn 0.3s ease;
        }
        /* Бекдроп для панели достижений */
        #achievements-backdrop {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0,0,0,0.6);
            z-index: 999;
        }
        @keyframes panelFadeIn {
            from { opacity: 0; transform: translate(-50%, -40%); }
            to { opacity: 1; transform: translate(-50%, -50%); }
        }
        #achievements-panel h2 {
            text-align: center;
            margin-top: 0;
            color: var(--accent-color);
            margin-bottom: 20px;
        }
        .achievement {
            background: rgba(30, 30, 40, 0.7);
            padding: 15px;
            margin: 15px 0;
            border-radius: 8px;
            border-left: 4px solid var(--locked-color);
            transition: all 0.3s ease;
        }
        .achievement.unlocked {
            border-left-color: var(--good-ending);
            background: rgba(46, 125, 50, 0.2);
        }
        .achievement h4 {
            margin: 0 0 5px;
            color: var(--text-color);
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 1.1em;
        }
        .achievement.locked h4 {
            color: var(--locked-color);
        }
        .achievement p {
            margin: 0;
            font-size: 0.9em;
            color: #a0a0a0;
        }
        .close-btn {
            position: absolute;
            top: 10px;
            right: 15px;
            background: none;
            border: none;
            color: var(--text-color);
            font-size: 1.5em;
            cursor: pointer;
            padding: 5px 10px;
            border-radius: 50%;
            transition: all 0.3s ease;
            touch-action: manipulation;
        }
        .close-btn:hover {
            background: rgba(255,255,255,0.1);
            color: #fff;
        }
        /* Уведомления о достижениях */
        .notification {
            position: fixed;
            bottom: 80px;
            right: 20px;
            background: rgba(46, 125, 50, 0.9);
            color: white;
            padding: 15px 20px;
            border-radius: 5px;
            z-index: 1000;
            box-shadow: 0 0 10px rgba(0,0,0,0.5);
            transform: translateX(0);
            transition: opacity 0.5s, transform 0.3s;
            font-weight: bold;
            max-width: 300px;
            text-align: center;
            animation: slideIn 0.3s ease;
        }
        @keyframes slideIn {
            from { transform: translateX(50px); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }
        .notification.fade-out {
            opacity: 0;
            transform: translateX(20px);
        }
        /* Адаптивный дизайн */
        @media (max-width: 768px) {
            body { 
                padding: 10px; 
                font-size: 0.95em;
                line-height: 1.7;
            }
            h1 { 
                font-size: 2em; 
                margin: 20px 0 15px;
                padding: 70px 15px 15px; /* Уменьшенный отступ для мобильных */
                background: rgba(13, 13, 21, 0.9);
                border-radius: 8px;
                backdrop-filter: blur(5px);
                -webkit-backdrop-filter: blur(5px);
                box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
            }
            .scene { 
                padding: 15px;
                margin: 15px 0;
                border-radius: 8px;
            }
            .choice {
                padding: 12px 15px;
                margin: 8px 0;
                font-size: 0.95em;
                min-height: 44px; /* Минимальная высота для удобного нажатия */
                display: flex;
                align-items: center;
            }
            .ending {
                padding: 45px 15px 25px; /* Больше верхний отступ на мобильных */
                font-size: 1.1em;
                margin: 15px 0;
            }
            .restart {
                padding: 12px 25px;
                font-size: 1em;
                min-height: 44px;
            }
            /* Панель прогресса на мобильных */
            #progress-panel {
                width: calc(100vw - 20px);
                max-width: 300px;
                font-size: 0.85em;
                top: 10px;
                right: 10px;
                left: 10px;
                margin: 0 auto;
                padding: 12px;
            }
            #progress-toggle {
                top: 8px;
                right: 8px;
                width: 30px;
                height: 30px;
                font-size: 1em;
            }
            /* Кнопка достижений на мобильных */
            #achievements-btn {
                bottom: 15px;
                right: 15px;
                padding: 10px 15px;
                font-size: 0.9em;
                min-height: 44px;
            }
            /* Кнопка сброса на мобильных */
            #reset-btn {
                bottom: 70px;
                right: 15px;
                padding: 10px 15px;
                font-size: 0.9em;
                min-height: 44px;
            }
            /* Панель достижений на мобильных */
            #achievements-panel {
                width: calc(100vw - 20px);
                max-width: 95%;
                padding: 20px;
                left: 10px;
                right: 10px;
                transform: translateY(-50%);
            }
            .achievement {
                padding: 12px;
                margin: 10px 0;
            }
            /* Улучшенные уведомления */
            .notification {
                bottom: 100px;
                right: 10px;
                left: 10px;
                max-width: none;
                text-align: center;
            }
        }
        @media (max-width: 480px) {
            body { 
                padding: 8px; 
                font-size: 0.9em;
            }
            h1 { 
                font-size: 1.6em; 
                margin: 15px 0 10px;
                padding: 60px 10px 10px; /* Еще меньший отступ для очень маленьких экранов */
                background: rgba(13, 13, 21, 0.9);
                border-radius: 6px;
                backdrop-filter: blur(5px);
                -webkit-backdrop-filter: blur(5px);
                box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
            }
            .scene { 
                padding: 12px;
                margin: 12px 0;
                border-radius: 6px;
            }
            .choice {
                padding: 10px 12px;
                margin: 6px 0;
                font-size: 0.9em;
                min-height: 48px;
            }
            .ending {
                padding: 40px 12px 20px; /* Доп. отступ сверху на очень маленьких экранах */
                font-size: 1em;
                margin: 12px 0;
            }
            .restart {
                padding: 10px 20px;
                font-size: 0.95em;
                min-height: 48px;
            }
            /* Панель прогресса на очень маленьких экранах */
            #progress-panel {
                width: calc(100vw - 16px);
                max-width: 280px;
                font-size: 0.8em;
                top: 8px;
                right: 8px;
                left: 8px;
                padding: 10px;
            }
            #progress-toggle {
                top: 5px;
                right: 5px;
                width: 28px;
                height: 28px;
                font-size: 0.9em;
            }
            /* Кнопка достижений на очень маленьких экранах */
            #achievements-btn {
                bottom: 10px;
                right: 10px;
                padding: 8px 12px;
                font-size: 0.85em;
                min-height: 48px;
            }
            /* Кнопка сброса на очень маленьких экранах */
            #reset-btn {
                bottom: 65px;
                right: 10px;
                padding: 8px 12px;
                font-size: 0.85em;
                min-height: 48px;
            }
            /* Панель достижений на очень маленьких экранах */
            #achievements-panel {
                width: calc(100vw - 16px);
                max-width: 98%;
                padding: 15px;
                left: 8px;
                right: 8px;
            }
            .achievement {
                padding: 10px;
                margin: 8px 0;
            }
            .notification {
                bottom: 80px;
                right: 8px;
                left: 8px;
                padding: 10px 12px;
                font-size: 0.9em;
            }
        }
        /* Стили для iOS Safari */
        @supports (-webkit-touch-callout: none) {
            #achievements-btn, #reset-btn, .choice, .restart, #progress-toggle {
                -webkit-tap-highlight-color: transparent;
            }
            body {
                -webkit-text-size-adjust: 100%;
            }
            .choice, .restart, #achievements-btn, #reset-btn {
                -webkit-appearance: none;
                appearance: none;
                border-radius: 5px;
            }
        }
        /* Стили для Android */
        @media screen and (max-width: 480px) and (orientation: portrait) {
            body {
                font-size: 0.95em;
            }
        }
        /* Дополнительные стили для улучшения UX */
        .choice:focus, .restart:focus, #achievements-btn:focus, #reset-btn:focus {
            outline: 2px solid var(--accent-color);
            outline-offset: 2px;
        }
        /* Улучшенная прокрутка */
        #progress-panel::-webkit-scrollbar {
            width: 6px;
        }
        #progress-panel::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
        }
        #progress-panel::-webkit-scrollbar-thumb {
            background: var(--accent-color);
            border-radius: 3px;
        }
        #progress-panel::-webkit-scrollbar-thumb:hover {
            background: #d4b483;
        }
        /* Анимации для лучшего восприятия */
        .choice, .restart, #achievements-btn, #reset-btn {
            will-change: transform;
        }
        .choice:active, .restart:active, #achievements-btn:active, #reset-btn:active {
            transform: scale(0.95);
        }
        /* Загрузочный экран */
        #loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--bg-color);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            color: var(--text-color);
        }
        .loader {
            border: 4px solid #333;
            border-top: 4px solid var(--accent-color);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin-bottom: 20px;
        }
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }