:root {
    --pb-primary: #087f5b;
    --pb-primary-dark: #065f46;
    --pb-primary-soft: #e8f6f0;
    --pb-accent: #f59f00;
    --pb-ink: #17332b;
    --pb-muted: #687a74;
    --pb-bg: #f3f7f5;
    --pb-surface: #fff;
    --pb-border: #dfe9e5;
    --pb-radius: 1.15rem;
    --pb-shadow: 0 8px 24px rgba(23, 51, 43, .07);
    --pb-shadow-hover: 0 16px 38px rgba(23, 51, 43, .13);
}

html { scroll-behavior: smooth; }
body.pickleball-ui {
    min-height: 100vh;
    background: var(--pb-bg) !important;
    color: var(--pb-ink);
    text-rendering: optimizeLegibility;
}

body.pickleball-ui main,
body.pickleball-ui > .container,
body.pickleball-ui > .container-fluid { animation: pbPageIn .22s ease-out; }

body.pickleball-ui .container { max-width: var(--ctb-page-max, 1320px); }
body.pickleball-ui h1,
body.pickleball-ui h2,
body.pickleball-ui h3,
body.pickleball-ui h4,
body.pickleball-ui h5 { color: var(--pb-ink); letter-spacing: -.012em; }

body.pickleball-ui .section-title,
body.pickleball-ui .page-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 800;
}

body.pickleball-ui .card,
body.pickleball-ui .card-modern,
body.pickleball-ui .player-card,
body.pickleball-ui .club-card,
body.pickleball-ui .tournament-card,
body.pickleball-ui .match-card,
body.pickleball-ui .calendar-wrapper,
body.pickleball-ui .filter-box {
    border-color: var(--pb-border) !important;
    border-radius: var(--pb-radius) !important;
    box-shadow: var(--pb-shadow);
}

