:root {
            --bg-color: #ffffff;
            --text-color: #333333;
            --passage-bg: #f8f9fa;
            --questions-bg: #ffffff;
            --border-color: #e0e0e0;
            --highlight-color: #FFD700;
            --accent-color: #29b6f6;
            --header-bg: #ff0000;
            --header-text: #ffffff;
            --button-bg: #29b6f6;
            --button-hover: #0288d1;
            --correct-color: #28a745;
            --incorrect-color: #dc3545;
            --progress-complete: #29b6f6;
            --progress-incomplete: #bdbdbd;
            --timer-bg: #E1F5FE;
            --timer-text: #0288d1;
            --footer-bg: #f5f5f5;
        }

        .night-mode {
            --bg-color: #121212;
            --text-color: #e0e0e0;
            --passage-bg: #1e1e1e;
            --questions-bg: #1e1e1e;
            --border-color: #424242;
            --highlight-color: #C58940;
            --accent-color: #29b6f6;
            --header-bg: #ff0000;
            --header-text: #ffffff;
            --button-bg: #29b6f6;
            --button-hover: #0288d1;
            --correct-color: #218838;
            --incorrect-color: #c82333;
            --progress-complete: #29b6f6;
            --progress-incomplete: #616161;
            --timer-bg: #01579b;
            --timer-text: #B3E5FC;
            --footer-bg: #121212;
        }

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

        html, body {
            width: 100%;
            height: 100vh;
            overflow: hidden;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            font-size: 15px;
        }

        header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            background-color: var(--header-bg);
            color: var(--header-text);
            padding: 12px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            z-index: 100;
            height: 60px;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .telegram-link {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #ffffff;
            text-decoration: none;
            font-weight: bold;
            padding: 6px 12px;
            border-radius: 20px;
            transition: background-color 0.3s;
        }

        .telegram-link:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        .timer-container {
            display: flex;
            align-items: center;
            gap: 12px;
            background-color: var(--timer-bg);
            padding: 8px 15px;
            border-radius: 25px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .timer-display {
            font-weight: bold;
            font-size: 16px;
            color: var(--timer-text);
            min-width: 60px;
            text-align: center;
        }

        .timer-button {
            background: none;
            border: none;
            color: #333333;
            cursor: pointer;
            font-size: 14px;
            padding: 4px 8px;
            border-radius: 4px;
            transition: background-color 0.3s;
        }

        .timer-button:hover {
            background-color: rgba(0, 0, 0, 0.1);
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .font-size-control {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .font-size-button {
            background: none;
            border: 2px solid #ffffff;
            color: #ffffff;
            padding: 4px 10px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            transition: all 0.3s;
        }

        .font-size-button:hover {
            background-color: #ffffff;
            color: #ff0000;
        }

        .night-mode-toggle {
            background: none;
            border: 2px solid #ffffff;
            color: #ffffff;
            padding: 8px 12px;
            border-radius: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 14px;
            transition: all 0.3s;
        }

        .night-mode-toggle:hover {
            background-color: #ffffff;
            color: #ff0000;
        }

        .container {
            position: fixed;
            top: 60px;
            bottom: 50px;
            left: 0;
            right: 0;
            display: flex;
            width: 100%;
        }

        .passage-section {
            width: 50%;
            background-color: var(--passage-bg);
            border-right: 1px solid var(--border-color);
            overflow-y: auto;
            overflow-x: hidden;
            padding: 30px;
            height: 100%;
        }

        .questions-section {
            width: 50%;
            background-color: var(--questions-bg);
            overflow-y: auto;
            overflow-x: hidden;
            padding: 30px;
            height: 100%;
        }

        .passage-section h1, .passage-section h2, .questions-section h2 {
            text-align: center;
            margin-bottom: 20px;
            color: var(--text-color);
        }

        /* Passage subheading styling */
        .passage-subheading {
            text-align: center;
            font-style: italic;
            font-size: 18px;
            font-weight: 400;
            margin-top: -10px;
            margin-bottom: 20px;
            color: var(--text-color);
            opacity: 0.9;
        }

        /* Passage instructions styling */
        .passage-instructions {
            text-align: center;
            margin-bottom: 25px;
            padding: 20px;
            background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(41, 182, 246, 0.2);
        }

        .passage-number {
            font-size: 18px;
            font-weight: 700;
            letter-spacing: 1px;
            color: #ffffff;
            margin-bottom: 10px;
            text-transform: uppercase;
        }

        .passage-time-info {
            font-size: 14px;
            font-style: italic;
            color: #ffffff;
            opacity: 0.95;
            line-height: 1.6;
        }

        #passageContent {
            line-height: 1.8;
        }

        #passageContent p {
            line-height: 1.8;
            margin-bottom: 1.5em;
            margin-top: 0;
            text-align: justify;
            display: block;
        }

        #passageContent h2 {
            margin-top: 1.5em;
            margin-bottom: 1em;
            display: block;
        }

        .passage-section p::selection,
        .passage-section h1::selection,
        .passage-section h2::selection,
        .passage-section h3::selection {
            background-color: var(--highlight-color);
            color: var(--text-color);
        }

        /* Highlight styles - robust approach using mark elements */
        mark.highlight-orange {
            background-color: #FFD700;
            color: inherit;
            padding: 0;
        }

        mark.highlight-blue {
            background-color: #ADD8E6;
            color: inherit;
            padding: 0;
        }

        mark.highlight-green {
            background-color: #90EE90;
            color: inherit;
            padding: 0;
        }

        /* Highlight toolbar */
        .highlight-toolbar {
            position: fixed;
            background: white;
            border: 2px solid #333;
            border-radius: 8px;
            padding: 10px;
            display: none;
            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            gap: 8px;
        }

        .highlight-toolbar button {
            width: 45px;
            height: 45px;
            border: 2px solid #333;
            border-radius: 6px;
            margin: 0;
            cursor: pointer;
            transition: transform 0.2s;
            font-size: 12px;
            font-weight: bold;
        }

        .highlight-toolbar button:hover {
            transform: scale(1.1);
        }

        .highlight-orange-btn {
            background-color: #FFD700;
        }

        .highlight-blue-btn {
            background-color: #ADD8E6;
        }

        .highlight-green-btn {
            background-color: #90EE90;
        }

        .highlight-remove-btn {
            background-color: #ff6b6b;
            color: white;
        }

        .night-mode .highlight-toolbar {
            background: #2e2e2e;
            border-color: #666;
        }

        .night-mode mark.highlight-orange {
            background-color: #B8860B;
        }

        .night-mode mark.highlight-blue {
            background-color: #4682B4;
        }

        .night-mode mark.highlight-green {
            background-color: #3CB371;
        }

        .question-group {
            margin-bottom: 30px;
            padding: 20px;
            background-color: var(--passage-bg);
            border-radius: 8px;
            border: 1px solid var(--border-color);
        }

        .instructions {
            background: linear-gradient(135deg, #e1f5fe 0%, #b3e5fc 100%);
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
            border-left: 4px solid #29b6f6;
            font-weight: 500;
        }

        .question {
            margin-bottom: 20px;
            padding: 15px;
            background-color: var(--bg-color);
            border-radius: 6px;
            border: 1px solid var(--border-color);
        }

        .question p {
            margin-bottom: 10px;
            line-height: 1.6;
        }

        .options {
            display: flex;
            flex-direction: column;
            gap: 4px;
            margin-top: 10px;
        }

        .options label {
            display: flex;
            align-items: center;
            padding: 6px 8px;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .options label:hover {
            background-color: var(--passage-bg);
        }

        .options input[type="radio"] {
            margin-right: 8px;
            cursor: pointer;
        }

        .options input[type="checkbox"] {
            margin-right: 8px;
            cursor: pointer;
        }

        .dual-choice-info {
            font-size: 13px;
            color: #29b6f6;
            font-weight: 600;
            font-style: italic;
            margin-top: 8px;
            margin-bottom: 8px;
        }

        .word-bank-container {
            background-color: #f5f5f5;
            border: 2px solid #29b6f6;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 24px;
        }

        .word-bank-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 12px;
            margin: 0;
        }

        .word-bank-option {
            padding: 10px 12px;
            background-color: white;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            line-height: 1.5;
        }

        .word-bank-option strong {
            color: #29b6f6;
            margin-right: 8px;
        }

        .word-bank-passage {
            line-height: 1.8;
            font-size: 15px;
        }

        .matching-headings-container {
            margin: 20px 0;
        }

        .headings-list {
            background-color: #f5f5f5;
            border: 2px solid #29b6f6;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 24px;
        }

        .heading-option {
            padding: 8px 12px;
            margin-bottom: 8px;
            background-color: white;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            line-height: 1.6;
        }

        .heading-option:last-child {
            margin-bottom: 0;
        }

        .heading-option strong {
            color: #29b6f6;
            margin-right: 12px;
            font-size: 15px;
        }

        .sections-list {
            margin-top: 20px;
        }

        .matching-heading-question {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 12px;
            padding: 12px;
            background-color: white;
            border: 1px solid #ddd;
            border-radius: 6px;
        }

        .section-label {
            flex: 1;
            font-size: 15px;
        }

        .section-label strong {
            color: #29b6f6;
            margin-right: 8px;
        }

        .matching-heading-question select {
            width: 150px;
            flex-shrink: 0;
        }

        input[type="text"], select {
            width: 100%;
            padding: 10px;
            border: 2px solid var(--border-color);
            border-radius: 6px;
            font-size: 14px;
            background-color: var(--bg-color);
            color: var(--text-color);
            transition: border-color 0.3s;
        }

        input[type="text"]:focus, select:focus {
            outline: none;
            border-color: #29b6f6;
        }

        .fill-in-the-blank {
            display: inline-block;
            min-width: 150px;
            margin: 0 5px;
            padding: 5px 10px;
        }

        /* Matching table styles */
        .matching-table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            background-color: var(--bg-color);
        }

        .matching-table th,
        .matching-table td {
            padding: 12px;
            text-align: center;
            border: 1px solid var(--border-color);
        }

        .matching-table th {
            background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
            color: white;
            font-weight: bold;
        }

        .matching-table .question-cell {
            text-align: left;
            font-weight: 500;
        }

        .matching-table td[data-answer] {
            cursor: pointer;
            transition: all 0.3s;
            width: 50px;
        }

        .matching-table td[data-answer]:hover {
            background-color: var(--passage-bg);
        }

        .matching-table td.selected {
            background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
            color: white;
            font-weight: bold;
        }

        .matching-table td.selected::after {
            content: '✓';
            font-size: 18px;
        }

        /* Word bank styles */
        .list-container {
            background-color: var(--timer-bg);
            padding: 15px;
            border-radius: 8px;
            margin: 20px 0;
        }

        .list-container h4 {
            margin-bottom: 15px;
            color: var(--text-color);
        }

        .list-container ul {
            list-style: none;
            padding: 0;
        }

        .list-container li {
            padding: 8px;
            margin-bottom: 5px;
            background-color: var(--bg-color);
            border-radius: 4px;
            border: 1px solid var(--border-color);
        }

        .three-column-list ul {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 10px;
        }

        /* Table completion styles */
        table.completion-table {
            width: 100%;
            border-collapse: collapse;
            margin: 15px 0;
        }

        table.completion-table th,
        table.completion-table td {
            padding: 10px;
            border: 1px solid var(--border-color);
            text-align: left;
        }

        table.completion-table th {
            background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
            color: white;
            font-weight: bold;
        }

        table.completion-table input {
            width: 100%;
        }

        footer {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 50px;
            background-color: var(--footer-bg);
            padding: 8px 15px;
            border-top: 1px solid var(--border-color);
            box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
            z-index: 90;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .progress-container {
            display: flex;
            align-items: center;
            gap: 2px;
            flex-wrap: nowrap;
            flex: 1;
            margin-right: 10px;
            overflow-x: auto;
        }

        .progress-indicator {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background-color: var(--progress-incomplete);
            transition: all 0.3s;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 9px;
            font-weight: bold;
            color: var(--text-color);
            border: 1px solid var(--border-color);
            cursor: pointer;
        }

        .progress-indicator:hover {
            transform: scale(1.1);
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        }

        .progress-indicator.completed {
            background-color: var(--progress-complete);
            color: white;
            border-color: var(--progress-complete);
        }

        .submit-button {
            background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
            color: white;
            border: none;
            padding: 10px 30px;
            font-size: 14px;
            font-weight: bold;
            border-radius: 25px;
            cursor: pointer;
            transition: all 0.3s;
            box-shadow: 0 2px 8px rgba(41, 182, 246, 0.3);
            flex-shrink: 0;
        }

        .submit-button:hover {
            background: linear-gradient(135deg, #29b6f6 0%, #039be5 100%);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(41, 182, 246, 0.4);
        }

        .submit-button:active {
            transform: translateY(0);
        }

        /* Responsive design */
        @media (max-width: 768px) {
            .container {
                flex-direction: column;
                bottom: 100px;
            }

            .passage-section {
                border-right: none;
                border-bottom: 1px solid var(--border-color);
            }

            header {
                flex-wrap: wrap;
                gap: 10px;
            }

            .header-left, .header-right {
                flex-wrap: wrap;
            }

            .three-column-list ul {
                grid-template-columns: 1fr;
            }

            footer {
                height: auto;
                min-height: 60px;
                padding: 8px 15px;
                flex-direction: column;
                gap: 8px;
            }

            .progress-container {
                gap: 3px;
                margin-right: 0;
                justify-content: center;
                max-width: 100%;
            }

            .progress-indicator {
                width: 18px;
                height: 18px;
                font-size: 8px;
            }

            .submit-button {
                width: 100%;
                padding: 12px 20px;
            }
        }

        @media (max-width: 480px) {
            .container {
                bottom: 120px;
            }

            footer {
                padding: 6px 10px;
            }

            .progress-container {
                gap: 2px;
            }

            .progress-indicator {
                width: 16px;
                height: 16px;
                font-size: 7px;
                border-width: 1px;
            }
        }

        /* Dropdown inline styles */
        .inline-dropdown {
            display: inline-block;
            min-width: 120px;
            margin: 0 5px;
            padding: 5px;
        }

        /* Summary paragraph styles */
        .summary-paragraph {
            line-height: 2;
            padding: 15px;
            background-color: var(--bg-color);
            border-radius: 6px;
            border: 1px solid var(--border-color);
        }

        .question-number {
            font-weight: bold;
            color: #29b6f6;
            margin: 0 3px;
        }

        /* Matching options list */
        .matching-options-list {
            background-color: var(--timer-bg);
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }

        .matching-options-list ul {
            list-style: none;
            padding: 0;
            columns: 2;
            column-gap: 20px;
        }

        .matching-options-list li {
            padding: 5px 0;
            break-inside: avoid;
        }

        /* Compact matching dropdown styles */
        .matching-dropdown-question {
            margin-bottom: 10px;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            gap: 10px;
            background-color: var(--bg-color);
            border-radius: 4px;
            border: 1px solid var(--border-color);
        }

        .matching-dropdown-question > div:first-child {
            flex: 1;
        }

        .matching-dropdown-question select {
            width: auto;
            min-width: 200px;
            padding: 6px 10px;
            font-size: 14px;
        }

        /* Reduce spacing for matching/dropdown question types */
        .question-group .question.matching-dropdown-compact {
            margin-bottom: 10px;
            padding: 8px 12px;
        }