:root {
    --bg: #eef3fb;
    --bg-accent: #e4ecfb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --surface-muted: #f1f5fb;
    --text: #0f1f3a;
    --text-soft: #5a6b86;
    --border: #d8e2f1;
    --primary: #2d5bcd;
    --primary-strong: #2249ab;
    --success: #179a52;
    --success-strong: #0f7c40;
    --danger: #dc3f5f;
    --danger-strong: #be2f4d;
    --shadow-soft: 0 10px 24px rgba(27, 52, 102, 0.08);
    --shadow-card: 0 14px 34px rgba(21, 41, 84, 0.12);
}

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

body {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 10% 0%, rgba(45, 91, 205, 0.12), transparent 30%),
        radial-gradient(circle at 90% 0%, rgba(23, 154, 82, 0.1), transparent 34%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-accent) 100%);
    min-height: 100vh;
    padding: 22px;
}

.container {
    max-width: 1220px;
    margin: 0 auto;
}

.center-text {
    text-align: center;
}

.teams-subtitle {
    margin-top: 2px;
    margin-bottom: 20px;
    color: var(--text-soft);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

p {
    line-height: 1.5;
}

/* === ДОБАВИТЬ ЭТИ СТИЛИ === */

/* Заголовки */
h1 {
    margin-bottom: 16px;
    color: #13346e;
    font-size: clamp(1.7rem, 3vw, 2.3rem);
    font-weight: 800;
    letter-spacing: 0.01em;
}

h2 {
    margin-bottom: 14px;
    color: #1a376d;
    font-size: clamp(1.15rem, 2vw, 1.42rem);
    font-weight: 750;
}

/* Таблица состава */
.roster-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
}

.roster-table th,
.roster-table td {
    border-bottom: 1px solid #e9eff9;
    padding: 10px 11px;
    text-align: left;
    font-size: 13px;
}

.roster-table th {
    background: var(--surface-soft);
    color: #37507e;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 12px;
}

.roster-table input[type="text"],
.roster-table input[type="number"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
}

.roster-table input[type="checkbox"] {
    transform: scale(1.1);
}

.lineup-table .lineup-table__zone-col {
    width: 72px;
    text-align: center;
}

.lineup-table .lineup-zone-cell {
    width: 72px;
    text-align: center;
    vertical-align: middle;
    padding: 11px 8px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
}

.lineup-table .lineup-zone-roman {
    display: inline-block;
    min-width: 1.8em;
    font-size: clamp(1.35rem, 3vw, 1.65rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
    color: #1e40af;
    font-family: Georgia, 'Times New Roman', serif;
}

.lineup-table .lineup-player-cell {
    padding: 10px 12px;
}

.lineup-table .lineup-player {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    background: #fff;
    min-height: 42px;
    box-sizing: border-box;
}

.lineup-table .lineup-player:focus {
    border-color: #3b6fc4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 111, 196, 0.2);
}

.lineup-table th,
.lineup-table td {
    font-size: 15px;
}

.lineup-table th {
    font-size: 13px;
    padding: 12px 11px;
}

.lineup-save-status {
    margin: 8px 0 0;
    min-height: 1.2em;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    color: #64748b;
}

.lineup-save-status--ok {
    color: #0f7c40;
}

.lineup-save-status--error {
    color: #b91c1c;
}

/* Карточка формы */
.form-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(214, 226, 244, 0.95);
}

/* Ряды формы */
.form-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.match-setup-line {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.match-setup-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: #334155;
    font-size: 15px;
}

.match-setup-optional {
    font-weight: 500;
    color: #64748b;
    font-size: 13px;
}

.match-setup-select {
    min-width: 280px;
    max-width: 100%;
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
}

.match-setup-select--narrow {
    min-width: 140px;
}

.match-setup-time {
    padding: 10px 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
}

.match-setup-time--readonly {
    background: #f1f5f9;
}

.match-serve-card {
    padding: 18px 20px;
}

.match-serve-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: center;
}

.match-serve-row__label {
    font-weight: 700;
    color: #1e466e;
}

.match-serve-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    color: #334155;
}

