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

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 50%, #0f0f23 100%);
    color: #00ff00;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

.game-container {
    max-width: 1400px;
    width: 100%;
    background: #000;
    border: 3px solid #00ff00;
    border-radius: 10px;
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 20px rgba(0, 255, 0, 0.1);
    padding: 20px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.main-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.game-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar {
    width: 350px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.title {
    font-size: 2.5rem;
    font-weight: 900;
    color: #00ff00;
    text-shadow: 
        0 0 10px #00ff00,
        0 0 20px #00ff00,
        0 0 30px #00ff00;
    letter-spacing: 3px;
    margin-bottom: 15px;
}

.section-title {
    color: #00ff00;
    font-size: 1rem;
    margin: 0 0 10px 0;
    text-shadow: 0 0 10px #00ff00;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    padding-bottom: 5px;
}

.stats-section,
.instructions-section,
.settings-section,
.leaderboard-section {
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 5px;
    padding: 15px;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 255, 0, 0.1);
    padding: 8px 12px;
    border: 1px solid #00ff00;
    border-radius: 3px;
}

.label {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
}

.game-area {
    position: relative;
    display: flex;
    justify-content: center;
}

#gameCanvas {
    border: 2px solid #00ff00;
    background: #000;
    box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.3),
        inset 0 0 20px rgba(0, 255, 0, 0.1);
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.game-over-content {
    text-align: center;
    background: #000;
    border: 3px solid #ff0040;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 
        0 0 30px #ff0040,
        inset 0 0 20px rgba(255, 0, 64, 0.1);
}

.game-over-content h2 {
    font-size: 2rem;
    color: #ff0040;
    text-shadow: 0 0 20px #ff0040;
    margin-bottom: 20px;
}

.game-over-content p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.game-over-content button {
    margin-top: 20px;
    padding: 12px 30px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 700;
    background: transparent;
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-over-content button:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 15px #00ff00;
}

.high-score-message {
    animation: pulse 1s ease-in-out infinite alternate;
    margin: 15px 0 !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.input-area {
    text-align: center;
}

#userInput {
    width: 100%;
    max-width: 800px;
    padding: 15px;
    font-family: 'Orbitron', monospace;
    font-size: 1.1rem;
    background: #000;
    color: #00ff00;
    border: 2px solid #00ff00;
    border-radius: 5px;
    outline: none;
    text-align: center;
    box-shadow: 
        0 0 10px rgba(0, 255, 0, 0.3),
        inset 0 0 10px rgba(0, 255, 0, 0.1);
}

#userInput:focus {
    box-shadow: 
        0 0 20px #00ff00,
        inset 0 0 10px rgba(0, 255, 0, 0.2);
}

#userInput::placeholder {
    color: rgba(0, 255, 0, 0.5);
}

.instructions {
    font-size: 0.9rem;
    opacity: 0.9;
}

.instructions p {
    margin: 8px 0;
}

.settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.setting-item label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.setting-item input,
.setting-item select {
    padding: 8px;
    font-family: 'Orbitron', monospace;
    background: #000;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 3px;
    width: 100%;
    text-align: center;
}

