:root {
    /* Cyber-Noir Palette */
    --bg-obsidian: #05070a;
    --bg-card: rgba(10, 15, 25, 0.7);
    --bg-panel: rgba(5, 10, 15, 0.85);
    --primary: #00f2ff;
    /* Neon Cyan */
    --primary-glow: rgba(0, 242, 255, 0.3);
    --secondary: #bc00ff;
    /* Neon Purple */
    --secondary-glow: rgba(188, 0, 255, 0.2);
    --accent: #00ff9d;
    /* Matrix Green */
    --warning: #ffaa00;
    /* Neon Amber */
    --error: #ff0055;
    /* Cyber Red */
    --text-main: #e0faff;
    --text-muted: #88a0a8;
    --border: rgba(0, 242, 255, 0.15);
    --border-bright: rgba(0, 242, 255, 0.4);
    --glass: rgba(255, 255, 255, 0.02);
    --panel-shadow: 0 0 30px rgba(0, 0, 0, 0.5);

    --font-main: 'Inter', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;
}

@keyframes scanline {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(100%);
    }
}

@keyframes flicker {
    0% {
        opacity: 0.97;
    }

    5% {
        opacity: 0.95;
    }

    10% {
        opacity: 0.99;
    }

    15% {
        opacity: 0.93;
    }

    20% {
        opacity: 0.98;
    }

    25% {
        opacity: 0.95;
    }

    30% {
        opacity: 0.97;
    }

    100% {
        opacity: 1;
    }
}

@keyframes pulse-border {
    0% {
        border-color: var(--border);
        box-shadow: 0 0 5px transparent;
    }

    50% {
        border-color: var(--primary);
        box-shadow: 0 0 15px var(--primary-glow);
    }

    100% {
        border-color: var(--border);
        box-shadow: 0 0 5px transparent;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-obsidian);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image:
        linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 242, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Scanline Effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 242, 255, 0.05);
    opacity: 0.4;
    z-index: 1000;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography Overrides */
h1,
h2,
h3,
h4,
h5 {
    letter-spacing: -0.02em;
    text-transform: uppercase;
    font-weight: 800;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--primary-glow));
    margin-bottom: 2rem;
    line-height: 1.2;
}

/* Header & Nav */
header {
    padding: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

header a {
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

.nav-btn:hover {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

/* Cards & Panels */
.card,
.panel {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.form-container {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow), inset 0 0 10px rgba(0, 242, 255, 0.05);
}

.card::before,
.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0.5;
}

/* Dashboard Specifics */
.mission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 5rem;
}

.card {
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Badges */
.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.badge {
    background: rgba(0, 242, 255, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
}

.xp-badge {
    background: rgba(0, 255, 157, 0.1);
    color: var(--accent);
    border-color: rgba(0, 255, 157, 0.2);
}

/* Buttons */
button,
.btn-primary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 1rem 2rem;
    border-radius: 4px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

button::after,
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 242, 255, 0.2), transparent);
    transition: 0.5s;
}

button:hover::after,
.btn-primary:hover::after {
    left: 100%;
}

button:hover,
.btn-primary:hover {
    background: var(--primary);
    color: var(--bg-obsidian);
    box-shadow: 0 0 30px var(--primary-glow);
    transform: scale(1.02);
}

/* Forms */
.form-container {
    padding: 4rem;
    max-width: 600px;
    margin: 4rem auto;
    width: 100%;
}

.form-group {
    margin-bottom: 2.5rem;
}

label {
    display: block;
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 1.2rem;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1rem;
    transition: all 0.3s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(0, 242, 255, 0.05);
}

/* Workspace Panels */
.workspace {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    /* Important for flex child to be scrollable */
    margin-bottom: 2rem;
}

.panel-header {
    background: rgba(0, 242, 255, 0.05);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: 0.9rem;
    color: var(--primary);
    margin: 0;
}

.panel-content {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* Radial Level Hub - Cyber Style */
.level-hub-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.radial-level-hub {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0deg, var(--primary) var(--angle, 0deg), rgba(255, 255, 255, 0.1) var(--angle, 0deg), rgba(255, 255, 255, 0.1) 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 0 15px var(--primary-glow);
}

.radial-level-hub::after {
    content: "";
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--bg-obsidian);
    border-radius: 50%;
    z-index: 1;
}

.hub-level-num {
    z-index: 2;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.hub-stats {
    display: flex;
    flex-direction: column;
}

.hub-xp-total {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--text-main);
}

.hub-xp-next {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Landing Page Hero */
.hero {
    height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    position: relative;
}

.hero::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    background: var(--primary-glow);
    filter: blur(150px);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.hero h1 {
    font-size: 8rem;
    line-height: 0.9;
    margin-bottom: 2rem;
}

/* Animations */
.animate-up {
    animation: flicker 0.5s ease forwards;
}

/* Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin: 5rem 0;
}

.feature-card {
    padding: 3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
}

.feature-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

/* Footer */
.landing-footer {
    border-top: 1px solid var(--border);
    padding: 5rem 0;
    background: rgba(0, 0, 0, 0.4);
}

.completed-card {
    opacity: 0.4;
    filter: grayscale(0.8);
    pointer-events: none;
}

.badge-container .badge {
    margin-bottom: 0.5rem;
}

/* Code Editor Styling */
.editor {
    background: #000;
    color: #00f2ff;
    padding: 2rem;
    font-family: var(--font-mono);
    line-height: 1.6;
    border: none;
    width: 100%;
    height: 100%;
    resize: none;
    outline: none;
}

/* Admin Specific */
.admin-tab-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
}

.admin-tab-btn.active {
    background: var(--primary);
    color: var(--bg-obsidian);
    border-color: var(--primary);
}

