@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap');

body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: 'Inter', sans-serif;
}

/* Container for the Three.js background */
#three-container {
    position: fixed;
    /* Important: keeps it stationary */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Puts it behind the UI */
}

/* UI Container */
#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    /* Ensure UI is on top of 3D scene */
}

/* Glass Panel */
.glass-panel {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    text-align: center;
    color: white;
    pointer-events: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    transition: opacity 0.3s;
}

h1 {
    margin: 0 0 10px 0;
    font-weight: 900;
    font-size: 2.5rem;
    text-transform: uppercase;
    background: linear-gradient(45deg, #00ffcc, #0099ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: #aaa;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Input Field */
input[type="text"] {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    width: 80%;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    text-align: center;
    font-weight: bold;
    outline: none;
    transition: 0.3s;
    margin-bottom: 20px;
}

input[type="text"]:focus {
    border-color: #00ffcc;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

/* Buttons */
button {
    background: white;
    color: black;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.5);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Leaderboard Table */
.leaderboard {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.leaderboard th {
    color: #888;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard td {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard tr:first-child td {
    color: #ffd700;
    font-weight: bold;
}

/* Gold color for #1 */
.rank-col {
    width: 30px;
    color: #555;
}

.score-col {
    text-align: right;
    font-family: monospace;
    font-size: 1.1rem;
}

.leaderboard-section {
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.leaderboard-section h3 {
    font-size: 0.8rem;
    color: #00ffcc;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Glass panel adjustments for larger content */
.glass-panel {
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.glass-panel::-webkit-scrollbar {
    width: 6px;
}

.glass-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* HUD */
#score-hud {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 32px;
    font-weight: 900;
    color: white;
    z-index: 10;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    font-style: italic;
}

/* Webcam */
#webcam-wrapper {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 180px;
    height: 135px;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.1);
    transform: scaleX(-1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 10;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loader */
#loader {
    display: none;
    margin: 0 auto 20px auto;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #00ffcc;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}