:root {
    --black: #0a0a0a;
    --near-black: #111111;
    --dark: #1a1a1a;
    --mid-dark: #2a2a2a;
    --mid: #555555;
    --mid-light: #888888;
    --light: #c8c8c8;
    --near-white: #e8e8e8;
    --white: #f5f5f5;
    --pure-white: #ffffff;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: #0c0c0f;
    color: var(--near-white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ambient gradient background */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(255,255,255,0.035) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 100%, rgba(180,180,220,0.03) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(255,255,255,0.012) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Subtle grid lines */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
    background-size: 72px 72px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse 100% 100% at 50% 0%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 0%, black 30%, transparent 80%);
}

/* Everything above bg layers */
.auth-overlay, .app { position: relative; z-index: 1; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── AUTH OVERLAY ── */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.35s ease;
}

.auth-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.auth-panel {
    width: 100%;
    max-width: 420px;
    padding: 0 24px;
    animation: fadeUp 0.55s ease both;
}

.auth-logo {
    text-align: center;
    margin-bottom: 44px;
}

.auth-logo .wordmark {
    font-family: 'DM Serif Display', serif;
    font-size: 2rem;
    color: var(--pure-white);
    letter-spacing: -0.02em;
}


.auth-logo .tagline {
    font-size: 0.75rem;
    color: var(--mid);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 6px;
    font-weight: 300;
}

.auth-card {
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 40px;
    background: var(--near-black);
}

.auth-card h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--pure-white);
    margin-bottom: 32px;
}

.form-field { margin-bottom: 20px; }

.form-field label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mid);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-field input {
    width: 100%;
    background: var(--dark);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 13px 16px;
    color: var(--pure-white);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-field input:focus {
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}

.form-field input::placeholder { color: var(--mid); }

.btn-primary {
    width: 100%;
    background: var(--pure-white);
    color: var(--black);
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    margin-top: 8px;
}

.btn-primary:hover {
    background: var(--near-white);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(255,255,255,0.1);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.auth-toggle {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--mid);
}

.auth-toggle a {
    color: var(--light);
    cursor: pointer;
    border-bottom: 1px solid rgba(200,200,200,0.25);
    transition: color 0.2s;
}

.auth-toggle a:hover { color: var(--pure-white); }

/* ── MAIN APP ── */
.app { display: none; min-height: 100vh; }
.app.show { display: block; animation: fadeUp 0.5s ease both; }

/* Header */
.header {
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: rgba(12,12,15,0.88);
    backdrop-filter: blur(20px);
    z-index: 50;
}

.header-brand {
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    color: var(--pure-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-brand span { color: var(--mid); font-style: italic; font-size: 0.9em; }

.header-right { display: flex; align-items: center; gap: 14px; }

.user-pill {
    display: none;
    align-items: center;
    gap: 9px;
    background: var(--dark);
    border: 1px solid var(--border-strong);
    border-radius: 100px;
    padding: 5px 16px 5px 8px;
}

.user-pill.show { display: flex; }

.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--mid-dark);
    border: 1px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; color: var(--light); font-weight: 500;
}

.user-name-display { font-size: 0.84rem; color: var(--near-white); }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 7px 16px;
    color: var(--mid-light);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover { border-color: rgba(255,255,255,0.3); color: var(--near-white); }

/* Main content */
.main {
    max-width: 840px;
    margin: 0 auto;
    padding: 64px 40px 100px;
}

/* Hero */
.hero { margin-bottom: 52px; }

.hero-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--mid);
    font-weight: 500;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hero-eyebrow::after {
    content: '';
    display: block;
    height: 1px;
    width: 36px;
    background: var(--mid-dark);
}

.hero h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.1rem, 5vw, 3.2rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--pure-white);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    font-style: italic;
}

.hero h4 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.7rem, 1vw, 1.25rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--pure-white);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.hero h1 em { color: var(--mid); font-style: italic; }

/* .hero p {
    line-height: 1.75;
    max-width: 200;
    font-weight: 300;
} */

/* Upload zone */
.upload-zone {
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    padding: 48px 40px;
    text-align: center;
    background: var(--near-black);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, background 0.3s;
    cursor: pointer;
    margin-bottom: 14px;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.025) 0%, transparent 65%);
    pointer-events: none;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.015);
}

.upload-icon {
    width: 52px; height: 52px;
    margin: 0 auto 20px;
    border: 1px solid var(--border-strong);
    border-radius: 13px;
    background: var(--dark);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.3s, border-color 0.3s;
}

.upload-zone:hover .upload-icon {
    transform: translateY(-3px);
    border-color: rgba(255,255,255,0.25);
}

.upload-icon svg {
    width: 22px; height: 22px;
    stroke: var(--mid-light);
    stroke-width: 1.5;
}

.upload-zone h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--near-white);
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--mid);
    font-size: 0.84rem;
    font-weight: 300;
}

.upload-zone p strong { color: var(--mid-light); font-weight: 400; }

input[type="file"] { display: none; }

/* Controls row */
.upload-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
}

.input-field {
    flex: 1;
    background: var(--near-black);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px 18px;
    color: var(--pure-white);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
    border-color: rgba(255,255,255,0.35);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.03);
}

.input-field::placeholder { color: var(--mid); }

