:root {
    /* Modern Palette */
    --q-bg: #121212;
    --q-bg-secondary: #1e1e1e;
    --q-primary: #6200ea;
    /* Deep Purple */
    --q-primary-light: #b388ff;
    --q-accent: #00e676;
    /* Green Accent */
    --q-error: #cf6679;
    --q-text: #ffffff;
    --q-text-muted: #b0bec5;
    --q-card-bg: rgba(255, 255, 255, 0.05);
    --q-border: rgba(255, 255, 255, 0.1);
}

/* === GLBAL STYLES === */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--q-bg);
    color: var(--q-text);
    font-family: 'Inter', 'Roboto', sans-serif;
    /* Modern sans-serif */
    overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin: 0;
}

/* === MAIN CONTAINER === */
.enyq-wrapper {
    background: radial-gradient(circle at top right, #2a1a4a 0%, var(--q-bg) 70%);
    position: relative;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
}

/* === HOST HEADER === */
.host-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
    padding: 0 40px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--q-border);
}

.host-header h2 {
    color: var(--q-primary-light);
    font-size: 1.5em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.status-bar {
    font-size: 0.9em;
    color: var(--q-text-muted);
}

.status-bar span {
    color: var(--q-text);
    font-weight: bold;
}

/* === CENTRAL VIEW BLOCK === */
.host-view {
    width: 95%;
    max-width: 1400px;
    height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* === LOBBY (GRID) === */
#host-view-lobby {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 40px;
    align-items: center;
    justify-items: center;
    padding: 20px;
    padding-bottom: 40px;
}

#host-view-lobby.hidden {
    display: none !important;
}

.qr-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--q-card-bg);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--q-border);
    backdrop-filter: blur(10px);
}

.enyq-qr {
    border-radius: 10px;
    width: 250px;
    height: 250px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background: white;
    padding: 10px;
}

.qr-link {
    font-size: 1.2em;
    color: var(--q-primary-light);
    margin-top: 20px;
    font-weight: 500;
    text-align: center;
}

.players-column {
    width: 100%;
    height: 60vh;
    background: var(--q-bg-secondary);
    border-radius: 20px;
    border: 1px solid var(--q-border);
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.players-column h4 {
    text-align: left;
    font-size: 1.2em;
    color: var(--q-text-muted);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#lobby-players-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

#lobby-players-list ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

#lobby-players-list li {
    background: var(--q-card-bg);
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1em;
    text-align: center;
    font-weight: 500;
    border: 1px solid var(--q-border);
    color: var(--q-text);
    animation: fadeIn 0.4s;
}

/* BUTTONS */
.start-game-row {
    grid-column: 1 / -1;
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.enyq-btn {
    background: var(--q-primary);
    color: white;
    border: none;
    font-size: 1.2em;
    padding: 15px 40px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(98, 0, 234, 0.3);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.enyq-btn:hover {
    background: #7c4dff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(98, 0, 234, 0.4);
}

.enyq-btn:active {
    transform: translateY(0);
}

.start-btn {
    font-size: 1.5em;
    padding: 20px 60px;
    background: linear-gradient(135deg, var(--q-primary), #7c4dff);
}

/* === PLAYER SCREEN === */
.player-theme {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--q-bg);
}

.player-theme .host-header {
    display: none;
}

#player-view-login {
    width: 90%;
    max-width: 400px;
    background: var(--q-bg-secondary);
    padding: 40px 30px;
    border-radius: 20px;
    border: 1px solid var(--q-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

#player-view-login h1 {
    font-size: 2em;
    color: var(--q-primary-light);
}

.enyq-input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 1px solid var(--q-text-muted);
    border-radius: 8px;
    text-align: center;
    box-sizing: border-box;
    background: var(--q-bg);
    color: var(--q-text);
}

.enyq-input:focus {
    border-color: var(--q-primary);
    outline: none;
}

.player-view .enyq-btn {
    width: 100%;
    background: var(--q-accent);
    color: #000;
    box-shadow: none;
}

.player-view .enyq-btn:hover {
    background: #69f0ae;
}

/* === SPINNER === */
.spinner {
    font-size: 3em;
    animation: spin 2s infinite linear;
    display: inline-block;
    margin-bottom: 20px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* === GAMEPLAY === */
#host-view-question,
#host-view-result,
#host-view-leaderboard {
    justify-content: center;
    width: 100%;
}

#host-q-text {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    max-width: 80%;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 80%;
    max-width: 1000px;
}

.ans-card {
    background: var(--q-card-bg);
    border: 1px solid var(--q-border);
    border-radius: 12px;
    padding: 30px;
    font-size: 1.4em;
    text-align: center;
    transition: background 0.2s;
}

.hidden {
    display: none !important;
}

/* === STATS === */
.stats-panel {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 40px;
    margin-bottom: 20px;
    width: 100%;
}

.stat-box {
    text-align: center;
}

.stat-label {
    font-size: 0.9em;
    color: var(--q-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
}

.stat-val {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--q-text);
}

/* PROGRESS BAR */
.progress-bar-bg {
    width: 80%;
    max-width: 1000px;
    height: 6px;
    background: var(--q-bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--q-accent);
    width: 0%;
    transition: width 0.5s ease;
}

/* === RESULT SCREEN === */
#host-view-result h3 {
    color: var(--q-text-muted);
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

#host-correct-answer {
    font-size: 3em;
    color: var(--q-accent);
    font-weight: bold;
    margin-bottom: 40px;
}

