:root {
    --bg-dark: #0a0b10;
    --bg-card: rgba(17, 19, 28, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --neon-cyan: #00f0ff;
    --neon-purple: #d000ff;
    --neon-green: #39ff14;
    --text-white: #ffffff;
    --text-muted: #8b92b6;
    --accent-red: #ff3838;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Montserrat', sans-serif;
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background animated matrix grid */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -1;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 300px; }
}

/* Glowing text elements */
.neon-text-cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6), 0 0 20px rgba(0, 240, 255, 0.3);
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
}

.neon-text-purple {
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(208, 0, 255, 0.6), 0 0 20px rgba(208, 0, 255, 0.3);
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
}

.neon-text-green {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.6);
    font-family: 'Orbitron', sans-serif;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: rgba(10, 11, 16, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 100;
}

.logo {
    font-size: 1.8rem;
    letter-spacing: 2px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(0, 240, 255, 0.2);
}

/* View panel toggle classes */
.view-panel {
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Buttons */
.neon-btn {
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    padding: 14px 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
}

.btn-cyan {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: var(--text-white);
    box-shadow: 0 0 15px rgba(0, 198, 255, 0.4);
}

.btn-cyan:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 198, 255, 0.7);
}

.btn-purple {
    background: linear-gradient(135deg, #f107a3, #7b2ff7);
    color: var(--text-white);
    box-shadow: 0 0 15px rgba(241, 7, 163, 0.4);
}

.btn-purple:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(241, 7, 163, 0.7);
}

.btn-gray {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    border: 1px solid var(--border-color);
}

.btn-gray:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-margin {
    margin-top: 20px;
}

/* Auth Card Styles */
.auth-card {
    max-width: 450px;
    margin: 60px auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tab-buttons {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    cursor: pointer;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.input-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input, .input-group textarea {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}

.input-group textarea {
    height: 120px;
    resize: vertical;
}

/* Layout for team view */
.game-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.level-badge {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.4);
}

.grid-layout {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

.task-card {
    min-height: 350px;
    display: flex;
    flex-direction: column;
}

.level-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 1px;
}

.task-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
    flex-grow: 1;
}

.coordinates-box {
    margin-top: 30px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.submit-input-wrapper {
    display: flex;
    gap: 10px;
}

.submit-input-wrapper input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    color: var(--text-white);
    font-family: inherit;
    font-size: 1.1rem;
    text-transform: lowercase;
}

.submit-input-wrapper input:focus {
    outline: none;
    border-color: var(--neon-cyan);
}

.submit-feedback {
    margin-top: 15px;
    font-weight: 600;
    text-align: center;
}

.feedback-success {
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.feedback-error {
    color: var(--accent-red);
    text-shadow: 0 0 10px rgba(255, 56, 56, 0.3);
}

.feedback-bonus {
    color: var(--neon-purple);
    text-shadow: 0 0 10px rgba(188, 19, 254, 0.3);
}

.feedback-warning {
    color: var(--accent-orange);
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.3);
}

/* Hints Section */
.hints-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.hint-timer {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.hint-timer span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

#hintTimer {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.hints-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hint-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.hint-item.revealed {
    border-style: solid;
    border-color: rgba(208, 0, 255, 0.3);
    background: rgba(208, 0, 255, 0.03);
}

.hint-label {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 6px;
    display: block;
}

/* Waiting / Finished states */
.centered-card {
    max-width: 600px;
    margin: 80px auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pulse-icon {
    animation: pulse 2s infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px var(--neon-cyan)); }
    100% { transform: scale(1.1); filter: drop-shadow(0 0 15px var(--neon-cyan)); }
}

.bounce-icon {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-7px); }
}

/* Admin Tabs */
.admin-tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
}

.admin-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 24px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.admin-tab-btn:hover {
    color: var(--text-white);
}

.admin-tab-btn.active {
    color: var(--neon-cyan);
    border-bottom-color: var(--neon-cyan);
}

