:root {
    --color-orange-400: #f67123;
    --color-orange-600: #f55622;
    --color-orange-800: #f34221;
    --color-gray-900: #1a1a1a;
    --color-gray-800: #12120f;
    --color-gray-700: #2e2e30;
    --color-gray-600: #313131;
    --color-blue-400: #0085ff;
    --color-blue-600: #0062F5;
    --color-green: #74fd32;
    --color-orange-green-400: #b1de22;
    --color-orange-green-600: #d8d72b;
    --color-orange-green-800: #fad132;
    --color-blue-gradient: linear-gradient(90deg, var(--color-blue-400), var(--color-blue-600));
    --color-orange-gradient: linear-gradient(90deg, var(--color-orange-600), var(--color-orange-800));
    --color-progress-gradient: linear-gradient(90deg, var(--color-green), var(--color-orange-400));
    
    /* Add new colors here following the same pattern */
    /* --color-purple-400: #a855f7; */
    /* --color-red-500: #ef4444; */
    --page-padding-y: clamp(1rem, 3vh, 2.5rem);
    --page-padding-x: clamp(0.75rem, 4vw, 3rem);
    --fixed-bar-height: 3.25rem;
    --tap-square-size: clamp(220px, min(85vw, 85vh), 380px);
    --content-max-width: min(960px, 92vw);
    --panel-radius: 20px;
}

/* Shop confirmation message */
.shop-confirm-msg {
    position: absolute;
    left: 50%;
    top: 32px;
    transform: translateX(-50%);
    background: #222d;
    color: #ffe;
    border-radius: 16px;
    padding: 12px 32px;
    font-size: 1.2em;
    font-weight: 600;
    box-shadow: 0 2px 16px #0006;
    z-index: 1002;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s;
}
.shop-confirm-msg.fade {
    opacity: 0;
}
body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: black;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.5s;
    padding: env(safe-area-inset-top) var(--page-padding-x) calc(var(--page-padding-y) + var(--fixed-bar-height) + env(safe-area-inset-bottom));
    box-sizing: border-box;
}

body > .progress-container {
    width: min(var(--content-max-width), 100%);
    margin: 0 auto;
    border-radius: 999px;
}

.header {
    max-width: 400px;
    background: linear-gradient(0deg, var(--color-gray-900), var(--color-gray-800));
    backdrop-filter: blur(10px);
    box-sizing: border-box;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    position: relative;
}

.header h1 {
    color: var(--color-orange-600);
    font-family: 'Chakra Petch', sans-serif;
    font-size: 1.5rem;
}

