body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 10px;
}

.container {
    max-width: 800px; /* Increased for wider tables */
    margin: 0 auto;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

h1 {
    color: #333;
    font-size: 1.8em;
    margin-bottom: 10px;
}

h2 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 10px;
}

h3 {
    color: #333;
    font-size: 1.2em;
    margin-bottom: 10px;
}

p {
    color: #555;
    font-size: 14px;
    margin-bottom: 20px;
}

.section-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-button {
    display: block;
    padding: 10px;
    font-size: 16px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.section-button:hover {
    background-color: #0056b3;
}

.section-button.active {
    background-color: #0056b3;
    font-weight: bold;
}

.section-button.disabled {
    background-color: #6c757d;
    cursor: not-allowed;
}

.admin-nav, .stats-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.team-setup {
    margin-bottom: 15px;
    text-align: center;
}

.team-input {
    margin: 10px 0;
}

.team-input h3 {
    margin: 10px 0 5px;
    color: #007bff;
    font-size: 1.2em;
}

.team-input input, .team-input select {
    padding: 8px;
    font-size: 14px;
    margin: 5px;
    width: 180px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.team-setup button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px;
}

.team-setup #resetGame {
    background-color: #dc3545;
}

.team-setup button:hover {
    background-color: #218838;
}

.team-setup #resetGame:hover {
    background-color: #c82333;
}

.team-input #newPlayerName {
    width: 150px;
    display: inline-block;
}

.team-input #newPlayerName + button {
    background-color: #007bff;
}

.team-input #newPlayerName + button:hover {
    background-color: #0056b3;
}

.season-selector {
    margin-bottom: 15px;
    text-align: center;
}

.season-selector label {
    display: inline-block;
    width: 100px;
    text-align: right;
    margin-right: 10px;
    font-size: 14px;
}

.season-selector select {
    padding: 8px;
    font-size: 14px;
    width: 190px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

th, td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: center;
    font-size: 14px;
}

th {
    background-color: #007bff;
    color: white;
    cursor: pointer;
}

th:hover {
    background-color: #0056b3;
}

td.frame-row {
    font-weight: bold;
}

td.total-row {
    background-color: #e9ecef;
    font-weight: bold;
}

.even-frame {
    background-color: #f0f0f0;
}

.odd-frame {
    background-color: #ffffff;
}

td input[type="number"] {
    padding: 4px;
    font-size: 14px;
    width: 50px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

td input[type="number"]:invalid {
    border-color: #dc3545;
}

td select {
    padding: 4px;
    font-size: 14px;
    width: 100px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#gameSummary {
    margin-top: 15px;
    padding: 10px;
    background-color: #e9ecef;
    border-radius: 4px;
    text-align: center;
}

.leaderboard-item {
    padding: 5px;
    font-size: 14px;
}

.error {
    color: #dc3545;
    font-size: 12px;
    margin: 5px 0;
}

.message {
    font-size: 12px;
    margin: 5px 0;
    text-align: center;
}

.message.success {
    color: #28a745;
}

.message.error {
    color: #dc3545;
}

#saveGameBtn {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px auto;
    display: block;
}

#saveGameBtn:hover {
    background-color: #0056b3;
}

#teamTable, #seasonTable, #playerScoresTable, #teamScoresTable, #playerMarksTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

#teamTable th, #teamTable td, #seasonTable th, #seasonTable td,
#playerScoresTable th, #playerScoresTable td, #teamScoresTable th, #teamScoresTable td,
#playerMarksTable th, #playerMarksTable td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: center;
    font-size: 14px;
}

#teamTable th, #seasonTable th, #playerScoresTable th, #teamScoresTable th, #playerMarksTable th {
    background-color: #007bff;
    color: white;
}

#teamTable td, #seasonTable td, #playerScoresTable td, #teamScoresTable td, #playerMarksTable td {
    background-color: #ffffff;
}

#teamTable button, #seasonTable button {
    padding: 4px 8px;
    font-size: 12px;
    margin: 2px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#teamTable button:first-child, #seasonTable button:first-child {
    background-color: #28a745;
    color: white;
}

