* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0a0a0a;
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Top Banner (always visible, contains hamburger, title, and auth buttons) */
.top-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 999;
}

/* Hamburger Menu in Top Banner */
.top-banner .hamburger-menu {
    position: static;
    flex-shrink: 0;
    width: 40px; /* Fixed width for consistent spacing */
}

/* Site Header in Top Banner - centered within 600px constraint to match content */
.top-banner .site-header {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    margin: 0;
    pointer-events: none; /* Allow clicks to pass through to elements behind */
    /* Constrain to same max-width as content-wrapper for alignment */
    max-width: 600px;
    width: 100%;
    box-sizing: border-box;
    padding: 0 20px; /* Match content-wrapper padding for alignment */
}

.top-banner .site-header h1 {
    pointer-events: auto; /* Re-enable pointer events for the title itself */
}

.top-banner .site-header h1 {
    font-size: 20px; /* 25% bigger (16px * 1.25 = 20px) */
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.top-banner .site-header h1 a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s ease;
}

.top-banner .site-header h1 a:hover {
    opacity: 0.8;
}

.top-banner .header-emoji {
    font-size: 22.5px; /* 25% bigger (18px * 1.25 = 22.5px) */
    line-height: 1;
    display: inline-block;
}

.top-banner .header-emoji.bull {
    transform: scaleX(-1);
}

.top-banner .header-emoji.bear {
    transform: scaleX(-1);
}

.top-banner .header-emoji img {
    width: 22.5px; /* 25% bigger (18px * 1.25 = 22.5px) */
    height: 22.5px; /* 25% bigger (18px * 1.25 = 22.5px) */
    object-fit: contain;
    display: block;
    /* Prevent layout shift while loading */
    min-width: 22.5px;
    min-height: 22.5px;
    background-color: transparent;
}

.top-banner .header-emoji.bear img {
    transform: scaleX(-1);
}

/* Auth Buttons Container (in top banner) - stacked vertically */
.top-banner .auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto; /* Push to the right */
    align-items: flex-end; /* Align buttons to the right edge */
    min-width: 80px; /* Reserve space to prevent layout shift */
}

.top-banner .auth-button {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    min-width: 80px; /* Ensure both buttons have the same width */
    text-align: center;
    box-sizing: border-box;
}

.auth-button {
    padding: 10px 10px;
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.auth-button:hover {
    background-color: #2a2a2a;
    border-color: #3a3a3a;
}

.auth-button.primary {
    background-color: #ff4444;
    border-color: #ff4444;
}

.auth-button.primary:hover {
    background-color: #ff5555;
    border-color: #ff5555;
}

/* Hamburger Menu Button */
.hamburger-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* Adjust hamburger position when top banner is visible */
body.has-top-banner .hamburger-menu {
    top: 60px; /* Below top banner */
}

.hamburger-menu:hover {
    background-color: #2a2a2a;
}

.hamburger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #ffffff;
    transition: all 0.3s ease;
}

/* Hamburger to X animation */
body.sidebar-open .hamburger-menu span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

body.sidebar-open .hamburger-menu span:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .hamburger-menu span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Backdrop/Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background-color: #1a1a1a;
    border-right: 1px solid #2a2a2a;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

body.sidebar-open .sidebar {
    transform: translateX(0);
}

/* Close button (X) */
.sidebar-close {
    position: absolute;
    top: 10px; /* Moved up from 15px */
    right: 10px; /* Moved right from 15px */
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidebar-close:hover {
    background-color: #2a2a2a;
}

.sidebar-header {
    margin-bottom: 30px;
    padding-top: 8px;
    padding-bottom: 20px;
    padding-left: 20px;
    padding-right: 20px;
    border-bottom: 1px solid #2a2a2a;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header h1 {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.sidebar-header h1 a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: opacity 0.2s ease;
}

.sidebar-header h1 a:hover {
    opacity: 0.8;
}

.sidebar-header .header-emoji {
    font-size: 20px;
    line-height: 1;
    display: inline-block;
}

.sidebar-header .header-emoji.bull {
    transform: scaleX(-1);
}

.sidebar-header .header-emoji.bear {
    transform: scaleX(-1);
}

.sidebar-header .header-emoji img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}

.sidebar-header .header-emoji.bear img {
    transform: scaleX(-1);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    color: #888;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item-icon {
    font-size: 18px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

.nav-item.active {
    background-color: #ff4444;
    color: #ffffff;
}

.nav-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
    position: relative;
}

.nav-item.locked::after {
    content: "🔒";
    margin-left: 8px;
    font-size: 12px;
}

/* Account Accordion in Sidebar */
.nav-account-container {
    margin-bottom: 8px;
}

.nav-account-accordion {
    border-radius: 8px;
    overflow: hidden;
    display: none; /* Hidden by default, shown via JS when logged out */
}

.nav-account-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    user-select: none;
}

.nav-account-header:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

.nav-account-title {
    flex: 1;
}

.nav-account-chevron {
    flex: 0 0 auto;
    color: #fbbf24; /* amber */
    font-size: 18px;
    font-weight: 800;
    transition: transform 0.2s ease-out, color 0.2s ease-out;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
    cursor: pointer;
    margin-left: auto;
}

.nav-account-accordion.expanded .nav-account-chevron {
    transform: rotate(180deg);
}

.nav-account-content-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.2s ease-out;
    overflow: hidden;
}

.nav-account-accordion.expanded .nav-account-content-wrapper {
    grid-template-rows: 1fr;
}

