:root {
  --bg: #f4f3f8;
  --surface: #ffffff;
  --surface-2: #f7f6fb;
  --border: #e6e3ef;
  --text: #1b1830;
  --muted: #6c6887;
  --accent: #6d4aff;
  --accent-2: #ff4f95;
  --accent-soft: #efeaff;
  --like: #f0396e;
  --ok: #19a974;
  --danger: #e5484d;
  --shadow: 0 1px 2px rgba(27, 24, 48, .04), 0 8px 24px rgba(27, 24, 48, .06);
  --radius: 18px;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0d1a; --surface: #181527; --surface-2: #201c33; --border: #2c2742;
    --text: #efedf8; --muted: #9b96b8; --accent: #8b6dff; --accent-soft: #2a2148;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0d1a; --surface: #181527; --surface-2: #201c33; --border: #2c2742;
  --text: #efedf8; --muted: #9b96b8; --accent: #8b6dff; --accent-soft: #2a2148;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.icon { width: 22px; height: 22px; flex: none; }
.icon.sm { width: 18px; height: 18px; }

/* ---------- layout ---------- */
.shell {
  display: grid; grid-template-columns: 250px minmax(0, 620px) 320px;
  gap: 28px; max-width: 1280px; margin: 0 auto; padding: 0 20px; justify-content: center;
}
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 0; gap: 4px; }
.aside { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 0; display: flex; flex-direction: column; gap: 18px; }
.main { padding: 22px 0 80px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; padding: 6px 14px 20px; letter-spacing: -.02em; }
.brand-logo { width: 36px; height: 36px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; color: #fff; }
.nav-link {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 14px;
  font-weight: 600; color: var(--muted); transition: background .15s, color .15s; position: relative;
}
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.nav-link.active .icon { color: var(--accent); }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-2); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; margin-left: auto;
}
.badge[hidden] { display: none; }
.sidebar .btn-primary { margin-top: 14px; padding: 13px; }
.me-card { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; cursor: pointer; }
.me-card:hover { background: var(--surface); }
.me-card .who { min-width: 0; flex: 1; }

/* ---------- elementos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-pad { padding: 18px; }
.section-title { font-size: 16px; font-weight: 800; margin: 0 0 12px; letter-spacing: -.01em; }

.btn {
  border: 1px solid var(--border); background: var(--surface); padding: 8px 16px; border-radius: 999px;
  font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, background .15s, opacity .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; border: 0; box-shadow: 0 6px 18px -6px var(--accent); }
.btn-primary:hover { background: var(--grad); opacity: .92; }
.btn-dark { background: var(--text); color: var(--surface); border: 0; }
.btn-dark:hover { background: var(--text); opacity: .88; }
.btn-ghost { background: transparent; border: 0; }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.icon-btn { background: transparent; border: 0; padding: 8px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.input, .textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 80px; }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.name { font-weight: 700; }
.handle, .muted { color: var(--muted); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--accent); opacity: .7; }

/* ---------- cabecera de página ---------- */
.page-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 14px 4px; margin: -22px 0 14px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.page-head h1 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 999px; }
.tab { padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); cursor: pointer; border: 0; background: transparent; }
.tab.active { background: var(--text); color: var(--surface); }

/* ---------- composer ---------- */
.composer { display: flex; gap: 12px; padding: 16px 18px; }
.composer .textarea { background: transparent; border: 0; padding: 8px 0; min-height: 56px; font-size: 17px; resize: none; box-shadow: none; }
.composer-tools { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.counter { font-size: 13px; color: var(--muted); margin-right: 8px; }
.counter.over { color: var(--danger); font-weight: 700; }
.preview { position: relative; margin: 8px 0; }
.preview img { border-radius: 14px; max-height: 360px; width: 100%; object-fit: cover; }
.preview .icon-btn { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; }

/* ---------- posts ---------- */
.post { display: flex; gap: 12px; padding: 16px 18px; cursor: pointer; transition: background .15s; }
.post:hover { background: var(--surface-2); }
.post + .post { border-top: 1px solid var(--border); }
.post-body { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.post-head .name:hover { text-decoration: underline; }
.post-text { white-space: pre-wrap; word-wrap: break-word; margin: 4px 0 0; }
.post-text a { color: var(--accent); font-weight: 600; }
.post-text a:hover { text-decoration: underline; }
.post-text code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13.5px; }
.post-img { margin-top: 10px; border-radius: 14px; border: 1px solid var(--border); max-height: 520px; width: 100%; object-fit: cover; cursor: zoom-in; }
.actions { display: flex; gap: 4px; margin: 8px -8px -6px; }
.action {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; cursor: pointer; font-size: 13.5px; font-weight: 600; transition: color .15s, background .15s;
}
.action:hover { background: var(--accent-soft); color: var(--accent); }
.action.like:hover, .action.like.on { color: var(--like); }
.action.like:hover { background: color-mix(in srgb, var(--like) 12%, transparent); }
.action.like.on .icon { fill: var(--like); animation: pop .35s ease; }
.action.save.on { color: var(--accent); }
.action.save.on .icon { fill: var(--accent); }
.action.end { margin-left: auto; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.35); } 100% { transform: scale(1); } }
.post-menu { position: relative; margin-left: auto; }
.menu {
  position: absolute; right: 0; top: 100%; z-index: 20; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 170px;
}
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; background: none; border: 0; padding: 9px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; text-align: left; }
.menu button:hover { background: var(--surface-2); }
.menu .danger { color: var(--danger); }

/* detalle y comentarios */
.post.detail { cursor: default; flex-direction: column; }
.post.detail:hover { background: none; }
.post.detail .post-text { font-size: 19px; line-height: 1.45; margin-top: 12px; }
.comment { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.comment-bubble { background: var(--surface-2); border-radius: 4px 16px 16px 16px; padding: 8px 14px; flex: 1; min-width: 0; }
.comment-form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: center; }

