:root {
    --background: #000;
    --text: #fff;
    --border: #333;
    --border-light: #999;
    --footer-text: #666;
}

[data-theme="light"] {
    --background: #fff;
    --text: #000;
    --border: #ddd;
    --border-light: #666;
    --footer-text: #999;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    overflow-x: hidden;
    overflow-y: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    width: 48px;
    height: 48px;
    border: 1px dotted var(--text);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.theme-toggle:hover {
    transform: rotate(45deg);
}

.toggle-circle {
    width: 8px;
    height: 8px;
    background: var(--text);
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 380px;
    padding: 60px 0 60px 140px;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 3px;
    margin-bottom: 35px;
    cursor: pointer;
    transition: color 0.3s;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.logo:hover {
    color: var(--border-light);
}

.nav-section {
    cursor: pointer;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 35px;
    position: relative;
}

.nav-section:hover .nav-title {
    color: var(--border-light);
}

.nav-section.greyed .nav-title {
    color: var(--border-light);
}

.nav-section.greyed:hover .nav-title {
    color: #888;
}

.nav-title {
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 3px;
    margin-bottom: 6px;
    transition: color 0.3s;
    color: var(--text);
}

.nav-subtitle {
    font-weight: 300;
    font-size: 13px;
    color: var(--text);
}

.nav-subtitle-soon {
    font-weight: 300;
    font-size: 13px;
    color: #747474;
}

.nav-icon {
    width: 250px;
    height: 250px;
    opacity: 0;
    transition: opacity 0.3s;
    position: absolute;
    right: -100px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.nav-section:hover .nav-icon,
.nav-section.active .nav-icon {
    opacity: 1;
}

.nav-icon-light {
    display: none;
}

.nav-icon-dark {
    display: block;
}

[data-theme="light"] .nav-icon-light {
    display: block;
}

[data-theme="light"] .nav-icon-dark {
    display: none;
}

.footer {
    margin-top: 35px;
    font-weight: 300;
    font-size: 11px;
    color: var(--footer-text);
    display: flex;
    align-items: center;
    gap: 15px;
}

.footer-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s;
    fill: var(--text);
}

.footer-icon:hover {
    opacity: 1;
}

.content {
    flex: 1;
    margin-left: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.content-inner {
    text-align: left;
    position: relative;
    min-height: 400px;
    max-height: 100vh;
    overflow: visible;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-logo {
    max-width: 1000px;
    width: 100%;
}

.section-content {
    max-width: 800px;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.section-content.active {
    opacity: 1;
    visibility: visible;
    position: relative;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

/* Mobile: Add scrolling for content sections */
@media screen and (max-width: 900px) {
    .section-content {
        max-height: calc(100vh - 180px); /* Space for menu button (top) and theme toggle (bottom) */
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px;
        margin-top: 80px; /* Space below menu button */
        margin-bottom: 80px; /* Space above theme toggle */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Home section should be centered, not scrollable */
    #home.section-content {
        margin-top: 0;
        margin-bottom: 0;
        max-height: 100vh;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Manifesto and protocols get more space since theme toggle is hidden */
    #manifesto.section-content,
    #protocols.section-content {
        margin-bottom: 20px; /* Reduced since no theme toggle */
        max-height: calc(100vh - 120px); /* More space for content */
    }
    
    /* Protocols section - bring higher on mobile */
    #protocols.section-content {
        margin-top: 20px; /* Much less top margin */
        max-height: calc(100vh - 60px); /* Maximum space for game */
        padding-top: 10px;
    }
    
    .section-content::-webkit-scrollbar {
        width: 4px;
    }
    
    .section-content::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .section-content::-webkit-scrollbar-thumb {
        background: var(--border-light);
        border-radius: 2px;
    }
    
    .section-content::-webkit-scrollbar-thumb:hover {
        background: var(--text);
    }
    
    .coming-soon-text {
        font-size: 22px;
        letter-spacing: 4px;
    }
    
    .coming-soon-subtitle {
        font-size: 12px;
        letter-spacing: 1.5px;
    }
    
    .coming-soon-container {
        min-height: 300px;
        padding: 20px;
    }
}

.section-header {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 3px;
    margin-bottom: 40px;
    color: var(--text);
}

.about-text {
    font-size: 15px;
    font-weight: 300;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 25px;
}

.brought-by {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
    margin-top: 60px;
    margin-bottom: 15px;
}

.elysium-logo-container {
    margin-bottom: 15px;
}

.elysium-logo {
    width: 100px;
    height: 100px;
}

.elysium-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
}

.collective-subheader {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
    margin-bottom: 20px;
}

.collective-name {
    font-size: 15px;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 15px;
}

.collective-links {
    font-size: 15px;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 30px;
}

.collective-links a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.3s;
}

.collective-links a:hover {
    color: var(--border-light);
}

.collective-separator {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.coming-soon-text {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 5px;
    color: var(--text);
    margin-bottom: 15px;
}

.coming-soon-subtitle {
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--border-light);
}

.section-content > * {
    opacity: 0;
    transform: translateX(-30px);
    transition: none;
}

.section-content.active > * {
    transition: all 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.section-content.active > *:nth-child(1) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
}

.section-content.active > *:nth-child(2) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.2s;
}

.section-content.active > *:nth-child(3) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.3s;
}

.section-content.active > *:nth-child(4) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.4s;
}

