     :root {
            --bg: #0c0e12;
            --panel: #151a22;
            --ink: #eaf1ff;
            --muted: #9fb0c8;
            --accent: #5aa2ff;
            --ok: #36b37e;
            --bad: #e84652;
            --warn: #f59e0b;
            --border: #233041;
            --radius: 28px;
            --radius-sm: 22px;
            --sans: Montserrat, Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
        }

        * { box-sizing: border-box; }
        html, body { height: 100%; margin: 0; padding: 0; }

        body {
            background: linear-gradient(180deg, var(--bg), #0b111a);
            color: var(--ink);
            font-family: var(--sans);
            line-height: 1.55;
            letter-spacing: .2px;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow-x: hidden;
        }

        #bgfx-stars {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
            pointer-events: none;
        }

        .header {
            padding: 14px 18px;
            border-bottom: 1px solid var(--border);
            background: linear-gradient(180deg, rgba(41, 32, 66, 0.95), rgba(31, 24, 49, 0.95));
            position: sticky;
            top: 0;
            z-index: 102;
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .header .title { font-weight: 700; font-size: 20px; margin: 0; }
        .header .spacer { flex: 1; }
        
        .header .stats-row {
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .header-stat {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 13px;
            font-weight: 600;
            padding: 6px 12px;
            background: rgba(93, 162, 255, 0.08);
            border-radius: 8px;
            border: 1px solid rgba(93, 162, 255, 0.2);
        }

        .header-stat.warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.2); color: var(--warn); }
        .header-stat.danger { background: rgba(232, 70, 82, 0.08); border-color: rgba(232, 70, 82, 0.2); color: var(--bad); }

.app-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 0;
    overflow-y: auto;
    position: relative;
    z-index: 10;
    max-height: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    position: relative;
    z-index: 11;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

       .fixed-viewport {
    min-height: auto; 
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    background: linear-gradient(180deg, rgba(15, 12, 25, 0.95), rgba(10, 8, 18, 0.95));
    box-shadow: 0 18px 60px rgba(18, 13, 28, 0.55);
    display: flex;
     flex-direction: column;  
    z-index: 1;
    max-width: 100%; min-height: 0;
}

        .viewport-header {
            padding: 12px 14px;
            border-bottom: 1px solid var(--border);
            background: linear-gradient(180deg, rgba(41, 32, 66, 0.75), rgba(31, 24, 49, 0.75));
            display: flex;
            align-items: center;
            gap: 16px;
            position: relative;
            z-index: 3;
            flex-shrink: 0;
        }

        .progress-bar {
            flex: 1;
            height: 6px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 999px;
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent), #5ba2ff);
            transition: width 0.3s ease;
            border-radius: 999px;
        }

        .progress-text { color: var(--muted); font-size: 12px; min-width: 50px; text-align: right; }

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    padding: 20px;
    position: relative;
    z-index: 2; 
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: none;
    
    
}

.task-content, #mode-theory-view {
  scrollbar-width: thin; overflow-y: auto;
  scrollbar-color: rgba(93, 162, 255, 0.5) rgba(21, 26, 34, 0.3);
}

.task-content::-webkit-scrollbar , #mode-theory-view::-webkit-scrollbar  {
  width: 10px;
}

.task-content::-webkit-scrollbar-track ,  #mode-theory-view::-webkit-scrollbar-track {
  background: rgba(21, 26, 34, 0.3);
  border-radius: 10px;
}

.task-content::-webkit-scrollbar-thumb ,  #mode-theory-view::-webkit-scrollbar-thumb {
  background: rgba(93, 162, 255, 0.5);
  border-radius: 10px;
}

.task-content::-webkit-scrollbar-thumb:hover,  #mode-theory-view::-webkit-scrollbar-thumb:hover {
  background: rgba(93, 162, 255, 0.8);
}

        .task h2 { margin: 0; font-size: 20px; max-width: 700px; text-align: center; font-weight: 700; }

        .quiz { display: grid; grid-template-columns: 1fr; gap: 8px; width: 90%; max-width: 700px; }

        .option {
            display: block;
            width: 100%;
            text-align: left;
            font-size: 15px;
            border-radius: 14px;
            padding: 10px 12px;
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.02);
            color: var(--ink);
            cursor: pointer;
            transition: all 0.2s ease;
            font-family: var(--sans);
            user-select: none;
            min-height: 36px;
        }

        .option:hover:not(.disabled):not(.correct):not(.wrong) {
            background: rgba(139, 92, 246, 0.08);
            border-color: rgba(168, 85, 247, 0.55);
        }

        .option.correct {
            background: rgba(34, 197, 94, 0.12);
            border: 1px solid rgba(34, 197, 94, 0.42);
            color: #86efac;
        }

        .option.wrong {
            background: rgba(239, 68, 68, 0.12);
            border: 1px solid rgba(239, 68, 68, 0.42);
            color: #ffb4b4;
        }

        .option.disabled {
            opacity: 0.7;
            pointer-events: none;
        }

        .result {
            margin-top: 4px;
            min-height: 20px;
            color: var(--muted);
            font-size: 13px;
            text-align: center;
        }

        .result.show {
            color: var(--ink);
            padding: 12px;
            background: rgba(93, 162, 255, 0.08);
            border-radius: 8px;
        }

        .viewport-footer {
            padding: 12px 14px;
            border-top: 1px solid var(--border);
            background: linear-gradient(180deg, rgba(41, 32, 66, 0.75), rgba(31, 24, 49, 0.75));
            display: flex;
            align-items: center;
            gap: 12px;
            position: relative;
            z-index: 3;
            flex-shrink: 0;
            flex-wrap: wrap;
        }

        .btn {
            padding: 8px 12px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--ink);
            border-radius: 999px;
            cursor: pointer;
            transition: all 0.22s ease;
            user-select: none;
            font-family: var(--sans);
            font-weight: 600;
            font-size: 13px;
        }

        .btn:hover { background: rgba(139, 92, 246, 0.08); border-color: rgba(168, 85, 247, 0.55); }