.btn-upload {
    background: var(--pure-white);
    color: var(--black);
    border: none;
    border-radius: 10px;
    padding: 12px 26px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-upload:hover { background: var(--near-white); transform: translateY(-1px); }
.btn-upload:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Status */
.status-bar {
    display: none;
    border-radius: 10px;
    padding: 13px 18px;
    font-size: 0.865rem;
    margin-bottom: 20px;
    align-items: center;
    gap: 12px;
}

.status-bar.show { display: flex; }

.status-bar.processing {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-strong);
    color: var(--light);
}

.status-bar.success {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--near-white);
}

.status-bar.error {
    background: rgba(255,60,60,0.05);
    border: 1px solid rgba(255,60,60,0.18);
    color: #ff9999;
}

.spinner-ring {
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
    display: none;
}

.spinner-ring.show { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Divider */
.section-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 48px 0 28px;
}

.section-divider span {
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--mid);
    font-weight: 500;
    white-space: nowrap;
}

.section-divider::before, .section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Notes output */
.notes-output { display: none; }
.notes-output.show { display: block; animation: fadeUp 0.5s ease both; }

.notes-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.notes-meta {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--mid);
    margin-bottom: 10px;
}

.notes-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.9rem;
    font-weight: 400;
    color: var(--pure-white);
    line-height: 1.2;
    margin-bottom: 20px;
}

.notes-summary-box {
    background: var(--near-black);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 20px 24px 20px 28px;
    color: var(--light);
    font-size: 1.2rem;
    line-height: 1.8;
    font-weight: 300;
    border-left: 3px solid var(--mid-dark);
}

/* Sections */
.section-block {
    margin-bottom: 28px;
    opacity: 0;
    animation: fadeUp 0.4s ease forwards;
}

.section-block:nth-child(1) { animation-delay: 0.04s; }
.section-block:nth-child(2) { animation-delay: 0.08s; }
.section-block:nth-child(3) { animation-delay: 0.12s; }
.section-block:nth-child(4) { animation-delay: 0.16s; }
.section-block:nth-child(5) { animation-delay: 0.2s; }

.section-heading {
    font-family: 'DM Serif Display', serif;
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--near-white);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-heading::before {
    content: '';
    display: block;
    width: 3px;
    height: 18px;
    background: var(--mid-dark);
    border-radius: 2px;
    flex-shrink: 0;
}

.section-body { padding-left: 15px; }

.section-text {
    color: var(--mid-light);
    font-size: 1.2rem;
    line-height: 1.8;
    font-weight: 300;
    margin-bottom: 10px;
}

.bullet-list { list-style: none; }

.bullet-list li {
    position: relative;
    padding: 7px 0 7px 20px;
    color: var(--mid-light);
    font-size: 1.1rem;
    line-height: 1.65;
    font-weight: 300;
    border-bottom: 1px solid rgba(255,255,255,0.035);
}

.bullet-list li:last-child { border-bottom: none; }

.bullet-list li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--mid-dark);
    font-size: 0.8rem;
}

/* Key terms */
.terms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.term-chip {
    background: var(--dark);
    border: 1px solid var(--border-strong);
    border-radius: 100px;
    padding: 5px 13px;
    font-family: 'DM Mono', monospace;
    font-size: 0.9rem;
    color: var(--light);
    transition: border-color 0.2s, color 0.2s;
}

.term-chip:hover { border-color: rgba(255,255,255,0.3); color: var(--pure-white); }

/* Action items */
.action-box {
    background: var(--near-black);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 20px 24px;
    display: none;
    margin-top: 8px;
}

.action-box.show { display: block; }

.action-box h4 {
    font-size: 1rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mid);
    margin-bottom: 14px;
    font-weight: 500;
}

.action-list { list-style: none; }

.action-list li {
    padding: 8px 0 8px 22px;
    position: relative;
    color: var(--light);
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 300;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.action-list li:last-child { border-bottom: none; }

.action-list li::before {
    content: '○';
    position: absolute;
    left: 0;
    color: var(--mid-dark);
    font-size: 0.72rem;
    top: 10px;
}

/* Notes footer */
.notes-footer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-download {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 9px 20px;
    color: var(--mid-light);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-download:hover {
    border-color: rgba(255,255,255,0.25);
    color: var(--near-white);
    background: rgba(255,255,255,0.03);
}

/* Lectures list */
.lectures-section { margin-top: 8px; }

.lectures-grid { display: grid; gap: 8px; }

.lecture-card {
    background: var(--near-black);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 22px;
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lecture-card:hover {
    border-color: var(--border-strong);
    background: rgba(255,255,255,0.018);
    transform: translateX(4px);
}

.lecture-card-title { font-size: 1rem; color: var(--near-white); margin-bottom: 3px; }
.lecture-card-meta { font-size: 0.9rem; color: var(--mid); font-family: 'DM Mono', monospace; }

.badge {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.badge.completed { background: rgba(255,255,255,0.06); color: var(--light); border: 1px solid var(--border-strong); }
.badge.processing { background: rgba(255,200,100,0.05); color: rgba(255,200,100,0.65); border: 1px solid rgba(255,200,100,0.15); }
.badge.failed { background: rgba(255,80,80,0.05); color: rgba(255,120,120,0.65); border: 1px solid rgba(255,80,80,0.15); }

.empty-state {
    text-align: center;
    padding: 36px 0;
    color: var(--mid);
    font-size: 0.875rem;
    font-weight: 300;
}

@media (max-width: 640px) {
    .header { padding: 0 20px; }
    .main { padding: 40px 20px 80px; }
    .upload-controls { flex-direction: column; }
    .auth-card { padding: 28px 22px; }
    .upload-zone { padding: 36px 20px; }
}