/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #E0EAFC 0%, #CFDEF3 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #2D3748;
}

.layout-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    flex: 1;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

/* Ad Sidebars */
.ad-sidebar {
    width: 160px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ad-sidebar.left {
    margin-right: 10px;
}

.ad-sidebar.right {
    margin-left: 10px;
}

/* Header */
header {
    background: white;
    padding: 30px;
    border-radius: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(142, 197, 252, 0.5);
    text-align: center;
    border: 4px solid white;
}

.header-content h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: #6B46C1;
    font-weight: 800;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.2em;
    color: #805AD5;
    font-weight: 500;
}

/* Screen Management */
.screen {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid white;
    backdrop-filter: blur(10px);
}

.screen.active {
    display: block;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Welcome/Start Screen */
.welcome-content {
    text-align: center;
}

.welcome-icon {
    font-size: 5em;
    margin-bottom: 10px;
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(20deg);
    }

    75% {
        transform: rotate(-20deg);
    }
}

.welcome-content h2 {
    color: #2D3748;
    font-size: 2.2em;
    margin-bottom: 15px;
    font-weight: 800;
}

.welcome-description {
    font-size: 1.2em;
    color: #718096;
    margin-bottom: 40px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.feature-card {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
    border: 2px solid #E2E8F0;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.feature-card h4 {
    color: #4A5568;
    margin-bottom: 5px;
}

.feature-card p {
    color: #718096;
    font-size: 0.9em;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(118, 75, 162, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(118, 75, 162, 0.4);
}

.btn-ghost {
    background: linear-gradient(135deg, #9F7AEA 0%, #667EEA 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
    width: 100%;
    max-width: 300px;
}

.btn-ghost:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.4);
    filter: brightness(1.1);
}

/* Game Arena */
#game-arena {
    padding: 0;
    /* Remove padding for full canvas feel */
    overflow: hidden;
    height: 85vh;
    /* Increased height */
    background: linear-gradient(to bottom, #1a202c, #2d3748);
    position: relative;
    cursor: crosshair;
}

.arena-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.health-container {
    width: 200px;
}

.health-bar-bg {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.health-bar {
    height: 100%;
    background: linear-gradient(90deg, #48BB78, #38B2AC);
    transition: width 0.3s ease, background 0.3s ease;
}

.health-bar.low {
    background: linear-gradient(90deg, #E53E3E, #C53030);
    animation: pulseRed 0.5s infinite;
}

.health-text {
    font-size: 0.8em;
    font-weight: 700;
    margin-top: 5px;
    display: block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    color: white;
}

.level-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.level-label {
    display: block;
    font-size: 0.7em;
    text-transform: uppercase;
    opacity: 0.8;
    color: white;
}

.level-value {
    font-size: 1.5em;
    font-weight: 800;
    color: #F6AD55;
}

.ghost-question-container {
    position: absolute;
    top: 150px;
    left: 0;
    right: 0;
    text-align: center;
    padding: 0 20px;
    z-index: 5;
}

#ghost-question-text {
    font-size: 1.4em;
    color: #E2E8F0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.4);
    display: inline-block;
    padding: 10px 20px;
    border-radius: 15px;
}

.ghosts-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.ghost {
    position: absolute;
    width: 120px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px 15px 50% 50%;
    text-align: center;
    color: #2D3748;
    font-weight: 700;
    font-size: 0.9em;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
    border: 2px solid transparent;
}

.ghost:hover {
    transform: scale(1.1);
    z-index: 10;
    border-color: #667EEA;
}

.ghost::before {
    content: '👻';
    display: block;
    font-size: 2em;
    margin-bottom: 5px;
}

.health-pack {
    position: absolute;
    font-size: 3em;
    cursor: pointer;
    z-index: 20;
    /* Above ghosts */
    filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5));
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
}

.health-pack:hover {
    transform: scale(1.2);
}

.health-pack.collected {
    transform: scale(1.5);
    opacity: 0;
}

.ghost.hit {
    transform: scale(1.5);
    opacity: 0;
    background: #48BB78;
}

.ghost.wrong {
    background: #F56565;
    animation: shake 0.4s;
}

/* Visual Effects */
.laser-beam {
    position: absolute;
    height: 4px;
    background: #4FD1C5;
    box-shadow: 0 0 10px #4FD1C5, 0 0 20px #4FD1C5;
    transform-origin: left center;
    z-index: 15;
    pointer-events: none;
    opacity: 0.8;
    border-radius: 2px;
}

.green-goo {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #48BB78;
    border-radius: 50%;
    box-shadow: 0 0 10px #48BB78;
    z-index: 15;
    pointer-events: none;
}

.firework-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ECC94B;
    /* Yellow */
    border-radius: 50%;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 0 10px #ECC94B;
}

.player-base {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.player-cannon {
    font-size: 3em;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

@keyframes pulseRed {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Footer Ad */
.footer-ad {
    background: white;
    padding: 20px;
    text-align: center;
    border-top: 1px solid #E2E8F0;
    margin-top: auto;
}

.ad-container {
    display: inline-block;
    min-height: 90px;
    background: #f0f0f0;
}

/* Responsive */
@media (max-width: 1100px) {
    .ad-sidebar {
        display: none;
    }

    .layout-wrapper {
        padding: 10px;
    }
}