/* Game Center Styles */
:root {
    --game-primary: #00f2ff;
    --game-secondary: #bc13fe;
    --game-bg: rgba(10, 10, 20, 0.95);
    --game-glass: rgba(255, 255, 255, 0.05);
}

/* Floating Entry Button */
#game-entry-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--game-primary);
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 0 15px var(--game-primary);
    transition: all 0.3s ease;
    animation: pulse-glow 2s infinite;
}

#game-entry-btn:hover {
    transform: scale(1.1) rotate(10deg);
    background: var(--game-primary);
    color: #000;
    box-shadow: 0 0 30px var(--game-primary);
}

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 10px var(--game-primary);
    }

    50% {
        box-shadow: 0 0 20px var(--game-primary), 0 0 40px var(--game-secondary);
    }

    100% {
        box-shadow: 0 0 10px var(--game-primary);
    }
}

/* Game Modal Overlay */
#game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#game-modal.active {
    opacity: 1;
    pointer-events: all;
}

/* Game Menu */
.game-menu {
    background: rgba(20, 20, 35, 0.85);
    /* Lighter, less opaque */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px;
    width: 95%;
    max-width: 1200px;
    /* Wider */
    height: 90vh;
    /* Fixed height for scrolling */
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.6);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
    /* Internal scrolling */
}

#game-modal.active .game-menu {
    transform: translateY(0);
}

.menu-header {
    flex-shrink: 0;
    margin-bottom: 20px;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* Scrollbar Styling */
.menu-content::-webkit-scrollbar {
    width: 8px;
}

.menu-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.menu-content::-webkit-scrollbar-thumb {
    background: var(--game-primary);
    border-radius: 4px;
}

/* Mobile Scroll Fix */
@media (max-height: 800px) {
    .game-menu {
        max-height: 90vh;
        overflow-y: auto;
        padding: 20px;
    }
}

/* Tooltip */
#game-tooltip {
    position: fixed;
    bottom: 90px;
    left: 20px;
    background: #fff;
    color: #000;
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.9rem;
    pointer-events: none;
    /* Let clicks pass through if needed, though it's just visual */
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9998;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#game-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}

#game-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Branding Watermark */
.game-branding {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.05);
    /* Very subtle */
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 0;
    /* Behind game elements */
    text-transform: uppercase;
    letter-spacing: 10px;
    white-space: nowrap;
}

/* Header Branding */
.header-brand {
    font-size: 0.8rem;
    color: #555;
    margin-left: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.game-menu h2 {
    font-family: 'Orbitron', sans-serif;
    /* Fallback to sans-serif if not loaded */
    font-size: 3rem;
    background: linear-gradient(45deg, var(--game-primary), var(--game-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 40px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    /* Smaller min-width */
    gap: 15px;
    /* Smaller gap */
}

.game-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    /* Smaller radius */
    padding: 15px;
    /* Smaller padding */
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.game-card:hover {
    transform: translateY(-3px);
    /* Subtle lift */
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--game-primary);
    box-shadow: 0 5px 20px rgba(0, 242, 255, 0.15);
}

.game-icon {
    font-size: 2.5rem;
    /* Smaller icon */
    margin-bottom: 10px;
    display: block;
}

/* Brighter Text */
.game-card h3 {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    /* Smaller title */
    margin-bottom: 5px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.game-card p {
    color: #ccc;
    font-size: 0.8rem;
    /* Smaller desc */
    line-height: 1.2;
}

/* Close Button */
.close-game-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10001;
}

.close-game-btn:hover {
    color: var(--game-secondary);
}

/* Active Game Full Screen */
#active-game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #050510;
    /* Slightly lighter than pure black */
    z-index: 10002;
    display: none;
    /* Hidden by default */
    flex-direction: column;
}

#active-game-container.active {
    display: flex;
}

.game-header {
    padding: 15px 30px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-header h3 {
    color: var(--game-primary);
    margin: 0;
}

.game-score {
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
}

#game-canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

canvas.game-canvas {
    background: #000;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    max-width: 100%;
    max-height: 80vh;
}

/* Cyber Constructor Specifics */
#cyber-constructor-ui {
    width: 100%;
    height: 100%;
    padding: 20px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0f0f1a 100%);
}

.cc-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    font-size: 1.5rem;
}

.cc-stat span {
    color: var(--game-primary);
    font-weight: bold;
}

.cc-main-btn {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--game-primary), var(--game-secondary));
    border: none;
    color: #fff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.3);
    transition: transform 0.1s;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cc-main-btn:active {
    transform: scale(0.95);
}

.cc-upgrades {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 800px;
}

.cc-upgrade-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--game-primary);
    padding: 15px;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.cc-upgrade-btn:hover:not(:disabled) {
    background: var(--game-primary);
    color: #000;
}

.cc-upgrade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #555;
}

.cc-progress-container {
    width: 100%;
    max-width: 800px;
    margin-top: auto;
    margin-bottom: 20px;
}

.cc-progress-bar {
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.cc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--game-primary), var(--game-secondary));
    width: 0%;
    transition: width 0.3s ease;
}

.cc-progress-text {
    text-align: center;
    margin-top: 5px;
    color: #aaa;
}

/* Instruction Modal */
#instruction-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#instruction-modal.active {
    opacity: 1;
    pointer-events: all;
}

.instruction-content {
    background: var(--game-glass);
    border: 1px solid var(--game-primary);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.2);
}

.instruction-content h2 {
    color: var(--game-primary);
    margin-bottom: 20px;
    font-size: 2rem;
}

.instruction-content p {
    color: #ddd;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.start-game-btn {
    background: linear-gradient(135deg, var(--game-primary), var(--game-secondary));
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.start-game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--game-secondary);
}

/* Cyber Pattern Styles */
#cyber-pattern-ui {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
}

.pattern-btn {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.1s;
    opacity: 0.5;
}

.pattern-btn.active {
    opacity: 1;
    box-shadow: 0 0 30px currentColor;
    transform: scale(0.95);
}

.pattern-btn:active {
    transform: scale(0.9);
}

/* Leaderboard Section - Redesigned */
.leaderboard-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lb-title {
    color: var(--game-secondary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.lb-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.lb-table tr {
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}

.lb-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lb-table td {
    padding: 12px 15px;
    border: none;
}

.lb-table td:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    font-weight: bold;
    color: #fff;
}

.lb-table td:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Game Over Input */
.game-over-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid var(--game-primary);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 10010;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    display: none;
}

.game-over-modal.active {
    display: block;
}

.go-input {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    font-size: 1.2rem;
    margin: 15px 0;
    width: 200px;
    text-align: center;
}

.go-btn {
    background: var(--game-primary);
    border: none;
    padding: 10px 20px;
    color: #000;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
}

/* Mute Button */
#game-mute-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 10px;
    transition: all 0.3s;
}

#game-mute-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--game-primary);
}

#game-mute-btn.muted {
    color: #555;
    border-color: #333;
}

/* Tetris Styles */
.tetris-score-box {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
    color: #fff;
}

/* Jump Styles */
.jump-msg {
    position: absolute;
    top: 20%;
    width: 100%;
    text-align: center;
    color: #aaa;
    pointer-events: none;
}