/* =========================================================
   1. Base / Variables
========================================================= */

* {
    box-sizing: border-box;
}

:root {
    --page-bg: #ced8ff;
    --page-text-main: #111827;
    --page-text-muted: #475467;

    --card-bg: rgba(255, 255, 255, 0.95);
    --card-slide-bg: rgba(255, 255, 255, 0.95);
    --card-border: #e7edf4;

    --text-main: #18212f;
    --text-muted: #667085;

    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --soft: #f3f6fa;

    --title-size: 54px;
    --title-color: #000;
    --title-align: left;

    --toolbar-height: 76px;

    --modal-bg: #ffffff;
    --modal-title: #0f172a;
    --modal-text: #18212f;
    --modal-border: #e7edf4;
    --colorlinkhover: #2196f3;

    --table-head-bg: #f6f8fb;
    --table-border: #e7edf4;

    --match-bg: linear-gradient(180deg, #fbfcfe, #f7f9fc);
    --score-bg: #ffffff;
    --slide-bg: #ecf0ff;
    --bracket-slide-head: #ecf0ff;
    --toolbar-bg: rgba(86, 151, 255, 0.49);
    --winner: #2563eb;
    --date-desc-color: #000000;
    --mc-empty: #f5f7fc;
    --bg-hero: rgba(255, 255, 255, 0.75);
}

html {
    min-height: 100%;
    max-width: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
    font-family: "Tektur", Arial, sans-serif;
    background: var(--page-bg);
    color: var(--page-text-main);
    padding-bottom: calc(var(--toolbar-height) + env(safe-area-inset-bottom));
}

button,
input,
select,
textarea {
    font-family: inherit;
}

button {
    color: inherit;
}

.hidden {
    display: none !important;
}



body.no-edit-access .edit-only,
body.no-edit-access .inline-image-btn,
body.no-edit-access .team-actions,
body.no-edit-access .match-actions,
body.no-edit-access [data-edit-only="1"] {
    display: none !important;
}

/* =========================================================
   2. Layout
========================================================= */

.layout {
    padding: 14px;
    max-width: 100%;
}

.container {
    max-width: 1320px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 20px;
    color: var(--text-main);
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.04);
    min-width: 0;
}

.landing-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.section-block {
    scroll-margin-top: 90px;
    min-width: 0;
}

.section-head,
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.section-head h2,
.section-title-row h2,
.section-title-row h4 {
    margin: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================================================
   3. Buttons
========================================================= */

.btn {
    border: none;
    border-radius: 5px;
    padding: 12px 16px;
    background: #e8edf4;
    color: #18212f;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
}

.header_img {
    padding: 6px 8px !important;
    font-size: 10px !important;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: var(--blue-dark);
}

.btn-small {
    padding: 9px 12px;
    font-size: 13px;
}

.icon-btn {
    border: none;
    background: transparent; 
    font-size: 22px;
    cursor: pointer;
}


.mode-toggle-icon {
    width: 22px;
    height: 22px;
    display: block;
}

#toggleModeBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#toggleModeBtn.is-edit-mode {
    color: var(--blue);
}


.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   4. Hero / Header
========================================================= */

.hero {
    margin-bottom: 20px;
}

.hero-clean {
    border-radius: 10px;
    background: var(--bg-hero);
    border: none;
    box-shadow: none;
    padding: 16px;
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.hero-left {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    min-width: 0;
}

.hero-logo-box {
    width: 92px;
    height: 92px;
    flex: 0 0 92px;
    position: relative;
}

.main-logo,
.logo-placeholder,
.team-logo,
.team-logo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    background: #eef3f8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #627086;
}

.inline-image-btn {
    position: absolute;
    left: 50%;
    bottom: -10px;
    transform: translateX(-50%);
    white-space: nowrap;
    border: none;
    background: #111827;
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.15);
}

.hero-content {
    min-width: 0;
}

.hero-title-3d {
    margin: 0 0 10px;
    min-height: 1em;
    font-size: var(--title-size);
    line-height: 0.98;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--title-color);
    text-align: var(--title-align);
    text-transform: uppercase;
}

.hero-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    font-size: 24px;
}

.editable-pill,
.dates-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px 8px 0;
    border-radius: 999px;
    color: var(--text-muted);
}

.dates-inline-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(231, 237, 244, 0.95);
}

.inline-date-input {
    border: none;
    background: transparent;
    font-size: 13px;
    color: var(--text-main);
    outline: none;
}

.date-sep {
    color: var(--page-text-muted);
}

.tournament-description {
   
    min-height: 1.5em;
    font-size: 16px;
    line-height: 1.5;
}

.tournament-description,
.hero-meta-row,
.editable-pill,
.dates-pill,
.date-sep,
.inline-date-input {
    color: var(--date-desc-color);
}

.clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.edit-mode .editable-multiline {
    -webkit-line-clamp: unset;
    overflow: visible;
}

/* =========================================================
   5. Editable Elements
========================================================= */

.editable-inline {
    position: relative;
    border-radius: 8px;
    transition: box-shadow 0.15s ease, background 0.15s ease;
}

body.edit-mode .editable-inline,
body.edit-mode .editable-zone {
    cursor: text;
}

body.edit-mode .editable-inline:hover,
body.edit-mode .editable-zone:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

body.edit-mode .editable-inline[contenteditable="true"]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

body.edit-mode .editable-inline.is-empty::before {
    content: attr(data-placeholder);
    color: rgba(71, 84, 103, 0.7);
    pointer-events: none;
}

/* =========================================================
   6. Stats
========================================================= */
.match-card-status,
.match-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.match-live-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    min-height: 24px;
    padding: 4px 9px;

    border-radius: 999px;

    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .06em;
    text-transform: uppercase;

    white-space: nowrap;
}

.match-live-badge::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
}

.match-live-badge-live {
    background: #fee2e2;
    color: #dc2626;
}

.match-live-badge-live::before {
    animation: livePulse 1s infinite;
}

.match-live-badge-paused {
    background: #fef3c7;
    color: #b45309;
}

.match-live-badge-finished {
    background: #e5e7eb;
    color: #475467;
}

.match-live-badge-finished::before {
    display: none;
}

@keyframes livePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(.65);
        opacity: .4;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    max-width: 720px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 14px 16px;
    backdrop-filter: blur(8px);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
}

/* =========================================================
   7. Teams Grid / Cards
========================================================= */

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.team-card {
    position: relative;
    border: 1px solid var(--card-border);
    background: var(--match-bg);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.team-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.05);
}

.team-card-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-logo-wrap {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
}