.section-content.active > *:nth-child(5) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.5s;
}

.section-content.active > *:nth-child(6) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.6s;
}

.section-content.active > *:nth-child(7) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.7s;
}

.section-content.active > *:nth-child(8) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.8s;
}

#protocols {
    max-width: 100%;
    text-align: center;
    padding: 40px 20px;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for protocols section */
#protocols::-webkit-scrollbar {
    width: 6px;
}

#protocols::-webkit-scrollbar-track {
    background: transparent;
}

#protocols::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

#protocols::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}

/* Scale protocols section for smaller screens */
@media screen and (max-height: 900px) and (min-width: 901px) {
    #protocols {
        padding: 30px 20px;
    }
    
    .section-header {
        font-size: 18px;
        margin-bottom: 30px;
    }
    
    .about-text {
        font-size: 14px;
        margin-bottom: 20px;
    }
}

@media screen and (max-height: 800px) and (min-width: 901px) {
    #protocols {
        padding: 25px 20px;
    }
    
    .section-header {
        font-size: 17px;
        margin-bottom: 25px;
    }
    
    .about-text {
        font-size: 13px;
        margin-bottom: 18px;
    }
}

@media screen and (max-height: 700px) and (min-width: 901px) {
    #protocols {
        padding: 20px 15px;
    }
    
    .section-header {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .about-text {
        font-size: 12px;
        margin-bottom: 15px;
    }
}

@media screen and (max-height: 650px) and (min-width: 901px) {
    #protocols {
        padding: 15px 10px;
    }
    
    .section-header {
        font-size: 15px;
        margin-bottom: 15px;
    }
    
    .about-text {
        font-size: 11px;
        margin-bottom: 12px;
    }
}

.game-container-wrapper {
    margin-top: 40px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 30px;
    width: 100%;
    justify-content: center;
}

/* Scale game container for different heights */
@media screen and (max-height: 900px) and (min-width: 901px) {
    .game-container-wrapper {
        margin-top: 30px;
        gap: 25px;
    }
    
    .game-menu h1 {
        font-size: 42px;
        letter-spacing: 5px;
        margin-bottom: 25px;
    }
    
    .game-menu h3 {
        font-size: 16px;
        margin-bottom: 35px;
    }
    
    .game-controls-text {
        font-size: 12px;
        margin-bottom: 35px;
    }
    
    .game-button {
        padding: 11px 28px;
        font-size: 13px;
        margin: 7px;
    }
}

@media screen and (max-height: 800px) and (min-width: 901px) {
    .game-container-wrapper {
        margin-top: 25px;
        gap: 20px;
    }
    
    .game-menu h1 {
        font-size: 38px;
        letter-spacing: 4px;
        margin-bottom: 20px;
    }
    
    .game-menu h3 {
        font-size: 15px;
        margin-bottom: 30px;
    }
    
    .game-controls-text {
        font-size: 11px;
        margin-bottom: 30px;
    }
    
    .game-button {
        padding: 10px 26px;
        font-size: 12px;
        margin: 6px;
    }
    
    .game-buttons-row {
        margin-top: 15px;
        gap: 10px;
    }
}

