/* Academia de Inversiones — tema bolsa */
:root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-2: #e8edf3;
    --ink: #0a1628;
    --ink-2: #1e3a5f;
    --muted: #5c6b7e;
    --line: #d4dce6;
    --brand: #0c2340;
    --brand-2: #1a4d7c;
    --brand-soft: #e8f0f8;
    --bull: #059669;
    --bull-light: #34d399;
    --bull-soft: #ecfdf5;
    --bear: #dc2626;
    --gold: #b8860b;
    --gold-light: #d4a847;
    --gold-soft: #fef9e7;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow: 0 1px 2px rgba(10,22,40,.05), 0 6px 20px rgba(10,22,40,.07);
    --shadow-lg: 0 8px 30px rgba(10,22,40,.12);
    --font: 'DM Sans', system-ui, sans-serif;
    --display: 'Instrument Serif', Georgia, serif;
    --nav: 64px;
    --bottom-nav-h: 60px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --ease: cubic-bezier(.22,1,.36,1);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0a0f18;
    --surface: #121a27;
    --surface-2: #1a2433;
    --ink: #e8edf3;
    --ink-2: #c5d0de;
    --muted: #8b9cb3;
    --line: #2a3548;
    --brand: #5b9fd4;
    --brand-2: #3d7ab5;
    --brand-soft: rgba(61, 122, 181, 0.18);
    --bull: #34d399;
    --bull-light: #6ee7b7;
    --bull-soft: rgba(52, 211, 153, 0.12);
    --gold: #d4a847;
    --gold-light: #e8c56a;
    --gold-soft: rgba(212, 168, 71, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,.25), 0 6px 20px rgba(0,0,0,.35);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.45);
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse 70% 45% at 90% 0%, rgba(5,150,105,.07), transparent),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(184,134,11,.05), transparent),
        linear-gradient(rgba(12,35,64,.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(12,35,64,.04) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    transition: background-color .25s ease, color .25s ease;
}

html[data-theme="dark"] body:not(.login-page) {
    background-image:
        radial-gradient(ellipse 70% 45% at 90% 0%, rgba(52,211,153,.06), transparent),
        radial-gradient(ellipse 50% 40% at 0% 100%, rgba(212,168,71,.04), transparent),
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
}

a { color: inherit; }

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

.fade-in { animation: fadeInUp 0.55s var(--ease) both; }

/* ── Login — terminal de mercado ── */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #061018 0%, #0c2340 40%, #0a2e1f 100%);
    overflow-x: hidden;
}

.login-page::after {
    content: '';
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.1), transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
    z-index: 0;
}

.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(52,211,153,.08), transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(212,168,71,.06), transparent 35%);
    pointer-events: none;
    z-index: 0;
}

.login-shell {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
    width: 100%;
    min-height: 0;
    position: relative;
    z-index: 1;
}

.login-hero {
    position: relative;
    display: flex;
    align-items: center;
    padding: clamp(32px, 5vw, 56px) clamp(28px, 4vw, 64px);
    color: #fff;
    overflow: hidden;
}

.login-hero-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .35;
}

.login-hero-bg .chart-deco {
    position: absolute;
    bottom: 8%;
    left: clamp(20px, 4vw, 48px);
    right: clamp(20px, 4vw, 48px);
    width: auto;
    max-width: none;
    height: auto;
    opacity: 1;
}

.login-hero-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}