.previous-sets-serve-info {
    margin: 16px auto 0;
    max-width: 420px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.previous-sets-serve-info__title {
    margin: 0 0 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.previous-sets-serve-info__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.previous-sets-serve-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 15px;
    font-weight: 600;
}

.previous-sets-serve-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.previous-sets-serve-item:first-child {
    padding-top: 0;
}

.previous-sets-serve-item__set {
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
}

.previous-sets-serve-item__team {
    text-align: right;
    word-break: break-word;
}

.previous-sets-serve-item--a .previous-sets-serve-item__team {
    color: #1e40af;
}

.previous-sets-serve-item--b .previous-sets-serve-item__team {
    color: #9a3412;
}

/* Поля ввода */
input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 91, 205, 0.15);
}

input[type="text"],
input[type="number"],
input[type="datetime-local"] {
    width: 200px;
}

select,
option {
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    font-weight: 500;
}

.field-with-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 13px;
    color: var(--text-soft);
}

.field-with-label span {
    font-weight: 600;
}

.field-with-label select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    min-width: 160px;
    background: #fff;
    color: var(--text);
}

.role-toggle-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

button.role-btn {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    cursor: pointer;
    color: #334f77;
}

button.role-btn.active {
    background: #224ca9;
    color: #fff;
    border-color: #224ca9;
}

.btn-row-del {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.btn-row-del:hover {
    background: #fecaca;
}

/* Кнопка отправки формы */
button[type="submit"] {
    background: var(--primary);
    color: white;
    border: 1px solid transparent;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 650;
    cursor: pointer;
    transition: background 0.2s, transform 0.08s ease;
    margin-top: 10px;
}

button[type="submit"]:hover {
    background: var(--primary-strong);
}

button {
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.08s ease, box-shadow 0.2s;
}

button:hover {
    background: var(--primary-strong);
    box-shadow: 0 7px 14px rgba(45, 91, 205, 0.2);
}

button:active {
    transform: translateY(1px);
}

/* Контейнер со счетом */
.score-container {
    background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
    border-radius: 18px;
    padding: 22px 18px;
    margin-bottom: 14px;
    border: 1px solid #d7e4fa;
    box-shadow: 0 12px 24px rgba(35, 69, 135, 0.1);
}

.score {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 700;
    line-height: 1.4;
    color: #213a68;
}

#score_a, #score_b {
    font-size: clamp(2.6rem, 7vw, 4.25rem);
    font-weight: 800;
    color: #143f8f;
    line-height: 1.2;
    margin: 0 8px;
    text-shadow: 0 1px 0 #fff;
}

.scoreboard-card {
    overflow: hidden;
}

.scoreboard-shared {
    margin-bottom: 16px;
}

.scoreboard-shared .series-score-strip {
    margin-bottom: 10px;
}

.scoreboard-teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.scoreboard-teams-grid.swapped .team-score-panel--a {
    order: 2;
}

.scoreboard-teams-grid.swapped .team-score-panel--b {
    order: 1;
}

.team-score-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    padding: 18px 16px 16px;
    border-radius: 16px;
    border: 2px solid transparent;
    box-shadow: 0 10px 22px rgba(35, 69, 135, 0.08);
    min-height: 100%;
}