@media screen and (max-height: 700px) and (min-width: 901px) {
    .game-container-wrapper {
        margin-top: 20px;
        gap: 18px;
    }
    
    .game-menu h1 {
        font-size: 34px;
        letter-spacing: 3px;
        margin-bottom: 18px;
    }
    
    .game-menu h3 {
        font-size: 14px;
        margin-bottom: 25px;
    }
    
    .game-controls-text {
        font-size: 10px;
        margin-bottom: 25px;
        line-height: 1.6;
    }
    
    .game-button {
        padding: 9px 24px;
        font-size: 11px;
        margin: 5px;
    }
    
    .game-buttons-row {
        margin-top: 12px;
        gap: 8px;
    }
}

@media screen and (max-height: 650px) and (min-width: 901px) {
    .game-container-wrapper {
        margin-top: 15px;
        gap: 15px;
    }
    
    .game-menu h1 {
        font-size: 30px;
        letter-spacing: 3px;
        margin-bottom: 15px;
    }
    
    .game-menu h3 {
        font-size: 13px;
        margin-bottom: 20px;
    }
    
    .game-controls-text {
        font-size: 9px;
        margin-bottom: 20px;
        line-height: 1.5;
    }
    
    .game-button {
        padding: 8px 22px;
        font-size: 11px;
        margin: 4px;
        letter-spacing: 1.5px;
    }
    
    .game-button.tweet svg {
        width: 14px;
        height: 14px;
    }
    
    .game-buttons-row {
        margin-top: 10px;
        gap: 6px;
    }
}

.game-canvas-container {
    position: relative;
    border: 1px solid var(--border);
    background: var(--background);
    padding: 10px;
    max-width: 653px;
    width: 100%;
}

/* Scale game canvas container for different heights */
@media screen and (max-height: 800px) and (min-width: 901px) {
    .game-canvas-container {
        padding: 9px;
    }
}

@media screen and (max-height: 700px) and (min-width: 901px) {
    .game-canvas-container {
        padding: 8px;
    }
}

@media screen and (max-height: 650px) and (min-width: 901px) {
    .game-canvas-container {
        padding: 7px;
    }
}

#gameCanvas {
    display: block;
    background: url(https://i.imgur.com/Y0BMP.png) top left;
    width: 100%;
    height: auto;
}

#gameScoreBoard {
    width: calc(100% - 20px);
    height: 50px;
    background: rgba(182, 200, 220, 0.7);
    position: absolute;
    top: 17px;
    left: 10px;
    z-index: 1;
    border: 3px solid #b6c8dc;
}

#gameScoreBoard p {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 600;
    padding: 0;
    line-height: 47px;
    margin: 0 0 0 5px;
    color: #000;
}

.game-menu {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.game-menu.hidden {
    display: none;
}

.game-menu h1 {
    font-family: 'Inter', sans-serif;
    font-size: 48px;
    font-weight: 600;
    letter-spacing: 6px;
    color: #fff;
    margin-bottom: 30px;
}

.game-menu h3 {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 300;
    color: #ccc;
    margin-bottom: 40px;
}

.game-controls-text {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 300;
    color: #999;
    margin-bottom: 40px;
    line-height: 1.8;
}

.game-button {
    padding: 12px 32px;
    border: 1px solid #fff;
    background: transparent;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    margin: 8px;
    text-decoration: none;
    display: inline-block;
}

.game-button:hover {
    background: #fff;
    color: #000;
}

.game-button.gyro {
    font-size: 11px;
    padding: 8px 20px;
}

.game-button.tweet {
    border: 1px solid #ffffff;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.game-button.tweet:hover {
    background: #000000;
    color: #fff;
}

.game-button.tweet svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.game-button.leaderboard {
    border: 1px solid #FFD700;
    color: #FFD700;
}

.game-button.leaderboard:hover {
    background: #FFD700;
    color: #000;
}


@media screen and (min-width: 900px) and (max-width:1200px) {
.home-logo{
    margin-left:7.5%;
}
}

/* Hide leaderboard buttons on desktop - show only on mobile/tablet */
@media screen and (min-width: 1201px) {
    .game-button.leaderboard {
        display: none !important;
    }
}

.game-buttons-row {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

#gameSprite {
    display: none;
}

.home-logo-light {
    display: none;
}

.home-logo-dark {
    display: block;
}

[data-theme="light"] .home-logo-light {
    display: block;
}

[data-theme="light"] .home-logo-dark {
    display: none;
}

/* Username Modal */
.username-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}



