:root {
    --primary: #10b981;
    /* Emerald Green */
    --primary-glow: rgba(16, 185, 129, 0.4);
    --accent: #fbbf24;
    /* Amber Gold */
    --bg-deep: #022c22;
    /* Very deep Emerald/Slate green base */
    --glass: rgba(255, 255, 255, 0.04);
    --glass-heavy: rgba(255, 255, 255, 0.08);
    --text: #f0fdf4;
    --text-muted: #64748b;
    --trans: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-deep);
    color: #ffffff;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* Optimized Aura Mesh Background */
.nebula-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #022c22;
    z-index: 1;
    overflow: hidden;
    will-change: auto;
}

.nebula-bg::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
}

.nebula-blob {
    position: absolute;
    filter: blur(60px);
    border-radius: 50%;
    opacity: 0.4;
    mix-blend-mode: screen;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.nebula-1 {
    width: 80vw;
    height: 80vw;
    background: radial-gradient(circle, #059669 0%, transparent 70%);
    top: -20%;
    left: -10%;
    animation: aura 30s infinite alternate linear;
}

.nebula-2 {
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, #047857 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation: aura 40s infinite alternate-reverse linear;
}

@keyframes aura {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }

    100% {
        transform: translate3d(30px, 15px, 0) rotate(5deg);
    }
}

#main-container {
    position: relative;
    z-index: 10;
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    z-index: 1;
    background: var(--bg-deep);
}

.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -9999 !important;
}

/* REGISTRATION SCREEN PREMIUM UI */
#screen-registration {
    justify-content: center;
    align-items: center;
    padding: 2rem;
    min-height: 100vh;
}

.registration-card {
    width: 100%;
    max-width: 400px;
    background: rgba(2, 44, 34, 0.8);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 32px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
    animation: fadeIn 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.registration-header {
    margin-bottom: 1rem;
}

.registration-header h2 {
    font-size: 1.8rem;
    margin: 1rem 0 0.2rem;
    font-weight: 800;
}

.registration-header p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.reg-form .input-group {
    margin-bottom: 0.8rem;
    text-align: left;
}

.reg-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 5px;
}

/* SLEEK FLOATING HEADER */
header {
    margin: calc(1rem + env(safe-area-inset-top)) 1rem 0.5rem;
    padding: 0.7rem 1.2rem;
    background: rgba(6, 78, 59, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.logo {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.menu-btn {
    width: 32px;
    height: 32px;
    background: var(--glass-heavy);
    border: 0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.menu-btn span {
    width: 16px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
}

/* CONTENT AREA */
#content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-bottom: 2rem;
}

.user-badge {
    background: var(--primary);
    color: #fff;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* PREMIUM SIDEBAR - ALIGNED LEFT */
.side-menu {
    position: fixed;
    top: 1.5rem;
    bottom: 1.5rem;
    left: -320px;
    width: 280px;
    background: rgba(2, 44, 34, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1000;
    transition: 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 24px;
    padding: 2.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.7);
    will-change: left;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Фикс прокрутки */
    scrollbar-width: none;
}
.side-menu::-webkit-scrollbar { display: none; }

.side-menu.open {
    left: 1rem;
}

.menu-header {
    margin-bottom: 3.5rem;
    text-align: left;
    padding-left: 1rem;
}

.menu-header .logo {
    font-size: 1.6rem;
}

.menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 1rem 1.2rem;
    color: #cbd5e1;
    background: none;
    border: 0;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    border-radius: 14px;
    transition: var(--trans);
    text-align: left;
    justify-content: flex-start;
}

.menu-item:hover {
    background: var(--glass);
    color: #fff;
}

.menu-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px var(--primary-glow);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 500;
}

/* HOME ACTION CARD */
.home-card {
    text-align: center;
    padding: 2.5rem 1rem;
    animation: fadeIn 0.8s ease-out;
}

.home-card h1 {
    font-size: 2.6rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.home-card p {
    color: #94a3b8;
    font-size: 1rem;
    margin-bottom: 3rem;
}

/* CARDS REFINEMENT */
.card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 1.8rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #059669);
    color: #fff;
    border: none;
    padding: 1.2rem;
    border-radius: 18px;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 8px 25px var(--primary-glow);
    transition: var(--trans);
}

.btn-primary:active {
    transform: scale(0.97);
}

input, select, textarea, button {
    font-family: inherit;
    color: #ffffff !important;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

input {
    width: 100%;
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.1rem;
    border-radius: 16px;
    color: #ffffff !important;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: var(--trans);
}

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.1rem;
    border-radius: 16px;
    color: #ffffff !important;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    transition: var(--trans);
    appearance: none;
}

/* Стили для выпадающих списков datalist в некоторых браузерах */
option {
    background: #022c22;
    color: #ffffff;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
    outline: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TASK NAVIGATION ACTIONS */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    transition: opacity 0.5s ease;
}

.nav-container.hidden-nav {
    opacity: 0;
    pointer-events: none;
}

.btn-nav {
    background: var(--glass-heavy);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--trans);
    flex: 1;
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-nav:not(:disabled):active {
    transform: scale(0.95);
    background: var(--primary);
}

.choice-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 1.2rem 1rem;
    border-radius: 18px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--trans);
    text-align: center;
    backdrop-filter: blur(10px);
}

.choice-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.choice-btn:active {
    transform: scale(0.97);
}

.narrative-text {
    background: rgba(255, 255, 255, 0.03);
    padding: 24px;
    border-radius: 24px;
    line-height: 1.7;
    font-size: 1.2rem;
    color: #f1f5f9;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-family: inherit;
    text-align: left;
}

/* LEADERBOARD TABS */
.rank-tabs {
    display: flex;
    gap: 8px;
    margin: 15px 20px 5px;
    background: rgba(0,0,0,0.2);
    padding: 6px;
    border-radius: 14px;
}

.rank-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--trans);
}

.rank-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* TEACHER DASHBOARD TABLE */
.teacher-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: 10px;
}

.teacher-table th {
    text-align: left;
    padding: 10px 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 800;
}

.teacher-table td {
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}

/* Profile Styles */
.profile-banner {
    width: 100%;
    height: 160px;
    background: linear-gradient(45deg, var(--primary), #3b82f6);
    border-radius: 0 0 30px 30px;
    position: relative;
    overflow: hidden;
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-header-ui {
    margin-top: -60px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 10;
    position: relative;
}

.profile-avatar-ui {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 5px solid var(--bg-deep);
    background: var(--bg-deep);
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.profile-info-card {
    width: 100%;
    margin-top: 15px;
}

.media-grid-ui {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 25px;
}

.media-item-ui {
    aspect-ratio: 1;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}

.media-item-ui img, .media-item-ui video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-mod-panel {
    margin-top: 30px;
    padding: 20px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-around;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.edit-overlay {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.teacher-table tr td:first-child {
    border-left: 1px solid rgba(255,255,255,0.05);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.teacher-table tr td:last-child {
    border-right: 1px solid rgba(255,255,255,0.05);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Avatar Selector Modal */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
    padding: 20px;
}

.avatar-option {
    width: 70px;
    height: 70px;
    border-radius: 16px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.3s;
    background: var(--glass);
    object-fit: cover;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.avatar-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}