.team-name {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.team-sub {
    font-size: 13px;
    color: var(--text-muted);
}

.teams-more-wrap {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    margin-top: 8px;
}

.teams-more-btn {
    min-width: 180px;
    border-radius: 999px;
}

.team-card-gold {
    background: linear-gradient(135deg, #fff7cc 0%, #facc15 48%, #f59e0b 100%) !important;
    border-color: #fff !important;
    box-shadow: 0 12px 28px rgba(234, 179, 8, 0.28);
}

.team-card-silver {
    background: linear-gradient(135deg, #e8f3ff 0%, #d2d9e3 52%, #ffffff 100%) !important;
    border-color: #fff !important;
    box-shadow: 0 12px 28px rgba(148, 163, 184, 0.28);
}

.team-card-bronze {
    background: linear-gradient(135deg, #ffedd5 0%, #d97706 52%, #92400e 100%) !important;
    border-color: #fff !important;
    box-shadow: 0 12px 28px rgba(180, 83, 9, 0.28);
}

.team-card-gold .team-name,
.team-card-gold .team-sub,
.team-card-silver .team-name,
.team-card-silver .team-sub,
.team-card-bronze .team-name,
.team-card-bronze .team-sub {
    color: #111827;
}

.team-place-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 2;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    color: #111827;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(17, 24, 39, 0.12);
    box-shadow: 0 6px 14px rgba(17, 24, 39, 0.12);
}

.team-place-badge.team-card-gold {
    background: #facc15 !important;
    border-color: #eab308 !important;
}

.team-place-badge.team-card-silver {
    background: #e5e7eb !important;
    border-color: #cbd5e1 !important;
}

.team-place-badge.team-card-bronze {
    background: #d97706 !important;
    color: #fff;
    border-color: #b45309 !important;
}


.team-import-export-box {
    margin: 14px 0;
    padding: 12px;
    border: 1px dashed var(--modal-border, #e7edf4);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.42);
}

.team-import-export-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 900;
    color: var(--text-main, #18212f);
}

.team-import-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 640px) {
    .team-import-export-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
}




/* =========================================================
   Team modal logo editor
========================================================= */

.team-logo-editor-box {
    margin-bottom: 14px;
}

.team-logo-editor-label {
    display: block;
    margin-bottom: 7px;
    color: var(--modal-text, #18212f);
}

.team-logo-edit-box {
    width: 118px;
    height: 118px;
    min-width: 118px;
    border-radius: 24px;
    margin: 0;
}

.team-logo-edit-box .main-logo,
.team-edit-logo-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-logo-edit-box .logo-placeholder {
    font-size: 14px;
}

.team-logo-edit-box .inline-image-btn {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: -10px;
    white-space: nowrap;
}



@media (max-width: 640px) {
    .team-logo-edit-box {
        width: 100px;
        height: 100px;
        min-width: 100px;
    }
}


/* =========================================================
   Collapsed fast team picker
========================================================= */

.team-db-picker-box {
    margin: 14px 0;
}

.team-db-picker-toggle {
    width: auto;
}

.team-db-picker-expanded {
    padding: 12px;
    border: 1px dashed var(--modal-border, #e7edf4);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.42);
}

.team-db-picker-expanded .team-db-picker-toggle {
    margin-bottom: 12px;
}

.team-db-picker-panel {
    display: block;
}

.team-db-picker-panel.hidden {
    display: none;
}

.team-db-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.team-db-picker-head label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main, #18212f);
}

#teamDbPickerSearch {
    width: 100%;
    margin-bottom: 8px;
}

.team-db-picker-list {
    display: grid;
    gap: 6px;
    max-height: 260px;
    overflow: auto;
    padding-right: 2px;
}

.team-db-picker-item {
    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;

    padding: 8px;
    border: 1px solid var(--modal-border, #e7edf4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    cursor: pointer;
    text-align: left;
    color: inherit;
}

.team-db-picker-item:hover {
    background: #fff;
    border-color: var(--primary, #356bff);
}

.team-db-picker-logo {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    overflow: hidden;

    border-radius: 10px;
    background: #f3f6fb;
    color: var(--text-muted, #667085);
    font-size: 10px;
    font-weight: 700;
}

.team-db-picker-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-db-picker-info {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.team-db-picker-name {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 14px;
    font-weight: 700;
    color: var(--text-main, #18212f);
}

.team-db-picker-meta {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: 11px;
    color: var(--text-muted, #667085);
}

.team-db-picker-action {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary, #356bff);
}

.team-db-picker-empty {
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.65);
    color: var(--text-muted, #667085);
    font-size: 13px;
}

@media (max-width: 640px) {
    .team-db-picker-toggle {
        width: 100%;
    }

    .team-db-picker-head {
        align-items: stretch;
        flex-direction: column;
    }

    .team-db-picker-item {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .team-db-picker-action {
        display: none;
    }

    .team-db-picker-logo {
        width: 38px;
        height: 38px;
    }
}

/* =========================================================
   8. Inline Team Buttons / Logos
========================================================= */

.team-inline {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: inherit;
    text-align: left;
    margin: 0;
    padding: 0;
    cursor: pointer;
    display: inline-grid !important;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center !important;
    column-gap: 8px;
    min-width: 0;
    max-width: 100%;
    vertical-align: middle !important;
    line-height: 1 !important;
    text-decoration: none !important;
    border-bottom: 0 !important;
    transition: transform 0.15s ease, color 0.15s ease, text-shadow 0.15s ease, opacity 0.15s ease;
}

.team-inline:disabled {
    cursor: default;
    opacity: 1;
    transform: none;
}

.team-inline:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 3px;
}

.team-inline:hover:not(:disabled) {
    transform: translateY(-2px);
}

.team-inline:hover:not(:disabled) .team-inline-name {
    color: var(--colorlinkhover);
    text-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

img.team-inline-logo,
span.team-inline-logo {
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    border-radius: 7px;
    margin: 0;
    padding: 0;
    background: #eef3f8;
}

img.team-inline-logo {
    display: block !important;
    object-fit: cover;
    object-position: center;
}

span.team-inline-logo {
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #627086;
    font-size: 14px;
    line-height: 1;
}

.team-inline-name {
    display: block !important;
    min-width: 0;
    height: 28px;
    line-height: 28px !important;
    margin: 0;
    padding: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: none !important;
    text-decoration: none !important;
}

.team-open-trigger {
    cursor: pointer;
}

.team-open-trigger:disabled {
    cursor: default;
    opacity: 1;
}

/* =========================================================
   9. Matches Calendar
========================================================= */

.empty-actions{text-align:center; padding:20px}

.matches-list {
    display: grid;
    gap: 14px;
    border-radius: 16px;
    min-width: 0;
    max-width: 100%;
}

.match-card {
    display: grid;
    gap: 14px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

.match-card-expanded {
    box-shadow: 0 0 42px 3px rgba(15, 23, 42, 0.4);
	padding-top:10px;
    border-radius: 12px;
}

.match-meta {
	 display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.35;
    min-width: 0;
    max-width: 100%;
}


.match-meta .spacer,
.match-meta .btn {
    flex: 0 0 40px; /* Задайте примерную ширину вашей кнопки, например 120px */
}

/* Текст даты занимает всё оставшееся пространство и центрируется */
.match-meta .match-date {
    flex: 1;
    text-align: center;
}

/* Выравниваем саму кнопку по правому краю своего блока */
.match-meta .btn {
    margin-left: auto;
}

.match-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px auto 32px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--card-border);
    background: var(--match-bg);
    border-radius: 10px;
}

.match-row.js-match-accordion-row {
    cursor: pointer;
}

.match-row.js-match-accordion-row .team-open-trigger {
    cursor: pointer;
}

.match-row-with-edit {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px auto 32px minmax(0, 1fr) minmax(0, 1fr) auto;
}

body:not(.edit-mode) .match-row-with-edit {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px auto 32px minmax(0, 1fr) minmax(0, 1fr);
}

body.edit-mode .match-row-with-edit {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px auto 32px minmax(0, 1fr) minmax(0, 1fr) auto;
}

.match-team-name-side {
    appearance: none;
    -webkit-appearance: none;
    border: 0 !important;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-family: inherit;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    cursor: pointer;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none !important;
    transition: transform 0.15s ease, color 0.15s ease, text-shadow 0.15s ease, opacity 0.15s ease;
}

.match-team-name-side:hover:not(:disabled) {
    transform: translateY(-2px);
    color: var(--colorlinkhover);
    text-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
}

.match-team-name-side:disabled {
    cursor: default;
    opacity: 1;
    transform: none;
}

.match-team-name-side:focus-visible,
.match-team-logo-side:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.45);
    outline-offset: 3px;
}

.match-team-name-left {
    text-align: right;
}

.match-team-name-right {
    text-align: left;
}

.match-team-logo-side {
    appearance: none;
    -webkit-appearance: none;
    border: 0 !important;
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    transition: transform 0.15s ease, opacity 0.15s ease;
    min-width: 0;
    max-width: 100%;
}

.match-team-logo-side:hover:not(:disabled) {
    transform: translateY(-2px);
}

.match-team-logo-side:disabled {
    cursor: default;
    opacity: 1;
    transform: none;
}

.match-team-logo-side .team-inline-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
    border-radius: 7px;
}

.match-score-center {
    min-width: 86px;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 14px;
    border: 1px solid #c1c1c1;
    border-radius: 10px;
    background: var(--score-bg);
    color: var(--text-main);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.match-score-separator {
    color: var(--text-muted);
}

.match-team-winner,
.match-team-name-side.match-team-winner {
    font-weight: 700 !important;
}

.matches-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.matches-more-btn {
    min-width: 200px;
    border-radius: 999px;
}

.match-edit-inline-btn {
    align-self: center;
    white-space: nowrap;
    margin-left: 4px;
}

.match-edit-icon {
    display: none;
    line-height: 0;
}

.match-edit-icon svg {
    display: block;
}

.match-score-center-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.quick-score-input {
    width: 46px;
    height: 34px;
    border: 1px solid var(--card-border);
    border-radius: 9px;
    background: var(--score-bg, #fff);
    color: var(--text-main);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    outline: none;
}

.quick-score-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.quick-score-input::-webkit-outer-spin-button,
.quick-score-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.quick-score-input[type="number"] {
    -moz-appearance: textfield;
}

/* =========================================================
   10. Match Events / Match Stats Accordion
========================================================= */
.match-row__icon {opacity:0.5;}
.match-events {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--table-border, rgba(148, 163, 184, .3));
    border-radius: 0 0 12px 12px;
    font-size: 13px;
}

.match-events-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.match-events-col-right {
    text-align: right;
    align-items: flex-end;
}

.match-event-item {
    color: var(--text-muted, #667085);
    line-height: 1.35;
}

.match-stats-accordion {
    margin-top: -22px;
    padding: 14px;
    border-top: 1px solid var(--table-border, rgba(148, 163, 184, .35));
    background: var(--soft, #f3f6fa);
    background: color-mix(in srgb, var(--soft, #f3f6fa) 72%, transparent);
    border-radius: 0 0 16px 16px;
    animation: matchStatsOpen .16s ease;
}

@keyframes matchStatsOpen {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.match-stats-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.match-stats-title {
    font-weight: 700;
    color: var(--text-main, #18212f);
}

.match-stats-hint {
    font-size: 12px;
    color: var(--text-muted, #667085);
}

.match-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.match-stats-side {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--table-border, rgba(148, 163, 184, .35));
    border-radius: 14px;
    background: var(--card-bg, rgba(255, 255, 255, .92));
}

.match-stats-team {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-main, #18212f);
}

.match-stats-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.match-stats-summary span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--soft, #f3f6fa);
    color: var(--text-main, #18212f);
    font-size: 12px;
    font-weight: 700;
}

.match-stats-events {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.match-stat-event {
    display: grid;
    grid-template-columns: 24px 42px 1fr auto;
    gap: 7px;
    align-items: center;
    font-size: 13px;
    color: var(--text-main, #18212f);
}

.match-stat-event-icon, .textcenter {
    text-align: center;
}

.match-stat-minute {
    font-weight: 700;
    color: var(--blue, #2563eb);
}

.match-stat-event-player {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-stat-event-type {
    color: var(--text-muted, #667085);
    font-size: 12px;
    white-space: nowrap;
}

.match-stat-empty {
    color: var(--text-muted, #667085);
    font-size: 13px;
}

.match-stat-empty-main {
    padding: 12px;
    text-align: center;
}

.match-stats-notes {
    padding-top: 10px;
   /* border-top: 1px dashed var(--table-border, rgba(148, 163, 184, .35));*/
    color: var(--text-muted, #667085);
    font-size: 13px;
}



/* =========================================================
   Calendar Wizard Modal
========================================================= */

.calendar-wizard-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(10px);
}

.calendar-wizard-backdrop.open {
    display: flex;
}

.calendar-wizard-modal {
    width: min(760px, 100%);
    max-height: calc(100vh - 40px);

    overflow: auto;

    background: var(--modal-bg);
    color: var(--modal-text);

    border: 1px solid var(--modal-border);
    border-radius: 24px;

    box-shadow:
        0 30px 90px rgba(15, 23, 42, 0.22),
        0 8px 24px rgba(15, 23, 42, 0.12);
}

.calendar-wizard-header {
    position: sticky;
    top: 0;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 18px 20px;

    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--modal-border);

    backdrop-filter: blur(12px);
}

.calendar-wizard-header h3 {
    margin: 0;

    color: var(--modal-title);

    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.calendar-wizard-close {
    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--modal-border);
    border-radius: 12px;

    background: var(--soft);
    color: var(--text-main);

    font-size: 24px;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color .15s ease,
        color .15s ease,
        border-color .15s ease,
        transform .08s ease;
}

.calendar-wizard-close:hover {
    background: #eaf0ff;
    border-color: #d7e2f2;
    color: var(--blue);
}

.calendar-wizard-close:active {
    transform: scale(.97);
}

.calendar-wizard-body {
    padding: 20px;
}

.calendar-wizard-section {
    margin-bottom: 18px;
}

.calendar-wizard-section:last-child {
    margin-bottom: 0;
}

.calendar-wizard-label {
    margin: 0 0 8px;

    color: var(--text-muted);

    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* Format cards */

.calendar-format-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.calendar-format-card {
    min-height: 118px;

    padding: 16px;

    border: 1px solid var(--card-border);
    border-radius: 18px;

    background:
        linear-gradient(180deg, #ffffff, #f8fbff);

    color: var(--text-main);
    text-align: left;

    cursor: pointer;

    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);

    transition:
        background-color .15s ease,
        border-color .15s ease,
        box-shadow .15s ease,
        transform .08s ease;
}

.calendar-format-card:hover {
    border-color: #cddaf1;
    box-shadow:
        0 12px 28px rgba(15, 23, 42, 0.08),
        0 0 0 3px rgba(37, 99, 235, 0.06);
}

.calendar-format-card:active {
    transform: scale(.99);
}

.calendar-format-card.active {
    border-color: var(--blue);
    background:
        linear-gradient(180deg, #eef4ff, #ffffff);

    box-shadow:
        0 12px 30px rgba(37, 99, 235, 0.16),
        0 0 0 3px rgba(37, 99, 235, 0.12);
}

.calendar-format-card b {
    display: block;
    margin-bottom: 6px;

    color: var(--text-main);

    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.calendar-format-card span {
    display: block;

    color: var(--text-muted);

    font-size: 13px;
    line-height: 1.4;
}

/* Fields */

.calendar-wizard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.calendar-wizard-field label {
    display: block;

    margin-bottom: 6px;

    color: var(--text-muted);

    font-size: 13px;
    font-weight: 700;
}

.calendar-wizard-field select,
.calendar-wizard-field input {
    width: 100%;
    min-height: 46px;

    padding: 10px 12px;

    border: 1px solid var(--modal-border);
    border-radius: 12px;

    background: #ffffff;
    color: var(--text-main);

    font-size: 14px;
    font-weight: 600;

    outline: none;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.calendar-wizard-field select:focus,
.calendar-wizard-field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

/* Checkboxes */

.calendar-wizard-check {
    display: flex;
    gap: 10px;
    align-items: center;

    margin-top: 12px;

    color: var(--text-main);

    font-size: 14px;
    font-weight: 600;
}

.calendar-wizard-check input {
    width: 18px;
    height: 18px;

    accent-color: var(--blue);
}

/* Notes */

.calendar-wizard-note {
    padding: 12px 14px;

    border-radius: 14px;

    background: #eef4ff;
    border: 1px solid #d9e6ff;

    color: var(--text-main);

    font-size: 13px;
    line-height: 1.45;
}

.calendar-wizard-note b {
    color: var(--blue-dark);
    font-weight: 700;
}

.calendar-wizard-warning {
    padding: 12px 14px;

    border-radius: 14px;

    background: #fff1f2;
    border: 1px solid #fecdd3;

    color: #991b1b;

    font-size: 13px;
    line-height: 1.45;
}

.calendar-wizard-warning b {
    color: #7f1d1d;
}

/* Footer */

.calendar-wizard-actions {
    position: sticky;
    bottom: 0;

    display: flex;
    justify-content: flex-end;
    gap: 10px;

    padding: 16px 20px 20px;

    background: rgba(255, 255, 255, 0.94);
    border-top: 1px solid var(--modal-border);

    backdrop-filter: blur(12px);
}

.calendar-wizard-btn {
    min-height: 44px;

    padding: 0 16px;

    border: 0;
    border-radius: 12px;

    cursor: pointer;

    font-size: 14px;
    font-weight: 800;

    transition:
        background-color .15s ease,
        color .15s ease,
        box-shadow .15s ease,
        transform .08s ease;
}

.calendar-wizard-btn:active {
    transform: scale(.98);
}

.calendar-wizard-btn.secondary {
    background: var(--soft);
    color: var(--text-main);
    border: 1px solid var(--modal-border);
}

.calendar-wizard-btn.secondary:hover {
    background: #eaf0ff;
    border-color: #d7e2f2;
}

.calendar-wizard-btn.primary {
    background: var(--blue);
    color: #ffffff;

    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.calendar-wizard-btn.primary:hover {
    background: var(--blue-dark);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

/* Visibility */

.calendar-wizard-options {
    margin-top: 14px;
}

.calendar-wizard-options.hidden {
    display: none;
}

/* Entry button block */

.calendar-generator-entry {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-top: 12px;
}

/* Mobile */

@media (max-width: 640px) {
    .calendar-wizard-backdrop {
        align-items: flex-end;
        padding: 10px;
    }

    .calendar-wizard-modal {
        max-height: calc(100vh - 20px);
        border-radius: 22px;
    }

    .calendar-format-grid,
    .calendar-wizard-row {
        grid-template-columns: 1fr;
    }

    .calendar-wizard-header {
        padding: 16px;
    }

    .calendar-wizard-body {
        padding: 16px;
    }

    .calendar-wizard-actions {
        padding: 14px 16px 16px;
        flex-direction: column-reverse;
    }

    .calendar-wizard-btn {
        width: 100%;
    }
}




/* =========================================================
   11. Standings / Matrix
========================================================= */

.group-block {
    margin-bottom: 20px;
}

.group-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 10px;
}

.table-wrap,
.matrix-wrap,
.bracket-horizontal {
    overflow-x: auto;
    max-width: 100%;
}

.standings-table,
.matrix-table {
    border-collapse: collapse;
}

.standings-table {
    width: 100%;
    table-layout: fixed;
}

.standings-table th,
.standings-table td,
.matrix-table th,
.matrix-table td {
    padding: 12px 10px;
    border: 1px solid var(--table-border);
    text-align: center;
    vertical-align: middle;
}

.standings-table thead th,
.matrix-table thead th {
    background: var(--table-head-bg);
    color: var(--text-muted);
}

.standings-table th:first-child,
.standings-table td:first-child {
    width: 46%;
    text-align: left;
}

.standings-table th:not(:first-child),
.standings-table td:not(:first-child) {
    width: 9%;
    text-align: center;
}

.standings-table .team-inline,
.matrix-table .team-inline {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.standings-table .team-inline-name,
.matrix-table .team-inline-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: medium;
}

.matrix-group-block {
    margin-bottom: 24px;
}

.matrix-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
}

.matrix-table th,
.matrix-table td {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    text-align: center;
    vertical-align: middle;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    width: 190px;
    min-width: 190px;
    max-width: 190px;
    text-align: left;
}

.matrix-table th .team-inline,
.matrix-table td:first-child .team-inline {
    justify-content: flex-start;
}

.matrix-table th:not(:first-child) .team-inline {
    justify-content: center;
}

.matrix-cell-empty {
    background: var(--mc-empty);
    color: var(--mc-empty);
}

.matrix-score {
    font-weight: 700;
}

/* =========================================================
   12. Bracket Slider / Bracket Cards
========================================================= */

.bracket-slider {
    width: 100%;
    min-width: 0;
}

.bracket-slider-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px;
    border-radius: 14px;
    background: var(--slide-bg);
    backdrop-filter: blur(10px);
}

.bracket-slider-arrow {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: #eef2ff;
    color: #1e3a8a;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transition: 0.15s ease;
}

.bracket-slider-arrow:hover {
    background: var(--card-bg);
    transform: translateY(-1px);
}

.bracket-slider-pagination {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px;
}

.bracket-slider-pagination::-webkit-scrollbar {
    display: none;
}

.bracket-page-btn {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    background: #f1f5f9;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: 0.15s ease;
}

.bracket-page-btn:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

.bracket-page-btn.active {
    background: var(--blue);
    color: #fff;
}

.bracket-slider-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 2px 2px 12px;
}

.bracket-slider-track::-webkit-scrollbar {
    height: 10px;
}

.bracket-slider-track::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
}

.bracket-slide {
    scroll-snap-align: start;
    flex: 0 0 calc((100% - 32px) / 3);
    min-width: 0;
    height: 80vh;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: var(--slide-bg);
    box-shadow: 0 10px 26px rgba(17, 24, 39, 0.05);
    overflow: hidden;
}

.bracket-slide-head {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #e7edf4;
    background: var(--bracket-slide-head);
}

.bracket-slide-kicker {
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bracket-slide-title {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 700;
    color: var(--text-main);
}

.bracket-slide-count {
    flex: 0 0 auto;
    padding: 6px 9px;
    border-radius: 999px;
    background: #ffffff96;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.bracket-slide-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px;
}

.bracket-slide-scroll::-webkit-scrollbar {
    width: 8px;
}

.bracket-slide-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
}

.bracket-slide-group {
    margin-bottom: 16px;
    padding: 10px;
    border-radius: 10px;
    background: var(--card-slide-bg);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.bracket-slide-group:last-child {
    margin-bottom: 0;
}

.bracket-slide-group-title {
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #475569;
}

.bracket-slide-matches {
    display: grid;
    gap: 10px;
}

.bracket-match-card {
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.04);
    background: var(--card-bg);
    color: var(--text-main);
    min-width: 0;
}

.bracket-match-card.playoff {
    background: var(--card-bg);
}

.bracket-match-card.placement {
    background: rgba(236, 253, 245, 0.95);
    border-color: rgba(52, 211, 153, 0.35);
    color: #052e16;
}

.bracket-match-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bracket-match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
	color:var(--text-muted);
}

.bracket-match-row.winner {
    font-weight: 600;
    color: var(--winner);
}

.bracket-team-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-team-name.placeholder {
    opacity: 0.62;
    font-style: italic;
}

.bracket-match-card .bracket-score {
    margin: 0;
    min-width: 34px;
    text-align: right;
    font-size: 15px;
    font-weight: 700;
}

.bracket-notes {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.bracket-match-card .match-events {
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 12px;
}

.bracket-match-card .match-events-col-right {
    text-align: left;
    align-items: flex-start;
}

/* =========================================================
   13. Forms / Modals
========================================================= */

.form-group,
.form-row {
    margin-bottom: 14px;
}

.form-group label,
.form-row label {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--modal-title);
}

.form-group input,
.form-group select,
.form-group textarea,
.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d6dde6;
    border-radius: 6px;
    background: #fff;
    color: #000;
    font-size: 14px;
}

.form-row-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.team-coach-editor,
.match-bracket-fields {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e7edf4;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-dialog {
    background: var(--modal-bg);
    color: var(--modal-text);
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow: auto;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.modal-dialog.small {
    max-width: 420px;
}

.modal-header {
    padding: 2px 20px;
    border-bottom: 1px solid #e7edf4;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
    color: var(--modal-text);
}

.modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.player-editor-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr) 160px auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

body:not(.edit-mode) .player-editor-row {
    grid-template-columns: 90px minmax(0, 1fr) 160px;
}

.player-editor-row input {
    width: 100%;
    min-width: 0;
}

.player-editor-row > div,
.player-editor-row > input {
    min-width: 0;
}

.modal-header h1,
.modal-header h2,
.modal-header h3,
.modal-header h4,
.modal-header .modal-title {
    color: var(--modal-title) !important;
}

.message-box {
    margin-top: 12px;
    font-size: 14px;
    color: #475467;
}

.empty-box {
    padding: 18px;
    border: 1px dashed #d8e1ec;
    border-radius: 10px;
    background: #fbfcfe;
    color: var(--text-muted);
}

.inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================================================
   14. Toasts
========================================================= */

.toast-container {
    position: fixed;
    left: 50%;
    bottom: calc(var(--toolbar-height) + 10px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(360px, calc(100vw - 24px));
}

.toast {
    background: rgba(17, 24, 39, 0.96);
    color: #fff;
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.18s ease;
    font-size: 14px;
}

.toast.success {
    background: rgba(16, 185, 129, 0.96);
}

.toast.error {
    background: rgba(220, 38, 38, 0.96);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   15. Scan Results Preview
========================================================= */

.scan-modal-dialog {
    max-width: 1100px;
}

.scan-help {
    margin-bottom: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.scan-table-wrap {
    overflow-x: auto;
}

.scan-table {
    width: 100%;
    border-collapse: collapse;
}

.scan-table th,
.scan-table td {
    padding: 10px;
    border: 1px solid var(--card-border);
    vertical-align: middle;
}

.scan-table th {
    background: #f6f8fb;
    color: var(--text-muted);
    font-weight: 700;
    text-align: left;
}

.scan-original-name {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.scan-team-select,
.scan-small-input,
.scan-score-input {
    width: 100%;
    border: 1px solid #d6dde6;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
    color: var(--text-main);
    font-size: 14px;
}

.scan-score-cell {
    min-width: 120px;
    white-space: nowrap;
    text-align: center;
}

.scan-score-cell span {
    display: inline-block;
    padding: 0 5px;
    font-weight: 700;
}

.scan-score-input {
    width: 46px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

/* =========================================================
   16. Background Palette
========================================================= */

.bg-palette {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(20, 30, 50, 0.18);
}

.bg-palette-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    cursor: pointer;
    padding: 0;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.16);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bg-palette-dot:hover {
    transform: scale(1.08);
}

.bg-palette-dot.active {
    box-shadow: 0 0 0 3px rgba(33, 115, 255, 0.18);
    border-color: #1d4ed8;
}

/* =========================================================
   17. Status / 404 / 500 Pages
========================================================= */

#statusPageRoot.hidden,
#pageRoot.hidden {
    display: none;
}

.nf-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 32%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.14), transparent 28%),
        linear-gradient(135deg, #f4f7fb 0%, #eef4ff 45%, #f9fbff 100%);
}

.nf-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.nf-ball {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.55;
    animation: nfFloat 8s ease-in-out infinite;
}

.nf-ball-1 {
    width: 220px;
    height: 220px;
    top: 8%;
    left: -60px;
    background: radial-gradient(circle at 30% 30%, #60a5fa, #2563eb);
}

.nf-ball-2 {
    width: 160px;
    height: 160px;
    right: 8%;
    bottom: 10%;
    background: radial-gradient(circle at 30% 30%, #34d399, #059669);
    animation-delay: 1.5s;
}

.nf-ball-3 {
    width: 100px;
    height: 100px;
    right: 20%;
    top: 14%;
    background: radial-gradient(circle at 30% 30%, #fbbf24, #f59e0b);
    animation-delay: 0.8s;
}

.nf-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
    padding: 44px 30px;
    border-radius: 15px;
    text-align: center;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.12), 0 8px 24px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
}

.nf-trophy-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

.nf-trophy {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff7d6 0%, #ffe08a 100%);
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.22);
}

.nf-code {
    margin-bottom: 10px;
    font-size: clamp(72px, 16vw, 128px);
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: #2563eb;
    text-shadow: 0 10px 30px rgba(37, 99, 235, 0.18);
}

.nf-code-error {
    color: #dc2626;
    text-shadow: 0 10px 30px rgba(220, 38, 38, 0.16);
}

.nf-title {
    margin: 0 0 12px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.15;
    font-weight: 700;
    color: #0f172a;
}

.nf-text {
    max-width: 520px;
    margin: 0 auto 24px;
    font-size: 16px;
    line-height: 1.65;
    color: #475569;
}

.nf-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.nf-btn {
    appearance: none;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 7px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.nf-btn:hover {
    transform: translateY(-1px);
}

.nf-btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.25);
}

.nf-btn-primary:hover {
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.32);
}

.nf-btn-secondary {
    color: #0f172a;
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.nf-btn-secondary:hover {
    background: #e2e8f0;
}

.nf-hint {
    font-size: 14px;
    color: #64748b;
}

@keyframes nfFloat {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    50% {
        transform: translateY(-12px) translateX(6px);
    }
}

/* =========================================================
   Toolbar centered logo
========================================================= */

.action-toolbar-main {
    position: relative;
}

.toolbar-logo-link {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;

    width: 46px;
    height: 46px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    transform: translate(-50%, -50%);
    border-radius: 12px;
    opacity: 0.4;
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.toolbar-logo-link:hover {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.04);
    
}

.toolbar-logo-link img {
    width: 40px;
    height: 40px;
    display: block;
}
/* =========================================================
   18. Bottom Toolbar / User Menu
========================================================= */

.action-toolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    pointer-events: none;
}

.action-toolbar-main {
    width: min(100%, 1320px);
    min-height: 62px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--toolbar-bg);
    backdrop-filter: blur(12px);
    box-shadow: 0 16px 40px rgba(17, 24, 39, 0.1);
    pointer-events: auto;
}

.action-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.action-btn {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border: none;
    border-radius: 10px;
    background: #f3f6fa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.action-btn:hover {
    transform: translateY(-1px);
    background: #eaf1fb;
}

.action-btn img {
    width: 20px;
    height: 20px;
    display: block;
}

.action-btn-primary {
    background: var(--blue);
}

.action-btn-primary:hover {
    background: var(--blue-dark);
}

.action-btn-primary img {
    filter: brightness(0) invert(1);
}

.action-btn-warning {
    background: #fff4e8;
}

.action-btn-warning:hover {
    background: #ffe7cc;
}

body.edit-mode #toggleModeBtn {
    background: #e0ecff;
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.action-menu-wrap {
    position: relative;
    flex: 0 0 auto;
}

.action-dots {
    font-size: 26px;
    line-height: 1;
    transform: translateY(-2px);
    display: inline-block;
    color: #000000;
}

.action-dropdown {
    position: absolute;
    right: -160px;
    bottom: calc(100% + 10px);
    min-width: 230px;
    padding: 8px;
    border-radius: 10px;
    background: var(--modal-bg);
    border: 1px solid rgba(231, 237, 244, 0.95);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.action-dropdown-item {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 11px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    color: var(--text-main);
    font-size: 14px;
    transition: background 0.15s ease;
    text-decoration: none;
}

.action-dropdown-item:hover {
    background: #2196f324;
}

.action-dropdown-item img {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.user-fab-wrap {
    position: relative;
    margin-left: auto;
    flex: 0 0 auto;
}

.user-fab {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(231, 237, 244, 0.95);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
    backdrop-filter: blur(12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.user-fab:hover {
    transform: translateY(-1px);
    background: #fff;
}

.user-fab img {
    width: 20px;
    height: 20px;
    display: block;
}

.user-fab.is-authorized {
    background: #ecfdf3;
    border-color: #b7ebc6;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08), inset 0 0 0 1px rgba(34, 197, 94, 0.18);
}

.user-popover {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    min-width: 260px;
    max-width: 320px;
    border-radius: 10px;
    background: var(--modal-bg);
    border: 1px solid rgba(231, 237, 244, 0.95);
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14);
    backdrop-filter: blur(12px);
}

.user-popover-inner {
    padding: 14px 16px;
}

.user-popover-label {
    font-size: 12px;
    color: var(--modal-text);
    margin-bottom: 6px;
}

.user-popover-email {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-main);
    word-break: break-word;
}

.view-switch {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.view-switch .btn.active {
    background: var(--blue);
    color: #fff;
}

.top-nav-right img {
    width: 20px;
}

/* =========================================================
   Tooltip (single source of truth)
========================================================= */

.tooltip-link {
    position: relative;
}

/* Сам тултип */
.tooltip-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);

    z-index: 1000;
    max-width: min(320px, calc(100vw - 24px));
    width: max-content;

    padding: 7px 10px;
    border-radius: 8px;

    background: rgba(15, 23, 42, 0.95);
    color: #fff;

    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
    text-align: left;

    opacity: 0;
    pointer-events: none;
    visibility: hidden;

    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Стрелочка: опущена на свою высоту, чтобы её остриё касалось тултипа */
.tooltip-link::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(100%);

    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;

    pointer-events: none;
    z-index: 1000;
}

.tooltip-link:hover::after,
.tooltip-link:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.tooltip-link:hover::before,
.tooltip-link:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

/* Если слева не хватает места — прижимаем tooltip к левому краю кнопки */
.tooltip-link.tooltip-align-left::after {
    left: 0;
    transform: none;
}

/* Если справа не хватает места — прижимаем tooltip к правому краю кнопки */
.tooltip-link.tooltip-align-right::after {
    left: auto;
    right: 0;
    transform: none;
}

/* Выравнивание стрелочки — сохраняем translateY(100%), иначе сбросится сдвиг вниз */
.tooltip-link.tooltip-align-left::before {
    left: 12px;
    transform: translateY(100%);
}

.tooltip-link.tooltip-align-right::before {
    left: auto;
    right: 12px;
    transform: translateY(100%);
}

/* =========================================================
   19. Header Image Background
========================================================= */

html.has-tournament-header-image body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    z-index: -2;
    pointer-events: none;
    background-image: var(--tournament-header-image);
    background-repeat: no-repeat;
    background-position: top center;
    background-size: cover;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 58%, rgba(0, 0, 0, 0.78) 72%, rgba(0, 0, 0, 0.35) 88%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 58%, rgba(0, 0, 0, 0.78) 72%, rgba(0, 0, 0, 0.35) 88%, rgba(0, 0, 0, 0) 100%);
}

html.has-tournament-header-image body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 600px;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.22) 45%, rgba(0, 0, 0, 0) 100%);
}

/* =========================================================
   Team highlight mode
========================================================= */
#highlightTeamBtn{width:100%}

.team-highlight-active .team-dimmed,
.team-highlight-active .team-inline-dimmed,
.team-highlight-active .team-logo-dimmed,
.team-highlight-active .match-dimmed,
.team-highlight-active .bracket-match-card.match-dimmed {
    opacity: 0.28;
    filter: grayscale(0.65);
    transition: opacity 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.team-highlighted,
.team-inline-highlighted,
.team-logo-highlighted,
.match-highlighted,
.bracket-match-card.match-highlighted {
    opacity: 1 !important;
    filter: none !important;
}

.team-card.team-highlighted {
    box-shadow:
        0 0 0 1px var(--blue),
        0 18px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.match-card.match-highlighted .match-row {
    border-color: rgba(var(--blue), 0.5);
    box-shadow:
        0 0 0 1px rgba(var(--blue), 0.5),
        0 14px 34px rgba(0, 0, 0, 0.2);
}

.bracket-match-card.match-highlighted {
    border-color: rgba(var(--blue), 0.5);
    box-shadow:
        0 0 0 1px rgba(var(--blue), 0.5),
        0 12px 28px rgba(0, 0, 0, 0.2);
}

.team-inline-highlighted,
.match-team-name-side.team-inline-highlighted,
.bracket-team-name.team-inline-highlighted {
    color: var(--blue) !important;
    font-weight: 700 !important;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.team-logo-highlighted .team-inline-logo,
.team-inline-highlighted .team-inline-logo {
    box-shadow: 0 0 0 rgba(var(--blue), 0.5);
}

.team-modal-actions-view {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

/*
   На мобильных приглушение делаем мягче,
   чтобы не ухудшать читаемость.
*/
@media (max-width: 600px) {
    .team-highlight-active .team-dimmed,
    .team-highlight-active .team-inline-dimmed,
    .team-highlight-active .team-logo-dimmed,
    .team-highlight-active .match-dimmed,
    .team-highlight-active .bracket-match-card.match-dimmed {
        opacity: 0.42;
        filter: grayscale(0.45);
    }
}


/* =========================================================
   Place-based bracket colors
========================================================= */

.bracket-place-group {
    overflow: hidden;
}

.bracket-place-route {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.35;
    color: var(--text-muted, #667085);
    font-weight: 500;
}

.place-range-gold {
   /* background: linear-gradient(135deg, rgba(250, 204, 21, 0.24), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(234, 179, 8, 0.48);*/
}

.place-range-bronze {
   /* background: linear-gradient(135deg, rgba(217, 119, 6, 0.18), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(217, 119, 6, 0.4);*/
}

.place-range-top {
   /* background: linear-gradient(135deg, rgba(34, 197, 94, 0.16), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(34, 197, 94, 0.35);*/
}

.place-range-blue {
  /*  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(37, 99, 235, 0.32);*/
}

.place-range-purple {
  /*  background: linear-gradient(135deg, rgba(147, 51, 234, 0.14), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(147, 51, 234, 0.3);*/
}

.place-range-gray {
   /* background: linear-gradient(135deg, rgba(100, 116, 139, 0.14), var(--card-slide-bg, rgba(255,255,255,.9)));
    border-color: rgba(100, 116, 139, 0.28);*/
}
/* =========================================================
   Match modal simplified layout
========================================================= */

.match-modal-body {
    display: grid;
    gap: 14px;
	
background:var(--slide-bg);
}

.match-modal-card {
    padding: 14px;
    border: 1px solid var(--modal-border, #e7edf4);
    border-radius: 8px;
    background: rgba(255, 255, 255,0.56);
}

.match-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
    grid-template-areas:
        "label1 labelscore label2"
        "team1 score team2";
    gap: 8px 12px;
    align-items: center;
}

.match-main-label {
    color: var(--text-muted, #667085);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.match-main-label-team1 {
    grid-area: label1;
}

.match-main-label-score {
    grid-area: labelscore;
    text-align: center;
}

.match-main-label-team2 {
    grid-area: label2;
}

.match-main-field-team1 {
    grid-area: team1;
}

.match-main-field-score {
    grid-area: score;
}

.match-main-field-team2 {
    grid-area: team2;
}



.match-main-field-score {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 7px;
    align-items: center;
}

.match-main-field-score span {
    font-weight: 700;
    color: var(--text-muted, #667085);
}

.form-row-full {
    display: grid;
    gap: 7px;
}

.match-source-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.match-source-grid .form-group {
    display: grid;
    gap: 7px;
}

.form-hint {
    margin-top: 6px;
    color: var(--text-muted, #667085);
    font-size: 12px;
    line-height: 1.4;
}

@media (max-width: 640px) { 
    .match-modal-card {
        padding: 12px;
        border-radius: 16px;
    }

    .match-main-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "label1"
            "team1"
            "labelscore"
            "score"
            "label2"
            "team2";
        gap: 7px;
    }

    .match-main-label-score {
        text-align: left;
        margin-top: 4px;
    }

    .match-main-field-score {
        grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
    }

    .match-source-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   20. Responsive
========================================================= */

@media (max-width: 1279px) {
    .bracket-slide {
        flex-basis: calc((100% - 16px) / 2);
    }
}

@media (max-width: 980px) {
    .hero-title-3d {
        font-size: 42px;
    }

    .match-card {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

@media (max-width: 899px) {
    .bracket-slider-nav {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        gap: 8px;
        padding: 8px;
    }

    .bracket-slider-arrow {
        width: 38px;
        height: 38px;
        font-size: 26px;
    }

    .bracket-slide {
        flex-basis: 100%;
        height: 80vh;
        max-height: 80vh;
    }

    .bracket-slide-title {
        font-size: 20px;
    }
}

@media (max-width: 720px) {
    :root {
        --title-size: 34px;
        --toolbar-height: 92px;
    }

    .layout {
        padding: 12px;
    }

    .hero-left {
        flex-direction: column;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .form-row-two,
    .player-editor-row,
    body.edit-mode .player-editor-row,
    body:not(.edit-mode) .player-editor-row {
        grid-template-columns: 1fr;
    }

    .dates-inline-wrap {
        width: 100%;
        justify-content: space-between;
        border-radius: 10px;
    }

    .inline-date-input {
        width: 100%;
    }

    .action-toolbar {
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }

    .action-toolbar-main {
        min-height: 58px;
        padding: 8px;
        gap: 8px;
        border-radius: 8px 8px 0 0;
    }

    .action-toolbar-actions {
        gap: 6px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .action-toolbar-actions::-webkit-scrollbar {
        display: none;
    }

    .action-btn,
    .user-fab {
        width: 44px;
        height: 44px;
        border-radius: 10px;
    }

    .action-dropdown,
    .user-popover {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: calc(var(--toolbar-height) + env(safe-area-inset-bottom) + 8px);
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .match-stats-grid {
        grid-template-columns: 1fr;
    }

    .match-stats-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .match-stat-event {
        /*grid-template-columns: 24px 38px 1fr;*/
    }

    .match-stat-event-type {
        grid-column: 4;
    }
}

@media (max-width: 640px) {
    .nf-card {
        padding: 32px 20px;
        border-radius: 11px;
    }

    .nf-text {
        font-size: 15px;
    }

    .nf-actions {
        flex-direction: column;
    }

    .nf-btn {
        width: 100%;
    }

    .team-inline {
        grid-template-columns: 24px minmax(0, 1fr);
        column-gap: 7px;
    }

    .team-inline-name {
        height: 24px;
        line-height: 24px !important;
        font-size: 12px !important;
    }

    img.team-inline-logo,
    span.team-inline-logo {
        width: 24px;
        height: 24px;
        min-width: 24px;
        max-width: 24px;
        border-radius: 6px;
        font-size: 13px;
    }

    .standings-table th:first-child,
    .standings-table td:first-child {
        width: 42%;padding:0;
    }

    .standings-table th:not(:first-child),
    .standings-table td:not(:first-child) {
        width: 9.666%;padding:0;
        font-size: 12px;
    }

    .matrix-table th,
    .matrix-table td {
        width: 76px;
        min-width: 76px;
        max-width: 76px;
    }

    .matrix-table th:first-child,
    .matrix-table td:first-child {
        width: 150px;
        min-width: 150px;
        max-width: 150px;
    }

    .matrix-table thead .team-inline-name {
        max-width: 64px;
    }

    .scan-modal-dialog {
        max-width: none;
    }

    .scan-table th,
    .scan-table td {
        padding: 8px;
    }

    .scan-team-select,
    .scan-small-input,
    .scan-score-input {
        font-size: 13px;
    }

    .bracket-slider-nav {
        position: static;
    }

    .bracket-page-btn {
        padding: 9px 12px;
        font-size: 12px;
    }

    .bracket-slide {
        height: 78vh;
        max-height: 78vh;
    }

    .bracket-slide-head {
        padding: 14px 14px 10px;
    }

    .bracket-slide-scroll {
        padding: 12px;
    }
}

/* Mobile calendar: logos stay visible */
@media (max-width: 600px) {
    .card {
        padding: 14px 10px;
    }

    .matches-list {
        gap: 10px;
    }

    .match-card {
        gap: 8px;
    }

    .match-meta {
        font-size: 12px;
        padding: 0 2px;
        text-align: center;
    }

    .match-row-with-edit,
    body:not(.edit-mode) .match-row-with-edit,
    body.edit-mode .match-row-with-edit {
        display: grid;
        grid-template-columns:24px minmax(0, 1fr) 24px auto 24px minmax(0, 1fr) 24px;
        grid-template-areas:
            "icon1 team1 logo1 score logo2 team2 icon2"
            "edit edit edit edit edit edit edit";
        align-items: center;
        gap: 6px;
        padding: 10px 7px;
        overflow: hidden;
    }
.match-icon-left       { grid-area: icon1; }
.match-icon-right      { grid-area: icon2; }

    .match-team-name-left {
        grid-area: team1;
        text-align: right;
    }

    .match-team-name-left + .match-team-logo-side {
        grid-area: logo1;
    }

    .match-score-center {
        grid-area: score;
    }

    .match-score-center + .match-team-logo-side {
        grid-area: logo2;
    }

    .match-team-name-right {
        grid-area: team2;
        text-align: left;
    }

    .match-team-logo-side {
        display: flex !important;
        width: 24px;
        height: 24px;
        min-width: 24px;
        max-width: 24px;
    }

    .match-team-logo-side .team-inline-logo,
    .match-row .team-inline-logo,
    .match-row img.team-inline-logo,
    .match-row span.team-inline-logo {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        border-radius: 6px;
        font-size: 12px;
    }

    .match-team-name-side {
        width: 100%;
        font-size: 14px;
        line-height: 1.2;
        white-space: normal;
        overflow: hidden;
        text-overflow: unset;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .match-score-center {
        min-width: 54px;
        padding: 8px 7px;
        gap: 3px;
        font-size: 15px;
        border-radius: 8px;
    }

    .match-edit-inline-btn.hidden {
        display: none !important;
    }

    .match-edit-inline-btn {
        grid-area: edit;
        justify-self: center;
        width: auto;
        min-width: 120px;
        height: 34px;
        padding: 0 12px;
        margin: 4px 0 0;
    }

    .match-edit-text {
        display: inline;
    }

    .match-edit-icon {
        display: none;
    }

    .quick-score-input {
        width: 32px;
        height: 30px;
        font-size: 14px;
        border-radius: 7px;
    }

    .match-score-center-edit {
        min-width: 82px;
        padding: 6px 5px;
        gap: 3px;
    }
	

    .hero-title-зd,
    #tournamentTitle {
        max-width: 100%;
        font-size: clamp(28px, 9vw, 40px) !important;
        line-height: 0.95;
        letter-spacing: -0.04em;
        overflow-wrap: anywhere;
        word-break: normal;
        hyphens: auto;
    }

}

@media (max-width: 380px) {
    .layout {
        padding-left: 8px;
        padding-right: 8px;
    }

    .card {
        padding-left: 8px;
        padding-right: 8px;
    }

    .match-row-with-edit,
    body:not(.edit-mode) .match-row-with-edit,
    body.edit-mode .match-row-with-edit {
        grid-template-columns:22px  minmax(0, 1fr) 22px auto 22px minmax(0, 1fr) 22px;
        gap: 4px;
        padding: 9px 6px;
    }

    .match-team-logo-side,
    .match-team-logo-side .team-inline-logo,
    .match-row .team-inline-logo,
    .match-row img.team-inline-logo,
    .match-row span.team-inline-logo {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        max-width: 22px !important;
    }

    .match-team-name-side {
        font-size: 11px;
    }

    .match-score-center {
        min-width: 48px;
        padding: 7px 6px;
        font-size: 14px;
    }

    .match-score-center-edit {
        min-width: 76px;
    }

    .quick-score-input {
        width: 29px;
        height: 28px;
        font-size: 13px;
    }
}


.match-protocol-box {
    margin-top: 18px;
}

.match-protocol-title-row {
    margin-bottom: 12px;
}

.match-protocol-title {
    font-weight: 700;
    font-size: 16px;
    color: #111827;
}

.match-protocol-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
}

.match-protocol-side {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    background: #f9fafb;
}

.match-protocol-side-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.match-protocol-side-label {
    font-size: 12px;
    color: #6b7280;
}

.match-protocol-team-name {
    font-weight: 700;
    color: #111827;
}

.match-protocol-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-protocol-row {
    display: grid;
    grid-template-columns: 78px minmax(130px, 1fr) 70px minmax(120px, 1fr) 34px;
    gap: 8px;
    align-items: end;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
}

.match-protocol-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #6b7280;
}

.match-protocol-field input,
.match-protocol-field select {
    width: 100%;
    min-height: 34px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 13px;
    background: #fff;
}

.match-protocol-remove {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #dc2626;
}

.match-protocol-empty {
    padding: 12px;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    color: #6b7280;
    font-size: 13px;
    background: #fff;
}

@media (max-width: 900px) {
    .match-protocol-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .match-protocol-row {
        grid-template-columns: 1fr 1fr;
    }

    .match-protocol-remove {
        grid-column: 1 / -1;
        width: 100%;
    }
}