.username-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.username-modal {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #fff;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.username-modal h2 {
    font-family: 'Inter', sans-serif;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: 4px;
    color: #fff;
    margin-bottom: 20px;
}

.username-modal p {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 300;
    color: #ccc;
    margin-bottom: 30px;
    line-height: 1.6;
}

.username-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.username-input {
    width: 100%;
    padding: 15px 15px 15px 35px;
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 300;
    letter-spacing: 1px;
    outline: none;
    transition: all 0.3s;
}

.username-input:focus {
    border-color: #FFD700;
}

.username-input::placeholder {
    color: #666;
}

.username-at-symbol {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    pointer-events: none;
}

.username-error {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #ff4444;
    margin-top: 10px;
    min-height: 18px;
}

.username-submit {
    padding: 15px 40px;
    border: 1px solid #fff;
    background: transparent;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.username-submit:hover {
    background: #fff;
    color: #000;
}

.username-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Leaderboard Modal */
.leaderboard-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.leaderboard-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.leaderboard-modal {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #fff;
    padding: 20px;
    width: 90%;
    max-width: 653px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dotted #fff;
}

.leaderboard-title {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #FFD700;
}

.leaderboard-close {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.leaderboard-close:hover {
    background: #fff;
    color: #000;
}

.leaderboard-stats {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 300;
    color: #ccc;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dotted #666;
}

.leaderboard-content {
    overflow-y: auto;
    max-height: calc(90vh - 200px);
    padding-right: 10px;
}

.leaderboard-content::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Inter', sans-serif;
    transition: background 0.2s;
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-entry.user-entry {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-rank {
    font-size: 16px;
    font-weight: 600;
    color: #999;
    min-width: 50px;
    text-align: left;
}

.leaderboard-entry.top-3 .leaderboard-rank {
    color: #FFD700;
    font-size: 20px;
}

.leaderboard-username {
    flex: 1;
    font-size: 15px;
    font-weight: 300;
    color: #fff;
    text-align: left;
    padding-left: 20px;
}

.leaderboard-score {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    min-width: 80px;
    text-align: right;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #999;
}

.leaderboard-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dotted #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.username-change-btn {
    background: transparent;
    border: 1px solid #666;
    color: #666;
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}

.username-change-btn:hover {
    border-color: #fff;
    color: #fff;
}

.leaderboard-refresh {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #666;
}

/* Persistent Leaderboard (Desktop Only) */
.persistent-leaderboard {
    background: var(--background);
    border: 1px solid var(--border);
    padding: 20px;
    width: 400px;
    max-height: 673px; /* Matches game canvas height (653px + 20px padding) */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

/* Scale leaderboard width for smaller viewports */
@media screen and (max-height: 800px) and (min-width: 901px) {
    .persistent-leaderboard {
        width: 360px;
    }
}

@media screen and (max-height: 700px) and (min-width: 901px) {
    .persistent-leaderboard {
        width: 340px;
    }
}

@media screen and (max-height: 650px) and (min-width: 901px) {
    .persistent-leaderboard {
        width: 320px;
    }
}

.persistent-leaderboard-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dotted var(--border);
    flex-shrink: 0;
}

.persistent-leaderboard-title {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 3px;
    color: #FFD700;
}

.persistent-leaderboard-stats {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 300;
    color: var(--text);
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dotted var(--border);
    flex-shrink: 0;
}

[data-theme="light"] .persistent-leaderboard-stats {
    background: rgba(0, 0, 0, 0.03);
}

.persistent-leaderboard-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 10px;
    min-height: 0; /* Important for flex scrolling */
}

.persistent-leaderboard-content::-webkit-scrollbar {
    width: 6px;
}

.persistent-leaderboard-content::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

.persistent-leaderboard-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
    transition: background 0.3s;
}

.persistent-leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: var(--text);
}

