#firstSetupPage {
    background: var(--page-bg) !important;
}

/* Shared hamburger navigation on desktop and mobile */
.topbar {
    width: min(calc(100% - clamp(32px, 8.4vw, 56px)), 1160px);
    min-height: 60px;
    margin: 0 auto;
    padding: clamp(8px, 1.5vw, 14px) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar .mobile-menu-toggle {
    display: flex !important;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    border: 1px solid #e4e9f0;
    border-radius: 13px;
    color: var(--text-primary);
    background: #fff;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.topbar .mobile-menu-toggle span {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: 99px;
    background: currentColor;
}

.topbar .mobile-menu-toggle:hover { background: var(--glass-subtle); }
.topbar .mobile-menu-toggle:focus-visible,
.mobile-nav-panel a:focus-visible,
.mobile-nav-panel button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.topbar .logo {
    color: var(--text-primary);
    font-size: clamp(14px, 1.3vw, 16px);
    font-weight: 800;
    letter-spacing: -0.035em;
    text-decoration: none;
    white-space: nowrap;
}

.mobile-nav-panel {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1001;
    width: min(50vw, 460px);
    min-width: min(300px, calc(100vw - 24px));
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    padding: max(22px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
    color: #182437;
    background: #fff;
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.14);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform 240ms cubic-bezier(0.2, 0.75, 0.25, 1), visibility 240ms;
}

.mobile-nav-panel.is-open {
    transform: translateX(0);
    visibility: visible;
}

.mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
}

.mobile-nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

#mobileNavigation[hidden],
.mobile-nav-backdrop[hidden] { display: none !important; }

.mobile-nav-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0 22px;
    border-bottom: 1px solid #edf0f4;
}

.mobile-nav-brand {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: -0.035em;
    text-decoration: none;
}

.mobile-nav-close {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
}

.mobile-nav-close:hover {
    background: var(--glass-subtle);
}

.mobile-nav-close:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
}

.mobile-nav-close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 16px;
}

.mobile-nav-links > a,
.mobile-nav-links > .mobile-nav-logout {
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 11px;
    border: 0;
    border-radius: 12px;
    color: var(--text-primary);
    background: transparent;
    text-align: left;
    text-decoration: none;
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-nav-links > a:hover,
.mobile-nav-links > .mobile-nav-logout:hover,
.mobile-nav-links > a.active {
    color: var(--accent-hover);
    background: var(--accent-soft);
}

.mobile-nav-open { overflow: hidden; }

html.mobile-nav-open,
body.mobile-nav-open {
    overflow: hidden;
    overscroll-behavior: none;
}

/* Mobile-first app navigation */
.bottom-navigation {
    display: none;
}

@media (max-width: 800px) {
    body.has-bottom-navigation {
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    #navbar .topbar .mobile-menu-toggle {
        display: none !important;
    }

    .bottom-navigation {
        position: fixed;
        inset: auto 0 0;
        z-index: 999;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr)) 48px;
        padding: 8px 14px max(8px, env(safe-area-inset-bottom));
        border-top: 1px solid var(--glass-border);
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08);
        contain: paint;
    }

    .mobile-nav-panel {
        width: clamp(220px, 50vw, 320px);
        min-width: 0;
        touch-action: pan-y;
        transition:
            transform 200ms cubic-bezier(0.2, 0.75, 0.25, 1),
            visibility 200ms;
    }

    .mobile-nav-backdrop {
        background: rgba(0, 0, 0, 0.42);
        transition: opacity 200ms ease;
    }

    .bottom-nav-item {
        display: flex;
        min-width: 0;
        min-height: 52px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border: 0;
        border-radius: 12px;
        position: relative;
        color: var(--text-muted);
        background: transparent;
        text-decoration: none;
        font-size: 10px;
        line-height: 1.2;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition:
            transform 120ms ease-out,
            color 140ms ease;
    }

    .bottom-nav-item:active {
        transform: scale(0.94);
    }

    .bottom-nav-item svg {
        position: relative;
        z-index: 1;
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .bottom-nav-item.active {
        color: var(--accent-hover);
    }

    .bottom-nav-item.active::before,
    .bottom-nav-more[aria-expanded="true"]::before {
        position: absolute;
        inset: 3px;
        z-index: 0;
        border-radius: 10px;
        background: var(--accent-soft);
        content: "";
    }

    .bottom-nav-item::before {
        opacity: 0;
        transition: opacity 140ms ease;
    }

    .bottom-nav-item.active::before,
    .bottom-nav-more[aria-expanded="true"]::before {
        opacity: 1;
    }

    .bottom-nav-item:focus-visible {
        outline: 3px solid var(--focus-ring);
        outline-offset: -2px;
    }

    .bottom-nav-more {
        width: 48px;
        justify-self: end;
        font: inherit;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav-panel,
    .mobile-nav-backdrop,
    .bottom-nav-item,
    .bottom-nav-item::before {
        transition-duration: 0.01ms;
    }
}

/* Desktop navigation */
.desktop-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 28px;
    margin-left: auto;
}