.team-score-panel--a {
    background: linear-gradient(165deg, #eef4ff 0%, #dbe8ff 55%, #c8d9fb 100%);
    border-color: #7ba3e8;
}

.team-score-panel--b {
    background: linear-gradient(165deg, #fff4ee 0%, #ffe8db 55%, #ffd9c8 100%);
    border-color: #e8a87c;
}

.team-score-panel__title {
    margin: 0 0 12px;
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    font-weight: 800;
    color: #1e3a5f;
    line-height: 1.3;
    word-break: break-word;
}

.team-score-panel--b .team-score-panel__title {
    color: #7c2d12;
}

.team-score-panel__score-wrap {
    margin-bottom: 12px;
}

.team-score-panel__score-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.team-score-panel__score {
    display: block;
    font-size: clamp(3rem, 10vw, 4.5rem) !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin: 0 !important;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.65);
}

.team-score-panel--a .team-score-panel__score {
    color: #143f8f !important;
}

.team-score-panel--b .team-score-panel__score {
    color: #9a3412 !important;
}

.team-score-panel__stats {
    list-style: none;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    font-size: clamp(1.05rem, 2.4vw, 1.2rem);
    font-weight: 500;
    color: #334155;
    line-height: 1.45;
}

.team-score-panel__stat-num {
    font-weight: 800;
}

.team-score-panel__stats li + li {
    margin-top: 4px;
}

.team-score-panel__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.team-score-panel__actions button {
    width: 100%;
    margin: 0;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
}

.team-score-panel__actions .btn-team-point {
    padding: clamp(18px, 4vw, 26px) clamp(16px, 3vw, 22px);
    font-size: clamp(1.35rem, 4vw, 1.85rem);
    font-weight: 800;
    border-radius: 14px;
    min-height: 64px;
}

.btn-team-point {
    background: var(--primary);
    color: #fff;
}

.btn-team-point:hover {
    background: var(--primary-strong);
}

.team-score-panel--b .btn-team-point {
    background: #c2410c;
}

.team-score-panel--b .btn-team-point:hover {
    background: #9a3412;
}

.btn-team-timeout {
    background: var(--success);
    color: #fff;
}

.btn-team-timeout:hover {
    background: var(--success-strong);
}

.team-score-panel__actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.scoreboard-global-actions {
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.scoreboard-global-actions .btn-delete-last {
    background: var(--danger);
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 10px;
}

.scoreboard-global-actions .btn-delete-last:hover {
    background: var(--danger-strong);
}

.scoreboard-global-actions .btn-swap-sides {
    background: var(--primary);
    color: #fff;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 10px;
    margin: 0;
}

.scoreboard-global-actions .btn-swap-sides:hover {
    background: var(--primary-strong);
}

/* Контейнер с кнопками управления */
.buttons-container {
    margin-bottom: 12px;
}

.buttons-container button {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin: 6px 5px;
}

.buttons-container button:hover {
    background: var(--primary-strong);
}

.buttons-container button:last-child {
    background: var(--danger);
}

.buttons-container button:last-child:hover {
    background: var(--danger-strong);
}

.buttons-container button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.buttons-container .btn-timeout {
    background: var(--success);
}

.buttons-container .btn-timeout:hover {
    background: var(--success-strong);
}

.set-finished-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(220, 38, 38, 0.1);
    color: #991b1b;
    font-weight: 600;
    font-size: 15px;
}

/* Контейнер результата */
.result-container {
    background: var(--surface-muted);
    border-radius: 12px;
    padding: 16px;
    margin-top: 20px;
    border: 1px solid var(--border);
}

#result {
    font-family: monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #2f4368;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        align-items: center;
    }

    input[type="text"],
    input[type="number"],
    input[type="datetime-local"] {
        width: 100%;
        max-width: 300px;
    }

    .buttons-container button {
        display: block;
        width: 100%;
        max-width: 250px;
        margin: 10px auto;
    }

    .scoreboard-teams-grid {
        grid-template-columns: 1fr;
    }

    #score_a, #score_b {
        font-size: 36px;
    }

    .team-score-panel__score {
        font-size: 3rem !important;
    }

    .score {
        font-size: 20px;
    }
}

/* Поле — мини-площадка */
.court-wrap {
    background: linear-gradient(180deg, #f6f9ff 0%, #e9f0ff 100%);
    border-radius: 16px;
    padding: 14px;
    border: 1px solid #ceddfa;
}

.court {
    display: grid;
    grid-template-columns: 1fr 14px 1fr;
    grid-template-areas: "left net right";
    gap: 0;
    align-items: stretch;
}

.court-half[data-team="a"] {
    grid-area: left;
}

.court-half[data-team="b"] {
    grid-area: right;
}

.court-net {
    grid-area: net;
}

.court.swapped {
    grid-template-areas: "right net left";
}

.court-half {
    background: linear-gradient(145deg, #8fb1ee 0%, #4373ce 40%, #2b59b8 100%);
    border-radius: 12px;
    padding: 12px;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.24), 0 6px 18px rgba(30, 56, 117, 0.22);
    position: relative;
}

.court-half::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    pointer-events: none;
}

