* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif; }

body { 
    background-color: #ffffff; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    padding: 20px;
}

/* Nav & UI */
.nav-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 5px; border-bottom: 1px solid #d3d6da; padding-bottom: 10px; }
.game-title { font-weight: 900; font-size: 1.5rem; letter-spacing: 1px; }
.puzzle-number { cursor: pointer; font-weight: bold; background: #f3f3f3; padding: 3px 8px; border-radius: 12px; font-size: 0.9rem; transition: background 0.2s; }
.puzzle-number:hover { background: #e0e0e0; }
.nav-icons { display: flex; gap: 8px; }
.icon-btn { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #121213; }

/* Sidebar Menu */
/* Sidebar Menu */
.side-menu { 
    position: fixed; 
    top: 0; 
    left: -300px; /* Hides completely off-screen */
    width: 280px; /* Fixed width instead of percentage */
    height: 100%; 
    background: white; 
    z-index: 1001; 
    transition: left 0.3s ease; 
    padding: 20px; 
    box-shadow: 2px 0 10px rgba(0,0,0,0.15); 
}
.side-menu.open { 
    left: 0; 
}
.menu-links { list-style: none; }
.menu-links li { margin-bottom: 15px; }
.menu-links a { text-decoration: none; color: #121213; font-weight: bold; font-size: 1.1rem; }

.menu-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; /* Viewport width ensures it covers everything */
    height: 100vh; /* Viewport height ensures it covers everything */
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
    display: none; 
}
.menu-overlay.open { 
    display: block; 
}

/* --- MODALS (BULLETPROOF CENTERING & CLEAN SPACING) --- */
.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.6); z-index: 2000; 
    display: none; 
}
.modal-overlay.open { display: block; }

.modal { 
    background: #fff; border: 2px solid #121213; padding: 30px 25px; 
    border-radius: 12px; width: 90%; max-width: 360px; 
    display: none; /* Hidden by default */
    flex-direction: column; align-items: center; text-align: center; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 2001; 
    
    /* Perfect Dead-Center Alignment */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.modal.open { display: flex; } 

.modal h2 { margin-top: 0; margin-bottom: 15px; width: 100%; }
.modal p { margin-bottom: 10px; font-size: 1rem; color: #121213; }

/* Form Inputs inside Modals (Fixes clipping) */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #d3d6da;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    display: block;
}

/* Main Container */
.game-container { width: 72vw; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.hud { display: flex; justify-content: space-between; width: 100%; font-size: 1.1rem; font-weight: bold; }
.attempts-container { display: inline-flex; gap: 6px; align-items: center; }
.circle { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #121213; display: inline-block; transition: background-color 0.2s; }
.circle.filled { background-color: #121213; }
.circle.hollow { background-color: transparent; }

/* Grid */
.grid-wrapper { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: visible; }
.grid { display: grid; gap: 8px; width: 100%; height: 100%; }
.box { border: 2px solid #d3d6da; background-color: #ffffff; color: transparent; display: flex; justify-content: center; align-items: center; font-size: clamp(14px, 3.5vw, 28px); font-weight: bold; cursor: pointer; user-select: none; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.grid.locked .box { cursor: default; pointer-events: none; }
.box.flashing { color: #121213; }
.box.solved { background-color: #121213; border-color: #121213; color: #ffffff; }
.box.error { background-color: #e63946; border-color: #e63946; color: #ffffff; }

/* UI Elements */
.timer-section { display: flex; flex-direction: column; align-items: center; gap: 10px; height: 60px; }
.timer-text { font-size: 1rem; color: #565758; font-weight: 600; }
.timer-text.hidden { display: none; }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.95); display: flex; flex-direction: column; justify-content: center; align-items: center; z-index: 10; text-align: center; }
.overlay h1 { font-size: 3rem; margin-bottom: 10px; }
.overlay.hidden { display: none; }
.btn { padding: 10px 25px; font-size: 1.1rem; font-weight: bold; background-color: #121213; color: white; border: none; border-radius: 4px; cursor: pointer; transition: background-color 0.2s; margin-top: 10px; width: 100%; }
.btn:hover { background-color: #3a3a3c; }

/* Floating Score */
.floating-score { position: absolute; color: #2b8a3e; font-size: 1.6rem; font-weight: 950; pointer-events: none; animation: floatUp 1.0s forwards ease-out; z-index: 20; transform: translate(-50%, -50%); }
.floating-score.perfect-bonus { font-size: 2.2rem; color: #000000; }
@keyframes floatUp { 0% { opacity: 1; transform: translate(-50%, 0) scale(0.8); } 50% { transform: translate(-50%, -25px) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
.fade-out { animation: fadeOut 0.5s forwards ease-in-out; }
.slide-in { animation: slideIn 0.5s forwards ease-out; }
@keyframes fadeOut { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.9); } }
@keyframes slideIn { 0% { opacity: 0; transform: translateX(100%); } 100% { opacity: 1; transform: translateX(0); } }

/* Footer styling */
.about-footer {
    display: block !important;
    width: 100% !important;
    max-width: 500px;
    margin-top: 40px !important;
    padding: 20px !important;
    font-size: 0.9em !important;
    color: #666 !important;
    text-align: center !important;
}

/* --- LAYOUT WRAPPER FOR SIDE ADS --- */
.main-layout-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* Side Skyscraper Ads (Desktop Only) */
.ad-side {
    display: none; /* Hidden on mobile by default */
    width: 160px;
    min-height: 600px;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

/* Show Side Ads on Screens Wider Than 1000px */
@media (min-width: 1000px) {
    .ad-side {
        display: block;
    }
}

/* Bottom Horizontal Ad */
.ad-container.ad-bottom {
    width: 100%;
    max-width: 728px;
    margin: 25px auto 0 auto;
    text-align: center;
    min-height: 90px;
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 10px;
}

.ad-label {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

/* --- IN-PAGE GAME INFO SECTION (AdSense & SEO) --- */
.game-info-section {
    width: 100%;
    max-width: 600px;
    margin: 35px auto 10px auto;
    text-align: left;
    color: #333;
    line-height: 1.6;
    border-top: 1px solid #d3d6da;
    padding-top: 25px;
}

.game-info-section h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: #121213;
}

.game-info-section h3 {
    font-size: 1.05rem;
    margin-top: 20px;
    margin-bottom: 8px;
    color: #121213;
}

.game-info-section p {
    font-size: 0.95rem;
    color: #565758;
    margin-bottom: 12px;
}

.game-info-section ul {
    margin-left: 20px;
    font-size: 0.95rem;
    color: #565758;
}

.game-info-section li {
    margin-bottom: 8px;
}

/* 1. Hide the bottom ad by default (for desktop) */
.mobile-only-ad {
    display: none; 
}

/* 2. Show it ONLY on screens smaller than 800px (Mobile/Tablet) */
@media (max-width: 800px) {
    .mobile-only-ad {
        display: block; 
        
        /* AD SENSE SAFETY GAP (Extremely Important!) */
        margin-top: 40px; 
        margin-bottom: 30px;
    }
}

