/* ===== ОБЩИЕ СТИЛИ ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ===== КОНТЕЙНЕРЫ ===== */
.admin-container, 
.viewer-container, 
.all-results-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.viewer-container {
    max-width: 100%;
}

/* ===== ЗАГОЛОВКИ ===== */
h1 {
    color: #333;
    margin-bottom: 20px;
    text-align: center;
    font-size: 2.5em;
}

h1 i {
    color: #667eea;
    margin-right: 10px;
}

.viewer-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.viewer-header h1 {
    color: #333;
    font-size: 3vw;
    margin-bottom: 5px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.header-top h1 {
    margin: 0;
    font-size: 2.5vw;
}

/* ===== ПАНЕЛЬ УПРАВЛЕНИЯ ===== */
.control-panel {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.control-panel button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.control-panel button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* ===== КНОПКИ ===== */
.btn-primary {
    background: #667eea;
    color: white;
}

.btn-success {
    background: #4CAF50;
    color: white;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-info {
    background: #2196F3;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-sm:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Навигационные кнопки */
.viewer-all-results-btn,
.all-results-viewer-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 40px;
    padding: 12px 30px;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.all-results-viewer-btn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

.viewer-all-results-btn:hover,
.all-results-viewer-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.all-results-viewer-btn:hover {
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.6);
}

.btn-reset-maxi {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(255, 152, 0, 0.3);
    white-space: nowrap;
    height: 48px;
}

.btn-reset-maxi:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 152, 0, 0.4);
}

/* ===== СЕЛЕКТОРЫ ===== */
.selector-group {
    display: flex;
    gap: 10px;
    background: white;
    padding: 5px 10px;
    border-radius: 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.selector-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selector-item label {
    color: #667eea;
    font-weight: 600;
    font-size: 0.9em;
}

.selector-item select {
    padding: 6px 12px;
    border: 2px solid #667eea;
    border-radius: 25px;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
    background: white;
    cursor: pointer;
    outline: none;
}

.selector-item select:hover {
    border-color: #764ba2;
}

/* Фильтры */
.filters-panel {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filters-panel.enhanced {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: 1px solid #667eea20;
}

.filters-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.filter-group.maxi {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 0.9em;
    color: #666;
    font-weight: 600;
}

.filter-group.maxi label {
    font-size: 1.1em;
    margin-bottom: 8px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group.maxi label i {
    color: #667eea;
    font-size: 1.2em;
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: white;
}

.filter-group.maxi select {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.1em;
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
}

.filter-group select:focus,
.filter-group.maxi select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.filter-group.maxi select:hover {
    border-color: #764ba2;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.2);
}

/* ===== ТЕКУЩАЯ ИНФОРМАЦИЯ (ДЛЯ ТАБЛО) ===== */
.current-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 5px;
}

.current-course {
    font-size: 2vw;
    color: #ff9800;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(255, 152, 0, 0.1);
    padding: 5px 20px;
    border-radius: 30px;
    border: 2px solid #ff9800;
}

.current-category {
    font-size: 2vw;
    color: #667eea;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(102, 126, 234, 0.1);
    padding: 5px 20px;
    border-radius: 30px;
    border: 2px solid #667eea;
}

.last-update {
    font-size: 1.2vw;
    color: #666;
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255,255,255,0.8);
    padding: 5px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ===== СТАТУС ПОДКЛЮЧЕНИЯ ===== */
.connection-status {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 10px #4CAF50;
}

.status-indicator.disconnected {
    background: #f44336;
    box-shadow: 0 0 10px #f44336;
}

.connection-status-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 5px;
}

.connection-status-badge.connected {
    background: #4CAF50;
    box-shadow: 0 0 10px #4CAF50;
}

.connection-status-badge.disconnected {
    background: #f44336;
    box-shadow: 0 0 10px #f44336;
}

/* ===== ФИКСИРОВАННАЯ СУММА ДЛЯ ГЕМБЛЕРЗ ===== */
.fixed-score-container {
    background: #fff3e0;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 10px 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.fixed-score-container label {
    color: #e65100;
    font-weight: 600;
    font-size: 0.95em;
}

.fixed-score-input {
    width: 80px;
    padding: 6px;
    border: 2px solid #ff9800;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* ===== ТАБЛИЦЫ ===== */
.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.contestants-table, 
.results-table, 
.all-results-table {
    width: 100%;
    border-collapse: collapse;
    background: #f8f9fa;
    font-size: 13px;
    min-width: 1200px;
}

.results-table {
    font-size: 1.8vw;
    min-width: auto;
}

.all-results-table {
    min-width: 1200px;
    font-size: 0.95em;
}

.contestants-table th, 
.results-table th,
.all-results-table th {
    background: #667eea;
    color: white;
    padding: 10px 5px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: nowrap;
}

.results-table th {
    background: #f8f9fa;
    color: #333;
    border-bottom: 2px solid #667eea;
    font-size: 1.6vw;
}

.all-results-table th {
    padding: 12px 8px;
}

.contestants-table td, 
.results-table td,
.all-results-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
    vertical-align: middle;
    text-align: center;
}

.results-table td {
    font-size: 1.8vw;
}

.all-results-table td {
    padding: 10px 8px;
}

.contestants-table td:nth-child(2),
.contestants-table td:nth-child(3) {
    text-align: left;
}

.results-table td:nth-child(2),
.results-table td:nth-child(3) {
    font-size: 1.8vw;
    font-weight: 500;
    text-align: center;
}

.all-results-table td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
}

.contestants-table tr:hover,
.results-table tbody tr:hover,
.all-results-table tbody tr:hover {
    background: #f1f3f5;
}

/* ===== СЕКЦИИ ТАБЛИЦ ===== */
.table-section {
    margin-bottom: 30px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.section-title {
    padding: 12px 20px;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 2.2vw;
    text-align: center;
}

.section-title i {
    margin-right: 8px;
}

/* ===== МЕСТА И МЕДАЛИ ===== */
.results-table tbody tr.first-place {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3d4 100%);
    border-left: 4px solid gold;
}

.results-table tbody tr.second-place {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid silver;
}

.results-table tbody tr.third-place {
    background: linear-gradient(135deg, #fff4e6 0%, #ffe4cc 100%);
    border-left: 4px solid #cd7f32;
}

.medal {
    display: inline-block;
    width: 3vw;
    height: 3vw;
    border-radius: 50%;
    font-weight: bold;
    line-height: 3vw;
    text-align: center;
    margin-right: 5px;
    font-size: 2.2vw;
}

.medal.gold {
    color: gold;
    text-shadow: 0 0 10px gold;
}

.medal.silver {
    color: silver;
    text-shadow: 0 0 10px silver;
}

.medal.bronze {
    color: #cd7f32;
    text-shadow: 0 0 10px #cd7f32;
}

.place-column {
    width: 70px;
    text-align: center;
    font-weight: 600;
}

.place-medal {
    display: inline-block;
    font-size: 1.4em;
    line-height: 1;
}

.place-medal.gold {
    filter: drop-shadow(0 2px 5px rgba(255, 215, 0, 0.5));
}

.place-medal.silver {
    filter: drop-shadow(0 2px 5px rgba(192, 192, 192, 0.5));
}

.place-medal.bronze {
    filter: drop-shadow(0 2px 5px rgba(205, 127, 50, 0.5));
}

/* ===== ПЕРИОДЫ И ПОСЛЕДОВАТЕЛЬНОСТИ ===== */
.period-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
}

.numbers-row {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 0 auto;
}

.number-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #333;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0;
    flex-shrink: 0;
}