/* Live Matrix Table */
.matrix-wrapper {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.matrix-table th, .matrix-table td {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.matrix-table th {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.01);
}

.matrix-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.matrix-team-name {
    font-weight: 700;
    font-size: 1.05rem;
}

.matrix-level-badge {
    background: rgba(208, 0, 255, 0.1);
    border: 1px solid var(--neon-purple);
    color: var(--neon-purple);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.matrix-time-warning {
    color: var(--accent-red);
    font-weight: 600;
}

.matrix-time-ok {
    color: var(--neon-green);
    font-weight: 600;
}

/* Games Panel grid */
.games-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
}

.game-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.3s ease;
}

.game-item:hover {
    border-color: rgba(208, 0, 255, 0.3);
}

.game-info h4 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.game-actions {
    display: flex;
    gap: 10px;
}

/* Levels Editor */
.levels-editor-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
}

.level-editor-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}

.level-editor-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
}

/* Game Preview Modal */
.game-preview-modal-content {
    width: 95% !important;
    max-width: 960px !important;
    max-height: 92vh !important;
    overflow-y: auto;
    padding: 0 !important;
}

.game-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.15);
    position: sticky;
    top: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    z-index: 5;
}

.game-preview-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.game-preview-body {
    padding: 25px;
}

/* Level Block */
.gp-level {
    margin-bottom: 30px;
    border: 1px solid rgba(0, 240, 255, 0.12);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(10, 15, 30, 0.5);
}

.gp-level-header {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.12) 0%, rgba(208, 0, 255, 0.08) 100%);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(0, 240, 255, 0.1);
}

.gp-level-num {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #fff;
    font-weight: 800;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.gp-level-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.gp-level-body {
    padding: 20px;
}

/* Task text */
.gp-task {
    margin-bottom: 18px;
}

.gp-task-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--neon-cyan);
    margin-bottom: 6px;
}

.gp-task-content {
    color: var(--text-primary);
    line-height: 1.65;
    font-size: 0.95rem;
}

.gp-task-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

/* Notes */
.gp-notes {
    background: rgba(255, 60, 80, 0.08);
    border-left: 3px solid var(--accent-red);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 18px;
}

.gp-notes-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-red);
    margin-bottom: 4px;
}

/* Hints */
.gp-hints {
    margin-bottom: 18px;
}

.gp-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--neon-purple);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gp-hint-card {
    border: 1px solid rgba(208, 0, 255, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    overflow: hidden;
}

.gp-hint-header {
    background: rgba(208, 0, 255, 0.07);
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gp-hint-delay {
    color: var(--neon-purple);
    font-size: 0.75rem;
}

.gp-hint-body {
    padding: 10px 14px;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.55;
}

.gp-hint-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

/* Codes */
.gp-codes {
    margin-bottom: 8px;
}

.gp-codes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gp-code-chip {
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--neon-cyan);
}

.gp-code-chip i {
    margin-right: 4px;
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Meta info row */
.gp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.gp-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.gp-meta-item i {
    color: var(--neon-cyan);
    font-size: 0.72rem;
}

/* Separator */
.gp-divider {
    border: none;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
    margin: 12px 0;
}

/* Empty state */
.gp-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Simple tables */
.table-wrapper {
    overflow-x: auto;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.simple-table th, .simple-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

/* Alert Banner */
.alert-banner {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-banner.success {
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
}

.alert-banner.error {
    background: rgba(255, 56, 56, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

/* Matrix headers & live logs list */
.matrix-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.matrix-status-box {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.live-logs-list {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-item {
    display: block;
}

.log-item.success { color: var(--neon-green); }
.log-item.error { color: var(--accent-red); }
.log-item.start { color: var(--neon-cyan); }

/* Interactive Code Chips */
.code-interactive-wrapper {
    display: flex;
    gap: 10px;
}
.codes-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    min-height: 38px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}
.code-chip {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--text-white);
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}
.code-chip i {
    cursor: pointer;
    color: var(--accent-red);
    transition: color 0.2s ease, transform 0.2s;
}
.code-chip i:hover {
    color: #ff5f5f;
    transform: scale(1.2);
}

/* Image Upload & Preview */
.image-preview-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--neon-purple);
    box-shadow: 0 0 10px rgba(208, 0, 255, 0.3);
}
.image-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.btn-delete-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: var(--text-white);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s;
}
.btn-delete-image:hover {
    background: var(--accent-red);
}

/* Level & Hint Images Display (Players) */
.level-image-container {
    margin-top: 20px;
    width: 100%;
    max-height: 350px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(255, 255, 255, 0.05);
}
.level-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hint-image-container {
    margin-top: 12px;
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(208, 0, 255, 0.2);
}
.hint-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hint-edit-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}
.hint-edit-block h5 {
    color: var(--neon-purple);
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 10px;
}
.hint-upload-row {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.hint-upload-row label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.hint-upload-row input[type="file"], .input-group input[type="file"] {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
}

/* ================= NEW SIDEBAR ADMIN SYSTEM ================= */
.admin-layout-wrapper {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    max-width: 1400px !important;
    width: 100%;
}

.admin-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.admin-sidebar-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.admin-sidebar-header .logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.admin-sidebar-header .sidebar-subtitle {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: 5px;
}

.admin-sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.admin-sidebar-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 12px 16px;
    border-radius: 10px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-sidebar-btn i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.admin-sidebar-btn:hover:not(:disabled) {
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.2);
}

.admin-sidebar-btn.active {
    color: var(--text-white);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15) 0%, rgba(208, 0, 255, 0.15) 100%);
    border: 1px solid rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.15);
}