.court-title {
    text-align: center;
    font-weight: 700;
    color: #f7faff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    margin-bottom: 12px;
}

.court-net {
    align-self: stretch;
    margin: 8px 0;
    background: linear-gradient(90deg, #e2e8f0, #ffffff 40%, #ffffff 60%, #e2e8f0);
    border-left: 3px solid #cbd5e1;
    border-right: 3px solid #cbd5e1;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.35);
    position: relative;
}

.court-net::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8%;
    bottom: 8%;
    width: 2px;
    margin-left: -1px;
    background: rgba(148, 163, 184, 0.6);
}

.court-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 118px);
    gap: 10px;
}

.zone {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    cursor: pointer;
    user-select: none;
    transition: transform 0.05s ease, border-color 0.15s ease, background 0.15s ease;
    position: relative;
}

.zone:active {
    transform: scale(0.99);
}

.zone.selected {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
}

.zone .zone-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.zone .player-number {
    font-size: clamp(2.25rem, 7vw, 3.5rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
}

.zone .zone-label {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 600;
}

.zone.server {
    border-color: #0d8f48;
    background: rgba(192, 252, 218, 0.95);
    box-shadow: 0 0 0 3px rgba(23, 154, 82, 0.34);
}

.zone.server::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.88) 0 12%, transparent 13%),
        radial-gradient(circle at 68% 72%, rgba(0, 0, 0, 0.12) 0 30%, transparent 31%),
        conic-gradient(
            from 12deg,
            #ffd847 0 18%,
            #2f63d0 18% 34%,
            #ffd847 34% 50%,
            #2f63d0 50% 66%,
            #ffd847 66% 82%,
            #2f63d0 82% 100%
        );
    border: 1.5px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        inset -1px -2px 4px rgba(20, 37, 76, 0.25),
        inset 1px 1px 3px rgba(255, 255, 255, 0.36),
        0 3px 8px rgba(13, 30, 66, 0.35);
    z-index: 2;
}

.serve-highlight {
    margin: 0 auto 14px;
    max-width: 720px;
    padding: 12px 16px;
    border-radius: 12px;
    background: linear-gradient(90deg, #ebfff4, #d5f9e4);
    border: 1px solid #72db9f;
    color: #0f7c40;
    font-weight: 800;
    font-size: 20px;
    text-align: center;
}

.sub-panel {
    margin: 16px auto;
    max-width: 640px;
    padding: 16px;
    background: #f9fbff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.sub-panel .sub-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    justify-content: center;
    margin-top: 10px;
}

.sub-panel label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #475569;
}

.sub-panel input[type="number"] {
    width: 100px;
}

.substitutions-card {
    padding: 20px 22px;
}

.substitutions-teams-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(148px, 190px) minmax(260px, 1fr);
    gap: 14px;
    align-items: stretch;
}

.substitutions-teams-grid.swapped .sub-team-panel--a {
    order: 3;
}

.substitutions-teams-grid.swapped .sub-history-panel {
    order: 2;
}

.substitutions-teams-grid.swapped .sub-team-panel--b {
    order: 1;
}

.substitutions-teams-grid.swapped .sub-history-panel__block--a {
    order: 2;
}

.substitutions-teams-grid.swapped .sub-history-panel__block--b {
    order: 1;
}

.sub-history-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    min-width: 0;
}

.sub-history-panel__head {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sub-history-panel__block {
    flex: 1;
    min-height: 0;
}

.sub-history-panel__team {
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 6px;
    padding: 4px 6px;
    border-radius: 6px;
}

.sub-history-panel__block--a .sub-history-panel__team {
    color: #1e40af;
    background: rgba(219, 232, 255, 0.9);
}

.sub-history-panel__block--b .sub-history-panel__team {
    color: #9a3412;
    background: rgba(255, 232, 219, 0.9);
}

.sub-history-panel__list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    line-height: 1.35;
}

.sub-history-item {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-weight: 600;
}

.sub-history-item:last-child {
    border-bottom: none;
}

