/* Custom Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle, #1a1a2e 0%, #16213e 100%);
    color: white;
    margin: 0;
    /* FIX 1: Allow vertical scrolling, but prevent horizontal bounce */
    overflow-x: hidden;
    overflow-y: auto; 
    overscroll-behavior-y: contain;
    /* REMOVED touch-action: none from body. We only want it on the Canvas. */
    
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
.main-header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    /* FIX 2: Better mobile layout for header */
    flex-wrap: wrap;
    gap: 10px;
}

h1 {
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0;
    white-space: nowrap; /* Keep title on one line */
}

h1 span {
    color: #00d2ff;
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    margin: 0 10px; /* Reduced margin slightly for mobile fit */
    text-decoration: none;
    color: #00d2ff;
    font-weight: 700;
    white-space: nowrap; /* Keep links from breaking */
}

/* Scoreboard */
#scoreboard {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 15px;
    margin: 0 auto 20px auto;
    position: relative;
    z-index: 10;
    width: 90vw;
    max-width: 600px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-box {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.label {
    font-size: 0.7rem;
    color: #00d2ff;
    font-weight: bold;
    text-transform: uppercase;
}

.value {
    font-size: 1.5rem;
    font-weight: 900;
}

/* Game Layout */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    flex-grow: 1;
}

canvas {
    width: 95vw;
    max-width: 800px;
    height: auto;
    max-height: 65vh;
    
    border-radius: 15px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    border: 4px solid #16213e;
    display: block;
    margin: 0 auto;
    background-color: #000;
    
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;

    /* FIX 3: Keep this here! It ensures only the game blocks scrolling while playing */
    touch-action: none; 
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Game Over Overlay */
.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-radius: 20px;
    border: 2px solid #00d2ff;
    text-align: center;
    z-index: 100;
    width: auto;
    min-width: 250px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

.hidden {
    display: none;
}

.overlay h2 {
    margin: 0 0 15px 0;
    color: #ff4b2b;
    font-size: 2.2rem;
    font-weight: 900;
}

/* Buttons */
.button-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-bottom: 20px;
}

.start-btn {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    border: none;
    border-radius: 30px;
    padding: 15px 40px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.4);
}

.start-btn:active {
    transform: scale(0.95);
}

/* Media Queries */
@media (max-width: 600px) {
    .header-content {
        flex-direction: column; /* Stack Title above Menu on very small phones */
        text-align: center;
    }
    
    nav {
        margin-top: 5px;
    }

    .watermark {
        font-size: 0.6rem;
        bottom: 10px;
        left: 10px;
        opacity: 0.2;
    }
}

@media (max-width: 480px) {
    .value {
        font-size: 1.2rem;
    }
    .start-btn {
        padding: 12px 30px;
        font-size: 0.9rem;
    }
    h1 {
        font-size: 1.2rem;
    }
    nav a {
        margin: 0 8px;
        font-size: 0.85rem;
    }
}

.canvas-footer {
    display: flex;
    justify-content: space-between;
    width: 95vw;
    max-width: 800px;
    margin-top: 8px;
    padding: 0 5px;
    box-sizing: border-box;
}

.footer-name, 
.footer-version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.watermark {
    position: fixed;
    bottom: 20px;
    left: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 1px;
    text-transform: uppercase;
    z-index: 1000;
    pointer-events: none;
}

/* About Page Specific Styles */
.about-content {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px; /* Reduced for mobile */
    border-radius: 15px;
    text-align: left;
    max-width: 800px;
    margin: 20px auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Allow about page to breathe on mobile */
    width: 90vw;
    box-sizing: border-box;
}

/* Ensure about sections don't overflow */
.about-section {
    word-wrap: break-word;
}

.about-section h2 {
    color: #00d2ff;
    font-size: 1.5rem; /* Slightly smaller for mobile */
    margin-bottom: 15px;
}

.about-section p {
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.section-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    margin: 30px 0;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); /* Better fit */
    gap: 15px;
    margin-top: 20px;
}

.control-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
}

.control-item strong {
    display: block;
    color: #ff4b2b;
    margin-bottom: 5px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

nav a.active {
    color: #00d2ff;
    border-bottom: 2px solid #00d2ff;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
}

.contact-methods .control-item {
    border-left: 4px solid #00d2ff;
    transition: transform 0.2s ease;
}