.desktop-navigation a {
    color: var(--text-primary, #e8edf5);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

.desktop-navigation .desktop-nav-more {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    padding: 0;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    background: var(--glass-panel);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

.desktop-navigation .desktop-nav-more svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.desktop-navigation .desktop-nav-more:hover {
    background: var(--glass-subtle);
}

.desktop-navigation a:hover,
.desktop-navigation a.active {
    color: var(--accent-hover);
}

@media (min-width: 769px) {
    .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .topbar-start {
        display: flex;
        align-items: center;
    }

    .topbar-start > .mobile-menu-toggle,
    .bottom-navigation {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .desktop-navigation {
        display: none;
    }
}

/* Keep exercise browsing and controls light instead of card-heavy */
.secondary-button {
    border-radius: 999px;
    box-shadow: none;
}

#firstSetupPage .save-button {
    color: #fff !important;
    background: #202124 !important;
    border: 1px solid #202124 !important;
    box-shadow: none;
}

#firstSetupPage .save-button:hover {
    color: #fff !important;
    background: #3f4348 !important;
    border-color: #3f4348 !important;
}

.secondary-button {
    color: #343a40;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
}

.secondary-button:hover {
    color: #202124;
    background: #e5e7eb;
    border-color: #9ca3af;
}

.main-button:focus-visible,
.secondary-button:focus-visible,
#firstSetupPage .save-button:focus-visible {
    outline: 3px solid rgba(55, 65, 81, 0.28);
    outline-offset: 3px;
}

.exercise-card {
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.exercise-card-media {
    background: transparent;
}

.exercise-card-content,
.exercise-section .exercise-card-content {
    min-height: 0;
    padding: 14px 0 18px;
}

.exercise-detail-page .exercise-demo-panel,
.exercise-detail-page .exercise-workout-panel {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.exercise-detail-page .exercise-demo-panel {
    padding: 0;
}

.exercise-detail-page .exercise-workout-panel {
    padding: 0;
}

.exercise-detail-page .exercise-mode-tabs {
    gap: 20px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
    background: transparent;
}

.exercise-detail-page .exercise-mode-tabs button,
.exercise-detail-page .exercise-mode-tabs button[aria-selected="true"] {
    min-height: 44px;
    padding: 8px 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.exercise-detail-page .exercise-mode-tabs button[aria-selected="true"] {
    color: var(--accent-hover);
    box-shadow: inset 0 -2px currentColor;
}

.exercise-detail-page .exercise-form-field input {
    padding-right: 2px;
    padding-left: 2px;
    border: 0;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
    background: transparent;
}

.exercise-detail-page .exercise-form-field input:focus {
    border-bottom-color: var(--accent);
    outline: 0;
    box-shadow: 0 1px 0 var(--accent);
}
:root body {
    background-color: var(--page-bg);
    color: var(--text-primary);
}

:root body :is(h1, h2, h3, h4, h5, h6, p, label, li, dt, dd, time, small) {
    color: inherit;
}

:root body :is(input, select, textarea) {
    color: var(--text-primary);
    border-color: var(--glass-border);
    color-scheme: dark;
}

:root body :is(input, select, textarea)::placeholder {
    color: var(--text-muted);
}

:root body :is(button:not(.main-button), .secondary-button) {
    color: var(--text-primary);
}

:root .bottom-navigation {
    border-color: var(--glass-border);
    background: rgba(20, 20, 20, 0.96);
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.28);
}

:root .bottom-nav-item {
    color: var(--text-muted);
}

:root .bottom-nav-item.active {
    color: var(--accent-hover);
}

:root .desktop-navigation a:hover,
:root .desktop-navigation a.active,
:root .desktop-nav-more:hover {
    color: var(--accent-hover);
}

:root .workout-item,
:root .competition-result,
:root .profile-detail,
:root .social-links a,
:root .google-button,
:root .exercise-card,
:root .exercise-form-field input {
    color: var(--text-primary);
    border-color: var(--glass-border);
    background-color: var(--glass-subtle);
}

:root .person-top,
:root .social-section,
:root .profile-socials,
:root .public-profile-header {
    border-color: var(--glass-border);
}

:root .secondary-button {
    border-color: var(--glass-border);
    color: var(--text-primary);
    background: var(--glass-subtle);
}

:root .secondary-button:hover {
    color: var(--text-primary);
    background: var(--glass-panel);
}

:root .mobile-nav-panel {
    color: var(--text-primary);
    background: var(--glass-panel);
    box-shadow: 18px 0 48px rgba(0, 0, 0, 0.35);
}

:root .mobile-nav-heading {
    border-color: var(--glass-border);
}

:root .mobile-nav-brand,
:root .mobile-nav-links > a,
:root .mobile-nav-close {
    color: var(--text-primary);
}

:root .mobile-nav-links > .mobile-nav-logout {
    color: #dc2626;
}

:root .topbar .mobile-menu-toggle {
    border-color: var(--glass-border);
    color: var(--text-primary);
    background: var(--glass-subtle);
}

:root .mobile-nav-close {
    border: 0;
    color: var(--text-primary);
    background: transparent;
}

:root .mobile-nav-close:hover {
    background: var(--glass-subtle);
}

:root .topbar .mobile-menu-toggle:hover {
    background: var(--glass-panel);
}

:root .mobile-nav-links > a:hover,
:root .mobile-nav-links > .mobile-nav-logout:hover {
    color: var(--accent-hover);
    background: var(--accent-soft);
}

:root .mobile-nav-links > .mobile-nav-logout:hover {
    color: #b91c1c;
}

:root .auth-content a.google-oauth-button {
    color: #202124;
    background: #fff;
    border-color: #dadce0;
    opacity: 1;
    visibility: visible;
}

#navbar .topbar-start > .guest-menu-toggle {
    display: flex !important;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

#navbar .topbar-start > .guest-menu-toggle:hover {
    background: transparent;
}

:root .mobile-nav-panel.guest-mobile-nav-panel {
    background: var(--page-bg);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.32);
}

:root .guest-mobile-nav-panel .mobile-nav-heading {
    border-color: var(--glass-border);
}

:root .exercise-card {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: #141414;
    transition:
        background-color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

:root .exercise-card-media {
    background: #141414;
}

:root .exercise-card:hover {
    border-color: #454545;
    background: #181818;
    transform: translateY(-2px);
}

:root .competition-result {
    border: 0;
    border-radius: 0;
    background: transparent;
}

:root .competition-result:hover {
    background: #161616;
}

:root .competition-user-info strong {
    color: var(--text-primary);
}

:root .competition-user-info span {
    color: var(--text-secondary);
}

:root .competition-search-area,
:root .competition-people,
:root .competition-results,
:root .competition-grid {
    background: transparent;
}

body.app-page .exercise-library-page .exercise-card,
body.app-page .exercise-library-page .exercise-card:hover {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
}

body.app-page .exercise-library-page .exercise-card-media {
    background: transparent;
}

:root .competition-search-area {
    width: 100%;
}

:root .competition-search-area .competition-result,
:root .competition-people .competition-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transition: background-color 160ms ease;
}

:root .competition-search-area .competition-result:hover,
:root .competition-people .competition-card:hover {
    background: #181818;
}

:root .competition-user-info strong,
:root .competition-card-profile h3 {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
}

:root .competition-user-info span,
:root .competition-card-header p,
:root .competition-card .recent-workouts {
    color: var(--text-secondary);
    font-size: 12px;
}

:root .competition-people .competition-card-header {
    flex: 1 1 50%;
    min-width: 0;
}

:root .competition-people .competition-card-profile {
    align-items: center;
}

:root .competition-people .today-workouts {
    flex: 1 1 35%;
    min-width: 0;
    padding: 0;
}

:root .competition-people .today-workouts p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

:root .competition-avatar {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border: 1px solid var(--glass-border);
}

:root .competition-avatar.placeholder {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    background: #242424;
    color: var(--text-primary);
    font-weight: 700;
}

:root .competition-results .add-competitor-button,
:root .competition-people .remove-competitor-button {
    display: inline-grid;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    flex: 0 0 36px;
    place-items: center;
    margin: 0;
    padding: 0;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--accent-hover);
    background: transparent;
    box-shadow: none;
    font-size: 20px;
    line-height: 1;
}