.sub-history-item--empty {
    justify-content: center;
    color: #94a3b8;
    font-weight: 500;
}

.sub-history-item--rev .sub-history-line {
    color: #0f7c40;
}

.sub-history-score {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}

.sub-team-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 18px 18px;
    border-radius: 16px;
    border: 2px solid transparent;
    box-shadow: 0 10px 22px rgba(35, 69, 135, 0.08);
}

.sub-team-panel--a {
    background: linear-gradient(165deg, #eef4ff 0%, #dbe8ff 55%, #c8d9fb 100%);
    border-color: #7ba3e8;
}

.sub-team-panel--b {
    background: linear-gradient(165deg, #fff4ee 0%, #ffe8db 55%, #ffd9c8 100%);
    border-color: #e8a87c;
}

.sub-team-panel__title {
    margin: 0;
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
    font-weight: 800;
    text-align: center;
    color: #1e3a5f;
}

.sub-team-panel--b .sub-team-panel__title {
    color: #7c2d12;
}

.sub-team-panel__quota {
    margin: 0;
    text-align: center;
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    font-weight: 600;
    color: #334155;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 10px;
}

.sub-team-panel__row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
    justify-content: center;
}

.sub-team-panel__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 200px;
    min-width: 180px;
    max-width: 280px;
}

.sub-team-panel__label {
    font-size: 15px;
    font-weight: 700;
    color: #334155;
}

.sub-team-panel__select {
    width: 100%;
    padding: 14px 16px !important;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    font-size: 17px;
    font-weight: 600;
    background: #fff;
    min-height: 52px;
    box-sizing: border-box;
}

.sub-team-panel--a .sub-team-panel__select:focus {
    border-color: #3b6fc4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 111, 196, 0.25);
}

.sub-team-panel--b .sub-team-panel__select:focus {
    border-color: #c2410c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.2);
}

.sub-team-panel__submit {
    flex: 0 0 auto;
    padding: 14px 22px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    min-height: 52px;
    border-radius: 10px !important;
}

.sub-team-panel--a .sub-team-panel__submit {
    background: #1d4ed8;
}

.sub-team-panel--a .sub-team-panel__submit:hover:not(:disabled) {
    background: #1e40af;
}

.sub-team-panel--b .sub-team-panel__submit {
    background: #c2410c;
}

.sub-team-panel--b .sub-team-panel__submit:hover:not(:disabled) {
    background: #9a3412;
}

.sub-team-panel__hint {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.sub-team-panel--a .sub-team-panel__hint {
    background: rgba(255, 255, 255, 0.7);
    color: #1e40af;
    border: 1px solid #93b4e8;
}

.sub-team-panel--b .sub-team-panel__hint {
    background: rgba(255, 255, 255, 0.7);
    color: #9a3412;
    border: 1px solid #e8a87c;
}

.sub-team-panel__hint--reverse {
    background: #ebfff4 !important;
    border-color: #72db9f !important;
    color: #0f7c40 !important;
}

@media (max-width: 1050px) {
    .substitutions-teams-grid {
        grid-template-columns: 1fr;
    }
}

.penalties-card {
    padding: 16px 18px;
}

.penalties-teams-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 12px;
    align-items: stretch;
}

.penalties-teams-grid.swapped .pen-team-panel--a {
    order: 2;
}

.penalties-teams-grid.swapped .pen-team-panel--b {
    order: 1;
}

.pen-team-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 12px;
    border-radius: 12px;
    border: 2px solid transparent;
    box-shadow: 0 6px 14px rgba(35, 69, 135, 0.06);
}

.pen-team-panel--a {
    background: linear-gradient(165deg, #eef4ff 0%, #e8f0fc 100%);
    border-color: #93b4e8;
}

.pen-team-panel--b {
    background: linear-gradient(165deg, #fff4ee 0%, #ffebe3 100%);
    border-color: #e8a87c;
}

.pen-team-panel__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    text-align: center;
    color: #1e3a5f;
}

.pen-team-panel--b .pen-team-panel__title {
    color: #7c2d12;
}

.pen-team-panel__row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    justify-content: center;
}

