/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
}

/* Main container */
#renderDiv {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #111;
}

/* Webcam video */
#webcam-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror view for intuitive control */
    z-index: 0;
}

/* Speech bubble */
#speech-bubble {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    padding: 15px 25px;
    background-color: rgba(255, 255, 255, 0.9);
    border: 2px solid #007bff;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #333;
    font-size: clamp(16px, 3vw, 22px);
    max-width: 80%;
    text-align: center;
    z-index: 25;
    opacity: 0.7;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease-in-out;
    pointer-events: none;
}

/* Canvas overlay (will be positioned by Three.js) */
canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important;
}

/* Speech bubble states */
.speech-bubble-active {
    opacity: 1 !important;
    transform: translateX(-50%) translateY(0px) !important;
}

.speech-bubble-interim {
    color: #888 !important;
    font-style: italic !important;
}

#game-title {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 100;
    text-align: center;
    background-color: white;
    padding: 8px;
    max-width: 150px;
    opacity: 0.8;
}

#icon {
    margin-top: 5px;
    width: 50px;
}

#hot-dog-box {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(40, 167, 69, 0.5);
    color: white;
    border: 3px dotted #28a745;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 30;
    user-select: none;
    pointer-events: none;
}

#not-hot-dog-box {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(220, 53, 69, 0.5);
    color: white;
    border: 3px dotted #dc3545;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 30;
    user-select: none;
    pointer-events: none;
}

/* Game Over Overlay */
#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*
    background: linear-gradient(135deg, 
        rgba(0, 0, 0, 0.8) 0%, 
        rgba(20, 20, 40, 0.9) 50%, 
        rgba(0, 0, 0, 0.8) 100%);
    */
    /* background-color:rgba(0, 0, 0, 0.3); */
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* opacity: 0.8; */
    visibility: visible;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
}

#game-over-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

#game-over-content {
    text-align: center;
    /*
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.1) 100%);
    */
    background-color: white;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* border-radius: 20px; */
    padding: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 400px;
    color: rgb(0, 0, 0);
    animation: slideInUp 0.6s ease-out;
    opacity: 1.0;
}

#game-over-content h1 {
    font-size: clamp(28px, 5vw, 48px);
    margin-bottom: 20px;
    /* background: linear-gradient(135deg, #00ff88, #00ccff); */
    /* -webkit-background-clip: text; */
    /* -webkit-text-fill-color: transparent; */
    /* background-clip: text; */
    font-weight: bold;
    /* text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); */
}

#game-over-content p {
    font-size: clamp(16px, 3vw, 20px);
    margin-bottom: 15px;
    line-height: 1.2;
    color: rgba(0, 0, 0, 0.9);
}

#game-over-image {
    width: 95%;
}

#restart-button {
    margin-top: 5px;
    padding: 15px 30px;
    font-size: clamp(16px, 3vw, 20px);
    font-weight: bold;
    color: white;
    background-color: blue;
    /* background: linear-gradient(135deg, #007bff, #0056b3); */
    border: none;
    /* border-radius: 50px; */
    cursor: pointer;
    transition: all 0.3s ease;
    /* box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3); */
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

#restart-button:hover {
    background-color: rgb(0, 136, 255);
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(0, 123, 255, 0.4);
}

#restart-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.3);
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-box {
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.9);
    color: black;
    font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
    border: 2px solid black;
    box-shadow: 3px 3px 0px black;
    font-size: clamp(13px, 2vw, 15px);
    text-align: center;
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    max-width: 90%;
    box-sizing: border-box;
    /* border-radius: 6px; */
}

#logo-container {
    position: absolute;
    bottom: 5px;
    left: 5px;
}

#social-links {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

#title-box {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 1.6em;
    max-width: 300px;
    font-weight: bold;
}

a {
    color: #0000ff !important;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

#logo {
    font-size: clamp(1.5em, 4vw, 2em);
}

.image-cell {
    width: 60px;
    border-bottom: 1px solid rgb(143, 143, 255);
    margin: 5px;
}

#link-table {
    margin: 0 auto;
    text-align: center;
}