.persistent-leaderboard-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dotted var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* Scale persistent leaderboard elements for different heights */
@media screen and (max-height: 900px) and (min-width: 901px) {
    .persistent-leaderboard {
        padding: 18px;
    }
    
    .persistent-leaderboard-title {
        font-size: 17px;
        letter-spacing: 2.5px;
    }
    
    .persistent-leaderboard-stats {
        font-size: 11px;
        padding: 9px;
        margin-bottom: 12px;
    }
    
    .persistent-leaderboard-header {
        margin-bottom: 18px;
        padding-bottom: 12px;
    }
    
    .leaderboard-entry {
        padding: 11px;
    }
    
    .leaderboard-rank {
        font-size: 15px;
    }
    
    .leaderboard-username {
        font-size: 14px;
    }
    
    .leaderboard-score {
        font-size: 15px;
    }
}

@media screen and (max-height: 800px) and (min-width: 901px) {
    .persistent-leaderboard {
        padding: 16px;
    }
    
    .persistent-leaderboard-title {
        font-size: 16px;
        letter-spacing: 2px;
    }
    
    .persistent-leaderboard-stats {
        font-size: 11px;
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .persistent-leaderboard-header {
        margin-bottom: 16px;
        padding-bottom: 10px;
    }
    
    .leaderboard-entry {
        padding: 10px;
    }
    
    .leaderboard-rank {
        font-size: 14px;
    }
    
    .leaderboard-username {
        font-size: 13px;
    }
    
    .leaderboard-score {
        font-size: 14px;
    }
    
    .username-change-btn-persistent {
        font-size: 10px;
        padding: 7px 14px;
    }

    .home-logo{
        margin-left:17.5%;
    }
}

@media screen and (max-height: 700px) and (min-width: 901px) {
    .persistent-leaderboard {
        padding: 14px;
    }
    
    .persistent-leaderboard-title {
        font-size: 15px;
        letter-spacing: 2px;
    }
    
    .persistent-leaderboard-stats {
        font-size: 10px;
        padding: 7px;
        margin-bottom: 8px;
    }
    
    .persistent-leaderboard-header {
        margin-bottom: 14px;
        padding-bottom: 8px;
    }
    
    .leaderboard-entry {
        padding: 9px;
    }
    
    .leaderboard-rank {
        font-size: 13px;
        min-width: 45px;
    }
    
    .leaderboard-username {
        font-size: 12px;
        padding-left: 15px;
    }
    
    .leaderboard-score {
        font-size: 13px;
        min-width: 70px;
    }
    
    .username-change-btn-persistent {
        font-size: 9px;
        padding: 6px 12px;
    }
    
    .leaderboard-refresh-persistent {
        font-size: 9px;
    }

    .home-logo{
        margin-left:17.5%;
    }
}

@media screen and (max-height: 650px) and (min-width: 901px) {
    .persistent-leaderboard {
        padding: 12px;
    }
    
    .persistent-leaderboard-title {
        font-size: 14px;
        letter-spacing: 1.5px;
    }
    
    .persistent-leaderboard-stats {
        font-size: 9px;
        padding: 6px;
        margin-bottom: 6px;
    }
    
    .persistent-leaderboard-header {
        margin-bottom: 12px;
        padding-bottom: 6px;
    }
    
    .persistent-leaderboard-footer {
        margin-top: 10px;
        padding-top: 10px;
        gap: 8px;
    }
    
    .leaderboard-entry {
        padding: 8px;
    }
    
    .leaderboard-rank {
        font-size: 12px;
        min-width: 40px;
    }
    
    .leaderboard-username {
        font-size: 11px;
        padding-left: 12px;
    }
    
    .leaderboard-score {
        font-size: 12px;
        min-width: 65px;
    }
    
    .username-change-btn-persistent {
        font-size: 9px;
        padding: 5px 10px;
    }
    
    .leaderboard-refresh-persistent {
        font-size: 8px;
    }

    .home-logo{
        margin-left:17.5%;
    }
}    


.username-change-btn-persistent {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--border-light);
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.username-change-btn-persistent:hover {
    border-color: var(--text);
    color: var(--text);
}

.leaderboard-refresh-persistent {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--footer-text);
    text-align: center;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--text);
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.mobile-menu-toggle:hover {
    color: var(--border-light);
}

