html.menu-visible .menu-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) scaleY(1);
}


body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 700;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}


* {
    box-sizing: border-box;
}


.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 10px;
    overflow-x: hidden;
    width: 100%;
}

/* ===== HEADER ===== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 15px;
    position: relative;
}

/* Logo area */
.header-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 60px;
}

.header-logo .fa-burst {
    font-size: 22px;
    color: #e20713;
}

.header-version {
    font-size: 9px;
    color: #999;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Center menu area */
.header-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
}

/* Menu toggle button */
.menu-toggle-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 28px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #818ea1 0%, #818ea1 100%);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1001;
}

.menu-toggle-btn:hover {
    background: linear-gradient(180deg, #737f91 0%, #737f91 100%);
}

.menu-toggle-btn.active {
    background: linear-gradient(180deg, #e20814 0%, #87687d 100%);
    border-radius: 10px 10px 0 0;
}

/* Inverse border radius — on the button, hanging below its corners */
.menu-toggle-btn.active::before,
.menu-toggle-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 8px;
    z-index: 1002;
    pointer-events: none;
}

.menu-toggle-btn.active::before {
    left: -8px;
    background: radial-gradient(circle at 0 0, transparent 8px, #87687d 8.5px);
}

.menu-toggle-btn.active::after {
    right: -8px;
    background: radial-gradient(circle at 100% 0, transparent 8px, #87687d 8.5px);
}

.menu-toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

/* Menu dropdown */
.menu-dropdown {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: linear-gradient(180deg, #87687d 0%, #5b83a8 100%);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
    transform-origin: top center;
    opacity: 1;
    visibility: visible;
    white-space: nowrap;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) scaleY(1);
}

.menu-dropdown.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) scaleY(0);
    padding: 0;
    pointer-events: none;
}

/* Menu items */
.menu-item {
    background: none;
    border: none;
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.menu-item:hover {
    background: linear-gradient(180deg, rgba(135, 104, 125, 0.6) 0%, rgba(255, 255, 255, 0.18) 100%);
}

.menu-item-danger:hover {
    background: linear-gradient(180deg, rgba(180, 40, 40, 0.5) 0%, rgba(226, 7, 19, 0.25) 100%);
}

.menu-item i {
    font-size: 14px;
}

/* Menu divider */
.menu-divider {
    width: 2px;
    height: 16px;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

/* Logout area */
.header-logout {
    min-width: 60px;
    display: flex;
    justify-content: flex-end;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: inherit;
}



.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #48bb78;
    color: white;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: #e20713;
    color: white;
}

.btn-danger:hover {
    background: #c00610;
}

.btn-secondary {
    background: #718096;
    color: white;
}

.btn-secondary:hover {
    background: #4a5568;
}


.status-message {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        bottom: -50px;
        opacity: 0;
    }

    to {
        bottom: 20px;
        opacity: 1;
    }
}

.status-message.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
    display: block;
}

.status-message.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
    display: block;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal.show {
    display: flex;
    /* align-items: center; */
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    height: fit-content;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 2px solid #e20713;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.close-modal {
    font-size: 32px;
    font-weight: 700;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.close-modal:hover {
    color: #e20713;
}

.modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.team-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.team-search-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    transition: border-color 0.2s ease;
}

.team-search-input:focus {
    outline: none;
    border-color: #e20713;
}

.bulk-import-container {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
}

.bulk-import-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    resize: vertical;
    margin-bottom: 10px;
    line-height: 1.6;
}

.bulk-import-textarea:focus {
    outline: none;
    border-color: #e20713;
}

.bulk-import-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.bulk-import-toggle {
    margin-bottom: 15px;
    text-align: center;
}

.bulk-import-stats {
    margin-top: 10px;
    padding: 10px;
    background-color: #e6fffa;
    border-left: 4px solid #38b2ac;
    border-radius: 4px;
    font-size: 14px;
    color: #234e52;
}

.bulk-import-stats.error {
    background-color: #fff5f5;
    border-left-color: #e53e3e;
    color: #742a2a;
}


.teams-list-container {
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    height: 75%;
}

.team-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.team-list-item:last-child {
    border-bottom: none;
}

.team-list-item:hover {
    background-color: #f7fafc;
}

.team-list-item-name {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    flex: 1;
}

.team-list-item-name input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: #2d3748;
    padding: 4px;
}

.team-list-item-name input:focus {
    outline: none;
    background-color: #f0f8ff;
    border-radius: 4px;
}

.team-list-item-actions {
    display: flex;
    gap: 8px;
}

.team-list-item-actions button {
    background: #e20713;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-list-item-actions button:hover {
    background: #c00610;
    transform: scale(1.05);
}

.empty-teams-list {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
    font-style: italic;
}

