:root {
    --primary: #8a2be2;
    --secondary: #00d2ff;
    --bg-dark: #07071a;
    --text-light: #ffffff;
    --panel-bg: rgba(20, 20, 40, 0.85);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #000 url('https://www.transparenttextures.com/patterns/stardust.png');
    animation: moveStars 100s linear infinite;
    z-index: 0;
}

@keyframes moveStars {
    from {
        background-position: 0 0;
    }

    to {
        background-position: -10000px 5000px;
    }
}

.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100vh;
    max-height: 850px;
    background: #111;
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px var(--primary);
    z-index: 10;
    overflow: hidden;
}

@media (min-width: 650px) {
    .game-wrapper {
        height: 90vh;
        border-radius: 20px;
    }
}

.interface {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--panel-bg);
}

.interface.active {
    display: flex;
    animation: fade_in 0.5s ease;
}

@keyframes fade_in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.game-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--secondary);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.8);
    margin-bottom: 5px;
    text-align: center;
}

.game-desc {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #ccc;
}

.input-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

.input-container input {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--secondary);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 20px;
    outline: none;
}

/* Menu Hub */
.game-selector-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    margin-top: 10px;
}

.game-selector-grid .game-card:first-child {
    grid-column: span 2;
}

.game-card {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--primary);
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: 0.3s;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: var(--secondary);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.4);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.game-card h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.game-card p {
    font-size: 0.8rem;
    color: #aaa;
}

/* difficulty */
.difficulty-select {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.diff-btn {
    padding: 10px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid #555;
    cursor: pointer;
    transition: 0.3s;
}

.diff-btn.active {
    background: var(--primary);
    border-color: #b166ff;
    box-shadow: 0 0 10px var(--primary);
}

.btn {
    width: 100%;
    max-width: 300px;
    padding: 15px;
    border-radius: 50px;
    border: none;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    margin-bottom: 15px;
    transition: 0.2s;
    text-transform: uppercase;
}

.main-start-btn {
    background: linear-gradient(45deg, #00d2ff, #3a7bd5);
    color: white;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}

.main-start-btn:active {
    transform: scale(0.95);
}

.board-btn {
    background: transparent;
    border: 2px solid var(--primary);
    color: white;
}

.board-btn:active {
    background: var(--primary);
}

.error-msg {
    color: #ff3333;
    height: 20px;
    font-weight: bold;
}

/* HUD Shared */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-bottom: 2px solid var(--primary);
    z-index: 20;
    font-weight: 900;
    font-size: 1.2rem;
}

/* Shooter specific */
.question-panel {
    position: absolute;
    top: 50px;
    left: 5%;
    width: 90%;
    background: rgba(138, 43, 226, 0.8);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    z-index: 20;
    border: 1px solid #b166ff;
    pointer-events: none;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20;
    border-top: 1px solid #333;
}

.mobile-controls button {
    flex: 1;
    margin: 0 5px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--secondary);
    border-radius: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

#btnShoot {
    flex: 2;
    background: rgba(255, 61, 0, 0.2);
    border-color: #ff3d00;
}

/* Drag Drop UI (Plugs & Category) */
.drop-ui-interface {
    justify-content: flex-start;
    padding-top: 60px;
    overflow-y: auto;
}

.drop-title {
    margin-top: 10px;
    font-size: 1.5rem;
    color: #00d2ff;
    text-align: center;
}

.drop-subtitle {
    font-size: 0.9rem;
    color: #ccc;
    margin-bottom: 20px;
    text-align: center;
}

/* Game 2 PC Plugs Setup */
.drag-drop-area {
    display: flex;
    width: 100%;
    gap: 10px;
    justify-content: space-between;
}

.draggables-col,
.dropzones-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 48%;
}

.drag-item {
    background: #333;
    border: 2px solid #666;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: grab;
    font-weight: bold;
    transition: 0.2s;
    background: linear-gradient(180deg, #444, #222);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.drag-item:active {
    cursor: grabbing;
    transform: scale(1.05);
    border-color: var(--secondary);
}

.drop-zone {
    background: rgba(0, 0, 0, 0.6);
    border: 2px dashed #8a2be2;
    border-radius: 8px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 0.9rem;
    transition: 0.2s;
    position: relative;
}

.drop-zone.hover {
    border-color: #00e676;
    background: rgba(0, 230, 118, 0.1);
}

.drop-zone .drag-item {
    width: 100%;
    margin: 0;
    border: none;
    box-shadow: none;
    background: #2e7d32;
}

.dz-label {
    position: absolute;
    font-size: 0.7rem;
    top: -10px;
    left: 10px;
    background: #111;
    padding: 2px 5px;
    border-radius: 5px;
    color: var(--secondary);
}

/* Game 3 Smart Sorting Setup */
.category-boxes {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.cat-box {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #555;
    border-radius: 10px;
    padding: 10px;
}

.cat-box h3 {
    font-size: 1rem;
    color: #ffd700;
    margin-bottom: 10px;
    text-align: center;
}

.cat-drop-zone {
    min-height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed #777;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
    transition: 0.3s;
}

.cat-drop-zone.hover {
    border-color: #00e676;
}

.draggables-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    width: 100%;
    min-height: 100px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.chip-item {
    padding: 8px 12px;
    background: #1976d2;
    color: white;
    border-radius: 20px;
    font-weight: bold;
    cursor: grab;
    font-size: 0.9rem;
    border: 1px solid #64b5f6;
}

.chip-item:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.btn-finish {
    background: #00e676;
    color: #000;
    margin-top: 20px;
    width: 100%;
}

.btn-finish:active {
    background: #00c853;
}

/* Leaderboard Table */
.table-container {
    width: 100%;
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 1px solid #444;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    color: white;
}

.leaderboard-table th {
    background: var(--primary);
    padding: 10px;
    position: sticky;
    top: 0;
}

.leaderboard-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #333;
}

/* Game Over */
.final-score {
    font-size: 1.5rem;
    margin: 20px 0;
}

#goScore {
    font-size: 3rem;
    font-weight: 900;
    color: #00e676;
}

#goStatusMsg {
    margin-bottom: 30px;
    font-size: 1.2rem;
}

.mt-2 {
    margin-top: 20px;
}