.admin-sidebar-btn:disabled, .admin-sidebar-btn.disabled-btn {
    opacity: 0.4;
    cursor: not-allowed;
}

.admin-content-area {
    flex-grow: 1;
    min-width: 0; /* Prevents flex children from overflowing */
}

.admin-tab-content {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header-card {
    padding: 20px;
}

.table-panel-card {
    padding: 20px;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.panel-header-row h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
}

/* Forms and settings grid */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group-row {
    display: flex;
    gap: 20px;
}

.input-group-row .input-group {
    flex: 1;
}

.neon-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(10, 11, 16, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-white);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s;
}

.neon-select:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.neon-select option {
    background-color: var(--bg-dark);
    color: var(--text-white);
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Teams split layout */
.teams-split-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

.credentials-table th, .credentials-table td {
    padding: 10px 8px;
    font-size: 0.85rem;
}

.credentials-table .copy-link-btn {
    font-size: 0.75rem;
    padding: 4px 8px;
    cursor: pointer;
}

/* Routes table */
.routes-table th, .routes-table td {
    padding: 12px;
}

.route-sequence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.route-step {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
}

.route-step.active-step {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.route-arrow {
    color: var(--text-muted);
}

/* 12codes Styles */
.alert-info-box {
    background: rgba(255, 170, 0, 0.08);
    border: 1px solid rgba(255, 170, 0, 0.25);
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #ffd27f;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.alert-info-box a {
    color: var(--neon-cyan);
    text-decoration: underline;
    font-weight: 600;
    transition: all 0.3s ease;
}
.alert-info-box a:hover {
    text-shadow: 0 0 10px var(--neon-cyan);
}
.btn-green {
    background: rgba(57, 255, 20, 0.15) !important;
    border: 1px solid var(--neon-green) !important;
    color: var(--text-white) !important;
}
.btn-green:hover {
    background: rgba(57, 255, 20, 0.25) !important;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3) !important;
}
.games-table th, .games-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border-color);
}
.games-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.settings-two-columns, .levels-two-columns {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 25px;
}