/* ---------- perfil ---------- */
.cover { height: 200px; background: var(--grad); border-radius: var(--radius) var(--radius) 0 0; background-size: cover; background-position: center; }
.profile-info { padding: 0 20px 18px; }
.profile-top { display: flex; align-items: flex-end; justify-content: space-between; margin-top: -54px; gap: 10px; }
.profile-top .avatar { border: 4px solid var(--surface); }
.profile-name { font-size: 22px; font-weight: 800; margin: 10px 0 0; letter-spacing: -.02em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0; color: var(--muted); font-size: 14px; }
.meta span, .meta a { display: inline-flex; align-items: center; gap: 5px; }
.meta a { color: var(--accent); }
.stats { display: flex; gap: 18px; font-size: 14px; }
.stats a:hover { text-decoration: underline; }
.stats b { color: var(--text); }
.pill { font-size: 11px; background: var(--surface-2); color: var(--muted); padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.profile-tabs { display: flex; border-top: 1px solid var(--border); }
.profile-tabs button { flex: 1; background: none; border: 0; padding: 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.profile-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.media-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: 8px; cursor: pointer; }

/* ---------- listas de usuarios ---------- */
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.user-row + .user-row { border-top: 1px solid var(--border); }
.user-row .who { flex: 1; min-width: 0; }
.aside .user-row { padding: 10px 0; border: 0; }
.trend { display: block; padding: 10px 0; }
.trend:hover .trend-tag { color: var(--accent); }
.trend-tag { font-weight: 700; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 42px; border-radius: 999px; background: var(--surface); }

/* ---------- notificaciones ---------- */
.notif { display: flex; gap: 14px; padding: 14px 18px; cursor: pointer; }
.notif + .notif { border-top: 1px solid var(--border); }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.notif-icon.like { background: color-mix(in srgb, var(--like) 15%, transparent); color: var(--like); }
.notif-icon.comment, .notif-icon.mention { background: var(--accent-soft); color: var(--accent); }
.notif-icon.follow { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.notif-quote { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- mensajes ---------- */
.dm { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 44px); overflow: hidden; }
.dm-list { border-right: 1px solid var(--border); overflow-y: auto; }
.dm-item { display: flex; gap: 12px; padding: 14px 16px; align-items: center; cursor: pointer; }
.dm-item:hover, .dm-item.active { background: var(--surface-2); }
.dm-item .who { min-width: 0; flex: 1; }
.dm-chat { display: flex; flex-direction: column; min-width: 0; }
.dm-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dm-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 75%; padding: 9px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.theirs { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.mine { background: var(--grad); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble-time { font-size: 11px; color: var(--muted); margin: 2px 6px 8px; }
.bubble-time.mine { align-self: flex-end; }
.dm-form { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.dm-back { display: none; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  background: var(--grad); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-hero::after {
  content: ""; position: absolute; inset: auto -20% -40% -20%; height: 70%;
  background: radial-gradient(closest-side, rgba(255,255,255,.25), transparent); pointer-events: none;
}
.auth-hero h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.05; letter-spacing: -.035em; margin: 0 0 16px; max-width: 12ch; }
.auth-hero p { font-size: 18px; opacity: .9; max-width: 36ch; margin: 0; }
.auth-hero .brand { padding: 0; color: #fff; }
.auth-hero .brand-logo { background: rgba(255,255,255,.2); }
.auth-features { display: flex; gap: 22px; flex-wrap: wrap; font-weight: 600; opacity: .95; position: relative; z-index: 1; }
.auth-features span { display: inline-flex; align-items: center; gap: 8px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.auth-box .btn { width: 100%; padding: 12px; margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); }
.auth-switch a { color: var(--accent); font-weight: 700; cursor: pointer; }
.demo-hint { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 13.5px; }
.input-wrap { position: relative; }
.input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input.has-prefix { padding-left: 30px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--accent); font-weight: 700; font-size: 13px; padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.pw-toggle:hover { background: var(--accent-soft); }
.input-wrap .input[name=password] { padding-right: 76px; }
.hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.hint.good { color: var(--ok); font-weight: 600; }
.hint.bad { color: var(--danger); font-weight: 600; }
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength i { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s; }
.strength[data-score="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] i:nth-child(-n+2) { background: #f5a524; }
.strength[data-score="3"] i:nth-child(-n+3) { background: #8bc34a; }
.strength[data-score="4"] i { background: var(--ok); }
.error-msg { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 20px; margin-bottom: 6px; }

/* ---------- modal, toast, lightbox ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 8, 20, .55); z-index: 100; display: grid; place-items: center; padding: 16px;
  animation: fade .15s ease; backdrop-filter: blur(3px);
}
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .2s ease; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.9); display: grid; place-items: center; cursor: zoom-out; animation: fade .15s; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; }
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: rise .2s ease; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.edit-cover { height: 140px; border-radius: 14px; background: var(--grad); background-size: cover; background-position: center; position: relative; margin-bottom: 50px; }
.edit-cover .avatar { position: absolute; left: 18px; bottom: -40px; border: 4px solid var(--surface); }
.img-pick { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.25); color: #fff; opacity: 0; transition: opacity .15s; cursor: pointer; border-radius: inherit; }
.edit-cover:hover > .img-pick, .avatar:hover > .img-pick { opacity: 1; }
.skeleton { height: 110px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton + .skeleton { border-top: 1px solid var(--border); }
@keyframes shimmer { to { background-position: -200% 0; } }
.load-more { display: block; width: 100%; padding: 14px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--accent); font-weight: 700; cursor: pointer; }

/* ---------- barra móvil ---------- */
.mobile-bar, .mobile-top { display: none; }

@media (max-width: 1180px) {
  .shell { grid-template-columns: 220px minmax(0, 620px); }
  .aside { display: none; }
}
/* Modo ancho: laboratorios y atlas usan todo el espacio (sin la columna derecha). */
@media (min-width: 861px) {
  body.ancho .shell { grid-template-columns: 230px minmax(0, 1fr); max-width: 1760px; }
  body.ancho .aside { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding: 0 16px; }
  .sidebar { display: none; }
  .main { padding-top: 0; padding-bottom: 90px; }
  .page-head { margin-top: 0; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 4px; }
  .mobile-top .brand { padding: 0; font-size: 20px; }
  .mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface);
    border-top: 1px solid var(--border); justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  }
  .mobile-bar a { padding: 8px 14px; color: var(--muted); position: relative; border-radius: 12px; }
  .mobile-bar a.active { color: var(--accent); }
  .mobile-bar .badge { position: absolute; top: 0; right: 4px; min-width: 16px; height: 16px; font-size: 10px; }
  .fab { position: fixed; right: 18px; bottom: 82px; z-index: 50; width: 56px; height: 56px; border-radius: 50%; padding: 0; }
  .dm { grid-template-columns: 1fr; height: calc(100vh - 160px); }
  .dm.has-chat .dm-list { display: none; }
  .dm:not(.has-chat) .dm-chat { display: none; }
  .dm-back { display: grid; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; min-height: 260px; }
  .auth-hero h1 { font-size: 34px; }
  .auth-features { display: none; }
  .cover { height: 140px; }
}
@media (min-width: 861px) { .fab { display: none; } }

/* ================= Atlas 3D ================= */
/* ---------- CORPUS · atlas 3D ---------- */
.ana-promo { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, color-mix(in srgb, #e8456b 10%, var(--surface)), color-mix(in srgb, var(--accent) 14%, var(--surface))); }
.ana-promo-ico { width: 56px; height: 56px; flex: none; border-radius: 16px; box-shadow: 0 8px 20px rgba(122, 92, 255, .3); }
.corpus-logo { width: 40px; height: 40px; flex: none; border-radius: 12px; display: block; }
#ana-root { container-type: inline-size; }
.ana { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "side" "info"; gap: 12px; align-items: start; }
.ana-stage { grid-area: stage; } .ana-side { grid-area: side; } .ana-info { grid-area: info; }
@container (min-width: 560px) { .ana { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "stage stage" "side info"; } }
@container (min-width: 1040px) { .ana { grid-template-columns: 240px minmax(0, 1fr) 330px; grid-template-areas: "side stage info"; } }
.ana:fullscreen { background: var(--bg); padding: 12px; grid-template-rows: 100%; height: 100vh; grid-template-columns: 240px minmax(0, 1fr) 330px; grid-template-areas: "side stage info"; }
.ana:fullscreen .ana-stage { height: 100%; }
.ana:fullscreen .ana-side, .ana:fullscreen .ana-info { max-height: 100%; }
.card.ana-side + .card, .ana .card + .card { margin-top: 0; }
.ana-side { padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: min(78vh, 760px); overflow: auto; }
.ana-brand { display: flex; align-items: center; gap: 10px; }
.ana-brand b { display: block; font-size: 17px; letter-spacing: .18em; }
.ana-brand span { font-size: 12px; color: var(--muted); }
.ana-sec-t { font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.ana-search { position: relative; }
.ana-search .input { padding: 9px 12px; font-size: 14px; width: 100%; }
.ana-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 32px rgba(0,0,0,.25); padding: 4px; max-height: 340px; overflow: auto; }
.ana-r { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.ana-r span:nth-child(2) { flex: 1; min-width: 0; }
.ana-r em { font-style: normal; font-size: 11px; color: var(--muted); }
.ana-r.on, .ana-r:hover { background: var(--surface-2); }
.ana-sys { display: flex; flex-direction: column; gap: 1px; }
.ana-sys-row { padding: 3px 6px; border-radius: 8px; }
.ana-sys-row:hover { background: var(--surface-2); }
.ana-sys-row label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.ana-sys-row input[type=checkbox] { accent-color: var(--accent); }
.ana-sys-n { flex: 1; }
.ana-load { font-size: 11px; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.ana-op { display: none; width: calc(100% - 24px); margin: 2px 0 4px 24px; height: 14px; accent-color: var(--accent); }
.ana-sys-row:has(input[type=checkbox]:checked) .ana-op { display: block; }
.ana-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.ana-reg, .ana-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.ana-btns { display: grid; gap: 6px; }
.ana-cred { font-size: 11px; color: var(--muted); line-height: 1.45; margin: 4px 0 0; }
.ana-cred a { color: inherit; text-decoration: underline; }
.ana-stage { position: relative; height: min(78vh, 760px); border-radius: var(--radius); overflow: hidden; background: radial-gradient(85% 75% at 50% 38%, #2f2950 0%, #17142a 62%, #0c0b16 100%); border: 1px solid var(--border); outline: none; }
.ana-stage:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }
.ana-stage canvas { width: 100% !important; height: 100% !important; display: block; cursor: grab; touch-action: none; }
.ana-stage canvas:active { cursor: grabbing; }
.ana-tools { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; z-index: 4; pointer-events: none; }
.ana-tgroup { display: flex; background: rgba(16, 13, 32, .72); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 3px; pointer-events: auto; }
.ana-tgroup button { background: none; border: 0; color: #e9e6ff; font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 10px; border-radius: 9px; cursor: pointer; min-width: 32px; }
.ana-tgroup button:hover { background: rgba(255,255,255,.12); }
.ana-tgroup button.on { background: var(--accent); color: #fff; }
.ana-tip { position: absolute; pointer-events: none; background: rgba(13,12,28,.92); color: #fff; padding: 6px 10px; border-radius: 9px; font-size: 13px; font-weight: 700; max-width: 300px; z-index: 5; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.ana-tip span { display: block; font-weight: 500; font-size: 11.5px; color: #c9c2ff; }
.ana-label { position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; background: #fff; color: #1b1530; font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; max-width: 70%; overflow: hidden; text-overflow: ellipsis; z-index: 3; box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.ana-hint { position: absolute; left: 12px; right: 12px; bottom: 10px; color: rgba(255,255,255,.55); font-size: 12px; pointer-events: none; text-align: center; }
.ana-loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12,11,22,.72); z-index: 6; }
.ana-loading[hidden] { display: none; }
.ana-loading.ana-loading-min { inset: auto 12px 36px auto; background: rgba(16,13,32,.85); border-radius: 14px; padding: 10px 12px; }
.ana-loading.ana-loading-min .corpus-logo, .ana-loading.ana-loading-min .ana-loading-t { display: none; }
.ana-loading-in { display: grid; justify-items: center; gap: 10px; color: #fff; text-align: center; width: min(320px, 80%); }
.ana-loading-in .corpus-logo { width: 64px; height: 64px; border-radius: 18px; animation: corpus-pulso 1.4s ease-in-out infinite; }
.ana-loading-t { font-weight: 800; }
.ana-loading .small { color: rgba(255,255,255,.7); }
.ana-bar { width: 100%; min-width: 180px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.ana-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7a5cff, #e8456b); transition: width .2s; }
@keyframes corpus-pulso { 50% { transform: scale(1.07); } }
.ana-tourbox { position: absolute; left: 50%; bottom: 36px; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); background: var(--surface); color: var(--text); border-radius: 16px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.35); z-index: 7; }
.ana-info { padding: 16px 18px; max-height: min(78vh, 760px); overflow: auto; }
.ana-bienv { display: flex; gap: 12px; align-items: flex-start; }
.ana-bienv .corpus-logo { width: 52px; height: 52px; border-radius: 15px; }
.ana-crumbs { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ana-title { margin: 8px 0 4px; font-size: 22px; letter-spacing: -.01em; line-height: 1.2; }
.ana-pieza { font-size: 13px; background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 10px; padding: 6px 10px; margin: 6px 0; }
.ana-acc { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.ana-lead { font-size: 15px; line-height: 1.6; margin: 8px 0 0 !important; }
.ana-info h4 { margin: 16px 0 6px; font-size: 14px; color: var(--accent); }
.ana-info p { margin: 0; line-height: 1.62; }
.ana-ul { margin: 4px 0; padding-left: 20px; line-height: 1.6; }
.ana-ul li + li { margin-top: 4px; }
.ana-sys-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text); }
.ana-sys-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ana-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.ana-link:hover { text-decoration: underline; }
.ana-info .callout { margin-top: 14px; }
.ana-info .callout .ana-ul { margin-top: 6px; }
.ana-teclas { margin-top: 14px; line-height: 1.5; }
@media (max-width: 860px) {
  .ana-stage { height: 64vh; }
  .ana-side { max-height: none; }
  .ana-sys { display: grid; grid-template-columns: 1fr 1fr; }
  .ana-hint { display: none; }
  .ana-tgroup button { padding: 6px 8px; font-size: 12px; }
}

/* ================= Llamadas ================= */
.verif { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 10px; font-weight: 800; margin-left: 4px; flex: none; vertical-align: middle; }
.call-btn { font-size: 18px; }
#llamada { position: fixed; inset: 0; z-index: 300; background: radial-gradient(120% 90% at 50% 30%, #2a2148, #0d1020 70%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; animation: fade .2s; }
#llamada [hidden] { display: none !important; }
#llamada.con-video .ll-barra { background: rgba(0,0,0,.45); }
#llamada .ll-remoto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
#llamada .ll-centro { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
#llamada .ll-centro .avatar { box-shadow: 0 0 0 8px rgba(109,74,255,.25), 0 0 0 18px rgba(109,74,255,.12); animation: ll-pulso 2s infinite; }
#llamada h2 { margin: 18px 0 0; font-size: 26px; }
.ll-estado { color: rgba(255,255,255,.75); display: flex; gap: 8px; }
.ll-tiempo { font-variant-numeric: tabular-nums; }
#llamada .ll-local { position: absolute; right: 20px; top: 20px; width: 200px; max-width: 32vw; aspect-ratio: 3/4; object-fit: cover; border-radius: 16px; border: 2px solid rgba(255,255,255,.4); background: #000; transform: scaleX(-1); }
.ll-barra { position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%); display: flex; gap: 16px; padding: 12px 18px; border-radius: 999px; background: rgba(0,0,0,.35); backdrop-filter: blur(10px); }
.ll-btn { width: 58px; height: 58px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 24px; display: grid; place-items: center; cursor: pointer; transition: transform .1s; }
.ll-btn:hover { transform: scale(1.06); } .ll-btn.off { background: rgba(255,255,255,.4); }
.ll-btn.rojo { background: #e5484d; } .ll-btn.verde { background: #19a974; }
#llamada.mini { inset: auto 20px 110px auto; width: 300px; height: 200px; border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.4); overflow: hidden; }
#llamada.mini h2, #llamada.mini .ll-local { display: none; }
#llamada.mini .ll-centro .avatar { width: 56px !important; height: 56px !important; font-size: 20px !important; }
#llamada.mini .ll-barra { bottom: 10px; gap: 8px; padding: 6px 10px; }
#llamada.mini .ll-btn { width: 40px; height: 40px; font-size: 18px; }
@keyframes ll-pulso { 50% { box-shadow: 0 0 0 14px rgba(109,74,255,.18), 0 0 0 28px rgba(109,74,255,.06); } }
@media (max-width: 860px) { #llamada .ll-local { width: 110px; right: 12px; top: 12px; } #llamada.mini { right: 12px; bottom: 150px; width: 220px; height: 160px; } }

/* ================= Música ================= */
.mu-hero { display: flex; gap: 14px; align-items: center; padding: 16px 18px; background: linear-gradient(135deg, color-mix(in srgb, #10b981 14%, var(--surface)), color-mix(in srgb, var(--accent) 12%, var(--surface))); }
.mu-hero-ico { width: 46px; height: 46px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.mu-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 4px; }
.chip-btn { cursor: pointer; font: inherit; font-size: 12.5px; color: inherit; }
.chip-btn.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.song-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; transition: background .12s; }
.song-row + .song-row { border-top: 1px solid var(--border); }
.song-row:hover, .song-row.playing { background: var(--surface-2); }
.song-row.playing .name { color: var(--accent); }
.song-play { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; cursor: pointer; flex: none; }
.song-row.playing .song-play { background: var(--grad); color: #fff; }
.song-cover { border-radius: 10px; object-fit: cover; flex: none; display: block; }
.song-cover-empty { display: grid; place-items: center; background: linear-gradient(135deg, #2a2148, #6d4aff); color: #fff; }
.song-meta { flex: 1; min-width: 0; }
.song-tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.song-dur { width: 42px; text-align: right; flex: none; }
.mu-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 34px 16px; border: 2px dashed var(--border); border-radius: 16px; cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s; }
.mu-drop b { color: var(--text); }
.mu-drop:hover, .mu-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.mu-drop .icon { width: 34px; height: 34px; color: var(--accent); }
#mf-detect .callout { margin: 12px 0; }
.mu-form-top { display: flex; gap: 14px; align-items: flex-start; }
.mu-cover-pick { width: 112px; height: 112px; border-radius: 14px; flex: none; position: relative; overflow: hidden; cursor: pointer; display: grid; place-items: center; background: linear-gradient(135deg, #2a2148, #6d4aff); color: #fff; margin-top: 4px; }
.mu-cover-pick img { width: 100%; height: 100%; object-fit: cover; }
.mu-cover-pick:hover .img-pick { opacity: 1; }
.mu-progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 6px 0 12px; }
.mu-progress span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
#player-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-template-columns: 1fr minmax(0, 1.4fr) 1fr; gap: 16px; align-items: center;
  padding: 10px 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0,0,0,.08); }
#player-bar[hidden] { display: none; }
body.has-player .main { padding-bottom: 110px; }
.pl-info { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pl-text { min-width: 0; }
.pl-center { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.pl-controls { display: flex; gap: 10px; align-items: center; }
.pl-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); color: var(--surface); display: grid; place-items: center; cursor: pointer; }
.pl-progress { display: flex; gap: 8px; align-items: center; width: 100%; }
.pl-progress input, .pl-right input { flex: 1; accent-color: var(--accent); }
.pl-right { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.pl-right input { max-width: 110px; }

/* ================= Onda IA ================= */
.ia-avatar { border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: conic-gradient(from 200deg, #6d4aff, #ff4f95, #f2b868, #5fc2c0, #6d4aff); box-shadow: 0 4px 14px -4px #6d4aff; }
.ia-page { display: flex; flex-direction: column; height: calc(100vh - 44px); }
.ia-head { margin-bottom: 0 !important; }
.ia-chat { flex: 1; overflow-y: auto; padding: 14px 4px; display: flex; flex-direction: column; gap: 14px; }
.ia-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 100%; }
.ia-msg.mine { justify-content: flex-end; }
.ia-bubble { padding: 10px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); max-width: 100%; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; }
.ia-msg.mine .ia-bubble { background: var(--grad); color: #fff; border: 0; border-bottom-right-radius: 6px; max-width: 80%; }
.ia-msg:not(.mine) .ia-bubble { border-top-left-radius: 6px; }
.ia-bubble.md p:first-child { margin-top: 0; } .ia-bubble.md p:last-child { margin-bottom: 0; }
.ia-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ia-source { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ia-source:hover { text-decoration: underline; }
.ia-typing { display: flex; gap: 5px; padding: 14px 16px; }
.ia-typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: ia-dot 1.2s infinite ease-in-out; }
.ia-typing i:nth-child(2) { animation-delay: .15s; } .ia-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ia-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.ia-empty { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ia-empty h2 { margin: 10px 0 0; letter-spacing: -.02em; }
.ia-empty p { max-width: 46ch; margin: 0 0 12px; }
.ia-sugs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; max-width: 560px; }
.ia-sug { text-align: left; display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-size: 14px; color: inherit; transition: border-color .15s, transform .1s; }
.ia-sug:hover { border-color: var(--accent); transform: translateY(-1px); }
.ia-composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 8px 8px 14px; border-radius: 22px; }
.ia-composer .textarea { background: transparent; border: 0; box-shadow: none; padding: 8px 0; min-height: 0; resize: none; font-size: 15px; }
.ia-send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
#ia-fab { position: fixed; right: 26px; bottom: 26px; z-index: 55; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: conic-gradient(from 200deg, #6d4aff, #ff4f95, #f2b868, #5fc2c0, #6d4aff); box-shadow: 0 10px 26px -8px #6d4aff; transition: transform .15s; }
#ia-fab:hover { transform: scale(1.06); }
#ia-fab[hidden] { display: none; }
body.has-player #ia-fab { bottom: 104px; }

/* ================= Juegos ================= */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.games-grid .card + .card { margin-top: 0; }
.game-card { overflow: hidden; transition: transform .12s; }
.game-card:hover { transform: translateY(-2px); }
.game-cover { height: 150px; display: grid; place-items: center; font-size: 64px; background: linear-gradient(135deg, #161a33, #f2b868); }
.game-cover.has-logo { background: radial-gradient(120% 90% at 25% 60%, #3a2a3d 0%, #161a33 55%, #0d1020 100%); padding: 10px 14px; }
.game-cover.has-logo svg { width: 100%; height: 100%; }
.game-frame { overflow: hidden; background: #000; aspect-ratio: 16 / 10; max-height: calc(100vh - 140px); }
.game-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
@media (max-width: 860px) {
  .game-frame { aspect-ratio: auto; height: calc(100vh - 200px); }
  #player-bar { bottom: calc(58px + env(safe-area-inset-bottom)); grid-template-columns: minmax(0, 1fr) auto; padding: 8px 12px; gap: 8px; }
  .pl-right, .pl-progress { display: none; }
  .pl-center { flex-direction: row; }
  body.has-player .main { padding-bottom: 170px; }
  #ia-fab { left: 16px; right: auto; bottom: 82px; width: 50px; height: 50px; }
  body.has-player #ia-fab { bottom: 146px; }
  .ia-page { height: calc(100vh - 190px); }
  .ia-sugs { grid-template-columns: 1fr; }
  .mu-form-top { flex-direction: column; align-items: center; }
  .song-dur { display: none; }
}

/* ================= Estudiar (simulador ULEAM) ================= */
.icon.flip { transform: rotate(180deg); color: var(--muted); }
.onboard .hero-study { text-align: center; padding: 10px 0 18px; }
.hero-emoji { font-size: 46px; }
.hero-study h2 { margin: 6px 0; letter-spacing: -.02em; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 18px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface-2); cursor: pointer; transition: border-color .15s, transform .1s; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.choice-emoji { font-size: 30px; }
select.input { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; line-height: 1.55; }
.callout.note { background: color-mix(in srgb, #0ea5e9 9%, var(--surface)); border-color: color-mix(in srgb, #0ea5e9 30%, transparent); }
.callout.key { background: color-mix(in srgb, var(--accent-2) 9%, var(--surface)); border-color: color-mix(in srgb, var(--accent-2) 35%, transparent); }
.study-hero { display: flex; align-items: center; gap: 16px; padding: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--accent-2) 10%, var(--surface))); }
.study-hero > div:first-child { flex: 1; min-width: 0; }
.study-hero h2 { margin: 10px 0 2px; font-size: 21px; letter-spacing: -.02em; }
.pill-lg { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.pill.hot { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; flex: none; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--surface) 78%, transparent 80% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border) 0); }
.ring span { font-size: 22px; font-weight: 800; line-height: 1; }
.ring small { font-size: 11px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.stat-grid .card + .card { margin-top: 0; }
.stat { padding: 14px; text-align: center; }
.stat-n { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 10px 0 6px; }
.bar span { display: block; height: 100%; border-radius: 4px; transition: width .4s; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.subject-grid .card + .card { margin-top: 0; }
.subject { display: block; padding: 16px; border-top: 4px solid var(--c); transition: transform .12s; }
.subject:hover { transform: translateY(-2px); }
.subject-emoji { font-size: 28px; margin-bottom: 6px; }
.sim-card { display: flex; align-items: center; gap: 14px; }
.sim-card > div { flex: 1; }
.result-row { padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.plan-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.plan-item + .plan-item { border-top: 1px dashed var(--border); }
.plan-item.done b { text-decoration: line-through; color: var(--muted); }
.plan-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.plan-day { display: flex; gap: 14px; padding: 10px 16px; }
.plan-day + .plan-day { border-top: 1px solid var(--border); }
.plan-day.today { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.plan-day.past { opacity: .7; }
.plan-date { width: 92px; flex: none; font-weight: 700; font-size: 13px; padding-top: 12px; text-transform: capitalize; }
.plan-date .pill { margin-left: 4px; background: var(--accent); color: #fff; }
.topic-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.topic-row + .topic-row { border-top: 1px solid var(--border); }
.topic-row:hover { background: var(--surface-2); }
.topic-num { width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; }
.lvl-dots { display: inline-flex; gap: 3px; }
.lvl-dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--border); }
.lvl-dots i.on { background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.level-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.level-tab { display: flex; gap: 8px; align-items: flex-start; padding: 10px; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); position: relative; }
.level-tab b { display: block; font-size: 13.5px; }
.level-tab small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.level-tab.active { border-color: var(--accent); background: var(--accent-soft); }
.lvl-n { width: 24px; height: 24px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; font-size: 12px; display: grid; place-items: center; flex: none; }
.lvl-ok { position: absolute; top: 6px; right: 8px; color: var(--ok); font-weight: 800; font-size: 12px; }
.tema-nav { margin-top: 14px; flex-wrap: wrap; }
.md { font-size: 15.5px; line-height: 1.7; }
.md h3 { font-size: 19px; margin: 22px 0 8px; letter-spacing: -.01em; }
.md h3:first-child, .md h4:first-child { margin-top: 0; }
.md h4 { font-size: 16.5px; margin: 18px 0 6px; color: var(--accent); }
.md h5 { font-size: 15px; margin: 14px 0 4px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 6px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md mark { background: color-mix(in srgb, #facc15 40%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
.md code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.md .callout { margin: 12px 0; }
.md-table { overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); border-radius: 12px; }
.md-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md-table th, .md-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); font-weight: 700; }
.md-table tr:last-child td { border-bottom: 0; }
.q { margin-bottom: 12px; }
.card.q + .card.q { margin-top: 0; }
.q-head { display: flex; gap: 12px; }
.q-fuente { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px; }
.q-num { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; flex: none; font-size: 13px; }
.q-text { flex: 1; min-width: 0; font-weight: 600; }
.q-text p { margin: 2px 0 6px; }
.q-opts { display: grid; gap: 8px; margin-top: 10px; }
.q-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; transition: border-color .12s, background .12s; position: relative; }
.q-opt:hover { border-color: var(--accent); }
.q-opt input { position: absolute; opacity: 0; pointer-events: none; }
.q-letter { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; text-transform: uppercase; }
.q-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.q-opt:has(input:checked) .q-letter { background: var(--accent); border-color: var(--accent); color: #fff; }
.q-opt.is-right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.q-opt.is-right .q-letter { background: var(--ok); border-color: var(--ok); color: #fff; }
.q-opt.is-wrong { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.q-opt.is-wrong .q-letter { background: var(--danger); border-color: var(--danger); color: #fff; }
.q-exp { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14.5px; }
.q-exp p { margin: 4px 0; }
.sticky-submit { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 10px; z-index: 4; }
.result-card { text-align: center; margin: 14px 0; }
.result-big { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.result-big small { font-size: 18px; color: var(--muted); }
.result-card.pass .result-big { color: var(--ok); }
.result-card.fail .result-big { color: var(--danger); }
.sim-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; text-align: left; }
.sim-breakdown > div { display: grid; grid-template-columns: 1fr auto; font-size: 14px; }
.sim-breakdown .bar { grid-column: 1 / -1; margin: 6px 0 0; }
.sim-bar { position: sticky; top: 8px; z-index: 6; display: flex; align-items: center; gap: 14px; padding: 10px 16px; margin-bottom: 8px; }
.sim-bar #sim-time { font-size: 20px; font-variant-numeric: tabular-nums; }
.sim-bar #sim-time.low { color: var(--danger); }
.clean-list { margin: 0; padding-left: 20px; line-height: 1.8; }
.lectura { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.lectura + .lectura { border-top: 1px dashed var(--border); }
.lectura:hover b { color: var(--accent); }
.lectura-ico, .libro-ico { font-size: 22px; flex: none; }
.libro { display: flex; align-items: flex-start; gap: 14px; padding: 14px 18px; }
.libro + .libro { border-top: 1px solid var(--border); }
.libro:hover { background: var(--surface-2); }
.libro .btn { flex: none; align-self: center; }
@media (max-width: 860px) {
  .level-tabs { grid-template-columns: 1fr 1fr; }
  .stat-grid { gap: 8px; }
  .stat-n { font-size: 19px; }
  .form-row, .choice-grid { grid-template-columns: 1fr; }
  .study-hero { padding: 16px; }
  .ring { width: 76px; height: 76px; }
  .plan-day { flex-direction: column; gap: 0; }
  .plan-date { padding-top: 4px; }
  .sim-bar { top: 4px; }
  .mobile-bar a { padding: 8px 10px; }
}

/* ---------- Laboratorio ---------- */
.lab-promo-ico { display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, #1fb58f, #3d8bfd); }
.lab-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.lab-tab { flex: none; padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 700; font-size: 14px; color: var(--text); text-decoration: none; }
.lab-tab.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lab-card + .lab-card { margin-top: 14px; }
.lab-h { margin: 0 0 6px; font-size: 18px; }
.lab-fila { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.lab-fila .input { flex: 1; min-width: 180px; }
.lab-fila select.input { min-width: 220px; }
#lab-cuerpo textarea.input { width: 100%; font-family: ui-monospace, Consolas, monospace; margin: 8px 0; }
.lab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 10px; margin: 10px 0; }
.lab-f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.lab-f span { line-height: 1.25; }
.lab-f .input { padding: 8px 10px; font-size: 14px; color: var(--text); }
.lab-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0 10px; }
.lab-check input { accent-color: var(--accent); }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.lab-seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin: 8px 0; }
.lab-seg button { flex: 1 1 auto; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 700; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.lab-seg button.on { background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.12); color: var(--accent); }
.lab-ecuacion { font-size: 21px; font-weight: 600; padding: 14px 16px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 9%, var(--surface)); margin: 10px 0; overflow-x: auto; white-space: nowrap; }
.lab-coef { color: var(--accent); margin-right: 1px; }
.lab-flecha { margin: 0 8px; color: var(--muted); }
.lab-tipo { font-size: 14px; margin-bottom: 8px; }
.lab-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; display: block; overflow-x: auto; }
.lab-tabla th, .lab-tabla td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.lab-tabla th { font-size: 12px; color: var(--muted); font-weight: 700; }
.lab-lim td { background: color-mix(in srgb, #e8456b 10%, transparent); }
.lab-barra { position: relative; min-width: 120px; height: 18px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.lab-barra i { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 45%, transparent); }
.lab-barra span { position: relative; padding-left: 6px; font-size: 12px; font-weight: 700; }
.lab-chart { position: relative; height: 300px; margin: 12px 0 6px; }
.lab-chart-alto { height: 360px; }
.lab-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 10px 0; }
.lab-kpis > div { background: var(--surface-2); border-radius: 12px; padding: 9px 12px; }
.lab-kpis span { display: block; font-size: 12px; color: var(--muted); }
.lab-kpis b { font-size: 16px; word-break: break-word; }
.lab-pasos { margin: 8px 0; padding-left: 22px; line-height: 1.65; }
.lab-pasos li + li { margin-top: 3px; }
.lab-ej { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-top: 10px; }
.lab-ej-q { font-size: 16px; font-weight: 600; margin: 4px 0 2px; line-height: 1.5; }
.lab-teoria { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; }
.lab-teoria summary { cursor: pointer; padding: 10px 14px; font-weight: 700; }
.lab-teoria-in { padding: 0 14px 12px; line-height: 1.65; font-size: 14px; }
.lab-teoria-in p { margin: 8px 0; }
.lab-reactor-ilu { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lab-reactor-ilu svg { width: 96px; height: 64px; color: var(--text); flex: none; }
.lab-fuentes { margin: 14px 2px 4px; line-height: 1.5; }
.lab-fuentes a { color: inherit; text-decoration: underline; }
#lab-cuerpo code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

/* ---------- Laboratorio de electrónica ---------- */
.el { display: grid; grid-template-columns: 200px minmax(0, 1fr) 360px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "barra barra barra" "paleta lienzo panel"; gap: 10px; height: min(82vh, 860px); }
.el .card + .card { margin-top: 0; }
.el-barra { grid-area: barra; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; }
.el-sel { width: auto; padding: 6px 8px; font-size: 13px; max-width: 220px; }
.el-sep { width: 1px; height: 22px; background: var(--border); }
.el-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.el-chk input { accent-color: var(--accent); }
.el-estado { font-size: 12.5px; color: var(--muted); margin-left: auto; max-width: 420px; }
.el.simulando .el-estado { color: var(--accent); font-weight: 700; }
.el-paleta { grid-area: paleta; padding: 8px; overflow: auto; }
.el-paleta .input { padding: 7px 9px; font-size: 13px; margin-bottom: 6px; }
.el-cat-t { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 10px 4px 4px; }
.el-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.el-item:hover { background: var(--surface-2); color: var(--accent); }
.el-lienzo { grid-area: lienzo; position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border); outline: none; cursor: grab;
  background-color: #f6f7fb; background-image: radial-gradient(circle, #cfd3e0 1px, transparent 1.2px); background-size: 19.2px 19.2px; }
.el-lienzo:active { cursor: grabbing; }
.el-mundo { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.el-cables { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; z-index: 3; pointer-events: none; }
.el-cable { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; pointer-events: stroke; cursor: pointer; }
.el-cable-sombra { fill: none; stroke: rgba(0,0,0,.25); stroke-width: 5; stroke-linejoin: round; }
.el-cable.sel { stroke-width: 4.5; filter: drop-shadow(0 0 3px #7a5cff); }
.el-cable.nuevo { stroke-dasharray: 6 4; pointer-events: none; }
.el-comp { position: absolute; z-index: 2; cursor: move; user-select: none; }
.el-comp > * { display: block; }
.el-comp.sel { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 4px; }
.el-comp:has(ondas-protoboard) { z-index: 1; }
.el-pin { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; z-index: 4; cursor: crosshair; }
.el-pin:hover { background: rgba(122, 92, 255, .55); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7a5cff; }
.el-tip { position: absolute; z-index: 9; pointer-events: none; background: rgba(13,12,28,.9); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 7px; }
.el-ayuda { position: absolute; left: 10px; bottom: 8px; right: 110px; font-size: 11.5px; color: #8a8fa3; pointer-events: none; }
.el-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; z-index: 6; }
.el-zoom button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 800; cursor: pointer; }
.el-panel { grid-area: panel; padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.el-tabs { display: flex; border-bottom: 1px solid var(--border); }
.el-tabs button { flex: 1; background: none; border: 0; padding: 10px 6px; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.el-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.el-p { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px; gap: 6px; overflow: auto; }
.el-p[hidden] { display: none; }
.el-placa { font-size: 13px; }
.el-editor { position: relative; flex: 1; min-height: 240px; display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #1b1d2a; }
.el-lineas { margin: 0; padding: 10px 6px; text-align: right; color: #5d6380; background: #15161f; font: 12.5px/1.5 ui-monospace, Consolas, monospace; overflow: hidden; user-select: none; min-width: 34px; }
.el-editor textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: #e6e8f2; font: 12.5px/1.5 ui-monospace, Consolas, monospace; padding: 10px; white-space: pre; tab-size: 2; }
.el-hex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.el-serial-bar { display: flex; align-items: center; justify-content: space-between; }
.el-serial { flex: 1; min-height: 160px; margin: 0; background: #0f1117; color: #8cf0a8; font: 12.5px/1.45 ui-monospace, Consolas, monospace; padding: 8px 10px; border-radius: 10px; overflow: auto; white-space: pre-wrap; }
.el-plot { height: 200px; position: relative; }
.el-props-t { font-weight: 800; font-size: 15px; color: var(--text); margin-bottom: 6px; }
#el-props { color: var(--text); }
#el-props p { margin: 6px 0; }
.el-ctrl { display: grid; gap: 8px; margin: 10px 0; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.el-medidas div { font-size: 13px; padding: 3px 0; }
.el-alerta { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, #e8456b 15%, transparent); }
.el-colores { display: flex; gap: 6px; margin: 8px 0; }
.el-colores button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
@media (max-width: 1250px) { .el { grid-template-columns: 170px minmax(0, 1fr); grid-template-areas: "barra barra" "paleta lienzo" "panel panel"; height: auto; grid-template-rows: auto 62vh 480px; } }
@media (max-width: 760px) { .el { grid-template-columns: 1fr; grid-template-areas: "barra" "lienzo" "paleta" "panel"; grid-template-rows: auto 60vh 220px 480px; } }
/* ---------- Laboratorio de física ---------- */
.fx-exps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fx-exps .chip.on { background: var(--accent); color: #fff; }
.fx-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.fx-canvas { width: 100%; height: 380px; display: block; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.fx-datos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .fx-grid, .fx-datos { grid-template-columns: 1fr; } .fx-canvas { height: 300px; } }
/* ---------- Simulador de física ---------- */
.sb-bar { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.sb-h { border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; font-weight: 700; padding: 7px 10px; border-radius: 9px; cursor: pointer; }
.sb-h.on { background: var(--accent); color: #fff; }
.sb-bar2 { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin: 10px 0; }
.sb-bar2 .lab-f { min-width: 160px; }
.sb-wrap { position: relative; }
#sb-cv { width: 100%; height: min(62vh, 560px); display: block; border-radius: 14px; touch-action: none; cursor: crosshair; }
.sb-info { position: absolute; top: 10px; right: 10px; background: rgba(13,12,28,.85); color: #fff; font-size: 12.5px; line-height: 1.5; padding: 8px 12px; border-radius: 10px; pointer-events: none; }
.sb-info[hidden] { display: none; }
