/* Mobile-friendly scorecard: sticky header + compact layout */

html {
    scroll-padding-top: 0;
}

body {
    -webkit-overflow-scrolling: touch;
}

.scorecard-page {
    max-width: 100%;
}

.scorecard-page .card {
    overflow: visible;
}

.scorecard-page .card-body {
    overflow: visible;
    padding: 0.75rem;
}

.scorecard-page .card-header {
    padding: 0.65rem 0.75rem;
}

.scorecard-page .card-header p {
    font-size: 0.9rem;
    line-height: 1.3;
}

.scorecard-table {
    --scorecard-extra-cols: 1;
    margin-bottom: 0;
    width: 100%;
    table-layout: auto;
}

.scorecard-table > :not(caption) > * > * {
    padding: 0.5rem 0.4rem;
    vertical-align: middle;
}

/* Sticky header — original light look */
.scorecard-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background-color: #fff;
    color: inherit;
    font-weight: 600;
    box-shadow: inset 0 -1px 0 #dee2e6;
}

/* Hole + Par: shrink to title width */
.scorecard-table thead th:first-child,
.scorecard-table tbody td:first-child,
.scorecard-table thead th:nth-child(2),
.scorecard-table tbody td:nth-child(2) {
    width: 1%;
    white-space: nowrap;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}

/* Remaining columns: all equal */
.scorecard-table thead th:nth-child(n+3),
.scorecard-table tbody td:nth-child(n+3) {
    width: calc(99% / var(--scorecard-extra-cols));
    white-space: normal;
    word-break: break-word;
}

.scorecard-table tbody td {
    font-size: 0.95rem;
}

.scorecard-table .score-input {
    width: 100%;
    max-width: 5rem;
    margin: 0 auto;
    padding: 0.25rem 0.35rem;
    font-size: 0.9rem;
}

.scorecard-table .edit-button,
.scorecard-table .save-button {
    padding: 0.3rem 0.45rem;
}

.scorecard-page .card-footer {
    padding: 0.75rem;
}

@media (max-width: 768px) {
    .scorecard-page.container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin-top: 0.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    .scorecard-page .card {
        border-radius: 0.5rem;
    }

    .scorecard-table thead th {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .scorecard-table tbody td {
        font-size: 0.85rem;
    }
}

@supports (padding: max(0px)) {
    .scorecard-page {
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    }
}
