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

body {
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gameTitle {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #f1c40f;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 
        0 0 10px rgba(241, 196, 15, 0.8),
        0 0 20px rgba(241, 196, 15, 0.4),
        0 0 30px rgba(241, 196, 15, 0.2);
    z-index: 100;
    font-family: 'Monaco', 'Consolas', monospace;
    pointer-events: none;
    white-space: nowrap;
}

#canvas3d {
    display: block;
    width: 100%;
    height: 100%;
}

#webcamContainer {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 312px;
    height: 234px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror the webcam */
}

#webcamOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


#gesture {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#gestureText {
    display: block;
    font-size: 72px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(22, 199, 154, 0.8), 0 0 40px rgba(22, 199, 154, 0.4);
    text-transform: uppercase;
    letter-spacing: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#gestureText.visible {
    opacity: 1;
}

#gazeCursor {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #e94560;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow:
        0 0 10px rgba(233, 69, 96, 0.6),
        0 0 20px rgba(233, 69, 96, 0.3),
        inset 0 0 10px rgba(233, 69, 96, 0.2);
}

#gazeCursor::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: #e94560;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

#gazeCursor.visible {
    opacity: 1;
}

/* Game UI Styles */
#gameUI {
    position: absolute;
    top: 20px;
    right: 20px;
    text-align: right;
}

#lives {
    font-size: 24px;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

#score {
    background: rgba(0, 0, 0, 0.7);
    color: #f39c12;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 24px;
    font-weight: bold;
    font-family: 'Monaco', 'Consolas', monospace;
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 60px 80px;
    border-radius: 16px;
    text-align: center;
    display: none;
    border: 2px solid #e94560;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.4);
}

#gameOver h1 {
    color: #e94560;
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(233, 69, 96, 0.6);
}

#gameOver p {
    color: #fff;
    font-size: 24px;
    margin-bottom: 30px;
}

#restartBtn {
    background: #16c79a;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

#restartBtn:hover {
    background: #1dd1a1;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(22, 199, 154, 0.5);
}

/* Newsletter Section */
#newsletterSection {
    margin: 30px 0;
    padding: 20px;
    background: rgba(241, 196, 15, 0.1);
    border: 1px solid rgba(241, 196, 15, 0.4);
    border-radius: 10px;
}

.newsletter-cta {
    color: #f1c40f;
    font-size: 16px;
    margin-bottom: 8px;
}

.newsletter-title {
    color: #fff;
    font-size: 18px;
    margin-bottom: 15px;
}

.newsletter-title strong {
    color: #2ecc71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

#newsletterForm {
    display: flex;
    gap: 10px;
    justify-content: center;
}

#emailInput {
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #f1c40f;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 250px;
    font-family: inherit;
    transition: all 0.3s ease;
}

#emailInput:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
    border-color: #f7dc6f;
}

#emailInput::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#subscribeBtn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    background: #f1c40f;
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#subscribeBtn:hover {
    background: #f7dc6f;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.5);
}

#subscribeBtn:disabled {
    background: #888;
    cursor: not-allowed;
    transform: none;
}

#subscribeMessage {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

#subscribeMessage.success {
    color: #2ecc71;
}

#subscribeMessage.error {
    color: #e74c3c;
}

/* Start Screen */
#startScreen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 60px 80px;
    border-radius: 16px;
    text-align: center;
    border: 2px solid #f1c40f;
    box-shadow: 0 0 40px rgba(241, 196, 15, 0.4);
    z-index: 1000;
}

#startScreen.hidden {
    display: none;
}

#startScreen h1 {
    color: #f1c40f;
    font-size: 36px;
    margin-bottom: 30px;
    text-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
    letter-spacing: 2px;
}

.start-instructions {
    margin-bottom: 30px;
}

.start-instructions p {
    color: #fff;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: left;
}

.start-instructions strong {
    color: #2ecc71;
}

#startBtn {
    background: #f1c40f;
    color: #000;
    border: none;
    padding: 15px 50px;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#startBtn:hover {
    background: #f7dc6f;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
}

#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    color: rgba(255, 255, 255, 0.3);
    pointer-events: none;
    font-weight: 100;
}

#flashOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease-out;
}

#flashOverlay.flash {
    opacity: 0.8;
}

/* YouTube Callout */
#youtubeCallout {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #f1c40f;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    color: #f1c40f;
    font-family: 'Monaco', 'Consolas', monospace;
    text-align: center;
    z-index: 100;
    box-shadow: 
        0 0 20px rgba(241, 196, 15, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
}

#youtubeCallout a {
    color: #2ecc71;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.6);
}

#youtubeCallout a:hover {
    color: #58d68d;
    text-shadow: 0 0 20px rgba(46, 204, 113, 0.8);
}

/* ============================================
   HUD Panel - Yellow/Green Style Guide
   ============================================ */

#hudPanel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #f1c40f;
    border-radius: 12px;
    padding: 15px 20px;
    min-width: 220px;
    font-family: 'Monaco', 'Consolas', monospace;
    box-shadow: 
        0 0 20px rgba(241, 196, 15, 0.3),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.hud-title {
    color: #f1c40f;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(241, 196, 15, 0.4);
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
}

.hud-item {
    margin-bottom: 12px;
}

.hud-item:last-child {
    margin-bottom: 0;
}

