/*
 * GemRush - Stylesheet for the canvas-based game & AdSense Web Portal
 * Designed to be modular, maintainable, and compatible with modern browsers.
 */

/* ==========================================================================
   Global Styles
   ========================================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: #222831;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    color: #EEEEEE;
    position: relative;
}

/* ==========================================================================
   Portal Top Navigation Bar
   ========================================================================== */
.portal-header {
    width: 100%;
    background: #1a1f27;
    border-bottom: 1px solid #393E46;
    padding: 14px 24px;
    box-sizing: border-box;
}

.portal-nav {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    color: #00ADB5;
    text-decoration: none;
}

.portal-links {
    display: flex;
    gap: 22px;
    align-items: center;
}

.portal-links a {
    color: #EEEEEE;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 500;
    transition: color 0.2s;
}

.portal-links a:hover {
    color: #00ADB5;
}

/* ==========================================================================
   AdSense Responsive Ad Slots
   ========================================================================== */
.ad-banner-slot {
    width: 100%;
    max-width: 900px;
    min-height: 90px;
    margin: 18px auto 6px;
    background: #1b2028;
    border: 1px dashed #393E46;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
}

.ad-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6c757d;
    margin-bottom: 4px;
}

/* ==========================================================================
   Main Game Container
   ========================================================================== */
#container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 900px;
    width: 100%;
    padding: 20px 30px 30px;
    box-sizing: border-box;
}

/* ==========================================================================
   Settings Button
   ========================================================================== */
#settingsButton {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    font-size: 16px;
    background: #393E46;
    color: #EEEEEE;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    z-index: 10;
}

#settingsButton:hover {
    background: #00ADB5;
    color: #222831;
}

/* ==========================================================================
   Settings Panel
   ========================================================================== */
#settingsPanel {
    display: none;
    position: absolute;
    top: 70px;
    right: 20px;
    background: #393E46;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 11;
    width: 220px;
}

.settings-item {
    margin-bottom: 15px;
}

.settings-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #A9B2B9;
}

#fullscreenButton, #soundToggleButton {
    width: calc(100% - 10px);
    padding: 10px;
    font-size: 16px;
    background: #00ADB5;
    color: #222831;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin-top: 5px;
}

#fullscreenButton:hover, #soundToggleButton:hover {
    background: #EEEEEE;
    color: #00ADB5;
}

#volumeSlider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #4A535E;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#volumeSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ADB5;
    cursor: pointer;
}

#volumeSlider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00ADB5;
    cursor: pointer;
    border: none;
}

/* ==========================================================================
   Game Canvas Wrapper & Canvas
   ========================================================================== */
.canvas-stage {
    position: relative;
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center;
}

#gameCanvas {
    border: 4px solid #00ADB5;
    background: #393E46;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    width: 100%;
    max-width: 800px;
    height: 500px;
    touch-action: manipulation;
}

/* ==========================================================================
   UI Elements
   ========================================================================== */
#ui {
    margin-top: 24px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    color: #A9B2B9;
    background: #2A323A;
    padding: 14px 24px;
    border-radius: 10px;
    box-sizing: border-box;
}

/* ==========================================================================
   Start and Game Over Screens
   ========================================================================== */
#startScreen, #gameOver {
    position: absolute;
    top: 270px;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(42, 50, 58, 0.96);
    padding: 40px;
    border-radius: 18px;
    border: 1px solid rgba(0, 173, 181, 0.35);
    color: #EEEEEE;
    text-align: center;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
    max-width: 560px;
    width: 90%;
    z-index: 9;
}

#startScreen h1, #gameOver h2 {
    margin: 0 0 20px;
    font-size: 40px;
    color: #00ADB5;
}

#startScreen p, #gameOver p {
    margin: 0 0 22px;
    font-size: 16.5px;
    line-height: 1.6;
    opacity: 0.92;
}

