/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

.screen.active {
    display: block;
}

/* Mobile/Desktop Toggle */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* Neon Glow Effects */
.neon-glow {
    box-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
}

.neon-border {
    border: 2px solid #00ffff;
    box-shadow: 0 0 10px #00ffff, inset 0 0 10px rgba(0, 255, 255, 0.1);
}

/* Main Menu */
#main-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.logo h1 {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease-in-out infinite;
    margin-bottom: 10px;
}

.logo .subtitle {
    font-size: 1.2rem;
    color: #00ffff;
    margin-bottom: 40px;
    opacity: 0.8;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 300px;
}

.menu-btn {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 2px solid #00ffff;
    color: #ffffff;
    padding: 15px 30px;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.menu-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px #00ffff, inset 0 0 20px rgba(0, 255, 255, 0.2);
    background: linear-gradient(45deg, #16213e, #1a1a2e);
}

.menu-btn:active {
    transform: scale(0.98);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 10px 20px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 10px #00ffff;
}

.game-stats {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #cccccc;
    margin-bottom: 5px;
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: 700;
    color: #00ffff;
}

/* Game Grid */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.grid {
    display: grid;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.grid.size-3 { grid-template-columns: repeat(3, 1fr); }
.grid.size-4 { grid-template-columns: repeat(4, 1fr); }
.grid.size-5 { grid-template-columns: repeat(5, 1fr); }

.tile {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Tile Types */
.tile.hash-fragment {
    background: linear-gradient(45deg, #4a90e2, #7b68ee);
    color: #ffffff;
    border-color: #00ffff;
}

.tile.nonce {
    background: linear-gradient(45deg, #ffd700, #ffb347);
    color: #000000;
    border-color: #ffd700;
    font-size: 0.8rem;
    animation: pulse-gold 2s infinite;
}

.tile.noise {
    background: linear-gradient(45deg, #555555, #777777);
    color: #cccccc;
    border-color: #888888;
    cursor: not-allowed;
    opacity: 0.7;
}

.tile.empty {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

@keyframes pulse-gold {
    0%, 100% { box-shadow: 0 0 10px #ffd700; }
    50% { box-shadow: 0 0 20px #ffd700, 0 0 30px #ffd700; }
}

/* Tile Animations */
.tile.merging {
    animation: merge-glow 0.5s ease;
}

@keyframes merge-glow {
    0% { transform: scale(1); box-shadow: 0 0 10px currentColor; }
    50% { transform: scale(1.1); box-shadow: 0 0 30px currentColor; }
    100% { transform: scale(1); box-shadow: 0 0 10px currentColor; }
}

.tile.mining-success {
    animation: mining-success 1s ease;
}

@keyframes mining-success {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); box-shadow: 0 0 50px #00ff00; }
    50% { transform: scale(1.1); box-shadow: 0 0 40px #00ff00; }
    75% { transform: scale(1.15); box-shadow: 0 0 60px #00ff00; }
    100% { transform: scale(1); box-shadow: 0 0 10px #00ff00; }
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.control-btn {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 2px solid #ff00ff;
    color: #ffffff;
    padding: 12px 25px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px #ff00ff;
    background: linear-gradient(45deg, #16213e, #1a1a2e);
}

/* Screen Headers */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.screen-header h2 {
    font-size: 2rem;
    color: #00ffff;
    margin: 0;
}

/* Instructions Screen */
.instructions-content {
    max-width: 600px;
    margin: 0 auto;
}

.instruction-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.instruction-item h3 {
    color: #00ffff;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.instruction-item p {
    line-height: 1.6;
    margin-bottom: 8px;
    color: #cccccc;
}

/* Settings Screen */
.settings-content {
    max-width: 400px;
    margin: 0 auto;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

.setting-item label {
    color: #ffffff;
    font-weight: 600;
    font-size: 1.1rem;
}

.toggle-btn {
    background: #ff4444;
    border: none;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #44ff44;
}

#theme-select, #difficulty-select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #00ffff;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 5px;
    font-family: 'Orbitron', monospace;
}

/* About Screen */
.about-content {
    max-width: 600px;
    margin: 0 auto;
}

.about-section {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.about-section h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.about-section p {
    line-height: 1.6;
    color: #cccccc;
}

/* Leaderboard Screen */
.leaderboard-content {
    max-width: 500px;
    margin: 0 auto;
}

.leaderboard-tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #00ffff;
}

.tab-btn {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #ffffff;
    padding: 15px;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: #00ffff;
    color: #000000;
}

.leaderboard-list {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #00ffff;
    border-radius: 10px;
    padding: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item .rank {
    color: #ffd700;
    font-weight: 700;
    width: 30px;
}

.leaderboard-item .name {
    flex: 1;
    color: #ffffff;
    margin-left: 15px;
}

.leaderboard-item .score {
    color: #00ffff;
    font-weight: 600;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ffff;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.5);
}

.modal-content h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.modal-content p {
    color: #cccccc;
    margin-bottom: 25px;
    line-height: 1.6;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 2px solid #ff00ff;
    color: #ffffff;
    padding: 12px 20px;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 120px;
}

.modal-btn:hover {
    box-shadow: 0 0 15px #ff00ff;
    transform: translateY(-2px);
}

/* Mobile Header & Hamburger Menu */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 2px solid #00ffff;
    z-index: 1000;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

.mobile-logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, #00ffff, #ff00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.hamburger-menu {
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    position: relative;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: #00ffff;
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

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

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 999;
    backdrop-filter: blur(10px);
}

.mobile-menu-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mobile-menu-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ffff;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.5);
}

.mobile-menu-header {
    position: relative;
    margin-bottom: 30px;
}

.mobile-menu-header h2 {
    font-size: 2rem;
    background: linear-gradient(45deg, #00ffff, #ff00ff, #ffff00);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 3s ease-in-out infinite;
    margin: 0 0 10px 0;
}

.mobile-menu-header .subtitle {
    color: #00ffff;
    opacity: 0.8;
    margin: 0;
}

.close-menu-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff0055;
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-menu-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px #ff0055;
}

.mobile-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-menu-btn {
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 2px solid #00ffff;
    color: #ffffff;
    padding: 15px 20px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
}

.mobile-menu-btn:hover, .mobile-menu-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 0 20px #00ffff;
    background: linear-gradient(45deg, #16213e, #1a1a2e);
}

.mobile-menu-btn .btn-icon {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
}

.mobile-menu-btn .btn-text {
    flex: 1;
    text-align: left;
}

/* Enhanced Instructions Styles */
.instructions-content {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 30px;
}

.instruction-item.featured {
    background: linear-gradient(45deg, rgba(0, 255, 255, 0.1), rgba(255, 0, 255, 0.1));
    border: 2px solid #00ffff;
    transform: scale(1.02);
}

.instruction-item.strategy {
    background: linear-gradient(45deg, rgba(255, 255, 0, 0.1), rgba(255, 0, 255, 0.1));
    border: 2px solid #ffff00;
}

.tile-examples {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.example-tile {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    border: 2px solid;
    flex-shrink: 0;
}

.hash-demo {
    background: linear-gradient(45deg, #4a90e2, #7b68ee);
    color: #ffffff;
    border-color: #00ffff;
}

.nonce-demo {
    background: linear-gradient(45deg, #ffd700, #ffb347);
    color: #000000;
    border-color: #ffd700;
    font-size: 0.7rem;
}

.noise-demo {
    background: linear-gradient(45deg, #555555, #777777);
    color: #cccccc;
    border-color: #888888;
    font-size: 0.7rem;
}

.tile-description {
    flex: 1;
    text-align: left;
}

.tile-description strong {
    color: #00ffff;
    display: block;
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .screen {
        padding-top: 80px;
        padding-left: 15px;
        padding-right: 15px;
        padding-bottom: 15px;
    }
    
    /* Show mobile menu by default on small screens */
    #main-menu.screen.active {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .tile {
        width: 60px;
        height: 60px;
        font-size: 0.8rem;
    }
    
    .game-stats {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat {
        font-size: 0.9rem;
    }
    
    .grid {
        padding: 15px;
        gap: 8px;
    }
    
    .screen-header h2 {
        font-size: 1.5rem;
    }
    
    .tile-examples {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .example-tile {
        align-self: center;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 2rem;
    }
    
    .tile {
        width: 50px;
        height: 50px;
        font-size: 0.7rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

/* Particle Effects */
@keyframes particle-float {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--random-x, 0), var(--random-y, -100px)) scale(0); opacity: 0; }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #00ffff;
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float 1s ease-out forwards;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00cccc;
}