/* Navigation Refactor */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 0;
    position: absolute;
    width: 100%;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.1em;
}

.steps-container {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
}


/* Section Headers */
.section-tag {
    color: var(--primary);
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    font-family: var(--font-mono);
    display: block;
    margin-bottom: 1.5rem;
    text-align: center;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 3rem;
    font-weight: 900;
    text-align: center;
}

/* Hero Content */
.hero-content {
    max-width: 900px;
    text-align: center;
}

.hero-content h1 span {
    color: var(--primary);
    filter: drop-shadow(0 0 20px var(--primary-glow));
}

/* Stats */
.stats-container {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
}



/* Form Layouts */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Workspace Specifics */
.workspace-body {
    overflow: hidden;
}

.workspace-container {
    max-width: 100%;
    padding: 0 2rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.workspace-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}


.card.locked {
    opacity: 0.6;
    filter: grayscale(0.8);
    cursor: not-allowed;
    position: relative;
    overflow: hidden;
}


.workspace-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

@media (max-width: 480px) {
    .card-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header-flex .badge {
        margin-top: 0.5rem;
    }
}

/* Profile Styles */
.profile-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    margin-top: 3rem;
}

.subject-identity {
    background: var(--bg-card);
    padding: 3rem 2rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    text-align: center;
    height: fit-content;
    position: relative;
    overflow: hidden;
}

.subject-identity::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.avatar-frame {
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
    border: 2px solid var(--primary);
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    position: relative;
}

.avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.form-panel {
    background: var(--bg-panel);
    padding: 0;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.panel-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 242, 255, 0.03);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.panel-header h2 {
    font-size: 1rem;
    letter-spacing: 0.2em;
    font-family: var(--font-mono);
    margin: 0;
    color: var(--primary);
}

.panel-body {
    padding: 2.5rem 2rem;
}

.avatar-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.avatar-node {
    cursor: pointer;
    border: 1px solid var(--border);
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.avatar-node:hover {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
}

.avatar-node.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(0, 242, 255, 0.1);
}

.avatar-node img {
    width: 100%;
    display: block;
}

.alert {
    padding: 1.25rem 2rem;
    border-radius: 4px;
    margin-bottom: 3rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-error {
    background: rgba(255, 0, 85, 0.05);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-info {
    background: rgba(0, 255, 157, 0.05);
    border: 1px solid var(--accent);
    color: var(--accent);
}

/* Auth Styles */
.auth-container {
    max-width: 600px;
    margin: 6rem auto;
    padding: 0 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 3rem;
}

.auth-footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 800;
}

.error-message {
    background: rgba(255, 0, 85, 0.05);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.success-message {
    background: rgba(0, 255, 157, 0.05);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.system-id {
    color: var(--primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    margin-bottom: 1rem;
    display: block;
}

.captcha-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.captcha-image-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.captcha-image {
    border-radius: 2px;
    width: 100%;
    height: auto;
    max-height: 50px;
    filter: invert(1) hue-rotate(180deg) brightness(1.5);
    border: 1px solid var(--border);
}

.refresh-captcha {
    background: none;
    border: none !important;
    box-shadow: none !important;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.65rem;
    text-decoration: none;
    padding: 0;
    width: auto;
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
}

.refresh-captcha:hover {
    color: var(--text-main);
    transform: none !important;
}

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 1.2rem;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    appearance: none;
    cursor: pointer;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .hero h1 {
        font-size: 5rem;
    }

    .workspace {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: visible;
        display: block;
        /* Override grid */
    }

    .panel {
        margin-bottom: 2rem;
        height: auto;
    }

    .panel-content {
        max-height: none;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    :root {
        --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    }

    body {
        background-size: 30px 30px;
    }

    /* Navigation */
    nav.container,
    header {
        flex-direction: column;
        gap: 1rem;
        position: relative !important;
        transform: none !important;
        left: auto !important;
        padding: 1rem !important;
        width: 100% !important;
        background: var(--bg-obsidian);
        /* Ensure background covers content */
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
    }

    .nav-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }

    /* Hero Section */
    .hero {
        height: auto;
        min-height: 80vh;
        padding: 6rem 1rem 3rem;
        flex-direction: column;
    }

    .hero h1 {
        font-size: 2.5rem;
        line-height: 1.2;
        word-break: break-word;
    }

    .hero p {
        font-size: 1rem !important;
    }

    .stats-container {
        gap: 2rem !important;
        flex-direction: column;
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Mission Workflow */
    .steps-container {
        flex-direction: column;
    }


    .step-card {
        margin-bottom: 1rem;
    }

    .fa-chevron-right {
        transform: rotate(90deg);
        margin: 1rem 0;
    }

    /* Forms */
    .form-container {
        padding: 1.5rem;
        margin: 2rem auto;
    }

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

    /* Dashboard */
    .mission-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-links {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-col {
        text-align: center !important;
        align-items: center;
    }

    .footer-col h5 {
        margin-bottom: 1rem;
    }

    /* Mission Workspace */
    .workspace {
        display: flex;
        flex-direction: column;
        height: auto;
        margin-bottom: 2rem;
    }

    .workspace-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .workspace-header>div {
        justify-content: space-between;
    }

    .panel {
        height: auto;
        min-height: auto;
        margin-bottom: 1rem;
    }

    .panel-content {
        overflow-y: visible;
        padding: 1rem;
    }

    #monaco-editor-container {
        min-height: 60vh;
    }

    /* Profile */
    .profile-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .stats-container {
        gap: 2rem;
    }

    /* Login/Register Mobile Fixes */
    .auth-container {
        padding: 0 1rem;
        margin: 4rem auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .hero h1 {
        font-size: 2.5rem !important;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-btn {
        width: 100%;
        text-align: center;
    }

    .level-hub-container {
        justify-content: center;
    }
}