.login-hero-content {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.login-hero h1 {
    font-family: var(--display);
    font-size: clamp(1.85rem, 3.2vw, 2.75rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 16px;
}

.login-hero p {
    font-size: 1rem;
    opacity: .88;
    line-height: 1.65;
    margin-bottom: 4px;
}

.login-hero .brand-row,
.login-side .brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    font-weight: 600;
    font-size: .95rem;
}

.login-hero .brand-row .logo,
.login-side .brand-row .logo { width: 40px; height: 40px; flex-shrink: 0; }

.ticker,
.login-ticker {
    overflow: hidden;
    background: rgba(0,0,0,.35);
    border-top: 1px solid rgba(52,211,153,.25);
    padding: 10px 0;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.ticker-track {
    display: flex;
    gap: 40px;
    animation: ticker 25s linear infinite;
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: rgba(255,255,255,.7);
}

.ticker-track span { color: var(--bull-light); }

@keyframes ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.login-features {
    list-style: none;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .92rem;
    opacity: .9;
}

.login-features li::before {
    content: '✓';
    width: 22px;
    height: 22px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: .7rem;
    flex-shrink: 0;
}

.login-form-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px clamp(16px, 3vw, 32px) 24px 8px;
    background: transparent;
    border-left: none;
    box-shadow: none;
}

html[data-theme="dark"] .login-form-side {
    background: var(--bg);
}

html[data-theme="dark"] .login-card {
    border-color: var(--line);
    box-shadow: var(--shadow-lg);
}

.login-card {
    width: 100%;
    max-width: 320px;
    padding: 22px 24px 24px;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius);
    box-shadow: 0 16px 48px rgba(0,0,0,.28), 0 0 0 1px rgba(255,255,255,.06);
    animation: fadeInUp 0.6s var(--ease) 0.1s both;
}

.login-card-eyebrow {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--bull);
    margin-bottom: 6px;
}

.login-card h2 {
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 400;
    margin-bottom: 4px;
    color: var(--ink);
    line-height: 1.2;
}

.login-card .sub {
    color: var(--muted);
    margin-bottom: 18px;
    font-size: .82rem;
}

.login-page .field { margin-bottom: 12px; }

.login-page .field label {
    font-size: .75rem;
    margin-bottom: 4px;
}

.login-page .field input {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: .9rem;
}

.login-page .btn-full {
    margin-top: 4px;
    padding: 11px 16px;
    font-size: .88rem;
}

/* ── Forms ── */
.field { margin-bottom: 20px; }

.field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    font-size: .95rem;
    color: var(--ink);
    background: var(--surface);
    transition: border-color .2s, box-shadow .2s, background .25s;
}

html[data-theme="dark"] .alert {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fca5a5;
}

html[data-theme="dark"] .player-ph {
    background: #000;
    color: #64748b;
}

html[data-theme="dark"] .bottom-nav {
    background: rgba(18, 26, 39, .96);
    border-top-color: var(--line);
}

html[data-theme="dark"] .watch-mobile-btn {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink-2);
}

html[data-theme="dark"] .kbd-hint kbd {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--muted);
}

.field input:focus {
    outline: none;
    border-color: var(--bull);
    box-shadow: 0 0 0 3px rgba(5,150,105,.12);
}

.alert {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: .88rem;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 12px;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s var(--ease);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(12,35,64,.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0a2e52 0%, #1e5a8a 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(12,35,64,.3);
}

.btn-outline {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
}

.btn-outline:hover { border-color: var(--brand-2); color: var(--brand); }

.btn-full { width: 100%; padding: 14px; }
.btn-sm { padding: 9px 16px; font-size: .82rem; }
.btn-disabled { opacity: .45; cursor: not-allowed; }

/* ── Tema claro / oscuro ── */
.theme-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, border-color .2s, color .2s, transform .15s;
}

.theme-toggle:hover {
    border-color: var(--bull);
    color: var(--bull);
    background: var(--bull-soft);
}

.theme-toggle:active { transform: scale(.96); }

.theme-toggle-inner {
    position: relative;
    width: 18px;
    height: 18px;
    display: block;
}

.theme-toggle .theme-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: 18px;
    height: 18px;
    transition: opacity .2s ease, transform .2s ease;
}

.theme-toggle .theme-icon-moon {
    opacity: 0;
    transform: scale(.85);
    pointer-events: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun {
    opacity: 0;
    transform: scale(.85);
    pointer-events: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon-moon {
    opacity: 1;
    transform: scale(1);
    pointer-events: none;
}

.login-form-tools {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    max-width: 320px;
    margin-bottom: 12px;
}

/* ── Nav ── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(20px, 4vw, 40px);
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color .3s, box-shadow .3s, background .25s;
}

html[data-theme="dark"] .topbar {
    background: rgba(18, 26, 39, .92);
}

html[data-theme="dark"] .topbar.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
}

.topbar.scrolled {
    border-bottom-color: var(--line);
    box-shadow: 0 4px 20px rgba(15,23,42,.06);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: .95rem;
    color: var(--ink);
}

.topbar-brand .logo { width: 32px; height: 32px; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: var(--surface-2);
    border-radius: 999px;
    font-size: .82rem;
    color: var(--ink-2);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--bull));
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
}

.back-btn:hover { color: var(--brand); }
.back-btn svg { width: 18px; height: 18px; flex-shrink: 0; display: block; }

.topbar svg:not(.logo) {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

/* ── Layout ── */
.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px clamp(20px, 4vw, 40px) 80px;
}

/* ── Hero ── */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 44px 48px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(5,150,105,.14), transparent 70%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--bull), var(--gold-light), var(--brand-2));
}

