:root {
    --primary: #6d28d9;
    --primary-hover: #5b21b6;
    --secondary: #10b981;
    --dark: #111827;
    --light: #f9fafb;
    --accent: #1e3a8a;
    --game-bg: #0f172a;
    --text-primary: #ffffff;
    --text-secondary: #e5e7eb;
    --focus-outline: 3px solid var(--accent);
    --hover-bg: rgba(30, 58, 138, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--game-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--dark);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    font-family: 'Press Start 2P', cursive;
}

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 2rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem;
    border-radius: 4px;
}

.nav-links a:hover,
.nav-links a:focus {
    color: var(--secondary);
    background-color: var(--hover-bg);
    outline: var(--focus-outline);
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.btn:hover,
.btn:focus {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    outline: var(--focus-outline);
}

.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url("https://images.unsplash.com/photo-1542751371-adc38448a05e?ixlib=rb-1.2.1&auto=format&fit=crop&w=1200&q=80") no-repeat center center/cover;
    height: 60vh;
    display: flex;
    align-items: center;
    text-align: center;
    position: relative;
}

.hero-content {
    width: 100%;
    padding: 2rem;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: 'Press Start 2P', cursive;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.featured-games, .games-page {
    padding: 4rem 0;
    transition: opacity 0.3s ease;
    flex: 1;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2.5rem;
    color: var(--text-primary);
    font-family: 'Press Start 2P', cursive;
}

.section-title span {
    color: var(--secondary);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.game-card {
    background: var(--dark);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-card:hover,
.game-card:focus-within {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    outline: var(--focus-outline);
}

.game-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 2px solid var(--primary);
}

.game-info {
    padding: 1.5rem;
}

.game-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-family: 'Press Start 2P', cursive;
    color: var(--text-primary);
}

.game-category {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.game-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    background: var(--dark);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 600px;
}

.no-results i {
    font-size: 3rem;
    color: var(--accent);
    margin-bottom: 1rem;
    display: block;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.no-results p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

footer {
    background: var(--dark);
    padding: 3rem 0;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
    display: inline-block;
    color: var(--text-primary);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s;
    padding: 0.25rem;
    border-radius: 4px;
    display: inline-block;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--secondary);
    background-color: var(--hover-bg);
    outline: var(--focus-outline);
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #374151;
    border-radius: 50%;
    color: white;
    transition: background 0.3s;
    text-decoration: none;
}

.social-link:hover,
.social-link:focus {
    background: var(--primary);
    outline: var(--focus-outline);
}

.copyright {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #374151;
    color: var(--text-secondary);
}

.mobile-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
}

.mobile-menu:hover,
.mobile-menu:focus {
    background-color: var(--hover-bg);
    outline: var(--focus-outline);
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        background: var(--dark);
        width: 100%;
        flex-direction: column;
        align-items: center;
        padding: 2rem 0;
        transform: translateY(-150%);
        transition: transform 0.3s ease-in-out;
        z-index: 99;
    }
    
    .nav-links.active {
        transform: translateY(0);
    }
    
    .nav-links li {
        margin: 1rem 0;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background: var(--dark);
    max-width: 800px;
    margin: 5% auto;
    border-radius: 8px;
    overflow: hidden;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-family: 'Press Start 2P', cursive;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
}

.close-modal:hover,
.close-modal:focus {
    background-color: var(--hover-bg);
    outline: var(--focus-outline);
}

.modal-body {
    padding: 1.5rem;
}

.game-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .game-details {
        grid-template-columns: 1fr;
    }
}

.modal-game-img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.game-meta {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.game-meta-item {
    background: #374151;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.play-now {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    width: 100%;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-input {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    background: #374151;
    color: var(--text-primary);
    width: 200px;
    transition: width 0.3s;
}

.search-input:focus {
    outline: var(--focus-outline);
    width: 250px;
}

.loader {
    border: 4px solid #374151;
    border-top: 4px solid var(--secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.game-container {
    display: none;
    padding: 1rem;
    text-align: center;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
    min-height: calc(100vh - 120px);
}

.game-screen {
    background: transparent;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    max-width: 1200px;
}

.game-ui {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.back-to-games {
    margin-top: 1rem;
}

.iframe-container {
    width: 100%;
    height: calc(100vh - 200px);
    min-height: 600px;
    position: relative;
}

.ratio-4by3 {
    aspect-ratio: 4/3;
    width: 80%;
    max-width: 800px;
    height: auto;
    margin: 0 auto;
    min-height: 0;
}

.game-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.music-control {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--text-primary);
}

.music-control:hover,
.music-control:focus {
    outline: var(--focus-outline);
    transform: scale(1.1);
}

.music-control i {
    font-size: 24px;
    color: var(--text-primary);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.games-page .games-grid {
    margin-top: 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.game-title-display {
    font-family: 'Press Start 2P', cursive;
    color: var(--text-primary);
    margin: 2rem 0;
    font-size: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: text-shadow 0.3s;
    user-select: none;
    padding: 0 1rem;
}

.game-title-display.glow {
    text-shadow: 0 0 10px var(--secondary), 
                 0 0 20px var(--secondary),
                 0 0 30px var(--secondary);
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.music-player-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}

.music-player-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 80%;
    max-width: 400px;
    background: var(--dark);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    max-height: 80vh;
    overflow-y: auto;
    transition: all 0.3s;
    opacity: 0;
    pointer-events: none;
}

.music-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #374151;
}

.music-player-header h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: var(--text-primary);
}

.close-music-player {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
}

.close-music-player:hover,
.close-music-player:focus {
    background-color: var(--hover-bg);
    outline: var(--focus-outline);
}

.music-list {
    list-style: none;
}

.music-item {
    padding: 12px;
    margin-bottom: 8px;
    background: #374151;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    color: var(--text-primary);
}

.music-item:hover,
.music-item:focus {
    background: var(--primary);
    transform: translateX(5px);
    outline: none;
}

.music-item.active {
    background: var(--secondary);
}

.music-item i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.music-info {
    flex: 1;
}

.music-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.music-author {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.now-playing {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #374151;
    display: none;
    color: var(--text-primary);
}

.now-playing.active {
    display: block;
}

.now-playing-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

[tabindex]:focus,
button:focus,
input:focus,
a:focus {
    outline: var(--focus-outline);
}

@media (prefers-contrast: more) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --primary: #0000ff;
        --secondary: #00ff00;
        --accent: #ffff00;
    }

    .game-card,
    .modal-content,
    .music-player-container {
        border: 2px solid white;
    }
}