body.pickleball-ui .card,
body.pickleball-ui .player-card,
body.pickleball-ui .club-card,
body.pickleball-ui .tournament-card {
    background: var(--pb-surface);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

@media (hover: hover) {
    body.pickleball-ui .card:hover,
    body.pickleball-ui .player-card:hover,
    body.pickleball-ui .club-card:hover,
    body.pickleball-ui .tournament-card:hover {
        transform: translateY(-3px);
        border-color: rgba(8, 127, 91, .22) !important;
        box-shadow: var(--pb-shadow-hover);
    }
}

body.pickleball-ui .card img,
body.pickleball-ui .gallery-item,
body.pickleball-ui .venue-image,
body.pickleball-ui .club-logo,
body.pickleball-ui .avatar {
    background: #e8efec;
}

/* Shared professional gallery + image viewer */
body.pickleball-ui .pb-gallery-strip{display:flex!important;gap:12px;overflow-x:auto;padding:4px 2px 12px;scroll-snap-type:x mandatory;scrollbar-width:thin}
body.pickleball-ui .pb-gallery-item{position:relative;flex:0 0 clamp(190px,28vw,300px);overflow:hidden;border-radius:14px;background:#e8efec;scroll-snap-align:start;box-shadow:0 5px 18px rgba(20,48,38,.1)}
body.pickleball-ui .pb-gallery-item img{display:block;width:100%;height:180px;object-fit:cover;cursor:zoom-in;transition:transform .3s ease,filter .3s ease}
body.pickleball-ui .pb-gallery-item:hover img{transform:scale(1.045);filter:brightness(1.03)}
body.pickleball-ui .pb-gallery-copy{position:absolute;top:8px;right:8px;width:36px;height:36px;display:flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:rgba(12,22,18,.72);color:#fff;backdrop-filter:blur(5px)}
body.pickleball-ui .pb-viewer .modal-content{height:auto;border:0;border-radius:18px;overflow:hidden;background:#0b0f0d}
body.pickleball-ui .pb-viewer-stage{position:relative;display:flex;min-height:min(72vh,720px);align-items:center;justify-content:center;background:#0b0f0d}
body.pickleball-ui .pb-viewer-image{display:block;max-width:100%;max-height:78vh;object-fit:contain;user-select:none;-webkit-user-drag:none}
body.pickleball-ui .pb-viewer-nav{position:absolute;top:50%;width:44px;height:44px;display:flex;align-items:center;justify-content:center;transform:translateY(-50%);border:0;border-radius:50%;background:rgba(255,255,255,.9);color:#17231f;box-shadow:0 4px 18px rgba(0,0,0,.25)}
body.pickleball-ui .pb-viewer-prev{left:14px}body.pickleball-ui .pb-viewer-next{right:14px}
body.pickleball-ui .pb-viewer-close{position:absolute;top:12px;right:12px;z-index:3;filter:invert(1);opacity:.9}
body.pickleball-ui .pb-viewer-counter{position:absolute;bottom:12px;left:50%;transform:translateX(-50%);padding:5px 12px;border-radius:999px;background:rgba(0,0,0,.62);color:#fff;font-size:13px}
@media(max-width:767.98px){body.pickleball-ui .pb-gallery-item{flex-basis:78vw}body.pickleball-ui .pb-gallery-item img{height:190px}body.pickleball-ui .pb-viewer-stage{min-height:100dvh}body.pickleball-ui .pb-viewer-image{max-height:100dvh}body.pickleball-ui .pb-viewer-nav{width:40px;height:40px}body.pickleball-ui .pb-viewer-prev{left:8px}body.pickleball-ui .pb-viewer-next{right:8px}}

body.pickleball-ui .btn {
    min-height: 42px;
    border-radius: .8rem;
    font-weight: 650;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body.pickleball-ui .btn-sm { min-height: 36px; }
body.pickleball-ui .btn-primary,
body.pickleball-ui .btn-success {
    background-color: var(--pb-primary);
    border-color: var(--pb-primary);
}
body.pickleball-ui .btn-primary:hover,
body.pickleball-ui .btn-success:hover {
    background-color: var(--pb-primary-dark);
    border-color: var(--pb-primary-dark);
}

body.pickleball-ui .form-control,
body.pickleball-ui .form-select,
body.pickleball-ui .input-group-text {
    min-height: 44px;
    border-color: var(--pb-border);
    border-radius: .8rem;
}
body.pickleball-ui .form-control:focus,
body.pickleball-ui .form-select:focus {
    border-color: var(--pb-primary);
    box-shadow: 0 0 0 .22rem rgba(8, 127, 91, .12);
}

body.pickleball-ui .pb-card-rating{margin-top:.65rem;padding-top:.65rem;border-top:1px solid var(--pb-border)}
body.pickleball-ui .pb-card-rating .rating{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem}
body.pickleball-ui .pb-card-rating .rating-stars{font-size:1.05rem;line-height:1}
body.pickleball-ui .pb-card-rating .rating-info{margin-left:.2rem;font-size:.78rem;color:var(--pb-muted)}
body.pickleball-ui .pb-card-rating .rating-bar{flex:0 0 100%;height:4px;margin-top:.25rem;background:#edf1ef}
body.pickleball-ui .pb-rating-summary{margin-top:.35rem;color:var(--pb-muted);font-size:.78rem}
body.pickleball-ui .input-group > :not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
body.pickleball-ui .input-group > :not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

body.pickleball-ui .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 1.25rem;
    box-shadow: 0 24px 70px rgba(16, 35, 29, .22);
}
body.pickleball-ui .modal-header { border-bottom-color: var(--pb-border); }
body.pickleball-ui .modal-footer { border-top-color: var(--pb-border); }

body.pickleball-ui .table-responsive {
    overflow: auto;
    border-radius: 1rem;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}
body.pickleball-ui .table { margin-bottom: 0; }
body.pickleball-ui .table > :not(caption) > * > * { padding: .8rem; border-bottom-color: #edf2f0; }
body.pickleball-ui .table thead th { white-space: nowrap; background: #f1f7f4; color: #49635a; font-size: .78rem; text-transform: uppercase; letter-spacing: .035em; }

body.pickleball-ui .pagination { gap: .3rem; }
body.pickleball-ui .page-link {
    display: grid;
    min-width: 40px;
    min-height: 40px;
    place-items: center;
    border: 0;
    border-radius: .75rem !important;
    color: #0f9bf5 ;
    font-weight: 700;
}
body.pickleball-ui .page-item.active .page-link { background: var(--pb-primary); }

body.pickleball-ui .badge { padding: .45em .7em; border-radius: 999px; }
body.pickleball-ui .text-muted { color: var(--pb-muted) !important; }

body.pickleball-ui .pb-sticky-tools,
body.pickleball-ui .toolbar,
body.pickleball-ui .filter-bar {
    border: 1px solid rgba(8, 127, 91, .1);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
}

body.pickleball-ui > .loading#loading {
    position: fixed !important;
    z-index: 1080 !important;
    inset: auto 1rem calc(5.2rem + env(safe-area-inset-bottom)) auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 54px;
    min-height: 54px;
    padding: .8rem !important;
    border: 1px solid rgba(8, 127, 91, .16);
    border-radius: 1rem;
    background: rgba(255, 255, 255, .96) !important;
    box-shadow: var(--pb-shadow-hover);
    backdrop-filter: blur(12px);
}
body.pickleball-ui > .loading#loading .spinner-border { color: var(--pb-primary) !important; }

.pb-network-status {
    position: fixed;
    z-index: 1090;
    top: .75rem;
    left: 50%;
    max-width: calc(100% - 2rem);
    transform: translateX(-50%);
    padding: .55rem .8rem;
    border-radius: 999px;
    background: #7f1d1d;
    color: #fff;
    box-shadow: var(--pb-shadow-hover);
    font-size: .78rem;
    font-weight: 700;
}

.pb-route-loading::before {
    content: "";
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 35%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #20c997, #087f5b);
    animation: pbProgress .8s ease-in-out infinite;
}

body.pickleball-ui [data-pb-reveal] { animation: pbItemIn .25s both; }

@keyframes pbPageIn { from { opacity: .4; } to { opacity: 1; } }
@keyframes pbItemIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pbProgress { from { transform: translateX(-110%); } to { transform: translateX(320%); } }

@media (max-width: 767.98px) {
    body.pickleball-ui { font-size: .95rem; }
    body.pickleball-ui > .container,
    body.pickleball-ui main.container { padding-right: 1rem; padding-left: 1rem; }
    body.pickleball-ui .row { --bs-gutter-x: 1rem; }
    body.pickleball-ui .modal-dialog { margin: .6rem; }
    body.pickleball-ui .modal-dialog-scrollable { height: calc(100% - 1.2rem); }
    body.pickleball-ui .modal-dialog:not(.modal-dialog-centered) { align-items: end; min-height: calc(100% - 1.2rem); }
    body.pickleball-ui .modal-content { border-radius: 1.2rem; }
    body.pickleball-ui .fc .fc-toolbar { align-items: stretch; flex-direction: column; gap: .6rem; }
    body.pickleball-ui .fc .fc-toolbar-chunk { display: flex; justify-content: center; }
    body.pickleball-ui .fc .fc-button { min-height: 40px; }
    body.pickleball-ui .fc .fc-toolbar-title { font-size: 1.1rem; }
    body.pickleball-ui .leaflet-control-zoom { margin-top: 4.5rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    body.pickleball-ui main,
    body.pickleball-ui > .container,
    body.pickleball-ui > .container-fluid,
    body.pickleball-ui [data-pb-reveal],
    .pb-route-loading::before { animation: none; }
    body.pickleball-ui .card,
    body.pickleball-ui .player-card,
    body.pickleball-ui .club-card,
    body.pickleball-ui .tournament-card { transition: none; }
}
