/* Cyber Arcade Game Theme Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Press+Start+2P&display=swap');

:root {
    --neon-pink: #ff007f;
    --neon-blue: #00f0ff;
    --neon-purple: #ab00ff;
    --neon-green: #39ff14;
    --neon-yellow: #ffeb3b;
    --dark-bg: #0d0e15;
    --panel-bg: rgba(20, 22, 37, 0.75);
    --glass-border: rgba(0, 240, 255, 0.15);
    --font-sans: 'Outfit', 'Inter', sans-serif;
    --font-retro: 'Press Start 2P', monospace;
    --glow-shadow: 0 0 10px rgba(0, 240, 255, 0.3), 0 0 20px rgba(0, 240, 255, 0.1);
    --glow-shadow-pink: 0 0 10px rgba(255, 0, 127, 0.3), 0 0 20px rgba(255, 0, 127, 0.1);
}

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

body {
    background-color: var(--dark-bg);
    color: #e2e8f0;
    font-family: var(--font-sans);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* CRT Screen Effect Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    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% 4px, 6px 100%;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.18;
}

.crt-overlay.active {
    animation: crt-flicker 0.15s infinite;
    opacity: 0.22;
}

@keyframes crt-flicker {
    0% { opacity: 0.21; }
    50% { opacity: 0.23; }
    100% { opacity: 0.22; }
}

/* Common Header Injection */
.arcade-header {
    background: rgba(15, 17, 28, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--neon-blue);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-center h1 {
    font-family: var(--font-retro);
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue);
    letter-spacing: 1px;
}

.arcade-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--neon-blue);
    color: #fff;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 12px;
}

.arcade-btn:hover {
    background: rgba(0, 240, 255, 0.15);
    box-shadow: 0 0 12px var(--neon-blue);
    transform: translateY(-1px);
}

.arcade-btn.pink {
    border-color: var(--neon-pink);
}

.arcade-btn.pink:hover {
    background: rgba(255, 0, 127, 0.15);
    box-shadow: 0 0 12px var(--neon-pink);
}

.header-score-panel {
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 15px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--font-retro);
    font-size: 11px;
}

.score-display, .high-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 8px;
    margin-bottom: 2px;
}

.score-val {
    color: var(--neon-green);
    font-weight: bold;
}

.high-score-val {
    color: var(--neon-yellow);
    font-weight: bold;
}

/* Game Canvas container styling */
#game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

.canvas-wrapper {
    background: #000;
    border: 3px solid var(--neon-purple);
    border-radius: 8px;
    box-shadow: 0 0 25px rgba(171, 0, 255, 0.25);
    position: relative;
    overflow: hidden;
    display: flex;
}

canvas {
    display: block;
    width: 70vw;
    height: 43.4vw;
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* UI/Overlay screens (Game Over, Start Screen) */
.game-screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 21, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.3s ease;
}

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

.overlay-title {
    font-family: var(--font-retro);
    font-size: 32px;
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 0 15px var(--neon-pink);
}

.overlay-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
    text-align: center;
    max-width: 80%;
}

.start-btn {
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
    border: none;
    color: #fff;
    padding: 15px 40px;
    font-family: var(--font-retro);
    font-size: 14px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 15px var(--neon-blue);
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--neon-blue), 0 0 10px var(--neon-purple);
}

/* Virtual Mobile Controls */
.mobile-controls {
    display: none; /* Injected and shown via JS on touch devices */
    width: 100%;
    max-width: 500px;
    padding: 15px;
    margin-top: 15px;
    user-select: none;
}

.dpad-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 180px;
    height: 180px;
    margin: 0 auto;
}

.dpad-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.dpad-btn:active {
    background: rgba(0, 240, 255, 0.25);
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
}

.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }

.action-buttons {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 20px;
    gap: 20px;
}

.mobile-action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 0, 127, 0.1);
    border: 3px solid var(--neon-pink);
    color: #fff;
    font-family: var(--font-retro);
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.3);
}

.mobile-action-btn:active {
    background: rgba(255, 0, 127, 0.35);
    box-shadow: 0 0 18px var(--neon-pink);
}

.mobile-action-btn.blue {
    border-color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.1);
}

.mobile-action-btn.blue:active {
    background: rgba(0, 240, 255, 0.35);
    box-shadow: 0 0 18px var(--neon-blue);
}

.horizontal-arrows {
    display: flex;
    justify-content: center;
    gap: 40px;
    width: 100%;
}

.horiz-btn {
    flex: 1;
    max-width: 140px;
    height: 60px;
    background: rgba(0, 240, 255, 0.1);
    border: 2px solid var(--neon-blue);
    color: #fff;
    font-size: 28px;
    border-radius: 10px;
    cursor: pointer;
}
.horiz-btn:active {
    background: rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 15px var(--neon-blue);
}