/* User Avatar Button and Dropdown */
.user-avatar-container {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.user-avatar-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: url('/assets/icons/user.png');
    background-position: center;
    background-size: cover;
    border: 2px solid var(--color-orange-400);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-avatar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar-btn:focus {
    outline: none;
    border-color: var(--color-orange-400);
    box-shadow: 0 0 0 2px rgba(255, 165, 0, 0.4);
}

.user-avatar-btn:active {
    transform: translateY(0);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.user-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-dropdown-content {
    padding: .5rem;
}

.user-dropdown-header {
    font-weight: bold;
    color: var(--color-orange-400);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
}

.user-info {
    color: #ffffff;
    font-size: 0.9rem;
    line-height: 1.4;
}

.user-info .loading {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
}

.user-info .username {
    font-weight: 600;
    color: var(--color-orange-300);
    margin-bottom: 0.25rem;
}

.user-info .email {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.user-info .sign-up-message {
    color: rgba(255, 255, 255, 0.9);
}

.user-info .sign-up-link {
    color: var(--color-orange-400);
    text-decoration: underline;
    cursor: pointer;
}

.user-info .sign-up-link:hover {
    color: var(--color-orange-300);
}

/* Dropdown menu items */
.dropdown-menu-item {
    width: 100%;
    background: none;
    border: none;
    padding: 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: 'Chakra Petch', sans-serif;
    text-transform: uppercase;
}

.dropdown-menu-item:hover {
    background: rgba(255, 165, 0, 0.1);
    color: var(--color-orange-300);
}

.dropdown-menu-item .menu-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    display:none;
}

.dropdown-menu-item .menu-text {
    flex: 1;
    text-align: left;
    font-weight: 400;
}

/* Dropdown separator */
.dropdown-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

/* My Account Overlay */
.account-panel {
    max-width: 500px;
    width: 90vw;
}

.account-content {
    padding: 1.5rem 0;
}

.account-info {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.account-info .loading {
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

.account-info .user-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-info .detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-info .detail-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.account-info .detail-value {
    font-size: 1rem;
    color: #ffffff;
    font-weight: 600;
}

.account-info .detail-value.username {
    color: var(--color-orange-300);
    font-size: 1.1rem;
}

.account-info .guest-notice {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.account-info .guest-notice .highlight {
    color: var(--color-orange-400);
    font-weight: 600;
}

.account-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.account-action-btn {
    background: var(--color-orange-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.account-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.3);
}

.account-action-btn:active {
    transform: translateY(0);
}

/* Mobile responsive adjustments for user avatar */
@media (max-width: 480px) {
    .user-avatar-container {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .user-avatar-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .user-dropdown {
        min-width: 200px;
        right: -10px;
    }
    
    .user-dropdown-content {
        padding: 0.875rem;
    }

    .account-panel {
        width: 95vw;
        max-width: none;
    }
    
    .account-info {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .account-info .detail-item {
        gap: 0.15rem;
    }
    
    .dropdown-menu-item {
        padding: 0.625rem;
        font-size: 0.85rem;
    }
}

@media (max-height: 600px) {
    .user-dropdown {
        max-height: 200px;
        overflow-y: auto;
    }
}

 nav.mode-toggle {
    display: flex;
    justify-content: space-between;
    width:400px;
    /* gap: 0.5rem;
    margin: 0.5rem 0 1rem; */
}

.mode-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-direction: column;
    width: min(var(--content-max-width), 100%);
    margin-left: auto;
    margin-right: auto;
}

.mode-tabs {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    width:100%;
}

.mode-tab {
    position: relative;
    z-index: 1;
    border: none;
    background: none;
    color: white;
    font-weight: 500;
    padding: 5px;
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0;
    font-family: 'Chakra Petch', sans-serif;
    width: 33.333%;
}

.mode-tab.active {
    border-bottom: 1px solid var(--color-orange-400);
}

.tab-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
/* Mode indicator */
.mode-indicator {
    display: flex;
    justify-content: center;
    margin-top: 0.5rem;
    color: #ccc;
    font-size: 0.95rem;
}
.mode-option {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 0.4rem;
    cursor: pointer;
    padding: 1rem 2rem;
    border-radius: 12px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    background: linear-gradient(0deg, #1a1a1a, #3a3a3a);
    width: min(100%, 420px);
}
.mode-option:hover {
    background: var(--color-blue-gradient);
    color:white;
font-weight: bold;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.mode-option input[type="radio"] {
    display: none;
}

.mode-title {
    font-weight: bold;
    margin-right: 0.25rem;
    font-size: 1.2rem;
}

.mode-desc {
    font-style: italic;
    color: #aaa;
    font-size: 0.9rem;
}

.play-now-button {
    display: inline-block;
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
    font-weight: normal;
    background: var(--color-orange-gradient);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 24px rgba(255, 165, 0, 0.3);
    text-transform: capitalize;
    letter-spacing: 0.5px;
    font-family: 'Chakra Petch', sans-serif;
    min-width: 200px;
}

.play-now-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 165, 0, 0.4);
    background: linear-gradient(45deg, var(--color-orange-400), var(--color-orange-600));
}

.play-now-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(255, 165, 0, 0.3);
}

/* Mobile responsive styling for Play Now button */
@media (max-width: 480px) {
    .play-now-button {
        padding: 1rem 2.5rem;
        font-size: 1.2rem;
        min-width: 180px;
    }
}

@media (max-height: 600px) {
    .play-now-button {
        padding: 0.8rem 2rem;
        font-size: 1.1rem;
    }
}

#currentModeName {
    color: #0ff;
}

/* Time Attack Game Over Overlay */
#gameOverOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#gameOverOverlay.hidden {
    display: none;
}

.results-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--panel-radius);
    padding: clamp(1.25rem, 2vw, 2rem);
    width: min(420px, 92vw);
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.final-score {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin: 1rem 0;
}
 
.score-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--color-orange-600);
    font-family: 'Chakra Petch', sans-serif;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

#playAgainButton, #changeModeButton {
    background: var(--color-blue-gradient);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0.6rem 1rem;
    font-weight: bold;
    cursor: pointer;
}

#changeModeButton {
    background: var(--color-gray-700);
    color: white;
}

* {
    box-sizing: border-box;
}

#welcome {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    background-image: url('assets/welcome.jpeg');
    background-blend-mode: darken;
    background-position: center;
    background-size: cover;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#welcome.hidden {
    opacity: 0;
    visibility: hidden;
}

#welcome h1 {
    color: var(--color-orange-600);
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 709;
    text-shadow: 0 0 15px black;
}

