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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
    /* Removed flex centering to allow natural document flow for AdSense */
    overflow-x: hidden;
    overflow-y: auto;
}

/* Site Header */
.site-header {
    width: 100%;
    text-align: center;
    padding: 20px 0 10px;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Game Section */
.game-section {
    display: flex;
    justify-content: center;
}

.game-title {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 0 0 10px #00fff2, 0 0 20px #00fff2;
    letter-spacing: 3px;
}

.game-wrapper {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
}

#gameCanvas {
    border: 3px solid #00fff2;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 255, 242, 0.5),
                inset 0 0 20px rgba(0, 255, 242, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

.side-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.score-panel,
.level-panel,
.highscore-panel {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.score-panel h3,
.level-panel h3,
.highscore-panel h3,
.next-piece-panel h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #00fff2;
}

#score,
#level,
#highScore {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 0 0 5px #fff;
}

.next-piece-panel {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

#nextCanvas {
    border: 2px solid #00fff2;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 242, 0.3);
    background: rgba(0, 0, 0, 0.5);
    margin: 0 auto;
    display: block;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.controls button {
    padding: 12px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
}

#startBtn {
    background: linear-gradient(45deg, #00fff2, #0088ff);
    color: #1a1a2e;
}

#startBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 242, 0.6);
}

#pauseBtn {
    background: linear-gradient(45deg, #ffd700, #ff8c00);
    color: #1a1a2e;
}

#pauseBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

#resetBtn {
    background: linear-gradient(45deg, #ff4444, #ff0000);
    color: #fff;
}

#resetBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.6);
}

#settingsBtn {
    background: linear-gradient(45deg, #ff00ff, #8800ff);
    color: #fff;
}

#settingsBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.6);
}

.instructions {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.instructions h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #00fff2;
}

.instructions p {
    font-size: 0.85rem;
    margin: 5px 0;
    color: #ccc;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 3px solid #00fff2;
    box-shadow: 0 0 30px rgba(0, 255, 242, 0.5);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #00fff2;
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

#finalScore {
    font-weight: bold;
    color: #ffd700;
    font-size: 1.5rem;
}

.modal-content button {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: bold;
    margin: 0 10px;
}

#restartBtn {
    background: linear-gradient(45deg, #00fff2, #0088ff);
    color: #1a1a2e;
}

#restartBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 242, 0.6);
}

#closeModalBtn {
    background: linear-gradient(45deg, #888, #555);
    color: #fff;
}

#closeModalBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(136, 136, 136, 0.6);
}

.settings-content {
    max-width: 400px;
    text-align: left;
}

.settings-content h2 {
    text-align: center;
    margin-bottom: 30px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: #00fff2;
    font-weight: bold;
}

.setting-item input[type="range"] {
    width: 100%;
    height: 8px;
    background: #333;
    border-radius: 5px;
    outline: none;
    -webkit-appearance: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #00fff2;
    border-radius: 50%;
    cursor: pointer;
}

.setting-item input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #00fff2;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#startLevelValue {
    color: #fff;
    font-weight: bold;
    margin-left: 10px;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    background: #1a1a2e;
    border: 2px solid #00fff2;
    border-radius: 5px;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.setting-item select:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 242, 0.5);
}

.setting-item select option {
    background: #1a1a2e;
    color: #fff;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #00fff2;
}

.checkbox-label span {
    color: #fff;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px 20px;
    font-size: 0.9rem;
}

#saveSettingsBtn {
    background: linear-gradient(45deg, #00fff2, #0088ff);
    color: #1a1a2e;
}

#saveSettingsBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 242, 0.6);
}

#resetSettingsBtn {
    background: linear-gradient(45deg, #ff8c00, #ff4400);
    color: #fff;
}

#resetSettingsBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.6);
}

#closeSettingsBtn {
    background: linear-gradient(45deg, #888, #555);
    color: #fff;
}

#closeSettingsBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(136, 136, 136, 0.6);
}

@media (max-width: 768px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }
    
    .side-panel {
        width: 100%;
        max-width: 300px;
    }
    
    .game-title {
        font-size: 1.8rem;
    }

    .game-description {
        padding: 20px 15px;
    }
}

/* Game Description Section */
.game-description {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    text-align: left;
    margin-top: 30px;
}

.game-description h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #00fff2;
}

.game-description h3 {
    font-size: 1.2rem;
    margin: 20px 0 10px;
    color: #00fff2;
}

.game-description p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 10px;
    color: #ccc;
}

.game-description ul {
    margin-left: 20px;
    color: #ccc;
}

.game-description li {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* Site Footer */
.site-footer {
    width: 100%;
    padding: 20px;
    text-align: center;
    margin-top: 30px;
}

.copyright {
    font-size: 0.85rem;
    color: #888;
    margin-top: 15px;
}
