/* Main styles for Retro Games Arcade */
:root {
    --bg-color: #120318;
    --text-color: #ffffff;
    --primary-color: #8c52ff;
    --secondary-color: #ff5252;
    --tile-bg-color: #1e1e2e;
    --header-color: #2d2d3d;
    --neon-glow: 0 0 5px #8c52ff, 0 0 10px #8c52ff, 0 0 20px #8c52ff, 0 0 40px #8c52ff;
}

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

body {
    font-family: 'Press Start 2P', 'Courier New', monospace;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 25% 15%, rgba(140, 82, 255, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 75% 85%, rgba(255, 82, 82, 0.05) 0%, transparent 60%);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 4px solid var(--primary-color);
    padding-bottom: 20px;
    position: relative;
}

.neon-text {
    color: #fff;
    text-shadow: var(--neon-glow);
    animation: neon-pulse 2s infinite alternate;
}

@keyframes neon-pulse {
    from {
        text-shadow: var(--neon-glow);
    }
    to {
        text-shadow: 0 0 2px #8c52ff, 0 0 5px #8c52ff, 0 0 10px #8c52ff, 0 0 20px #8c52ff;
    }
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

button {
    background-color: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 10px 20px;
    margin: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

input {
    background-color: var(--tile-bg-color);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    padding: 10px;
    margin: 10px 0;
    width: 100%;
    max-width: 300px;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    box-shadow: 0 0 8px rgba(140, 82, 255, 0.3);
}

/* Game tiles */
.game-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-tile {
    background-color: var(--tile-bg-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
    text-align: center;
    padding: 20px;
    height: 230px;
    border: 3px solid transparent;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.game-tile:hover {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(140, 82, 255, 0.3);
}

.game-tile:hover::after {
    content: 'PLAY';
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.game-tile img {
    max-width: 120px;
    height: auto;
    margin-bottom: 10px;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 5px rgba(140, 82, 255, 0.5));
}

.game-tile h3 {
    font-size: 16px;
    margin: 10px 0;
    color: white;
}

.game-tile p {
    font-size: 10px;
    color: #ccc;
}

/* Game container */
.game-container {
    background-color: var(--tile-bg-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(140, 82, 255, 0.2);
}

.game-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.game-header h2 {
    margin-left: 20px;
    margin-bottom: 0;
}

.game-screen {
    background-color: #000;
    border: 3px solid var(--primary-color);
    border-radius: 4px;
    min-height: 400px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(140, 82, 255, 0.3);
}

.game-start-screen {
    text-align: center;
    padding: 20px;
    background-color: var(--header-color);
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: pulsate 4s infinite alternate;
}

@keyframes pulsate {
    0% {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    }
    100% {
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(140, 82, 255, 0.4);
    }
}

.game-buttons {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* Leaderboard */
.leaderboard {
    background-color: var(--header-color);
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.leaderboard h3 {
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 0.5fr 2fr 1fr;
    gap: 10px;
    padding: 10px;
    background-color: var(--tile-bg-color);
    margin-bottom: 5px;
    border-radius: 4px;
    transition: transform 0.2s;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
}

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

.leaderboard-entry .score {
    text-align: right;
    color: var(--secondary-color);
}

.leaderboard-entry:nth-child(1) {
    background-color: rgba(255, 215, 0, 0.15);
    border-left: 4px solid #ffd700;
}

.leaderboard-entry:nth-child(2) {
    background-color: rgba(192, 192, 192, 0.15);
    border-left: 4px solid #c0c0c0;
}

.leaderboard-entry:nth-child(3) {
    background-color: rgba(205, 127, 50, 0.15);
    border-left: 4px solid #cd7f32;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid var(--primary-color);
    font-size: 12px;
}

/* Touch controls for mobile */
.touch-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 15px auto;
}

.touch-controls button {
    margin: 5px;
    font-size: 18px;
    padding: 15px;
}

.touch-controls button[data-direction="up"] {
    grid-column: 2;
    grid-row: 1;
}

.touch-controls button[data-direction="left"] {
    grid-column: 1;
    grid-row: 2;
}

.touch-controls button[data-direction="right"] {
    grid-column: 3;
    grid-row: 2;
}

.touch-controls button[data-direction="down"] {
    grid-column: 2;
    grid-row: 3;
}

.pause-button {
    display: block;
    margin: 10px auto;
}

.game-score {
    text-align: center;
    margin: 10px 0;
    font-size: 18px;
    color: var(--secondary-color);
    text-shadow: 0 0 5px rgba(255, 82, 82, 0.5);
}

/* Arcade cabinet decorations */
.game-selection {
    position: relative;
}

.game-selection::before, .game-selection::after {
    content: '';
    position: absolute;
    top: -20px;
    width: 30px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), transparent);
    z-index: -1;
    border-radius: 5px;
}

.game-selection::before {
    left: -40px;
    transform: rotate(-5deg);
}

.game-selection::after {
    right: -40px;
    transform: rotate(5deg);
}

/* CRT Effect for Game Screen */
.game-screen {
    position: relative;
    overflow: hidden;
}

.game-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .game-tiles {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .game-tile {
        height: 200px;
    }
    
    .game-selection::before, .game-selection::after {
        display: none;
    }
}