:root .competition-results .add-competitor-button:hover,
:root .competition-people .remove-competitor-button:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    :root .competition-search-area .competition-result,
    :root .competition-people .competition-card {
        gap: 10px;
        padding: 12px 2px;
    }

    :root .competition-people .competition-card {
        flex-wrap: wrap;
    }

    :root .competition-people .competition-card-header {
        flex: 1 1 calc(100% - 48px);
    }

    :root .competition-people .today-workouts {
        flex: 1 1 100%;
        padding-left: 54px;
    }
}

:root body :is(
    .container,
    .app-page,
    .profile-container,
    .exercise-library,
    .exercise-library-groups,
    .exercise-section,
    .workout-section,
    .social-section,
    .competition-people,
    .competition-search-area) {
    border: 0;
    background: transparent;
    box-shadow: none;
}

:root body :is(
    .card) {
    border-color: var(--glass-border);
    background: #141414;
    box-shadow: none;
}

:root body :is(
    .person-top,
    .social-section,
    .profile-socials,
    .public-profile-header
) {
    border-color: var(--glass-border);
}

:root body :is(
    .competition-card,
    .profile-detail,
    .exercise-mode-tabs
) {
    border-color: var(--glass-border);
    background: transparent;
}

:root .workout-item {
    border-color: var(--glass-border);
    background: transparent;
    box-shadow: none;
}