/* Скрытие на мобильных */
.desktop-only {
    display: flex;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 15px 20px;
    }

    .team-search-container {
        flex-direction: row;
    }
}


.table-container {
    overflow-x: auto;
}

/* Mobile scroll snapping — only round columns snap */
@media (max-width: 768px) {
    .table-container {
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        /* Account for the sticky team-name column so snapped cells are not hidden behind it */
        scroll-padding-left: 120px;
    }

    td.score-cell,
    th.round-header {
        scroll-snap-align: start;
    }
}

/* Round history viewing mode */
.round-dimmed {
    opacity: 0.25 !important;
    background-color: #e8e8e8 !important;
    pointer-events: none;
}

.round-dimmed .score-input,
.round-dimmed .score-value {
    opacity: 0.3;
}

.round-header-active {
    background: #8b0000 !important;
    box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.7);
    position: relative;
}

th.score-header-reset {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

th.score-header-reset:hover {
    background: #b71c1c !important;
}

.round-header-clickable {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.round-header-clickable:hover {
    background: #c62828 !important;
}

/* Round viewing indicator bar */
.round-viewing-bar {
    background: #8b0000;
    color: white;
    text-align: center;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.round-viewing-bar span {
    opacity: 0.7;
    font-weight: 400;
}


table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

thead {
    background: #e20713;
    color: white;
}

th {
    padding: 20px 10px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: white;
    border-top: 2px solid #e20713;
    border-bottom: 2px solid #e20713;
    border-right: 2px solid #e20713;
}

th:first-child {
    border-left: 2px solid #e20713;
}

th:last-child {
    border-right: 2px solid #e20713;
}

th.round-header {
    font-size: 14px;
    line-height: 1.2;
}

th.round-header .round-label {
    display: block;
    font-size: 12px;
}

th.round-header .round-number {
    display: block;
    font-size: 14px;
    margin-top: 2px;
}

th.place-header {
    font-size: 14px;
    width: 60px; /* Фиксированная ширина */
}

td {
    padding: 0;
    text-align: center;
    border-bottom: 2px solid #e20713;
    border-right: 2px solid #e20713;
    height: 50px;
}

td:first-child {
    border-left: 2px solid #e20713;
}

td:last-child {
    border-right: 2px solid #e20713;
}

tbody tr {
    transition: background-color 0.2s ease;
}

.place-cell {
    font-weight: 700;
    font-size: 18px;
    color: #000000;
    background: white;
    border-left: 0;
    border-right: 0;
    padding: 4px 6px;
    white-space: nowrap;
    position: relative;
}

.place-number {
    font-size: 18px;
    font-weight: 700;
}




.team-name {
    font-weight: 700;
    color: #000000;
    text-align: center;
    padding: 0;
    min-width: 120px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: white;
    z-index: 10;
    border-left: 2px solid #e20713;
    border-right: 2px solid #e20713;
}


.team-name-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 4px 8px;
    font-size: 18px;
    white-space: normal;
    line-height: 1.1;
    overflow: hidden;
    max-height: 50px; /* Match cell height to enforce no-grow */
}

/* Score value display (span instead of input for mobile) */
.score-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
    z-index: 2;
}

.score-input {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    background: transparent;
    transition: background-color 0.2s ease;
    /* Disable text selection and context menu on mobile */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    z-index: 2;
}

.score-input:focus {
    outline: none;
    background-color: #f0f8ff;
}

td.score-cell {
    padding: 0;
    height: 50px;
    width: 80px;
    min-width: 80px;
    position: relative;
}

/* SVG Marker Icons */
.marker-icon {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

/* Красная звёздочка (ручная метка *) - в углу */
.marker-asterisk {
    width: 14px;
    height: 14px;
    top: 3px;
    right: 3px;
    fill: #e20713;
}

/* Золотой круг (разделённый максимум) - вокруг числа */
.marker-gold-circle {
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    fill: #FFD700;
    opacity: 0.9;
}

/* Золотая звезда (единственный максимум) - на фоне числа */
.marker-gold-star {
    width: 48px;
    height: 48px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    fill: #FFD700;
    opacity: 0.85;
}

/* Обеспечиваем видимость текста поверх маркеров */
.score-input {
    position: relative;
    z-index: 2;
}


td.score-cell {
    padding: 0;
    height: 50px;
    position: relative;
}

.total-cell {
    font-weight: 700;
    font-size: 18px;
    color: white;
    background: #e20713;
    padding: 12px 10px;
    position: sticky;
    right: 0;
    z-index: 5;
    border-right: 2px solid #e20713;
    border-left: 2px solid #e20713;
}


thead th:last-child {
    position: sticky;
    right: 0;
    z-index: 20;
    background: #e20713;
}

/* Медальные места */
.medal-gold {
    background: linear-gradient(180deg, #E1AC2C 0%, #F4E180 100%) !important;
    color: #783f04 !important;
}

.medal-silver {
    background: linear-gradient(180deg, #C2C2C2 0%, #E9E9E9 100%) !important;
    color: #434343 !important;
}

.medal-bronze {
    background: linear-gradient(180deg, #ce9363 0%, #EACC77 100%) !important;
    color: #783f04 !important;
}

/* Изменение позиций (новая колонка) */
.change-header {
    width: 60px; /* Немного шире для стрелки и числа */
    min-width: 60px;
    padding: 0;
}

.change-cell {
    width: 60px;
    min-width: 60px;
    padding: 0;
    font-weight: 700;
    font-size: 15px;
}

.change-text {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.change-positive {
    background-color: #b6d7a8; /* Зеленый фон */
    color: #38761d;
}

.change-negative {
    background-color: #ea9999; /* Красный фон */
    color: #660000; 
}

.change-neutral {
    background-color: #f6b26b;
    color: #783f04;
    font-size: 18px;
}

/* Фиксация колонок при прокрутке */
thead th:nth-child(3) { /* Team Name is now 3rd column */
    position: sticky;
    left: 0;
    z-index: 20;
    background: #e20713;
    border-left: 2px solid #e20713;
}

thead th:last-child {
    position: sticky;
    right: 0;
    z-index: 20;
    background: #e20713;
    border-right: 2px solid #e20713;
}

tbody tr .team-name {
    left: 0;
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .menu-item-text {
        display: none;
    }

    .menu-item {
        padding: 10px 12px;
    }

    th,
    td {
        font-size: 12px;
    }

    .score-input,
    .team-name input {
        font-size: 16px;
    }

    .place-cell {
        font-size: 16px;
    }

    .team-name-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 10px;
        border-radius: 10px;
    }

    h1 {
        font-size: 1.5em;
    }

    th {
        padding: 15px 5px;
    }
}

.team-name-wrapper {
    position: relative;
}

.team-autocomplete {
    position: fixed;
    background: white;
    border: 2px solid #e20713;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    min-width: 200px;
}

.team-autocomplete.show {
    display: block;
}


.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover {
    background-color: #f7fafc;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

td.score-cell {
    padding: 0;
    height: 50px;
    width: 80px;
    min-width: 80px;
    position: relative;
}

th.round-header {
    width: 80px;
    min-width: 80px;
}

.team-name input::placeholder {
    color: #a0aec0;
    font-style: italic;
}

@media (max-width: 768px) {
    td.score-cell {
        width: 60px;
        min-width: 60px;
    }

    th.round-header {
        width: 60px;
        min-width: 60px;
    }

    .team-autocomplete {
        max-height: 150px;
        font-size: 14px;
    }
}

.teams-section-header {
    font-size: 14px;
    font-weight: 700;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    background-color: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    margin-top: 10px;
}

.teams-section-header:first-child {
    margin-top: 0;
}

.team-list-item.in-table {
    background-color: #f0f8ff;
    border-left: 4px solid #667eea;
}

.team-list-item-actions .btn-add {
    background: #48bb78;
}

.team-list-item-actions .btn-add:hover {
    background: #38a169;
}

.team-list-item-actions .btn-remove {
    background: #f59e0b;
}

.team-list-item-actions .btn-remove:hover {
    background: #d97706;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #2d3748;
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #e20713;
}

.form-select {
    cursor: pointer;
    background-color: white;
}

/* Сводка игры */
.game-summary {
    margin-top: 20px;
    padding: 15px;
    background-color: #f7fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.game-summary h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2d3748;
}

.game-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.game-summary-item:last-child {
    border-bottom: none;
}

.game-summary-label {
    font-weight: 700;
    color: #718096;
}

.game-summary-value {
    font-weight: 700;
    color: #2d3748;
}

/* Большое модальное окно */
.modal-large .modal-content {
    max-width: 900px;
}

/* Фильтры архива */
.archive-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.archive-filters .form-select,
.archive-filters .form-input {
    flex: 1;
}

/* Контейнер архива игр */
.games-archive-container {
    max-height: 500px;
    overflow-y: auto;
}

.game-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.game-card:hover {
    border-color: #e20713;
    box-shadow: 0 4px 12px rgba(226, 7, 19, 0.1);
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.game-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
}

.game-card-city {
    display: inline-block;
    padding: 6px 12px;
    background-color: #e20713;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.game-card-city.dubai {
    background-color: #3182ce;
}

.game-card-city.abudhabi {
    background-color: #38a169;
}

.game-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.game-card-stat {
    text-align: center;
}

.game-card-stat-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 5px;
}

.game-card-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
}

.game-card-teams {
    margin-top: 15px;
}

.game-card-teams-title {
    font-size: 14px;
    font-weight: 700;
    color: #718096;
    margin-bottom: 10px;
}

.game-card-top-teams {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-card-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #f7fafc;
    border-radius: 6px;
}

/* Призовые места */
.first {
    background: linear-gradient(180deg, #ffd966 0%, #fff4cc 25%, #ffd966 100%) !important;
    color: #7f6000 !important;
}

.second {
    background: linear-gradient(180deg, #d9d9d9 0%, #f0f0f0 25%, #d9d9d9 100%) !important;
    color: #434343 !important;
}

.third {
    background: linear-gradient(180deg, #f6b26b 0%, #fcd5b4 25%, #f6b26b 100%) !important;
    color: #783f04 !important;
}


.game-card-team-name {
    font-weight: 700;
}

.game-card-team-score {
    font-weight: 700;
    font-size: 18px;
}

.game-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
}

.game-card-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-load {
    background-color: #3182ce;
    color: white;
}

.btn-load:hover {
    background-color: #2c5282;
}

.btn-delete {
    background-color: #e53e3e;
    color: white;
}

.btn-delete:hover {
    background-color: #c53030;
}

.btn-export {
    background-color: #38a169;
    color: white;
}

.btn-export:hover {
    background-color: #2f855a;
}

.empty-archive {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
}

.empty-archive-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-archive-text {
    font-size: 18px;
    font-style: italic;
}

@media (max-width: 768px) {
    .game-card-body {
        grid-template-columns: 1fr;
    }

    .archive-filters {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 20px;
    }

    table {
        font-size: 12px;
        min-width: 450px;
    }

    th,
    td {
        padding: 6px 3px;
        font-size: 11px;
    }

    th.col-team {
        min-width: 100px;
    }

    td.team-name {
        max-width: 100px;
        font-size: 11px;
    }

    input.score-input {
        width: 35px;
        font-size: 13px;
    }

    .status {
        font-size: 13px;
        padding: 8px 12px;
    }
}

/* Clear teams button in section header */
.clear-teams-btn {
    font-size: 12px;
    text-transform: none;
    color: #e20713;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    font-weight: 600;
}

.clear-teams-btn:hover {
    background-color: #fed7d7;
}

/* Clear dialog modal */
.clear-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
}

.clear-dialog {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.clear-dialog h3 {
    margin-bottom: 20px;
    color: #2d3748;
}

.clear-dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.clear-dialog-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.clear-dialog-buttons .btn-points {
    background: #f59e0b;
    color: white;
}

.clear-dialog-buttons .btn-points:hover {
    background: #d97706;
}

.clear-dialog-buttons .btn-all {
    background: #e20713;
    color: white;
}

.clear-dialog-buttons .btn-all:hover {
    background: #c00610;
}

.clear-dialog-buttons .btn-cancel {
    background: #718096;
    color: white;
}

.clear-dialog-buttons .btn-cancel:hover {
    background: #4a5568;
}

/* =====================================================
   Custom Numeric Keyboard for Mobile
   ===================================================== */

.custom-keyboard {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #e8e8e8;
    padding: 8px;
    display: none;
    z-index: 9999;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.custom-keyboard.visible {
    display: block;
}

/* Добавить отступ к body когда клавиатура видна */
body.keyboard-open {
    padding-bottom: 130px;
}

.keyboard-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.keyboard-row:last-child {
    margin-bottom: 0;
}

.key-btn {
    height: 48px;
    border: none;
    border-radius: 10px;
    background: #e0e0e0;
    color: #444;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Neumorphic inner shadow effect */
    box-shadow: 
        inset 2px 2px 4px rgba(255, 255, 255, 0.9),
        inset -2px -2px 4px rgba(0, 0, 0, 0.1),
        1px 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.key-btn:active {
    box-shadow: 
        inset -2px -2px 4px rgba(255, 255, 255, 0.9),
        inset 2px 2px 4px rgba(0, 0, 0, 0.15);
    transform: scale(0.97);
}

/* Специальные кнопки - и * */
.key-btn.key-special {
    font-size: 24px;
    font-weight: 600;
}

/* Активная ячейка подсветка - красная внутренняя тень */
.score-cell.keyboard-active {
    box-shadow: inset 0 0 8px 2px rgba(226, 7, 19, 0.4) !important;
}

/* На десктопе скрываем клавиатуру */
@media (hover: hover) and (pointer: fine) {
    .custom-keyboard {
        display: none !important;
    }
}

/* Modal Centering Fix */
.modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: #fefefe;
    margin: auto; /* Fallback */
    padding: 10px;
    border: 1px solid #888;
    width: 95%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}