@import url('https://fonts.googleapis.com/css2?family=Bangers:wght@400&family=Fredoka+One:wght@400');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

body {
    font-family: 'Fredoka One', 'Comic Sans MS', cursive, sans-serif;
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: black;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.main-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    font-family: 'Bangers', cursive;
}

.loading-content {
    text-align: center;
    color: white;
    position: absolute;
    top: 15vh;
}

@media screen and (max-width: 768px) {
    .loading-content {
        top: 5vh;
    }
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #ff6b6b;
    border-top: 4px solid #feca57;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #ff6b6b;
    text-shadow: 3px 3px 0px #feca57;
}

.loading-status {
    font-size: 16px;
    color: #fff;
}

.instructions {
    font-size: 24px;
    line-height: 1.6;
    max-width: 500px;
    text-align: center;
    margin-top: 20px;
    color: #555;
}

.loading-screen.hidden {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 50;
}

#mediapipeVideoContainer,
#mediapipeGazeDot {
    display: none !important;
}

.background-gif {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
    object-fit: cover;
}

.background-gif.show {
    opacity: 1;
}

.focus-dot {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: #feca57;
    border-radius: 50%;
    border: 8px solid #ff6b6b;
    box-shadow: 0 0 50px rgba(254, 202, 87, 0.8);
    z-index: 70;
    /* Higher than GIF to stay in front */
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bangers', cursive;
    font-size: 3rem;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 3px 3px 0px #000;
}

.disappointment-text {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #ff6b6b;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    z-index: 15;
    border: 3px solid #ff6b6b;
    text-shadow: 2px 2px 0px #000;
    font-family: 'Bangers', cursive;
    animation: textBounce 0.6s ease-in-out;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.disappointment-text.show {
    opacity: 1;
}


.controls-panel {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 20;
}

.btn {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border: 3px solid #000;
    padding: 15px 25px;
    border-radius: 25px;
    color: #000;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    text-shadow: 1px 1px 0px #fff;
    box-shadow: 0 4px 0px #000;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0px #000;
}

.btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0px #000;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.button-container {
    position: fixed;
    top: 70%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
    z-index: 80;
}

.try-again-btn {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    border: 3px solid #000;
    padding: 20px 40px;
    border-radius: 30px;
    color: #000;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    text-shadow: 1px 1px 0px #fff;
    box-shadow: 0 6px 0px #000;
}

.try-again-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0px #000;
}

.try-again-btn:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0px #000;
}

.register-btn {
    background: linear-gradient(45deg, #feca57, #ff6b6b);
    color: #000;
    border: 3px solid #000;
    padding: 20px 40px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    text-shadow: 1px 1px 0px #fff;
    box-shadow: 0 6px 0px #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.register-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 0px #000;
}

.register-btn:active {
    transform: translateY(3px);
    box-shadow: 0 3px 0px #000;
}

.leaderboard-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: #000;
    border: 3px solid #000;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    text-shadow: 1px 1px 0px #fff;
    box-shadow: 0 4px 0px #000;
    z-index: 80;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0px #000;
}

.leaderboard-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0px #000;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    border: 4px solid #ff6b6b;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    font-family: 'Bangers', cursive;
    color: #ff6b6b;
    text-shadow: 2px 2px 0px #feca57;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.modal-content p {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.modal-content input {
    width: 100%;
    padding: 15px;
    border: 3px solid #ff6b6b;
    border-radius: 10px;
    font-size: 1.1rem;
    font-family: 'Fredoka One', cursive;
    margin-bottom: 20px;
    text-align: center;
}

.modal-content input:focus {
    outline: none;
    border-color: #feca57;
    box-shadow: 0 0 10px rgba(254, 202, 87, 0.3);
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-buttons button {
    padding: 12px 24px;
    border: 3px solid #000;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Bangers', cursive;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-buttons button[type="button"] {
    background: #ccc;
    color: #333;
}

.modal-buttons button[type="submit"] {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: #000;
}

.modal-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#mediapipeVideoContainer {
    position: fixed !important;
    top: 20px !important;
    left: 20px !important;
    width: 400px !important;
    height: 300px !important;
    z-index: 10 !important;
    border: 3px solid #ff6b6b !important;
    border-radius: 15px !important;
    overflow: hidden !important;
}

#mediapipeVideoContainer video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#mediapipeVideoContainer canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
}

.camera-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #fff;
    font-size: 12px;
    text-align: center;
    padding: 10px;
}

.debug-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.debug-info {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #ff6b6b;
    font-family: 'Bangers', cursive;
    font-size: 12px;
    line-height: 1.4;
    z-index: 20;
}

.landmark-point {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #00ff00;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.eye-landmark {
    background: #ff0000;
}

.gaze-indicator {
    position: absolute;
    width: 15px;
    height: 15px;
    border: 2px solid #00ff00;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1s infinite;
}

.gaze-indicator.looking-away {
    border-color: #ff0000;
}

@keyframes focusPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px #ff6b6b;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.3);
        box-shadow: 0 0 50px #ff6b6b;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 30px #ff6b6b;
    }
}

@keyframes textBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translate(-50%, -50%) translateY(0);
    }

    40% {
        transform: translate(-50%, -50%) translateY(-10px);
    }

    60% {
        transform: translate(-50%, -50%) translateY(-5px);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

@media (max-width: 768px) {
    .stats-panel {
        top: 10px;
        right: 10px;
        padding: 15px;
        min-width: 150px;
    }

    .controls-panel {
        bottom: 10px;
        flex-direction: column;
        align-items: center;
    }

    .camera-container {
        top: 10px;
        left: 10px;
        width: 150px;
        height: 100px;
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {

    body::before,
    body::after {
        display: none !important;
    }

    .focus-dot {
        width: 180px;
        height: 180px;
        font-size: 2.8rem;
        padding: 10px;
        box-sizing: border-box;
    }

    .button-container {
        gap: 10px;
    }

    .try-again-btn {
        flex-shrink: 0;
        padding: 15px 25px;
        font-size: 1rem;
    }

    .register-btn {
        flex-shrink: 0;
        padding: 15px 25px;
        font-size: 1rem;
    }

    .loading-text {
        font-size: 28px;
    }

    .instructions {
        font-size: 18px;
        max-width: 350px;
    }

    /* Ensure countdown timer is visible when countdown starts */
    #countdownTimer {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 180px;
        height: 180px;
        font-size: 2.8rem;
        padding: 10px;
        box-sizing: border-box;
        text-align: center;
        line-height: 1;
        overflow: visible;
    }

    /* Hide any explosion images on mobile */
    [style*="explosion"],
    [src*="explosion"] {
        display: none !important;
    }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
    .focus-dot {
        width: 160px;
        height: 160px;
        font-size: 2.5rem;
        padding: 8px;
    }
    
    #countdownTimer {
        width: 160px;
        height: 160px;
        font-size: 2.5rem;
        padding: 8px;
    }
}