/* CKEditor Rich Text Formatting Styles */
.task-content p, .hint-content p, #welcomeMessageText p, #finishedStateText p, #waitingStateText p {
    margin-bottom: 12px;
}
.task-content ul, .hint-content ul, #welcomeMessageText ul, #finishedStateText ul, #waitingStateText ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 12px;
}
.task-content ol, .hint-content ol, #welcomeMessageText ol, #finishedStateText ol, #waitingStateText ol {
    list-style-type: decimal;
    margin-left: 20px;
    margin-bottom: 12px;
}
.task-content blockquote, .hint-content blockquote, #welcomeMessageText blockquote {
    border-left: 3px solid var(--neon-cyan);
    padding-left: 15px;
    color: var(--text-muted);
    font-style: italic;
    margin: 15px 0;
}
.task-content table, .hint-content table, #welcomeMessageText table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}
.task-content table th, .task-content table td,
.hint-content table th, .hint-content table td,
#welcomeMessageText table th, #welcomeMessageText table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
}
.task-content table th, .hint-content table th, #welcomeMessageText table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

/* Quill Custom Theme Overrides */
.ql-toolbar.ql-snow {
    background: #111218 !important;
    border: 1px solid rgba(0, 240, 255, 0.2) !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    padding: 10px !important;
}
.ql-container.ql-snow {
    background: rgba(10, 11, 16, 0.6) !important;
    border: 1px solid rgba(0, 240, 255, 0.2) !important;
    border-bottom-left-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
    font-family: 'Montserrat', sans-serif !important;
    font-size: 0.95rem !important;
    color: #e2e8f0 !important;
}
.ql-editor {
    min-height: 180px;
    line-height: 1.6;
}
.ql-editor.ql-blank::before {
    color: var(--text-muted) !important;
    font-style: italic !important;
    font-size: 0.9rem !important;
}
.ql-snow .ql-stroke { stroke: #e2e8f0 !important; }
.ql-snow .ql-fill { fill: #e2e8f0 !important; }
.ql-snow .ql-picker { color: #e2e8f0 !important; }
.ql-snow .ql-picker-options {
    background-color: #111218 !important;
    border: 1px solid rgba(0, 240, 255, 0.2) !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5) !important;
}
.ql-snow .ql-picker-item { color: #e2e8f0 !important; }
.ql-snow .ql-picker-item:hover, .ql-snow .ql-picker-item.ql-selected { color: var(--neon-cyan) !important; }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow .ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke, .ql-snow .ql-toolbar button.ql-active .ql-stroke { stroke: var(--neon-cyan) !important; }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow .ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill, .ql-snow .ql-toolbar button.ql-active .ql-fill { fill: var(--neon-cyan) !important; }
.ql-snow.ql-toolbar button:hover, .ql-snow .ql-toolbar button:hover,
.ql-snow.ql-toolbar button.ql-active, .ql-snow .ql-toolbar button.ql-active,
.ql-snow.ql-toolbar .ql-picker-label:hover, .ql-snow .ql-toolbar .ql-picker-label:hover,
.ql-snow.ql-toolbar .ql-picker-label.ql-active, .ql-snow .ql-toolbar .ql-picker-label.ql-active { color: var(--neon-cyan) !important; }

/* ========================================= */
/* NOTIFICATION INFO STYLE                   */
/* ========================================= */
.alert-banner.info {
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
}

/* ========================================= */
/* PLAYER LEVEL TIMER                        */
/* ========================================= */
.level-timer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.level-timer-bar i {
    color: var(--neon-cyan);
}

.level-timer-bar .timer-value {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--neon-cyan);
}

.level-timer-bar .timer-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ========================================= */
/* MOBILE HAMBURGER MENU                     */
/* ========================================= */
.mobile-hamburger {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mobile-hamburger:active {
    transform: scale(0.92);
}

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    backdrop-filter: blur(4px);
}

.mobile-sidebar-overlay.active {
    display: block;
}

/* ========================================= */
/* MOBILE RESPONSIVENESS (max-width: 768px)  */
/* ========================================= */

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    /* --- HAMBURGER VISIBLE --- */
    .mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* --- NAVBAR --- */
    .navbar {
        padding: 12px 16px !important;
        flex-direction: row;
        gap: 10px;
    }
    
    .logo {
        font-size: 1.3rem !important;
    }

    .user-status {
        gap: 8px;
    }

    .user-status .neon-btn {
        width: auto !important;
        padding: 6px 12px !important;
        font-size: 0.7rem !important;
        margin-bottom: 0 !important;
    }

    /* --- CONTAINER --- */
    .container {
        margin: 15px auto;
        padding: 0 12px;
    }

    /* --- GLASS CARDS --- */
    .glass-card {
        padding: 16px 14px !important;
        border-radius: 12px;
        margin-bottom: 15px;
    }

    /* --- AUTH CARD --- */
    .auth-card {
        margin: 30px auto;
    }

    .auth-header h2 {
        font-size: 1.4rem;
    }

    /* --- ADMIN SIDEBAR (MOBILE DRAWER) --- */
    .admin-layout-wrapper {
        flex-direction: column;
        gap: 0;
        margin-top: 0;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        border-radius: 0;
        padding: 20px 16px;
        transition: left 0.3s ease;
        overflow-y: auto;
        background: rgba(10, 11, 16, 0.97);
        backdrop-filter: blur(20px);
    }

    .admin-sidebar.mobile-open {
        left: 0;
    }

    .admin-sidebar-header {
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .admin-sidebar-header .logo-text {
        font-size: 1.3rem !important;
    }

    .admin-sidebar-btn {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    .admin-content-area {
        width: 100%;
        padding: 0;
    }

    /* --- TABLES: HORIZONTAL SCROLL --- */
    .games-table, 
    .simple-table, 
    .matrix-table, 
    .credentials-table, 
    .routes-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .table-panel-card,
    .table-wrapper {
        padding: 0 !important;
        overflow-x: auto;
    }

    .games-table th, .games-table td,
    .simple-table th, .simple-table td {
        padding: 10px 12px !important;
        font-size: 0.82rem;
    }

    /* --- MATRIX MONITORING MOBILE --- */
    .matrix-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .matrix-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .matrix-header .neon-btn {
        width: 100%;
    }

    .matrix-table th, .matrix-table td {
        padding: 10px 12px !important;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .live-feed-panel {
        max-height: 350px;
        overflow-y: auto;
    }

    #matrixLiveFeed {
        max-height: 280px !important;
    }

    /* --- ANALYTICS CHARTS --- */
    #adminAnalyticsTab .glass-card[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* force analytics grid to stack */
    #adminAnalyticsTab > div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
    }

    /* --- SETTINGS TWO COLUMNS --- */
    .settings-two-columns, 
    .levels-two-columns {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* --- TEAMS LAYOUT --- */
    .teams-split-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* --- INPUT ROWS --- */
    .input-group-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* --- BUTTONS --- */
    .neon-btn {
        padding: 12px 16px !important;
        font-size: 0.8rem !important;
    }

    /* Don't force full width on action buttons */
    .game-actions .neon-btn,
    td .neon-btn,
    .btn-small {
        width: auto !important;
        margin-bottom: 0 !important;
    }

    .game-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* --- PANEL HEADERS --- */
    .panel-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .panel-header-row h2,
    .panel-header-card h2 {
        font-size: 1.3rem !important;
    }

    /* --- GAME HEADER BAR (PLAYER) --- */
    .game-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 15px;
    }

    .level-badge {
        align-self: flex-start;
    }

    /* --- GRID LAYOUT (PLAYER GAME) --- */
    .grid-layout {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .task-card {
        min-height: unset;
    }

    .level-title {
        font-size: 1.3rem;
    }

    .task-content {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    /* --- CODE INPUT (PLAYER) - BIGGER TOUCH TARGET --- */
    .submit-input-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .submit-input-wrapper input {
        font-size: 1.15rem !important;
        padding: 16px !important;
        border-radius: 10px;
        text-align: center;
    }

    .submit-input-wrapper .neon-btn {
        width: 100% !important;
        padding: 14px !important;
        font-size: 1rem !important;
        margin-bottom: 0 !important;
    }

    /* --- COORDINATES BOX --- */
    .coordinates-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .coordinates-box .neon-btn {
        width: 100% !important;
    }

    /* --- HINTS (PLAYER) --- */
    .hints-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #hintTimerBox {
        width: 100%;
        justify-content: space-between;
    }

    .hint-item {
        padding: 12px;
    }

    /* --- LEVEL EDITOR RICH TEXT --- */
    #levelFormTaskText,
    #hintFormText,
    #settingsWelcomeText,
    #settingsFinishText {
        height: 180px !important;
    }

    .ql-toolbar.ql-snow {
        padding: 6px !important;
        flex-wrap: wrap;
    }

    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 8px !important;
    }

    /* --- CENTERED CARD (WAITING/FINISHED) --- */
    .centered-card {
        margin: 30px auto;
        padding: 25px 20px !important;
    }

    .centered-card h2 {
        font-size: 1.4rem;
    }

    /* --- WELCOME BANNER --- */
    #welcomeMessageBanner {
        padding: 12px 14px !important;
    }

    /* --- LEVEL IMAGE --- */
    .level-image-container {
        max-height: 250px;
    }

    /* --- CODES PROGRESS --- */
    #codesProgressContainer {
        padding: 8px !important;
    }

    /* --- GAME PREVIEW MODAL --- */
    .game-preview-modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    .game-preview-header {
        padding: 14px 16px;
    }

    .game-preview-header h2 {
        font-size: 1.1rem;
    }

    .game-preview-body {
        padding: 14px;
    }

    /* --- MODALS --- */
    .modal-content {
        width: 95% !important;
        max-width: 100% !important;
        border-radius: 12px;
    }

    /* --- QR CODE MODAL --- */
    #qrCodeModal .modal-content {
        max-width: 320px !important;
    }

    #qrCodeModalImage {
        width: 200px !important;
        height: 200px !important;
    }

    /* --- BREADCRUMBS --- */
    [style*="font-size: 0.85rem"][style*="color: var(--text-muted)"] {
        font-size: 0.75rem !important;
        line-height: 1.5;
        word-break: break-word;
    }

    /* --- FORM TITLES --- */
    #levelFormTitle,
    #hintsFormTitle,
    #codesFormTitle,
    #settingsGameHeaderTitle,
    #levelsGameHeaderTitle {
        font-size: 1.3rem !important;
    }
}