.nav-account-content {
    min-height: 0;
    padding: 0 16px 0 16px;
    transition: padding 0.2s ease-out;
}

.nav-account-accordion.expanded .nav-account-content {
    padding: 0 16px 12px 16px;
}

.nav-account-subitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 44px; /* Extra left padding to indent under Account */
    margin-bottom: 4px;
    color: #888;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
}

.nav-account-link {
    display: none; /* Hidden by default, shown via JS when logged in (as flex to match nav-item) */
}

.nav-account-subitem:hover {
    background-color: #2a2a2a;
    color: #ffffff;
}

.nav-account-subitem-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}


/* Site Header (moved to top banner, kept for backward compatibility) */
.site-header {
    text-align: center;
    margin-bottom: 30px;
    margin-top: 20px;
}

.site-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.header-emoji {
    font-size: 32px;
    line-height: 1;
    display: inline-block;
}

.header-emoji.bull {
    transform: scaleX(-1); /* Flip bull to face right (inward) */
}

.header-emoji.bear {
    transform: scaleX(-1); /* Flip bear to face left (inward) */
}

.header-emoji img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}

.header-emoji.bear img {
    transform: scaleX(-1); /* Flip bear image to face left (inward) */
}

/* Main Content */
.main-content {
    width: 100%;
    padding: 20px;
    padding-top: 120px; /* Increased top padding for top banner with clear spacing */
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
    transition: margin-left 0.3s ease;
}

/* Add spacing to first element in content wrapper */
.content-wrapper > *:first-child {
    margin-top: 20px; /* Additional spacing after top bar */
}

/* Mobile adjustments for top banner */
@media (max-width: 768px) {
    .top-banner {
        padding: 8px 12px;
    }

    .top-banner .site-header h1 {
        font-size: 14px;
        gap: 6px;
    }

    .top-banner .header-emoji {
        font-size: 16px;
    }

    .top-banner .header-emoji img {
        width: 16px;
        height: 16px;
    }

    .top-banner .auth-button {
        padding: 5px 10px;
        font-size: 11px;
    }

    .main-content {
        padding-top: 110px; /* Increased padding on mobile to prevent overlap with stacked buttons */
    }
    
    .content-wrapper > *:first-child {
        margin-top: 15px; /* Slightly less spacing on mobile */
    }
}

/* Desktop: Sidebar open pushes content */
@media (min-width: 769px) {
    body.sidebar-open .main-content {
        margin-left: 240px;
    }
}

/* Content wrapper to constrain width and center */
.content-wrapper {
    width: 100%;
    max-width: 600px; /* Match original centered layout */
    margin: 0 auto; /* Center the wrapper */
    padding: 0 20px; /* Match top banner padding for alignment */
    box-sizing: border-box;
}

/* Progress Widget (hidden by default, shown only for logged-in users) */
.progress-widget {
    background-color: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: none; /* Hidden by default - only shown for logged-in users */
    align-items: center;
    gap: 12px;
    font-size: 14px;
    width: 100%;
    max-width: 600px; /* Match content width */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    min-height: 48px; /* Ensure consistent height to prevent shift */
}

.progress-widget.visible {
    display: flex;
}

.progress-widget.loading {
    display: flex;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.progress-item#progressItem1 {
    justify-content: flex-start;
}

.progress-item#progressItem3 {
    justify-content: flex-end;
    margin-left: auto;
}

/* Progress Bar Container - takes up middle space */
.progress-bar-container {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    position: relative;
}

.progress-bar-label {
    text-align: center;
    width: 100%;
    left: 0 !important;
    transform: none;
}

/* Mobile responsive layout */
@media (max-width: 768px) {
    .progress-widget {
        gap: 8px;
        padding: 10px 12px;
    }

.progress-item#progressItem1 {
    justify-content: flex-start;
}

.progress-item#progressItem3 {
    justify-content: flex-end;
    margin-left: auto;
}

    .progress-bar-container {
        flex: 1 1 auto;
        min-width: 0;
    }
}

.progress-label {
    color: #888;
    font-size: 50%;
}

.progress-value {
    font-weight: 600;
    color: #ffffff;
    font-size: 50%;
}

/* Progress Bar Styles */
.progress-bar-container {
    width: 100%;
    margin: 8px 0;
}

.progress-bar-wrapper {
    position: relative;
    width: 100%;
}

.progress-bar-label {
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    font-size: 12px;
    font-weight: 600;
    color: #fbbf24;
    z-index: 2;
    text-align: center;
    width: 100%;
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #2a2a2a;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24 0%, #fcd34d 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar-level-indicator {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 600;
    color: #ffffff;
    background-color: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.progress-bar-target {
    position: absolute;
    right: 2px;
    top: -18px;
    font-size: 9px;
    font-weight: 500;
    color: #888;
    z-index: 1;
}

/* Skeleton loading state */
.progress-skeleton {
    display: inline-block;
    background: linear-gradient(
        90deg,
        #2a2a2a 0%,
        #3a3a3a 50%,
        #2a2a2a 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.progress-skeleton-label {
    width: 45px;
    height: 14px;
}

.progress-skeleton-value {
    width: 30px;
    height: 16px;
}

.progress-skeleton-value.long {
    width: 60px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Common card styles */
.card {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #2a2a2a;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #ffffff;
    text-align: center;
    position: relative;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }

    .hamburger-menu {
        top: 15px;
        left: 15px;
        width: 36px;
        height: 36px;
    }

    .main-content {
        padding-top: 70px;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }
}

