* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #10141c;
    color: #e8ebf0;
}

.topbar {
    background: #171c28;
    padding: 16px 24px;
    border-bottom: 1px solid #2a3142;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.logo {
    color: #fff;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
}

.admin-status {
    font-size: 0.85rem;
    color: #7f889c;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

h1, h2, h3 { color: #fff; }

a { color: #6aa9ff; }

.card {
    background: #171c28;
    border: 1px solid #2a3142;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.highlight-card {
    background: linear-gradient(135deg, #2f6fed22, #171c28);
    border-color: #2f6fed55;
}

.highlight-label {
    color: #6aa9ff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    margin: 0 0 8px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 700px) {
    .grid-2 { grid-template-columns: 1fr; }
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #2a3142;
}

th { color: #9aa4b8; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-grupos { background: #3b3320; color: #f0c674; }
.badge-mata_mata { background: #3a2432; color: #f28fb0; }
.badge-finalizado { background: #1f3a2a; color: #7fd99f; }

.btn {
    display: inline-block;
    background: #2f6fed;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #2660d4; }

.btn-secondary {
    background: #2a3142;
}
.btn-secondary:hover { background: #38415a; }

.btn-small {
    padding: 5px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: #b3392e;
}
.btn-danger:hover { background: #d1453a; }

label {
    display: block;
    margin: 14px 0 6px;
    color: #cdd3e0;
}

input[type=text], input[type=date], input[type=number], textarea, select {
    width: 100%;
    padding: 9px 10px;
    background: #10141c;
    border: 1px solid #2a3142;
    border-radius: 6px;
    color: #e8ebf0;
    font-size: 1rem;
}

textarea { min-height: 90px; resize: vertical; }

.format-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #10141c;
    border: 1px solid #2a3142;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 10px;
    cursor: pointer;
}

.format-option input {
    width: auto;
    margin-top: 3px;
}

.format-option:has(input:checked) {
    border-color: #2f6fed;
    background: #2f6fed15;
}

.checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #10141c;
    border: 1px solid #2a3142;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0;
    width: auto;
}

.checkbox-list input { width: auto; }

.add-player-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.add-player-row input[type=text] {
    width: auto;
    flex: 1;
}

.winner-radios {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.winner-radio {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #10141c;
    border: 2px solid #2a3142;
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 600;
    user-select: none;
    transition: background 0.1s, border-color 0.1s, transform 0.05s;
}

.winner-radio input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.winner-radio:active {
    transform: scale(0.96);
}

.winner-radio:has(input:checked) {
    background: #2f6fed;
    border-color: #2f6fed;
    color: #fff;
}

.jogo-num {
    display: inline-block;
    color: #7f889c;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 4px;
}

.link-danger {
    color: #e08074;
    font-size: 0.9rem;
}

.match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    scroll-margin-top: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #2a3142;
    flex-wrap: wrap;
}

.match-row form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-row select, .match-row input[type=number] {
    width: auto;
}

.balls-field {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #9aa4b8;
    white-space: nowrap;
}

.stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #2a3142;
    border-radius: 8px;
    overflow: hidden;
}

.stepper-btn {
    background: #2a3142;
    color: #e8ebf0;
    border: none;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.stepper-btn:hover { background: #38415a; }
.stepper-btn:active { background: #465071; }

.stepper input[type=number] {
    width: 48px;
    height: 40px;
    padding: 0;
    text-align: center;
    border: none;
    border-left: 1px solid #2a3142;
    border-right: 1px solid #2a3142;
    border-radius: 0;
    font-size: 1.1rem;
    -moz-appearance: textfield;
}

.stepper input[type=number]::-webkit-outer-spin-button,
.stepper input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.tag-grupo {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 6px;
    vertical-align: middle;
}

.tag-g1 { background: #1c2e4a; color: #6aa9ff; }
.tag-g2 { background: #3a2432; color: #f28fb0; }
.tag-g3 { background: #1f3a2a; color: #7fd99f; }
.tag-g4 { background: #3b3320; color: #f0c674; }
.tag-g5 { background: #331f3a; color: #c98af2; }
.tag-g6 { background: #123a3a; color: #6cd9d9; }
.tag-g7 { background: #3a2a12; color: #f2a55c; }
.tag-g8 { background: #2a123a; color: #d16cf2; }

.result-done {
    color: #7fd99f;
    font-weight: 600;
}

.champion-banner {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #2f6fed33, #f0c67433);
    border-radius: 12px;
    margin-bottom: 24px;
}

.champion-banner h2 { font-size: 2rem; margin: 0; }

.error {
    background: #3a2020;
    color: #f0a0a0;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.empty {
    color: #7f889c;
    font-style: italic;
}

@media (max-width: 600px) {
    .container { padding: 14px; }
    .topbar { padding: 14px 16px; }
    .card { padding: 14px; }

    .match-row {
        flex-direction: column;
        align-items: stretch;
    }

    .match-row form {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .match-row .winner-radios {
        flex-direction: column;
        width: 100%;
    }

    .match-row .winner-radio {
        width: 100%;
        padding: 12px 14px;
    }

    .match-row .balls-field {
        width: 100%;
        justify-content: space-between;
    }

    .stepper-btn {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .stepper input[type=number] {
        width: 56px;
        height: 48px;
        font-size: 1.2rem;
    }

    .match-row .btn,
    .match-row .btn-secondary {
        width: 100%;
        text-align: center;
    }

    table { font-size: 0.9rem; }
    th, td { padding: 8px 6px; }

    .champion-banner { padding: 20px; }
    .champion-banner h2 { font-size: 1.5rem; }
}