.hud-label {
    color: #2ecc71;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 6px;
    text-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

.bar-container {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
    position: relative;
}

/* Shield bar - Green gradient */
.shield-bar .bar-fill {
    background: linear-gradient(90deg, #27ae60, #2ecc71, #58d68d);
    box-shadow: 
        0 0 10px rgba(46, 204, 113, 0.6),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Shield bar warning state */
.shield-bar.warning .bar-fill {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    box-shadow: 
        0 0 10px rgba(231, 76, 60, 0.6),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    animation: pulse-warning 0.5s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Photon bar - Yellow gradient */
.photon-bar .bar-fill {
    background: linear-gradient(90deg, #f39c12, #f1c40f, #f7dc6f);
    box-shadow: 
        0 0 10px rgba(241, 196, 15, 0.6),
        inset 0 -2px 4px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Photon bar ready state */
.photon-bar.ready .bar-fill {
    animation: pulse-ready 1s ease-in-out infinite;
}

@keyframes pulse-ready {
    0%, 100% { 
        box-shadow: 
            0 0 10px rgba(241, 196, 15, 0.6),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.2);
    }
    50% { 
        box-shadow: 
            0 0 20px rgba(241, 196, 15, 0.9),
            0 0 30px rgba(241, 196, 15, 0.4),
            inset 0 -2px 4px rgba(0, 0, 0, 0.3),
            inset 0 2px 4px rgba(255, 255, 255, 0.2);
    }
}

.bar-percent {
    color: #f1c40f;
    font-size: 11px;
    font-weight: bold;
    text-align: right;
    margin-top: 4px;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.5);
}

.hud-button {
    width: 100%;
    background: rgba(241, 196, 15, 0.2);
    border: 2px solid #f1c40f;
    border-radius: 8px;
    color: #f1c40f;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 6px 10px;
    cursor: pointer;
    font-family: 'Monaco', 'Consolas', monospace;
    transition: all 0.3s ease;
    text-shadow: 0 0 5px rgba(241, 196, 15, 0.6);
    box-shadow: 
        0 0 5px rgba(241, 196, 15, 0.3),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.hud-button:hover {
    background: rgba(241, 196, 15, 0.3);
    box-shadow: 
        0 0 20px rgba(241, 196, 15, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
    transform: scale(1.02);
}

.hud-button.muted {
    color: #e74c3c;
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.6);
    box-shadow: 
        0 0 10px rgba(231, 76, 60, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Scanline effect on HUD */
#hudPanel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    border-radius: 10px;
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

@media (max-width: 768px) {
    /* Game Title - Smaller and allow wrapping */
    #gameTitle {
        font-size: 12px;
        letter-spacing: 1px;
        top: 10px;
        padding: 0 10px;
        white-space: normal;
        text-align: center;
        max-width: 90%;
    }
    
    /* Webcam Container - Much smaller, top right */
    #webcamContainer {
        width: 160px;
        height: 120px;
        bottom: auto;
        top: 50px;
        right: 10px;
    }
    
    /* HUD Panel - Compact horizontal layout at bottom */
    #hudPanel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        min-width: unset;
        padding: 10px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .hud-title {
        width: 100%;
        font-size: 12px;
        margin-bottom: 5px;
        padding-bottom: 5px;
    }
    
    .hud-item {
        flex: 1;
        min-width: 100px;
        margin-bottom: 0;
    }
    
    .hud-label {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    .bar-container {
        height: 12px;
    }
    
    .bar-percent {
        font-size: 9px;
        margin-top: 2px;
    }
    
    .hud-button {
        font-size: 9px;
        padding: 4px 8px;
    }
    
    /* Score - Smaller, top left */
    #score {
        padding: 6px 12px;
        font-size: 16px;
        top: 10px;
        left: 10px;
    }
    
    #gameUI {
        top: 10px;
        right: auto;
        left: 10px;
    }
    
    /* YouTube Callout - Hidden on mobile */
    #youtubeCallout {
        display: none;
    }
    
    /* Start Screen - Less padding, smaller text */
    #startScreen {
        padding: 30px 15px;
        max-width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #startScreen h1 {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .start-instructions p {
        font-size: 14px;
        margin-bottom: 10px;
    }
    
    #startBtn {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    /* Game Over Screen - Responsive */
    #gameOver {
        padding: 30px 20px;
        max-width: 90%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    #gameOver h1 {
        font-size: 32px;
        margin-bottom: 15px;
    }
    
    #gameOver p {
        font-size: 18px;
        margin-bottom: 20px;
    }
    
    /* Newsletter Section - Stack vertically */
    #newsletterSection {
        padding: 15px;
        margin: 20px 0;
    }
    
    .newsletter-cta {
        font-size: 14px;
    }
    
    .newsletter-title {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    #newsletterForm {
        flex-direction: column;
        gap: 8px;
    }
    
    #emailInput {
        width: 100%;
        font-size: 14px;
        padding: 10px 12px;
    }
    
    #subscribeBtn {
        width: 100%;
        font-size: 14px;
        padding: 10px 20px;
    }
    
    #restartBtn {
        padding: 12px 30px;
        font-size: 16px;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    #gameTitle {
        font-size: 10px;
    }
    
    #webcamContainer {
        width: 120px;
        height: 90px;
    }
    
    #startScreen h1,
    #gameOver h1 {
        font-size: 20px;
    }
    
    .start-instructions p {
        font-size: 12px;
    }
}