.menu-circle {
    width: 32px;
    height: 32px;
    border: 1px dotted var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.menu-circle-inner {
    width: 8px;
    height: 8px;
    background: var(--text);
    border-radius: 50%;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.mobile-menu-toggle.active .menu-circle {
    transform: rotate(90deg);
    border-style: solid;
}

.mobile-menu-toggle.active .menu-circle-inner {
    transform: scale(0);
}

/* Hide MENU text */
.menu-text {
    display: none;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}

@media screen and (max-width: 900px) {
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        position: fixed;
        left: -380px;
        transition: left 0.5s cubic-bezier(0.77, 0, 0.175, 1);
        background-color: var(--background);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1000;
        padding: 40px 50px 40px 50px;
        width: 320px;
        border-right: 1px solid var(--border);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.3);
        justify-content: center;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    .content-inner {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        max-height: 100vh;
        padding: 0;
        width: 100%;
        overflow: hidden;
    }

    #home {
        text-align: center;
        padding: 20px;
        max-height: 100vh;
        overflow-y: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #home img.home-logo {
        max-height: 70vh;
        width: auto;
        max-width: 90%;
        object-fit: contain;
        margin-left: 17.5%;
    }

    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
    }

    .nav-icon {
        display: none !important;
    }

    .logo {
        font-size: 20px;
        margin-bottom: 30px;
        padding-bottom: 30px;
        opacity: 0;
    }

    .nav-section {
        margin-bottom: 30px;
        padding-bottom: 30px;
        opacity: 0;
    }

    .nav-title {
        font-size: 18px;
    }

    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 12px;
    }

    .footer {
        font-size: 10px;
        opacity: 0;
    }

    .section-header {
        font-size: 18px;
    }

    .about-text {
        font-size: 14px;
    }
    
    #protocols {
        padding: 20px 15px;
        max-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .game-canvas-container {
        max-width: 100%;
        width: 95%;
    }

    .game-menu h1 {
        font-size: 32px;
        letter-spacing: 4px;
    }

    .game-menu h3 {
        font-size: 14px;
    }

    .game-controls-text {
        font-size: 11px;
        padding: 0 15px;
    }

    .game-buttons-row {
        flex-direction: column;
        gap: 8px;
    }

    .game-button.tweet,
    .game-button.leaderboard {
        font-size: 12px;
        padding: 10px 24px;
    }

    .username-modal {
        padding: 30px 20px;
    }

    .username-modal h2 {
        font-size: 24px;
    }

    .leaderboard-modal {
        width: 95%;
        padding: 15px;
    }

    .leaderboard-title {
        font-size: 18px;
        letter-spacing: 2px;
    }
}

@media screen and (max-width: 500px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    .logo {
        font-size: 18px;
        letter-spacing: 2px;
    }

    .nav-title {
        font-size: 16px;
        letter-spacing: 2px;
    }

    .home-logo {
        max-width: 100%;
        width: 90%;
        margin: 0 auto;
        margin-left: 17.5;
    }

    .game-menu h1 {
        font-size: 28px;
    }

    .game-menu h3 {
        font-size: 12px;
    }
}/* ========================================
   FLUID RESPONSIVE SCALING FOR ALL DESKTOPS
   Everything scales perfectly to fit ANY viewport
   ======================================== */

/* Mobile menu animations */
.sidebar.mobile-open .logo {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.1s;
    margin-top: 60px; /* Add space from menu button */
}

.sidebar.mobile-open .nav-section:nth-child(2) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.15s;
}

.sidebar.mobile-open .nav-section:nth-child(3) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.2s;
}

.sidebar.mobile-open .nav-section:nth-child(4) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.25s;
}

.sidebar.mobile-open .nav-section:nth-child(5) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.3s;
}

.sidebar.mobile-open .nav-section:nth-child(6) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.35s;
}

.sidebar.mobile-open .nav-section:nth-child(7) {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.4s;
}