.number-btn.open-btn {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.number-btn.open-btn:hover {
    background: #4CAF50;
    color: white;
}

.number-btn.close-btn {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.number-btn.close-btn:hover {
    background: #f44336;
    color: white;
}

.number-btn.zero-btn {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ff9800;
}

.number-btn.zero-btn:hover {
    background: #ff9800;
    color: white;
}

.selected-numbers {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-height: 28px;
    padding: 3px;
    background: white;
    border-radius: 15px;
    border: 1px solid #e0e0e0;
    margin: 0 auto;
    width: fit-content;
}

.selected-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    animation: popIn 0.2s ease-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.selected-number.open-number {
    background: #4CAF50;
    color: white;
}

.selected-number.close-number {
    background: #f44336;
    color: white;
}

.selected-number.zero-selected {
    background: #ff9800;
    color: white;
}

.sequence-mini {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 300px;
    margin: 0 auto;
    padding: 2px;
}

.sequence-mini-number {
    width: 2.2vw;
    height: 2.2vw;
    min-width: 24px;
    min-height: 24px;
    max-width: 32px;
    max-height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3vw;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.sequence-mini-number.open {
    background: #4CAF50;
    color: white;
}

.sequence-mini-number.close {
    background: #f44336;
    color: white;
}

.sequence-mini-number.zero {
    background: #ff9800;
    color: white;
}

.sequence-controls {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-top: 3px;
}

.clear-btn {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 9px;
    cursor: pointer;
    text-transform: uppercase;
}

.clear-btn.open-clear {
    background: #4CAF50;
}

.clear-btn.close-clear {
    background: #f44336;
}

/* Мини-последовательности */
.mini-sequence {
    display: flex;
    gap: 3px;
    justify-content: center;
    align-items: center;
    max-width: 300px;
    margin: 0 auto;
}

.mini-sequence.wrap-sequence {
    flex-wrap: wrap;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 12px;
}

.mini-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.mini-number.open {
    background: #4CAF50;
    color: white;
}

.mini-number.close {
    background: #f44336;
    color: white;
}

.mini-number.zero {
    background: #ff9800;
    color: white;
}

.sequence-cell {
    max-width: 350px;
    min-width: 150px;
}

.sequence-stats {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 5px;
    font-size: 0.85em;
    flex-wrap: wrap;
}

.sequence-stats .stat-item {
    background: #e8eaf6;
    padding: 2px 8px;
    border-radius: 12px;
    color: #667eea;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== ВРЕМЯ ===== */
.time-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

.time-input {
    width: 80px;
    padding: 4px 8px;
    border: 2px solid #ff9800;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.time-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.time-badge {
    background: #e8eaf6;
    color: #667eea;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.6vw;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
    min-width: 80px;
}

/* ===== СУММЫ И БЕЙДЖИ ===== */
.sum-badge {
    font-weight: bold;
    font-size: 1.1em;
    padding: 3px 6px;
    border-radius: 12px;
    display: inline-block;
    min-width: 35px;
    text-align: center;
}

.results-table .sum-badge {
    font-size: 2.2vw;
    padding: 6px 14px;
    border-radius: 25px;
    min-width: 60px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.open-sum {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #4CAF50;
}

.results-table .open-sum,
.all-results-table .open-sum {
    border: 2px solid #4CAF50;
}

.close-sum {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.results-table .close-sum,
.all-results-table .close-sum {
    border: 2px solid #f44336;
}

.total-score {
    font-weight: bold;
    font-size: 1.2em;
    color: #667eea;
    background: #e8eaf6;
    border: 1px solid #667eea;
    padding: 3px 8px;
    border-radius: 15px;
    display: inline-block;
    min-width: 45px;
    text-align: center;
}

.total-badge {
    font-weight: bold;
    font-size: 2.5vw;
    color: #667eea;
    background: #e8eaf6;
    border-radius: 30px;
    padding: 7px 20px;
    display: inline-block;
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
    min-width: 85px;
    text-align: center;
    border: 2px solid #667eea;
}

.sum-badge[title],
.total-badge[title] {
    cursor: help;
    position: relative;
}

/* ===== ГЕМБЛЕРЗ ===== */
.gamblerz-checkbox-cell {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gamblerz-checkbox-input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #4CAF50;
    transform: scale(1.2);
}

.gamblerz-status {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.gamblerz-status span {
    font-size: 12px;
    color: #666;
}

.gamblerz-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 1.4vw;
    font-weight: 600;
}

.gamblerz-completed {
    background: #4CAF50;
    color: white;
}

.gamblerz-not-completed {
    background: #f44336;
    color: white;
}

/* ===== ТАБЛИЦА ОЖИДАЮЩИХ ===== */
.unscored-table tbody tr {
    background: #fff9e6;
}

.unscored-table tbody tr:hover {
    background: #fff3d4;
}

.status-badge {
    display: inline-block;
    padding: 4px 15px;
    border-radius: 20px;
    font-size: 1.4vw;
    font-weight: 600;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 5px rgba(255, 152, 0, 0.3);
}

/* ===== ПАНЕЛЬ СТАТИСТИКИ ===== */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.viewer-container .stats-panel {
    grid-template-columns: repeat(6, 1fr);
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.viewer-container .stat-card {
    padding: 8px 5px;
}

.stat-card h3 {
    font-size: 0.8em;
    margin-bottom: 3px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.viewer-container .stat-card h3 {
    font-size: 1vw;
}

.stat-card .stat-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    line-height: 1.2;
    font-size: 1.2em;
    font-weight: bold;
}

.viewer-container .stat-card .stat-value {
    font-size: 1.5vw;
}

.stat-card .stat-number {
    font-size: 2em;
    font-weight: bold;
}

.stat-card .stat-word {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Сводная статистика */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.summary-card i {
    font-size: 2em;
    opacity: 0.9;
    min-width: 40px;
    text-align: center;
}

.summary-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.summary-label {
    font-size: 0.85em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}

.summary-value .stat-number {
    font-size: 1.8em;
    font-weight: bold;
    line-height: 1;
}

.summary-value .stat-word {
    font-size: 0.9em;
    opacity: 0.9;
}

/* ===== УПРАВЛЕНИЕ СПОРТСМЕНАМИ ===== */
.athlete-management {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    flex-wrap: wrap;
    gap: 10px;
}

.management-header h3 {
    color: #333;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.management-header h3 i {
    color: #667eea;
}

.management-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.count-badge {
    background: #667eea;
    color: white;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    margin-left: 8px;
}

.add-athlete-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 0.9em;
    color: #666;
    font-weight: 600;
}

.form-group input {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-add {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    height: 38px;
    align-self: flex-end;
}

.btn-add:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.athletes-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px;
    background: #e8eaf6;
    border-radius: 8px;
    color: #667eea;
    font-weight: 600;
    flex-wrap: wrap;
    gap: 10px;
}

.warning-message {
    background: #fff3e0;
    border: 1px solid #ff9800;
    color: #e65100;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    flex-wrap: wrap;
}

/* ===== БЛОКИ КАТЕГОРИЙ ===== */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.category-block {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    flex-wrap: wrap;
    gap: 10px;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
    flex-wrap: wrap;
}

.course-badge {
    padding: 5px 15px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95em;
    color: white;
}

.course-badge.snooker {
    background: #4CAF50;
}

.course-badge.gamblerz {
    background: #ff9800;
}

.category-badge {
    padding: 5px 15px;
    background: #667eea;
    color: white;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95em;
}

.athletes-count {
    color: #666;
    font-size: 0.9em;
    padding: 3px 10px;
    background: #e0e0e0;
    border-radius: 15px;
}

.category-update {
    color: #666;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Топ-3 */
.top-three {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3d4 100%);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid gold;
}

.top-three-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #b8860b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.top-three-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top-three-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    font-size: 0.95em;
    flex-wrap: wrap;
}

.top-three-medal {
    font-size: 1.4em;
    min-width: 30px;
}

.top-three-name {
    font-weight: 600;
    color: #333;
}

.top-three-dog {
    color: #666;
    font-style: italic;
}

.top-three-score {
    margin-left: auto;
    font-weight: 600;
    color: #667eea;
    background: #e8eaf6;
    padding: 3px 10px;
    border-radius: 15px;
}

.top-three-time {
    color: #ff9800;
    font-weight: 600;
    min-width: 60px;
    text-align: right;
}

/* ===== АНИМАЦИИ ===== */
@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-block {
    animation: slideIn 0.3s ease-out;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 20px;
    border-radius: 10px;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f44336;
    flex-wrap: wrap;
    gap: 10px;
}

.modal-header h3 {
    color: #f44336;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    cursor: pointer;
    font-size: 20px;
    color: #666;
}

.modal-close:hover {
    color: #f44336;
}

.modal-body {
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.modal-btn.cancel {
    background: #e0e0e0;
    color: #666;
}

.modal-btn.cancel:hover {
    background: #bdbdbd;
}

.modal-btn.confirm {
    background: #f44336;
    color: white;
}

.modal-btn.confirm:hover {
    background: #d32f2f;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== АДМИН-ПАНЕЛЬ И АВТОРИЗАЦИЯ ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-header h1 {
    margin: 0;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #e8eaf6;
    padding: 8px 15px;
    border-radius: 30px;
    color: #667eea;
    font-weight: 600;
    flex-wrap: wrap;
}

.btn-logout {
    background: none;
    border: none;
    color: #f44336;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #ffebee;
    transform: scale(1.1);
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ - ЕДИНЫЙ СТИЛЬ ===== */
@media (max-width: 1024px) {
    .header-top {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-top h1 {
        font-size: 4vw;
    }
    
    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group.maxi {
        width: 100%;
    }
    
    .btn-reset-maxi {
        width: 100%;
        justify-content: center;
    }
    
    .summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .all-results-table {
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    /* Общие контейнеры */
    .admin-container,
    .viewer-container,
    .all-results-container {
        padding: 15px;
        border-radius: 15px;
    }

    /* Заголовки */
    h1 {
        font-size: 5vw;
    }

    .viewer-header h1,
    .all-results-header h1 {
        font-size: 5vw;
        white-space: normal;
        word-break: break-word;
    }

    .header-top {
        flex-direction: column;
        gap: 10px;
    }

    .header-top h1 {
        font-size: 5vw;
    }

    /* Навигационные кнопки */
    .viewer-all-results-btn,
    .all-results-viewer-btn {
        width: 100%;
        justify-content: center;
        padding: 10px;
        font-size: 4vw;
        margin: 5px 0;
        white-space: normal;
        text-align: center;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    /* Текущая информация */
    .current-info {
        flex-direction: column;
        gap: 8px;
        margin: 10px 0;
    }

    .current-course,
    .current-category {
        font-size: 4.5vw;
        width: 100%;
        text-align: center;
        padding: 8px;
        box-sizing: border-box;
    }

    .last-update {
        position: static;
        margin: 10px 0;
        width: 100%;
        text-align: center;
        justify-content: center;
        font-size: 4vw;
        box-sizing: border-box;
    }

    /* Панель управления */
    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .control-panel button {
        width: 100%;
    }

    .selector-group {
        flex-direction: column;
        width: 100%;
        border-radius: 15px;
        padding: 10px;
    }

    .selector-item {
        width: 100%;
    }

    .selector-item select {
        width: 100%;
    }

    /* Фиксированная сумма */
    .fixed-score-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .fixed-score-input {
        width: 100%;
    }

    /* Фильтры */
    .filters-panel.enhanced {
        padding: 15px;
    }

    .filters-row {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group.maxi {
        width: 100%;
    }

    .filter-group.maxi select {
        font-size: 4vw;
        padding: 10px;
    }

    /* Управление спортсменами */
    .management-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .management-actions {
        width: 100%;
    }

    .management-actions .btn-sm {
        flex: 1;
        justify-content: center;
    }

    .add-athlete-form {
        grid-template-columns: 1fr;
    }

    .btn-add {
        width: 100%;
        justify-content: center;
    }

    .athletes-count {
        flex-direction: column;
        text-align: center;
    }

    /* Таблицы - горизонтальная прокрутка как в админке */
    .table-responsive,
    .results-table-container,
    .category-block {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 10px 0;
        border-radius: 10px;
    }

    .contestants-table,
    .results-table,
    .all-results-table {
        min-width: 800px;
        font-size: 3.8vw;
    }

    .contestants-table th,
    .results-table th,
    .all-results-table th {
        font-size: 3.5vw;
        white-space: nowrap;
    }

    .contestants-table td,
    .results-table td,
    .all-results-table td {
        font-size: 3.8vw;
        white-space: nowrap;
    }

    /* Имена в таблицах */
    .contestants-table td:nth-child(2),
    .contestants-table td:nth-child(3),
    .results-table td:nth-child(2),
    .results-table td:nth-child(3),
    .all-results-table td:nth-child(3) {
        min-width: 120px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Секции таблиц */
    .section-title {
        font-size: 4.5vw;
        padding: 10px;
    }

    /* Последовательности */
    .sequence-mini-number,
    .mini-number {
        width: 6vw;
        height: 6vw;
        min-width: 24px;
        min-height: 24px;
        font-size: 3.5vw;
    }

    .time-badge {
        font-size: 3.5vw;
        padding: 3px 8px;
        min-width: 60px;
    }

    .sum-badge {
        font-size: 4vw;
        padding: 3px 6px;
        min-width: 40px;
    }

    .total-badge {
        font-size: 4.5vw;
        padding: 4px 10px;
        min-width: 50px;
    }

    /* Статистика */
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .viewer-container .stats-panel {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-card {
        padding: 8px;
    }

    .stat-card h3 {
        font-size: 3.5vw;
    }

    .stat-card .stat-number {
        font-size: 4.5vw;
    }

    .stat-card .stat-word {
        font-size: 3vw;
    }

    /* Сводная статистика */
    .summary-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .summary-card {
        padding: 12px;
    }

    .summary-card i {
        font-size: 5vw;
    }

    .summary-value .stat-number {
        font-size: 4.5vw;
    }

    .summary-value .stat-word {
        font-size: 3.5vw;
    }

    /* Блоки категорий */
    .category-block {
        padding: 15px;
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-info {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .category-title {
        width: 100%;
        justify-content: space-between;
    }

    .course-badge,
    .category-badge {
        font-size: 4vw;
        padding: 4px 12px;
    }

    .athletes-count,
    .category-update {
        font-size: 3.8vw;
    }

    /* Топ-3 */
    .top-three-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-three-medal {
        font-size: 5vw;
    }

    .top-three-name {
        font-size: 4vw;
    }

    .top-three-dog {
        font-size: 3.8vw;
    }

    .top-three-score {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    .top-three-time {
        text-align: center;
        width: 100%;
    }

    /* Модальные окна */
    .modal-content {
        margin: 20% 15px;
        width: auto;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }

    /* Индикаторы прокрутки */
    .table-responsive::-webkit-scrollbar,
    .results-table-container::-webkit-scrollbar,
    .category-block::-webkit-scrollbar {
        height: 4px;
    }

    .table-responsive::-webkit-scrollbar-track,
    .results-table-container::-webkit-scrollbar-track,
    .category-block::-webkit-scrollbar-track {
        background: #f0f0f0;
        border-radius: 4px;
    }

    .table-responsive::-webkit-scrollbar-thumb,
    .results-table-container::-webkit-scrollbar-thumb,
    .category-block::-webkit-scrollbar-thumb {
        background: #667eea;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    /* Еще более мелкие экраны */
    h1 {
        font-size: 6vw;
    }

    .viewer-header h1,
    .all-results-header h1 {
        font-size: 6vw;
    }

    .current-course,
    .current-category {
        font-size: 5vw;
    }

    .contestants-table,
    .results-table,
    .all-results-table {
        min-width: 700px;
        font-size: 4vw;
    }

    .stats-panel {
        grid-template-columns: 1fr;
    }

    .viewer-container .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }

    .sequence-mini-number,
    .mini-number {
        min-width: 22px;
        min-height: 22px;
    }

    .category-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .category-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .athletes-count,
    .category-update {
        width: 100%;
        text-align: center;
    }
}