#welcome p { 
    padding: 0 2rem;
    text-align:center;
}
#info {
    margin: 0 auto;
    text-align: center;
    backdrop-filter: blur(5px);
    overflow-y: auto;
    max-height: 80vh;
    width: 50%;
    overflow: hidden;
}

#info h1 {
    color: #0ff;
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px #0ff;
}

#info h2 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

#info p {
    color: #ccc;
    font-size: 1.2rem;
    font-weight: bold;
    margin:  0 0 0.5rem 0;
}

#info ul {
    text-align: left;
    margin: 0.5rem 0 1.5rem 0;
    padding-left: 1.5rem;
}

#info li {
    color: #fff;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

#startButton {
    background: linear-gradient(45deg, #0ff, #00bfff);
    border: none;
    border-radius: 50px;
    color: #000;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.3);
    margin-top: 1rem;
}

#startButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 255, 255, 0.5);
    background: linear-gradient(45deg, #00bfff, #0ff);
}

#startButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 15px rgba(0, 255, 255, 0.3);
}

.reset-container {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

#resetButton {
    background: linear-gradient(45deg, #ff4444, #ff6666);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.75rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 15px rgba(255, 68, 68, 0.3);
}

#resetButton:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.5);
    background: linear-gradient(45deg, #ff6666, #ff4444);
}

#resetButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 68, 68, 0.3);
}

.hidden {
    display: none;
}
.level-info {
    display: flex;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);
    font-size: medium;
    margin: clamp(1rem, 1rem, 2.5rem) auto;
    user-select: none;
    flex-wrap: wrap;
    padding: 0 clamp(0.5rem, 4vw, 1.5rem);
    width: min(var(--content-max-width), 100%);
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: clamp(32vh, 45vh, 520px);
    position: relative;
    margin: 0 auto;
    width: min(100%, var(--content-max-width));
}
.tap-square {
    width: var(--tap-square-size);
    height: var(--tap-square-size);
    background: linear-gradient(0deg, var(--color-orange-800), var(--color-orange-400));
    border-radius: clamp(14px, 4vw, 18px);
    color:white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    font-size: 2.1rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 32px #0008;
    user-select: none;
    position: relative;
    text-align: center;
    overflow: hidden;
    touch-action: manipulation;
}
.tap-square.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}
.tap-start-prompt {
    font-weight: bold;
    color: #fff;
    pointer-events: none;
    font-size: 3rem;
    text-transform:uppercase;
    font-family: 'chakra petch', sans-serif;
}
.progress-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    background: var(--color-progress-gradient);
    opacity:1;
    pointer-events: none;
    transition: height 0.3s cubic-bezier(.4,2,.6,1), opacity 0.2s, background 0.25s ease, filter 0.25s ease;
    z-index: 1;
    border-radius: inherit;
}

/* Pulse when time is low in Time Attack */
.pulse {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scaleY(1); filter: brightness(1); }
    50% { transform: scaleY(1.02); filter: brightness(1.2); }
    100% { transform: scaleY(1); filter: brightness(1); }
}