/* ========================================= */
/* EXTRA SMALL SCREENS (max-width: 400px)    */
/* ========================================= */
@media (max-width: 400px) {
    .logo {
        font-size: 1.1rem !important;
    }

    .panel-header-row h2,
    .panel-header-card h2 {
        font-size: 1.1rem !important;
    }

    .level-title {
        font-size: 1.1rem;
    }

    .neon-text-cyan, .neon-text-purple, .neon-text-green {
        font-size: inherit;
    }

    .matrix-table th, .matrix-table td {
        padding: 8px !important;
        font-size: 0.75rem;
    }

    .admin-sidebar-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
}

/* ========================================= */
/* TABLET (max-width: 1024px)                */
/* ========================================= */
@media (max-width: 1024px) and (min-width: 769px) {
    .admin-layout-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        height: auto;
    }

    .admin-sidebar-header {
        flex-shrink: 0;
    }

    .admin-sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        margin-bottom: 0;
    }

    .admin-sidebar-btn span {
        display: none;
    }

    .admin-sidebar-btn {
        padding: 10px;
        font-size: 1.1rem;
    }

    .admin-sidebar-footer {
        margin-left: auto;
    }

    .settings-two-columns, .levels-two-columns {
        grid-template-columns: 1fr !important;
    }

    .teams-split-layout {
        grid-template-columns: 1fr;
    }

    .matrix-layout {
        grid-template-columns: 1fr !important;
    }
}

