body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none;
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    line-height: 1.6;
}

body::-webkit-scrollbar {
    display: none;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #151515;
    --bg-card: #1a1a1a;
    --accent: #00ff88;
    --accent-dim: #00ff8844;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border: #2a2a2a;
}

/* Navigation */
nav {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    margin: 0 auto;
    /* ← вместо left: 50% + transform */
    width: min(calc(100% - 40px), 1200px);
    /* ← было 12% */
    transform: translateX(-50%);
    /* центрирует относительно left: 50% */
    width: min(calc(100% - 40px), 1200px);
    box-sizing: border-box;
    padding: 0.8rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    z-index: 1000;

    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    animation: fadeInDown 0.8s ease forwards;
    transition: all 0.3s ease;
}

.logo {
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Nav Right Items */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    flex-shrink: 1;
    overflow: hidden;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 3px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    /* never squish the lang switcher */
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease;
}

.lang-btn.active {
    color: var(--text-primary);
}

/* The sliding animated pill */
.lang-switcher::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    height: calc(100% - 6px);
    width: calc(50% - 3px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1;
}

/* Toggle position based on which is active 
   (Assuming RU is left and EN is right) */
.lang-switcher[data-active="en"]::before {
    transform: translateX(100%);
}

.logo-m {
    font-family: 'Space Mono', monospace;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    text-align: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    width: 100%;
    height: 100%;
}

.modal-content,
.modal-content-2 {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    width: 90%;
    font-family: 'Space Mono', monospace;
    max-width: 380px;
    padding: 50px 30px 40px;
    border-radius: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    color: white;
}

.modal.show .modal-2.show {
    display: block;
}

.modal.active .modal-2.show {
    display: flex;
}


.arr-lef,
.arr-lef-2 {
    position: absolute;
    top: 25px;
    left: 25px;
    cursor: pointer;
    z-index: 10;
}

.log {
    margin-top: 30px;
    text-align: center;
    font-size: 15px;
    white-space: nowrap;
}

.log a {
    color: white !important;
    /* белый цвет */
    text-decoration: none;
    /* убрать подчеркивание */
    margin-left: 5px;
    /* небольшой отступ */
}

.log a:hover {
    text-decoration: underline;
    /* подчеркивание при наведении */
    opacity: 0.8;
}

.log a:visited {
    color: white !important;
    /* белый даже после клика */
}

.reg-c {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.reg,
.pass,
.enter,
.email {
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
    /* CRITICAL: includes padding in width! */
}

.reg,
.pass,
.email {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    font-family: 'Space Mono', monospace;
    padding: 15px 20px;
    font-size: 16px;
    color: white;
    outline: none;
    box-shadow: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.pass-wrapper {
    position: relative;
    width: 100%;
}

.reg::placeholder,
.pass::placeholder,
.email::placeholder {
    color: rgba(255, 255, 255, 0.6);
    /* прозрачный placeholder */
}

.reg:focus,
.pass:focus,
.email:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.enter {
    -webkit-appearance: none;
    appearance: none;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 16px;
    font-family: 'Space Mono', monospace;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.571);
    box-shadow: none;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.enter:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.3);
}

.enter:active {
    transform: translateY(0);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    margin-left: auto;
    flex-wrap: nowrap;
    min-width: 0;
    max-width: calc(100vw - 140px);
    overflow: hidden;
}

.nav-links li {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* userArea — выровнен по gap как остальные пункты */
#userArea {
    position: relative;
    display: flex;
    align-items: center;
}

#userNick {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    flex-shrink: 1;
    min-width: 0;
}

/* iOS 26 Liquid Glass Avatar in Navbar */
.nav-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.18),
        0 4px 16px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(12px) saturate(1.4);
    -webkit-backdrop-filter: blur(12px) saturate(1.4);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
    margin-right: 6px;
    pointer-events: none;
}

.nav-avatar:hover {
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.25),
        0 6px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
}

.hero-content {
    text-align: center;
    z-index: 1;
}

h1 {
    font-size: 6rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.3s forwards;
}

.gradient-text {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInUp 1s ease 0.5s forwards;
}