/* Danger state (<= 5s) */
.progress-bar.danger {
    background: linear-gradient(to top, #ff3b3b 90%, #ff3b3b88 100%);
}

.danger-text {
    color: #ff6b6b !important;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.35);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* High score celebrate animation */
.celebrate {
    animation: celebrate 1.2s ease-out 1;
}

@keyframes celebrate {
    0% { transform: scale(0.9); opacity: 0; }
    30% { transform: scale(1.06); opacity: 1; }
    60% { transform: scale(1.0); }
    100% { transform: scale(1.0); }
}

/* Disabled toggle state */
.toggle-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile tooltip for mode */
.mode-tooltip {
    display: none;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
    margin: 0 1rem 0.5rem;
}

@media (max-width: 600px) {
    .mode-tooltip { display: block; }
}
.tap-square.disabled .progress-bar {
    opacity: 0.08;
    background: linear-gradient(to top, #fff 90%, #fff8 100%);
}
.tap-square span {
    z-index: 2;
    position: relative;
    pointer-events: none;
}
.level-info > div {
    width: 100%;
}
.level-info .standard-stats {
    font-family:'Chakra Petch', sans-serif;
    text-transform:uppercase;
    color:rgba(0,0,0,.75);
    font-weight:normal;
    font-size: 2rem;
}
.mode-info-overlay-items {
    display: flex;
    justify-content: space-between;
    align-items:center;
    text-align:center;
    font-family:'Chakra Petch', sans-serif;
    text-transform:uppercase;
    color:rgba(255,255,2551,.7);
    font-weight:normal;
}
.mode-info-overlay-items > div {
    margin: 0.25rem 0;
    font-size: 1.5rem;
    width:75px;
}
.mode-info-overlay-items > div > div {
    font-size:1rem;
}

.energy-display {
    font-family: 'Chakra Petch', sans-serif;
    text-transform: uppercase;
    color: white;
    font-size: 1.1rem;
    font-weight: normal;
    padding-bottom: 1rem;
}

.xp-float {
    position: absolute;
    pointer-events: none;
    font-weight: bold;
    font-size: 1.8rem;
    color: #0ff;
    opacity: 1;
    animation: floatFade .5s ease-out forwards;
    text-shadow: 0 0 6px #000;
    z-index: 10;
    width: 50px;
    height:50px;
    background-color:transparent;
    background-image:url('assets/coin-spin.webp');
    background-size:contain;
    text-indent: -9990px
}
@keyframes floatFade {
    0%   { opacity: 1; transform: translateY(0);}
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-60px);}
}

/* Combo Indicator */
.combo-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 11;
    pointer-events: none;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.combo-indicator.hidden { opacity: 0; }
.combo-indicator .combo-mult {
    background: rgba(0, 255, 255, 0.18);
    border: 1px solid rgba(0, 255, 255, 0.35);
    color: var(--color-orange-400);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px var(--color-gray-700);
}
.combo-indicator .combo-streak {
    display: none;
}
.combo-pop {
    animation: comboPop 220ms ease-out;
}
@keyframes comboPop {
    0% { transform: translateY(-2px) scale(0.95); opacity: 0.7; }
    60% { transform: translateY(0) scale(1.06); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Achievements Panel */
.achievements-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.summary-stat {
    color: #fff;
}
.summary-value { font-size: 1.25rem; font-weight: 800; color: #0ff; }
.progress-container { position: relative; height: 8px; background: rgba(255,255,255,0.08); flex: 1; overflow: hidden; border-radius: 999px; width: 100%; }
.progress-fill { position: absolute; left:0; top:0; bottom:0; height: 8px; background: linear-gradient(90deg, #600, #900); }
.achievements-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.achievement-card { display: flex; gap: 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 12px; align-items: center; }
.achievement-card.locked { opacity: 0.7; filter: grayscale(0.2); }
.achievement-icon { font-size: 1.75rem; }
.achievement-title { font-weight: 800; color: #fff; }
.achievement-badge { background: rgba(0,255,170,0.2); color: #0f8; border: 1px solid rgba(0,255,170,0.4); border-radius: 6px; padding: 2px 6px; font-size: 0.75rem; }
.achievement-description { color: #ccc; font-size: 0.9rem; margin: 4px 0 6px; }
.achievement-progress { display: flex; align-items: center; gap: 8px; }
.achievement-progress-bar { flex:1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.achievement-progress-fill { height: 100%; background: linear-gradient(90deg, #0ff, #64f0ff); width: 0; }

/* Leaderboards Panel */
.leaderboards-panel {
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.leaderboards-content {
    padding: 1rem 0;
}

.leaderboard-mode-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
}

.mode-toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.mode-toggle-btn.active {
    background: var(--color-orange-gradient);
    color: #000;
    font-weight: 600;
}

.leaderboard-table-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: rgba(255, 255, 255, 0.08);
}

.leaderboard-table th {
    padding: 1rem;
    text-align: left;
    color: #4fd1c7;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-table th.rank-col {
    width: 80px;
    text-align: center;
}

.leaderboard-table th.score-col {
    width: 120px;
    text-align: right;
}

.leaderboard-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-table tbody tr:last-child td {
    border-bottom: none;
}

.rank-col {
    text-align: center;
    font-weight: 700;
    color: #4fd1c7;
}

.username-col {
    font-weight: 500;
}

.score-col {
    text-align: right;
    font-weight: 600;
    color: #fbbf24;
}

.leaderboard-empty, .leaderboard-loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #ccc;
}

.leaderboard-empty p, .leaderboard-loading p {
    margin: 0;
    font-size: 1.1rem;
}

/* Special styling for top 3 ranks */
.leaderboard-table tbody tr:nth-child(1) .rank-col {
    color: #ffd700; /* Gold */
}

.leaderboard-table tbody tr:nth-child(2) .rank-col {
    color: #c0c0c0; /* Silver */
}

.leaderboard-table tbody tr:nth-child(3) .rank-col {
    color: #cd7f32; /* Bronze */
}

.leaderboard-table tbody tr:nth-child(1) .username-col {
    color: #ffd700;
    font-weight: 700;
}

.leaderboard-table tbody tr:nth-child(2) .username-col {
    color: #c0c0c0;
    font-weight: 700;
}

.leaderboard-table tbody tr:nth-child(3) .username-col {
    color: #cd7f32;
    font-weight: 700;
}

#level {
    font-weight: bold;
    color: #0ff;
    text-shadow: 0 0 6px #000;
    font-size: 1.2em;

}

.character {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

.character-frame {
    position: absolute;
    top:0;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    body {
        padding-left: clamp(0.75rem, 4vw, 1.25rem);
        padding-right: clamp(0.75rem, 4vw, 1.25rem);
        padding-top: calc(1.25rem + env(safe-area-inset-top));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .mode-tabs {
        width: min(360px, 100%);
    }

    #info {
        padding: 1.5rem;
        border-radius: clamp(14px, 4vw, 18px);
        max-height: 75vh;
    }

    #info h1 {
        font-size: clamp(2.1rem, 6vw, 2.5rem);
        margin-bottom: 0.5rem;
    }

    #info h2 {
        font-size: clamp(1.1rem, 3.5vw, 1.35rem);
        margin-bottom: 0.75rem;
    }

    #info p {
        font-size: 1.05rem;
    }

    .level-info {
        font-size: medium;
        margin-top: 1.2rem;
        margin-bottom: 1.1rem;
        text-align: center;
    }

    .container {
        min-height: clamp(40vh, 48vh, 520px);
        padding: 0.75rem 0;
    }

    .tap-square {
        font-size: clamp(1.45rem, 4vw, 1.85rem);
    }

    .reset-container {
        margin: 0.75rem 0;
    }

    #resetButton {
        font-size: 0.9rem;
        padding: 0.6rem 1.45rem;
    }
}

@media (max-width: 480px) {
    #info {
        padding: 1.1rem;
        width: 96vw;
    }

    #info h1 {
        font-size: clamp(1.8rem, 8vw, 2.2rem);
    }

    #info p {
        font-size: 0.95rem;
    }

    .ss {
        gap: 0.6rem;
        font-size: 1.05rem;
        flex-direction: column;
        align-items: center;
    }

    .tap-square {
        width: clamp(220px, 70vw, 280px);
        height: clamp(220px, 70vw, 280px);
        font-size: clamp(1.3rem, 85vw, 1.6rem);
    }

    #resetButton {
        font-size: 0.85rem;
        padding: 0.5rem 1.2rem;
    }
}

@media (max-width: 340px) {
    #info {
        padding: 0.85rem;
    }

    .tap-square {
        width: clamp(200px, 95vw, 240px);
        height: clamp(200px, 95vw, 240px);
        font-size: 1.25rem;
    }

    .character-frame {
        width: 48px;
        height: 48px;
        top: -16px;
    }
}

/* Landscape orientation optimizations */
@media (max-height: 600px) and (orientation: landscape) {
    #info {
        max-height: 70vh;
        padding: 1rem;
    }
    
    #info h1 {
        font-size: 2rem;
        margin-bottom: 0.25rem;
    }
    
    #info h2 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }
    
    #info li {
        font-size: 0.8rem;
        margin-bottom: 0.2rem;
    }
    
    .stats {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 1.1rem;
    }
    
    .container {
        min-height: 35vh;
        padding: 0.5rem;
    }
    
    .reset-container {
        margin: 0.5rem 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .tap-square {
        border-radius: 18px;
    }
    
    #info {
        border-radius: 22px;
    }
}