@keyframes glitch { 0% { transform: translate(0) } 20% { transform: translate(-2px, 2px) } 40% { transform: translate(-2px, -2px) } 60% { transform: translate(2px, 2px) } 80% { transform: translate(2px, -2px) } 100% { transform: translate(0) } }


/* MDPS Header Overrides */
.site-header-nav {
    position: fixed;
    top: 0; left: 0; width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px 16px;
    background: rgba(11, 15, 25, 0.94);
    border-bottom: 1px solid rgba(0, 242, 254, 0.25);
    backdrop-filter: blur(16px);
    z-index: 105;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.home-badge {
    font-size: 16px; font-weight: 900; color: #00f2fe;
    text-decoration: none; display: flex; align-items: center; gap: 8px;
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.5); letter-spacing: 0.5px;
}
.nav-links { display: flex; align-items: center; gap: 14px; }
.nav-link {
    color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 700;
    padding: 6px 12px; border-radius: 8px; transition: all 0.2s ease;
    display: flex; align-items: center; gap: 6px;
}
.nav-link:hover { color: #00f2fe; background: rgba(0, 242, 254, 0.1); }
.nav-link.active { color: #00f2fe; font-weight: 800; background: rgba(0, 242, 254, 0.15); }
.nav-link.highlight-anubis {
    color: #ff0055; border: 1px solid rgba(255, 0, 85, 0.4);
    background: rgba(255, 0, 85, 0.08);
}

.mobile-nav-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
@media (max-width: 768px) {
    .site-header-nav .nav-links { display: none; }
    .mobile-nav-toggle { display: flex; }
}

.mobile-nav-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%; height: 100dvh;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    opacity: 0; visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.mobile-nav-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-nav-drawer {
    position: absolute; top: 0; right: 0; width: 85%; max-width: 340px; height: 100%; height: 100dvh;
    background: #0b0f19; border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px 16px 30px 16px; display: flex; flex-direction: column; justify-content: space-between;
    transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8); overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-nav-overlay.active .mobile-nav-drawer { transform: translateX(0); }
.mobile-nav-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 14px; }
.mobile-nav-close { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.mobile-nav-links { display: flex; flex-direction: column; gap: 8px; }
.mobile-nav-links a { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px; color: #cbd5e1; text-decoration: none; font-size: 14px; font-weight: 600; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.05); }
.mobile-nav-links a i { font-size: 16px; width: 22px; text-align: center; color: #00f2fe; }
.mobile-nav-links a:hover, .mobile-nav-links a.active { background: linear-gradient(135deg, rgba(0, 242, 254, 0.15), rgba(208, 0, 255, 0.15)); border-color: rgba(0, 242, 254, 0.3); color: #fff; }

main.container {
    margin-top: calc(75px + env(safe-area-inset-top, 0px));
}


/* ========================================================= */
/* RESPONSIVE MOBILE ADMIN CARD STYLES (< 768px)            */
/* ========================================================= */
@media (max-width: 768px) {
    /* Two column containers in admin tab should stack vertically */
    .levels-two-columns,
    .settings-two-columns,
    .teams-split-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    /* --------------------------------------------------------- */
    /* 1. LOCATIONS & CODES (LEVELS TAB) CARD LAYOUT            */
    /* --------------------------------------------------------- */
    .games-table {
        display: block !important;
        width: 100% !important;
        border-collapse: separate !important;
    }

    .games-table thead {
        display: none !important;
    }

    .games-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .games-table tbody tr,
    .admin-level-row {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: rgba(17, 19, 28, 0.85) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        box-sizing: border-box !important;
        height: auto !important;
        gap: 10px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
    }

    .games-table tbody tr td,
    .admin-level-title-cell,
    .admin-level-actions-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
    }

    .admin-level-title-wrap {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
        font-size: 1rem !important;
        padding-bottom: 10px !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .admin-level-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 4px !important;
    }

    .admin-level-actions .neon-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 6px !important;
        font-size: 0.78rem !important;
        margin: 0 !important;
        white-space: nowrap !important;
        border-radius: 8px !important;
    }

    /* --------------------------------------------------------- */
    /* 2. ROUTES TAB CARD LAYOUT                                 */
    /* --------------------------------------------------------- */
    .routes-table {
        display: block !important;
        width: 100% !important;
        border-collapse: separate !important;
    }

    .routes-table thead {
        display: none !important;
    }

    .routes-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 14px !important;
        width: 100% !important;
    }

    .routes-table tbody tr,
    .admin-route-row {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: rgba(17, 19, 28, 0.85) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        box-sizing: border-box !important;
        height: auto !important;
        gap: 10px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
    }

    .routes-table tbody tr td {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
    }

    .admin-route-team-cell {
        font-size: 1.05rem !important;
        font-weight: 700 !important;
        color: #fff !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .admin-route-type-cell {
        margin-bottom: 2px !important;
    }

    .route-type-badge {
        font-size: 0.78rem !important;
        padding: 3px 8px !important;
        border-radius: 6px !important;
        background: rgba(0, 240, 255, 0.1) !important;
        border: 1px solid rgba(0, 240, 255, 0.2) !important;
        display: inline-block !important;
    }

    .admin-route-steps-cell {
        background: rgba(0, 0, 0, 0.3) !important;
        padding: 10px 12px !important;
        border-radius: 10px !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        box-sizing: border-box !important;
    }

    .route-sequence {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        align-items: center !important;
    }

    .route-step {
        background: rgba(0, 240, 255, 0.12) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
        color: #ffffff !important;
        padding: 4px 8px !important;
        border-radius: 6px !important;
        font-size: 0.78rem !important;
        font-weight: 600 !important;
    }

    .route-arrow {
        color: var(--neon-cyan) !important;
        font-size: 0.7rem !important;
    }

    .admin-route-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        width: 100% !important;
        margin-top: 4px !important;
    }

    .admin-route-actions .neon-btn {
        width: 100% !important;
        justify-content: center !important;
        padding: 9px 8px !important;
        font-size: 0.8rem !important;
        margin: 0 !important;
        border-radius: 8px !important;
    }

    /* --------------------------------------------------------- */
    /* 3. CREDENTIALS / TEAMS TAB CARD LAYOUT                   */
    /* --------------------------------------------------------- */
    .credentials-table {
        display: block !important;
        width: 100% !important;
    }

    .credentials-table thead {
        display: none !important;
    }

    .credentials-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
    }

    .credentials-table tbody tr {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        background: rgba(17, 19, 28, 0.85) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
        border-radius: 14px !important;
        padding: 14px !important;
        box-sizing: border-box !important;
        gap: 8px !important;
    }

    .credentials-table tbody tr td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 4px 0 !important;
        border: none !important;
        font-size: 0.85rem !important;
    }

    .credentials-table tbody tr td:last-child {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        padding-top: 10px !important;
        margin-top: 4px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .credentials-table tbody tr td:last-child .neon-btn {
        width: 100% !important;
        justify-content: center !important;
        font-size: 0.78rem !important;
        padding: 8px !important;
    }
}