.cta-button {
    display: inline-block;
    padding: 1.2rem 3rem;
    background: linear-gradient(135deg,
            rgba(10, 155, 10, 0.062) 0%,
            rgba(10, 155, 10, 0.062) 50%,
            rgba(10, 155, 10, 0.062) 100%);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.411);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.08),
        inset 0 1px 1px rgba(255, 255, 255, 0.35),
        inset 0 -1px 1px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    animation: fadeInUp 1s ease 0.7s forwards;
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%,
            rgba(255, 255, 255, 0.25) 0%,
            transparent 60%);
    pointer-events: none;
    transition: transform 0.5s ease;
}

.cta-button:hover::before {
    transform: translate(10%, 10%);
}

.cta-button:hover {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.25) 0%,
            rgba(255, 255, 255, 0.10) 50%,
            rgba(255, 255, 255, 0.18) 100%);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.45),
        inset 0 -1px 1px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

.cta-button:active {
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 50%,
            rgba(255, 255, 255, 0.08) 100%);
    transform: scale(0.97);
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.10),
        inset 0 1px 1px rgba(255, 255, 255, 0.20),
        inset 0 -1px 1px rgba(0, 0, 0, 0.04);
}

.features {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 4rem;
}

.features-grid {
    display: grid;
    grid-template-columns: 2fr 1.4fr;
    grid-auto-rows: 220px;
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border-radius: 32px;
    border: 1px solid var(--border);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 60%);
    pointer-events: none;
    z-index: 1;
}

/* PixelBlast canvas background */
.pb-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    border-radius: inherit;
}

.pb-canvas canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: inherit;
}

/* Keep text content above canvas */
.card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.feature-card:hover {
    border-color: var(--accent);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.feature-main {
    grid-row: span 2;
}

.feature-side {
    display: flex;
    align-items: flex-end;
}

.feature-wide {
    grid-column: span 2;
}

.feature-wide .card-content {
    align-items: center;
    text-align: center;
}

.feature-main .card-content {
    align-items: flex-start;
    text-align: left;
}

.feature-eyebrow {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: white;
    margin: 0;
    text-shadow: 0 0 12px rgba(0, 255, 136, 0.9), 0 1px 4px rgba(0, 0, 0, 0.8);
}

.feature-card h3,
.feature-card h4 {
    margin: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.feature-card h3 {
    font-size: 1.9rem;
}

.feature-card h4 {
    font-size: 1.3rem;
}

.feature-text {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    max-width: 26rem;
}

/* Folders Section */
.folders-section {
    padding: 8rem 4rem;
    background: var(--bg-secondary);
}

.folders-container {
    max-width: 1200px;
    margin: 0 auto;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.folder {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    opacity: 0;
    transform: scale(0.9);
}

.folder.visible {
    opacity: 1;
    transform: scale(1);
}

.folder:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 60px rgba(0, 255, 136, 0.2);
}

.folder-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.folder:hover .folder-icon {
    transform: rotateY(180deg);
}

.folder-name {
    font-size: 1.2rem;
    font-weight: 500;
}

.folder-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.add-folder {
    border: 2px dashed var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.add-folder:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    z-index: 9999;
    transform-origin: left;
    transform: scaleX(0);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.glass-modal {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    width: 50%;
    box-sizing: border-box;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.4s ease;
}

/* Результат теста */
.result-overlay {
    z-index: 1200;
}

.result-modal {
    max-width: 520px;
    width: 90%;
    padding: 30px;
}

.result-header h2 {
    font-size: 1.7rem;
    margin-bottom: 0.25rem;
}

.result-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quiz-result-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    margin-top: 1rem;
}

.quiz-result-circle {
    position: relative;
    width: 140px;
    height: 140px;
}

.quiz-result-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.qr-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 10;
}

.qr-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 439.82;
    stroke-dashoffset: 439.82;
    transition: stroke-dashoffset 0.9s ease;
}

.quiz-result-percent {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 600;
}

.quiz-result-details {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
}