.sidebar.mobile-open .footer {
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 0.45s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smaller desktops/tablets - Show mobile menu */
@media screen and (max-width: 1200px) and (min-width: 901px) {
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .sidebar {
        position: fixed;
        left: -380px;
        transition: left 0.5s cubic-bezier(0.77, 0, 0.175, 1);
        background-color: var(--background);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 1000;
        padding: 40px 50px;
        width: 320px;
        border-right: 1px solid var(--border);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.mobile-open {
        left: 0;
    }
    
    .content {
        margin-left: 0;
        width: 100%;
    }
    
    .logo,
    .nav-section,
    .footer {
        opacity: 0;
    }
    
    /* Hide persistent leaderboard on tablets */
    .persistent-leaderboard {
        display: none;
    }
    
    .game-container-wrapper {
        flex-direction: column;
        align-items: center;
    }
}

/* GRANULAR HEIGHT-BASED SCALING FOR DESKTOPS (min-width: 901px) */
/* 1080p and above - Base styles already set, no changes needed */

/* Between 1000px - 1080px height */
@media screen and (max-height: 1080px) and (min-height: 1001px) and (min-width: 901px) {
    .sidebar {
        padding: 50px 0 50px 120px;
    }
    
    .logo {
        font-size: 20px;
        margin-bottom: 30px;
        padding-bottom: 30px;
    }
    
    .nav-section {
        margin-bottom: 30px;
        padding-bottom: 30px;
    }
    
    .nav-title {
        font-size: 20px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 12px;
    }
    
    .footer {
        margin-top: 30px;
        font-size: 10px;
    }
    
    #gameCanvas {
        max-height: 70vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 70vh;
    }
}

/* Between 900px - 1000px height */
@media screen and (max-height: 1000px) and (min-height: 901px) and (min-width: 901px) {
    .sidebar {
        padding: 40px 0 40px 100px;
    }
    
    .logo {
        font-size: 18px;
        margin-bottom: 25px;
        padding-bottom: 25px;
    }
    
    .nav-section {
        margin-bottom: 25px;
        padding-bottom: 25px;
    }
    
    .nav-title {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 11px;
    }
    
    .footer {
        margin-top: 25px;
        font-size: 10px;
    }
    
    #gameCanvas {
        max-height: 68vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 68vh;
    }
}

/* Between 800px - 900px height */
@media screen and (max-height: 900px) and (min-height: 801px) and (min-width: 901px) {
    .sidebar {
        padding: 35px 0 35px 90px;
    }
    
    .logo {
        font-size: 17px;
        margin-bottom: 22px;
        padding-bottom: 22px;
    }
    
    .nav-section {
        margin-bottom: 22px;
        padding-bottom: 22px;
    }
    
    .nav-title {
        font-size: 17px;
        margin-bottom: 4px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 11px;
    }
    
    .footer {
        margin-top: 22px;
        font-size: 9px;
    }
    
    #gameCanvas {
        max-height: 65vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 65vh;
    }
}

/* Between 750px - 800px height */
@media screen and (max-height: 800px) and (min-height: 751px) and (min-width: 901px) {
    .sidebar {
        padding: 30px 0 30px 80px;
    }
    
    .logo {
        font-size: 16px;
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .nav-section {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .nav-title {
        font-size: 16px;
        margin-bottom: 3px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 10px;
    }
    
    .footer {
        margin-top: 20px;
        font-size: 9px;
    }
    
    #gameCanvas {
        max-height: 62vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 62vh;
    }
}

/* Between 700px - 750px height */
@media screen and (max-height: 750px) and (min-height: 701px) and (min-width: 901px) {
    .sidebar {
        padding: 25px 0 25px 70px;
    }
    
    .logo {
        font-size: 15px;
        margin-bottom: 18px;
        padding-bottom: 18px;
    }
    
    .nav-section {
        margin-bottom: 18px;
        padding-bottom: 18px;
    }
    
    .nav-title {
        font-size: 15px;
        margin-bottom: 2px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 9px;
    }
    
    .footer {
        margin-top: 18px;
        font-size: 8px;
    }
    
    .footer-icon {
        width: 13px;
        height: 13px;
    }
    
    #gameCanvas {
        max-height: 60vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 60vh;
    }
}

