:root {
    --bg: #0b0e1a;
    --bg-dark: #060812;
    --accent: #00ff9d;
    --accent2: #00d4ff;
    --accent3: #7c9eff;
    --text: #e0f0ff;
    --text-dim: #a3bffa;
    --card: rgba(20, 25, 45, 0.65);
    --glow: 0 0 20px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(145deg, var(--bg-dark) 0%, var(--bg) 100%);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
}

/* Navigation */
.navbar-desktop {
    position: fixed;
    inset: 0 0 auto 0;
    padding: 0.9rem 5vw;
    background: rgba(8, 12, 30, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 255, 157, 0.16);
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 1024px) {
    .navbar-desktop {
        display: none;
    }
}

.logo {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.4rem, 5vw, 1.8rem);
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.nav-links {
    display: flex;
    gap: clamp(1rem, 3vw, 1.8rem);
    align-items: center;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-weight: 500;
    font-size: clamp(0.8rem, 3vw, 0.95rem);
    transition: all 0.22s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    text-shadow: 0 0 12px var(--accent);
}

.btn-small {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #0b1121 !important;
    padding: 0.4rem 1rem;
    border-radius: 50vmax;
    font-weight: 700;
}

/* Sidebar */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--card);
    border: 1px solid var(--accent2);
    color: var(--accent2);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
    }
}

.admin-sidebar {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    transform: translateX(-120%);
    opacity: 0;
    width: 260px;
    background: rgba(8, 12, 24, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid var(--accent2);
    border-radius: 2rem;
    padding: 1.5rem 0.8rem;
    transition: transform 0.3s, opacity 0.2s;
    z-index: 2000;
}

@media (max-width: 1024px) {
    .admin-sidebar {
        display: block;
    }
}

.admin-sidebar.open {
    transform: translateX(0);
    opacity: 1;
}

.sidebar-logo {
    font-family: 'Orbitron', monospace;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding: 0 0.5rem 1.2rem;
    border-bottom: 1px solid var(--accent2);
    margin-bottom: 1.2rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 2rem;
}

.sidebar-nav a i {
    width: 1.5rem;
    color: var(--accent2);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent2);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 255, 157, 0.1);
    margin-top: 1.5rem;
}

.sidebar-footer .signup-link {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #0b1121;
    padding: 0.7rem 1rem;
    border-radius: 2rem;
    text-align: center;
    display: block;
    font-weight: 700;
    text-decoration: none;
}

.sidebar-footer .logout-link {
    background: linear-gradient(90deg, rgba(225, 62, 62, 0.81), red);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 2rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 0.5rem;
}

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 1025px) {
    .main-container {
        padding-top: 80px;
    }
}

@media (max-width: 1024px) {
    .main-container {
        padding-top: 0.5rem;
    }
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    margin: 1rem 0;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .back-home {
        margin-left: 3.5rem;
    }
}

.back-home:hover {
    color: var(--accent);
    transform: translateX(-5px);
}

/* Game Header */
.game-header {
    text-align: center;
    padding: 1rem;
}

.game-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: clamp(1.8rem, 8vw, 2.5rem);
    font-weight: 900;
}

.gradient-text {
    background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem auto;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 50px;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
}

.mode-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #0b1121;
    border-color: transparent;
}

.mode-btn.practice {
    background: rgba(0, 255, 157, 0.2);
    border-color: var(--accent);
}

/* Timer Settings */
.timer-settings {
    background: var(--card);
    border-radius: 1.5rem;
    padding: 1rem;
    margin: 1rem auto;
    max-width: 500px;
    text-align: center;
    border: 1px solid rgba(0, 255, 157, 0.2);
    display: none;
}

.timer-settings.show {
    display: block;
}

.timer-presets {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 50px;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover,
.preset-btn.active {
    background: var(--accent);
    color: #0b1121;
    border-color: transparent;
}

.custom-timer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.custom-timer input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 1rem;
    padding: 0.3rem 0.8rem;
    color: var(--text);
    width: 80px;
    text-align: center;
}

.custom-timer button {
    background: var(--accent);
    border: none;
    border-radius: 1rem;
    padding: 0.3rem 1rem;
    cursor: pointer;
    font-weight: bold;
}

/* Practice Badge */
.practice-badge {
    position: fixed;
    top: 100px;
    right: 20px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #0b1121;
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.8rem;
    z-index: 100;
    display: none;
}

