/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* ==================== Page Layout with Sidebars ==================== */
.page-wrapper {
    display: grid;
    grid-template-columns: 160px 1fr 160px;
    gap: 20px;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.sidebar {
    min-height: 100vh;
}

.sidebar-left,
.sidebar-right {
    display: flex;
    align-items: flex-start;
    padding-top: 80px;
}

.sticky-ad {
    position: sticky;
    top: 20px;
    width: 160px;
    min-height: 600px;
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
}

/* Responsive: Hide sidebars on tablets and mobile */
@media (max-width: 1024px) {
    .page-wrapper {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .sidebar {
        display: none;
    }
}

.container {
    max-width: 450px;
    width: 100%;
}

/* ==================== Header ==================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.back-button {
    text-decoration: none;
    color: white;
    font-size: 1.1em;
    font-weight: 600;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.title {
    font-size: 3em;
    color: white;
    text-align: center;
    flex: 1;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* ==================== Game Info ==================== */
.game-info {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.info-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.info-box.highlight {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
}

.label {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    opacity: 0.8;
}

.value {
    font-size: 2em;
    font-weight: 800;
}

/* ==================== Instructions ==================== */
.instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.instructions p {
    color: #2d3436;
    font-size: 0.95em;
    margin: 5px 0;
    font-weight: 500;
}

/* ==================== Canvas ==================== */
#gameCanvas {
    display: block;
    margin: 0 auto 20px;
    background: linear-gradient(180deg, #87ceeb 0%, #e0f7fa 100%);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    max-width: 100%;
    height: auto;
    cursor: pointer;
}

/* ==================== Controls ==================== */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.start-btn {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Game Over Overlay ==================== */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: scaleIn 0.3s ease;
}

.game-over-title {
    font-size: 2.5em;
    color: #2d3436;
    margin-bottom: 15px;
}

.final-score {
    font-size: 1.3em;
    color: #636e72;
    margin-bottom: 25px;
}

.final-score span {
    font-weight: 800;
    color: #0984e3;
    font-size: 1.3em;
}

.play-again-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.play-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==================== Responsive ==================== */
@media (max-width: 600px) {
    .title {
        font-size: 2em;
    }

    #gameCanvas {
        width: 100%;
        max-width: 400px;
    }
}
