:root {
    --bg-color: #0b0f19;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #00d4ff;
    --accent-green: #00ff88;
    --accent-red: #ff4d4d;
    --accent-purple: #a855f7;
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.35);
}

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

body {
    font-family: 'Outfit', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.05) 0px, transparent 50%),
        radial-gradient(at 50% 0%, rgba(14, 165, 233, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Snow Canvas */
#snowBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Header & Navigation */
header {
    width: 100%;
    padding: 15px 5%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--accent-blue), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-links li.active a {
    color: #ffffff;
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
}

/* Main Layout */
main {
    flex: 1;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    position: relative;
}

/* Lobby Styles */
.lobby-container {
    max-width: 1000px;
    width: 100%;
    text-align: center;
    margin-top: 20px;
}

.hero-section {
    margin-bottom: 50px;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.hero-section p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

.game-card {
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 35px 25px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(0, 212, 255, 0.1), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.game-card:hover {
    transform: translateY(-10px);
    border-color: rgba(0, 212, 255, 0.25);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), var(--shadow-glow);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 5px 15px rgba(0, 212, 255, 0.3));
    transition: transform 0.3s ease;
}

.game-card:hover .game-card-icon {
    transform: scale(1.15) rotate(5deg);
}

.game-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.game-card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
    flex-grow: 1;
}

.game-card-btn {
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-snake {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.game-card:hover .btn-snake {
    background: var(--accent-green);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.btn-jump {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.game-card:hover .btn-jump {
    background: var(--accent-blue);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
}

/* Stats and Information Panel */
.stats-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    margin-top: 40px;
    text-align: left;
}

.stats-panel h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-blue);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-primary);
}

/* Game Interface Layout */
.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1000px;
    width: 100%;
}

.game-wrapper {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid rgba(186, 230, 253, 0.2); /* Light icy border */
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 35px rgba(0, 212, 255, 0.1); /* Soft cyan glow */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

/* Hanging Icicles decoration from the top edge of the game container */
.game-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30px;
    right: 30px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0,0 h100 v2 l-3,10 l-2,-10 l-4,6 l-3,-6 l-5,14 l-4,-14 l-3,8 l-3,-8 l-6,12 l-5,-12 l-3,7 l-3,-7 l-6,15 l-4,-15 l-4,8 l-3,-8 l-6,11 l-4,-11 l-3,6 l-4,-6 z' fill='%23bae6fd'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 3px 5px rgba(56, 189, 248, 0.6));
    opacity: 0.9;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.game-title {
    font-size: 1.8rem;
    font-weight: 900;
}

.game-title span {
    color: var(--accent-blue);
    text-shadow: var(--shadow-glow);
}

.scoreboard-container {
    display: flex;
    gap: 20px;
}

.score-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 16px;
    text-align: center;
}

.score-box-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.score-box-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-blue);
}

.score-box-value.highscore {
    color: var(--accent-purple);
}

/* Canvas Area styling */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4/3;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
    background-color: #0b0d10;
}

.canvas-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.overlay-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 25px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), #0088ff);
    color: #000;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.5);
}

/* Game Controls Area */
.game-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 20px;
    gap: 15px;
}

.btn-group {
    display: flex;
    gap: 10px;
}

.btn-group button {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-back {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-action {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Virtual D-Pad for Mobile Controls */
.mobile-dpad {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    width: 180px;
    height: 180px;
    margin-top: 25px;
}

.dpad-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 15px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.1s, transform 0.1s;
}

.dpad-btn:active {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--accent-blue);
    transform: scale(0.95);
}

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

/* Responsive styles */
@media (max-width: 768px) {
    .navbar {
        padding: 10px 15px;
    }
    
    .nav-brand {
        font-size: 1.2rem;
    }
    
    .nav-links {
        gap: 5px;
    }
    
    .nav-links a {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .hero-section h1 {
        font-size: 2.2rem;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .game-wrapper {
        padding: 15px;
    }
    
    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .scoreboard-container {
        width: 100%;
        justify-content: space-between;
    }
    
    .mobile-dpad {
        display: grid;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-group {
        width: 100%;
    }
    
    .btn-group button {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}

footer {
    width: 100%;
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.4);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: auto;
    z-index: 10;
}