.setting-item input:focus,
.setting-item select:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.setting-item select option {
    background: #000;
    color: #00ff00;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .stats-section,
    .instructions-section,
    .settings-section,
    .leaderboard-section {
        flex: 1;
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .game-container {
        padding: 15px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .sidebar {
        flex-direction: column;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    .main-content {
        gap: 20px;
    }
}

/* Glitch effect for title */
@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

.title:hover {
    animation: glitch 0.3s ease-in-out;
}

/* Neon glow effect */
@keyframes neonGlow {
    0%, 100% { 
        text-shadow: 
            0 0 5px #00ff00,
            0 0 10px #00ff00,
            0 0 15px #00ff00,
            0 0 20px #00ff00;
    }
    50% { 
        text-shadow: 
            0 0 2px #00ff00,
            0 0 5px #00ff00,
            0 0 8px #00ff00,
            0 0 12px #00ff00;
    }
}

.title {
    animation: neonGlow 2s ease-in-out infinite alternate;
}

/* Leaderboard Styles */

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.leaderboard-header .section-title {
    margin: 0;
}

.leaderboard-type-selector {
    display: flex;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
    border-radius: 5px;
    overflow: hidden;
}

.leaderboard-type-selector button {
    padding: 8px 16px;
    font-family: 'Orbitron', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    background: transparent;
    color: #00ff00;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.leaderboard-type-selector button:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: #00ff00;
}

.leaderboard-type-selector button:hover {
    background: rgba(0, 255, 0, 0.2);
}

.leaderboard-type-selector button.active {
    background: rgba(0, 255, 0, 0.3);
    color: #ffffff;
    text-shadow: 0 0 5px #00ff00;
}

.leaderboard-controls {
    display: flex;
    gap: 10px;
}

.leaderboard-controls button {
    padding: 8px 15px;
    font-family: 'Orbitron', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    background: transparent;
    color: #00ff00;
    border: 1px solid #00ff00;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.leaderboard-controls button:hover {
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.leaderboard {
    background: rgba(0, 255, 0, 0.02);
    border: 1px solid rgba(0, 255, 0, 0.2);
    border-radius: 3px;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.leaderboard-headers {
    display: grid;
    grid-template-columns: 30px 1fr 50px 35px 40px 60px;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 255, 0, 0.3);
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    color: #00ffff;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 30px 1fr 50px 35px 40px 60px;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0, 255, 0, 0.1);
    font-size: 0.8rem;
    transition: background-color 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 0, 0.1);
}

.leaderboard-entry:first-child {
    color: #FFD700;
    font-weight: 700;
    text-shadow: 0 0 10px #FFD700;
}

.leaderboard-entry:nth-child(2) {
    color: #C0C0C0;
    font-weight: 700;
    text-shadow: 0 0 10px #C0C0C0;
}

.leaderboard-entry:nth-child(3) {
    color: #CD7F32;
    font-weight: 700;
    text-shadow: 0 0 10px #CD7F32;
}

.leaderboard-entry .rank {
    text-align: center;
    font-weight: 700;
}

.leaderboard-entry .name {
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-entry .score {
    text-align: right;
    font-weight: 700;
    color: #00ffff;
}

.leaderboard-entry .level {
    text-align: center;
}

.leaderboard-entry .sentences {
    text-align: center;
}

.leaderboard-entry .date {
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.8;
}

.no-scores {
    text-align: center;
    padding: 20px;
    opacity: 0.6;
    font-style: italic;
}

.loading-scores {
    text-align: center;
    padding: 20px;
    color: #00FF88;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.7; }
    to { opacity: 1; }
}

.high-score-message.global {
    color: #00FF88 !important;
    text-shadow: 0 0 15px #00FF88 !important;
}

.offline-message {
    color: #FFA500 !important;
    text-shadow: 0 0 15px #FFA500 !important;
    font-size: 0.9em;
}

/* Custom scrollbar for leaderboard */
.leaderboard::-webkit-scrollbar {
    width: 8px;
}

.leaderboard::-webkit-scrollbar-track {
    background: rgba(0, 255, 0, 0.1);
    border-radius: 4px;
}

.leaderboard::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3);
    border-radius: 4px;
}

.leaderboard::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 0, 0.5);
}

/* Mobile responsiveness for leaderboard */
@media (max-width: 1200px) {
    .leaderboard-header {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .leaderboard-headers,
    .leaderboard-entry {
        grid-template-columns: 25px 1fr 45px 30px 35px 50px;
        font-size: 0.7rem;
        gap: 5px;
    }
    
    .leaderboard-headers .name,
    .leaderboard-entry .name {
        min-width: 0;
    }
}