/* Base Styles */

/* CSS Custom Properties for Better Maintainability */
:root {
    --color-green: #00e676;
    --color-green-dark: #00c853;
    --color-red: #ff5252;
    --color-red-dark: #e53935;
    --color-blue: #448aff;
    --color-blue-dark: #2979ff;
    --color-yellow: #ffea00;
    --color-yellow-dark: #ffd600;
    --color-purple: #e040fb;
    --color-purple-dark: #d500f9;
    --color-orange: #ff9100;
    --color-orange-dark: #ff6d00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Accessibility: Allow text selection in readable content */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li {
    -webkit-user-select: text;
    user-select: text;
}

body {
    font-family: 'Outfit', sans-serif;
    background: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    /* Fallback for older browsers */
    min-height: 100dvh;
    width: 100%;
    overflow-x: hidden;
    touch-action: manipulation;
    padding: 0;
    margin: 0;
}

.game-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    display: none;
    flex-direction: column;
    padding: 10px;
    /* Fallback */
    padding: max(10px, env(safe-area-inset-top, 10px)) max(10px, env(safe-area-inset-right, 10px)) max(10px, env(safe-area-inset-bottom, 10px)) max(10px, env(safe-area-inset-left, 10px));
    margin: 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

@media (min-width: 768px) {
    .game-container {
        max-width: 700px;
    }
}

.game-container.active {
    display: flex;
}

/* Accessibility: Focus Styles for Keyboard Navigation */
button:focus-visible,
.level-btn:focus-visible,
.nav-btn:focus-visible,
.header-btn:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 2000;
    font-family: 'Outfit', sans-serif;
    color: #2d3436;
}

.start-screen.hidden {
    display: none;
}