#startButton, #playAgain, #nextLevel {
    padding: 14px 38px;
    font-size: 19px;
    font-weight: 700;
    background: #00ADB5;
    color: #222831;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#startButton:hover, #playAgain:hover, #nextLevel:hover {
    background: #EEEEEE;
    color: #00ADB5;
}

/* ==========================================================================
   Pause Message
   ========================================================================== */
#pauseMessage {
    display: none;
    position: absolute;
    top: 270px;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(42, 50, 58, 0.92);
    color: #EEEEEE;
    padding: 30px 60px;
    border-radius: 12px;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 8;
}

#highScore {
    font-size: 16px;
    opacity: 0.85;
    margin-bottom: 22px;
    color: #A9B2B9;
}

#controlInfo {
    margin-top: 20px;
    font-size: 14px;
    opacity: 0.8;
    text-align: center;
    width: 100%;
    max-width: 800px;
    color: #A9B2B9;
}

#controlInfo p {
    margin: 4px 0;
}

/* ==========================================================================
   Rich Editorial Content Section (Required for AdSense Content Compliance)
   ========================================================================== */
.editorial-content {
    max-width: 900px;
    width: 100%;
    margin: 30px auto 50px;
    padding: 0 24px;
    box-sizing: border-box;
}

.editorial-card {
    background: #2A323A;
    border: 1px solid #393E46;
    border-radius: 16px;
    padding: 36px;
    margin-bottom: 28px;
    line-height: 1.75;
}

.editorial-card h2 {
    color: #00ADB5;
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 16px;
    border-bottom: 1px solid #393E46;
    padding-bottom: 10px;
}

.editorial-card h3 {
    color: #EEEEEE;
    font-size: 18px;
    margin-top: 22px;
    margin-bottom: 10px;
}

.editorial-card p {
    color: #CBD5E1;
    font-size: 15.5px;
    margin-bottom: 14px;
}

.editorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.feature-box {
    background: #222831;
    border: 1px solid #393E46;
    border-radius: 12px;
    padding: 18px;
}

.feature-box h4 {
    color: #00ADB5;
    margin: 0 0 8px;
    font-size: 16px;
}

.feature-box p {
    font-size: 14px;
    margin: 0;
    color: #A9B2B9;
}

/* ==========================================================================
   Portal Footer
   ========================================================================== */
.portal-footer {
    width: 100%;
    background: #1a1f27;
    border-top: 1px solid #393E46;
    padding: 40px 24px 28px;
    box-sizing: border-box;
    margin-top: auto;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 14px;
    color: #A9B2B9;
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #EEEEEE;
    text-decoration: none;
}

.footer-links a:hover {
    color: #00ADB5;
    text-decoration: underline;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 600px) {
    #gameCanvas {
        height: 400px;
        border-width: 3px;
    }
    #startScreen, #gameOver {
        top: 220px;
        padding: 24px;
    }
    #startScreen h1, #gameOver h2 {
        font-size: 28px;
    }
    #ui {
        font-size: 15px;
        flex-wrap: wrap;
        gap: 10px;
    }
    .editorial-card {
        padding: 22px;
    }
}

/* ==========================================================================
   High-Viewability 3-Column Gaming Portal Stage (Google AdSense Optimized)
   ========================================================================== */
.arcade-stage-wrapper {
    width: 100%;
    max-width: 1460px;
    margin: 10px auto 16px;
    padding: 0 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
}

.ad-side-rail {
    width: 200px;
    min-width: 160px;
    min-height: 600px;
    background: #1b2028;
    border: 1px dashed #393E46;
    border-radius: 12px;
    padding: 10px 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: sticky;
    top: 20px;
    flex-shrink: 0;
}

.ad-in-article-slot {
    width: 100%;
    max-width: 900px;
    min-height: 120px;
    margin: 0 auto 28px;
    background: #1b2028;
    border: 1px dashed #393E46;
    border-radius: 12px;
    padding: 12px;
    box-sizing: border-box;
    text-align: center;
}

@media (max-width: 1260px) {
    .ad-side-rail {
        display: none;
    }
    .arcade-stage-wrapper {
        gap: 0;
    }
}