.pen-team-panel__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 130px;
    min-width: 120px;
    max-width: 200px;
}

.pen-team-panel__label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.pen-team-panel__select {
    width: 100%;
    padding: 9px 10px !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    min-height: 38px;
    box-sizing: border-box;
}

.pen-team-panel__submit {
    flex: 0 0 auto;
    padding: 9px 14px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    min-height: 38px;
    border-radius: 8px !important;
    border: none;
    color: #fff;
    cursor: pointer;
}

.pen-team-panel--a .pen-team-panel__submit {
    background: #1d4ed8;
}

.pen-team-panel--a .pen-team-panel__submit:hover:not(:disabled) {
    background: #1e40af;
}

.pen-team-panel--b .pen-team-panel__submit {
    background: #c2410c;
}

.pen-team-panel--b .pen-team-panel__submit:hover:not(:disabled) {
    background: #9a3412;
}

.pen-team-panel__submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 720px) {
    .penalties-teams-grid {
        grid-template-columns: 1fr;
    }
}

.compact-actions-card {
    padding: 14px 16px;
}

.compact-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 8px;
    align-items: start;
}

.compact-actions-card .sub-panel {
    margin: 0;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
}

.compact-actions-card .sub-panel .sub-row {
    margin-top: 4px;
    gap: 6px;
    justify-content: flex-start;
}

.compact-actions-card label {
    font-size: 11px;
    gap: 2px;
}

.compact-actions-card input[type="number"] {
    width: 68px;
    padding: 6px 8px;
}

.compact-actions-card select {
    padding: 6px 8px !important;
    min-height: 32px;
}

.compact-actions-card button {
    padding: 7px 10px;
    font-size: 12px;
    min-height: 32px;
}

@media (max-width: 980px) {
    .compact-actions-grid {
        grid-template-columns: 1fr;
    }
}

.sub-notice {
    margin-top: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #ebfff4;
    color: #106f3b;
    font-weight: 600;
    text-align: center;
    display: none;
}

.sub-notice.visible {
    display: block;
}

.series-score-strip {
    margin-top: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #edf3ff;
    border: 1px solid #b5caf7;
    color: #1f3d73;
    font-weight: 600;
    font-size: 16px;
}

.event-log-wrap {
    max-height: 420px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    color: var(--primary-strong);
    text-decoration: underline;
}

.event-log-table {
    font-size: 13px;
}

.event-log-table th,
.event-log-table td {
    white-space: nowrap;
}

.event-log-table td:nth-child(4) {
    white-space: normal;
    max-width: 280px;
}

.referees-table .ref-col-type {
    width: 19%;
}

.referees-table .ref-col-name {
    width: 20%;
}

.referees-table .ref-col-city {
    width: 16%;
}

.referees-table .ref-col-sign {
    width: 38%;
}

.referees-table .ref-col-del {
    width: 7%;
    text-align: center;
}

.referees-table .ref-role,
.referees-table .ref-name,
.referees-table .ref-city {
    width: 100%;
    padding: 6px 8px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.ref-sign-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 52px;
    justify-content: center;
}

.ref-sign-cell .ref-sign-na {
    font-size: 12px;
    color: var(--text-soft);
}

.ref-sign-cell .ref-sign-canvas,
.ref-sign-cell .ref-sign-clear {
    display: none;
}

.ref-sign-cell--active .ref-sign-na {
    display: none;
}

.ref-sign-cell--active .ref-sign-canvas,
.ref-sign-cell--active .ref-sign-clear {
    display: block;
}

.signature-canvas--compact {
    width: 100%;
    max-width: 200px;
    height: 72px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    touch-action: none;
}

.btn-signature-clear {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 8px;
    background: var(--surface-muted);
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.btn-signature-clear:hover {
    background: #e8eef8;
}

@media (max-width: 768px) {
    .court {
        grid-template-columns: 1fr;
    }
    .court-net {
        display: none;
    }
    .court-grid {
        grid-template-rows: repeat(2, 96px);
    }

    .zone .player-number {
        font-size: clamp(2rem, 12vw, 2.75rem);
    }
}