/* Achievement Toast Notification */
.achievement-toast {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.15) 0%, rgba(0, 191, 255, 0.15) 100%);
    border: 2px solid #0ff;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 40px rgba(0, 255, 255, 0.3), 0 0 20px rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    z-index: 3000;
    min-width: 300px;
    max-width: 90vw;
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.achievement-toast.show {
    top: 20px;
}

.achievement-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 0.85rem;
    color: #0ff;
    text-transform: uppercase;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.achievement-name {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.9rem;
    color: #ccc;
}

@keyframes achievement-glow {
    0%, 100% { box-shadow: 0 10px 40px rgba(0, 255, 255, 0.3), 0 0 20px rgba(0, 255, 255, 0.2); }
    50% { box-shadow: 0 10px 50px rgba(0, 255, 255, 0.5), 0 0 30px rgba(0, 255, 255, 0.4); }
}

.achievement-toast.show {
    animation: achievement-glow 2s ease-in-out infinite;
}

/* Navigation Buttons */
.nav-buttons {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    /* gap: clamp(0.5rem, 2vw, 0.9rem); */
    margin: clamp(0.75rem, 2vh, 1.5rem) auto;
    width: min(var(--content-max-width), 100%);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0.2rem;
    scrollbar-width: none;
}

.nav-buttons::-webkit-scrollbar {
    display: none;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* border-radius: 12px; */
    padding: clamp(0.55rem, 1.5vw, 0.75rem);
    width: clamp(56px, 18vw, 88px);
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    flex: 0 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align:center;
}

