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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: white;
    text-align: center;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.setup-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
    background: #f8f9fa;
}

.player-setup, .game-setup {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.players-header h4 {
    margin: 0;
}

.clear-names-btn {
    background: #ff9800;
    font-size: 14px;
    padding: 8px 15px;
}

.clear-names-btn:hover {
    background: #f57c00;
}

.player-setup h3, .game-setup h3 {
    color: #2E7D32;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.add-player {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    }
    
.add-player input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.add-player input:focus {
    outline: none;
    border-color: #4CAF50;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

button:hover {
    background: #45a049;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(33, 150, 243, 0.35);
    outline-offset: 2px;
}

.reset-btn {
    background: #f44336;
}

.reset-btn:hover {
    background: #da190b;
}

.players-list ul {
    list-style: none;
}

.players-list li {
    background: #e8f5e8;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-player {
    background: #f44336;
    padding: 5px 10px;
    font-size: 12px;
}

.remove-player:hover {
    background: #da190b;
}

.game-setup label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #333;
}

.game-setup input,
.game-setup select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.scorecard {
    padding: 30px;
}

.scorecard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.game-details h2 {
    color: #2E7D32;
    font-size: 2rem;
    margin-bottom: 4px;
}

.game-details p {
    color: #555;
    font-weight: bold;
}

.scorecard-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.back-btn {
    background: #2196F3;
}

.back-btn:hover {
    background: #1976D2;
}

.share-btn {
    background: #673AB7;
}

.share-btn:hover {
    background: #512DA8;
}

.standings-slot {
    margin-bottom: 20px;
}

.live-standings {
    margin: 0;
    padding: 20px;
    background: #f3faf4;
    border: 1px solid #d7ead9;
    position: sticky;
    top: 10px;
    z-index: 20;
    transition: padding 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.live-standings.is-compact {
    position: fixed;
    left: 50%;
    top: 10px;
    width: min(calc(100% - 80px), 1140px);
    padding: 12px 16px;
    border-color: #b8dabb;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    transform: translateX(-50%);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.live-standings.is-compact .summary-header {
    margin-bottom: 8px;
}

.summary-header h3 {
    margin: 0;
}

.live-standings.is-compact .summary-header h3 {
    font-size: 1.05rem;
    text-align: left;
}

.round-progress {
    color: #2E7D32;
    font-size: 0.95rem;
    font-weight: bold;
    white-space: nowrap;
}

.live-standings.is-compact .round-progress {
    font-size: 0.85rem;
}
    
.scorecard-table-container {
    overflow-x: auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 15px 10px;
    text-align: center;
    border: 1px solid #ddd;
}

th {
    background: #4CAF50;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.hole-header {
    background: #2E7D32 !important;
}

tbody tr:nth-child(even) {
    background: #f8f9fa;
}

tbody tr:hover {
    background: #e8f5e8;
}

.score-input {
    width: 58px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 16px;
}

.score-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.par-input {
    width: 58px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 16px;
    background-color: #fff3cd;
    border-color: #ffc107;
}

.par-input:focus {
    outline: none;
    border-color: #e0a800;
}

.score-control {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.number-stepper {
    display: inline-grid;
    grid-template-columns: 36px 58px 36px;
    gap: 6px;
    align-items: center;
}

.stepper-btn,
.quick-score-btn {
    border-radius: 6px;
    padding: 0;
    font-weight: bold;
}

.stepper-btn {
    width: 36px;
    height: 36px;
    background: #eef6ef;
    color: #2E7D32;
    border: 1px solid #cfe5d1;
}

.stepper-btn:hover {
    background: #dceddd;
}

.quick-score-row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.quick-score-btn {
    width: 30px;
    height: 30px;
    background: #ffffff;
    color: #2E7D32;
    border: 1px solid #cfe5d1;
    font-size: 14px;
}

.quick-score-btn:hover {
    background: #e8f5e8;
}

.quick-score-btn.is-selected {
    background: #2E7D32;
    border-color: #2E7D32;
    color: white;
}

.quick-score-btn.is-selected:hover {
    background: #276b2b;
}

tfoot td {
    background: #2E7D32;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
}

.summary {
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
}

.summary h3 {
    color: #2E7D32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

.results-item {
    background: white;
    padding: 15px;
    margin: 8px 0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.live-standings.is-compact #results {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.live-standings.is-compact .results-item {
    flex: 0 0 auto;
    min-width: 230px;
    padding: 10px 12px;
    margin: 0;
    font-size: 0.9rem;
}

.live-standings.is-compact .empty-results {
    margin: 0;
    text-align: left;
}

.leader {
    border-left: 6px solid #F7931E;
    font-weight: bold;
}

.empty-results {
    color: #666;
    font-style: italic;
    text-align: center;
}

.mobile-scorecard {
    display: none;
}

.hole-card {
    background: white;
    border: 1px solid #dfe8df;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 14px;
    overflow: hidden;
}

.hole-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #f3faf4;
    border-bottom: 1px solid #dfe8df;
}

.hole-card-header h3 {
    color: #2E7D32;
    font-size: 1.2rem;
}

.hole-card-header label {
    display: grid;
    gap: 5px;
    justify-items: end;
    color: #333;
    font-weight: bold;
}

.mobile-player-list {
    display: grid;
}

.mobile-player-score {
    display: grid;
    grid-template-columns: minmax(90px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px;
    border-top: 1px solid #edf1ed;
}

.mobile-player-score:first-child {
    border-top: 0;
}

.mobile-player-score strong,
.mobile-player-score span {
    display: block;
}

.mobile-player-score span {
    color: #607060;
    font-size: 0.9rem;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .setup-section {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .add-player {
        flex-direction: column;
    }
    
    .scorecard-header {
        flex-direction: column;
        gap: 15px;
    }

    .scorecard {
        padding: 20px;
    }

    .scorecard-buttons {
        width: 100%;
    }

    .scorecard-buttons button {
        flex: 1;
        padding-left: 12px;
        padding-right: 12px;
    }

    .summary-header,
    .results-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .live-standings.is-compact .summary-header {
        align-items: center;
        flex-direction: row;
        margin-bottom: 6px;
    }

    .live-standings.is-compact .results-item {
        min-width: 190px;
    }

    .round-progress {
        white-space: normal;
    }

    .scorecard-table-container {
        display: none;
    }

    .mobile-scorecard {
        display: block;
    }
}

@media (max-width: 480px) {
    body {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .container {
        border-radius: 12px;
    }

    .scorecard {
        padding: 16px 12px;
    }

    .live-standings {
        padding: 16px;
        top: 8px;
    }

    .live-standings.is-compact {
        width: calc(100% - 33px);
        padding: 10px 12px;
    }

    .live-standings.is-compact .summary-header h3 {
        font-size: 0.95rem;
    }

    .live-standings.is-compact .round-progress {
        font-size: 0.78rem;
    }

    .live-standings.is-compact .results-item {
        min-width: 170px;
        padding: 8px 10px;
    }

    .mobile-player-score {
        grid-template-columns: max-content minmax(0, 1fr);
        align-items: start;
        column-gap: 8px;
    }

    .mobile-player-score .score-control {
        display: contents;
    }

    .mobile-player-score .number-stepper {
        grid-column: 1;
        grid-row: 2;
        grid-template-columns: 38px 56px 38px;
        gap: 5px;
        justify-self: start;
        margin-top: 10px;
    }

    .mobile-player-score .stepper-btn {
        width: 38px;
    }

    .mobile-player-score .score-input {
        width: 56px;
    }

    .quick-score-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: stretch;
        align-content: stretch;
        justify-content: stretch;
        gap: 6px;
        width: 100%;
    }

    .quick-score-btn {
        width: 100%;
        height: 100%;
        min-height: 30px;
    }
}

@media (max-width: 320px) {
    header h1 {
        font-size: 1.3rem;
        line-height: 1.2;
    }
}