/* Between 650px - 700px height */
@media screen and (max-height: 700px) and (min-height: 651px) and (min-width: 901px) {
    .sidebar {
        padding: 20px 0 20px 60px;
    }
    
    .logo {
        font-size: 14px;
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .nav-section {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .nav-title {
        font-size: 14px;
        margin-bottom: 2px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 9px;
    }
    
    .footer {
        margin-top: 16px;
        font-size: 8px;
    }
    
    .footer-icon {
        width: 12px;
        height: 12px;
    }
    
    #gameCanvas {
        max-height: 58vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 58vh;
    }
}

/* 650px height and below - Maximum compression */
@media screen and (max-height: 650px) and (min-width: 901px) {
    .sidebar {
        padding: 15px 0 15px 50px;
    }
    
    .logo {
        font-size: 13px;
        margin-bottom: 14px;
        padding-bottom: 14px;
    }
    
    .nav-section {
        margin-bottom: 14px;
        padding-bottom: 14px;
    }
    
    .nav-title {
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 8px;
    }
    
    .footer {
        margin-top: 14px;
        font-size: 7px;
    }
    
    .footer-icon {
        width: 11px;
        height: 11px;
    }
    
    #gameCanvas {
        max-height: 55vh;
        width: auto;
    }
    
    .persistent-leaderboard {
        max-height: 55vh;
    }
}

/* MOBILE - Compact menu with scrolling */
@media screen and (max-width: 900px) {
    .sidebar {
        height: 100vh;
        overflow-y: auto;
        padding: 30px 30px !important;
        justify-content: flex-start !important;
    }
    
    .logo {
        font-size: 16px !important;
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
        margin-top: 60px;
    }
    
    .nav-section {
        margin-bottom: 20px !important;
        padding-bottom: 20px !important;
    }
    
    .nav-title {
        font-size: 16px !important;
        margin-bottom: 3px !important;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 11px !important;
    }
    
    .footer {
        font-size: 9px !important;
        margin-top: 20px !important;
        margin-bottom: 20px;
    }
    
    .footer-icon {
        width: 14px;
        height: 14px;
    }
    
    /* Protocols section needs full width on mobile */
    #protocols {
        max-width: 100% !important;
        padding: 20px 10px !important;
    }
    
    /* Game scaling on mobile */
    #gameCanvas {
        max-height: 60vh;
        max-width: 90vw;
        width: auto;
        height: auto;
    }
    
    .game-container-wrapper {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 20px 0;
    }
    
    /* Hide persistent leaderboard on mobile */
    .persistent-leaderboard {
        display: none;
    }
}

/* Very small mobile screens */
@media screen and (max-width: 900px) and (max-height: 700px) {
    .sidebar {
        padding: 20px 25px !important;
    }
    
    .logo {
        font-size: 14px !important;
        margin-bottom: 15px !important;
        padding-bottom: 15px !important;
    }
    
    .nav-section {
        margin-bottom: 15px !important;
        padding-bottom: 15px !important;
    }
    
    .nav-title {
        font-size: 14px !important;
        margin-bottom: 2px !important;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 10px !important;
    }
    
    .footer {
        font-size: 8px !important;
        margin-top: 15px !important;
    }
    
    .section-content {
        max-height: calc(100vh - 170px) !important; /* Adjusted for smaller screens */
        padding: 20px 15px !important;
        margin-top: 75px;
        margin-bottom: 75px;
    }
    
    #protocols {
        padding: 15px 10px !important;
        max-height: calc(100vh - 50px) !important;
    }
    
    #gameCanvas {
        max-height: 50vh;
        max-width: 85vw;
    }
}

/* Landscape mobile - Extra compact */
@media screen and (max-width: 900px) and (orientation: landscape) {
    .sidebar {
        padding: 15px 20px !important;
    }
    
    .logo {
        font-size: 13px !important;
        margin-bottom: 12px !important;
        padding-bottom: 12px !important;
        margin-top: 55px;
    }
    
    .nav-section {
        margin-bottom: 12px !important;
        padding-bottom: 12px !important;
    }
    
    .nav-title {
        font-size: 13px !important;
        margin-bottom: 2px !important;
    }
    
    .nav-subtitle,
    .nav-subtitle-soon {
        font-size: 9px !important;
    }
    
    .footer {
        font-size: 8px !important;
        margin-top: 12px !important;
    }
    
    .section-content {
        max-height: calc(100vh - 160px) !important; /* Adjusted for landscape */
        padding: 15px 10px !important;
        margin-top: 70px;
        margin-bottom: 70px;
    }
    
    #protocols {
        padding: 12px 8px !important;
        max-height: calc(100vh - 40px) !important;
    }
    
    #gameCanvas {
        max-height: 70vh;
        max-width: 80vw;
    }
}