.nav-btn span {
    margin-top: 0.25rem;
    font-size: 10px;;
    font-weight: normal;
    color: #999;
    text-transform: uppercase;
    font-family: 'Roboto', sans-serif;
    text-align:center;
}

.nav-btn img {
    width: 24px;
    height: 24px;
}

.nav-btn:hover {
    background: rgba(255, 83, 28, .15);
    border-color: var(--color-orange-400);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--color-orange-400);
}

.nav-btn:active {
    transform: translateY(0);
}

/* Overlay Base Styles */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    background: var(--color-gray-900);;
    border: none;
    border-radius: var(--panel-radius);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    max-width: min(600px, 92vw);
    width: min(var(--content-max-width), 92vw);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.overlay-header h2 {
    margin: 0;
    color: white;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0;
    font-family: 'Roboto', sans-serif;
    text-align:center;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #0ff;
}

/* Authentication Overlay */
.auth-panel {
    min-width: 320px;
    max-width: 450px;
    width: 95vw;
    max-height: 90vh;
}

.auth-content {
    max-height: 75vh;
    overflow-y: auto;
    padding-right: 5px;
}

.guest-info, .user-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 255, 0.2);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.status-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.status-text {
    flex: 1;
}

.status-title {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.15rem;
}

.status-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.guest-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem;
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
}

.warning-icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 0.1rem;
}