.practice-badge.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Game Stats */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1rem auto;
    padding: 1rem;
    background: var(--card);
    border-radius: 2rem;
    border: 1px solid rgba(0, 255, 157, 0.2);
    max-width: 800px;
}

.stat-box {
    text-align: center;
}

.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Selector */
.category-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem auto;
    flex-wrap: wrap;
}

.category-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 50px;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
}

.category-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.category-btn.active {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #0b1121;
    border-color: transparent;
}

/* Game Area */
.game-area {
    background: var(--card);
    border-radius: 2rem;
    margin: 1rem auto;
    padding: 2rem;
    border: 2px solid rgba(0, 255, 157, 0.3);
    min-height: 500px;
}

/* Question Card */
.question-card {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.question-category {
    display: inline-block;
    background: rgba(0, 255, 157, 0.2);
    padding: 0.3rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 255, 157, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text);
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    background: rgba(0, 255, 157, 0.1);
    border-color: var(--accent);
    transform: translateX(5px);
}

.option-btn.correct {
    background: rgba(0, 255, 157, 0.3);
    border-color: var(--accent);
    color: var(--accent);
}

.option-btn.wrong {
    background: rgba(255, 68, 68, 0.3);
    border-color: #ff4444;
    color: #ff4444;
}

.option-btn.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Brick Visuals */
.brick-visual {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.brick-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.quiz-brick {
    width: 50px;
    height: 30px;
    background: linear-gradient(135deg, #ff4d4d, #ff6b6b);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.quiz-brick.destroyed {
    background: linear-gradient(135deg, #00ff9d, #00d4ff);
    opacity: 0.5;
    transform: scale(0.9);
}

.quiz-brick.added {
    animation: brickPop 0.3s ease;
}

@keyframes brickPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Combo Meter */
.combo-meter {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    font-weight: bold;
    font-size: 1rem;
    z-index: 100;
    display: none;
    white-space: nowrap;
}

.combo-meter.show {
    display: block;
    animation: comboPop 0.3s ease;
}

@keyframes comboPop {
    0% {
        transform: translateX(-50%) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* Timer Bar */
.time-bar {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    z-index: 100;
}

.time-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    width: 100%;
    transition: width 0.1s linear;
}

/* Leaderboard */
.leaderboard-section {
    background: var(--card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin: 2rem auto;
    max-width: 800px;
    border: 1px solid rgba(0, 255, 157, 0.2);
}

.quiz-rank-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-rank-number {
    font-family: 'Orbitron', monospace;
    width: 40px;
    font-weight: bold;
    color: var(--accent);
}

.quiz-rank-flag {
    font-size: 1.2rem;
    width: 30px;
}

.quiz-rank-name {
    flex: 1;
}

.quiz-rank-score {
    font-family: 'Orbitron', monospace;
    color: var(--accent2);
    font-weight: bold;
}

.quiz-rank-stats {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: 0.5rem;
}

/* Modal */
.game-over-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1f35, #0b0e1a);
    border-radius: 2rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--accent);
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
}

.modal-btn-primary {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    color: #0b1121;
}

.modal-btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

.practice-warning {
    background: rgba(255, 193, 7, 0.2);
    border: 1px solid #ffc107;
    border-radius: 1rem;
    padding: 0.5rem;
    margin: 1rem 0;
    display: none;
}

/* Footer */
footer {
    padding: 2rem 5vw 1.5rem;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    color: var(--text-dim);
    border-top: 1px solid rgba(0, 255, 157, 0.1);
    font-size: 0.8rem;
    margin-top: 2rem;
    width: 100%;
    padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.footer-developer {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: #8ab4ff;
}

footer a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
}

footer a:hover {
    color: var(--accent);
}

@media (max-width: 930px) {
    footer {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        gap: 0.8rem;
    }
}



body.sidebar-open {
    overflow: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
        display: none;
    }
}

/* Footer */
footer {
    padding: 2rem 5vw 1.5rem;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    color: var(--text-dim);
    border-top: 1px solid rgba(0, 255, 157, 0.1);
    font-size: 0.8rem;
    margin-top: 2rem;
    width: 100%;
    padding-bottom: calc(1.5rem + var(--safe-bottom));
}

.footer-developer {
    font-family: 'Orbitron', monospace;
    font-size: 0.9rem;
    color: #8ab4ff;
}

footer a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
}

footer a:hover {
    color: var(--accent);
}

@media (max-width: 930px) {
    footer {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        gap: 0.8rem;
    }
}