/* Launcher/Index-specific Styles */
.launcher-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
}

.arcade-brand {
    text-align: center;
    margin-bottom: 40px;
}

.arcade-title {
    font-family: var(--font-retro);
    font-size: 38px;
    background: linear-gradient(to bottom, #fff 20%, var(--neon-blue) 60%, var(--neon-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.5));
    letter-spacing: -2px;
    margin-bottom: 10px;
    animation: neon-shimmer 2s infinite alternate;
}

@keyframes neon-shimmer {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.4)) drop-shadow(0 0 20px rgba(255, 0, 127, 0.2)); }
    50% { filter: drop-shadow(0 0 18px rgba(0, 240, 255, 0.6)) drop-shadow(0 0 30px rgba(255, 0, 127, 0.4)); }
}

.arcade-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    word-spacing: 2px;
}

.search-filter-panel {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 20px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.filter-categories {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    padding: 8px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.category-tag:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.category-tag.active {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
}

.game-card {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: var(--neon-purple);
    box-shadow: 0 12px 30px rgba(171, 0, 255, 0.2);
}

.game-card-thumbnail {
    height: 140px;
    background: linear-gradient(45deg, rgba(13, 14, 21, 0.9), rgba(20, 22, 37, 0.95));
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.game-icon-svg {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon-svg {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 12px var(--neon-purple));
}

.game-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.game-card:hover .game-card-badge {
    background: rgba(171, 0, 255, 0.15);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}

.game-card-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-card-title {
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: 18px;
    margin-bottom: 8px;
    color: #fff;
}

.game-card-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    margin-bottom: 15px;
    flex: 1;
}

.game-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.game-card-highscore {
    font-family: var(--font-retro);
    font-size: 9px;
    color: var(--neon-yellow);
}

.game-card-play {
    font-size: 11px;
    font-weight: bold;
    color: var(--neon-blue);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.game-card:hover .game-card-play {
    color: var(--neon-purple);
}

/* Footer info */
footer {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.25);
    font-size: 12px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* CRT grid structure inside games */
.grid-game-board {
    display: grid;
    background: rgba(20, 22, 35, 0.6);
    border: 2px solid var(--neon-blue);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--glow-shadow);
}

/* Monetization Ad Styles */
.arcade-ad-container {
    width: 100%;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.arcade-ad-banner {
    background: linear-gradient(135deg, rgba(20, 22, 37, 0.9), rgba(13, 14, 21, 0.95));
    border: 2px dashed var(--neon-pink);
    border-radius: 8px;
    padding: 12px 20px;
    width: 100%;
    max-width: 800px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 0 10px rgba(255, 0, 127, 0.15);
    position: relative;
    overflow: hidden;
}

.arcade-ad-banner::before {
    content: "SPONSORED COMS";
    position: absolute;
    top: 2px;
    right: 8px;
    font-size: 8px;
    color: var(--neon-pink);
    font-family: var(--font-retro);
    opacity: 0.6;
}

.arcade-ad-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.arcade-ad-icon {
    font-size: 24px;
    animation: ad-pulse 2s infinite alternate;
}

.arcade-ad-text {
    display: flex;
    flex-direction: column;
}

.arcade-ad-title {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.arcade-ad-desc {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 2px;
}

.arcade-ad-btn {
    background: rgba(255, 0, 127, 0.1);
    border: 1px solid var(--neon-pink);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.arcade-ad-btn:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 12px var(--neon-pink);
    transform: scale(1.03);
}

@keyframes ad-pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--neon-pink)); }
    100% { transform: scale(1.1); filter: drop-shadow(0 0 8px var(--neon-pink)); }
}

/* "How to Play" Guidance Modal Styles */
.arcade-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(7, 8, 15, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.arcade-modal.active {
    display: flex !important;
}

.arcade-modal-content {
    background: rgba(20, 22, 37, 0.98);
    border: 3px solid var(--neon-blue);
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
    width: 90%;
    max-width: 500px;
    padding: 30px;
    position: relative;
    animation: modal-enter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-enter {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.arcade-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.arcade-modal-close:hover {
    color: var(--neon-pink);
}

.arcade-modal-title {
    font-family: var(--font-retro);
    font-size: 14px;
    color: #fff;
    text-shadow: 0 0 10px var(--neon-blue);
    margin-bottom: 25px;
    text-transform: uppercase;
    line-height: 1.4;
}

.arcade-modal-section {
    margin-bottom: 18px;
}

.arcade-modal-section-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--neon-pink);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.arcade-modal-section-content {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    white-space: pre-line;
}

