/* Custom Stylesheet for The Family Slice Golf Tour Dashboard */

/* Admin-only elements hidden unless body has admin-mode class */
body:not(.admin-mode) .admin-only {
    display: none !important;
}

:root {
    --primary: #ccff80;
    --primary-glow: rgba(204, 255, 128, 0.15);
    --primary-glow-hover: rgba(204, 255, 128, 0.35);
    --bg-dark: #0d0d0d;
    --card-bg: rgba(26, 26, 26, 0.65);
    --border-color: rgba(255, 255, 255, 0.06);
}

/* Premium Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0f0f0f;
}
::-webkit-scrollbar-thumb {
    background: #2b2b2b;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Glassmorphism Panel & Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
    border-color: rgba(204, 255, 128, 0.3);
    box-shadow: 0 12px 40px 0 rgba(204, 255, 128, 0.08);
}

.glass-panel {
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Premium Inputs */
.modern-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

select {
    color-scheme: dark;
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--on-surface);
}

select option {
    background-color: #1c1b1b;
    color: var(--on-surface);
}

select option:checked,
select option:hover {
    background-color: #2f3328;
    color: var(--primary);
}

/* Animated Hover Buttons */
.glow-button {
    box-shadow: 0 0 20px var(--primary-glow);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glow-button:hover {
    box-shadow: 0 0 35px var(--primary-glow-hover);
    transform: translateY(-2px);
}

.glow-button:active {
    transform: translateY(1px);
}

/* Dynamic Active Indicators for Sidebar Nav */
.sidebar-link {
    position: relative;
    transition: all 0.3s ease;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 60%;
    background-color: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-link.active {
    background-color: rgba(204, 255, 128, 0.08);
    color: var(--primary);
}

.sidebar-link.active::before {
    transform: translateY(-50%) scaleY(1);
}

#mobile-top-nav {
    display: none;
}

@media (max-width: 767px) {
    body > footer.fixed.bottom-0 {
        display: none !important;
    }

    main {
        padding-top: 4.75rem !important;
        padding-bottom: 1.5rem !important;
    }

    #mobile-top-nav {
        display: block;
    }

    .mobile-nav-bar {
        align-items: center;
        background: rgba(19, 19, 19, 0.92);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
        display: flex;
        gap: 0.85rem;
        height: 4.25rem;
        left: 0;
        padding: 0.75rem 1rem;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 80;
    }

    .mobile-menu-button,
    .mobile-menu-close {
        align-items: center;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0.85rem;
        color: var(--primary);
        display: inline-flex;
        height: 2.75rem;
        justify-content: center;
        width: 2.75rem;
    }

    .mobile-nav-kicker {
        color: var(--on-surface-variant, #c2cab0);
        font-size: 0.62rem;
        font-weight: 800;
        letter-spacing: 0.12em;
        line-height: 1;
        text-transform: uppercase;
    }

    .mobile-nav-title {
        color: #fff;
        font-family: "Playfair Display", serif;
        font-size: 1.35rem;
        font-weight: 800;
        line-height: 1.1;
    }

    .mobile-menu-overlay {
        background: rgba(0, 0, 0, 0.58);
        inset: 0;
        opacity: 0;
        pointer-events: none;
        position: fixed;
        transition: opacity 0.22s ease;
        z-index: 90;
    }

    .mobile-menu-panel {
        background: rgba(19, 19, 19, 0.98);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0 0 1.25rem 1.25rem;
        box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
        left: 0;
        max-height: calc(100dvh - 1rem);
        overflow-y: auto;
        padding: 1rem;
        position: fixed;
        right: 0;
        top: 0;
        transform: translateY(-105%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 100;
    }

    .mobile-nav-open .mobile-menu-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-nav-open .mobile-menu-panel {
        transform: translateY(0);
    }

    .mobile-menu-heading {
        align-items: center;
        display: flex;
        justify-content: space-between;
        margin-bottom: 1rem;
    }

    .mobile-menu-heading h2 {
        color: var(--primary);
        font-family: "Playfair Display", serif;
        font-size: 1.7rem;
        font-style: italic;
        font-weight: 800;
        line-height: 1.1;
    }

    .mobile-menu-links {
        display: grid;
        gap: 0.45rem;
    }

    .mobile-menu-link {
        align-items: center;
        border: 1px solid transparent;
        border-radius: 0.95rem;
        color: var(--on-surface-variant, #c2cab0);
        display: flex;
        font-size: 0.95rem;
        font-weight: 700;
        gap: 0.85rem;
        padding: 0.9rem 0.95rem;
        transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    }

    .mobile-menu-link.active {
        background: rgba(204, 255, 128, 0.1);
        border-color: rgba(204, 255, 128, 0.2);
        color: var(--primary);
    }

    button.mobile-menu-link {
        background: transparent;
        cursor: pointer;
        width: 100%;
        text-align: left;
    }
}

/* Pulse Animation for Leaders */
@keyframes leaderPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(204, 255, 128, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(204, 255, 128, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(204, 255, 128, 0);
    }
}

.leader-badge {
    animation: leaderPulse 2s infinite;
}

/* Material Icon styling customization */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 350, 'GRAD' 0, 'opsz' 24;
    transition: all 0.2s ease;
}

.sidebar-link:hover .material-symbols-outlined,
.sidebar-link.active .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Dynamic layout styling */
main {
    transition: margin-left 0.3s ease;
}

/* Page transitions */
.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mobile-chip-label {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 576px) {
    body {
        font-size: 15px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    main {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
        max-width: 100vw;
        overflow-x: hidden;
    }

    main > div {
        padding: 1.25rem 0.875rem 1rem !important;
        max-width: 100vw !important;
        min-width: 0;
        overflow-x: hidden;
    }

    main > section {
        max-width: 100vw !important;
        min-width: 0;
        overflow-x: hidden;
    }

    main > div > *,
    main > section > * {
        min-width: 0;
    }

    main > div > .mb-8,
    main > div > .mb-10 {
        margin-bottom: 1.5rem !important;
    }

    main > div > .mb-8.flex,
    main > div > .mb-10.flex {
        align-items: flex-start !important;
        flex-direction: column;
    }

    main > div > .mb-8.flex > a,
    main > div > .mb-10.flex > a {
        justify-content: center;
        width: 100%;
    }

    main > div > .mb-8 p,
    main > div > .mb-10 p,
    main p,
    section.glass-card p {
        max-width: 100%;
        overflow-wrap: anywhere;
        white-space: normal;
    }

    h3.font-headline {
        font-size: 1.72rem !important;
        line-height: 1.05 !important;
    }

    h4.font-headline {
        line-height: 1.15;
    }

    .glass-card,
    .glass-panel {
        border-radius: 1rem !important;
        max-width: 100%;
        min-width: 0;
    }

    .glass-card {
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
    }

    .glass-panel {
        padding: 1rem !important;
    }

    #loading-state,
    #error-state,
    #empty-state {
        padding: 2rem 1rem !important;
    }

    footer.md\:hidden,
    body > footer {
        display: grid !important;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        height: calc(4.5rem + env(safe-area-inset-bottom));
        left: 0 !important;
        right: auto !important;
        width: 100dvw !important;
        max-width: 100dvw !important;
        padding-bottom: env(safe-area-inset-bottom);
        align-items: flex-start;
        padding-top: 0.45rem;
    }

    footer.md\:hidden a,
    body > footer a {
        min-width: 0;
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }

    footer.md\:hidden .material-symbols-outlined {
        font-size: 1.35rem;
    }

    footer.md\:hidden span:last-child {
        font-size: 0.58rem !important;
        letter-spacing: 0.04em;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    button,
    a.glow-button,
    button.glow-button {
        min-height: 2.75rem;
    }

    button[type="submit"] {
        line-height: 1.25;
        letter-spacing: 0.08em !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    table {
        min-width: 32rem;
    }

    .overflow-x-auto {
        max-width: 100%;
    }

    table:has(#leaderboard-rows) {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    table:has(#leaderboard-rows) thead {
        display: none;
    }

    table:has(#leaderboard-rows),
    table:has(#leaderboard-rows) tbody,
    table:has(#leaderboard-rows) tr,
    table:has(#leaderboard-rows) td {
        display: block;
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
    }

    table:has(#leaderboard-rows) tr {
        display: grid;
        grid-template-columns: 2.5rem minmax(0, 1fr);
        gap: 0.65rem;
        align-items: center;
        padding: 0.875rem;
    }

    table:has(#leaderboard-rows) tr + tr {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    table:has(#leaderboard-rows) td {
        border: 0 !important;
        padding: 0 !important;
        width: auto !important;
    }

    table:has(#leaderboard-rows) td:nth-child(2) .flex {
        gap: 0.65rem !important;
        min-width: 0;
    }

    table:has(#leaderboard-rows) td:nth-child(2) .w-9 {
        width: 2.35rem !important;
        height: 2.35rem !important;
        flex-shrink: 0;
    }

    table:has(#leaderboard-rows) td:nth-child(2) .text-white {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    table:has(#leaderboard-rows) td:nth-child(3),
    table:has(#leaderboard-rows) td:nth-child(4) {
        display: grid;
        grid-template-columns: max-content max-content;
        justify-content: start;
        position: relative;
        align-items: center;
        gap: 0.5rem;
        padding: 0.45rem 0.6rem !important;
        border-radius: 0.65rem;
        background: rgba(255, 255, 255, 0.025);
        text-align: right !important;
    }

    table:has(#leaderboard-rows) td:nth-child(3),
    table:has(#leaderboard-rows) td:nth-child(4) {
        grid-column: 1 / -1;
        font-size: 0.95rem !important;
    }

    table:has(#leaderboard-rows) td:nth-child(3)::before,
    table:has(#leaderboard-rows) td:nth-child(4)::before {
        color: var(--on-surface-variant, #c2cab0);
        content: "";
        font-family: Inter, sans-serif;
        font-size: 0.56rem;
        font-weight: 800;
        letter-spacing: 0.045em;
        line-height: 1.1;
        text-align: left;
        text-transform: uppercase;
    }

    table:has(#leaderboard-rows) td:nth-child(3)::before {
        content: "Wins";
    }

    table:has(#leaderboard-rows) td:nth-child(4)::before {
        content: "Pts";
    }

    .mobile-stat-value {
        color: inherit !important;
        display: block;
        position: static;
        transform: none;
        text-align: right;
        z-index: 1;
    }

    .mobile-labeled-cell {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        gap: 1rem;
    }

    .mobile-labeled-cell::before {
        content: none !important;
    }

    .mobile-chip-label {
        color: var(--on-surface-variant, #c2cab0);
        display: block;
        font-family: Inter, sans-serif;
        font-size: 0.56rem;
        font-weight: 800;
        letter-spacing: 0.045em;
        line-height: 1.1;
        text-align: left;
        text-transform: uppercase;
    }

    th,
    td {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }

    table:has(#stats-rows) {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    table:has(#stats-rows) thead {
        display: none;
    }

    table:has(#stats-rows),
    table:has(#stats-rows) tbody,
    table:has(#stats-rows) td {
        display: block;
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
    }

    table:has(#stats-rows) tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.875rem;
    }

    table:has(#stats-rows) tr + tr {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    table:has(#stats-rows) td {
        border: 0 !important;
        padding: 0 !important;
    }

    table:has(#stats-rows) td:first-child {
        grid-column: 1 / -1;
        margin-bottom: 0.35rem;
    }

    table:has(#stats-rows) td:first-child .flex {
        gap: 0.7rem !important;
    }

    table:has(#stats-rows) td:first-child .w-9 {
        width: 2.25rem !important;
        height: 2.25rem !important;
        flex-shrink: 0;
    }

    table:has(#stats-rows) td:not(:first-child) {
        display: grid;
        grid-template-columns: max-content max-content;
        justify-content: start;
        position: relative;
        width: auto;
        min-height: 2.25rem;
        margin: 0;
        padding: 0.45rem 0.55rem !important;
        align-items: center;
        gap: 0.5rem;
        border-radius: 0.65rem;
        background: rgba(255, 255, 255, 0.025);
        vertical-align: top;
        text-align: right !important;
    }

    table:has(#stats-rows) td:nth-child(2n + 3) {
        margin-left: 0;
    }

    table:has(#stats-rows) td:not(:first-child)::before {
        color: var(--on-surface-variant, #c2cab0);
        content: "";
        flex: 1 1 auto;
        font-family: Inter, sans-serif;
        font-size: 0.56rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        line-height: 1.05;
        text-align: left;
        text-transform: uppercase;
    }

    table:has(#stats-rows) td:nth-child(2)::before {
        content: "HC";
    }

    table:has(#stats-rows) td:nth-child(3)::before {
        content: "Net Pts";
    }

    table:has(#stats-rows) td:nth-child(4)::before {
        content: "Scratch Pts";
    }

    table:has(#stats-rows) td:nth-child(5)::before {
        content: "Avg Net";
    }

    table:has(#stats-rows) td:nth-child(6)::before {
        content: "Avg Scratch";
    }

    table:has(#stats-rows) td:nth-child(7)::before {
        content: "Rounds";
    }

    table:has(#stats-rows) td:nth-child(8)::before {
        content: "Net Wins";
    }

    table:has(#stats-rows) td:nth-child(9)::before {
        content: "Scratch Wins";
    }

    table:has(#trend-rows),
    table:has(#profile-rounds-rows),
    table:has(#profile-tournament-rows) {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    table:has(#trend-rows) thead,
    table:has(#profile-rounds-rows) thead,
    table:has(#profile-tournament-rows) thead {
        display: none;
    }

    table:has(#trend-rows),
    table:has(#trend-rows) tbody,
    table:has(#trend-rows) tr,
    table:has(#trend-rows) td,
    table:has(#profile-rounds-rows),
    table:has(#profile-rounds-rows) tbody,
    table:has(#profile-rounds-rows) tr,
    table:has(#profile-rounds-rows) td,
    table:has(#profile-tournament-rows),
    table:has(#profile-tournament-rows) tbody,
    table:has(#profile-tournament-rows) tr,
    table:has(#profile-tournament-rows) td {
        display: block;
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
    }

    table:has(#trend-rows) tr,
    table:has(#profile-rounds-rows) tr,
    table:has(#profile-tournament-rows) tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
        padding: 0.875rem;
    }

    table:has(#trend-rows) tr + tr,
    table:has(#profile-rounds-rows) tr + tr,
    table:has(#profile-tournament-rows) tr + tr {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    table:has(#trend-rows) td,
    table:has(#profile-rounds-rows) td,
    table:has(#profile-tournament-rows) td {
        border: 0 !important;
        padding: 0 !important;
        width: auto !important;
        font-size: 0.9rem;
    }

    table:has(#trend-rows) td:first-child,
    table:has(#profile-rounds-rows) td:first-child,
    table:has(#profile-tournament-rows) td:first-child {
        grid-column: 1 / -1;
    }

    table:has(#trend-rows) td:first-child .flex {
        gap: 0.7rem !important;
        min-width: 0;
    }

    table:has(#trend-rows) td:first-child .w-8 {
        width: 2.25rem !important;
        height: 2.25rem !important;
        flex-shrink: 0;
    }

    table:has(#trend-rows) td:first-child .text-white,
    table:has(#profile-rounds-rows) td:first-child,
    table:has(#profile-tournament-rows) td:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    table:has(#trend-rows) td:not(:first-child),
    table:has(#profile-rounds-rows) td:not(:first-child),
    table:has(#profile-tournament-rows) td:not(:first-child) {
        display: grid;
        grid-template-columns: max-content max-content;
        justify-content: start;
        position: relative;
        min-height: 2.45rem;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem !important;
        border-radius: 0.7rem;
        background: rgba(255, 255, 255, 0.025);
        text-align: right !important;
    }

    table:has(#profile-rounds-rows) td:nth-child(2) {
        font-size: 0.84rem !important;
    }

    table:has(#trend-rows) td:not(:first-child)::before,
    table:has(#profile-rounds-rows) td:not(:first-child)::before,
    table:has(#profile-tournament-rows) td:not(:first-child)::before {
        color: var(--on-surface-variant, #c2cab0);
        content: "";
        flex: 1 1 auto;
        font-family: Inter, sans-serif;
        font-size: 0.57rem;
        font-weight: 800;
        letter-spacing: 0.045em;
        line-height: 1.1;
        text-align: left;
        text-transform: uppercase;
    }

    table:has(#trend-rows) td:nth-child(2)::before {
        content: "Previous HC";
    }

    table:has(#trend-rows) td:nth-child(3)::before {
        content: "Current HC";
    }

    table:has(#trend-rows) td:nth-child(4)::before {
        content: "Rounds";
    }

    table:has(#trend-rows) td:nth-child(5)::before {
        content: "Change";
    }

    table:has(#profile-rounds-rows) td:nth-child(2)::before {
        content: "Date";
    }

    table:has(#profile-rounds-rows) td:nth-child(3)::before {
        content: "Net";
    }

    table:has(#profile-rounds-rows) td:nth-child(4)::before {
        content: "Scratch";
    }

    table:has(#profile-tournament-rows) td:nth-child(2)::before {
        content: "Format";
    }

    table:has(#profile-tournament-rows) td:nth-child(3)::before {
        content: "Partner";
    }

    table:has(#profile-tournament-rows) td:nth-child(4)::before {
        content: "Score";
    }

    table:has(#profile-tournament-rows) td:nth-child(5)::before {
        content: "Result";
    }

    table:has(#trend-rows) td:nth-child(5) .mr-3 {
        margin-right: 0.35rem !important;
    }

    table:has(#tournament-player-stats-rows),
    table:has(#tournament-team-stats-rows) {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    table:has(#tournament-player-stats-rows) thead,
    table:has(#tournament-team-stats-rows) thead {
        display: none;
    }

    table:has(#tournament-player-stats-rows),
    table:has(#tournament-player-stats-rows) tbody,
    table:has(#tournament-player-stats-rows) tr,
    table:has(#tournament-player-stats-rows) td,
    table:has(#tournament-team-stats-rows),
    table:has(#tournament-team-stats-rows) tbody,
    table:has(#tournament-team-stats-rows) tr,
    table:has(#tournament-team-stats-rows) td {
        display: block;
        box-sizing: border-box;
        max-width: 100%;
    }

    table:has(#tournament-player-stats-rows) tr,
    table:has(#tournament-team-stats-rows) tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
        padding: 1rem !important;
        border: 0 !important;
    }

    table:has(#tournament-player-stats-rows) tr + tr,
    table:has(#tournament-team-stats-rows) tr + tr {
        border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
    }

    table:has(#tournament-player-stats-rows) td,
    table:has(#tournament-team-stats-rows) td {
        border: 0 !important;
        padding: 0 !important;
        width: auto !important;
    }

    table:has(#tournament-player-stats-rows) td:first-child,
    table:has(#tournament-team-stats-rows) td:first-child {
        grid-column: 1 / -1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
    }

    section.glass-card > div:first-child {
        padding: 1rem !important;
        align-items: flex-start !important;
        flex-direction: column;
    }

    section.glass-card > div:first-child > span {
        align-self: flex-start;
    }

    section[class*="pt-6"] {
        padding-top: 1.25rem !important;
    }

    #profile-name {
        font-size: 2.4rem !important;
        line-height: 0.95 !important;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    #profile-avatar {
        object-position: top center;
    }

    #profile-name + div {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem 1rem !important;
        margin-top: 1rem !important;
        width: 100%;
    }

    #profile-name + div > div.flex-col {
        min-width: 0;
    }

    #profile-name + div span[id] {
        font-size: 1.45rem !important;
    }

    button[onclick="shareProfile()"] {
        width: 100%;
        justify-content: center;
    }

    #podium-container {
        padding-top: 0 !important;
        gap: 0.625rem !important;
        margin-bottom: 1rem !important;
    }

    #podium-container > div {
        min-height: 0;
        height: auto !important;
        padding: 0.875rem 1rem !important;
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 0.875rem;
        text-align: left !important;
    }

    #podium-container > div:nth-child(1) {
        order: 1;
    }

    #podium-container > div:nth-child(2) {
        order: 2;
    }

    #podium-container > div:nth-child(3) {
        order: 3;
    }

    #podium-container > div:nth-child(4) {
        order: 4;
    }

    #podium-container > div > div.flex.flex-col.items-center {
        display: contents;
    }

    #podium-container > div > div.flex.flex-col.items-center > .w-16 {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 3rem !important;
        height: 3rem !important;
        margin-bottom: 0 !important;
    }

    #podium-container h4 {
        grid-column: 2;
        grid-row: 1;
        font-size: 1rem !important;
        margin: 0 !important;
    }

    #podium-container > div > .w-full {
        grid-column: 2;
        grid-row: 2;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.45rem;
        width: auto !important;
        padding-top: 0 !important;
        border-top: 0 !important;
    }

    #podium-container > div > .w-full p.text-\[10px\] {
        display: none;
    }

    #podium-container > div > .w-full p {
        line-height: 1;
        margin-top: 0 !important;
    }

    #podium-container > div > .w-full > div:first-child {
        align-items: center;
        background: rgba(255, 255, 255, 0.055);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 999px;
        display: inline-flex;
        min-height: 1.35rem;
        order: 2;
        padding: 0.12rem 0.45rem;
    }

    #podium-container > div > .w-full > div:first-child p:last-child {
        color: #e5e2e1 !important;
        font-family: Inter, sans-serif !important;
        font-size: 0.68rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.02em;
    }

    #podium-container > div > .w-full > div:first-child p:last-child::after {
        color: var(--on-surface-variant, #c2cab0);
        content: " wins";
        font-family: Inter, sans-serif;
        font-size: 0.62rem;
    }

    #podium-container > div > .w-full > div:last-child p:last-child {
        font-size: 1.35rem !important;
        margin-left: 0.1rem;
        min-width: 5.2rem;
    }

    #podium-container > div > .w-full > div:last-child {
        order: 1;
    }

    #podium-container > div > div:last-child {
        grid-column: 3;
        grid-row: 1 / span 2;
        position: static !important;
        opacity: 0.45 !important;
        font-size: 1rem !important;
        align-self: center;
    }

    #podium-container > div > .absolute.-top-6 {
        grid-column: 3;
        grid-row: 1 / span 2;
        position: static !important;
        align-self: center;
        padding: 0.35rem 0.5rem !important;
        font-size: 0.58rem !important;
        line-height: 1;
        white-space: nowrap;
    }

    #podium-container > div:has(> .absolute.-top-6) > div:last-child {
        display: none;
    }

    #players-grid {
        gap: 1rem !important;
        max-width: 100%;
    }

    #players-grid .glass-card {
        display: grid !important;
        grid-template-columns: 4.75rem minmax(0, 1fr);
        gap: 0.85rem;
        padding: 0.875rem !important;
        max-width: 100%;
    }

    #player-search {
        width: 100% !important;
        min-width: 0;
    }

    #player-search,
    #player-search::placeholder {
        font-size: 0.78rem !important;
    }

    #players-grid .glass-card > div:first-child {
        display: contents;
    }

    #players-grid .glass-card > div:first-child > .relative {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 4.75rem !important;
        aspect-ratio: 1;
        margin-bottom: 0 !important;
        border-radius: 0.75rem !important;
    }

    #players-grid .glass-card > div:first-child > .relative img {
        object-position: top center;
    }

    #players-grid .glass-card h4 {
        grid-column: 2;
        grid-row: 1;
        align-self: end;
        font-size: 1.1rem !important;
        line-height: 1.05;
        margin-bottom: 0 !important;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #players-grid .glass-card > div:last-child {
        grid-column: 2;
        grid-row: 2;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        align-items: end;
        border-top: 0 !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    #players-grid .glass-card > div:last-child > div,
    #players-grid .glass-card > div:last-child > div > div {
        min-width: 0;
        text-align: left !important;
    }

    #players-grid .glass-card > div:last-child > div:first-child {
        grid-column: 1 / -1;
    }

    #players-grid .glass-card > div:last-child > div:last-child {
        display: contents;
    }

    #players-grid .glass-card p.text-\[9px\] {
        font-size: 0.5rem !important;
        letter-spacing: 0.035em;
        white-space: nowrap;
    }

    #players-grid .glass-card p.text-3xl {
        font-size: 1.25rem !important;
        line-height: 1;
    }

    #rounds-container {
        gap: 1rem !important;
    }

    #rounds-container table {
        display: block;
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    #rounds-container table thead {
        display: none;
    }

    #rounds-container table,
    #rounds-container tbody,
    #rounds-container tr,
    #rounds-container td {
        display: block;
        box-sizing: border-box;
        max-width: 100%;
        width: 100%;
    }

    #rounds-container tr {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.55rem;
        padding: 0.875rem;
    }

    #rounds-container tr + tr {
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    #rounds-container td {
        width: auto !important;
        border: 0 !important;
        padding: 0 !important;
        font-size: 0.9rem;
    }

    #rounds-container td:first-child {
        grid-column: 1 / -1;
    }

    #rounds-container td:nth-child(1) .flex {
        gap: 0.7rem !important;
        min-width: 0;
    }

    #rounds-container td:nth-child(1) .w-8 {
        width: 2.25rem !important;
        height: 2.25rem !important;
        flex-shrink: 0;
    }

    #rounds-container td:nth-child(1) .text-white {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #rounds-container td:not(:first-child) {
        display: grid;
        grid-template-columns: max-content max-content;
        justify-content: start;
        position: relative;
        min-height: 2.45rem;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem !important;
        border-radius: 0.7rem;
        background: rgba(255, 255, 255, 0.025);
        text-align: right !important;
    }

    #rounds-container td:not(:first-child)::before {
        color: var(--on-surface-variant, #c2cab0);
        content: "";
        flex: 1 1 auto;
        font-family: Inter, sans-serif;
        font-size: 0.57rem;
        font-weight: 800;
        letter-spacing: 0.045em;
        line-height: 1.1;
        text-align: left;
        text-transform: uppercase;
    }

    #rounds-container td:nth-child(2)::before {
        content: "Net";
    }

    #rounds-container td:nth-child(3)::before {
        content: "Played HC";
    }

    #rounds-container td:nth-child(4)::before {
        content: "Scratch";
    }

    #rounds-container td:nth-child(5)::before {
        content: "Points";
    }

    #rounds-container td:nth-child(2) .flex,
    #rounds-container td:nth-child(4) .flex {
        justify-content: flex-end;
        gap: 0.35rem !important;
    }

    #rounds-container td:nth-child(2) .material-symbols-outlined,
    #rounds-container td:nth-child(4) .material-symbols-outlined {
        font-size: 1rem !important;
    }

    #rounds-container .glass-card > div:first-child {
        align-items: flex-start !important;
    }

    #rounds-container .glass-card > div:first-child > div:last-child {
        width: 100%;
        flex-direction: column;
        justify-content: flex-start;
        text-align: left;
        gap: 0.75rem !important;
    }

    #rounds-container .glass-card > div:first-child > div:last-child > .w-px {
        display: none;
    }

    #rounds-container .glass-card > div:first-child > div:last-child > div {
        text-align: left;
    }

    #tournament-logs > div {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 0.55rem;
        padding: 0.8rem !important;
    }

    #tournament-logs > div > div:last-child {
        text-align: left !important;
    }

    section:has(#tournament-logs) {
        padding: 1rem !important;
    }

    section:has(#tournament-logs) > div:first-child {
        margin-bottom: 0.85rem !important;
    }

    section:has(#tournament-logs) > div:first-child .material-symbols-outlined {
        display: none;
    }

    section:has(#tournament-logs) > .mt-6 {
        display: none;
    }

    #scorecard-form {
        gap: 1.25rem;
    }

    #scorecard-form > :not([hidden]) ~ :not([hidden]) {
        margin-top: 1.25rem !important;
    }

    #player-scorecards {
        gap: 1rem !important;
    }

    #player-scorecards > div {
        padding: 1rem !important;
        border-radius: 1rem !important;
    }

    #player-scorecards > div > div:first-child {
        margin-bottom: 1rem !important;
    }

    #player-scorecards .grid.grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 0.625rem !important;
    }

    #player-scorecards .grid.grid-cols-3 > div:first-child {
        grid-column: auto;
    }

    #player-scorecards input {
        min-height: 3rem;
        padding: 0.625rem 0.5rem !important;
    }

    /* Profile course filter – stretch to full width when stacked */
    #profile-course-filter {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Profile hole analysis grid – compact for mobile */
    #hole-analysis-content .grid-cols-9 {
        gap: 2px !important;
    }

    #hole-analysis-content .grid-cols-9 > div {
        padding: 4px 0 !important;
        border-radius: 5px !important;
    }

    #hole-analysis-content .grid-cols-9 > div > div:nth-child(1),
    #hole-analysis-content .grid-cols-9 > div > div:nth-child(3),
    #hole-analysis-content .grid-cols-9 > div > div:nth-child(4) {
        font-size: 0.55rem !important;
        line-height: 1.1;
    }

    #hole-analysis-content .grid-cols-9 > div > div:nth-child(2) {
        font-size: 0.7rem !important;
        line-height: 1.1;
    }

    #hole-analysis-content {
        padding: 0.75rem !important;
    }

    /* Breakdown course filter – stretch to full width when stacked */
    #breakdown-course-filter {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Course filter dropdown – stretch to full width when stacked */
    #course-filter {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Scoring breakdown – reduce outer padding */
    #scoring-breakdown-content {
        padding: 0.75rem !important;
    }

    /* Scoring breakdown – best/worst hole pair cards */
    #scoring-breakdown-content .flex.gap-3 > div {
        padding: 0.625rem !important;
    }

    /* Hole avg grid – compact all 9 cells to fit the screen */
    #scoring-breakdown-content .grid-cols-9 {
        gap: 2px !important;
    }

    #scoring-breakdown-content .grid-cols-9 > div {
        padding: 4px 0 !important;
        border-radius: 5px !important;
    }

    /* Hole number and par labels */
    #scoring-breakdown-content .grid-cols-9 > div > div:nth-child(1),
    #scoring-breakdown-content .grid-cols-9 > div > div:nth-child(3) {
        font-size: 0.55rem !important;
        line-height: 1.2;
    }

    /* Avg score value – slightly larger than labels */
    #scoring-breakdown-content .grid-cols-9 > div > div:nth-child(2) {
        font-size: 0.7rem !important;
        line-height: 1.1;
    }

    /* Course performance summary cards – keep 2 cols, reduce padding */
    #course-stats-content .grid-cols-2 > div {
        padding: 0.75rem !important;
    }

    #course-stats-content .grid-cols-2 > div .font-headline {
        font-size: 1.75rem !important;
    }
}
