* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Quicksand', sans-serif;
    background-color: #1e4022;
    color: #fff;
    padding: 1rem;
}

.container {
    max-width: 700px;
    margin: auto;
    background-color: #2f5335;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}

h1,
h2 {
    text-align: center;
    color: #eac77a;
}

.player-inputs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.warning-message {
    color: #fca5a5;
    font-weight: bold;
    text-align: center;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.player-card {
    background-color: #3c6b44;
    border: 2px solid #598c5c;
    border-radius: 8px;
    padding: 0.8rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    width: calc(50% - 10px);
    margin: 5px;
    box-sizing: border-box;
}

.player-card h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: #fff;
    font-size: 1rem;
}

.player-card input.player-name {
    width: calc(100% - 1rem);
    background-color: #2f5335;
    color: #fff;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    margin: 0 auto;
    display: block;
}

.control-group {
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.control-group label {
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.control-group .controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.control-group button:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

.secondary-btn {
    background-color: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--dark-green);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid var(--gold);
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--gold);
}

.close {
    color: var(--gold);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.history-item {
    padding: 1rem;
    border: 1px solid rgba(212, 175, 55, 0.3);
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background-color: rgba(212, 175, 55, 0.1);
}

.history-item .game-name {
    font-weight: bold;
    color: var(--gold);
}

.history-item .game-players {
    font-size: 0.8rem;
    opacity: 0.8;
}

.control-group button {
    background-color: #d6ad60;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    border-radius: 6px;
    color: #1e4022;
    font-weight: bold;
    cursor: pointer;
    min-width: 28px;
}

.control-group button:hover {
    background-color: #eac77a;
}

.control-group .value {
    min-width: 1.5rem;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}

#next-round {
    background-color: #d6ad60;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 8px;
    color: #1e4022;
    font-weight: bold;
    cursor: pointer;
    display: block;
    width: fit-content;
    margin: 0;
}

.undo-btn {
    background-color: #e08e79;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 8px;
    color: #1e4022;
    font-weight: bold;
    cursor: pointer;
    display: block;
    width: fit-content;
    margin: 0;
}

.undo-btn:hover {
    background-color: #e89f8c;
}

.undo-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

#next-round:hover {
    background-color: #eac77a;
}

.scoreboard {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

.round-block {
    margin-bottom: 2rem;
    border: 2px solid #598c5c;
    border-radius: 8px;
    overflow: hidden;
    background-color: #3c6b44;
    width: 100%;
    max-width: 500px;
    overflow-x: auto;
}

.round-label {
    font-weight: bold;
    color: #f6e27a;
    text-align: center;
    margin: 0;
    padding: 0.8rem;
    background-color: #4e7c57;
}

.round-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #3c6b44;
    table-layout: fixed;
}

.round-table th,
.round-table td {
    padding: 0.4rem 0.1rem;
    text-align: center;
    border-bottom: 1px solid #598c5c;
    font-size: 1.1rem;
    width: 20%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.round-table th:first-child,
.round-table td:first-child {
    width: 25%;
}

.round-table th:not(:first-child),
.round-table td:not(:first-child) {
    width: 18.75%;
}

.round-table thead {
    background-color: #4e7c57;
}

.round-table th {
    font-weight: bold;
    color: #fff;
}

.round-table td.total {
    font-weight: bold;
    color: #f6e27a;
}

.current-round-header {
    font-weight: bold;
    color: #f6e27a;
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* ------------------------------------------------------------- */
/* AJUSTES ESPECÍFICOS PARA MÓVILES (max-width: 600px) */
/* ------------------------------------------------------------- */
@media (max-width: 600px) {

    .player-card {
        padding: 0.7rem;
    }

    .player-card h3 {
        font-size: 0.95rem;
        margin-bottom: 0.6rem;
    }

    .player-card input.player-name {
        font-size: 0.95rem;
    }

    .control-group {
        margin-bottom: 0.6rem;
    }

    .control-group .controls {
        gap: 0.4rem;
    }

    .control-group button {
        padding: 0.35rem 0.55rem;
        min-width: 26px;
        font-size: 0.95rem;
    }

    .control-group .value {
        min-width: 1.3rem;
        font-size: 0.95rem;
    }

    /* Ajustes para la tabla en móviles */
    .round-block {
        max-width: 100%;
    }

    .round-table th,
    .round-table td {
        font-size: 1.2rem;
        padding: 0.35rem 0.05rem;
    }

    #next-round,
    .undo-btn {
        width: auto;
        flex: 1;
        font-size: 1rem;
        padding: 0.8rem 0.5rem;
    }
}

/* Chart Modal Light Theme */
#chart-modal .modal-content {
    background-color: #ffffff;
    color: #1e4022;
}

#chart-modal .modal-header {
    border-bottom: 1px solid rgba(30, 64, 34, 0.2);
}

#chart-modal h3,
#chart-modal .close {
    color: #1e4022;
}