.game-header {
    background: #ffffff;
    padding: clamp(10px, 2vw, 15px) clamp(10px, 4vw, 25px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid #dfe6e9;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.header-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: clamp(10px, 2vw, 25px);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 12px);
    flex-shrink: 0;
}

.dots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.dots span {
    width: 10px;
    height: 10px;
    background: #4a90e2;
    border-radius: 4px;
}

.logo-text {
    color: #2d3436;
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.main-nav {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

#howToPlayBtn {
    background: #f1f2f6;
    color: #2d3436;
}

#settingsBtn {
    background: #f1f2f6;
    color: #2d3436;
}

.nav-btn {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}


.nav-btn:hover {
    background: #e1e2e6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-btn:active {
    transform: translateY(0);
}

.main-content {
    flex: 1;
    padding: clamp(15px, 4vw, 40px) clamp(10px, 3vw, 20px);
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero-section {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 5vw, 40px);
    margin-bottom: 40px;
}

@media (min-width: 768px) {
    .hero-section {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }
}

.hero-left {
    flex: 1;
}

.hero-right {
    flex: 1;
    display: flex;
    justify-content: center;
}

.game-title {
    font-size: clamp(2rem, 8vw, 4.5rem);
    color: #2d3436;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 800;
    line-height: 1.1;
}


.tagline {
    font-size: clamp(1.1rem, 3vw, 1.4rem);
    color: #636e72;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 400;
}

.game-highlights {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 30px;
}

.highlight-card {
    background: #ffffff;
    border-radius: 20px;
    padding: clamp(15px, 4vw, 25px);
    border: 1px solid #dfe6e9;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.highlight-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

.highlight-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #4a90e2;
}

.highlight-text h3 {
    color: #2d3436;
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 700;
}

.highlight-text p {
    color: #636e72;
    font-size: 1rem;
    line-height: 1.5;
}

.game-preview {
    position: relative;
    width: min(75vw, 320px);
    height: min(75vw, 320px);
    background: linear-gradient(135deg, #d4a574 0%, #a0724b 100%);
    border-radius: 24px;
    padding: clamp(10px, 3vw, 20px);
    margin: 30px auto;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 0 8px rgba(255, 255, 255, 0.5);
    transform: perspective(1000px) rotateX(10deg) rotateY(-5deg);
    transition: transform 0.3s ease;
}

.game-preview:hover {
    transform: perspective(1000px) rotateX(5deg) rotateY(-2deg) scale(1.02);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    height: 100%;
}

.preview-cell {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.preview-tile {
    animation: float 3s ease-in-out infinite;
}

.preview-tile.green {
    background: #00e676;
}

.preview-tile.blue {
    background: #448aff;
}

.preview-tile.red {
    background: #ff5252;
}

.preview-tile.yellow {
    background: #ffea00;
}

.preview-gates {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
}

.preview-gate {
    position: absolute;
    width: clamp(40px, 15vw, 60px);
    height: clamp(40px, 15vw, 60px);
    border-radius: 50%;
}

.preview-gate.top {
    top: calc(clamp(40px, 15vw, 60px) / -2);
    left: 50%;
    transform: translateX(-50%);
    background: #00e676;
}

.preview-gate.right {
    right: calc(clamp(40px, 15vw, 60px) / -2);
    top: 50%;
    transform: translateY(-50%);
    background: #448aff;
}

.preview-gate.bottom {
    bottom: calc(clamp(40px, 15vw, 60px) / -2);
    left: 50%;
    transform: translateX(-50%);
    background: #ff5252;
}

.preview-gate.left {
    left: calc(clamp(40px, 15vw, 60px) / -2);
    top: 50%;
    transform: translateY(-50%);
    background: #ffea00;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.game-description {
    background: #ffffff;
    border-radius: 25px;
    padding: clamp(20px, 5vw, 40px);
    margin-bottom: 40px;
    border: 1px solid #dfe6e9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.game-description h2 {
    text-align: center;
    color: #2d3436;
    font-size: 2.2rem;
    margin-bottom: 30px;
    font-weight: 700;
}

.steps-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .steps-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.step {
    text-align: center;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 1px solid #dfe6e9;
    transition: all 0.2s ease;
}

.step:hover {
    background: #f1f2f6;
    transform: translateY(-3px);
}

.step-number {
    width: 50px;
    height: 50px;
    background: #4a90e2;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 auto 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.step h3 {
    color: #2d3436;
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 600;
}

.step p {
    color: #636e72;
    font-size: 0.95rem;
    line-height: 1.5;
}

.level-selection-section {
    background: #ffffff;
    border-radius: 25px;
    padding: clamp(20px, 5vw, 40px);
    border: 1px solid #dfe6e9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.section-header {
    text-align: center;
    margin-bottom: 30px;
}

.section-header h2 {
    color: #2d3436;
    font-size: 2rem;
    margin-bottom: 10px;
}

.section-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

.level-select-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .level-select-container {
        flex-direction: row;
        justify-content: center;
    }
}

.level-category {
    flex: 1;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #dfe6e9;
}

.level-category h3 {
    color: #2d3436;
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    width: 100%;
}

.level-btn {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 60px;
    border-radius: 12px;
    border: 1px solid #dfe6e9;
    background: #f8f9fa;
    color: #2d3436;
    font-size: 1.2rem;
    /* Fallback */
    font-size: clamp(1.1rem, 3vw, 1.3rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
}

/* Fallback for browsers without aspect-ratio support */
.level-btn::before {
    content: '';
    display: block;
    padding-bottom: 100%;
}

@supports (aspect-ratio: 1) {
    .level-btn::before {
        display: none;
    }
}

.level-btn:hover:not(.locked) {
    transform: translateY(-3px);
    background: #4a90e2;
    color: #ffffff;
    border-color: #4a90e2;
    box-shadow: 0 5px 15px rgba(74, 144, 226, 0.3);
}

.level-btn.locked {
    background: #f1f2f6;
    color: #b2bec3;
    cursor: not-allowed;
    border: 1px solid #dfe6e9;
}

.level-btn.locked i {
    font-size: 1.1rem;
    opacity: 0.5;
}

.quick-start-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

@media (min-width: 480px) {
    .quick-start-buttons {
        flex-direction: row;
        justify-content: center;
        gap: 20px;
    }
}

.quick-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.3s ease;
}

.quick-btn:hover {
    transform: translateY(-3px);
}

.start-btn {
    background: #4a90e2;
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.2);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    padding: clamp(12px, 3vh, 18px) clamp(30px, 8vw, 45px);
    border-radius: 12px;
    transition: all 0.2s;
}

.start-btn:hover {
    transform: translateY(-3px);
    background: #357abd;
    box-shadow: 0 15px 30px rgba(74, 144, 226, 0.3);
}

.continue-btn {
    background: rgba(52, 152, 219, 0.2);
    color: white;
    border: 2px solid #3498db;
}

.random-btn {
    background: rgba(155, 89, 182, 0.2);
    color: white;
    border: 2px solid #9b59b6;
}

.game-footer {
    margin-top: clamp(40px, 8vw, 60px);
    padding: clamp(30px, 6vw, 60px) clamp(10px, 3vw, 20px);
    background: #ffffff;
    border-top: 1px solid #dfe6e9;
}

.footer-container {
    display: flex;

    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;

}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h4 {
    color: #3498db;

    font-size: 1.4rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-section p {
    color: #636e72;
    line-height: 1.8;
    max-width: 400px;
    margin: 0 auto;
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    color: #bdc3c7;
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.features-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #3498db;
}

.social-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.3s ease;
}

.social-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.footer-bottom {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dfe6e9;
    color: #b2bec3;
}

.footer-bottom .privacy-btn,
.footer-bottom .terms-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    text-decoration: none;
    margin: 0 5px;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer-bottom .privacy-btn:hover,
.footer-bottom .terms-btn:hover {
    color: #2980b9;
    text-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}


.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 28px;
    padding: 35px;
    width: 100%;
    max-width: 500px;
    max-height: 85dvh;
    overflow-y: auto;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.modal-content h2 {
    color: #2d3436;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: 700;
}

.modal-body {
    color: #636e72;
    line-height: 1.6;
    margin-bottom: 25px;
}

.instructions,
.tips {
    margin-top: 20px;
}

.instructions h3,
.tips h3 {
    color: #3498db;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.instructions ol,
.tips ul {
    padding-left: 20px;
}

.instructions li,
.tips li {
    margin-bottom: 8px;
}

.modal-close {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: #2980b9;
}

.game-container:not([style*="display: none"]) {
    display: flex !important;
}


.header {
    background: linear-gradient(180deg, #2d4a7c 0%, #1e3a5f 100%);
    border-radius: 15px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #3d5a80;
    margin-bottom: 15px;
    width: 100%;
    gap: 5px;
}

@media (min-width: 400px) {
    .header {
        padding: 12px 20px;
        border-radius: 20px;
        gap: 15px;
    }
}

.level-badge {
    background: linear-gradient(180deg, #4a6fa5 0%, #2d4a7c 100%);
    border: 2px solid #6b8cce;
    border-radius: 50%;
    width: clamp(40px, 12vw, 60px);
    height: clamp(40px, 12vw, 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}



.level-number {
    font-size: clamp(16px, 4vw, 24px);
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.level-text {
    font-size: 9px;
    color: #a8c0e8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


.header-left-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

@media (min-width: 400px) {
    .header-left-controls {
        gap: 10px;
    }
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;

    font-size: 14px;
    margin-right: 5px;
    transition: all 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateX(-3px);
}


.timer-container {
    background: linear-gradient(180deg, #1a1a1a 0%, #000000 100%);
    border-radius: 10px;
    padding: 4px 6px;
    border: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.8);
    flex: 1;
    min-width: 70px;
    text-align: center;
    margin: 0 2px;
}

@media (min-width: 400px) {
    .timer-container {
        padding: 8px 15px;
        border-radius: 15px;
        min-width: 110px;
        margin: 0 10px;
    }
}

.timer-label {
    font-size: 10px;
    color: #888;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.timer-value {
    font-size: clamp(16px, 4vw, 22px);
    font-weight: bold;
    color: #00ff88;

    font-family: 'Courier New', monospace;

    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
    letter-spacing: clamp(1px, 0.5vw, 2px);
}

@media (min-width: 400px) {
    .timer-value {
        font-size: 22px;
        letter-spacing: 2px;
    }
}

.header-buttons {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

@media (min-width: 400px) {
    .header-buttons {
        gap: 6px;
    }
}

.header-btn {
    width: clamp(32px, 8vw, 38px);
    height: clamp(32px, 8vw, 38px);
    border-radius: clamp(8px, 2vw, 10px);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 3.5vw, 16px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.header-btn:active {
    transform: scale(0.92);
}

.pause-btn {
    background: linear-gradient(180deg, #f39c12 0%, #d35400 100%);

    color: white;
    border: 2px solid #e67e22;
}

.restart-btn {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);

    color: white;
    border: 2px solid #2ecc71;
}

#freezeBtn {
    background: linear-gradient(180deg, #00c6ff 0%, #0072ff 100%);

    color: white;
    border: 2px solid #00c6ff;
}

#gameSettingsBtn {
    background: linear-gradient(180deg, #7f8c8d 0%, #2c3e50 100%);
    color: white;
    border: 2px solid #95a5a6;
}

.separator {
    display: none;
}

@media (min-width: 450px) {
    .separator {
        display: block;
    }
}

.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(10px, 2vh, 20px) clamp(5px, 2vw, 10px);
    width: 100%;
    min-height: 0;
}

@media (min-width: 768px) {
    .game-area {
        min-height: 400px;
        padding: 20px 0;
    }
}

.board-container {
    position: relative;
    perspective: 1000px;
    width: 100%;
    max-width: min(90vw, 90vmin, 550px);
    margin: 0 auto;
}

.game-board {
    position: relative;
    background: linear-gradient(145deg, #8b5a2b 0%, #6b4423 50%, #5c3a1d 100%);
    border-radius: clamp(12px, 3vw, 20px);
    padding: clamp(5px, 1.5vw, 12px);
    box-shadow:
        0 15px 30px rgba(0, 0, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.15),
        inset 0 -2px 0 rgba(0, 0, 0, 0.3);
    transform: rotateX(3deg);
    border: clamp(2px, 0.8vw, 4px) solid #a0724b;
    width: 100%;
    aspect-ratio: 1;
    max-height: 70dvh;
}

@media (min-width: 400px) {
    .game-board {
        padding: 12px;
        border-radius: 20px;
        border-width: 4px;
    }
}

.board-inner {
    background: linear-gradient(145deg, #d4a574 0%, #c4956a 50%, #b8896a 100%);
    border-radius: 8px;
    position: relative;
    overflow: visible;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
    height: 100%;
}

.grid {
    display: grid;
    gap: 2px;
    padding: 5px;
    width: 100%;
    height: 100%;
}

.cell {
    background: linear-gradient(145deg, #4d3319 0%, #3d2814 100%);
    border-radius: 4px;
    aspect-ratio: 1;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.gate {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.gate-top,
.gate-bottom {
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 24px;
    border-radius: 8px;
}

@media (min-width: 400px) {

    .gate-top,
    .gate-bottom {
        width: 70px;
        height: 28px;
        border-radius: 10px;
    }
}

.gate-top {
    top: -22px;
}

.gate-bottom {
    bottom: -22px;
}

.gate-left,
.gate-right {
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 60px;
    border-radius: 8px;
}

@media (min-width: 400px) {

    .gate-left,
    .gate-right {
        width: 28px;
        height: 70px;
        border-radius: 10px;
    }
}

.gate-left {
    left: -22px;
}

.gate-right {
    right: -22px;
}

.gate-arrow {
    font-size: 12px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}


.gate-green {
    background: linear-gradient(180deg, #00e676 0%, #00c853 100%);
    box-shadow: 0 3px 12px rgba(0, 230, 118, 0.4);
    border: 2px solid #69f0ae;
}

.gate-red {
    background: linear-gradient(180deg, #ff5252 0%, #f44336 100%);
    box-shadow: 0 3px 12px rgba(255, 82, 82, 0.4);
    border: 2px solid #ff8a80;
}

.gate-blue {
    background: linear-gradient(180deg, #448aff 0%, #2979ff 100%);
    box-shadow: 0 3px 12px rgba(68, 138, 255, 0.4);
    border: 2px solid #82b1ff;
}

.gate-yellow {
    background: linear-gradient(180deg, #ffea00 0%, #ffd600 100%);
    box-shadow: 0 3px 12px rgba(255, 234, 0, 0.4);
    border: 2px solid #ffff8d;
}

.gate-purple {
    background: linear-gradient(180deg, #e040fb 0%, #d500f9 100%);
    box-shadow: 0 3px 12px rgba(224, 64, 251, 0.4);
    border: 2px solid #ea80fc;
}

.gate-orange {
    background: linear-gradient(180deg, #ff9100 0%, #ff6d00 100%);
    box-shadow: 0 3px 12px rgba(255, 145, 0, 0.4);
    border: 2px solid #ffab40;
}


.tile {
    position: absolute;
    border-radius: 8px;
    cursor: grab;
    z-index: 10;
    transition: box-shadow 0.2s, transform 0.1s;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    /* Rich wooden texture base */
    background: linear-gradient(145deg, #a0724b 0%, #8b5a2b 100%);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    border: 1.5px solid #6b4423;
}

.tile::after {
    content: '';
    width: 40%;
    height: 40%;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.tile:active {
    cursor: grabbing;
}

.tile.dragging {
    z-index: 100;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5) !important;
    transform: scale(1.1) rotate(2deg);
}

.tile-green::after {
    background: radial-gradient(circle, #00ff88 0%, #00c853 100%);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.tile-red::after {
    background: radial-gradient(circle, #ff5252 0%, #d32f2f 100%);
    box-shadow: 0 0 15px rgba(255, 82, 82, 0.5);
}

.tile-blue::after {
    background: radial-gradient(circle, #448aff 0%, #1976d2 100%);
    box-shadow: 0 0 15px rgba(68, 138, 255, 0.5);
}

.tile-yellow::after {
    background: radial-gradient(circle, #ffea00 0%, #fbc02d 100%);
    box-shadow: 0 0 15px rgba(255, 234, 0, 0.5);
}

.tile-purple::after {
    background: radial-gradient(circle, #e040fb 0%, #9c27b0 100%);
    box-shadow: 0 0 15px rgba(224, 64, 251, 0.5);
}

.tile-orange::after {
    background: radial-gradient(circle, #ff9100 0%, #f57c00 100%);
    box-shadow: 0 0 15px rgba(255, 145, 0, 0.5);
}

.tile-green,
.tile-red,
.tile-blue,
.tile-yellow,
.tile-purple,
.tile-orange {
    background: linear-gradient(145deg, #a0724b 0%, #8b5a2b 100%) !important;
}


.bottom-controls {
    padding: 10px 0;
}

.ad-button {
    width: 100%;
    background: linear-gradient(180deg, #7c4dff 0%, #651fff 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.3);
    transition: transform 0.15s;
    border: 2px solid #b388ff;
}

.ad-button:active {
    transform: scale(0.97);
}

@media (min-width: 412px) {
    .bottom-controls {
        padding: 20px 0;
    }

    .ad-button {
        padding: 15px 30px;
        font-size: 16px;
    }
}

.popup-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;
    backdrop-filter: blur(5px);
    padding: 20px;
}

.popup-overlay.active {
    display: flex;
}


.popup {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: clamp(25px, 5vw, 40px);
    text-align: center;
    width: 95%;
    max-width: 600px;
    /* Increased from 480px */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-height: 95dvh;
    box-shadow:
        0 40px 100px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    border: none;
    position: relative;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.popup-overlay.active .popup {
    transform: scale(1);
    opacity: 1;
}

.popup-banner-ad {
    width: 100%;
    min-height: 120px;
    margin-top: 25px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.popup-banner-ad>* {
    max-width: 100%;
    height: auto !important;
}


.popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: rotate(30deg);
    pointer-events: none;
}

.popup-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 5px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.popup-title.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 38px;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 10px rgba(46, 204, 113, 0.3));
}

.popup-title.fail {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 38px;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 10px rgba(231, 76, 60, 0.3));
}

.popup-score {
    font-size: 24px;
    color: #2d3436;
    margin-bottom: 25px;
    background: #f8f9fa;
    padding: 12px 25px;
    border-radius: 15px;
    display: inline-block;
    border: 1px solid #dfe6e9;
    font-weight: 600;
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.popup-btn {
    padding: 15px 25px;
    border-radius: 15px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.popup-btn:active {
    transform: translateY(1px);
}

.popup-btn.primary {
    background: linear-gradient(90deg, #00b09b 0%, #96c93d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 176, 155, 0.4);
}

.popup-btn.secondary {
    background: #f1f2f6;
    color: #2d3436;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #dfe6e9;
}

.popup-btn.secondary:hover {
    background: #e1e2e6;
}

.popup-btn.ad {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    width: 100%;
    margin-top: 10px;
    height: 50px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: adPulse 2s infinite;
}

.popup-btn.ad:hover {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

@keyframes adPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 4px 25px rgba(108, 92, 231, 0.5);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    }
}

.popup-btn.primary,
.popup-btn.secondary {
    width: 100%;
    margin-bottom: 5px;
}


.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(5px);
}

.pause-overlay.active {
    display: flex;
}

.pause-text {
    font-size: 48px;
    color: #2d3436;
    font-weight: 800;
    letter-spacing: 2px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    animation: pausePulse 1.5s ease-in-out infinite;
}

@keyframes pausePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes tileDestroy {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }

    30% {
        transform: scale(1.3) rotate(10deg);
    }

    100% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
}

.tile.destroying {
    animation: tileDestroy 0.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 200;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

.gate.glow {
    animation: gateGlow 0.3s ease-out;
}

@keyframes gateGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.5);
    }
}

.paused .tile,
.paused .particle {
    animation-play-state: paused !important;
}

.score-display {
    text-align: center;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #a8c0e8;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@media (max-width: 320px) {
    .level-badge {
        width: 45px;
        height: 45px;
    }

    .level-number {
        font-size: 18px;
    }

    .timer-value {
        font-size: 16px;
    }

    .header-btn {
        width: 35px;
        height: 35px;
    }

    .gate-top,
    .gate-bottom {
        width: 50px;
        height: 20px;
    }

    .gate-left,
    .gate-right {
        width: 20px;
        height: 50px;
    }

    .gate-top {
        top: -18px;
    }

    .gate-bottom {
        bottom: -18px;
    }

    .gate-left {
        left: -18px;
    }

    .gate-right {
        right: -18px;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .game-container {
        flex-direction: row;
        gap: 10px;
    }

    .header {
        flex-direction: column;
        width: 100px;
        height: 100%;
        padding: 10px;
        margin-bottom: 0;
        margin-right: 10px;
    }

    .level-badge {
        width: 50px;
        height: 50px;
    }

    .timer-container {
        min-width: auto;
        padding: 5px 10px;
    }

    .header-buttons {
        flex-direction: column;
        width: 100%;
    }

    .header-btn {
        width: 100%;
    }

    .game-area {
        flex: 1;
        padding: 5px 0;
    }

    .bottom-controls {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .game-container {
        max-width: 600px;
    }

    .game-board {
        max-width: 450px;
        max-height: 450px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .tile {
        cursor: pointer;
    }

    .tile:active {
        transform: scale(0.95);
    }

    .header-btn:active,
    .ad-button:active,
    .popup-btn:active,
    .nav-btn:active,
    .quick-btn:active {
        transform: scale(0.95);
    }
}

@media (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}





.header-btn i,
.nav-btn i,
.start-btn i,
.popup-btn i,
.control-icon-btn i,
.ad-button i {
    color: inherit;
    pointer-events: none;
}

.gate-arrow i {
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.highlight-icon i {
    color: #ffd700;

    font-size: 24px;
}

.start-btn i {
    margin-right: 8px;

}

.popup-btn i {
    margin-right: 5px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.setting-item span {
    font-weight: bold;
    color: #333;
    font-size: 1.1rem;
}

.setting-item.danger-zone {
    margin-top: 20px;
    background: rgba(231, 76, 60, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.danger-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.danger-btn:hover {
    background: #c0392b;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2ecc71;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2ecc71;
}

input:checked+.slider:before {
    -webkit-transform: translateX(22px);
    -ms-transform: translateX(22px);
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

:root {

    --site-padding: clamp(10px, 3vw, 30px);
    --header-height: clamp(60px, 8vh, 80px);
    --board-size: min(90vw, 70vh, 500px);

    --font-dynamic: clamp(14px, 1.2vw + 10px, 18px);
}


body {
    padding: 0 !important;
    margin: 0 !important;
    min-height: 100dvh;
    overflow-x: hidden;
}

body,
html {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.start-screen,
.game-container {
    width: 100%;
    min-height: 100dvh;
    padding: 0 !important;
    overflow-x: hidden;
}

.main-content {
    padding: var(--site-padding) !important;
    padding-left: max(var(--site-padding), env(safe-area-inset-left)) !important;
    padding-right: max(var(--site-padding), env(safe-area-inset-right)) !important;
    padding-bottom: max(var(--site-padding), env(safe-area-inset-bottom)) !important;
}

.game-header {
    width: 100% !important;
    padding-top: max(10px, env(safe-area-inset-top)) !important;
    padding-bottom: 12px !important;
    padding-left: max(var(--site-padding), env(safe-area-inset-left)) !important;
    padding-right: max(var(--site-padding), env(safe-area-inset-right)) !important;
    height: auto !important;
    background: #ffffff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

.header-container {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    gap: 10px !important;
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 1.1rem !important;
    }

    .logo .dots {
        transform: scale(0.7);
        gap: 3px;
    }

    .nav-btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }

    .nav-btn span {
        display: none;
    }

}

.hero-section {
    display: flex !important;
    flex-direction: column !important;
    gap: clamp(15px, 3vh, 40px) !important;
    margin: clamp(15px, 4vh, 60px) 0 !important;
    align-items: center !important;
}

@media (min-width: 992px) {
    .hero-section {
        flex-direction: row !important;
        text-align: left !important;
    }

    .game-title,
    .tagline {
        text-align: left !important;
    }
}

.game-title {
    font-size: clamp(2rem, 6vw, 4rem) !important;
    line-height: 1.1 !important;
}

.game-highlights {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 400px;
}

@media (min-width: 600px) {
    .game-highlights {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
        max-width: none;
    }
}

.game-container {
    max-width: 800px !important;
    margin: 0 auto !important;
    height: 100dvh !important;
    display: none;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom)) !important;
}

.game-container.active {
    display: flex !important;
}

.header {
    width: 100% !important;
    padding-top: max(10px, env(safe-area-inset-top)) !important;
    padding-left: max(var(--site-padding), env(safe-area-inset-left)) !important;
    padding-right: max(var(--site-padding), env(safe-area-inset-right)) !important;
    margin-bottom: 10px !important;
}

.game-area {
    flex: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px var(--site-padding) !important;
    padding-left: max(var(--site-padding), env(safe-area-inset-left)) !important;
    padding-right: max(var(--site-padding), env(safe-area-inset-right)) !important;
    min-height: 0 !important;
}

.board-container {
    width: var(--board-size) !important;
    height: var(--board-size) !important;
    max-width: none !important;
    margin: 0 auto !important;
}

.game-board {
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    padding: clamp(5px, 1.5vmin, 15px) !important;
}

/* --- Header & HUD in Game --- */
.header {
    width: 100% !important;
    padding: 10px !important;
    margin-bottom: 5px !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.level-badge {
    width: clamp(45px, 10vmin, 65px) !important;
    height: clamp(45px, 10vmin, 65px) !important;
}

.timer-container {
    flex: 0 1 auto !important;
    min-width: clamp(80px, 15vw, 120px) !important;
    padding: 8px !important;
}

/* --- Popups & Modals --- */
/* Popups are now managed by the main .popup class */

/* --- Tablet & Desktop Overrides --- */
@media (min-width: 768px) {
    .level-select {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)) !important;
    }

    .level-btn {
        max-width: 70px !important;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        flex-direction: row !important;
        margin: 10px 0 !important;
    }

    .game-preview {
        width: 40vh !important;
        height: 40vh !important;
    }

    .game-container {
        padding: 5px !important;
    }
}

/* Targetting specific user requested resolutions */
/* 768x1024, 820x1180, 912x1368 (Tablets) */
@media (min-width: 760px) and (max-width: 950px) {
    .main-content {
        padding: 40px !important;
    }

    .game-title {
        font-size: 3.5rem !important;
    }

    .hero-section {
        gap: 40px !important;
    }
}

/* 344x812 (Mini/Long Phones), Pixel 7 (412x915), iPhone 12/13/14/15 Pro Max (428-430px) */
@media (max-width: 450px) {
    .logo-text {
        font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
    }

    .nav-btn {
        padding: 6px 12px !important;
    }

    .game-title {
        font-size: clamp(1.6rem, 8vw, 2.2rem) !important;
    }

    .tagline {
        font-size: clamp(0.9rem, 4vw, 1.1rem) !important;
    }

    .hero-section {
        margin: 10px 0 !important;
        gap: 20px !important;
    }

    .game-preview {
        width: min(80vw, 300px) !important;
        height: min(80vw, 300px) !important;
        margin: 10px auto !important;
    }

    .highlight-card {
        padding: 12px !important;
    }

    .highlight-icon {
        font-size: 1.8rem !important;
        margin-bottom: 5px !important;
    }

    .highlight-text h3 {
        font-size: 1rem !important;
    }

    .highlight-text p {
        font-size: 0.85rem !important;
    }
}

/* iPhone SE (320x568) & Ultra-Small Phones */
@media (max-width: 330px) {
    .logo-text {
        font-size: 0.85rem !important;
    }

    .nav-btn {
        padding: 6px 8px !important;
    }

    .game-title {
        font-size: 1.5rem !important;
    }

    .tagline {
        font-size: 0.9rem !important;
    }

    .game-preview {
        width: 250px !important;
        height: 250px !important;
    }

    .level-select {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr)) !important;
        gap: 8px !important;
    }

    .level-btn {
        border-radius: 8px !important;
    }

    /* HUD Fix for narrow screens */
    .timer-container {
        min-width: 70px !important;
        padding: 5px !important;
    }

    .timer-value {
        font-size: 14px !important;
    }

    .timer-label {
        font-size: 10px !important;
    }

    .level-badge {
        width: 40px !important;
        height: 40px !important;
    }

    .level-number {
        font-size: 16px !important;
    }

    .level-text {
        font-size: 9px !important;
    }

    .header-btn {
        width: 32px !important;
        height: 32px !important;
    }
}
/* Side Ads Styling */
.side-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: 600px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
}

.left-side-ad {
    left: 20px;
}

.right-side-ad {
    right: 20px;
}

/* Show only when game is active */
.game-active .side-ad {
    display: flex;
}

/* Responsive Hide on Small Screens */
@media (max-width: 1100px) {
    .side-ad {
        width: 120px;
        height: 480px;
        left: 5px;
        right: 5px;
    }
}

@media (max-width: 950px) {
    .side-ad {
        display: none !important;
    }
}