#teamTable button:first-child:hover, #seasonTable button:first-child:hover {
    background-color: #218838;
}

#teamTable button:last-child, #seasonTable button:last-child {
    background-color: #dc3545;
    color: white;
}

#teamTable button:last-child:hover, #seasonTable button:last-child:hover {
    background-color: #c82333;
}

#teamForm, #seasonForm, #currentSeasonForm, #currentWeekForm {
    margin-bottom: 15px;
    text-align: center;
}

#teamForm input[type="text"], #seasonForm input[type="text"], #currentWeekForm input[type="number"] {
    padding: 8px;
    font-size: 14px;
    margin: 5px;
    width: 180px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#currentSeasonForm select {
    padding: 8px;
    font-size: 14px;
    margin: 5px;
    width: 190px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#teamForm button, #seasonForm button, #currentSeasonForm button, #currentWeekForm button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 5px;
}

#teamForm button:hover, #seasonForm button:hover, #currentSeasonForm button:hover, #currentWeekForm button:hover {
    background-color: #0056b3;
}

#currentSeasonForm label, #currentWeekForm label {
    display: inline-block;
    width: 120px;
    text-align: right;
    margin-right: 10px;
    font-size: 14px;
}

@media (max-width: 600px) {
    .container {
        padding: 8px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 4px;
    }

    td input[type="number"] {
        width: 40px;
        font-size: 12px;
    }

    td select {
        width: 80px;
        font-size: 12px;
    }

    .team-input input, .team-input select {
        width: 140px;
        font-size: 12px;
    }

    .team-input #newPlayerName {
        width: 120px;
    }

    .season-selector select {
        width: 150px;
        font-size: 12px;
    }

    .season-selector label {
        width: 80px;
        font-size: 12px;
    }

    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.2em;
    }

    .section-button {
        font-size: 14px;
        padding: 8px;
    }

    #saveGameBtn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .message {
        font-size: 10px;
    }

    #teamTable, #seasonTable, #playerScoresTable, #teamScoresTable, #playerMarksTable {
        font-size: 12px;
    }

    #teamTable th, #teamTable td, #seasonTable th, #seasonTable td,
    #playerScoresTable th, #playerScoresTable td, #teamScoresTable th, #teamScoresTable td,
    #playerMarksTable th, #playerMarksTable td {
        padding: 4px;
    }

    #teamForm input[type="text"], #seasonForm input[type="text"], #currentWeekForm input[type="number"] {
        width: 140px;
        font-size: 12px;
    }

    #currentSeasonForm select {
        width: 150px;
        font-size: 12px;
    }

    #teamForm button, #seasonForm button, #currentSeasonForm button, #currentWeekForm button {
        font-size: 12px;
        padding: 6px 12px;
    }

    #currentSeasonForm label, #currentWeekForm label {
        width: 100px;
        font-size: 12px;
    }

    .admin-nav, .stats-nav {
        gap: 8px;
    }
}

.game-code {
    font-family: 'Consolas', 'Courier New', 'Monaco', monospace;
    font-size: 16px;
    letter-spacing: 2px; /* Improves readability */
}

/* Hide spinner arrows on number inputs for score and hundos fields */
/* Chrome, Safari, Edge, Opera */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

/* Added styles for score and hundos inputs */
.score-input {
    padding: 4px;
    font-size: 14px;
    width: 50px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.hundos-input {
    padding: 4px;
    font-size: 14px;
    width: 30px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.live-scoreboard-container {
    max-width: none;
    width: 100%;
    padding: 20px;
}

.live-scoreboard-container h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.live-scoreboard-container table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.live-scoreboard-container td, .live-scoreboard-container th {
    font-size: 40px;
    padding: 10px;
    text-align: center;
}

.live-scoreboard-container td[colspan="2"] {
    font-weight: bold;
    text-align: left;
    padding-left: 40px;
}

.live-scoreboard-container tr.empty-row td {
    font-size: 12px;
    padding: 10px 0;
    background: transparent;
    border: none;
    height: 10px;
}