.quiz-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.arr-lef-m {
    position: fixed;
    left: 25px;
    /* расстояние от левого края */
    top: 25px;
    /* расстояние от верхнего края */
    cursor: pointer;
    z-index: 100;
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    color: white;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.modal-header p {
    color: rgba(255, 255, 255, 0.7);
}

/* AI Analysis Animation */
.ai-analysis {
    text-align: center;
    padding: 40px 20px;
}

.loader {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    position: relative;
}

.loader-ring {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.analysis-text {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.analysis-details {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

/* Mode Selection */
.mode-selection {
    display: none;
}

.mode-selection.active {
    display: block;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #10b981;
    transform: translateY(-5px);
}

.mode-card.selected {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.mode-card h3 {
    color: white;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.mode-card p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Upload Section */
.upload-section {
    padding: 8rem 4rem;
    text-align: center;
}

.upload-area {
    max-width: 600px;
    margin: 3rem auto;
    padding: 4rem;
    border: 2px dashed var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.upload-area:hover .upload-icon {
    opacity: 1;
    transform: translateY(-10px);
}

.upload-area.hidden {
    display: none;
}

.loader {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Legacy chat styles removed — replaced by new glassmorphic styles below */

.typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.flashcards-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.quiz-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.flashcard-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.close-flashcards {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-flashcards:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.card-counter {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

.flashcard-wrapper {
    perspective: 1000px;
    width: 100%;
    max-width: 700px;
    height: 450px;
    margin: 0 auto;
    box-sizing: border-box;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}

.quiz-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 800px;
    width: 100%;
    padding: 40px 40px 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.quiz-header {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    width: calc(100% - 40px);
    margin: 0 auto;
}

/* Back button inside quiz — override fixed positioning from .arr-lef-m */
#quizBackBtn {
    position: static;
    display: none;
    /* hidden on first question */
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

#quizBackBtn:hover {
    opacity: 1;
    transform: translateX(-3px);
}

.quiz-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.quiz-progress {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.quiz-question {
    color: #ffffff;
    font-size: 1.6rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.quiz-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.quiz-option-letter {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.quiz-option.selected {
    border-color: rgba(16, 185, 129, 0.9);
    background: rgba(16, 185, 129, 0.15);
}

.quiz-option.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.2);
}

.quiz-option.wrong {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quiz-status {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

.quiz-next-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.quiz-next-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(16, 185, 129, 0.4);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-inner {
    position: relative;
    width: 80%;
    height: 80%;
    transform-style: preserve-3d;
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.flashcard-back {
    transform: rotateY(180deg);
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
}

.card-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.card-content {
    color: white;
    font-size: 1.8rem;
    text-align: center;
    line-height: 1.5;
    font-weight: 500;
    max-height: 300px;
    overflow-y: auto;
    padding: 0 20px;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

.flashcard-controls {
    position: absolute;
    bottom: 90px;
    display: flex;
    gap: 20px;
    max-width: 650px;
    width: 60%;
    padding: 0 20px;
    justify-content: center;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px 40px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

.nav-btn.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
}

.nav-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Адаптивность для мобилок */
@media (max-width: 768px) {
    .flashcard-wrapper {
        height: 400px;
        width: calc(100% - 40px);
        margin: 0 auto;
    }

    .card-content {
        font-size: 1.4rem;
        max-height: 250px;
    }

    .flashcard-controls {
        bottom: 20px;
        gap: 10px;
    }

    .nav-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .flashcard-header {
        padding: 0 20px;
    }

    .quiz-card {
        padding: 28px 20px 22px;
        border-radius: 24px;
    }

    .quiz-question {
        font-size: 1.3rem;
    }

    .quiz-option {
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .quiz-header {
        width: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    .flashcard-wrapper {
        height: 350px;
    }

    .flashcard-front,
    .flashcard-back {
        padding: 30px 20px;
        border-radius: 20px;
    }

    .card-content {
        font-size: 1.2rem;
        padding: 0 10px;
    }

    .nav-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .card-counter {
        font-size: 1rem;
    }

    .close-flashcards {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.card-content::-webkit-scrollbar {
    width: 6px;
}

.card-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.card-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.card-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.input-area button {
    width: 48px;
    height: 48px;
    padding: 0;
    /* убираем растянутый padding */
    background: #0e0e00;
    border: none;
    border-radius: 50%;
    /* ключевая строка */
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
    transition: background 0.2s;

    display: flex;
    /* центрируем иконку */
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.input-area button:hover {
    transform: translateY(-4px);
    /* поднимается вверх */
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
    /* тень для эффекта */
}

.input-area button:active {
    transform: translateY(-1px);
    /* чуть опускается */
}

.input-area button:disabled {
    background: #0e0e00;
    cursor: not-allowed;
}

/* Footer */
footer {
    padding: 4rem;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

/* Responsive */
@media only screen and (max-width: 768px) {
    .features {
        padding: 4rem 2rem;
    }

    .features-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }

    .feature-main,
    .feature-wide {
        grid-column: span 1;
        grid-row: span 1;
    }
}

@media only screen and (max-width: 480px) {
    nav {
        padding: 1rem 1rem;
        box-sizing: border-box;
    }

    .nav-links {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        list-style: none;
        margin-left: auto;
        padding: 0;
        flex-wrap: nowrap;
        justify-content: flex-end;
        min-width: 0;
        max-width: calc(100vw - 100px);
        overflow: hidden;
    }

    .nav-links a {
        font-size: 0.78rem;
    }

    #userNick {
        max-width: 70px;
        font-size: 0.78rem;
    }

    #userArea {
        display: flex;
        align-items: center;
        gap: 4px;
        min-width: 0;
        flex-shrink: 1;
        margin-left: 16px;
    }

    .nav-avatar {
        width: 34px;
        height: 34px;
        margin-right: 2px;
    }

    .logo-m {
        font-size: 32px;
    }

    .modal-content,
    .modal-content-2 {
        width: 92%;
        padding: 40px 20px 30px;
        border-radius: 20px;
    }

    .reg,
    .pass,
    .enter,
    .email {
        margin-bottom: 10px;
        /* отступ снизу */
        width: 100%;
        /* на всю ширину */
    }

    .reg,
    .pass,
    .email {
        background: rgba(255, 255, 255, 0.15);
        /* прозрачный фон */
        border: 1px solid rgba(255, 255, 255, 0.3);
        /* прозрачная рамка */
        border-radius: 50px;
        /* округлые края как в iOS */
        font-family: 'Space Mono', monospace;
        padding: 10px 5px;
        font-size: 16px;
        color: white;
        /* цвет текста */
        outline: none;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
        /* эффект размытия */
    }

    .enter {
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 50px;
        padding: 10px 5px;
        font-size: 16px;
        font-family: 'Space Mono', monospace;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.571);
        cursor: pointer;
        transition: all 0.3s ease;
        backdrop-filter: blur(10px);
    }

    .reg-c {
        margin-top: 15px;
    }

    .log {
        margin-top: 10px;
        text-align: center;
        font-size: 10px;
        white-space: nowrap;
    }

    .log a {
        color: white !important;
        /* белый цвет */
        text-decoration: none;
        /* убрать подчеркивание */
        margin-left: 5px;
        /* небольшой отступ */
    }

    h1 {
        font-size: 3rem;
    }

    .modal-overlay {
        padding: 0;
        align-items: center;
        overflow-y: auto;
    }

    .mode-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 12px;
        overflow: visible;
    }

    .mode-card {
        padding: 5px 10px;
    }

    .glass-modal {
        width: 92%;
        max-width: 380px;
        padding: 24px 20px;
        border-radius: 20px;
        max-height: 85vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        margin: 0 auto;
    }

    .modal-header {
        text-align: center;
        margin-bottom: 45px;
    }

    .modal-header h2 {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }

    .modal-header p {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }

    .mode-card {
        padding: 5px 10px;
    }

    .mode-icon {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }

    .mode-card h3 {
        font-size: 0.95rem;
        margin-bottom: 5px;
    }

    .mode-card p {
        font-size: 0.75rem;
    }


    .btn {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .glass-modal::-webkit-scrollbar {
        width: 6px;
    }

    .glass-modal::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: 3px;
    }

    .glass-modal::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

    .glass-modal::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }

    .modal-header h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .modal-header p {
        font-size: 0.85rem;
    }

    .mode-card h3 {
        font-size: 1rem;
    }

    .mode-card p {
        font-size: 0.8rem;
    }

    .btn {
        margin-top: 5px;
        padding: 12px 30px;
        font-size: 1rem;
    }

    /* AI анализ */
    .loader {
        width: 60px;
        height: 60px;
        margin-bottom: 20px;
    }

    .analysis-text {
        font-size: 1rem;
    }

    .analysis-details {
        font-size: 0.85rem;
    }

    /* Кнопка назад */
    .arr-lef-m {
        width: 20px;
        left: 15px;
        top: 15px;
    }
}

.hero-subtitle {
    font-size: 1.2rem;
}

.folders-section,
.upload-section {
    padding: 4rem 2rem;
}

.folder-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* ===========================
   LANGUAGE SWITCHER
   =========================== */
/* ===========================
   LANGUAGE SWITCHER
   =========================== */
.lang-switcher {
    position: relative;
    /* Pushing it down to align with text */
    top: 2px;
    margin-left: 15px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0;
    /* Remove padding to look like text */
    margin: 0;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: var(--text-primary);
    background: transparent;
    /* No background on hover */
}

.lang-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.lang-arrow {
    transition: transform 0.3s ease;
    color: currentColor;
}

.lang-btn[aria-expanded="true"] .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 140px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 9999;
    /* Animation */
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.lang-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.lang-option {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-primary);
}

.lang-option.active {
    color: var(--accent);
    background: rgba(0, 255, 136, 0.07);
}

/* ===========================
   PASSWORD EYE TOGGLE
   =========================== */
.pass-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.pass-wrapper .pass {
    margin-bottom: 0 !important;
    padding-right: 48px !important;
    width: 100%;
}

.eye-btn {
    position: absolute;
    right: 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
    flex-shrink: 0;
}

.eye-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

.eye-icon {
    display: block;
    transition: transform 0.3s ease, opacity 0.2s;
}

/* Eye open → closed animation */
.eye-btn.eye-visible .eye-icon {
    transform: scale(0.9);
}

.eye-btn.eye-visible .eye-open {
    display: none;
}

.eye-btn.eye-visible .eye-closed {
    display: block !important;
}

/* ===========================
   FORGOT PASSWORD
   =========================== */
.forgot-pass {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
    margin-top: 8px;
    margin-bottom: 2px;
    transition: color 0.2s;
}

.forgot-pass:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Forgot password sub-form */
.forgot-form {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 10px;
}

.forgot-form.visible {
    display: flex;
}

.forgot-back {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    padding: 0;
    font-family: 'DM Sans', sans-serif;
    transition: color 0.2s;
}

.forgot-back:hover {
    color: white;
}

.forgot-msg {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 6px;
    min-height: 20px;
}

/* Header Layout Adjustments */
.logo {
    justify-self: start;
}

.nav-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-nick {
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 30px;
    justify-self: center;
    /* Center the nav links in the middle column */
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    padding: 3px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 16px;
    transition: all 0.3s ease;
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Login Button */
.loginBtn {
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    padding: 8px 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.loginBtn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.btn-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.loginBtn:hover .btn-glow {
    opacity: 0.5;
}



/* Mobile Responsive */
@media (max-width: 768px) {
    nav {
        padding: 0.6rem 1rem;
        gap: 10px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-right {
        gap: 10px;
    }

    .user-nick {
        max-width: 80px;
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .nav-avatar {
        width: 32px;
        height: 32px;
        margin-right: 4px;
    }
}

/* ============================
   CHAT UI — ChatGPT/Claude style
   position: fixed so layout is
   always reliable
   ============================ */

/* The container covers the whole screen like a full-page chat */
.chat-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    background: var(--bg-primary);
    animation: fadeIn 0.4s ease forwards;
    display: flex;
    flex-direction: column;
}

/* Inner wrapper — mirrors ChatGPT's max-width column */
.chat-inner {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    /* centers horizontally without breaking height */
    flex: 1;
    min-height: 0;
    /* CRITICAL for overflow scroll to work */
    display: flex;
    flex-direction: column;
    padding: 80px 16px 0;
    box-sizing: border-box;
}

/* File info header */
.file-info {
    flex-shrink: 0;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 10px 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 16px;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}



/* Sticky bottom input wrapper — fixed to bottom of viewport */
.chat-input-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(to top, var(--bg-primary) 70%, transparent);
    z-index: 501;
}

.input-area {
    width: 100%;
    max-width: 800px;
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(20, 20, 26, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 8px 8px 8px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-sizing: border-box;
}

.input-area:focus-within {
    border-color: rgba(0, 255, 136, 0.35);
    box-shadow:
        0 0 0 3px rgba(0, 255, 136, 0.06),
        0 8px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: 'DM Sans', sans-serif;
    padding: 10px 0;
    caret-color: var(--accent);
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.28);
    font-style: italic;
}

#sendBtn {
    background: linear-gradient(135deg, var(--accent) 0%, #00b35f 100%);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
    flex-shrink: 0;
}

#sendBtn img {
    filter: brightness(0) invert(1);
    width: 22px;
    height: 22px;
    transition: transform 0.3s ease;
}

#sendBtn:hover {
    transform: scale(1.07);
    box-shadow: 0 6px 22px rgba(0, 255, 136, 0.5);
}

#sendBtn:hover img {
    transform: translateX(2px);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 14px 18px;
    font-size: 1rem;
    line-height: 1.65;
    animation: messageSlideUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(16px);
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@keyframes messageSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 255, 136, 0.06) 100%);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 20px 20px 4px 20px;
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.06);
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 20px 20px 20px 4px;
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    max-width: 90%;
}

.message.ai pre {
    background: rgba(0, 0, 0, 0.45);
    border-radius: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 10px 0;
}

.message.ai code {
    font-family: 'Space Mono', monospace;
    font-size: 0.88em;
    color: #e2b340;
}

.message.ai p {
    margin: 0 0 10px 0;
}

.message.ai p:last-child {
    margin-bottom: 0;
}

.message.ai ul,
.message.ai ol {
    padding-left: 1.4em;
    margin: 6px 0;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile responsive */
@media (max-width: 600px) {

    /* Mode Selection specific fixes for mobile */
    .mode-grid {
        grid-template-columns: 1fr;
        /* Stack vertically to save space */
        gap: 12px;
        margin-bottom: 20px;
        max-height: 60vh;
        overflow-y: auto;
        padding: 5px;
    }

    .mode-card {
        padding: 15px 15px;
        display: flex;
        align-items: center;
        text-align: left;
        gap: 15px;
    }

    .mode-icon {
        font-size: 2rem;
        margin-bottom: 0;
    }

    .mode-card h3 {
        margin-bottom: 4px;
        font-size: 1.1rem;
    }

    .mode-card p {
        font-size: 0.85rem;
    }

    .modal-header h2 {
        font-size: 1.5rem;
    }

    /* Chat UI fixes for mobile */
    .chat-inner {
        padding-top: 60px;
    }

    .message {
        max-width: 95%;
        font-size: 0.95rem;
        padding: 12px 14px;
    }

    .message.ai {
        max-width: 98%;
    }

    .chat-input-wrapper {
        padding: 10px;
    }

    .input-area {
        padding: 6px 6px 6px 14px;
        gap: 6px;
    }

    #messageInput {
        font-size: 0.95rem;
    }

    #sendBtn {
        width: 38px;
        height: 38px;
    }

    #sendBtn img {
        width: 18px;
        height: 18px;
    }
}

.chat-container {
    background: rgba(14, 14, 16, 0.75);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    height: 72vh;
    min-height: 520px;
    width: calc(100% - 32px);
    max-width: 940px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    animation: modalSlideUp 0.6s ease forwards;
}


.file-info {
    text-align: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 20px;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 18px;
    padding: 4px 14px 140px 4px;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 255, 136, 0.35) transparent;
}

.messages::-webkit-scrollbar {
    width: 5px;
    background: transparent;
}

.messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin: 12px 0;
}

.messages::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom,
            rgba(0, 255, 136, 0.5),
            rgba(0, 180, 100, 0.3));
    border-radius: 10px;
    transition: background 0.2s ease;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom,
            rgba(0, 255, 136, 0.8),
            rgba(0, 180, 100, 0.6));
}

.message {
    max-width: 85%;
    padding: 16px 20px;
    font-size: 1rem;
    line-height: 1.6;
    animation: messageSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
    position: relative;
    word-wrap: break-word;
}

@keyframes messageSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.15) 0%, rgba(0, 255, 136, 0.05) 100%);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 20px 20px 4px 20px;
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.05);
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px 20px 20px 4px;
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.message.ai pre {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 12px 16px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 12px;
    margin-bottom: 12px;
}

