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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0b2b1f 0%, #1a4a2f 100%);
    min-height: 100vh;
    padding: 20px;
}

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

.card {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

button {
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

button:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

input, select {
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.flag-icon {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.equipo-con-bandera {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.header {
    background: #0a2a1f;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-radius: 24px 24px 0 0;
}

.logo h1 {
    font-size: 1.6rem;
}

.logo span {
    color: #f5c542;
}

.user-info {
    background: #1e4a2f;
    padding: 8px 16px;
    border-radius: 40px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-ranking {
    background: #f5c542;
    color: #0a2a1f;
    border: none;
    padding: 6px 12px;
    border-radius: 30px;
    cursor: pointer;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    background: #e9ecef;
    border-bottom: 2px solid #cbd5e1;
}

.tab-btn {
    background: none;
    border: none;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #2d3e2b;
}

.tab-btn.active {
    background: white;
    border-bottom: 3px solid #f5c542;
    color: #0a5c2e;
}

.tab-pane {
    display: none;
    padding: 2rem;
    background: white;
    border-radius: 0 0 24px 24px;
}

.tab-pane.active {
    display: block;
}

.grupos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card-grupo {
    background: #f8fafc;
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-left: 8px solid #f5c542;
    overflow-x: auto;
}

.tabla-posiciones {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.tabla-posiciones th,
.tabla-posiciones td {
    padding: 6px 4px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

.tabla-posiciones th {
    background: #e9ecef;
    text-align: left;
}

.fila-clasificado-directo {
    background-color: #d4edda !important;
}
.fila-opcion-tercero {
    background-color: #fff3cd !important;
}
.fila-normal {
    background-color: #ffffff;
}

.partidos-lista {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.partido-card {
    background: #f8fafc;
    border-radius: 20px;
    padding: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.partido-header {
    font-size: 0.85rem;
    color: #0a5c2e;
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

.partido-cuerpo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.equipo-local, .equipo-visitante {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    min-width: 140px;
}

.marcador-inputs {
    display: flex;
    gap: 10px;
    align-items: center;
}

.marcador-inputs input {
    width: 70px;
    text-align: center;
}

.resultado-info {
    font-size: 0.8rem;
    color: #555;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.btn-guardar {
    background: #f5c542;
    border: none;
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: bold;
}

.btn-guardar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.estado-sin-jugar { color: #d9534f; }
.estado-terminado { color: #5cb85c; }

@media (max-width: 768px) {
    .partido-cuerpo {
        flex-direction: column;
        align-items: stretch;
    }
    .equipo-local, .equipo-visitante {
        justify-content: center;
    }
    .marcador-inputs {
        justify-content: center;
    }
    .resultado-info {
        flex-direction: column;
        align-items: center;
    }
}

.simulacion-container {
    margin-top: 20px;
}
.simulacion-grupo {
    margin-bottom: 30px;
}
.simulacion-tabla {
    width: 100%;
    border-collapse: collapse;
}
.simulacion-tabla th, .simulacion-tabla td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
}
.simulacion-tabla th {
    background-color: #f2f2f2;
}
.lista-terceros {
    background: #f8fafc;
    border-radius: 16px;
    padding: 12px;
    margin-top: 20px;
}
.resaltado-tercero {
    background-color: #fff3cd;
    padding: 4px;
    border-radius: 8px;
}

.goleador-area {
    text-align: center;
    padding: 20px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 90vw;
    max-height: 85vh;
    overflow: auto;
    padding: 1rem;
    resize: both;
    min-width: 300px;
    min-height: 200px;
}

.bracket-container {
    overflow-x: auto;
    padding: 20px;
}
.bracket {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: nowrap;
    min-width: fit-content;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 220px;
}
.bracket-match {
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px;
    border-left: 4px solid #f5c542;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 0.8rem;
}
.bracket-match .equipos {
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.bracket-match .resultado {
    text-align: center;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #555;
}
.bracket-match .fecha {
    font-size: 0.7rem;
    color: #777;
    text-align: center;
    margin-top: 4px;
}
@media (max-width: 768px) {
    .bracket {
        flex-direction: column;
        gap: 20px;
    }
    .bracket-round {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

.welcome-container {
    min-height: 80vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    border-radius: 32px;
    position: relative;
    padding: 2rem;
    background-color: #0a2a1f;
}

.welcome-logo {
    max-width: 200px;
    margin-bottom: 2rem;
}

.welcome-title {
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.btn-reglas {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #f5c542;
    color: #0a2a1f;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 100;
}

.btn-reglas:hover {
    transform: scale(1.05);
    background: #e0b032;
}

.modal-reglas {
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    .grupos-grid {
        grid-template-columns: 1fr;
    }
    .btn-reglas {
        bottom: 15px;
        right: 15px;
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}
