html {
    scroll-behavior: smooth;
    scroll-padding-top: 110px;
    font-family: sans-serif;
    background: #fdfdfd;
}
body {
    margin: 0;
    padding: 0;
}
.court-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #f8f9fa;
    padding: 4px;
    border-bottom: 2px solid #ccc;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.court-section-header {
    position: sticky;
    top: 45px;
    z-index: 900;
    background: #333;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    scroll-margin-top: 110px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid rgba(0,0,0,.1);
    cursor: pointer;
    text-align: center;
}
.court-nav .btn,
.footer-nav .btn {
    padding: 6px 10px;
}
.btn-blue { background: #5a9bd5; color: white; }
.btn-red { background: #e06666; color: white; }
.btn-gray { background: #adb5bd; color: white; }
.btn-green { background: #93c47d; color: white; }
.done-row {
    background-color: #f0f0f0 !important;
    opacity: .6;
}
.yt-live {
    background-color: #c6efce !important;
    font-weight: bold;
}
.yt-next {
    background-color: #f1f9f1 !important;
}
.done-row button:not([value="0"]) {
    pointer-events: none;
    opacity: 0.5;
}
.nav-link {
    background: #5a9bd5;
    color: white;
    text-decoration: none;
    padding: 8px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
}
@media (min-width: 768px) {
    table,
    .court-section-header,
    .court-nav,
    .footer-nav {
        width: 600px !important;
        margin-left: 10px !important;
        box-sizing: border-box;
    }
    .page-admin table,
    .page-admin .footer-nav {
        margin-left: 0 !important;
    }
    .court-section-header {
        text-align: left;
        padding-left: 15px;
    }
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}
th {
    background: #eee;
    text-align: left;
    padding: 5px;
    font-size: 12px;
}
.footer-nav {
    margin: 20px 10px;
    display: flex;
    gap: 10px;
    padding-top: 0;
}
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 1px dotted #999;
}
.tooltip .tooltiptext {
    visibility: hidden;
    width: 140px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1001;
    bottom: 125%;
    left: 50%;
    margin-left: -70px;
    opacity: 0;
    transition: opacity .3s;
    font-size: 11px;
    font-weight: 400;
    pointer-events: none;
}
.tooltip:hover .tooltiptext,
.tooltip:active .tooltiptext {
    visibility: visible;
    opacity: 1;
}
button, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
td button, td select {
    color: #000;
}
.scroll-anchor {
    display: block;
    position: relative;
    top: -110px;
    visibility: hidden;
}
.court-table {
    table-layout: fixed;
}
.td-num {
    width: 45px;
    text-align: center;
    padding: 0;
}
.name-cell {
    padding: 0 5px;
    word-break: break-word;
    font-size: 13px;
}
.td-coach {
    padding: 1px;
    width: 75px;
}
.td-result {
    padding: 1px;
    width: 85px;
}
.td-ptime {
    width: 45px;
    text-align: center;
    font-size: 11px;
}
.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}
.btn-cell {
    background: #efefef;
    border: 1px solid #ccc;
    padding: 2px 0;
    font-size: 11px;
    border-radius: 3px;
}
.btn-cell-clear {
    grid-column: span 2;
    background: #efefef;
    border: 1px solid #ccc;
    padding: 1px 0;
    font-size: 10px;
    border-radius: 3px;
}
.wait-for {
    grid-column: span 2;
    font-size: 9px;
    text-align: center;
    color: #999;
    padding: 2px 0;
    line-height: 1.1;
}
.result-label {
    font-weight: bold;
    text-align: center;
    font-size: 12px;
}
.coach-badge {
    padding: 4px;
    border-radius: 3px;
    font-size: 10px;
    text-align: center;
}
.break-row {
    background-color: #fff2cc;
}
.athlete-row {
    background-color: #ce93d8 !important;
}
.athlete-row.done-row {
    background-color: #e1bee7 !important;
}
.af-toggle {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.af-toggle.active {
    background: #5a9bd5;
    color: #fff;
}
.af-toggle.inactive {
    background: #ddd;
    color: #666;
}
.last-refresh {
    font-size: 10px;
    font-weight: normal;
    opacity: 0.8;
}
.court-section-header.stats {
    background: #93c47d;
    margin-top: 30px;
    padding: 5px 10px;
}
.login-wrap {
    padding: 50px;
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.msg-banner {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
}
.pwa-install-prompt {
    display: none;
    margin-top: 20px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
}
.pwa-install-btn {
    background: #5a9bd5;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}
.pwa-install-link {
    display: inline-block;
    background: #5a9bd5;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}
.admin-content {
    padding: 10px;
}
.team-info {
    background: #eee;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-size: 13px;
    max-width: 600px;
    box-sizing: border-box;
}
#pwa-bell {
    position: fixed;
    bottom: 16px;
    right: 12px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 3px 12px rgba(0,0,0,.3);
    transition: transform .15s, background .2s;
    background: #5a9bd5;
    color: #fff;
}
#pwa-bell:active {
    transform: scale(.92);
}
#pwa-bell.on {
    background: #93c47d;
}
#pwa-bell.on-warn {
    background: #9b59b6;
}
#pwa-bell.denied {
    background: #e06666;
}
#pwa-bell[hidden] {
    display: none !important;
}
#pwa-toast {
    position: fixed;
    bottom: 76px;
    right: 12px;
    z-index: 10000;
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    max-width: 240px;
    text-align: center;
    line-height: 1.4;
}
#pwa-toast.show {
    opacity: 1;
}
#pwa-install-banner {
    display: none;
    position: sticky;
    top: 45px;
    z-index: 950;
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    padding: 8px 12px;
    font-size: 13px;
    color: #856404;
    text-align: center;
    max-width: 600px;
    box-sizing: border-box;
}
#pwa-install-banner a {
    color: #856404;
    font-weight: bold;
    text-decoration: underline;
    margin-left: 4px;
}
#pwa-install-banner .close-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #856404;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}
@media (min-width: 768px) {
    #pwa-bell {
        position: sticky;
        right: auto;
        margin-left: 562px;
    }
    #pwa-toast {
        right: auto;
        left: 10px;
    }
}