.message.ai code {
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
    color: #e2b340;
}

.message.ai p {
    margin: 0 0 10px 0;
}

.message.ai p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
    height: 24px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-primary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
    opacity: 0.7;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(18, 18, 22, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    padding: 10px 10px 10px 22px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 0 0 0 rgba(0, 255, 136, 0),
        0 8px 30px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    flex-shrink: 0;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-top: 0;
}

.input-area:focus-within {
    border-color: rgba(0, 255, 136, 0.35);
    box-shadow:
        0 0 0 3px rgba(0, 255, 136, 0.07),
        0 8px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    background: rgba(22, 22, 28, 0.92);
}

#messageInput {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: 'DM Sans', sans-serif;
    padding: 10px 0;
    caret-color: var(--accent);
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.28);
    font-style: italic;
}

#sendBtn {
    background: linear-gradient(135deg, var(--accent) 0%, #00b35f 100%);
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
    flex-shrink: 0;
}

#sendBtn img {
    filter: brightness(0) invert(1);
    width: 22px;
    height: 22px;
    transition: transform 0.3s ease;
}

#sendBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.45);
}

#sendBtn:hover img {
    transform: translateX(2px);
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile responsive for Quizzes and Flashcards */
@media (max-width: 768px) {

    /* Flashcards Adaptation */
    .flashcards-container {
        padding: 15px;
        box-sizing: border-box;
    }

    .flashcard-header {
        padding: 0 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .flashcard-wrapper {
        height: 350px;
        width: calc(100% - 40px);
        margin: 0 auto;
    }

    .flashcard-front h3,
    .flashcard-back h3 {
        font-size: 1.3rem;
    }

    .flashcard-front p,
    .flashcard-back p {
        font-size: 0.95rem;
    }

    .flashcard-controls button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Quiz Adaptation */
    .quiz-container {
        padding: 15px;
        box-sizing: border-box;
    }

    .quiz-card {
        padding: 25px 20px 20px;
        border-radius: 20px;
    }

    .quiz-header {
        width: calc(100% - 30px);
    }

    .quiz-progress {
        font-size: 0.9rem;
    }

    .quiz-question {
        font-size: 1.25rem;
        margin-bottom: 20px;
    }

    .quiz-option {
        padding: 10px 14px;
        font-size: 0.95rem;
        gap: 10px;
        border-radius: 14px;
    }

    .quiz-option-letter {
        width: 24px;
        height: 24px;
        font-size: 0.85rem;
    }

    .quiz-next-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .quiz-review-item {
        padding: 12px;
        font-size: 0.9rem;
    }
}

/* Quiz Review Screen */
.quiz-review-container {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
    width: 100%;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.quiz-review-container::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

.quiz-review-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.quiz-review-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
}

.review-q {
    color: white;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.review-ans {
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ans-correct {
    color: #10b981;
}

.ans-wrong {
    color: #f87171;
}

/* ==============================
   Profile Avatar Upload Styles
   ============================== */
.avatar-upload-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.8rem;
}

.avatar-circle {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.12),
        0 8px 32px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(16px) saturate(1.5);
    -webkit-backdrop-filter: blur(16px) saturate(1.5);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle:hover {
    transform: scale(1.04);
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.18),
        0 12px 40px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(0, 0, 0, 0.25);
}

.avatar-circle:hover .avatar-overlay {
    opacity: 1;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-initial {
    font-size: 2.4rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    user-select: none;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    border-radius: 50%;
    color: white;
}

.avatar-status {
    font-size: 0.82rem;
    margin-top: 10px;
    min-height: 1.2em;
    text-align: center;
}