html {
    overflow-y: scroll; /* Force scrollbar to always show */
    margin-right: calc(-1 * (100vw - 100%)); /* Prevent content shift */
    width: 100vw;
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
    background-color: #f5f5f5;
    padding-right: calc(100vw - 100%); /* Compensate for scrollbar width */
    box-sizing: border-box;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

/* Optional: Style for specific containers */
.container {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-section {
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
}

.user-header {
    background: #666;
    color: white;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

    .user-header:hover {
        background: #5c646d;
    }

    .user-header h2 {
        margin: 0;
        font-size: 1.1em;
    }

.user-content {
    display: none;
    background: white;
    padding: 20px;
}

    .user-content.active {
        display: block;
    }

.attempt-section {
    margin-left: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 15px;
}

.interaction {
    padding: 10px;
    margin: 5px 0;
    border-left: 3px solid #007bff;
}

.correct {
    border-left-color: #28a745;
}

.wrong {
    border-left-color: #dc3545;
}

.non {
    border-left-color: #6c757d;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

select, input {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    width: 100%;
}

.stats {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.leaderboard-table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    min-width: auto; /* Убираем минимальную ширину, если она была */
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.leaderboard-table th {
    background: #f5f5f5;
    font-weight: bold;
}

.leaderboard-table tr:hover {
    background: #f8f9fa;
}

.leaderboard-table tbody tr {
    cursor: pointer;
}

.leaderboard-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.total-users {
    font-size: 1.2em;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2em;
    color: #666;
}

.error {
    background: #fee;
    color: #c00;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.chevron {
    border: solid white;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 4px;
    transform: rotate(45deg);
    transition: transform 0.3s;
}

.user-header.active .chevron {
    transform: rotate(-135deg);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    height: 40px;
    width: auto;
}

h1 {
    margin: 0;  /* Reset margin to align with logo */
}

.response-parts {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    margin-bottom: 20px;
}

.response-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 10px;
}

.response-text {
    text-align: center;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #666;
}

.response-image {
    max-height: 100px;
    max-width: 100%;
    width: auto;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    object-fit: contain;
}

.timestamp {
    font-size: 0.75em;
    color: #888;
    margin-top: 10px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.top-select {
    width: auto;
    padding: 4px 8px;
    font-size: 0.9em;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-button {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #666;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.export-button:hover {
    background: #555;
}

.export-button i {
    font-size: 1.2em;
}

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: calc((100% - 1200px) / 2 - 50px);
    width: 45px;
    height: 45px;
    background: #666;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    display: flex; /* Изменено с none на flex */
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, opacity 0.3s;
    opacity: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    pointer-events: none; /* Добавлено */
}

.scroll-to-top.visible {
    opacity: 1;
    pointer-events: auto; /* Добавлено */
}

.scroll-to-top:hover {
    background: #555;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: none;
}

.clear-search:hover {
    color: #333;
}

.clear-search.visible {
    display: block;
}

.user-filter-combo {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
}

.user-filter-combo input,
.user-filter-combo select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.user-filter-combo input {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.user-filter-combo select {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #f8f9fa;
    cursor: pointer;
}

.user-filter-combo select:hover {
    background-color: #e9ecef;
}

.clear-search {
    position: absolute;
    right: calc(50% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: none;
    z-index: 2;
}

/* ...existing code... */

.custom-select {
    position: relative;
    width: 100%;
}

.select-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch; /* Изменено с center на stretch */
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    min-height: 38px; /* Фиксированная высота для единообразия */
    padding-right: 32px; /* Добавляем отступ справа для стрелки */
}

.select-input-wrapper input {
    border: none;
    flex: 1;
    padding: 8px 76px 8px 12px; /* Увеличиваем правый отступ для обеих кнопок */
    outline: none; /* Убираем outline при фокусе */
    background: transparent;
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
}

.select-input-wrapper input:focus {
    box-shadow: none; /* Убираем тень при фокусе */
}

.result-select {
    cursor: pointer;
}

.select-value {
    padding: 8px 12px; /* Унифицируем отступы */
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.toggle-dropdown {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0; /* Добавляем, чтобы кнопка растянулась на всю высоту */
    width: 32px;
    border: none;
    background: #f8f9fa;
    border-left: 1px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

.toggle-dropdown i {
    font-size: 0.8em;
    transition: transform 0.2s;
}

.select-dropdown.active + .toggle-dropdown i,
.active .toggle-dropdown i {
    transform: rotate(180deg);
}

.clear-search {
    position: absolute;
    right: 40px; /* Позиционируем относительно кнопки дропдауна */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: none;
    z-index: 2;
    height: 24px; /* Фиксируем высоту */
    width: 24px; /* Фиксируем ширину */
}

.clear-search.visible {
    display: block;
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.select-dropdown.active {
    display: block;
}

.select-dropdown .option {
    padding: 8px 12px;
    cursor: pointer;
}

.select-dropdown .option:hover {
    background: #f8f9fa;
}

.select-dropdown .option.selected {
    background: #e9ecef;
}

.select-dropdown .option.hidden {
    display: none;
}

/* ...existing code... */

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.language-selector {
    position: relative;
}

.language-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    min-width: 140px;
}

.language-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.flag-icon {
    font-style: normal;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
    min-width: 160px;
}

.language-dropdown.active {
    display: block;
}

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.language-option:hover {
    background: #f8f9fa;
}

.language-option.selected {
    background: #e9ecef;
}

/* ...existing code... */

.fi {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
}

/* ...existing code... */

/* Обновляем стили для адаптивности */
@media (max-width: 1260px) {
    .scroll-to-top {
        right: 30px;
    }
}

@media (max-width: 768px) {
    .filters {
        grid-template-columns: 1fr;
    }
    
    .user-filter-combo {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .user-filter-combo input,
    .user-filter-combo select {
        border: 1px solid #ddd;
        border-radius: 4px;
    }


    /* Контейнер */
    .container {
        padding: 0 10px;
        margin: 10px;
        width: auto;
        min-width: 0;
    }

    /* Карточки */
    .card {
        padding: 15px;
        width: auto;
        overflow: hidden;
    }

    /* Таблица лидерборда */
    .stats {
        padding: 15px;
        overflow: hidden; /* Убираем скролл у контейнера */
    }

    .leaderboard-table {
        font-size: 14px;
        width: 100%;
        display: block; /* Включаем блочное отображение */
        overflow-x: auto; /* Добавляем горизонтальный скролл */
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    }

    .leaderboard-table thead,
    .leaderboard-table tbody {
        width: min-content; /* Чтобы контент определял ширину */
        min-width: 100%; /* Но не меньше ширины контейнера */
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* Фиксированные минимальные ширины для колонок */
    .leaderboard-table th:first-child,
    .leaderboard-table td:first-child {
        min-width: 60px;  /* Rank */
    }

    .leaderboard-table th:nth-child(2),
    .leaderboard-table td:nth-child(2) {
        min-width: 120px; /* User */
    }

    .leaderboard-table th:nth-child(3),
    .leaderboard-table td:nth-child(3) {
        min-width: 200px; /* Email */
    }

    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        min-width: 100px;  /* Score */
    }

    .leaderboard-table th:last-child,
    .leaderboard-table td:last-child {
        min-width: 160px;  /* Date */
    }

    /* Адаптивные ответы с картинками */
    .response-parts {
        flex-direction: column;
        gap: 10px;
        overflow-x: visible;
    }

    .response-part {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        gap: 15px;
        align-items: flex-start;
    }

    .response-text {
        flex: 1;
        text-align: left;
        margin-bottom: 0;
    }

    .response-image {
        width: 100px;
        height: 100px;
        object-fit: cover;
    }
}

/* ...existing code... */