.warning-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.auth-tab {
    flex: 1;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.auth-tab.active {
    color: white;
    background: rgba(0, 255, 255, 0.2);
}

.auth-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.form-group input {
    padding: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #0ff;
    box-shadow: 0 0 0 2px rgba(0, 255, 255, 0.2);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.auth-submit-btn {
    padding: 0.75rem;
    background: var(--color-orange-gradient);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.3rem;
    font-family: 'Roboto', sans-serif;
    text-transform: uppercase;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 255, 0.3);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-help {
    margin-top: 0.75rem;
    padding: 0.6rem;
    background: rgba(0, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 255, 0.1);
}

.help-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.35rem;
    line-height: 1.3;
}

.help-text:last-child {
    margin-bottom: 0;
}

.user-info.logged-in .user-status {
    margin-bottom: 1rem;
}

.user-actions {
    display: flex;
    justify-content: center;
}

.logout-btn {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid rgba(255, 0, 0, 0.4);
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: rgba(255, 0, 0, 0.6);
}

.auth-message {
    margin-top: 0.75rem;
    padding: 0.6rem;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.auth-message.success {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    color: #4ade80;
}

.auth-message.error {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #f87171;
}

.auth-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.auth-loading.hidden {
    display: none !important;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(0, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: #0ff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

/* Mobile Compact Auth Styles */
@media (max-width: 480px) {
    .auth-panel {
        min-width: 280px;
        width: 98vw;
        max-height: 95vh;
    }
    
    .overlay-header h2 {
        font-size: 1.1rem;
    }
    
    .guest-info, .user-info {
        margin-bottom: 0.75rem;
        padding: 0.6rem;
    }
    
    .user-status {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .status-icon {
        font-size: 1.3rem;
    }
    
    .status-subtitle {
        font-size: 0.8rem;
    }
    
    .guest-warning {
        gap: 0.4rem;
        padding: 0.5rem;
    }
    
    .warning-text {
        font-size: 0.8rem;
        line-height: 1.25;
    }
    
    .auth-tabs {
        margin-bottom: 0.75rem;
    }
    
    .auth-tab {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .auth-form {
        gap: 0.6rem;
    }
    
    .form-group {
        gap: 0.25rem;
    }
    
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-group input {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .auth-submit-btn {
        padding: 0.65rem;
        font-size: 0.85rem;
        margin-top: 0.25rem;
    }
    
    .form-help {
        margin-top: 0.5rem;
        padding: 0.5rem;
    }
    
    .help-text {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
        line-height: 1.2;
    }
    
    .auth-message {
        margin-top: 0.5rem;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .auth-loading {
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .loading-spinner {
        width: 24px;
        height: 24px;
    }
    
    .loading-text {
        font-size: 0.8rem;
    }
}

/* Stats Dashboard */
.stats-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.stats-tab {
    flex: 1;
    background: transparent;
    border:none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    text-align: center;
    text-transform:uppercase
}

.stats-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stats-tab.active {
    border-color: var(--color-orange-600);
    color: white;
}

.stats-tab-content {
    display: none;
}

.stats-tab-content.active {
    display: block;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    font-family: 'Roboto', sans-serif;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    font-family: 'Chakra Petch', sans-serif;
    color: white;
}

.standard-stats {
    width: 100%;
    max-width: 400px;
}

.level-progress {
    display: flex;
    justify-content: space-between;
    font-size: medium;
    margin-bottom: 10px;
}

.coin-display {
    font-size:2.5rem;
    font-weight: bold;
    color: var(--color-orange);
    margin-bottom: 1rem;
    margin-top:1rem;
    text-align:center;
    font-family: 'Chakra Petch', sans-serif;
    width: min(var(--content-max-width), 100%);
}

/* Settings Panel */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 12px;
    gap: 1rem;
    font-family: "Roboto Condensed", sans-serif;
}

.setting-info {
    flex: 1;
}

.setting-label {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.setting-description {
    font-size: 0.85rem;
    color: #aaa;
}

/* Settings Sections */
.settings-section {
    margin-bottom: 2rem;
}

.section-header {
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
}

/* Auth Section in Settings */
.auth-setting {
    background: rgba(0, 133, 255, 0.08);
    border: 1px solid rgba(0, 133, 255, 0.2);
}

.settings-auth-btn {
    padding: 0.7rem 1.2rem;
    background: var(--color-orange-gradient);
    border: none;
    border-radius: 8px;
    color: white;
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.settings-auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 133, 255, 0.3);
}

.settings-auth-btn .auth-icon {
    font-size: 1.1rem;
    line-height: 1;
    color: white;
}

.settings-auth-btn.registered {
    background: linear-gradient(135deg, var(--color-green) 0%, #22c55e 100%);
    color: white;
}

.settings-auth-btn.registered .auth-icon {
    color: white;
}

.settings-auth-btn.guest .auth-icon {
    color: white;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 90px;
    height: 30px;
    display: inline-block;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    transition: all 0.3s ease;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    height: 22px;
    width: 40px;
    left: 4px;
    bottom: 4px;
    background: white;
    border-radius: 30px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(40px);
    background: var(--color-blue-gradient);
}

.toggle-slider:hover {
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

/* Volume Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    max-width: 200px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-blue-600);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px var(--color-blue-400);
}

.volume-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--color-blue-600);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.volume-value {
    min-width: 45px;
    text-align: right;
    color: white;
    font-weight: bold;
}

/* Theme Select */
.theme-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.theme-select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #0ff;
}

.theme-select:focus {
    border-color: #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.theme-select option {
    background: #222;
    color: #fff;
}

/* Shop */
.shop-balance { color:white; font-family: 'Roboto Condensed', sans-serif; font-weight: 800; margin-bottom: 1rem; }
.shop-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.shop-item { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; padding: 12px; display:flex; flex-direction: column; gap: 8px; font-family: 'Roboto', sans-serif; }
.shop-item-header { display:flex; align-items:center; justify-content: space-between; }
.shop-item-title { font-weight: 800; color:#fff; font-family: 'Roboto Condensed', sans-serif; font-size:1.1em; }
.shop-item-level { color:#aaa; font-size: 0.9rem; }
.shop-item-desc { color:#ccc; font-size: 0.95rem; }
.shop-item-cost { color:var(--color-orange-600); font-weight: 700; }
.shop-item button { 
    align-self: flex-end; 
    background: var(--color-blue-gradient); 
    border: 1px solid rgba(255,255,255,0.1); 
    color:#fff; 
    border-radius: 16px; 
    padding: 0.5rem 2rem; 
    cursor:pointer; 
    text-transform: uppercase;
    transition: all .2s ease; 
}
.shop-item button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,255,255,0.25); }
.shop-item button:disabled { opacity: .5; cursor: not-allowed; }
.shop-note { color:#aaa; font-size: .9rem; margin-top: 1rem; text-align: center; }

        /* Achievements Panel */
        .achievements-summary {
            margin-bottom: 1.5rem;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            text-align: center;
        }

        .summary-stat {
            display: flex;
            justify-content: center;
            align-items: baseline;
            gap: 0.25rem;
            margin-bottom: 0.75rem;
        }

        .summary-value {
            font-size: 2rem;
            font-weight: bold;
            color: var(--color-orange-400);
            font-family: 'Chakra Petch', sans-serif;
        }

        .summary-label {
            font-size: 1rem;
            color: #aaa;
        }

        .progress-container {
            height: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            overflow: hidden;
            display: flex;
             margin: 0 auto;
            width: 100%;
            max-width: 400px;

        }

        .progress-fill {
            height: 100%;
            background: var(--color-progress-gradient);
            border-radius: 4px;
            transition: width 0.5s ease;
        }

        .achievements-content {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .achievement-card {
            display: flex;
            gap: 1rem;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            transition: all 0.3s ease;
        }

        .achievement-card.unlocked {
            /* background: rgba(0, 255, 255, 0.08); */
            border-color: var(--color-orange-600);
        }

        .achievement-card.locked {
            opacity: 0.5;
        }

        .achievement-icon {
            font-size: 2.5rem;
            width: 50px;
            height: 50px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            flex-shrink: 0;
        }

        .achievement-info {
            flex: 1;
        }

        .achievement-header {
            display: flex;
            justify-content: space-between;
            align-items: start;
            margin-bottom: 0.5rem;
        }

        .achievement-title {
            font-size: 1.1rem;
            color: #fff;
            font-weight: bold;
        }

        .achievement-card.unlocked .achievement-title {
            color: var(--color-orange-400);
        }

        .achievement-badge {
            background: var(--color-blue-gradient);
            color: white;
            border: 1px solid rgba(255, 255, 255, 0.3);
            text-transform: uppercase;
            padding: 0.25rem 0.5rem;
            border-radius: 6px;
            font-size: 0.75rem;
            font-weight: bold;
            font-family: 'Roboto Condensed', sans-serif;
        }

        .achievement-description {
            font-size: 0.9rem;
            color: #aaa;
            margin-bottom: 0.5rem;
        }

        .achievement-progress {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .achievement-progress-bar {
            flex: 1;
            height: 6px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 3px;
            overflow: hidden;
        }

        .achievement-progress-fill {
            height: 100%;
            background: var(--color-progress-gradient);
            border-radius: 3px;
            transition: width 0.3s ease;
        }

        .achievement-progress-text {
            font-size: 0.85rem;
            color: #aaa;
            min-width: 70px;
            text-align: right;
        }

        @keyframes achievement-pulse {
            0%, 100% {
                box-shadow: 0 0 5px var(--color-orange-400);
            }
            50% {
                box-shadow: 0 0 15px var(--color-orange-600);
            }
        }

#loadingProgressBar {
    position: absolute;
    bottom: 20px;
    width: 80%;
    height: 10px;
    background-color: var(--color-gray-300);
    border-radius: 5px;
    overflow: hidden;
}

#loadingProgressBar div {
    height: 100%;
    background-color: var(--color-orange-600);
    transition: width 0.3s ease;
}

/* Footer Styles */
.footer {
    padding: 2em;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 100;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.4);
    height: 100%;
}

.footer-separator {
    color: rgba(255, 255, 255, 0.4);
}

.footer-link {
    color: #4fd1c7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: #7dd3d8;
    text-decoration: underline;
}

/* Roadmap Modal Styles */
.roadmap-panel {
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.roadmap-content {
    padding: 1rem 0;
}

.roadmap-section {
    margin-bottom: 2rem;
}

.roadmap-section h3 {
    color: #4fd1c7;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.roadmap-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.roadmap-list li {
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.roadmap-list li.completed {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.roadmap-list li.planned {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.roadmap-list li.future {
    background: rgba(168, 85, 247, 0.1);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #c4b5fd;
}

.roadmap-note {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.roadmap-note p {
    margin: 0;
    color: #fbbf24;
    font-size: 0.9rem;
    line-height: 1.5;
}

.roadmap-footer {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: center;
}

.roadmap-footer p {
    margin: 0;
    color: #fbbf24;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* How to Play Modal Styles */
.how-to-play-panel {
    max-width: 700px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.help-panel {
    max-width: 700px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.help-content {
    padding: 1rem 0;
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    color: #4fd1c7;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mode-help {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mode-help-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    line-height: 1.5;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.5;
}

.help-list li:last-child {
    border-bottom: none;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.level-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
}

.level-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #4fd1c7, #00c6ff);
    color: #000;
    font-weight: bold;
    border-radius: 50%;
    font-size: 0.9rem;
}

.level-name {
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.level-requirement {
    font-size: 0.85rem;
    color: #ccc;
}

/* Mobile adjustments for footer */
@media (max-width: 768px) {
    .footer-content {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
    
    .roadmap-panel,
    .help-panel,
    .leaderboards-panel {
        width: 95vw;
        max-height: 85vh;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .mode-toggle-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .roadmap-section h3,
    .help-section h3 {
        font-size: 1.1rem;
    }
    
    .roadmap-list li {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .levels-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .mode-help {
        gap: 0.75rem;
    }

    .mode-help-item {
        padding: 0.75rem;
    }
}