#signupResendStatus,
#loginOtpResendStatus {
    min-height: 0;
    margin: 0 0 12px;
    font-size: 13px;
    text-align: center;
}

.auth-footer #signupLink,
.auth-footer #loginLink {
    color: #60a5fa !important;
}

body.auth-session-prompt-active .auth-container {
    visibility: hidden;
}

.auth-session-dialog {
    width: min(calc(100% - 32px), 420px);
    max-width: calc(100vw - 32px);
    margin: auto;
    padding: clamp(22px, 5vw, 30px);
    color: var(--text-primary);
    border: none;
    outline: none;
    border-radius: 18px;
    background: rgba(24, 24, 24, 0);
    box-shadow: none;
    backdrop-filter: blur(28px) saturate(155%);
    -webkit-backdrop-filter: blur(28px) saturate(155%);
}

.auth-session-dialog::backdrop {
    background: rgba(0, 0, 0, 0.56);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.auth-session-dialog-content h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
}

.auth-session-dialog-content > p {
    margin: 9px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.auth-session-dialog-content > .auth-session-prompt-status {
    color: var(--danger);
}

.auth-session-prompt-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 24px;
}

.auth-session-prompt-actions button {
    min-height: 40px;
    padding: 8px 2px;
    color: var(--text-secondary);
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    transition: color 160ms ease, background-color 160ms ease;
}

.auth-session-prompt-actions button:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.07);
}

.auth-session-prompt-actions [data-auth-session-logout] {
    color: var(--text-primary);
}

.auth-session-prompt-actions button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
}

.auth-session-prompt-actions button:disabled {
    cursor: wait;
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .auth-session-prompt-actions button {
        transition: none;
    }
}
