:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Background Animation */
.background-globes {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary);
    bottom: -150px;
    right: -150px;
    animation-delay: -5s;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {

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

    33% {
        transform: translate(30px, -50px);
    }

    66% {
        transform: translate(-20px, 20px);
    }
}

/* Main Container & Card */
.container {
    width: 100%;
    max-width: 500px;
    padding: 1rem;
    z-index: 10;
}

.game-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Navigation Overlays */
.nav-overlay {
    position: fixed;
    z-index: 50;
    padding: 1rem;
}

.top-left {
    top: 1rem;
    left: 1rem;
}

.top-right {
    top: 1rem;
    right: 1rem;
}

.top-center {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

.bottom-right {
    bottom: 1rem;
    right: 1rem;
}

.nav-btn,
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.25rem;
    border-radius: 50px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-btn:hover,
.icon-btn:hover {
    background: rgba(40, 50, 70, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Stats Board */
.score-board {
    display: flex;
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.05em;
}

.score-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: relative;
    cursor: pointer;
    width: 40px;
    height: 22px;
    background-color: #3b4555;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

.label-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Game Core */
.image-wrapper {
    width: 180px;
    height: 180px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.1);
    padding: 5px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 10px 30px -10px var(--primary);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    background-color: var(--bg-dark);
}

.question-area {
    margin-bottom: 2rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-label {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.prompt-value,
.fade-text {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

button.name-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

button.name-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

button.name-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
    transform: scale(1.05);
}

button.name-btn.wrong {
    background: var(--error);
    border-color: var(--error);
    opacity: 0.5;
}

/* Loading & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.overlay.hidden {
    display: none;
}

.loader-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

/* Game Over */
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    padding: 1rem 2.5rem;
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: transform 0.2s;
    box-shadow: 0 10px 25px -5px var(--primary);
}

.primary-btn:hover {
    transform: scale(1.05);
}

/* =========================================
   Overview Page Styles (Consolidated)
   ========================================= */
.overview-container {
    width: 95%;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    min-height: 80vh;
}

.overview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    color: white;
    width: 300px;
    outline: none;
    transition: border-color 0.3s;
}

.search-box:focus {
    border-color: var(--primary);
}

.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.emp-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s, background 0.3s;
}

.emp-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.emp-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.emp-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.emp-card .role {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    display: block;
}

.emp-card .dept {
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    color: var(--primary);
    display: inline-block;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--primary);
}


/* =========================================
   Media Queries for Responsiveness
   ========================================= */

/* Tablet & Large Phones (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 700px;
    }

    .overview-container {
        width: 100%;
        border-radius: 0;
        margin: 0;
        min-height: 100vh;
    }
}

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

    /* --- Game Page --- */
    .container {
        max-width: 100%;
        padding: 0.5rem;
        padding-top: 80px;
        /* Space for top nav */
    }

    .game-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    /* Stack Navigation on Mobile */
    .nav-overlay {
        position: absolute;
        /* Change fixed to absolute relative to something or stick to top */
        padding: 0.5rem;
    }

    .top-left {
        top: 0.5rem;
        left: 0.5rem;
    }

    .top-right {
        top: 0.5rem;
        right: 0.5rem;
    }

    /* Score board moves to top center but smaller */
    .top-center {
        top: 4rem;
        /* Below the nav/filter */
        width: 100%;
        display: flex;
        justify-content: center;
        pointer-events: none;
        /* Let clicks pass through if overlapping */
    }

    .score-board {
        transform: scale(0.9);
        background: rgba(15, 23, 42, 0.8);
        padding: 0.25rem 1rem;
    }

    /* Bottom controls */
    .bottom-right {
        bottom: 1rem;
        right: 1rem;
        position: fixed;
    }

    /* Game Elements */
    .image-wrapper {
        width: 140px;
        height: 140px;
        margin-bottom: 1rem;
    }

    .prompt-value {
        font-size: 1.5rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
        /* 1 column on mobile */
        gap: 0.75rem;
    }

    button.name-btn {
        padding: 0.75rem;
        min-height: 50px;
        font-size: 0.95rem;
    }

    /* --- Overview Page --- */
    .overview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-box {
        width: 100%;
    }

    .employees-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        /* Smaller cards */
        gap: 1rem;
    }

    .emp-card {
        padding: 1rem;
    }

    .emp-card img {
        width: 80px;
        height: 80px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .employees-grid {
        grid-template-columns: 1fr;
        /* Single column list for very small screens */
    }

    .container {
        padding-top: 70px;
    }

    .top-center {
        top: 3.5rem;
    }
}

.hidden {
    display: none !important;
}

.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    color: #f43f5e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.logout-btn:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.1);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
}