.hero-inner { position: relative; z-index: 1; }

.welcome {
    font-size: .9rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.welcome strong { color: var(--ink-2); }

.hero-tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--bull-soft);
    color: var(--bull);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid rgba(5,150,105,.15);
}

.hero h1 {
    font-family: var(--display);
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 400;
    line-height: 1.15;
    margin-bottom: 12px;
}

.hero > p {
    color: var(--muted);
    font-size: 1.02rem;
    max-width: 560px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.stat-box {
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    transition: border-color .2s, transform .2s;
}

.stat-box:hover {
    border-color: var(--bull);
    transform: translateY(-2px);
}

.stat-num {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--bull), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-lbl {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 4px;
}

/* ── Modules ── */
.section-h {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    margin-bottom: 16px;
}

.modules {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.mod-card.featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
}

.mod-card.featured .mod-top { height: auto; min-height: 200px; }
.mod-card.featured .mod-body { padding: 32px 36px; justify-content: center; }
.mod-card.featured .mod-body h2 { font-size: 1.65rem; }

.mod-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .25s var(--ease), box-shadow .25s;
    display: flex;
    flex-direction: column;
}

.mod-card:hover:not(.locked) {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.mod-card.locked { opacity: .55; }

.mod-top {
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.mod-top::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.mod-num {
    position: absolute;
    top: 12px;
    right: 20px;
    font-family: var(--display);
    font-size: 4rem;
    font-weight: 400;
    opacity: .15;
    line-height: 1;
}

.mod-top.m1 { background: linear-gradient(135deg, #0c2340 0%, #0f3d2e 60%, #059669 100%); }
.mod-top.m2 { background: linear-gradient(135deg, #0c2340 0%, #1a365d 50%, #2563eb 100%); }
.mod-top.m3 { background: linear-gradient(135deg, #1a2e1a 0%, #3d3520 50%, #b8860b 100%); }

.mod-top span {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    opacity: .9;
}

.mod-body { padding: 22px 24px 24px; flex: 1; display: flex; flex-direction: column; }

.mod-body h2 {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 400;
    margin-bottom: 8px;
    line-height: 1.3;
}

.mod-body p {
    font-size: .88rem;
    color: var(--muted);
    flex: 1;
    margin-bottom: 18px;
    line-height: 1.6;
}

.chip {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.chip-ok { background: var(--bull-soft); color: var(--bull); border: 1px solid rgba(5,150,105,.15); }
.chip-wait { background: var(--surface-2); color: var(--muted); }

.prog { margin: 12px 0 18px; }
.prog-track {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.prog-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--bull), var(--gold-light));
    border-radius: 3px;
    transition: width .8s var(--ease);
}
.prog-label {
    font-size: .75rem;
    color: var(--muted);
    margin-top: 6px;
}

/* ── Module page ── */
.mod-header {
    margin-bottom: 36px;
    padding: 32px 36px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--muted);
    margin-bottom: 16px;
}

.breadcrumb a {
    text-decoration: none;
    color: var(--brand);
    font-weight: 500;
}

.breadcrumb a:hover { text-decoration: underline; }
.mod-header h1 {
    font-family: var(--display);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 400;
    margin: 12px 0 8px;
}
.mod-header p { color: var(--muted); max-width: 600px; }

.lessons { display: flex; flex-direction: column; gap: 10px; }

.lesson-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    transition: all .25s var(--ease);
}

.lesson-row:hover {
    border-color: var(--bull);
    box-shadow: var(--shadow-lg);
    transform: translateX(6px);
    background: linear-gradient(90deg, var(--bull-soft), var(--surface));
}

.lesson-idx {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bull-soft);
    color: var(--bull);
    font-weight: 700;
    font-size: .9rem;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.lesson-row:hover .lesson-idx { background: var(--bull); color: #fff; }

.lesson-txt { flex: 1; }
.lesson-txt h3 { font-size: .95rem; font-weight: 600; }
.lesson-txt p { font-size: .8rem; color: var(--muted); margin-top: 2px; }

.lesson-go {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    color: var(--brand);
    font-size: .75rem;
    transition: all .2s;
}

.lesson-row:hover .lesson-go { background: var(--brand); color: #fff; }

/* ── Watch ── */
.watch-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

.player {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16/9;
    box-shadow: var(--shadow-lg);
}

.player iframe, .player video {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.player-ph {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #94a3b8;
    min-height: 200px;
}

.watch-info { margin-top: 28px; padding: 24px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.watch-info .ep { font-size: .75rem; font-weight: 700; color: var(--bull); text-transform: uppercase; letter-spacing: .08em; }
.watch-info h1 { font-family: var(--display); font-size: 1.75rem; font-weight: 400; margin: 8px 0 16px; }

.watch-nav {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.watch-nav a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    color: var(--ink-2);
    transition: all .2s;
}

.watch-nav a:hover { background: var(--bull-soft); color: var(--bull); }
.watch-nav a.disabled { opacity: .35; pointer-events: none; }

.sidebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: sticky;
    top: calc(var(--nav) + 16px);
}

.sidebar-h {
    padding: 14px 18px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
}

.sidebar-list { max-height: 70vh; overflow-y: auto; padding: 6px; }

.sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: .84rem;
    color: var(--ink-2);
    transition: background .15s;
}

.sb-item:hover { background: var(--surface-2); }
.sb-item.on {
    background: var(--bull-soft);
    color: var(--bull);
    font-weight: 600;
    border-left: 3px solid var(--bull);
}

.sb-n {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--surface-2);
    font-size: .7rem;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.sb-item.on .sb-n { background: var(--bull); color: #fff; }

.empty {
    text-align: center;
    padding: 60px 24px;
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    color: var(--muted);
}

.logo { flex-shrink: 0; }

.site-footer {
    text-align: center;
    padding: 32px 20px 48px;
    font-size: .8rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .mod-card.featured { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .login-hero {
        padding: 28px 24px 32px;
        align-items: flex-start;
    }

    .login-hero-bg .chart-deco {
        bottom: 0;
        opacity: .5;
    }

    .login-hero-content { max-width: none; }

    .login-stat { margin-top: 20px; padding-top: 16px; }

    .login-form-side {
        padding: 0 24px 28px;
        justify-content: center;
    }

    .login-card {
        max-width: 360px;
        border-color: var(--line);
        box-shadow: var(--shadow-lg);
    }
}

@media (max-width: 768px) {
    .login-hero h1 { font-size: 1.65rem; }

    .login-features { display: none; }

    .login-stat div strong { font-size: 1.5rem; }
    .watch-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .modules { grid-template-columns: 1fr; }
    .user-badge span:not(.avatar) { display: none; }
    .lesson-go { display: none; }
    .hero { padding: 32px 28px; }
}

@media (max-width: 480px) {
    .hero { padding: 28px 24px; }
    .modules { grid-template-columns: 1fr; }
    .hero-layout { flex-direction: column; }
    .nav-link { display: none; }
}

/* ── v6 enhancements ── */
.hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.hero-content { flex: 1; min-width: 0; }

.progress-ring {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    position: relative;
}

.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.progress-ring .ring-bg {
    fill: none;
    stroke: var(--line);
    stroke-width: 8;
}

.progress-ring .ring-fill {
    fill: none;
    stroke: url(#ringGrad);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s var(--ease);
}

.progress-ring .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.progress-ring .ring-pct {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--bull);
    line-height: 1;
}

.progress-ring .ring-lbl {
    font-size: .65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 2px;
}

.continue-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 24px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #0c2340 0%, #0f4c3a 50%, #059669 100%);
    border-radius: var(--radius);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 8px 30px rgba(5,150,105,.25);
    border: 1px solid rgba(52,211,153,.2);
    transition: transform .25s var(--ease), box-shadow .25s;
}

.continue-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(5,150,105,.35);
    color: #fff;
}

.continue-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,.15);
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.continue-icon svg { width: 22px; height: 22px; }

.continue-text { flex: 1; }
.continue-text strong { display: block; font-size: 1rem; margin-bottom: 2px; }
.continue-text span { font-size: .85rem; opacity: .85; }

.continue-arrow {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
}

.nav-link {
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color .2s, background .2s;
}

.nav-link:hover { color: var(--bull); background: var(--bull-soft); }

.topbar-brand span { font-weight: 700; }

.chip-lock::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 5px;
    background: currentColor;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 1a5 5 0 00-5 5v3H6a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V11a2 2 0 00-2-2h-1V6a5 5 0 00-5-5zm-3 8V6a3 3 0 116 0v3H9z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.lesson-row .lesson-tag {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bull);
    background: var(--bull-soft);
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.lesson-row:hover .lesson-tag { background: var(--bull); color: #fff; }

.player-shell {
    position: relative;
    border-radius: var(--radius);
    padding: 3px;
    background: linear-gradient(135deg, var(--bull), var(--gold-light), var(--brand-2));
    box-shadow: var(--shadow-lg);
}

.player-shell .player {
    border-radius: calc(var(--radius) - 2px);
    box-shadow: none;
}

.kbd-hint {
    margin-top: 12px;
    font-size: .75rem;
    color: var(--muted);
    text-align: center;
}

.kbd-hint kbd {
    display: inline-block;
    padding: 2px 7px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    font-family: inherit;
    font-size: .7rem;
    font-weight: 600;
}

.watch-mobile-nav { display: none; }

.sb-item .sb-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ticker campus */
.campus-ticker {
    background: linear-gradient(90deg, #061018, #0c2340);
    border-bottom: 1px solid rgba(52,211,153,.15);
    overflow: hidden;
    padding: 8px 0;
}

.campus-ticker .ticker-track {
    color: rgba(255,255,255,.65);
    font-size: .72rem;
    animation-duration: 35s;
}

.campus-ticker .ticker-track span { color: var(--bull-light); }

.mod-theme {
    display: block;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    opacity: .75;
    margin-bottom: 4px;
}

.login-stat {
    display: flex;
    gap: clamp(20px, 4vw, 36px);
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,.15);
}

.login-stat div strong {
    display: block;
    font-family: var(--display);
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
}

.login-stat div span {
    font-size: .8rem;
    opacity: .7;
}

@media (max-width: 900px) {
    .lessons-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   App móvil — experiencia tipo aplicación
   ══════════════════════════════════════════ */

.bottom-nav {
    display: none;
}

.bottom-nav svg {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
    flex-shrink: 0;
    display: block;
    pointer-events: none;
}

.bottom-nav-item span {
    line-height: 1.1;
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
        visibility: hidden;
        pointer-events: none;
        height: 0;
        overflow: hidden;
    }
}

.desktop-only { display: block; }

.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

.app-shell .app-main,
.app-shell > .wrap {
    flex: 1;
    width: 100%;
    min-width: 0;
}

.btn,
.field input,
.back-btn,
.lesson-row,
.bottom-nav-item,
.watch-mobile-btn {
    touch-action: manipulation;
}

@media (max-width: 768px) {
    body {
        background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
    }

    .desktop-only { display: none !important; }

    /* —— Topbar compacta —— */
    .app-shell .topbar {
        position: sticky;
        top: 0;
        height: calc(52px + var(--safe-top));
        padding: var(--safe-top) max(14px, var(--safe-left)) 0 max(14px, var(--safe-right));
    }

    .topbar-brand span {
        font-size: .88rem;
        max-width: 42vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .back-btn {
        font-size: .82rem;
        max-width: 55vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-right { gap: 8px; }

    .theme-toggle {
        width: 34px;
        height: 34px;
        border-radius: 50%;
    }

    .nav-link,
    .topbar-logout,
    .user-name { display: none !important; }

    .user-badge {
        padding: 2px;
        background: transparent;
    }

    .avatar {
        width: 34px;
        height: 34px;
        font-size: .75rem;
    }

    .campus-ticker { display: none; }

    .site-footer { display: none; }

    /* —— Contenido con espacio para barra inferior —— */
    .app-shell > .wrap {
        max-width: none;
        padding: 14px max(14px, var(--safe-left)) calc(var(--bottom-nav-h) + var(--safe-bottom) + 20px) max(14px, var(--safe-right));
    }

    .field input,
    .login-page .field input {
        font-size: 16px;
        min-height: 44px;
    }

    .btn {
        min-height: 44px;
    }

    /* —— Hero campus —— */
    .hero {
        padding: 18px 16px;
        margin-bottom: 16px;
        border-radius: var(--radius);
    }

    .hero-layout {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .hero h1 {
        font-size: 1.45rem;
        margin-bottom: 8px;
    }

    .hero-content > p,
    .hero > p {
        font-size: .88rem;
    }

    .welcome { font-size: .82rem; margin-bottom: 6px; }

    .progress-ring {
        width: 88px;
        height: 88px;
        align-self: center;
    }

    .progress-ring .ring-pct { font-size: 1.2rem; }

    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin-top: 16px;
        padding-top: 16px;
    }

    .stat-box {
        padding: 10px 8px;
        text-align: center;
    }

    .stat-num { font-size: 1.35rem; }

    .stat-lbl {
        font-size: .62rem;
        letter-spacing: .03em;
    }

    .continue-card {
        gap: 14px;
        padding: 14px 16px;
        margin-bottom: 20px;
    }

    .continue-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .continue-text strong { font-size: .88rem; }
    .continue-text span { font-size: .78rem; }

    .continue-arrow {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .section-h { margin-bottom: 12px; }

    /* —— Módulos —— */
    .modules { gap: 14px; }

    .mod-card.featured {
        grid-template-columns: 1fr;
    }

    .mod-card.featured .mod-top { min-height: 100px; }

    .mod-card.featured .mod-body {
        padding: 18px 16px 20px;
    }

    .mod-card.featured .mod-body h2 { font-size: 1.25rem; }

    .mod-top { height: 88px; padding: 16px; }

    .mod-num { font-size: 2.75rem; top: 8px; right: 14px; }

    .mod-body { padding: 16px; }

    .mod-body h2 { font-size: 1.15rem; }

    .mod-body p { font-size: .84rem; margin-bottom: 14px; }

    /* —— Página módulo —— */
    .mod-header {
        padding: 18px 16px;
        margin-bottom: 16px;
        border-radius: var(--radius);
    }

    .mod-header h1 {
        font-size: 1.45rem;
        margin: 8px 0 6px;
    }

    .mod-header p { font-size: .88rem; }

    .breadcrumb { font-size: .78rem; margin-bottom: 12px; }

    .lesson-row {
        padding: 14px 14px;
        gap: 12px;
        border-radius: 12px;
    }

    .lesson-idx {
        width: 38px;
        height: 38px;
        font-size: .82rem;
        border-radius: 10px;
    }

    .lesson-txt h3 { font-size: .9rem; }

    .lesson-txt p { font-size: .75rem; }

    /* —— Reproductor —— */
    .page-watch > .wrap {
        padding-left: 0;
        padding-right: 0;
        padding-top: 0;
    }

    .page-watch .player-shell {
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    .page-watch .player-shell .player {
        border-radius: 0;
    }

    .page-watch .watch-info {
        margin-top: 0;
        padding: 16px max(14px, var(--safe-left)) 12px max(14px, var(--safe-right));
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }

    .page-watch .watch-info h1 {
        font-size: 1.2rem;
        margin: 6px 0 0;
    }

    .page-watch .watch-nav { display: none; }

    .page-watch .sidebar {
        display: none;
        margin: 0 max(14px, var(--safe-left)) 12px max(14px, var(--safe-right));
        border-radius: var(--radius);
        position: static;
    }

    .page-watch.playlist-open .sidebar {
        display: block;
    }

    .page-watch .sidebar-list {
        max-height: 50vh;
    }

    .watch-mobile-nav {
        display: flex;
        gap: 8px;
        padding: 0 max(14px, var(--safe-left)) 8px max(14px, var(--safe-right));
    }

    .watch-mobile-btn {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 8px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
        font: inherit;
        font-size: .78rem;
        font-weight: 600;
        color: var(--ink-2);
        text-decoration: none;
        cursor: pointer;
    }

    .watch-mobile-btn--next {
        background: var(--bull-soft);
        border-color: rgba(5,150,105,.2);
        color: var(--bull);
    }

    .watch-mobile-btn.disabled {
        opacity: .35;
        pointer-events: none;
    }

    .watch-playlist-toggle {
        flex: 0.85;
        background: var(--brand-soft);
        border-color: rgba(12,35,64,.1);
        color: var(--brand);
    }

    /* —— Barra inferior fija —— */
    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        height: auto;
        max-height: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
        background: rgba(255,255,255,.94);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        border-top: 1px solid var(--line);
        padding: 4px max(6px, var(--safe-right)) calc(6px + var(--safe-bottom)) max(6px, var(--safe-left));
        box-shadow: 0 -8px 30px rgba(10,22,40,.08);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        min-height: 48px;
        max-height: 56px;
        padding: 6px 4px;
        border-radius: 10px;
        text-decoration: none;
        font-size: .62rem;
        font-weight: 700;
        letter-spacing: .02em;
        color: var(--muted);
        transition: color .15s, background .15s;
        overflow: hidden;
    }

    .bottom-nav-item svg {
        width: 22px !important;
        height: 22px !important;
        max-width: 22px;
        max-height: 22px;
    }

    .bottom-nav-item.on {
        color: var(--bull);
        background: var(--bull-soft);
    }

    .bottom-nav-item:active {
        transform: scale(.97);
    }

    /* —— Login móvil —— */
    .login-page {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .login-shell {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .login-hero {
        padding: max(16px, var(--safe-top)) max(16px, var(--safe-left)) 20px max(16px, var(--safe-right));
    }

    .login-hero h1 { font-size: 1.55rem; }

    .login-hero p { font-size: .92rem; }

    .login-hero .brand-row { margin-bottom: 20px; }

    .login-features { display: none; }

    .login-stat {
        margin-top: 16px;
        padding-top: 16px;
        gap: 20px;
    }

    .login-stat div strong { font-size: 1.5rem; }

    .login-form-side {
        padding: 0 max(16px, var(--safe-left)) max(12px, var(--safe-bottom)) max(16px, var(--safe-right));
    }

    .login-card {
        max-width: none;
        width: 100%;
    }

    .login-ticker {
        padding-bottom: max(10px, var(--safe-bottom));
    }
}

@media (max-width: 380px) {
    .bottom-nav-item span { font-size: .58rem; }

    .stats { grid-template-columns: 1fr 1fr 1fr; }

    .stat-lbl { font-size: .58rem; }
}

/* ── Quiz ── */
.lesson-done-badge {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--bull-soft);
    color: var(--bull);
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
}

.lesson-quiz-hint {
    margin-top: 12px;
    font-size: .85rem;
    color: var(--muted);
}

.open-quiz-btn { margin-top: 10px; }

.quiz-panel {
    margin-top: 24px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.quiz-panel[hidden] { display: none !important; }

.quiz-panel--open {
    border-color: var(--bull);
    box-shadow: 0 0 0 1px rgba(5,150,105,.15), var(--shadow-lg);
}

.quiz-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.quiz-title {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 400;
    margin-bottom: 4px;
}

.quiz-subtitle {
    font-size: .88rem;
    color: var(--muted);
}

.quiz-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    flex-shrink: 0;
}

.quiz-q {
    border: none;
    margin: 0 0 20px;
    padding: 0;
}

.quiz-q legend {
    font-size: .92rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.45;
}

.quiz-q-num {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    background: var(--bull-soft);
    color: var(--bull);
    border-radius: 6px;
    font-size: .75rem;
    margin-right: 6px;
}

.quiz-opt {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.quiz-opt:hover { border-color: var(--bull); background: var(--bull-soft); }

.quiz-opt input { margin-top: 3px; flex-shrink: 0; }

.quiz-opt span { font-size: .88rem; line-height: 1.4; }

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.quiz-score.ok { color: var(--bull); }
.quiz-score.fail { color: var(--bear); }

.quiz-hint { font-size: .85rem; color: var(--muted); margin-top: 8px; }

.quiz-pass-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bull-soft);
    color: var(--bull);
    font-size: 2rem;
    display: grid;
    place-items: center;
    margin: 8px auto 16px;
}

.lesson-row.lesson-done { border-color: rgba(5,150,105,.25); }

.lesson-row.lesson-done .lesson-idx {
    background: var(--bull);
    color: #fff;
}

.lesson-row.lesson-locked {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.sb-item.done .sb-n { background: var(--bull); color: #fff; }

.sb-item.locked {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}