.correct-badge {
    background: rgba(0, 230, 118, 0.1);
    color: var(--q-accent);
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 500;
    margin: 5px;
    display: inline-block;
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* === LEADERBOARD === */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 350px;
    margin-bottom: 60px;
    gap: 20px;
    width: 80%;
    max-width: 800px;
}

.podium-place {
    width: 150px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.p-bar {
    width: 100%;
    border-radius: 8px 8px 0 0;
    position: relative;
    animation: growUp 1s ease-out both;
}

.place-1 .p-bar {
    height: 250px;
    background: var(--q-primary);
}

.place-2 .p-bar {
    height: 180px;
    background: var(--q-bg-secondary);
    border: 1px solid var(--q-border);
}

.place-3 .p-bar {
    height: 120px;
    background: var(--q-bg-secondary);
    border: 1px solid var(--q-border);
}

.p-name {
    margin-bottom: 10px;
    font-weight: 600;
}

.p-score {
    position: absolute;
    bottom: 10px;
    width: 100%;
    font-weight: bold;
}

.medal {
    font-size: 2em;
    margin-bottom: 10px;
}

.rest-list {
    list-style: none;
    padding: 0;
    width: 60%;
    max-width: 600px;
    margin: 0 auto;
}

.rest-list li {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--q-border);
    font-size: 1.1em;
}

/* === FLYING NAMES === */
#flying-names-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.flying-name {
    position: absolute;
    left: 50%;
    top: 80%;
    transform: translateX(-50%);
    background: var(--q-primary);
    color: white;
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.2em;
    animation: flyUp 2s ease-out forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes flyUp {
    0% {
        opacity: 0;
        transform: translate(-50%, 20px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -150px);
    }
}

/* === MOBILE PLAYER === */
@media (max-width: 768px) {
    .player-theme {
        padding: 20px;
        justify-content: flex-start;
        padding-top: 40px;
    }

    #player-view-login {
        width: 100%;
        margin-top: 40px;
        padding: 30px 20px;
    }

    #player-q-text {
        font-size: 1.4em;
    }

    .player-options-list {
        display: flex;
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    .player-opt-btn {
        width: 100%;
        background: var(--q-bg-secondary);
        color: var(--q-text);
        padding: 20px;
        border: 1px solid var(--q-border);
        border-radius: 12px;
        font-size: 1.1em;
    }

    .player-opt-btn:active {
        background: var(--q-primary);
        color: white;
        transform: scale(0.98);
    }
}

/* === DASHBOARD STYLES === */
.dashboard-container {
    width: 95%;
    max-width: 1200px;
    margin-top: 100px;
    padding-bottom: 50px;
}

.dash-nav {
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
}

.dash-tab {
    opacity: 0.7;
}

.dash-tab.active {
    opacity: 1;
    box-shadow: 0 0 15px var(--q-primary);
}

.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.quiz-card {
    background: var(--q-card-bg);
    border: 1px solid var(--q-border);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.2s;
}

.quiz-card:hover {
    transform: translateY(-5px);
    border-color: var(--q-primary);
}

.quiz-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

.quiz-actions button {
    flex: 1;
    font-size: 0.9em;
    padding: 10px;
}

.question-block {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--q-border);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
}

.q-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--q-border);
    padding-bottom: 10px;
}

.btn-remove-q {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: var(--q-error);
    opacity: 0.7;
}

.btn-remove-q:hover {
    opacity: 1;
}

.answers-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--q-border);
}

.opt-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.small-input {
    width: 100px;
    display: inline-block;
    padding: 10px;
}

/* Form Group */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--q-text-muted);
    font-size: 0.9em;
}