* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00f3ff;
    --secondary: #ff00ff;
    --accent: #00ff88;
    --dark: #0a0a1a;
    --darker: #050510;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-secondary: #b0b0b0;
}

body {
    font-family: 'Rajdhani', 'Segoe UI', sans-serif;
    background: var(--darker);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
}

/* Animated Star Background */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars { background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"><circle cx="0.5" cy="0.5" r="0.5" fill="white" opacity="0.3"/></svg>') repeat; animation: stars 100s linear infinite; }
.stars2 { background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"><circle cx="0.5" cy="0.5" r="0.4" fill="white" opacity="0.2"/></svg>') repeat; animation: stars 150s linear infinite; }
.stars3 { background: transparent url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1 1"><circle cx="0.5" cy="0.5" r="0.3" fill="white" opacity="0.1"/></svg>') repeat; animation: stars 200s linear infinite; }

@keyframes stars {
    from { transform: translateY(0); }
    to { transform: translateY(-100vh); }
}

/* Screen Management */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Auth Screens */
.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: radial-gradient(circle at center, rgba(10, 10, 26, 0.9) 0%, rgba(5, 5, 16, 0.95) 100%);
}

.game-logo {
    text-align: center;
    margin-bottom: 40px;
}

.quantum-cube {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    position: relative;
    transform-style: preserve-3d;
    animation: cubeRotate 8s linear infinite;
}

.cube-face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.cube-face.front { transform: translateZ(50px); }
.cube-face.back { transform: translateZ(-50px) rotateY(180deg); }
.cube-face.right { transform: translateX(50px) rotateY(90deg); }
.cube-face.left { transform: translateX(-50px) rotateY(-90deg); }
.cube-face.top { transform: translateY(-50px) rotateX(90deg); }
.cube-face.bottom { transform: translateY(50px) rotateX(-90deg); }

@keyframes cubeRotate {
    0% { transform: rotateX(0) rotateY(0); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

.game-logo h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3em;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    text-shadow: 0 0 30px var(--primary);
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.2em;
    letter-spacing: 2px;
}

.auth-form {
    width: 100%;
    max-width: 400px;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
}

.form-group input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--text);
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary);
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--primary);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: rgba(0, 243, 255, 0.1);
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--text-secondary);
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.auth-divider span {
    background: var(--darker);
    padding: 0 15px;
}

/* Game Screen */
#gameScreen {
    background: radial-gradient(ellipse at center, #0a0a1a 0%, #050510 100%);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(5, 5, 16, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar-cube {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-radius: 8px;
    position: relative;
}

.avatar-cube::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    background: var(--dark);
    border-radius: 5px;
    border: 1px solid var(--primary);
}

.player-details h3 {
    color: var(--primary);
    font-size: 1.2em;
    margin-bottom: 2px;
}

.player-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.credits {
    color: var(--accent);
}

.level {
    color: var(--text-secondary);
}

.game-scores {
    display: flex;
    gap: 20px;
    text-align: right;
}

.score-display, .high-score {
    font-size: 1.3em;
    font-weight: 600;
}

.score-display {
    color: var(--primary);
}

.high-score {
    color: var(--text-secondary);
}

/* Game Wrapper */
.game-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    border: none;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a1a 100%);
}

/* Overlay Menus */
.overlay-menu {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.overlay-menu.active {
    display: flex;
}

.menu-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    backdrop-filter: blur(20px);
}

.menu-content h2 {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
    font-size: 2em;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn {
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border-color: transparent;
}

.menu-btn.primary:hover {
    box-shadow: 0 5px 20px var(--primary);
}

/* Tutorial Screen */
.tutorial-content {
    margin: 30px 0;
}

.tutorial-step {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.step-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.step-text h3 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.1em;
}

.step-text p {
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Game Over Screen */
.result-header {
    margin-bottom: 30px;
}

.result-icon {
    font-size: 4em;
    margin-bottom: 10px;
}

.result-stats {
    margin: 30px 0;
}

.stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat:last-child {
    border-bottom: none;
}

.label {
    color: var(--text-secondary);
}

.value {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.2em;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    padding: 15px;
    background: rgba(5, 5, 16, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.9em;
}

.nav-btn:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 5, 16, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: var(--primary);
    font-family: 'Orbitron', sans-serif;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
}

.close-btn:hover {
    color: var(--primary);
}

.modal-body {
    padding: 20px;
}

/* Shop Styles */
.shop-balance {
    background: linear-gradient(45deg, var(--accent), #00ffaa);
    color: var(--dark);
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.shop-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.tab-btn.active {
    background: var(--primary);
    color: var(--dark);
}

.shop-items {
    display: grid;
    gap: 15px;
}

.shop-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.shop-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.shop-item img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
}

.item-info p {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.buy-btn {
    background: var(--accent);
    color: var(--dark);
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--accent);
}

.buy-btn.owned {
    background: var(--primary);
    cursor: not-allowed;
}

/* Profile Styles */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.profile-avatar .avatar-cube {
    width: 60px;
    height: 60px;
}

.profile-info {
    flex: 1;
}

.profile-info h4 {
    color: var(--primary);
    font-size: 1.5em;
    margin-bottom: 5px;
}

.edit-btn {
    background: rgba(0, 243, 255, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-btn:hover {
    background: var(--primary);
    color: var(--dark);
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-card i {
    color: var(--primary);
    font-size: 1.5em;
}

.stat-value {
    display: block;
    color: var(--primary);
    font-size: 1.3em;
    font-weight: 600;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.profile-actions {
    text-align: center;
}

/* Daily Reward */
.daily-content {
    text-align: center;
}

.reward-amount {
    font-size: 3em;
    color: var(--accent);
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.streak-info {
    margin: 15px 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.streak-info i {
    color: #ff6b35;
}

/* Settings */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-info i {
    color: var(--primary);
    width: 20px;
}

.setting-item select {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text);
    min-width: 120px;
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Leaderboard */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-rank {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: var(--dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.leaderboard-item.me {
    background: rgba(0, 243, 255, 0.2);
    border-color: var(--primary);
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    color: var(--primary);
}

.leaderboard-score {
    color: var(--accent);
    font-weight: 600;
}

/* Responsive */
@media (max-width: 480px) {
    .game-header {
        padding: 10px 15px;
    }
    
    .player-details h3 {
        font-size: 1em;
    }
    
    .game-scores {
        gap: 10px;
    }
    
    .score-display, .high-score {
        font-size: 1.1em;
    }
    
    .menu-content {
        padding: 20px;
    }
    
    .menu-content h2 {
        font-size: 1.5em;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-secondary { color: var(--text-secondary); }