.btn:disabled { 
    opacity: 0.5; 
    cursor: not-allowed;
    pointer-events: none;
}

.btn[disabled] {
    pointer-events: none !important;
}
        .btn.primary {
            background: linear-gradient(180deg, rgba(139, 92, 246, 0.18), rgba(93, 63, 192, 0.22));
            border-color: rgba(168, 85, 247, 0.35);
        }

        .btn.danger {
            background: rgba(239, 68, 68, 0.1);
            border-color: rgba(239, 68, 68, 0.3);
            color: #ffb4b4;
        }

        .btn.xl { padding: 12px 20px; font-weight: 700; font-size: 15px; }

        .center-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            gap: 16px;
            text-align: center;
            padding: 24px;
            position: relative;
            z-index: 2;
        }

        .center-title { font-weight: 800; letter-spacing: .3px; margin: 0; font-size: 32px; }
        .center-subtitle { color: var(--muted); margin: 0; font-size: 15px; }

        .muted { color: var(--muted); }

        .topics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 12px;
            width: 100%;
            max-width: 800px;
        }

        .topic-btn {
            padding: 12px 16px;
            border: 1px solid var(--border);
            background: rgba(139, 92, 246, 0.08);
            color: var(--ink);
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            font-family: var(--sans);
            font-weight: 600;
            font-size: 13px;
            text-align: center;
            line-height: 1.4;
        }

        .topic-btn:hover {
            background: rgba(139, 92, 246, 0.12);
            border-color: var(--accent);
        }

        .modal {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.7);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 200;
            padding: 16px;
        }

        .modal.show { display: flex; }

        .modal-content {
            background: var(--panel);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            max-width: 600px;
            max-height: 80vh;
            overflow-y: auto;
            padding: 24px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid var(--border);
        }

        .modal-title { font-size: 20px; font-weight: 700; margin: 0; }

        .modal-close {
            background: none;
            border: none;
            color: var(--muted);
            cursor: pointer;
            font-size: 24px;
            padding: 0;
            width: 32px;
            height: 32px;
        }


#mode-theory-view { 
  min-height: 300px;  
}

.theory-content {
  width: 100%;
  max-width: 900px;  
  max-height: 900px;  
  overflow-y: auto;
}


        .theory-content {
            font-size: 14px;
            line-height: 1.6;
        }

        .theory-content h3 { margin-top: 16px; margin-bottom: 8px; font-size: 15px; }
        .theory-content p { margin: 8px 0; }

        .hint-box {
            background: rgba(93, 162, 255, 0.08);
            border-left: 3px solid var(--accent);
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 13px;
        }

        .hint-box p { margin: 4px 0; }

        .stat { text-align: center; }
        .stat .num { font-size: 28px; font-weight: 700; color: var(--accent); }
        .stat .cap { color: var(--muted); margin-top: -4px; font-size: 12px; }

        .stats {
            display: flex;
            gap: 20px;
            justify-content: center;
            margin: 12px 0;
            flex-wrap: wrap;
        }

        .warning-box {
            background: rgba(245, 158, 11, 0.08);
            border: 1px solid rgba(245, 158, 11, 0.3);
            padding: 16px;
            border-radius: 12px;
            margin: 16px 0;
            font-size: 14px;
            line-height: 1.6;
        }

        .warning-box h3 { margin-top: 0; margin-bottom: 8px; color: var(--warn); }
        .warning-box ul { margin: 8px 0; padding-left: 20px; }
        .warning-box li { margin: 4px 0; }

        .input-field {
            padding: 12px 16px;
            border: 1px solid var(--border);
            background: rgba(255, 255, 255, 0.02);
            color: var(--ink);
            border-radius: 12px;
            font-family: var(--sans);
            font-size: 15px;
            width: 100%;
            max-width: 300px;
            transition: all 0.2s ease;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--accent);
            background: rgba(93, 162, 255, 0.05);
        }

        footer {
            text-align: center;
            color: var(--muted);
            padding: 20px;
            border-top: 1px solid var(--border);
            position: relative;
            z-index: 102;
            background: linear-gradient(180deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.4));
        }

        footer p { margin: 4px 0; font-size: 13px; }
        
        
        
  @media (max-height: 800px) {
    .task-content {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .fixed-viewport {
        max-height: 70vh;
    }
    
    .task-content {
        padding: 16px;
        gap: 12px;
    }
    
    .viewport-header,
    .viewport-footer {
        flex-shrink: 0;
        padding: 8px 12px;
    }
}      


/* Стили для картинок в вариантах ответов */
.option img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 6px;
}

.option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 60px;
}

/* На маленьких экранах */
@media (max-width: 480px) {
    .option img {
        max-height: 150px;
    }
    
    .option {
        min-height: 50px;
    }
}