/* Ensure buttons inside admin cards receive all touch/click events on mobile */
.admin-level-actions,
.admin-route-actions {
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
}

.admin-level-actions .neon-btn,
.admin-route-actions .neon-btn {
    position: relative !important;
    z-index: 10 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(0, 240, 255, 0.4) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Touch target fixes for admin level buttons */
.admin-level-actions {
    position: relative !important;
    z-index: 50 !important;
    pointer-events: auto !important;
}

.admin-level-actions .neon-btn {
    position: relative !important;
    z-index: 50 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(0, 240, 255, 0.4) !important;
}

/* Fix mobile navigation & sidebar overlay touch blocking */
.mobile-nav-overlay:not(.active),
.mobile-sidebar-overlay:not(.active) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Auth View card and tab buttons priority touch targets */
.auth-card {
    position: relative !important;
    z-index: 10 !important;
}

.tab-buttons .tab-btn,
#vkOrgLoginContainer button {
    position: relative !important;
    z-index: 20 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
}

/* Inline Level Accordion Editor Styling */
.admin-inline-row {
    background: transparent !important;
}

.level-inline-slot {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

.level-inline-slot .glass-card {
    background: rgba(11, 15, 25, 0.95) !important;
    border: 1px solid rgba(0, 240, 255, 0.35) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 240, 255, 0.15) !important;
    border-radius: 14px !important;
}

.admin-level-row.inline-editor-active {
    border-color: rgba(0, 240, 255, 0.6) !important;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.25) !important;
    background: rgba(0, 240, 255, 0.08) !important;
}
